mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
Remove usage of MachineBasicBlock::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4342 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -176,9 +176,9 @@ InstructionSelection::InsertCodeForPhis(Function &F)
|
|||||||
{
|
{
|
||||||
// for all basic blocks in function
|
// for all basic blocks in function
|
||||||
//
|
//
|
||||||
for (Function::iterator BB = F.begin(); BB != F.end(); ++BB) {
|
MachineFunction &MF = MachineFunction::get(&F);
|
||||||
BasicBlock::InstListType &InstList = BB->getInstList();
|
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
|
||||||
for (BasicBlock::iterator IIt = InstList.begin();
|
for (BasicBlock::iterator IIt = BB->getBasicBlock()->begin();
|
||||||
PHINode *PN = dyn_cast<PHINode>(&*IIt); ++IIt) {
|
PHINode *PN = dyn_cast<PHINode>(&*IIt); ++IIt) {
|
||||||
// FIXME: This is probably wrong...
|
// FIXME: This is probably wrong...
|
||||||
Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
|
Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
|
||||||
@@ -208,11 +208,7 @@ InstructionSelection::InsertCodeForPhis(Function &F)
|
|||||||
|
|
||||||
vector<MachineInstr*> mvec;
|
vector<MachineInstr*> mvec;
|
||||||
Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec);
|
Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec);
|
||||||
|
BB->insert(BB->begin(), mvec.begin(), mvec.end());
|
||||||
// get an iterator to machine instructions in the BB
|
|
||||||
MachineBasicBlock& bbMvec = MachineBasicBlock::get(BB);
|
|
||||||
|
|
||||||
bbMvec.insert(bbMvec.begin(), mvec.begin(), mvec.end());
|
|
||||||
} // for each Phi Instr in BB
|
} // for each Phi Instr in BB
|
||||||
} // for all BBs in function
|
} // for all BBs in function
|
||||||
}
|
}
|
||||||
@@ -229,21 +225,29 @@ InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
|
|||||||
Instruction *TermInst = (Instruction*)BB->getTerminator();
|
Instruction *TermInst = (Instruction*)BB->getTerminator();
|
||||||
MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst);
|
MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst);
|
||||||
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
||||||
|
|
||||||
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
||||||
|
|
||||||
MachineBasicBlock &bbMvec = MachineBasicBlock::get(BB);
|
MachineFunction &MF = MachineFunction::get(BB->getParent());
|
||||||
|
MachineBasicBlock *MBB;
|
||||||
|
|
||||||
|
// FIXME: if PHI instructions existed in the machine code, this would be
|
||||||
|
// unnecesary.
|
||||||
|
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
|
||||||
|
if (I->getBasicBlock() == BB) {
|
||||||
|
MBB = I;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// find the position of first machine instruction generated by the
|
// find the position of first machine instruction generated by the
|
||||||
// terminator of this BB
|
// terminator of this BB
|
||||||
MachineBasicBlock::iterator MCIt =
|
MachineBasicBlock::iterator MCIt =
|
||||||
std::find(bbMvec.begin(), bbMvec.end(), FirstMIOfTerm);
|
std::find(MBB->begin(), MBB->end(), FirstMIOfTerm);
|
||||||
|
|
||||||
assert( MCIt != bbMvec.end() && "Start inst of terminator not found");
|
assert(MCIt != MBB->end() && "Start inst of terminator not found");
|
||||||
|
|
||||||
// insert the copy instructions just before the first machine instruction
|
// insert the copy instructions just before the first machine instruction
|
||||||
// generated for the terminator
|
// generated for the terminator
|
||||||
bbMvec.insert(MCIt, CpVec.begin(), CpVec.end());
|
MBB->insert(MCIt, CpVec.begin(), CpVec.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -176,9 +176,9 @@ InstructionSelection::InsertCodeForPhis(Function &F)
|
|||||||
{
|
{
|
||||||
// for all basic blocks in function
|
// for all basic blocks in function
|
||||||
//
|
//
|
||||||
for (Function::iterator BB = F.begin(); BB != F.end(); ++BB) {
|
MachineFunction &MF = MachineFunction::get(&F);
|
||||||
BasicBlock::InstListType &InstList = BB->getInstList();
|
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
|
||||||
for (BasicBlock::iterator IIt = InstList.begin();
|
for (BasicBlock::iterator IIt = BB->getBasicBlock()->begin();
|
||||||
PHINode *PN = dyn_cast<PHINode>(&*IIt); ++IIt) {
|
PHINode *PN = dyn_cast<PHINode>(&*IIt); ++IIt) {
|
||||||
// FIXME: This is probably wrong...
|
// FIXME: This is probably wrong...
|
||||||
Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
|
Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
|
||||||
@@ -208,11 +208,7 @@ InstructionSelection::InsertCodeForPhis(Function &F)
|
|||||||
|
|
||||||
vector<MachineInstr*> mvec;
|
vector<MachineInstr*> mvec;
|
||||||
Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec);
|
Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec);
|
||||||
|
BB->insert(BB->begin(), mvec.begin(), mvec.end());
|
||||||
// get an iterator to machine instructions in the BB
|
|
||||||
MachineBasicBlock& bbMvec = MachineBasicBlock::get(BB);
|
|
||||||
|
|
||||||
bbMvec.insert(bbMvec.begin(), mvec.begin(), mvec.end());
|
|
||||||
} // for each Phi Instr in BB
|
} // for each Phi Instr in BB
|
||||||
} // for all BBs in function
|
} // for all BBs in function
|
||||||
}
|
}
|
||||||
@@ -229,21 +225,29 @@ InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
|
|||||||
Instruction *TermInst = (Instruction*)BB->getTerminator();
|
Instruction *TermInst = (Instruction*)BB->getTerminator();
|
||||||
MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst);
|
MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst);
|
||||||
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
||||||
|
|
||||||
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
||||||
|
|
||||||
MachineBasicBlock &bbMvec = MachineBasicBlock::get(BB);
|
MachineFunction &MF = MachineFunction::get(BB->getParent());
|
||||||
|
MachineBasicBlock *MBB;
|
||||||
|
|
||||||
|
// FIXME: if PHI instructions existed in the machine code, this would be
|
||||||
|
// unnecesary.
|
||||||
|
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
|
||||||
|
if (I->getBasicBlock() == BB) {
|
||||||
|
MBB = I;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// find the position of first machine instruction generated by the
|
// find the position of first machine instruction generated by the
|
||||||
// terminator of this BB
|
// terminator of this BB
|
||||||
MachineBasicBlock::iterator MCIt =
|
MachineBasicBlock::iterator MCIt =
|
||||||
std::find(bbMvec.begin(), bbMvec.end(), FirstMIOfTerm);
|
std::find(MBB->begin(), MBB->end(), FirstMIOfTerm);
|
||||||
|
|
||||||
assert( MCIt != bbMvec.end() && "Start inst of terminator not found");
|
assert(MCIt != MBB->end() && "Start inst of terminator not found");
|
||||||
|
|
||||||
// insert the copy instructions just before the first machine instruction
|
// insert the copy instructions just before the first machine instruction
|
||||||
// generated for the terminator
|
// generated for the terminator
|
||||||
bbMvec.insert(MCIt, CpVec.begin(), CpVec.end());
|
MBB->insert(MCIt, CpVec.begin(), CpVec.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user