aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachineInstr.cpp8
-rw-r--r--lib/CodeGen/RegAlloc/PhyRegAlloc.cpp17
-rw-r--r--lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp17
-rw-r--r--lib/Target/SparcV9/SparcV9RegInfo.cpp10
4 files changed, 25 insertions, 27 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 02c25fdd7f..df633c6511 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -82,14 +82,14 @@ MachineInstr::SetMachineOperandReg(unsigned int i,
operands[i].markDef();
if (isDefAndUse)
operands[i].markDefAndUse();
- regsUsed.insert(regNum);
+ insertUsedReg(regNum);
}
void
MachineInstr::SetRegForOperand(unsigned i, int regNum)
{
operands[i].setRegForValue(regNum);
- regsUsed.insert(regNum);
+ insertUsedReg(regNum);
}
@@ -111,10 +111,10 @@ MachineInstr::substituteValue(const Value* oldVal, Value* newVal, bool defsOnly)
// Subsitute implicit refs
for (unsigned i=0, N=implicitRefs.size(); i < N; ++i)
- if (implicitRefs[i] == oldVal)
+ if (getImplicitRef(i) == oldVal)
if (!defsOnly || implicitRefIsDefined(i))
{
- implicitRefs[i] = newVal;
+ implicitRefs[i].Val = newVal;
++numSubst;
}
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index c97028a683..5fc6a4d5c0 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
@@ -691,10 +691,10 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR,
int scratchReg = -1;
if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType))
{
- scratchReg = this->getUsableUniRegAtMI(scratchRegType, &LVSetBef,
- MInst, MIBef, MIAft);
+ scratchReg = getUsableUniRegAtMI(scratchRegType, &LVSetBef,
+ MInst, MIBef, MIAft);
assert(scratchReg != MRI.getInvalidRegNum());
- MInst->getRegsUsed().insert(scratchReg);
+ MInst->insertUsedReg(scratchReg);
}
if (!isDef || isDefAndUse) {
@@ -774,7 +774,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType,
// of copying it to memory and back. But we have to mark the
// register as used by this instruction, so it does not get used
// as a scratch reg. by another operand or anyone else.
- MInst->getRegsUsed().insert(scratchReg);
+ MInst->insertUsedReg(scratchReg);
MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType);
MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType);
}
@@ -874,12 +874,11 @@ void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC,
// Add the registers already marked as used by the instruction.
// This should include any scratch registers that are used to save
// values across the instruction (e.g., for saving state register values).
- const hash_set<int>& regsUsed = MInst->getRegsUsed();
- for (hash_set<int>::const_iterator SI=regsUsed.begin(), SE=regsUsed.end();
- SI != SE; ++SI)
- {
+ const vector<bool> &regsUsed = MInst->getRegsUsed();
+ for (unsigned i = 0, e = regsUsed.size(); i != e; ++i)
+ if (regsUsed[i]) {
unsigned classId = 0;
- int classRegNum = MRI.getClassRegNum(*SI, classId);
+ int classRegNum = MRI.getClassRegNum(i, classId);
if (RC->getID() == classId)
{
assert(classRegNum < (int) IsColorUsedArr.size() &&
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index c97028a683..5fc6a4d5c0 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -691,10 +691,10 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR,
int scratchReg = -1;
if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType))
{
- scratchReg = this->getUsableUniRegAtMI(scratchRegType, &LVSetBef,
- MInst, MIBef, MIAft);
+ scratchReg = getUsableUniRegAtMI(scratchRegType, &LVSetBef,
+ MInst, MIBef, MIAft);
assert(scratchReg != MRI.getInvalidRegNum());
- MInst->getRegsUsed().insert(scratchReg);
+ MInst->insertUsedReg(scratchReg);
}
if (!isDef || isDefAndUse) {
@@ -774,7 +774,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType,
// of copying it to memory and back. But we have to mark the
// register as used by this instruction, so it does not get used
// as a scratch reg. by another operand or anyone else.
- MInst->getRegsUsed().insert(scratchReg);
+ MInst->insertUsedReg(scratchReg);
MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType);
MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType);
}
@@ -874,12 +874,11 @@ void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC,
// Add the registers already marked as used by the instruction.
// This should include any scratch registers that are used to save
// values across the instruction (e.g., for saving state register values).
- const hash_set<int>& regsUsed = MInst->getRegsUsed();
- for (hash_set<int>::const_iterator SI=regsUsed.begin(), SE=regsUsed.end();
- SI != SE; ++SI)
- {
+ const vector<bool> &regsUsed = MInst->getRegsUsed();
+ for (unsigned i = 0, e = regsUsed.size(); i != e; ++i)
+ if (regsUsed[i]) {
unsigned classId = 0;
- int classRegNum = MRI.getClassRegNum(*SI, classId);
+ int classRegNum = MRI.getClassRegNum(i, classId);
if (RC->getID() == classId)
{
assert(classRegNum < (int) IsColorUsedArr.size() &&
diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp
index d7b20c032f..65539cf87e 100644
--- a/lib/Target/SparcV9/SparcV9RegInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp
@@ -663,7 +663,7 @@ UltraSparcRegInfo::InitializeOutgoingArg(MachineInstr* CallMI,
{
isArgInReg = true;
UniArgReg = (unsigned) UniArgRegOrNone;
- CallMI->getRegsUsed().insert(UniArgReg); // mark the reg as used
+ CallMI->insertUsedReg(UniArgReg); // mark the reg as used
}
if (LR->hasColor()) {
@@ -788,7 +788,7 @@ void UltraSparcRegInfo::colorCallArgs(MachineInstr *CallMI,
UniRetReg = getUnifiedRegNum(RegClassID, CorrectCol);
// Mark the register as used by this instruction
- CallMI->getRegsUsed().insert(UniRetReg);
+ CallMI->insertUsedReg(UniRetReg);
// if the LR received the correct color, NOTHING to do
recvCorrectColor = RetValLR->hasColor()? RetValLR->getColor() == CorrectCol
@@ -1026,7 +1026,7 @@ void UltraSparcRegInfo::colorRetValue(MachineInstr *RetMI,
unsigned UniRetReg = getUnifiedRegNum(RegClassID, CorrectCol);
// Mark the register as used by this instruction
- RetMI->getRegsUsed().insert(UniRetReg);
+ RetMI->insertUsedReg(UniRetReg);
// if the LR received the correct color, NOTHING to do
@@ -1433,7 +1433,7 @@ UltraSparcRegInfo::insertCallerSavingCode(vector<MachineInstr*>& instrnsBefore,
scratchReg = PRA.getUsableUniRegAtMI(scratchRegType, &LVSetBef,
CallMI, AdIBef, AdIAft);
assert(scratchReg != getInvalidRegNum());
- CallMI->getRegsUsed().insert(scratchReg);
+ CallMI->insertUsedReg(scratchReg);
}
if (AdIBef.size() > 0)
@@ -1461,7 +1461,7 @@ UltraSparcRegInfo::insertCallerSavingCode(vector<MachineInstr*>& instrnsBefore,
scratchReg = PRA.getUsableUniRegAtMI(scratchRegType, &LVSetAft,
CallMI, AdIBef, AdIAft);
assert(scratchReg != getInvalidRegNum());
- CallMI->getRegsUsed().insert(scratchReg);
+ CallMI->insertUsedReg(scratchReg);
}
if (AdIBef.size() > 0)