|
28 | 28 |
|
29 | 29 | #include "mlir/Dialect/Func/IR/FuncOps.h" |
30 | 30 | #include "mlir/Dialect/LLVMIR/LLVMTypes.h" |
| 31 | +#include "mlir/IR/Attributes.h" |
31 | 32 | #include "mlir/IR/Builders.h" |
32 | 33 | #include "mlir/IR/BuiltinAttributes.h" |
33 | 34 | #include "mlir/IR/BuiltinTypes.h" |
@@ -55,6 +56,8 @@ using namespace mlir; |
55 | 56 | #include "clang/CIR/Interfaces/ASTAttrInterfaces.h" |
56 | 57 | #include "clang/CIR/Interfaces/CIROpInterfaces.h" |
57 | 58 | #include <clang/CIR/MissingFeatures.h> |
| 59 | +#include <clang/CIR/Dialect/IR/CIRTypes.h> |
| 60 | +#include <clang/CIR/Dialect/IR/CIRDialect.h> |
58 | 61 |
|
59 | 62 | //===----------------------------------------------------------------------===// |
60 | 63 | // CIR Dialect |
@@ -304,6 +307,12 @@ static void printOmittedTerminatorRegion(mlir::OpAsmPrinter &printer, |
304 | 307 | } |
305 | 308 | } |
306 | 309 |
|
| 310 | +mlir::ParseResult parseAddressSpaceValue(mlir::AsmParser &p, |
| 311 | + mlir::Attribute &attr); |
| 312 | + |
| 313 | +void printAddressSpaceValue(mlir::AsmPrinter &printer, cir::GlobalOp op, |
| 314 | + mlir::Attribute attr); |
| 315 | + |
307 | 316 | //===----------------------------------------------------------------------===// |
308 | 317 | // AllocaOp |
309 | 318 | //===----------------------------------------------------------------------===// |
@@ -2481,17 +2490,7 @@ cir::GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) { |
2481 | 2490 | if (auto g = dyn_cast<GlobalOp>(op)) { |
2482 | 2491 | symTy = g.getSymType(); |
2483 | 2492 | // Convert enum to attribute for comparison |
2484 | | - cir::AddressSpace symAddrSpace = g.getAddrSpace(); |
2485 | | - if (symAddrSpace == cir::AddressSpace::Default) { |
2486 | | - symAddrSpaceAttr = {}; |
2487 | | - } else if (cir::isTargetAddressSpace(symAddrSpace)) { |
2488 | | - unsigned targetAS = |
2489 | | - cir::getTargetAddressSpaceValueFromCIRAS(symAddrSpace); |
2490 | | - symAddrSpaceAttr = |
2491 | | - cir::TargetAddressSpaceAttr::get(getContext(), targetAS); |
2492 | | - } else { |
2493 | | - symAddrSpaceAttr = cir::AddressSpaceAttr::get(getContext(), symAddrSpace); |
2494 | | - } |
| 2493 | + symAddrSpaceAttr = g.getAddrSpace(); |
2495 | 2494 | // Verify that for thread local global access, the global needs to |
2496 | 2495 | // be marked with tls bits. |
2497 | 2496 | if (getTls() && !g.getTlsModel()) |
|
0 commit comments