mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Remove PHINodeTraits and use MachineInstrExpressionTrait instead.
llvm-svn: 97687
This commit is contained in:
parent
0b21835716
commit
7310728cf9
@ -443,34 +443,3 @@ MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A,
|
||||
|
||||
return NMBB;
|
||||
}
|
||||
|
||||
unsigned
|
||||
PHIElimination::PHINodeTraits::getHashValue(const MachineInstr *MI) {
|
||||
if (!MI || MI==getEmptyKey() || MI==getTombstoneKey())
|
||||
return DenseMapInfo<MachineInstr*>::getHashValue(MI);
|
||||
unsigned hash = 0;
|
||||
for (unsigned ni = 1, ne = MI->getNumOperands(); ni != ne; ni += 2)
|
||||
hash = hash*37 + DenseMapInfo<BBVRegPair>::
|
||||
getHashValue(BBVRegPair(MI->getOperand(ni+1).getMBB()->getNumber(),
|
||||
MI->getOperand(ni).getReg()));
|
||||
return hash;
|
||||
}
|
||||
|
||||
bool PHIElimination::PHINodeTraits::isEqual(const MachineInstr *LHS,
|
||||
const MachineInstr *RHS) {
|
||||
const MachineInstr *EmptyKey = getEmptyKey();
|
||||
const MachineInstr *TombstoneKey = getTombstoneKey();
|
||||
if (!LHS || !RHS || LHS==EmptyKey || RHS==EmptyKey ||
|
||||
LHS==TombstoneKey || RHS==TombstoneKey)
|
||||
return LHS==RHS;
|
||||
|
||||
unsigned ne = LHS->getNumOperands();
|
||||
if (ne != RHS->getNumOperands())
|
||||
return false;
|
||||
// Ignore operand 0, the defined register.
|
||||
for (unsigned ni = 1; ni != ne; ni += 2)
|
||||
if (LHS->getOperand(ni).getReg() != RHS->getOperand(ni).getReg() ||
|
||||
LHS->getOperand(ni+1).getMBB() != RHS->getOperand(ni+1).getMBB())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -102,15 +102,9 @@ namespace llvm {
|
||||
// Defs of PHI sources which are implicit_def.
|
||||
SmallPtrSet<MachineInstr*, 4> ImpDefs;
|
||||
|
||||
// Lowered PHI nodes may be reused. We provide special DenseMap traits to
|
||||
// match PHI nodes with identical arguments.
|
||||
struct PHINodeTraits : public DenseMapInfo<MachineInstr*> {
|
||||
static unsigned getHashValue(const MachineInstr *PtrVal);
|
||||
static bool isEqual(const MachineInstr *LHS, const MachineInstr *RHS);
|
||||
};
|
||||
|
||||
// Map reusable lowered PHI node -> incoming join register.
|
||||
typedef DenseMap<MachineInstr*, unsigned, PHINodeTraits> LoweredPHIMap;
|
||||
typedef DenseMap<MachineInstr*, unsigned,
|
||||
MachineInstrExpressionTrait> LoweredPHIMap;
|
||||
LoweredPHIMap LoweredPHIs;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user