[Mlir-commits] [mlir] [MLIR][LLVM] Implement LLVM dialect support for global aliases (PR #125295)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Tue Feb 4 11:49:54 PST 2025
================
@@ -952,6 +962,42 @@ ModuleImport::getOrCreateNamelessSymbolName(llvm::GlobalVariable *globalVar) {
return symbolRef;
}
+LogicalResult ModuleImport::convertAlias(llvm::GlobalAlias *alias) {
+ // Insert the global after the last one or at the start of the module.
+ OpBuilder::InsertionGuard guard(builder);
+ if (!aliasInsertionOp)
+ builder.setInsertionPointToStart(mlirModule.getBody());
+ else
+ builder.setInsertionPointAfter(aliasInsertionOp);
+
+ Type type = convertType(alias->getValueType());
+ AliasOp aliasOp = builder.create<AliasOp>(
+ mlirModule.getLoc(), type, convertLinkageFromLLVM(alias->getLinkage()),
+ alias->getName(),
+ /*addr_space=*/alias->getAddressSpace(),
----------------
bcardosolopes wrote:
Gets it from the type:
```
unsigned getAddressSpace() const {
return getType()->getAddressSpace();
}
```
https://github.com/llvm/llvm-project/pull/125295
More information about the Mlir-commits
mailing list