diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-03-12 09:27:41 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-03-12 09:27:41 +0000 |
commit | 0b6cb507385c8bd10b6a51b5e45a9b99d8d94798 (patch) | |
tree | 5b215ee4ea7339e068a16c0b92203d6c41f944c8 /include/llvm/Transforms/Utils/BuildLibCalls.h | |
parent | b3e87b2262087cf69f7461e4bc586cdb747434f7 (diff) | |
download | external_llvm-0b6cb507385c8bd10b6a51b5e45a9b99d8d94798.zip external_llvm-0b6cb507385c8bd10b6a51b5e45a9b99d8d94798.tar.gz external_llvm-0b6cb507385c8bd10b6a51b5e45a9b99d8d94798.tar.bz2 |
Factor checked library call optimization into a common helper class and use it
to unify the almost identical code in CodeGenPrepare and InstCombineCalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/BuildLibCalls.h')
-rw-r--r-- | include/llvm/Transforms/Utils/BuildLibCalls.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/BuildLibCalls.h b/include/llvm/Transforms/Utils/BuildLibCalls.h index 5efaecf..bf97339 100644 --- a/include/llvm/Transforms/Utils/BuildLibCalls.h +++ b/include/llvm/Transforms/Utils/BuildLibCalls.h @@ -96,6 +96,18 @@ namespace llvm { /// a pointer, Size is an 'intptr_t', and File is a pointer to FILE. void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B, const TargetData *TD); + + /// SimplifyFortifiedLibCalls - Helper class for folding checked library + /// calls (e.g. __strcpy_chk) into their unchecked counterparts. + class SimplifyFortifiedLibCalls { + protected: + CallInst *CI; + virtual void replaceCall(Value *With) = 0; + virtual bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp, + bool isString) const = 0; + public: + bool fold(CallInst *CI, const TargetData *TD); + }; } #endif |