diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-12-01 00:40:05 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-12-01 00:40:05 +0000 |
commit | 42f3b122741e94ab31e331e4b7497a7bbcb13212 (patch) | |
tree | fad4056ed17f825289efcf3ccb0e7a1d22575c6f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | fd0799536376e88b2629ce0a69fc6b8edf5e243b (diff) | |
download | llvm-42f3b122741e94ab31e331e4b7497a7bbcb13212.zip llvm-42f3b122741e94ab31e331e4b7497a7bbcb13212.tar.gz llvm-42f3b122741e94ab31e331e4b7497a7bbcb13212.tar.bz2 |
[safestack] Protect byval function arguments.
Detect unsafe byval function arguments and move them to the unsafe
stack.
llvm-svn: 254353
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 0bd5fa9..623da67 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1136,9 +1136,10 @@ DbgDeclareInst *llvm::FindAllocaDbgDeclare(Value *V) { return nullptr; } -bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, - DIBuilder &Builder, bool Deref, int Offset) { - DbgDeclareInst *DDI = FindAllocaDbgDeclare(AI); +bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress, + Instruction *InsertBefore, DIBuilder &Builder, + bool Deref, int Offset) { + DbgDeclareInst *DDI = FindAllocaDbgDeclare(Address); if (!DDI) return false; DebugLoc Loc = DDI->getDebugLoc(); @@ -1168,12 +1169,17 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, // Insert llvm.dbg.declare immediately after the original alloca, and remove // old llvm.dbg.declare. - Builder.insertDeclare(NewAllocaAddress, DIVar, DIExpr, Loc, - AI->getNextNode()); + Builder.insertDeclare(NewAddress, DIVar, DIExpr, Loc, InsertBefore); DDI->eraseFromParent(); return true; } +bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, + DIBuilder &Builder, bool Deref, int Offset) { + return replaceDbgDeclare(AI, NewAllocaAddress, AI->getNextNode(), Builder, + Deref, Offset); +} + /// changeToUnreachable - Insert an unreachable instruction before the specified /// instruction, making it and the rest of the code in the block dead. static void changeToUnreachable(Instruction *I, bool UseLLVMTrap) { |