summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveRangeEdit.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-11-10 01:05:12 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-11-10 01:05:12 +0000
commitb80e973c95034e5754d888140497a9658a7c1ded (patch)
tree91584f6564e6ef1dfc310343e841886de265979a /lib/CodeGen/LiveRangeEdit.cpp
parent42c31a70735e55bf82e66a9315c97d1821c9a798 (diff)
downloadllvm-b80e973c95034e5754d888140497a9658a7c1ded.tar.gz
llvm-b80e973c95034e5754d888140497a9658a7c1ded.tar.bz2
llvm-b80e973c95034e5754d888140497a9658a7c1ded.tar.xz
Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveRangeEdit.cpp')
-rw-r--r--lib/CodeGen/LiveRangeEdit.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp
index bbcc07ca09..3c7d9f66e7 100644
--- a/lib/CodeGen/LiveRangeEdit.cpp
+++ b/lib/CodeGen/LiveRangeEdit.cpp
@@ -88,36 +88,29 @@ bool LiveRangeEdit::allUsesAvailableAt(const MachineInstr *OrigMI,
return true;
}
-LiveRangeEdit::Remat LiveRangeEdit::canRematerializeAt(VNInfo *ParentVNI,
- SlotIndex UseIdx,
- bool cheapAsAMove,
- LiveIntervals &lis) {
+bool LiveRangeEdit::canRematerializeAt(Remat &RM,
+ SlotIndex UseIdx,
+ bool cheapAsAMove,
+ LiveIntervals &lis) {
assert(scannedRemattable_ && "Call anyRematerializable first");
- Remat RM = { 0, 0 };
-
- // We could remat an undefined value as IMPLICIT_DEF, but all that should have
- // been taken care of earlier.
- if (!(RM.ParentVNI = parent_.getVNInfoAt(UseIdx)))
- return RM;
// Use scanRemattable info.
if (!remattable_.count(RM.ParentVNI))
- return RM;
+ return false;
// No defining instruction.
- MachineInstr *OrigMI = lis.getInstructionFromIndex(RM.ParentVNI->def);
- assert(OrigMI && "Defining instruction for remattable value disappeared");
+ RM.OrigMI = lis.getInstructionFromIndex(RM.ParentVNI->def);
+ assert(RM.OrigMI && "Defining instruction for remattable value disappeared");
// If only cheap remats were requested, bail out early.
- if (cheapAsAMove && !OrigMI->getDesc().isAsCheapAsAMove())
- return RM;
+ if (cheapAsAMove && !RM.OrigMI->getDesc().isAsCheapAsAMove())
+ return false;
// Verify that all used registers are available with the same values.
- if (!allUsesAvailableAt(OrigMI, RM.ParentVNI->def, UseIdx, lis))
- return RM;
+ if (!allUsesAvailableAt(RM.OrigMI, RM.ParentVNI->def, UseIdx, lis))
+ return false;
- RM.OrigMI = OrigMI;
- return RM;
+ return true;
}
SlotIndex LiveRangeEdit::rematerializeAt(MachineBasicBlock &MBB,