diff options
author | Meador Inge <meadori@codesourcery.com> | 2012-11-11 03:51:43 +0000 |
---|---|---|
committer | Meador Inge <meadori@codesourcery.com> | 2012-11-11 03:51:43 +0000 |
commit | b69bf6be1b042a5f06a623fc546107fc6d9f46c4 (patch) | |
tree | 97d292bb4f422725e3fa00304a7e491f50c815d7 /include/llvm/Transforms/Utils/SimplifyLibCalls.h | |
parent | 23280ffb90dd7107f866977e8444370590b84b15 (diff) | |
download | external_llvm-b69bf6be1b042a5f06a623fc546107fc6d9f46c4.zip external_llvm-b69bf6be1b042a5f06a623fc546107fc6d9f46c4.tar.gz external_llvm-b69bf6be1b042a5f06a623fc546107fc6d9f46c4.tar.bz2 |
Add method for replacing instructions to LibCallSimplifier
In some cases the library call simplifier may need to replace instructions
other than the library call being simplified. In those cases it may be
necessary for clients of the simplifier to override how the replacements
are actually done. As such, a new overrideable method for replacing
instructions was added to LibCallSimplifier.
A new subclass of LibCallSimplifier is also defined which overrides
the instruction replacement method. This is because the instruction
combiner defines its own replacement method which updates the worklist
when instructions are replaced.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/SimplifyLibCalls.h')
-rw-r--r-- | include/llvm/Transforms/Utils/SimplifyLibCalls.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/llvm/Transforms/Utils/SimplifyLibCalls.h b/include/llvm/Transforms/Utils/SimplifyLibCalls.h index 5db2d00..fde452b 100644 --- a/include/llvm/Transforms/Utils/SimplifyLibCalls.h +++ b/include/llvm/Transforms/Utils/SimplifyLibCalls.h @@ -19,6 +19,7 @@ namespace llvm { class Value; class CallInst; class DataLayout; + class Instruction; class TargetLibraryInfo; class LibCallSimplifierImpl; @@ -35,8 +36,16 @@ namespace llvm { /// optimizeCall - Take the given call instruction and return a more /// optimal value to replace the instruction with or 0 if a more - /// optimal form can't be found. + /// optimal form can't be found. Note that the returned value may + /// be equal to the instruction being optimized. In this case all + /// other instructions that use the given instruction were modified + /// and the given instruction is dead. Value *optimizeCall(CallInst *CI); + + /// replaceAllUsesWith - This method is used when the library call + /// simplifier needs to replace instructions other than the library + /// call being modified. + virtual void replaceAllUsesWith(Instruction *I, Value *With) const; }; } // End llvm namespace |