2001-09-14 21:18:34 +00:00
|
|
|
#include "llvm/CodeGen/LiveRangeInfo.h"
|
2002-02-04 05:56:09 +00:00
|
|
|
#include "llvm/CodeGen/RegClass.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Method.h"
|
2002-02-12 21:07:25 +00:00
|
|
|
#include "llvm/BasicBlock.h"
|
2002-02-05 03:35:53 +00:00
|
|
|
#include "Support/SetOperations.h"
|
2002-01-20 22:54:45 +00:00
|
|
|
#include <iostream>
|
|
|
|
using std::cerr;
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 06:02:59 +00:00
|
|
|
LiveRangeInfo::LiveRangeInfo(const Method *M, const TargetMachine &tm,
|
2002-01-20 22:54:45 +00:00
|
|
|
std::vector<RegClass *> &RCL)
|
2002-02-05 06:02:59 +00:00
|
|
|
: Meth(M), TM(tm), RegClassList(RCL), MRI(tm.getRegInfo()) { }
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
LiveRangeInfo::~LiveRangeInfo() {
|
2002-02-05 06:02:59 +00:00
|
|
|
for (LiveRangeMapType::iterator MI = LiveRangeMap.begin();
|
|
|
|
MI != LiveRangeMap.end(); ++MI) {
|
2002-01-07 19:19:18 +00:00
|
|
|
|
2002-01-20 22:54:45 +00:00
|
|
|
if (MI->first && MI->second) {
|
|
|
|
LiveRange *LR = MI->second;
|
2002-01-07 19:19:18 +00:00
|
|
|
|
2002-01-20 22:54:45 +00:00
|
|
|
// we need to be careful in deleting LiveRanges in LiveRangeMap
|
|
|
|
// since two/more Values in the live range map can point to the same
|
|
|
|
// live range. We have to make the other entries NULL when we delete
|
|
|
|
// a live range.
|
2002-01-07 19:19:18 +00:00
|
|
|
|
2002-02-05 06:02:59 +00:00
|
|
|
for(LiveRange::iterator LI = LR->begin(); LI != LR->end(); ++LI)
|
2002-01-20 22:54:45 +00:00
|
|
|
LiveRangeMap[*LI] = 0;
|
|
|
|
|
|
|
|
delete LR;
|
2002-01-07 19:19:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2001-09-14 21:18:34 +00:00
|
|
|
// union two live ranges into one. The 2nd LR is deleted. Used for coalescing.
|
2001-09-30 23:11:59 +00:00
|
|
|
// Note: the caller must make sure that L1 and L2 are distinct and both
|
|
|
|
// LRs don't have suggested colors
|
2002-01-07 19:19:18 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 02:52:05 +00:00
|
|
|
void LiveRangeInfo::unionAndUpdateLRs(LiveRange *L1, LiveRange *L2) {
|
|
|
|
assert(L1 != L2 && (!L1->hasSuggestedColor() || !L2->hasSuggestedColor()));
|
|
|
|
set_union(*L1, *L2); // add elements of L2 to L1
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 02:52:05 +00:00
|
|
|
for(ValueSet::iterator L2It = L2->begin(); L2It != L2->end(); ++L2It) {
|
2001-09-14 21:18:34 +00:00
|
|
|
//assert(( L1->getTypeID() == L2->getTypeID()) && "Merge:Different types");
|
|
|
|
|
2002-02-04 16:36:59 +00:00
|
|
|
L1->insert(*L2It); // add the var in L2 to L1
|
2002-02-05 02:52:05 +00:00
|
|
|
LiveRangeMap[*L2It] = L1; // now the elements in L2 should map
|
2002-01-07 19:19:18 +00:00
|
|
|
//to L1
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
2001-09-30 23:11:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Now if LROfDef(L1) has a suggested color, it will remain.
|
|
|
|
// But, if LROfUse(L2) has a suggested color, the new range
|
|
|
|
// must have the same color.
|
|
|
|
|
|
|
|
if(L2->hasSuggestedColor())
|
2002-02-05 02:52:05 +00:00
|
|
|
L1->setSuggestedColor(L2->getSuggestedColor());
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-19 17:21:03 +00:00
|
|
|
|
2002-02-05 02:52:05 +00:00
|
|
|
if (L2->isCallInterference())
|
2001-10-19 17:21:03 +00:00
|
|
|
L1->setCallInterference();
|
|
|
|
|
2002-02-05 02:52:05 +00:00
|
|
|
// add the spill costs
|
|
|
|
L1->addSpillCost(L2->getSpillCost());
|
|
|
|
|
2002-01-20 22:54:45 +00:00
|
|
|
delete L2; // delete L2 as it is no longer needed
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Method for constructing all live ranges in a method. It creates live
|
|
|
|
// ranges for all values defined in the instruction stream. Also, it
|
|
|
|
// creates live ranges for all incoming arguments of the method.
|
|
|
|
//---------------------------------------------------------------------------
|
2002-02-05 06:02:59 +00:00
|
|
|
void LiveRangeInfo::constructLiveRanges() {
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 06:02:59 +00:00
|
|
|
if (DEBUG_RA)
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "Consturcting Live Ranges ...\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
// first find the live ranges for all incoming args of the method since
|
|
|
|
// those LRs start from the start of the method
|
|
|
|
|
|
|
|
// get the argument list
|
|
|
|
const Method::ArgumentListType& ArgList = Meth->getArgumentList();
|
|
|
|
// get an iterator to arg list
|
|
|
|
Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();
|
|
|
|
|
|
|
|
|
|
|
|
for( ; ArgIt != ArgList.end() ; ++ArgIt) { // for each argument
|
|
|
|
LiveRange * ArgRange = new LiveRange(); // creates a new LR and
|
2002-02-04 16:36:59 +00:00
|
|
|
const Value *Val = (const Value *) *ArgIt;
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-04 16:36:59 +00:00
|
|
|
ArgRange->insert(Val); // add the arg (def) to it
|
2002-01-20 22:54:45 +00:00
|
|
|
LiveRangeMap[Val] = ArgRange;
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
// create a temp machine op to find the register class of value
|
|
|
|
//const MachineOperand Op(MachineOperand::MO_VirtualRegister);
|
|
|
|
|
2001-09-30 23:11:59 +00:00
|
|
|
unsigned rcid = MRI.getRegClassIDOfValue( Val );
|
2001-09-14 21:18:34 +00:00
|
|
|
ArgRange->setRegClass(RegClassList[ rcid ] );
|
|
|
|
|
|
|
|
|
|
|
|
if( DEBUG_RA > 1) {
|
2002-02-05 01:43:49 +00:00
|
|
|
cerr << " adding LiveRange for argument "
|
|
|
|
<< RAV((const Value *)*ArgIt) << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-09-30 23:11:59 +00:00
|
|
|
// Now suggest hardware registers for these method args
|
|
|
|
MRI.suggestRegs4MethodArgs(Meth, *this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now find speical LLVM instructions (CALL, RET) and LRs in machine
|
|
|
|
// instructions.
|
2002-02-05 06:02:59 +00:00
|
|
|
//
|
|
|
|
for (Method::const_iterator BBI = Meth->begin(); BBI != Meth->end(); ++BBI) {
|
2001-09-30 23:11:59 +00:00
|
|
|
// Now find all LRs for machine the instructions. A new LR will be created
|
|
|
|
// only for defs in the machine instr since, we assume that all Values are
|
|
|
|
// defined before they are used. However, there can be multiple defs for
|
|
|
|
// the same Value in machine instructions.
|
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
// get the iterator for machine instructions
|
|
|
|
const MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec();
|
|
|
|
|
|
|
|
// iterate over all the machine instructions in BB
|
2002-02-05 06:02:59 +00:00
|
|
|
for(MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
|
|
|
|
MInstIterator != MIVec.end(); ++MInstIterator) {
|
|
|
|
const MachineInstr *MInst = *MInstIterator;
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
// Now if the machine instruction is a call/return instruction,
|
|
|
|
// add it to CallRetInstrList for processing its implicit operands
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2002-01-20 22:54:45 +00:00
|
|
|
if(TM.getInstrInfo().isReturn(MInst->getOpCode()) ||
|
|
|
|
TM.getInstrInfo().isCall(MInst->getOpCode()))
|
2001-10-15 16:26:38 +00:00
|
|
|
CallRetInstrList.push_back( MInst );
|
|
|
|
|
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
// iterate over MI operands to find defs
|
2002-02-05 06:02:59 +00:00
|
|
|
for (MachineInstr::const_val_op_iterator OpI = MInst->begin(),
|
|
|
|
OpE = MInst->end(); OpI != OpE; ++OpI) {
|
2002-01-20 22:54:45 +00:00
|
|
|
if(DEBUG_RA) {
|
2001-10-15 16:26:38 +00:00
|
|
|
MachineOperand::MachineOperandType OpTyp =
|
|
|
|
OpI.getMachineOperand().getOperandType();
|
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
if (OpTyp == MachineOperand::MO_CCRegister)
|
|
|
|
cerr << "\n**CC reg found. Is Def=" << OpI.isDef() << " Val:"
|
|
|
|
<< RAV(OpI.getMachineOperand().getVRegValue()) << "\n";
|
2001-09-18 22:43:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
// create a new LR iff this operand is a def
|
2002-02-04 16:36:59 +00:00
|
|
|
if (OpI.isDef()) {
|
|
|
|
const Value *Def = *OpI;
|
2001-09-30 23:11:59 +00:00
|
|
|
|
|
|
|
// Only instruction values are accepted for live ranges here
|
2002-02-05 01:43:49 +00:00
|
|
|
if (Def->getValueType() != Value::InstructionVal ) {
|
|
|
|
cerr << "\n**%%Error: Def is not an instruction val. Def="
|
|
|
|
<< RAV(Def) << "\n";
|
2001-09-30 23:11:59 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
LiveRange *DefRange = LiveRangeMap[Def];
|
|
|
|
|
|
|
|
// see LR already there (because of multiple defs)
|
|
|
|
if( !DefRange) { // if it is not in LiveRangeMap
|
|
|
|
DefRange = new LiveRange(); // creates a new live range and
|
2002-02-04 16:36:59 +00:00
|
|
|
DefRange->insert(Def); // add the instruction (def) to it
|
2001-09-14 21:18:34 +00:00
|
|
|
LiveRangeMap[ Def ] = DefRange; // update the map
|
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
if (DEBUG_RA > 1)
|
|
|
|
cerr << " creating a LR for def: " << RAV(Def) << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
// set the register class of the new live range
|
|
|
|
//assert( RegClassList.size() );
|
|
|
|
MachineOperand::MachineOperandType OpTy =
|
|
|
|
OpI.getMachineOperand().getOperandType();
|
|
|
|
|
|
|
|
bool isCC = ( OpTy == MachineOperand::MO_CCRegister);
|
2001-09-30 23:11:59 +00:00
|
|
|
unsigned rcid = MRI.getRegClassIDOfValue(
|
2001-09-14 21:18:34 +00:00
|
|
|
OpI.getMachineOperand().getVRegValue(), isCC );
|
|
|
|
|
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
if (isCC && DEBUG_RA)
|
|
|
|
cerr << "\a**created a LR for a CC reg:"
|
|
|
|
<< RAV(OpI.getMachineOperand().getVRegValue());
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
DefRange->setRegClass(RegClassList[rcid]);
|
|
|
|
} else {
|
2002-02-04 16:36:59 +00:00
|
|
|
DefRange->insert(Def); // add the opearand to def range
|
2001-09-14 21:18:34 +00:00
|
|
|
// update the map - Operand points
|
|
|
|
// to the merged set
|
2002-02-05 01:43:49 +00:00
|
|
|
LiveRangeMap[Def] = DefRange;
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
if (DEBUG_RA > 1)
|
|
|
|
cerr << " added to an existing LR for def: "
|
|
|
|
<< RAV(Def) << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // if isDef()
|
|
|
|
|
|
|
|
} // for all opereands in machine instructions
|
|
|
|
|
|
|
|
} // for all machine instructions in the BB
|
|
|
|
|
2001-09-30 23:11:59 +00:00
|
|
|
} // for all BBs in method
|
|
|
|
|
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
// Now we have to suggest clors for call and return arg live ranges.
|
|
|
|
// Also, if there are implicit defs (e.g., retun value of a call inst)
|
|
|
|
// they must be added to the live range list
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
suggestRegs4CallRets();
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
if( DEBUG_RA)
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "Initial Live Ranges constructed!\n";
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
}
|
2001-09-30 23:11:59 +00:00
|
|
|
|
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// If some live ranges must be colored with specific hardware registers
|
|
|
|
// (e.g., for outgoing call args), suggesting of colors for such live
|
|
|
|
// ranges is done using target specific method. Those methods are called
|
|
|
|
// from this function. The target specific methods must:
|
|
|
|
// 1) suggest colors for call and return args.
|
|
|
|
// 2) create new LRs for implicit defs in machine instructions
|
|
|
|
//---------------------------------------------------------------------------
|
2001-10-15 16:26:38 +00:00
|
|
|
void LiveRangeInfo::suggestRegs4CallRets()
|
|
|
|
{
|
2001-09-30 23:11:59 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
CallRetInstrListType::const_iterator It = CallRetInstrList.begin();
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
for( ; It != CallRetInstrList.end(); ++It ) {
|
|
|
|
|
|
|
|
const MachineInstr *MInst = *It;
|
|
|
|
MachineOpCode OpCode = MInst->getOpCode();
|
|
|
|
|
|
|
|
if( (TM.getInstrInfo()).isReturn(OpCode) )
|
|
|
|
MRI.suggestReg4RetValue( MInst, *this);
|
|
|
|
|
|
|
|
else if( (TM.getInstrInfo()).isCall( OpCode ) )
|
|
|
|
MRI.suggestRegs4CallArgs( MInst, *this, RegClassList );
|
|
|
|
|
|
|
|
else
|
|
|
|
assert( 0 && "Non call/ret instr in CallRetInstrList" );
|
|
|
|
}
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
// The following method coalesces live ranges when possible. This method
|
|
|
|
// must be called after the interference graph has been constructed.
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2001-10-15 16:26:38 +00:00
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
/* Algorithm:
|
|
|
|
for each BB in method
|
|
|
|
for each machine instruction (inst)
|
|
|
|
for each definition (def) in inst
|
|
|
|
for each operand (op) of inst that is a use
|
2001-11-10 00:20:24 +00:00
|
|
|
if the def and op are of the same register type
|
2001-09-14 21:18:34 +00:00
|
|
|
if the def and op do not interfere //i.e., not simultaneously live
|
|
|
|
if (degree(LR of def) + degree(LR of op)) <= # avail regs
|
2001-09-30 23:11:59 +00:00
|
|
|
if both LRs do not have suggested colors
|
|
|
|
merge2IGNodes(def, op) // i.e., merge 2 LRs
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
*/
|
2002-01-07 19:19:18 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
void LiveRangeInfo::coalesceLRs()
|
|
|
|
{
|
2001-09-14 21:18:34 +00:00
|
|
|
if( DEBUG_RA)
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "\nCoalscing LRs ...\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
Method::const_iterator BBI = Meth->begin(); // random iterator for BBs
|
|
|
|
|
|
|
|
for( ; BBI != Meth->end(); ++BBI) { // traverse BBs in random order
|
|
|
|
|
|
|
|
// get the iterator for machine instructions
|
|
|
|
const MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec();
|
2002-01-20 22:54:45 +00:00
|
|
|
MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin();
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
// iterate over all the machine instructions in BB
|
|
|
|
for( ; MInstIterator != MIVec.end(); ++MInstIterator) {
|
|
|
|
|
|
|
|
const MachineInstr * MInst = *MInstIterator;
|
|
|
|
|
|
|
|
if( DEBUG_RA > 1) {
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << " *Iterating over machine instr ";
|
2001-09-14 21:18:34 +00:00
|
|
|
MInst->dump();
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// iterate over MI operands to find defs
|
2002-02-05 06:02:59 +00:00
|
|
|
for(MachineInstr::const_val_op_iterator DefI = MInst->begin(),
|
|
|
|
DefE = MInst->end(); DefI != DefE; ++DefI) {
|
|
|
|
if (DefI.isDef()) { // iff this operand is a def
|
|
|
|
LiveRange *LROfDef = getLiveRangeForValue( *DefI );
|
|
|
|
RegClass *RCOfDef = LROfDef->getRegClass();
|
|
|
|
|
|
|
|
MachineInstr::const_val_op_iterator UseI = MInst->begin(),
|
|
|
|
UseE = MInst->end();
|
|
|
|
for( ; UseI != UseE; ++UseI){ // for all uses
|
|
|
|
|
|
|
|
LiveRange *LROfUse = getLiveRangeForValue( *UseI );
|
|
|
|
if (!LROfUse) { // if LR of use is not found
|
2001-09-14 21:18:34 +00:00
|
|
|
//don't warn about labels
|
2002-02-05 03:52:29 +00:00
|
|
|
if (!isa<BasicBlock>(*UseI) && DEBUG_RA)
|
2002-02-05 01:43:49 +00:00
|
|
|
cerr << " !! Warning: No LR for use " << RAV(*UseI) << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
continue; // ignore and continue
|
|
|
|
}
|
|
|
|
|
2002-02-05 06:02:59 +00:00
|
|
|
if (LROfUse == LROfDef) // nothing to merge if they are same
|
2001-09-14 21:18:34 +00:00
|
|
|
continue;
|
|
|
|
|
2002-02-05 03:52:29 +00:00
|
|
|
if (MRI.getRegType(LROfDef) == MRI.getRegType(LROfUse)) {
|
2001-11-10 00:20:24 +00:00
|
|
|
|
|
|
|
// If the two RegTypes are the same
|
2002-02-05 03:52:29 +00:00
|
|
|
if (!RCOfDef->getInterference(LROfDef, LROfUse) ) {
|
2001-09-14 21:18:34 +00:00
|
|
|
|
|
|
|
unsigned CombinedDegree =
|
|
|
|
LROfDef->getUserIGNode()->getNumOfNeighbors() +
|
|
|
|
LROfUse->getUserIGNode()->getNumOfNeighbors();
|
|
|
|
|
2002-02-05 03:52:29 +00:00
|
|
|
if (CombinedDegree <= RCOfDef->getNumOfAvailRegs()) {
|
2001-09-30 23:11:59 +00:00
|
|
|
// if both LRs do not have suggested colors
|
2002-02-05 03:52:29 +00:00
|
|
|
if (!(LROfDef->hasSuggestedColor() &&
|
|
|
|
LROfUse->hasSuggestedColor())) {
|
2001-09-30 23:11:59 +00:00
|
|
|
|
|
|
|
RCOfDef->mergeIGNodesOfLRs(LROfDef, LROfUse);
|
|
|
|
unionAndUpdateLRs(LROfDef, LROfUse);
|
|
|
|
}
|
|
|
|
|
2001-09-14 21:18:34 +00:00
|
|
|
} // if combined degree is less than # of regs
|
|
|
|
} // if def and use do not interfere
|
2001-10-12 17:48:18 +00:00
|
|
|
}// if reg classes are the same
|
2001-09-14 21:18:34 +00:00
|
|
|
} // for all uses
|
|
|
|
} // if def
|
|
|
|
} // for all defs
|
|
|
|
} // for all machine instructions
|
|
|
|
} // for all BBs
|
|
|
|
|
2002-02-05 06:02:59 +00:00
|
|
|
if (DEBUG_RA)
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "\nCoalscing Done!\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------- Debug code for printing ---------------*/
|
|
|
|
|
|
|
|
|
2002-02-05 01:43:49 +00:00
|
|
|
void LiveRangeInfo::printLiveRanges() {
|
2001-09-14 21:18:34 +00:00
|
|
|
LiveRangeMapType::iterator HMI = LiveRangeMap.begin(); // hash map iterator
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "\nPrinting Live Ranges from Hash Map:\n";
|
2002-02-05 01:43:49 +00:00
|
|
|
for( ; HMI != LiveRangeMap.end(); ++HMI) {
|
|
|
|
if (HMI->first && HMI->second) {
|
|
|
|
cerr << " " << RAV(HMI->first) << "\t: ";
|
2002-02-05 02:52:05 +00:00
|
|
|
printSet(*HMI->second); cerr << "\n";
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|