aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-30 23:10:15 +0000
committerChris Lattner <sabre@nondot.org>2007-12-30 23:10:15 +0000
commit8aa797aa51cd4ea1ec6f46f4891a6897944b75b2 (patch)
treee0a02ef069161c19c6e91b8cdca0640b53d29db9 /lib/CodeGen
parent78d34664e7935a3c0e8f0fc7a345b94314a1b3b8 (diff)
downloadexternal_llvm-8aa797aa51cd4ea1ec6f46f4891a6897944b75b2.zip
external_llvm-8aa797aa51cd4ea1ec6f46f4891a6897944b75b2.tar.gz
external_llvm-8aa797aa51cd4ea1ec6f46f4891a6897944b75b2.tar.bz2
Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock(). I don't plan on switching everything over, so new clients should just start using the shorter names. Remove old long accessors, switching everything over to use the short accessor: getMachineBasicBlock() -> getMBB(), getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter.cpp2
-rw-r--r--lib/CodeGen/BranchFolding.cpp12
-rw-r--r--lib/CodeGen/LiveVariables.cpp2
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp5
-rw-r--r--lib/CodeGen/MachineInstr.cpp17
-rw-r--r--lib/CodeGen/PHIElimination.cpp12
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp2
7 files changed, 23 insertions, 29 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 0f7f6f1..fa68541 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -1226,7 +1226,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
++OpNo; // Skip over the ID number.
if (Modifier[0]=='l') // labels are target independent
- printBasicBlockLabel(MI->getOperand(OpNo).getMachineBasicBlock(),
+ printBasicBlockLabel(MI->getOperand(OpNo).getMBB(),
false, false);
else {
AsmPrinter *AP = const_cast<AsmPrinter*>(this);
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 4f86987..7e97223 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -172,8 +172,8 @@ bool BranchFolder::runOnMachineFunction(MachineFunction &MF) {
for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) {
MachineOperand &Op = I->getOperand(op);
if (!Op.isJumpTableIndex()) continue;
- unsigned NewIdx = JTMapping[Op.getJumpTableIndex()];
- Op.setJumpTableIndex(NewIdx);
+ unsigned NewIdx = JTMapping[Op.getIndex()];
+ Op.setIndex(NewIdx);
// Remember that this JT is live.
JTIsLive[NewIdx] = true;
@@ -210,14 +210,12 @@ static unsigned HashMachineInstr(const MachineInstr *MI) {
case MachineOperand::MO_Register: OperandHash = Op.getReg(); break;
case MachineOperand::MO_Immediate: OperandHash = Op.getImm(); break;
case MachineOperand::MO_MachineBasicBlock:
- OperandHash = Op.getMachineBasicBlock()->getNumber();
+ OperandHash = Op.getMBB()->getNumber();
break;
- case MachineOperand::MO_FrameIndex: OperandHash = Op.getFrameIndex(); break;
+ case MachineOperand::MO_FrameIndex:
case MachineOperand::MO_ConstantPoolIndex:
- OperandHash = Op.getConstantPoolIndex();
- break;
case MachineOperand::MO_JumpTableIndex:
- OperandHash = Op.getJumpTableIndex();
+ OperandHash = Op.getIndex();
break;
case MachineOperand::MO_GlobalAddress:
case MachineOperand::MO_ExternalSymbol:
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index 772843a..c4af6a8 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/lib/CodeGen/LiveVariables.cpp
@@ -696,6 +696,6 @@ void LiveVariables::analyzePHINodes(const MachineFunction& Fn) {
for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- PHIVarInfo[BBI->getOperand(i + 1).getMachineBasicBlock()->getNumber()].
+ PHIVarInfo[BBI->getOperand(i + 1).getMBB()->getNumber()].
push_back(BBI->getOperand(i).getReg());
}
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index e5be62d..f539596 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -214,9 +214,8 @@ void MachineBasicBlock::ReplaceUsesOfBlockWith(MachineBasicBlock *Old,
// Scan the operands of this machine instruction, replacing any uses of Old
// with New.
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
- if (I->getOperand(i).isMachineBasicBlock() &&
- I->getOperand(i).getMachineBasicBlock() == Old)
- I->getOperand(i).setMachineBasicBlock(New);
+ if (I->getOperand(i).isMBB() && I->getOperand(i).getMBB() == Old)
+ I->getOperand(i).setMBB(New);
}
// Update the successor information. If New was already a successor, just
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 85012da..d843b27 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -40,12 +40,11 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
case MachineOperand::MO_MachineBasicBlock:
return getMBB() == Other.getMBB();
case MachineOperand::MO_FrameIndex:
- return getFrameIndex() == Other.getFrameIndex();
+ return getIndex() == Other.getIndex();
case MachineOperand::MO_ConstantPoolIndex:
- return getConstantPoolIndex() == Other.getConstantPoolIndex() &&
- getOffset() == Other.getOffset();
+ return getIndex() == Other.getIndex() && getOffset() == Other.getOffset();
case MachineOperand::MO_JumpTableIndex:
- return getJumpTableIndex() == Other.getJumpTableIndex();
+ return getIndex() == Other.getIndex();
case MachineOperand::MO_GlobalAddress:
return getGlobal() == Other.getGlobal() && getOffset() == Other.getOffset();
case MachineOperand::MO_ExternalSymbol:
@@ -100,19 +99,19 @@ void MachineOperand::print(std::ostream &OS, const TargetMachine *TM) const {
break;
case MachineOperand::MO_MachineBasicBlock:
OS << "mbb<"
- << ((Value*)getMachineBasicBlock()->getBasicBlock())->getName()
- << "," << (void*)getMachineBasicBlock() << ">";
+ << ((Value*)getMBB()->getBasicBlock())->getName()
+ << "," << (void*)getMBB() << ">";
break;
case MachineOperand::MO_FrameIndex:
- OS << "<fi#" << getFrameIndex() << ">";
+ OS << "<fi#" << getIndex() << ">";
break;
case MachineOperand::MO_ConstantPoolIndex:
- OS << "<cp#" << getConstantPoolIndex();
+ OS << "<cp#" << getIndex();
if (getOffset()) OS << "+" << getOffset();
OS << ">";
break;
case MachineOperand::MO_JumpTableIndex:
- OS << "<jt#" << getJumpTableIndex() << ">";
+ OS << "<jt#" << getIndex() << ">";
break;
case MachineOperand::MO_GlobalAddress:
OS << "<ga:" << ((Value*)getGlobal())->getName();
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 1773b57..480ba93 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/lib/CodeGen/PHIElimination.cpp
@@ -174,9 +174,8 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
// Adjust the VRegPHIUseCount map to account for the removal of this PHI
// node.
for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2)
- --VRegPHIUseCount[BBVRegPair(
- MPhi->getOperand(i + 1).getMachineBasicBlock(),
- MPhi->getOperand(i).getReg())];
+ --VRegPHIUseCount[BBVRegPair(MPhi->getOperand(i + 1).getMBB(),
+ MPhi->getOperand(i).getReg())];
// Now loop over all of the incoming arguments, changing them to copy into
// the IncomingReg register in the corresponding predecessor basic block.
@@ -189,7 +188,7 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
// Get the MachineBasicBlock equivalent of the BasicBlock that is the
// source path the PHI.
- MachineBasicBlock &opBlock = *MPhi->getOperand(i).getMachineBasicBlock();
+ MachineBasicBlock &opBlock = *MPhi->getOperand(i).getMBB();
// Check to make sure we haven't already emitted the copy for this block.
// This can happen because PHI nodes may have multiple entries for the
@@ -339,7 +338,6 @@ void PNE::analyzePHINodes(const MachineFunction& Fn) {
for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end();
BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI)
for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- ++VRegPHIUseCount[BBVRegPair(
- BBI->getOperand(i + 1).getMachineBasicBlock(),
- BBI->getOperand(i).getReg())];
+ ++VRegPHIUseCount[BBVRegPair(BBI->getOperand(i + 1).getMBB(),
+ BBI->getOperand(i).getReg())];
}
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index 4b5c123..d736084 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -385,7 +385,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
UnionedBlocks.count(SrcInfo.DefInst->getParent())) {
// add a copy from a_i to p in Waiting[From[a_i]]
- MachineBasicBlock* From = P->getOperand(i).getMachineBasicBlock();
+ MachineBasicBlock* From = P->getOperand(i).getMBB();
Waiting[From].insert(std::make_pair(SrcReg, DestReg));
UsedByAnother.insert(SrcReg);
} else {