1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Added phi elimination code

llvm-svn: 1265
This commit is contained in:
Ruchira Sasanka 2001-11-12 14:45:33 +00:00
parent 9b7638e108
commit 426d6e2b10
3 changed files with 55 additions and 13 deletions

View File

@ -943,11 +943,12 @@ ForwardOperand(InstructionNode* treeNode,
}
void
void UltraSparcInstrInfo::
CreateCopyInstructionsByType(const TargetMachine& target,
Value* src,
Instruction* dest,
vector<MachineInstr*>& minstrVec)
vector<MachineInstr*>& minstrVec) const
{
bool loadConstantToReg = false;
@ -1004,6 +1005,7 @@ CreateCopyInstructionsByType(const TargetMachine& target,
}
//******************* Externally Visible Functions *************************/
@ -2048,7 +2050,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
else
{
vector<MachineInstr*> minstrVec;
CreateCopyInstructionsByType(target,
target.getInstrInfo().CreateCopyInstructionsByType(target,
subtreeRoot->getInstruction()->getOperand(forwardOperandNum),
subtreeRoot->getInstruction(), minstrVec);
assert(minstrVec.size() > 0);

View File

@ -139,6 +139,15 @@ public:
vector<MachineInstr*>& minstrVec,
vector<TmpInstruction*>& tempVec,
TargetMachine& target) const;
// create copy instruction(s)
virtual void
CreateCopyInstructionsByType(const TargetMachine& target,
Value* src,
Instruction* dest,
vector<MachineInstr*>& minstrVec) const;
};
@ -1278,7 +1287,7 @@ private:
static const int MinStackFrameSize = 176;
static const int NumFixedOutgoingArgs = 6;
static const int SizeOfEachArgOnStack = 8;
static const int StaticAreaOffsetFromFP = 0 + OFFSET;
static const int StaticAreaOffsetFromFP = 0 + OFFSET;
static const int FirstIncomingArgOffsetFromFP = 128 + OFFSET;
static const int FirstOptionalIncomingArgOffsetFromFP = 176 + OFFSET;
static const int FirstOutgoingArgOffsetFromSP = 128 + OFFSET;

View File

@ -893,7 +893,6 @@ void UltraSparcRegInfo::colorRetValue(const MachineInstr *const RetMI,
// register number
//---------------------------------------------------------------------------
MachineInstr * UltraSparcRegInfo::cpReg2RegMI(const unsigned SrcReg,
const unsigned DestReg,
const int RegType) const {
@ -1040,24 +1039,56 @@ MachineInstr * UltraSparcRegInfo::cpMem2RegMI(const unsigned SrcPtrReg,
// Following method is Not needed now
MachineInstr* UltraSparcRegInfo::cpValue2Value(Value *Src, Value *Dest) const {
//---------------------------------------------------------------------------
// Generate a copy instruction to copy a value to another. Temporarily
// used by PhiElimination code.
//---------------------------------------------------------------------------
MachineInstr * UltraSparcRegInfo::cpValue2Value(Value *Src, Value *Dest) const{
int RegType = getRegType( Src );
assert( (RegType==getRegType(Src)) && "Src & Dest are diff types");
MachineInstr * MI = NULL;
MI = new MachineInstr(ADD, 3);
MI->SetMachineOperand(0, MachineOperand:: MO_VirtualRegister, Src, false);
MI->SetMachineOperand(1, SparcIntRegOrder::g0, false);
MI->SetMachineOperand(2, MachineOperand:: MO_VirtualRegister, Dest, true);
switch( RegType ) {
case IntRegType:
MI = new MachineInstr(ADD, 3);
MI->SetMachineOperand(0, MachineOperand:: MO_VirtualRegister, Src, false);
MI->SetMachineOperand(1, SparcIntRegOrder::g0, false);
MI->SetMachineOperand(2, MachineOperand:: MO_VirtualRegister, Dest, true);
break;
case FPSingleRegType:
MI = new MachineInstr(FMOVS, 2);
MI->SetMachineOperand(0, MachineOperand:: MO_VirtualRegister, Src, false);
MI->SetMachineOperand(1, MachineOperand:: MO_VirtualRegister, Dest, true);
break;
case FPDoubleRegType:
MI = new MachineInstr(FMOVD, 2);
MI->SetMachineOperand(0, MachineOperand:: MO_VirtualRegister, Src, false);
MI->SetMachineOperand(1, MachineOperand:: MO_VirtualRegister, Dest, true);
break;
default:
assert(0 && "Unknow RegType in CpValu2Value");
}
return MI;
}
//----------------------------------------------------------------------------
// This method inserts caller saving/restoring instructons before/after
// a call machine instruction.