xref: /llvm-project/flang/include/flang/Optimizer/Dialect/FIROps.h (revision c6b6e18c4d25305ab98b6eab752de99ea4e15344)
1 //===-- Optimizer/Dialect/FIROps.h - FIR operations -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef FORTRAN_OPTIMIZER_DIALECT_FIROPS_H
10 #define FORTRAN_OPTIMIZER_DIALECT_FIROPS_H
11 
12 #include "flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h"
13 #include "flang/Optimizer/Dialect/FIRAttr.h"
14 #include "flang/Optimizer/Dialect/FIRType.h"
15 #include "flang/Optimizer/Dialect/FirAliasTagOpInterface.h"
16 #include "flang/Optimizer/Dialect/FortranVariableInterface.h"
17 #include "mlir/Dialect/Arith/IR/Arith.h"
18 #include "mlir/Dialect/Func/IR/FuncOps.h"
19 #include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
20 #include "mlir/Interfaces/LoopLikeInterface.h"
21 #include "mlir/Interfaces/SideEffectInterfaces.h"
22 
23 namespace fir {
24 
25 class FirEndOp;
26 class DoLoopOp;
27 class RealAttr;
28 
29 void buildCmpCOp(mlir::OpBuilder &builder, mlir::OperationState &result,
30                  mlir::arith::CmpFPredicate predicate, mlir::Value lhs,
31                  mlir::Value rhs);
32 unsigned getCaseArgumentOffset(llvm::ArrayRef<mlir::Attribute> cases,
33                                unsigned dest);
34 DoLoopOp getForInductionVarOwner(mlir::Value val);
35 mlir::ParseResult isValidCaseAttr(mlir::Attribute attr);
36 mlir::ParseResult parseCmpcOp(mlir::OpAsmParser &parser,
37                               mlir::OperationState &result);
38 mlir::ParseResult parseSelector(mlir::OpAsmParser &parser,
39                                 mlir::OperationState &result,
40                                 mlir::OpAsmParser::UnresolvedOperand &selector,
41                                 mlir::Type &type);
42 
getNormalizedLowerBoundAttrName()43 static constexpr llvm::StringRef getNormalizedLowerBoundAttrName() {
44   return "normalized.lb";
45 }
46 
47 /// Model operations which affect global debugging information
48 struct DebuggingResource
49     : public mlir::SideEffects::Resource::Base<DebuggingResource> {
getNameDebuggingResource50   mlir::StringRef getName() final { return "DebuggingResource"; }
51 };
52 
53 } // namespace fir
54 
55 #define GET_OP_CLASSES
56 #include "flang/Optimizer/Dialect/FIROps.h.inc"
57 
58 #endif // FORTRAN_OPTIMIZER_DIALECT_FIROPS_H
59