summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-04-19 22:29:18 +0000
committerEli Bendersky <eliben@google.com>2013-04-19 22:29:18 +0000
commit75299e3a95c0cfcade8515c603e7802351a11bee (patch)
treee46da3596b22c4fee03b305fe027f7ef8e9daa98 /include/llvm/CodeGen
parent2a8bea7a8eba9bfa05dcc7a87e9152a0043841b2 (diff)
downloadllvm-75299e3a95c0cfcade8515c603e7802351a11bee.tar.gz
llvm-75299e3a95c0cfcade8515c603e7802351a11bee.tar.bz2
llvm-75299e3a95c0cfcade8515c603e7802351a11bee.tar.xz
Move TryToFoldFastISelLoad to FastISel, where it belongs. In general, I'm
trying to move as much FastISel logic as possible out of the main path in SelectionDAGISel - intermixing them just adds confusion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/FastISel.h22
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h3
2 files changed, 19 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h
index 705db7e643..be14f749bf 100644
--- a/include/llvm/CodeGen/FastISel.h
+++ b/include/llvm/CodeGen/FastISel.h
@@ -123,12 +123,28 @@ public:
/// index value.
std::pair<unsigned, bool> getRegForGEPIndex(const Value *V);
- /// TryToFoldLoad - The specified machine instr operand is a vreg, and that
+ /// \brief We're checking to see if we can fold \p LI the \p FoldInst.
+ /// Note that we could have a sequence where multiple LLVM IR instructions
+ /// are folded into the same machineinstr. For example we could have:
+ /// A: x = load i32 *P
+ /// B: y = icmp A, 42
+ /// C: br y, ...
+ ///
+ /// In this scenario, \p LI is "A", and \p FoldInst is "C". We know
+ /// about "B" (and any other folded instructions) because it is between
+ /// A and C.
+ ///
+ /// If we succeed folding, return true.
+ ///
+ bool tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst);
+
+ /// \brief The specified machine instr operand is a vreg, and that
/// vreg is being provided by the specified load instruction. If possible,
/// try to fold the load as an operand to the instruction, returning true if
/// possible.
- virtual bool TryToFoldLoad(MachineInstr * /*MI*/, unsigned /*OpNo*/,
- const LoadInst * /*LI*/) {
+ /// This method should be implemented by targets.
+ virtual bool tryToFoldLoadIntoMI(MachineInstr * /*MI*/, unsigned /*OpNo*/,
+ const LoadInst * /*LI*/) {
return false;
}
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index 5f503deff1..a4721db685 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -259,9 +259,6 @@ private:
void SelectBasicBlock(BasicBlock::const_iterator Begin,
BasicBlock::const_iterator End,
bool &HadTailCall);
-
- bool TryToFoldFastISelLoad(const LoadInst *LI, const Instruction *FoldInst,
- FastISel *FastIS);
void FinishBasicBlock();
void CodeGenAndEmitDAG();