[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp LiveVariables.cpp PHIElimination.cpp PrologEpilogInserter.cpp RegAllocLinearScan.cpp RegAllocLocal.cpp RegAllocSimple.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 10 15:13:09 PST 2004
Changes in directory llvm/lib/CodeGen:
LiveIntervals.cpp updated: 1.46 -> 1.47
LiveVariables.cpp updated: 1.20 -> 1.21
PHIElimination.cpp updated: 1.14 -> 1.15
PrologEpilogInserter.cpp updated: 1.17 -> 1.18
RegAllocLinearScan.cpp updated: 1.43 -> 1.44
RegAllocLocal.cpp updated: 1.41 -> 1.42
RegAllocSimple.cpp updated: 1.47 -> 1.48
---
Log message:
Do not use MachineOperand::isVirtualRegister either!
---
Diffs of the changes: (+29 -27)
Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.46 llvm/lib/CodeGen/LiveIntervals.cpp:1.47
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.46 Thu Feb 5 16:55:25 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp Tue Feb 10 15:12:22 2004
@@ -115,7 +115,8 @@
for (int i = mi->getNumOperands() - 1; i >= 0; --i) {
MachineOperand& mop = mi->getOperand(i);
- if (mop.isVirtualRegister()) {
+ if (mop.isRegister() &&
+ MRegisterInfo::isVirtualRegister(mop.getReg())) {
unsigned reg = mop.getAllocatedRegNum();
Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg);
assert(r2iit != r2iMap_.end());
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.20 llvm/lib/CodeGen/LiveVariables.cpp:1.21
--- llvm/lib/CodeGen/LiveVariables.cpp:1.20 Tue Feb 10 14:41:10 2004
+++ llvm/lib/CodeGen/LiveVariables.cpp Tue Feb 10 15:12:22 2004
@@ -231,11 +231,10 @@
// Process all explicit uses...
for (unsigned i = 0; i != NumOperandsToProcess; ++i) {
MachineOperand &MO = MI->getOperand(i);
- if (MO.isUse()) {
- if (MO.isVirtualRegister() && !MO.getVRegValueOrNull()) {
+ if (MO.isUse() && MO.isRegister()) {
+ if (MRegisterInfo::isVirtualRegister(MO.getReg())){
HandleVirtRegUse(getVarInfo(MO.getReg()), MBB, MI);
- } else if (MO.isRegister() &&
- MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
+ } else if (MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
AllocatablePhysicalRegisters[MO.getReg()]) {
HandlePhysRegUse(MO.getReg(), MI);
}
@@ -250,16 +249,15 @@
// Process all explicit defs...
for (unsigned i = 0; i != NumOperandsToProcess; ++i) {
MachineOperand &MO = MI->getOperand(i);
- if (MO.isDef()) {
- if (MO.isVirtualRegister()) {
+ if (MO.isDef() && MO.isRegister()) {
+ if (MRegisterInfo::isVirtualRegister(MO.getReg())) {
VarInfo &VRInfo = getVarInfo(MO.getReg());
assert(VRInfo.DefBlock == 0 && "Variable multiply defined!");
VRInfo.DefBlock = MBB; // Created here...
VRInfo.DefInst = MI;
VRInfo.Kills.push_back(std::make_pair(MBB, MI)); // Defaults to dead
- } else if (MO.isRegister() &&
- MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
+ } else if (MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
AllocatablePhysicalRegisters[MO.getReg()]) {
HandlePhysRegDef(MO.getReg(), MI);
}
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.14 llvm/lib/CodeGen/PHIElimination.cpp:1.15
--- llvm/lib/CodeGen/PHIElimination.cpp:1.14 Sun Dec 14 07:24:17 2003
+++ llvm/lib/CodeGen/PHIElimination.cpp Tue Feb 10 15:12:22 2004
@@ -73,7 +73,7 @@
// Unlink the PHI node from the basic block... but don't delete the PHI yet
MBB.erase(MBB.begin());
- assert(MI->getOperand(0).isVirtualRegister() &&
+ assert(MRegisterInfo::isVirtualRegister(MI->getOperand(0).getReg()) &&
"PHI node doesn't write virt reg?");
unsigned DestReg = MI->getOperand(0).getAllocatedRegNum();
@@ -174,7 +174,7 @@
MachineInstr *PrevInst = *(I-1);
for (unsigned i = 0, e = PrevInst->getNumOperands(); i != e; ++i) {
MachineOperand &MO = PrevInst->getOperand(i);
- if (MO.isVirtualRegister() && MO.getReg() == IncomingReg)
+ if (MO.isRegister() && MO.getReg() == IncomingReg)
if (MO.isDef()) {
HaveNotEmitted = false;
break;
@@ -183,7 +183,7 @@
}
if (HaveNotEmitted) { // If the copy has not already been emitted, do it.
- assert(opVal.isVirtualRegister() &&
+ assert(MRegisterInfo::isVirtualRegister(opVal.getReg()) &&
"Machine PHI Operands must all be virtual registers!");
unsigned SrcReg = opVal.getReg();
RegInfo->copyRegToReg(opBlock, I, IncomingReg, SrcReg, RC);
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.17 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.18
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.17 Tue Feb 10 14:41:10 2004
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Tue Feb 10 15:12:22 2004
@@ -116,12 +116,12 @@
} else {
for (unsigned i = 0, e = (*I)->getNumOperands(); i != e; ++i) {
MachineOperand &MO = (*I)->getOperand(i);
- assert(!MO.isVirtualRegister() &&
- "Register allocation must be performed!");
- if (MO.isRegister() && MO.isDef() &&
- MRegisterInfo::isPhysicalRegister(MO.getReg()))
+ if (MO.isRegister() && MO.isDef()) {
+ assert(MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
+ "Register allocation must be performed!");
ModifiedRegs[MO.getReg()] = true; // Register is modified
- }
+ }
+ }
++I;
}
Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.43 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.44
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.43 Fri Feb 6 12:08:18 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Feb 10 15:12:22 2004
@@ -405,8 +405,9 @@
for (unsigned i = 0, e = (*currentInstr_)->getNumOperands();
i != e; ++i) {
MachineOperand& op = (*currentInstr_)->getOperand(i);
- if (op.isVirtualRegister()) {
- unsigned virtReg = op.getAllocatedRegNum();
+ if (op.isRegister() &&
+ MRegisterInfo::isVirtualRegister(op.getReg())) {
+ unsigned virtReg = op.getReg();
Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg);
if (it != v2pMap_.end()) {
DEBUG(std::cerr << "\t\t\t%reg" << it->first
@@ -441,7 +442,8 @@
"registers:\n");
for (unsigned i = 0; i != numOperands; ++i) {
MachineOperand& op = (*currentInstr_)->getOperand(i);
- if (op.isVirtualRegister() && op.isUse()) {
+ if (op.isRegister() && op.isUse() &&
+ MRegisterInfo::isVirtualRegister(op.getReg())) {
unsigned virtReg = op.getAllocatedRegNum();
unsigned physReg = 0;
Virt2PhysMap::iterator it = v2pMap_.find(virtReg);
@@ -471,9 +473,10 @@
"registers:\n");
for (unsigned i = 0; i != numOperands; ++i) {
MachineOperand& op = (*currentInstr_)->getOperand(i);
- if (op.isVirtualRegister()) {
+ if (op.isRegister() &&
+ MRegisterInfo::isVirtualRegister(op.getReg())) {
assert(!op.isUse() && "we should not have uses here!");
- unsigned virtReg = op.getAllocatedRegNum();
+ unsigned virtReg = op.getReg();
unsigned physReg = 0;
Virt2PhysMap::iterator it = v2pMap_.find(virtReg);
if (it != v2pMap_.end()) {
Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.41 llvm/lib/CodeGen/RegAllocLocal.cpp:1.42
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.41 Tue Feb 10 14:41:10 2004
+++ llvm/lib/CodeGen/RegAllocLocal.cpp Tue Feb 10 15:12:22 2004
@@ -522,8 +522,8 @@
//
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
if (MI->getOperand(i).isUse() &&
- !MI->getOperand(i).isDef() &&
- MI->getOperand(i).isVirtualRegister()){
+ !MI->getOperand(i).isDef() && MI->getOperand(i).isRegister() &&
+ MRegisterInfo::isVirtualRegister(MI->getOperand(i).getReg())) {
unsigned VirtSrcReg = MI->getOperand(i).getAllocatedRegNum();
unsigned PhysSrcReg = reloadVirtReg(MBB, I, VirtSrcReg);
MI->SetMachineOperandReg(i, PhysSrcReg); // Assign the input register
@@ -589,8 +589,8 @@
// we need to scavenge a register.
//
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
- if (MI->getOperand(i).isDef() &&
- MI->getOperand(i).isVirtualRegister()) {
+ if (MI->getOperand(i).isDef() && MI->getOperand(i).isRegister() &&
+ MRegisterInfo::isVirtualRegister(MI->getOperand(i).getReg())) {
unsigned DestVirtReg = MI->getOperand(i).getAllocatedRegNum();
unsigned DestPhysReg;
Index: llvm/lib/CodeGen/RegAllocSimple.cpp
diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.47 llvm/lib/CodeGen/RegAllocSimple.cpp:1.48
--- llvm/lib/CodeGen/RegAllocSimple.cpp:1.47 Sun Dec 14 07:24:16 2003
+++ llvm/lib/CodeGen/RegAllocSimple.cpp Tue Feb 10 15:12:22 2004
@@ -174,7 +174,7 @@
for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
MachineOperand &op = MI->getOperand(i);
- if (op.isVirtualRegister()) {
+ if (op.isRegister() && MRegisterInfo::isVirtualRegister(op.getReg())) {
unsigned virtualReg = (unsigned) op.getAllocatedRegNum();
DEBUG(std::cerr << "op: " << op << "\n");
DEBUG(std::cerr << "\t inst[" << i << "]: ";
More information about the llvm-commits
mailing list