mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Reduce the amount of LLVM Values for which we save reg. allocator
state. Also, save the state for the incoming register of each phi node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13906 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a7afac29d0
commit
25d4b54f93
@ -28,6 +28,7 @@
|
|||||||
#include "../LiveVar/FunctionLiveVarInfo.h"
|
#include "../LiveVar/FunctionLiveVarInfo.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
|
#include "llvm/iPHINode.h"
|
||||||
#include "llvm/iOther.h"
|
#include "llvm/iOther.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
@ -1164,18 +1165,22 @@ void PhyRegAlloc::saveState () {
|
|||||||
saveStateForValue (state, Arg, -1, ArgNum);
|
saveStateForValue (state, Arg, -1, ArgNum);
|
||||||
++ArgNum;
|
++ArgNum;
|
||||||
}
|
}
|
||||||
unsigned Insn = 0;
|
unsigned InstCount = 0;
|
||||||
// Instructions themselves encoded as operand # -1
|
// Instructions themselves encoded as operand # -1
|
||||||
for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II){
|
for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II){
|
||||||
saveStateForValue (state, (&*II), Insn, -1);
|
const Instruction *Inst = &*II;
|
||||||
for (unsigned i = 0; i < (*II).getNumOperands (); ++i) {
|
saveStateForValue (state, Inst, InstCount, -1);
|
||||||
const Value *V = (*II).getOperand (i);
|
if (isa<PHINode> (Inst)) {
|
||||||
// Don't worry about it unless it's something whose reg. we'll need.
|
MachineCodeForInstruction &MCforPN = MachineCodeForInstruction::get(Inst);
|
||||||
if (!isa<Argument> (V) && !isa<Instruction> (V))
|
// Last instr should be the copy...figure out what reg it is reading from
|
||||||
continue;
|
if (Value *PhiCpRes = MCforPN.back()->getOperand(0).getVRegValueOrNull()){
|
||||||
saveStateForValue (state, V, Insn, i);
|
if (DEBUG_RA)
|
||||||
|
std::cerr << "Found Phi copy result: " << PhiCpRes->getName()
|
||||||
|
<< " in: " << *MCforPN.back() << "\n";
|
||||||
|
saveStateForValue (state, PhiCpRes, InstCount, -2);
|
||||||
}
|
}
|
||||||
++Insn;
|
}
|
||||||
|
++InstCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user