[mlir][llvm] Add UnnamedAddr attribute to GlobalOp

This patch add the UnnamedAddr attribute for the GlobalOp in the LLVM
dialect. The attribute is also handled to and from LLVM IR.

This is meant to be used in a follow up patch to lower OpenACC/OpenMP ops to
call to kmp and tgt runtime calls (D100678).

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D100677
This commit is contained in:
clementval
2021-04-19 21:45:01 -04:00
parent b98807df05
commit c46a88625d
7 changed files with 63 additions and 3 deletions

View File

@@ -407,6 +407,9 @@ LogicalResult ModuleTranslation::convertGlobals() {
op.sym_name(),
/*InsertBefore=*/nullptr, llvm::GlobalValue::NotThreadLocal, addrSpace);
if (op.unnamed_addr().hasValue())
var->setUnnamedAddr(convertUnnamedAddrToLLVM(*op.unnamed_addr()));
globalsMapping.try_emplace(op, var);
}