13#ifndef CLANG_CIR_DIALECT_IR_CIRDIALECT_H
14#define CLANG_CIR_DIALECT_IR_CIRDIALECT_H
16#include "mlir/IR/Builders.h"
17#include "mlir/IR/BuiltinOps.h"
18#include "mlir/IR/BuiltinTypes.h"
19#include "mlir/IR/OpDefinition.h"
20#include "mlir/Interfaces/SideEffectInterfaces.h"
23#include "clang/CIR/Dialect/IR/CIROpsDialect.h.inc"
30#include "llvm/TargetParser/Triple.h"
35 llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>;
37 mlir::OpBuilder &, mlir::Location, mlir::OperationState &)>;
45 :
public mlir::SideEffects::Resource::Base<
46 FloatingPointEnvironmentResource> {
47 mlir::StringRef
getName() const final {
return "FloatingPointEnvironment"; }
51template <
typename ConcreteType>
57 FPEnvConstrainedOpInterface fenvOp = getFenvOp();
58 if (fenvOp.getFenvExceptionMode() == cir::FPExceptionMode::Masked &&
59 !fenvOp.getFenvStrictExcept())
60 return mlir::Speculation::Speculatable;
62 return mlir::Speculation::NotSpeculatable;
67 if (!getFenvOp().getFenvAttr())
69 effects.emplace_back(mlir::MemoryEffects::Read::get(),
70 FloatingPointEnvironmentResource::get());
71 effects.emplace_back(mlir::MemoryEffects::Write::get(),
72 FloatingPointEnvironmentResource::get());
76 FPEnvConstrainedOpInterface getFenvOp() {
77 return mlir::cast<FPEnvConstrainedOpInterface>(this->getOperation());
86 typename Op::Properties properties{};
87 Op::populateDefaultProperties(
88 mlir::OperationName(Op::getOperationName(), context), properties);
94RecordLayoutAttr
getRecordLayout(mlir::ModuleOp mod, mlir::StringAttr name);
107#define GET_OP_CLASSES
108#include "clang/CIR/Dialect/IR/CIROps.h.inc"
126 const mlir::DataLayout &dataLayout);
llvm::function_ref< void(mlir::OpBuilder &, mlir::Location)> BuilderCallbackRef
llvm::function_ref< void( mlir::OpBuilder &, mlir::Location, mlir::OperationState &)> BuilderOpStateCallbackRef
mlir::Speculation::Speculatability getSpeculatability()
void getEffects(llvm::SmallVectorImpl< mlir::MemoryEffects::EffectInstance > &effects)
RecordLayoutAttr tryGetRecordLayout(mlir::ModuleOp mod, mlir::StringAttr name)
Same lookup as getRecordLayout, but returns a null attribute instead of asserting when the record has...
RecordLayoutAttr getRecordLayout(mlir::ModuleOp mod, mlir::StringAttr name)
Look up the RecordLayoutAttr for a named record in the module's cir.record_layouts dictionary.
Op::Properties getDefaultProperties(mlir::MLIRContext *context)
The properties of Op with every ODS-declared default applied.
uint64_t getVTableEntrySize(mlir::ModuleOp mod, const mlir::DataLayout &dataLayout)
The size in bytes of an entry of a C++ vtable in module.
void buildTerminatedBody(mlir::OpBuilder &builder, mlir::Location loc)
bool usesRelativeVTables(mlir::ModuleOp mod)
Whether the C++ vtables of module use the relative layout.
AllocaOp getUnderlyingAlloca(mlir::Value addr)
The alloca that defines addr, looking through casts that preserve the underlying storage.
std::optional< llvm::Triple > getTripleFromModule(mlir::ModuleOp mod)
Attempts to construct an llvm::Triple from a module's cir.triple attribute.
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
The process floating-point environment, including its rounding mode and exception state.
bool isAddressable() const final
mlir::StringRef getName() const final