diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-03-11 06:45:52 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-03-11 06:45:52 +0000 |
commit | cf68bd5fc1e4f372d310756839a353849c655709 (patch) | |
tree | 9a517501640bc8155544a1f96e2a32338f533795 /lib/Target/SparcV9/RegAlloc | |
parent | 36061dab060d5a50fd18359e528bb41afe0f9b68 (diff) | |
download | external_llvm-cf68bd5fc1e4f372d310756839a353849c655709.zip external_llvm-cf68bd5fc1e4f372d310756839a353849c655709.tar.gz external_llvm-cf68bd5fc1e4f372d310756839a353849c655709.tar.bz2 |
In PhyRegAlloc::saveState(), dump Arguments' saved-state, and try to
make the output more compact.
Divorce state-saving from the doFinalization method; for some reason it's not
getting called when I want it to, at Reoptimizer time. Put the guts in
PhyRegAlloc::finishSavingState(). Put an abort() in it so that I can be really
really sure that it's getting called.
Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/RegAlloc')
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp | 40 | ||||
-rw-r--r-- | lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h | 1 |
2 files changed, 31 insertions, 10 deletions
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index 410c120..1428fc6 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -1186,14 +1186,27 @@ void PhyRegAlloc::saveState () { /// void PhyRegAlloc::verifySavedState () { std::vector<AllocInfo> &state = FnAllocState[Fn]; + int ArgNum = 0; + for (Function::const_aiterator i=Fn->abegin (), e=Fn->aend (); i != e; ++i) { + const Argument *Arg = &*i; + std::cerr << "Argument: " << *Arg << "\n" + << "FnAllocState:\n"; + for (unsigned i = 0; i < state.size (); ++i) { + AllocInfo &S = state[i]; + if (S.Instruction == -1 && S.Operand == ArgNum) + std::cerr << " " << S << "\n"; + } + std::cerr << "----------\n"; + ++ArgNum; + } int Insn = 0; for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II) { const Instruction *I = *II; MachineCodeForInstruction &Instrs = MachineCodeForInstruction::get (I); - std::cerr << "Instruction:\n" << " " << *I << "\n" + std::cerr << "Instruction: " << *I << "MachineCodeForInstruction:\n"; for (unsigned i = 0, n = Instrs.size (); i != n; ++i) - std::cerr << " " << *Instrs[i] << "\n"; + std::cerr << " " << *Instrs[i]; std::cerr << "FnAllocState:\n"; for (unsigned i = 0; i < state.size (); ++i) { AllocInfo &S = state[i]; @@ -1206,21 +1219,29 @@ void PhyRegAlloc::verifySavedState () { } +bool PhyRegAlloc::doFinalization (Module &M) { + if (SaveRegAllocState) finishSavingState (M); + return false; +} + + /// Finish the job of saveState(), by collapsing FnAllocState into an LLVM -/// Constant and stuffing it inside the Module. (NOTE: Soon, there will be -/// other, better ways of storing the saved state; this one is cumbersome and -/// does not work well with the JIT.) +/// Constant and stuffing it inside the Module. /// -bool PhyRegAlloc::doFinalization (Module &M) { - if (!SaveRegAllocState) - return false; // Nothing to do here, unless we're saving state. +/// FIXME: There should be other, better ways of storing the saved +/// state; this one is cumbersome and does not work well with the JIT. +/// +void PhyRegAlloc::finishSavingState (Module &M) { + std::cerr << "---- Saving reg. alloc state; SaveStateToModule = " + << SaveStateToModule << " ----\n"; + abort (); // If saving state into the module, just copy new elements to the // correct global. if (!SaveStateToModule) { ExportedFnAllocState = FnAllocState; // FIXME: should ONLY copy new elements in FnAllocState - return false; + return; } // Convert FnAllocState to a single Constant array and add it @@ -1282,7 +1303,6 @@ bool PhyRegAlloc::doFinalization (Module &M) { new GlobalVariable (ST2, true, GlobalValue::ExternalLinkage, ConstantStruct::get (ST2, CV2), "_llvm_regAllocState", &M); - return false; // No error. } diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h index 2536155..b8d9bcc 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h @@ -129,6 +129,7 @@ private: const Value *V, int Insn, int Opnd); void saveState(); void verifySavedState(); + void finishSavingState(Module &M); void setCallInterferences(const MachineInstr *MI, const ValueSet *LVSetAft); |