diff options
| author | Brian Gaeke <gaeke@uiuc.edu> | 2004-05-30 07:08:43 +0000 |
|---|---|---|
| committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-05-30 07:08:43 +0000 |
| commit | 01c1f3279dd72f743269a20dcf9a1e540c97077d (patch) | |
| tree | a912477a043c5e98e92df05f885a553ee7fd739c | |
| parent | 98366689443087569f243ae19fbb7e41e917d12d (diff) | |
| download | bcm5719-llvm-01c1f3279dd72f743269a20dcf9a1e540c97077d.tar.gz bcm5719-llvm-01c1f3279dd72f743269a20dcf9a1e540c97077d.zip | |
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.
llvm-svn: 13906
| -rw-r--r-- | llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index fbabc61aa58..b813ee49713 100644 --- a/llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -28,6 +28,7 @@ #include "../LiveVar/FunctionLiveVarInfo.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include "llvm/iPHINode.h" #include "llvm/iOther.h" #include "llvm/Module.h" #include "llvm/Type.h" @@ -1164,18 +1165,22 @@ void PhyRegAlloc::saveState () { saveStateForValue (state, Arg, -1, ArgNum); ++ArgNum; } - unsigned Insn = 0; + unsigned InstCount = 0; // Instructions themselves encoded as operand # -1 for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II){ - saveStateForValue (state, (&*II), Insn, -1); - for (unsigned i = 0; i < (*II).getNumOperands (); ++i) { - const Value *V = (*II).getOperand (i); - // Don't worry about it unless it's something whose reg. we'll need. - if (!isa<Argument> (V) && !isa<Instruction> (V)) - continue; - saveStateForValue (state, V, Insn, i); + const Instruction *Inst = &*II; + saveStateForValue (state, Inst, InstCount, -1); + if (isa<PHINode> (Inst)) { + MachineCodeForInstruction &MCforPN = MachineCodeForInstruction::get(Inst); + // Last instr should be the copy...figure out what reg it is reading from + if (Value *PhiCpRes = MCforPN.back()->getOperand(0).getVRegValueOrNull()){ + if (DEBUG_RA) + std::cerr << "Found Phi copy result: " << PhiCpRes->getName() + << " in: " << *MCforPN.back() << "\n"; + saveStateForValue (state, PhiCpRes, InstCount, -2); + } } - ++Insn; + ++InstCount; } } |

