[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp TwoAddressInstructionPass.cpp VirtRegMap.cpp
Evan Cheng
evan.cheng at apple.com
Fri Dec 1 13:49:02 PST 2006
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.198 -> 1.199
TwoAddressInstructionPass.cpp updated: 1.41 -> 1.42
VirtRegMap.cpp updated: 1.80 -> 1.81
---
Log message:
Match TargetInstrInfo changes.
---
Diffs of the changes: (+12 -20)
LiveIntervalAnalysis.cpp | 3 +--
TwoAddressInstructionPass.cpp | 23 +++++++++--------------
VirtRegMap.cpp | 6 ++----
3 files changed, 12 insertions(+), 20 deletions(-)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.198 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.199
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.198 Tue Nov 28 18:39:47 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Dec 1 15:48:44 2006
@@ -433,8 +433,7 @@
for (unsigned j = i+1; j < e; ++j) {
MachineOperand &MO2 = MI->getOperand(j);
if (MO2.isRegister() && MO2.isUse() && MO2.getReg() == Reg &&
- TII->getOperandConstraint(MI->getOpcode(), j,
- TargetInstrInfo::TIED_TO) == (int)i)
+ TII->getOperandConstraint(MI->getOpcode(),j,TOI::TIED_TO) == (int)i)
return true;
}
}
Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.41 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.42
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.41 Tue Nov 28 16:48:48 2006
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Fri Dec 1 15:48:44 2006
@@ -79,8 +79,8 @@
bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
DOUT << "Machine Function\n";
const TargetMachine &TM = MF.getTarget();
- const MRegisterInfo &MRI = *TM.getRegisterInfo();
const TargetInstrInfo &TII = *TM.getInstrInfo();
+ const MRegisterInfo &MRI = *TM.getRegisterInfo();
LiveVariables &LV = getAnalysis<LiveVariables>();
bool MadeChange = false;
@@ -92,11 +92,11 @@
mbbi != mbbe; ++mbbi) {
for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end();
mi != me; ++mi) {
- unsigned opcode = mi->getOpcode();
+ const TargetInstrDescriptor *TID = mi->getInstrDescriptor();
bool FirstTied = true;
- for (unsigned si = 1, e = TII.getNumOperands(opcode); si < e; ++si) {
- int ti = TII.getOperandConstraint(opcode, si, TargetInstrInfo::TIED_TO);
+ for (unsigned si = 1, e = TID->numOperands; si < e; ++si) {
+ int ti = TID->getOperandConstraint(si, TOI::TIED_TO);
if (ti == -1)
continue;
@@ -139,13 +139,11 @@
// allow us to coalesce A and B together, eliminating the copy we are
// about to insert.
if (!LV.KillsRegister(mi, regB)) {
- const TargetInstrDescriptor &TID = TII.get(opcode);
-
// If this instruction is commutative, check to see if C dies. If
// so, swap the B and C operands. This makes the live ranges of A
// and C joinable.
// FIXME: This code also works for A := B op C instructions.
- if ((TID.Flags & M_COMMUTABLE) && mi->getNumOperands() == 3) {
+ if ((TID->Flags & M_COMMUTABLE) && mi->getNumOperands() == 3) {
assert(mi->getOperand(3-si).isRegister() &&
"Not a proper commutative instruction!");
unsigned regC = mi->getOperand(3-si).getReg();
@@ -173,20 +171,17 @@
// If this instruction is potentially convertible to a true
// three-address instruction,
- if (TID.Flags & M_CONVERTIBLE_TO_3_ADDR)
+ if (TID->Flags & M_CONVERTIBLE_TO_3_ADDR)
// FIXME: This assumes there are no more operands which are tied
// to another register.
#ifndef NDEBUG
- for (unsigned i = si+1, e = TII.getNumOperands(opcode); i < e; ++i)
- assert(TII.getOperandConstraint(opcode, i,
- TargetInstrInfo::TIED_TO) == -1);
+ for (unsigned i = si+1, e = TID->numOperands; i < e; ++i)
+ assert(TID->getOperandConstraint(i, TOI::TIED_TO) == -1);
#endif
- if (MachineInstr *New = TII.convertToThreeAddress(mi)) {
+ if (MachineInstr *New = TII.convertToThreeAddress(mbbi, mi, LV)) {
DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
DOUT << "2addr: TO 3-ADDR: " << *New;
- LV.instructionChanged(mi, New); // Update live variables
- mbbi->insert(mi, New); // Insert the new inst
mbbi->erase(mi); // Nuke the old inst.
mi = New;
++NumConvertedTo3Addr;
Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.80 llvm/lib/CodeGen/VirtRegMap.cpp:1.81
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.80 Thu Nov 16 20:09:07 2006
+++ llvm/lib/CodeGen/VirtRegMap.cpp Fri Dec 1 15:48:44 2006
@@ -97,8 +97,7 @@
}
ModRef MRInfo;
- if (TII.getOperandConstraint(OldMI->getOpcode(), OpNo,
- TargetInstrInfo::TIED_TO)) {
+ if (TII.getOperandConstraint(OldMI->getOpcode(), OpNo, TOI::TIED_TO)) {
// Folded a two-address operand.
MRInfo = isModRef;
} else if (OldMI->getOperand(OpNo).isDef()) {
@@ -592,8 +591,7 @@
// aren't allowed to modify the reused register. If none of these cases
// apply, reuse it.
bool CanReuse = true;
- int ti = TII->getOperandConstraint(MI.getOpcode(), i,
- TargetInstrInfo::TIED_TO);
+ int ti = TII->getOperandConstraint(MI.getOpcode(), i, TOI::TIED_TO);
if (ti != -1 &&
MI.getOperand(ti).isReg() &&
MI.getOperand(ti).getReg() == VirtReg) {
More information about the llvm-commits
mailing list