Add address space attribute to LLVMIR's GlobalOp.
PiperOrigin-RevId: 270012505
This commit is contained in:
parent
866724d7cf
commit
9d1bb322c8
@ -487,7 +487,8 @@ def LLVM_AddressOfOp
|
||||
def LLVM_GlobalOp
|
||||
: LLVM_ZeroResultOp<"mlir.global">,
|
||||
Arguments<(ins TypeAttr:$type, UnitAttr:$constant, StrAttr:$sym_name,
|
||||
AnyAttr:$value)> {
|
||||
AnyAttr:$value,
|
||||
DefaultValuedAttr<NonNegativeI32Attr, "0">:$addr_space)> {
|
||||
|
||||
let builders = [
|
||||
OpBuilder<"Builder *builder, OperationState *result, LLVMType type, "
|
||||
|
@ -326,9 +326,12 @@ void ModuleTranslation::convertGlobals() {
|
||||
cst = getLLVMConstant(type, op.value(), op.getLoc());
|
||||
}
|
||||
|
||||
auto *var = new llvm::GlobalVariable(*llvmModule, type, op.constant(),
|
||||
llvm::GlobalValue::InternalLinkage,
|
||||
cst, op.sym_name());
|
||||
auto addrSpace = op.addr_space().getLimitedValue();
|
||||
auto *var = new llvm::GlobalVariable(
|
||||
*llvmModule, type, op.constant(), llvm::GlobalValue::InternalLinkage,
|
||||
cst, op.sym_name(), /*InsertBefore=*/nullptr,
|
||||
llvm::GlobalValue::NotThreadLocal, addrSpace);
|
||||
|
||||
globalsMapping.try_emplace(op, var);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user