diff options
| author | Alexander Richardson <arichardson.kde@gmail.com> | 2018-08-23 09:25:17 +0000 |
|---|---|---|
| committer | Alexander Richardson <arichardson.kde@gmail.com> | 2018-08-23 09:25:17 +0000 |
| commit | 6bcf2ba2f0fff179602fd60b5e0127cd20fc907e (patch) | |
| tree | e75d5473ea23982ba49e0c6ee1b24fd35b57dd8f /llvm/lib/Transforms/Instrumentation | |
| parent | ba9eee5fadf1114d5ed422ce80dca50099057933 (diff) | |
| download | bcm5719-llvm-6bcf2ba2f0fff179602fd60b5e0127cd20fc907e.tar.gz bcm5719-llvm-6bcf2ba2f0fff179602fd60b5e0127cd20fc907e.zip | |
Allow creating llvm::Function in non-zero address spaces
Most users won't have to worry about this as all of the
'getOrInsertFunction' functions on Module will default to the program
address space.
An overload has been added to Function::Create to abstract away the
details for most callers.
This is based on https://reviews.llvm.org/D37054 but without the changes to
make passing a Module to Function::Create() mandatory. I have also added
some more tests and fixed the LLParser to accept call instructions for
types in the program address space.
Reviewed By: bjope
Differential Revision: https://reviews.llvm.org/D47541
llvm-svn: 340519
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index bb0e4379d1a..89b237c391e 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -645,8 +645,8 @@ DataFlowSanitizer::buildWrapperFunction(Function *F, StringRef NewFName, GlobalValue::LinkageTypes NewFLink, FunctionType *NewFT) { FunctionType *FT = F->getFunctionType(); - Function *NewF = Function::Create(NewFT, NewFLink, NewFName, - F->getParent()); + Function *NewF = Function::Create(NewFT, NewFLink, F->getAddressSpace(), + NewFName, F->getParent()); NewF->copyAttributesFrom(F); NewF->removeAttributes( AttributeList::ReturnIndex, @@ -819,7 +819,8 @@ bool DataFlowSanitizer::runOnModule(Module &M) { // easily identify cases of mismatching ABIs. if (getInstrumentedABI() == IA_Args && !IsZeroArgsVoidRet) { FunctionType *NewFT = getArgsFunctionType(FT); - Function *NewF = Function::Create(NewFT, F.getLinkage(), "", &M); + Function *NewF = Function::Create(NewFT, F.getLinkage(), + F.getAddressSpace(), "", &M); NewF->copyAttributesFrom(&F); NewF->removeAttributes( AttributeList::ReturnIndex, |

