mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Sparc: No functionality change. Cleanup whitespaces, comment formatting etc.,
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183243 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5a57dbef33
commit
1e06bcbd63
@ -107,7 +107,7 @@ bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
||||
MachineBasicBlock::iterator MI = I;
|
||||
++I;
|
||||
|
||||
//If MI is restore, try combining it with previous inst.
|
||||
// If MI is restore, try combining it with previous inst.
|
||||
if (!DisableDelaySlotFiller &&
|
||||
(MI->getOpcode() == SP::RESTORErr
|
||||
|| MI->getOpcode() == SP::RESTOREri)) {
|
||||
@ -115,7 +115,7 @@ bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//If MI has no delay slot, skip
|
||||
// If MI has no delay slot, skip.
|
||||
if (!MI->hasDelaySlot())
|
||||
continue;
|
||||
|
||||
@ -135,7 +135,7 @@ bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
||||
unsigned structSize = 0;
|
||||
if (needsUnimp(MI, structSize)) {
|
||||
MachineBasicBlock::iterator J = MI;
|
||||
++J; //skip the delay filler.
|
||||
++J; // skip the delay filler.
|
||||
assert (J != MBB.end() && "MI needs a delay instruction.");
|
||||
BuildMI(MBB, ++J, I->getDebugLoc(),
|
||||
TII->get(SP::UNIMP)).addImm(structSize);
|
||||
@ -165,13 +165,13 @@ Filler::findDelayInstr(MachineBasicBlock &MBB,
|
||||
|
||||
if (J->getOpcode() == SP::RESTORErr
|
||||
|| J->getOpcode() == SP::RESTOREri) {
|
||||
//change retl to ret
|
||||
// change retl to ret.
|
||||
slot->setDesc(TII->get(SP::RET));
|
||||
return J;
|
||||
}
|
||||
}
|
||||
|
||||
//Call's delay filler can def some of call's uses.
|
||||
// Call's delay filler can def some of call's uses.
|
||||
if (slot->isCall())
|
||||
insertCallDefsUses(slot, RegDefs, RegUses);
|
||||
else
|
||||
@ -241,12 +241,12 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
|
||||
unsigned Reg = MO.getReg();
|
||||
|
||||
if (MO.isDef()) {
|
||||
//check whether Reg is defined or used before delay slot.
|
||||
// check whether Reg is defined or used before delay slot.
|
||||
if (IsRegInSet(RegDefs, Reg) || IsRegInSet(RegUses, Reg))
|
||||
return true;
|
||||
}
|
||||
if (MO.isUse()) {
|
||||
//check whether Reg is defined before delay slot.
|
||||
// check whether Reg is defined before delay slot.
|
||||
if (IsRegInSet(RegDefs, Reg))
|
||||
return true;
|
||||
}
|
||||
@ -259,7 +259,7 @@ void Filler::insertCallDefsUses(MachineBasicBlock::iterator MI,
|
||||
SmallSet<unsigned, 32>& RegDefs,
|
||||
SmallSet<unsigned, 32>& RegUses)
|
||||
{
|
||||
//Call defines o7, which is visible to the instruction in delay slot.
|
||||
// Call defines o7, which is visible to the instruction in delay slot.
|
||||
RegDefs.insert(SP::O7);
|
||||
|
||||
switch(MI->getOpcode()) {
|
||||
@ -283,7 +283,7 @@ void Filler::insertCallDefsUses(MachineBasicBlock::iterator MI,
|
||||
}
|
||||
}
|
||||
|
||||
//Insert Defs and Uses of MI into the sets RegDefs and RegUses.
|
||||
// Insert Defs and Uses of MI into the sets RegDefs and RegUses.
|
||||
void Filler::insertDefsUses(MachineBasicBlock::iterator MI,
|
||||
SmallSet<unsigned, 32>& RegDefs,
|
||||
SmallSet<unsigned, 32>& RegUses)
|
||||
@ -299,8 +299,8 @@ void Filler::insertDefsUses(MachineBasicBlock::iterator MI,
|
||||
if (MO.isDef())
|
||||
RegDefs.insert(Reg);
|
||||
if (MO.isUse()) {
|
||||
//Implicit register uses of retl are return values and
|
||||
//retl does not use them.
|
||||
// Implicit register uses of retl are return values and
|
||||
// retl does not use them.
|
||||
if (MO.isImplicit() && MI->getOpcode() == SP::RETL)
|
||||
continue;
|
||||
RegUses.insert(Reg);
|
||||
@ -308,7 +308,7 @@ void Filler::insertDefsUses(MachineBasicBlock::iterator MI,
|
||||
}
|
||||
}
|
||||
|
||||
//returns true if the Reg or its alias is in the RegSet.
|
||||
// returns true if the Reg or its alias is in the RegSet.
|
||||
bool Filler::IsRegInSet(SmallSet<unsigned, 32>& RegSet, unsigned Reg)
|
||||
{
|
||||
// Check Reg and all aliased Registers.
|
||||
@ -355,24 +355,24 @@ static bool combineRestoreADD(MachineBasicBlock::iterator RestoreMI,
|
||||
MachineBasicBlock::iterator AddMI,
|
||||
const TargetInstrInfo *TII)
|
||||
{
|
||||
//Before: add <op0>, <op1>, %i[0-7]
|
||||
// restore %g0, %g0, %i[0-7]
|
||||
// Before: add <op0>, <op1>, %i[0-7]
|
||||
// restore %g0, %g0, %i[0-7]
|
||||
//
|
||||
//After : restore <op0>, <op1>, %o[0-7]
|
||||
// After : restore <op0>, <op1>, %o[0-7]
|
||||
|
||||
unsigned reg = AddMI->getOperand(0).getReg();
|
||||
if (reg < SP::I0 || reg > SP::I7)
|
||||
return false;
|
||||
|
||||
//Erase RESTORE
|
||||
// Erase RESTORE.
|
||||
RestoreMI->eraseFromParent();
|
||||
|
||||
//Change ADD to RESTORE
|
||||
// Change ADD to RESTORE.
|
||||
AddMI->setDesc(TII->get((AddMI->getOpcode() == SP::ADDrr)
|
||||
? SP::RESTORErr
|
||||
: SP::RESTOREri));
|
||||
|
||||
//map the destination register
|
||||
// Map the destination register.
|
||||
AddMI->getOperand(0).setReg(reg - SP::I0 + SP::O0);
|
||||
|
||||
return true;
|
||||
@ -382,17 +382,17 @@ static bool combineRestoreOR(MachineBasicBlock::iterator RestoreMI,
|
||||
MachineBasicBlock::iterator OrMI,
|
||||
const TargetInstrInfo *TII)
|
||||
{
|
||||
//Before: or <op0>, <op1>, %i[0-7]
|
||||
// restore %g0, %g0, %i[0-7]
|
||||
// and <op0> or <op1> is zero,
|
||||
// Before: or <op0>, <op1>, %i[0-7]
|
||||
// restore %g0, %g0, %i[0-7]
|
||||
// and <op0> or <op1> is zero,
|
||||
//
|
||||
//After : restore <op0>, <op1>, %o[0-7]
|
||||
// After : restore <op0>, <op1>, %o[0-7]
|
||||
|
||||
unsigned reg = OrMI->getOperand(0).getReg();
|
||||
if (reg < SP::I0 || reg > SP::I7)
|
||||
return false;
|
||||
|
||||
//check whether it is a copy
|
||||
// check whether it is a copy.
|
||||
if (OrMI->getOpcode() == SP::ORrr
|
||||
&& OrMI->getOperand(1).getReg() != SP::G0
|
||||
&& OrMI->getOperand(2).getReg() != SP::G0)
|
||||
@ -403,15 +403,15 @@ static bool combineRestoreOR(MachineBasicBlock::iterator RestoreMI,
|
||||
&& (!OrMI->getOperand(2).isImm() || OrMI->getOperand(2).getImm() != 0))
|
||||
return false;
|
||||
|
||||
//Erase RESTORE
|
||||
// Erase RESTORE.
|
||||
RestoreMI->eraseFromParent();
|
||||
|
||||
//Change OR to RESTORE
|
||||
// Change OR to RESTORE.
|
||||
OrMI->setDesc(TII->get((OrMI->getOpcode() == SP::ORrr)
|
||||
? SP::RESTORErr
|
||||
: SP::RESTOREri));
|
||||
|
||||
//map the destination register
|
||||
// Map the destination register.
|
||||
OrMI->getOperand(0).setReg(reg - SP::I0 + SP::O0);
|
||||
|
||||
return true;
|
||||
@ -421,10 +421,10 @@ static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI,
|
||||
MachineBasicBlock::iterator SetHiMI,
|
||||
const TargetInstrInfo *TII)
|
||||
{
|
||||
//Before: sethi imm3, %i[0-7]
|
||||
// restore %g0, %g0, %g0
|
||||
// Before: sethi imm3, %i[0-7]
|
||||
// restore %g0, %g0, %g0
|
||||
//
|
||||
//After : restore %g0, (imm3<<10), %o[0-7]
|
||||
// After : restore %g0, (imm3<<10), %o[0-7]
|
||||
|
||||
unsigned reg = SetHiMI->getOperand(0).getReg();
|
||||
if (reg < SP::I0 || reg > SP::I7)
|
||||
@ -435,11 +435,11 @@ static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI,
|
||||
|
||||
int64_t imm = SetHiMI->getOperand(1).getImm();
|
||||
|
||||
//is it a 3 bit immediate?
|
||||
// Is it a 3 bit immediate?
|
||||
if (!isInt<3>(imm))
|
||||
return false;
|
||||
|
||||
//make it a 13 bit immediate
|
||||
// Make it a 13 bit immediate.
|
||||
imm = (imm << 10) & 0x1FFF;
|
||||
|
||||
assert(RestoreMI->getOpcode() == SP::RESTORErr);
|
||||
@ -451,7 +451,7 @@ static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI,
|
||||
RestoreMI->getOperand(2).ChangeToImmediate(imm);
|
||||
|
||||
|
||||
//Erase the original SETHI
|
||||
// Erase the original SETHI.
|
||||
SetHiMI->eraseFromParent();
|
||||
|
||||
return true;
|
||||
@ -460,11 +460,11 @@ static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI,
|
||||
bool Filler::tryCombineRestoreWithPrevInst(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI)
|
||||
{
|
||||
//No previous instruction
|
||||
// No previous instruction.
|
||||
if (MBBI == MBB.begin())
|
||||
return false;
|
||||
|
||||
//asssert that MBBI is "restore %g0, %g0, %g0"
|
||||
// assert that MBBI is a "restore %g0, %g0, %g0".
|
||||
assert(MBBI->getOpcode() == SP::RESTORErr
|
||||
&& MBBI->getOperand(0).getReg() == SP::G0
|
||||
&& MBBI->getOperand(1).getReg() == SP::G0
|
||||
@ -472,7 +472,7 @@ bool Filler::tryCombineRestoreWithPrevInst(MachineBasicBlock &MBB,
|
||||
|
||||
MachineBasicBlock::iterator PrevInst = MBBI; --PrevInst;
|
||||
|
||||
//Cannot combine with a delay filler
|
||||
// It cannot combine with a delay filler.
|
||||
if (isDelayFiller(MBB, PrevInst))
|
||||
return false;
|
||||
|
||||
@ -484,6 +484,6 @@ bool Filler::tryCombineRestoreWithPrevInst(MachineBasicBlock &MBB,
|
||||
case SP::ORri: return combineRestoreOR(MBBI, PrevInst, TII); break;
|
||||
case SP::SETHIi: return combineRestoreSETHIi(MBBI, PrevInst, TII); break;
|
||||
}
|
||||
//Cannot combine with the previous instruction
|
||||
// It cannot combine with the previous instruction.
|
||||
return false;
|
||||
}
|
||||
|
@ -28,5 +28,6 @@ has_asmprinter = 1
|
||||
type = Library
|
||||
name = SparcCodeGen
|
||||
parent = Sparc
|
||||
required_libraries = AsmPrinter CodeGen Core MC SelectionDAG SparcDesc SparcInfo Support Target
|
||||
required_libraries = AsmPrinter CodeGen Core MC SelectionDAG SparcDesc
|
||||
SparcInfo Support Target
|
||||
add_to_library_groups = Sparc
|
||||
|
@ -16,7 +16,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def CC_Sparc32 : CallingConv<[
|
||||
//Custom assign SRet to [sp+64].
|
||||
// Custom assign SRet to [sp+64].
|
||||
CCIfSRet<CCCustom<"CC_Sparc_Assign_SRet">>,
|
||||
// i32 f32 arguments get passed in integer registers if there is space.
|
||||
CCIfType<[i32, f32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
|
||||
|
@ -130,7 +130,7 @@ void SparcFrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
}
|
||||
|
||||
bool SparcFrameLowering::hasReservedCallFrame(const MachineFunction &MF) const {
|
||||
//Reserve call frame if there are no variable sized objects on the stack
|
||||
// Reserve call frame if there are no variable sized objects on the stack.
|
||||
return !MF.getFrameInfo()->hasVarSizedObjects();
|
||||
}
|
||||
|
||||
@ -174,17 +174,17 @@ void SparcFrameLowering::remapRegsForLeafProc(MachineFunction &MF) const {
|
||||
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
|
||||
//remap %i[0-7] to %o[0-7]
|
||||
// Remap %i[0-7] to %o[0-7].
|
||||
for (unsigned reg = SP::I0; reg <= SP::I7; ++reg) {
|
||||
if (!MRI.isPhysRegUsed(reg))
|
||||
continue;
|
||||
unsigned mapped_reg = (reg - SP::I0 + SP::O0);
|
||||
assert(!MRI.isPhysRegUsed(mapped_reg));
|
||||
|
||||
//Replace I register with O register
|
||||
// Replace I register with O register.
|
||||
MRI.replaceRegWith(reg, mapped_reg);
|
||||
|
||||
//mark the reg unused.
|
||||
// Mark the reg unused.
|
||||
MRI.setPhysRegUnused(reg);
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,10 @@ public:
|
||||
RegScavenger *RS = NULL) const;
|
||||
|
||||
private:
|
||||
//Remap input registers to output registers for leaf procedure.
|
||||
// Remap input registers to output registers for leaf procedure.
|
||||
void remapRegsForLeafProc(MachineFunction &MF) const;
|
||||
|
||||
//Returns true if MF is a leaf procedure.
|
||||
// Returns true if MF is a leaf procedure.
|
||||
bool isLeafProc(MachineFunction &MF) const;
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ static bool CC_Sparc_Assign_SRet(unsigned &ValNo, MVT &ValVT,
|
||||
{
|
||||
assert (ArgFlags.isSRet());
|
||||
|
||||
//Assign SRet argument
|
||||
// Assign SRet argument.
|
||||
State.addLoc(CCValAssign::getCustomMem(ValNo, ValVT,
|
||||
0,
|
||||
LocVT, LocInfo));
|
||||
@ -54,18 +54,18 @@ static bool CC_Sparc_Assign_f64(unsigned &ValNo, MVT &ValVT,
|
||||
static const uint16_t RegList[] = {
|
||||
SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
|
||||
};
|
||||
//Try to get first reg
|
||||
// Try to get first reg.
|
||||
if (unsigned Reg = State.AllocateReg(RegList, 6)) {
|
||||
State.addLoc(CCValAssign::getCustomReg(ValNo, ValVT, Reg, LocVT, LocInfo));
|
||||
} else {
|
||||
//Assign whole thing in stack
|
||||
// Assign whole thing in stack.
|
||||
State.addLoc(CCValAssign::getCustomMem(ValNo, ValVT,
|
||||
State.AllocateStack(8,4),
|
||||
LocVT, LocInfo));
|
||||
return true;
|
||||
}
|
||||
|
||||
//Try to get second reg
|
||||
// Try to get second reg.
|
||||
if (unsigned Reg = State.AllocateReg(RegList, 6))
|
||||
State.addLoc(CCValAssign::getCustomReg(ValNo, ValVT, Reg, LocVT, LocInfo));
|
||||
else
|
||||
@ -206,7 +206,7 @@ SparcTargetLowering::LowerReturn_32(SDValue Chain,
|
||||
RetOps.push_back(DAG.getRegister(VA.getLocReg(), VA.getLocVT()));
|
||||
}
|
||||
|
||||
unsigned RetAddrOffset = 8; //Call Inst + Delay Slot
|
||||
unsigned RetAddrOffset = 8; // Call Inst + Delay Slot
|
||||
// If the function returns a struct, copy the SRetReturnReg to I0
|
||||
if (MF.getFunction()->hasStructRetAttr()) {
|
||||
SparcMachineFunctionInfo *SFI = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
@ -351,7 +351,7 @@ LowerFormalArguments_32(SDValue Chain,
|
||||
CCValAssign &VA = ArgLocs[i];
|
||||
|
||||
if (i == 0 && Ins[i].Flags.isSRet()) {
|
||||
//Get SRet from [%fp+64]
|
||||
// Get SRet from [%fp+64].
|
||||
int FrameIdx = MF.getFrameInfo()->CreateFixedObject(4, 64, true);
|
||||
SDValue FIPtr = DAG.getFrameIndex(FrameIdx, MVT::i32);
|
||||
SDValue Arg = DAG.getLoad(MVT::i32, dl, Chain, FIPtr,
|
||||
@ -410,7 +410,7 @@ LowerFormalArguments_32(SDValue Chain,
|
||||
|
||||
if (VA.needsCustom()) {
|
||||
assert(VA.getValVT() == MVT::f64);
|
||||
//If it is double-word aligned, just load.
|
||||
// If it is double-word aligned, just load.
|
||||
if (Offset % 8 == 0) {
|
||||
int FI = MF.getFrameInfo()->CreateFixedObject(8,
|
||||
Offset,
|
||||
@ -470,7 +470,7 @@ LowerFormalArguments_32(SDValue Chain,
|
||||
}
|
||||
|
||||
if (MF.getFunction()->hasStructRetAttr()) {
|
||||
//Copy the SRet Argument to SRetReturnReg
|
||||
// Copy the SRet Argument to SRetReturnReg.
|
||||
SparcMachineFunctionInfo *SFI = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
unsigned Reg = SFI->getSRetReturnReg();
|
||||
if (!Reg) {
|
||||
@ -680,7 +680,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
|
||||
|
||||
//Create local copies for byval args.
|
||||
// Create local copies for byval args.
|
||||
SmallVector<SDValue, 8> ByValArgs;
|
||||
for (unsigned i = 0, e = Outs.size(); i != e; ++i) {
|
||||
ISD::ArgFlagsTy Flags = Outs[i].Flags;
|
||||
@ -696,8 +696,8 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
SDValue SizeNode = DAG.getConstant(Size, MVT::i32);
|
||||
|
||||
Chain = DAG.getMemcpy(Chain, dl, FIPtr, Arg, SizeNode, Align,
|
||||
false, //isVolatile,
|
||||
(Size <= 32), //AlwaysInline if size <= 32
|
||||
false, // isVolatile,
|
||||
(Size <= 32), // AlwaysInline if size <= 32
|
||||
MachinePointerInfo(), MachinePointerInfo());
|
||||
ByValArgs.push_back(FIPtr);
|
||||
}
|
||||
@ -719,7 +719,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
ISD::ArgFlagsTy Flags = Outs[realArgIdx].Flags;
|
||||
|
||||
//Use local copy if it is a byval arg.
|
||||
// Use local copy if it is a byval arg.
|
||||
if (Flags.isByVal())
|
||||
Arg = ByValArgs[byvalArgIdx++];
|
||||
|
||||
@ -759,7 +759,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
if (VA.isMemLoc()) {
|
||||
unsigned Offset = VA.getLocMemOffset() + StackOffset;
|
||||
//if it is double-word aligned, just store.
|
||||
// if it is double-word aligned, just store.
|
||||
if (Offset % 8 == 0) {
|
||||
SDValue StackPtr = DAG.getRegister(SP::O6, MVT::i32);
|
||||
SDValue PtrOff = DAG.getIntPtrConstant(Offset);
|
||||
@ -792,7 +792,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
if (NextVA.isRegLoc()) {
|
||||
RegsToPass.push_back(std::make_pair(NextVA.getLocReg(), Lo));
|
||||
} else {
|
||||
//Store the low part in stack.
|
||||
// Store the low part in stack.
|
||||
unsigned Offset = NextVA.getLocMemOffset() + StackOffset;
|
||||
SDValue StackPtr = DAG.getRegister(SP::O6, MVT::i32);
|
||||
SDValue PtrOff = DAG.getIntPtrConstant(Offset);
|
||||
@ -1398,11 +1398,12 @@ const char *SparcTargetLowering::getTargetNodeName(unsigned Opcode) const {
|
||||
/// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to
|
||||
/// be zero. Op is expected to be a target specific node. Used by DAG
|
||||
/// combiner.
|
||||
void SparcTargetLowering::computeMaskedBitsForTargetNode(const SDValue Op,
|
||||
APInt &KnownZero,
|
||||
APInt &KnownOne,
|
||||
const SelectionDAG &DAG,
|
||||
unsigned Depth) const {
|
||||
void SparcTargetLowering::computeMaskedBitsForTargetNode
|
||||
(const SDValue Op,
|
||||
APInt &KnownZero,
|
||||
APInt &KnownOne,
|
||||
const SelectionDAG &DAG,
|
||||
unsigned Depth) const {
|
||||
APInt KnownZero2, KnownOne2;
|
||||
KnownZero = KnownOne = APInt(KnownZero.getBitWidth(), 0);
|
||||
|
||||
@ -1625,7 +1626,7 @@ static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
SparcMachineFunctionInfo *FuncInfo = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
|
||||
//Need frame address to find the address of VarArgsFrameIndex
|
||||
// Need frame address to find the address of VarArgsFrameIndex.
|
||||
MF.getFrameInfo()->setFrameAddressIsTaken(true);
|
||||
|
||||
// vastart just stores the address of the VarArgsFrameIndex slot into the
|
||||
@ -1734,7 +1735,7 @@ static SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) {
|
||||
if (depth == 0)
|
||||
RetAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, RetReg, VT);
|
||||
else {
|
||||
//Need frame address to find return address of the caller
|
||||
// Need frame address to find return address of the caller.
|
||||
MFI->setFrameAddressIsTaken(true);
|
||||
|
||||
// flush first to make sure the windowed registers' values are in stack
|
||||
|
@ -7,7 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class InstSP<dag outs, dag ins, string asmstr, list<dag> pattern> : Instruction {
|
||||
class InstSP<dag outs, dag ins, string asmstr, list<dag> pattern>
|
||||
: Instruction {
|
||||
field bits<32> Inst;
|
||||
|
||||
let Namespace = "SP";
|
||||
|
@ -141,15 +141,15 @@ bool SparcInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
|
||||
if (I->isDebugValue())
|
||||
continue;
|
||||
|
||||
//When we see a non-terminator, we are done
|
||||
// When we see a non-terminator, we are done.
|
||||
if (!isUnpredicatedTerminator(I))
|
||||
break;
|
||||
|
||||
//Terminator is not a branch
|
||||
// Terminator is not a branch.
|
||||
if (!I->isBranch())
|
||||
return true;
|
||||
|
||||
//Handle Unconditional branches
|
||||
// Handle Unconditional branches.
|
||||
if (I->getOpcode() == SP::BA) {
|
||||
UnCondBrIter = I;
|
||||
|
||||
@ -178,7 +178,7 @@ bool SparcInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
|
||||
|
||||
unsigned Opcode = I->getOpcode();
|
||||
if (Opcode != SP::BCOND && Opcode != SP::FBCOND)
|
||||
return true; //Unknown Opcode
|
||||
return true; // Unknown Opcode.
|
||||
|
||||
SPCC::CondCodes BranchCode = (SPCC::CondCodes)I->getOperand(1).getImm();
|
||||
|
||||
@ -187,7 +187,7 @@ bool SparcInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
|
||||
if (AllowModify && UnCondBrIter != MBB.end() &&
|
||||
MBB.isLayoutSuccessor(TargetBB)) {
|
||||
|
||||
//Transform the code
|
||||
// Transform the code
|
||||
//
|
||||
// brCC L1
|
||||
// ba L2
|
||||
@ -221,8 +221,8 @@ bool SparcInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
|
||||
Cond.push_back(MachineOperand::CreateImm(BranchCode));
|
||||
continue;
|
||||
}
|
||||
//FIXME: Handle subsequent conditional branches
|
||||
//For now, we can't handle multiple conditional branches
|
||||
// FIXME: Handle subsequent conditional branches.
|
||||
// For now, we can't handle multiple conditional branches.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -243,7 +243,7 @@ SparcInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Conditional branch
|
||||
// Conditional branch
|
||||
unsigned CC = Cond[0].getImm();
|
||||
|
||||
if (IsIntegerCC(CC))
|
||||
|
@ -259,7 +259,7 @@ let Predicates = [HasNoV9] in { // Only emit these in V8 mode.
|
||||
// SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded after
|
||||
// instruction selection into a branch sequence. This has to handle all
|
||||
// permutations of selection between i32/f32/f64 on ICC and FCC.
|
||||
// Expanded after instruction selection.
|
||||
// Expanded after instruction selection.
|
||||
let Uses = [ICC], usesCustomInserter = 1 in {
|
||||
def SELECT_CC_Int_ICC
|
||||
: Pseudo<(outs IntRegs:$dst), (ins IntRegs:$T, IntRegs:$F, i32imm:$Cond),
|
||||
@ -516,7 +516,7 @@ let isBarrier = 1 in
|
||||
"ba $dst",
|
||||
[(br bb:$dst)]>;
|
||||
|
||||
//Indirect Branch
|
||||
// Indirect branch instructions.
|
||||
let isTerminator = 1, isBarrier = 1,
|
||||
hasDelaySlot = 1, isBranch =1,
|
||||
isIndirectBranch = 1 in {
|
||||
|
@ -50,13 +50,13 @@ BitVector SparcRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
||||
// FIXME: G1 reserved for now for large imm generation by frame code.
|
||||
Reserved.set(SP::G1);
|
||||
|
||||
//G1-G4 can be used in applications.
|
||||
// G1-G4 can be used in applications.
|
||||
if (ReserveAppRegisters) {
|
||||
Reserved.set(SP::G2);
|
||||
Reserved.set(SP::G3);
|
||||
Reserved.set(SP::G4);
|
||||
}
|
||||
//G5 is not reserved in 64 bit mode.
|
||||
// G5 is not reserved in 64 bit mode.
|
||||
if (!Subtarget.is64Bit())
|
||||
Reserved.set(SP::G5);
|
||||
|
||||
@ -93,7 +93,7 @@ SparcRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
SparcMachineFunctionInfo *FuncInfo = MF.getInfo<SparcMachineFunctionInfo>();
|
||||
unsigned FramePtr = SP::I6;
|
||||
if (FuncInfo->isLeafProc()) {
|
||||
//Use %sp and adjust offset if needed.
|
||||
// Use %sp and adjust offset if needed.
|
||||
FramePtr = SP::O6;
|
||||
int stackSize = MF.getFrameInfo()->getStackSize();
|
||||
Offset += (stackSize) ? Subtarget.getAdjustedFrameSize(stackSize) : 0 ;
|
||||
|
Loading…
Reference in New Issue
Block a user