@@ -57,6 +57,9 @@ static cl::opt<bool>
57
57
static cl::opt<bool > memRefABI (" memref-abi" , cl::init(true ),
58
58
cl::desc(" Use memrefs when possible" ));
59
59
60
+ cl::opt<std::string> PrefixABI (" prefix-abi" , cl::init(" " ),
61
+ cl::desc(" Prefix for emitted symbols" ));
62
+
60
63
static cl::opt<bool >
61
64
CombinedStructABI (" struct-abi" , cl::init(true ),
62
65
cl::desc(" Use literal LLVM ABI for structs" ));
@@ -3955,6 +3958,8 @@ MLIRASTConsumer::GetOrCreateLLVMFunction(const FunctionDecl *FD) {
3955
3958
else
3956
3959
name = CGM.getMangledName (FD).str ();
3957
3960
3961
+ name = (PrefixABI + name);
3962
+
3958
3963
if (llvmFunctions.find (name) != llvmFunctions.end ()) {
3959
3964
return llvmFunctions[name];
3960
3965
}
@@ -4025,6 +4030,8 @@ MLIRASTConsumer::GetOrCreateLLVMGlobal(const ValueDecl *FD,
4025
4030
std::string prefix) {
4026
4031
std::string name = prefix + CGM.getMangledName (FD).str ();
4027
4032
4033
+ name = (PrefixABI + name);
4034
+
4028
4035
if (llvmGlobals.find (name) != llvmGlobals.end ()) {
4029
4036
return llvmGlobals[name];
4030
4037
}
@@ -4163,6 +4170,8 @@ MLIRASTConsumer::GetOrCreateGlobal(const ValueDecl *FD, std::string prefix,
4163
4170
bool tryInit) {
4164
4171
std::string name = prefix + CGM.getMangledName (FD).str ();
4165
4172
4173
+ name = (PrefixABI + name);
4174
+
4166
4175
if (globals.find (name) != globals.end ()) {
4167
4176
return globals[name];
4168
4177
}
@@ -4321,6 +4330,8 @@ mlir::FuncOp MLIRASTConsumer::GetOrCreateMLIRFunction(const FunctionDecl *FD) {
4321
4330
else
4322
4331
name = CGM.getMangledName (FD).str ();
4323
4332
4333
+ name = (PrefixABI + name);
4334
+
4324
4335
assert (name != " free" );
4325
4336
4326
4337
llvm::GlobalValue::LinkageTypes LV;
0 commit comments