aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Target/TargetInstrInfo.h
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-07-28 16:48:01 +0000
committerManman Ren <mren@apple.com>2012-07-28 16:48:01 +0000
commit0eb3edea9cb6819334173a7d288da85943201fe5 (patch)
tree77172a23d7618e5dbe447fc4b7536ba1a416deaf /include/llvm/Target/TargetInstrInfo.h
parentcdfbcdeeede52de472ae8187c0fb4ed4a014c2a3 (diff)
downloadexternal_llvm-0eb3edea9cb6819334173a7d288da85943201fe5.zip
external_llvm-0eb3edea9cb6819334173a7d288da85943201fe5.tar.gz
external_llvm-0eb3edea9cb6819334173a7d288da85943201fe5.tar.bz2
X86 Peephole: fold loads to the source register operand if possible.
Machine CSE and other optimizations can remove instructions so folding is possible at peephole while not possible at ISel. rdar://10554090 and rdar://11873276 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160919 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetInstrInfo.h')
-rw-r--r--include/llvm/Target/TargetInstrInfo.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index 73efc50..ba5e05d 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGET_TARGETINSTRINFO_H
#define LLVM_TARGET_TARGETINSTRINFO_H
+#include "llvm/ADT/SmallSet.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -693,6 +694,16 @@ public:
return false;
}
+ /// optimizeLoadInstr - Try to remove the load by folding it to a register
+ /// operand at the use. We fold the load instructions if and only if the
+ /// def and use are in the same BB.
+ virtual MachineInstr* optimizeLoadInstr(MachineInstr *MI,
+ const MachineRegisterInfo *MRI,
+ SmallSet<unsigned, 4> &FoldAsLoadDefRegs,
+ MachineInstr *&DefMI) const {
+ return 0;
+ }
+
/// FoldImmediate - 'Reg' is known to be defined by a move immediate
/// instruction, try to fold the immediate into the use instruction.
virtual bool FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI,