Subzero: Use llvm::ilist<> for PhiList and AssignList.
This is toward the goal of pulling non-POD fields out of the CfgNode
class so that CfgNode can be arena-allocated and not leak memory.
For now, PhiList and AssignList are defined as InstList. Ideally,
they would be ilist<> of InstPhi and InstAssign, but SFINAE happens.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/794923002
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 3fcf8a6..1288c20 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -1775,6 +1775,7 @@
// Apple.
NeedsStackAlignment = true;
+ typedef std::vector<Operand *> OperandList;
OperandList XmmArgs;
OperandList StackArgs, StackArgLocations;
uint32_t ParameterAreaSizeBytes = 0;
@@ -4148,7 +4149,9 @@
// Undef input.
void TargetX8632::prelowerPhis() {
CfgNode *Node = Context.getNode();
- for (InstPhi *Phi : Node->getPhis()) {
+ for (auto I = Node->getPhis().begin(), E = Node->getPhis().end(); I != E;
+ ++I) {
+ auto Phi = llvm::dyn_cast<InstPhi>(I);
if (Phi->isDeleted())
continue;
Variable *Dest = Phi->getDest();
@@ -4212,11 +4215,11 @@
// set. TODO(stichnot): This work is being repeated for every split
// edge to the successor, so consider updating LiveIn just once
// after all the edges are split.
- for (InstAssign *Assign : Assignments) {
- Variable *Dest = Assign->getDest();
+ for (auto I = Assignments.begin(), E = Assignments.end(); I != E; ++I) {
+ Variable *Dest = I->getDest();
if (Dest->hasReg()) {
Available[Dest->getRegNum()] = false;
- } else if (isMemoryOperand(Assign->getSrc(0))) {
+ } else if (isMemoryOperand(I->getSrc(0))) {
NeedsRegs = true; // Src and Dest are both in memory
}
}
@@ -4237,7 +4240,7 @@
// afterwards if necessary.
for (auto I = Assignments.rbegin(), E = Assignments.rend(); I != E; ++I) {
Context.rewind();
- InstAssign *Assign = *I;
+ auto Assign = llvm::dyn_cast<InstAssign>(&*I);
Variable *Dest = Assign->getDest();
Operand *Src = Assign->getSrc(0);
Variable *SrcVar = llvm::dyn_cast<Variable>(Src);