mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-28 07:05:03 +00:00
Tidy up. Simplify logic. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146896 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d22170e16a
commit
8209968306
@ -92,26 +92,26 @@ static void printExpr(const MCExpr *Expr, raw_ostream &OS) {
|
||||
MCSymbolRefExpr::VariantKind Kind = SRE->getKind();
|
||||
|
||||
switch (Kind) {
|
||||
default: assert(0 && "Invalid kind!");
|
||||
case MCSymbolRefExpr::VK_None: break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPREL: OS << "%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_CALL: OS << "%call16("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT16: OS << "%got("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT: OS << "%got("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_ABS_HI: OS << "%hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_ABS_LO: OS << "%lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TLSGD: OS << "%tlsgd("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TLSLDM: OS << "%tlsldm("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_DTPREL_HI:OS << "%dtprel_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_DTPREL_LO:OS << "%dtprel_lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOTTPREL: OS << "%gottprel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_HI: OS << "%tprel_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_LO: OS << "%tprel_lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPOFF_HI: OS << "%hi(%neg(%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPOFF_LO: OS << "%lo(%neg(%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_DISP: OS << "%got_disp("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_PAGE: OS << "%got_page("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_OFST: OS << "%got_ofst("; break;
|
||||
default: assert(0 && "Invalid kind!");
|
||||
case MCSymbolRefExpr::VK_None: break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPREL: OS << "%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_CALL: OS << "%call16("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT16: OS << "%got("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT: OS << "%got("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_ABS_HI: OS << "%hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_ABS_LO: OS << "%lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TLSGD: OS << "%tlsgd("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TLSLDM: OS << "%tlsldm("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_DTPREL_HI: OS << "%dtprel_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_DTPREL_LO: OS << "%dtprel_lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOTTPREL: OS << "%gottprel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_HI: OS << "%tprel_hi("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_LO: OS << "%tprel_lo("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPOFF_HI: OS << "%hi(%neg(%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GPOFF_LO: OS << "%lo(%neg(%gp_rel("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_DISP: OS << "%got_disp("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_PAGE: OS << "%got_page("; break;
|
||||
case MCSymbolRefExpr::VK_Mips_GOT_OFST: OS << "%got_ofst("; break;
|
||||
}
|
||||
|
||||
OS << SRE->getSymbol();
|
||||
|
@ -142,7 +142,8 @@ extern "C" void LLVMInitializeMipsTargetMC() {
|
||||
TargetRegistry::RegisterMCAsmBackend(TheMips64elTarget, createMipsAsmBackend);
|
||||
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheMipsTarget, createMipsMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheMipselTarget, createMipsMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheMipselTarget,
|
||||
createMipsMCCodeEmitter);
|
||||
|
||||
// Register the MC subtarget info.
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget,
|
||||
|
@ -459,7 +459,8 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
|
||||
// Tell the assembler which ABI we are using
|
||||
if (OutStreamer.hasRawTextSupport())
|
||||
OutStreamer.EmitRawText("\t.section .mdebug." + Twine(getCurrentABIString()));
|
||||
OutStreamer.EmitRawText("\t.section .mdebug." +
|
||||
Twine(getCurrentABIString()));
|
||||
|
||||
// TODO: handle O64 ABI
|
||||
if (OutStreamer.hasRawTextSupport()) {
|
||||
|
@ -107,7 +107,8 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
||||
|
||||
unsigned getJumpTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
|
||||
|
||||
unsigned getBranchTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
|
||||
unsigned getBranchTargetOpValue(const MachineInstr &MI,
|
||||
unsigned OpNo) const;
|
||||
unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||
unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||
unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||
@ -119,7 +120,7 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
||||
int emitUSH(const MachineInstr &MI);
|
||||
|
||||
void emitGlobalAddressUnaligned(const GlobalValue *GV, unsigned Reloc,
|
||||
int Offset) const;
|
||||
int Offset) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,7 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
||||
if (EnableDelaySlotFiller && findDelayInstr(MBB, I, D)) {
|
||||
MBB.splice(llvm::next(I), &MBB, D);
|
||||
++UsefulSlots;
|
||||
}
|
||||
else
|
||||
} else
|
||||
BuildMI(MBB, llvm::next(I), I->getDebugLoc(), TII->get(Mips::NOP));
|
||||
|
||||
// Record the filler instruction that filled the delay slot.
|
||||
@ -167,8 +166,7 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB,
|
||||
}
|
||||
|
||||
bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
|
||||
bool &sawLoad,
|
||||
bool &sawStore,
|
||||
bool &sawLoad, bool &sawStore,
|
||||
SmallSet<unsigned, 32> &RegDefs,
|
||||
SmallSet<unsigned, 32> &RegUses) {
|
||||
if (candidate->isImplicitDef() || candidate->isKill())
|
||||
|
@ -294,7 +294,7 @@ SDNode* MipsDAGToDAGISel::Select(SDNode *Node) {
|
||||
ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(Node);
|
||||
if (Node->getValueType(0) == MVT::f64 && CN->isExactlyValue(+0.0)) {
|
||||
SDValue Zero = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl,
|
||||
Mips::ZERO, MVT::i32);
|
||||
Mips::ZERO, MVT::i32);
|
||||
return CurDAG->getMachineNode(Mips::BuildPairF64, dl, MVT::f64, Zero,
|
||||
Zero);
|
||||
}
|
||||
@ -315,10 +315,12 @@ SDNode* MipsDAGToDAGISel::Select(SDNode *Node) {
|
||||
DestReg = Mips::V1_64;
|
||||
}
|
||||
|
||||
SDNode *Rdhwr = CurDAG->getMachineNode(RdhwrOpc, Node->getDebugLoc(),
|
||||
Node->getValueType(0), CurDAG->getRegister(SrcReg, PtrVT));
|
||||
SDNode *Rdhwr =
|
||||
CurDAG->getMachineNode(RdhwrOpc, Node->getDebugLoc(),
|
||||
Node->getValueType(0),
|
||||
CurDAG->getRegister(SrcReg, PtrVT));
|
||||
SDValue Chain = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, DestReg,
|
||||
SDValue(Rdhwr, 0));
|
||||
SDValue(Rdhwr, 0));
|
||||
SDValue ResNode = CurDAG->getCopyFromReg(Chain, dl, DestReg, PtrVT);
|
||||
ReplaceUses(SDValue(Node, 0), ResNode);
|
||||
return ResNode.getNode();
|
||||
|
@ -297,8 +297,7 @@ static bool SelectMadd(SDNode* ADDENode, SelectionDAG* CurDAG) {
|
||||
// create MipsMAdd(u) node
|
||||
MultOpc = MultOpc == ISD::UMUL_LOHI ? MipsISD::MAddu : MipsISD::MAdd;
|
||||
|
||||
SDValue MAdd = CurDAG->getNode(MultOpc, dl,
|
||||
MVT::Glue,
|
||||
SDValue MAdd = CurDAG->getNode(MultOpc, dl, MVT::Glue,
|
||||
MultNode->getOperand(0),// Factor 0
|
||||
MultNode->getOperand(1),// Factor 1
|
||||
ADDCNode->getOperand(1),// Lo0
|
||||
@ -371,8 +370,7 @@ static bool SelectMsub(SDNode* SUBENode, SelectionDAG* CurDAG) {
|
||||
// create MipsSub(u) node
|
||||
MultOpc = MultOpc == ISD::UMUL_LOHI ? MipsISD::MSubu : MipsISD::MSub;
|
||||
|
||||
SDValue MSub = CurDAG->getNode(MultOpc, dl,
|
||||
MVT::Glue,
|
||||
SDValue MSub = CurDAG->getNode(MultOpc, dl, MVT::Glue,
|
||||
MultNode->getOperand(0),// Factor 0
|
||||
MultNode->getOperand(1),// Factor 1
|
||||
SUBCNode->getOperand(0),// Lo0
|
||||
@ -490,11 +488,10 @@ static bool InvertFPCondCode(Mips::CondCode CC) {
|
||||
if (CC >= Mips::FCOND_F && CC <= Mips::FCOND_NGT)
|
||||
return false;
|
||||
|
||||
if (CC >= Mips::FCOND_T && CC <= Mips::FCOND_GT)
|
||||
return true;
|
||||
assert((CC >= Mips::FCOND_T && CC <= Mips::FCOND_GT) &&
|
||||
"Illegal Condition Code");
|
||||
|
||||
assert(false && "Illegal Condition Code");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Creates and returns an FPCmp node from a setcc node.
|
||||
@ -584,8 +581,7 @@ static SDValue PerformANDCombine(SDNode *N, SelectionDAG& DAG,
|
||||
return SDValue();
|
||||
|
||||
return DAG.getNode(MipsISD::Ext, N->getDebugLoc(), ValTy,
|
||||
ShiftRight.getOperand(0),
|
||||
DAG.getConstant(Pos, MVT::i32),
|
||||
ShiftRight.getOperand(0), DAG.getConstant(Pos, MVT::i32),
|
||||
DAG.getConstant(SMSize, MVT::i32));
|
||||
}
|
||||
|
||||
@ -638,11 +634,9 @@ static SDValue PerformORCombine(SDNode *N, SelectionDAG& DAG,
|
||||
if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.getSizeInBits()))
|
||||
return SDValue();
|
||||
|
||||
return DAG.getNode(MipsISD::Ins, N->getDebugLoc(), ValTy,
|
||||
Shl.getOperand(0),
|
||||
return DAG.getNode(MipsISD::Ins, N->getDebugLoc(), ValTy, Shl.getOperand(0),
|
||||
DAG.getConstant(SMPos0, MVT::i32),
|
||||
DAG.getConstant(SMSize0, MVT::i32),
|
||||
And0.getOperand(0));
|
||||
DAG.getConstant(SMSize0, MVT::i32), And0.getOperand(0));
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI)
|
||||
@ -713,10 +707,10 @@ static Mips::FPBranchCode GetFPBranchCodeFromCond(Mips::CondCode CC) {
|
||||
if (CC >= Mips::FCOND_F && CC <= Mips::FCOND_NGT)
|
||||
return Mips::BRANCH_T;
|
||||
|
||||
if (CC >= Mips::FCOND_T && CC <= Mips::FCOND_GT)
|
||||
return Mips::BRANCH_F;
|
||||
assert((CC >= Mips::FCOND_T && CC <= Mips::FCOND_GT) &&
|
||||
"Invalid CondCode.");
|
||||
|
||||
return Mips::BRANCH_INVALID;
|
||||
return Mips::BRANCH_F;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1049,8 +1043,7 @@ MipsTargetLowering::EmitAtomicBinaryPartword(MachineInstr *MI,
|
||||
|
||||
// Transfer the remainder of BB and its successor edges to exitMBB.
|
||||
exitMBB->splice(exitMBB->begin(), BB,
|
||||
llvm::next(MachineBasicBlock::iterator(MI)),
|
||||
BB->end());
|
||||
llvm::next(MachineBasicBlock::iterator(MI)), BB->end());
|
||||
exitMBB->transferSuccessorsAndUpdatePHIs(BB);
|
||||
|
||||
BB->addSuccessor(loopMBB);
|
||||
@ -1082,7 +1075,6 @@ MipsTargetLowering::EmitAtomicBinaryPartword(MachineInstr *MI,
|
||||
BuildMI(BB, dl, TII->get(Mips::NOR), Mask2).addReg(Mips::ZERO).addReg(Mask);
|
||||
BuildMI(BB, dl, TII->get(Mips::SLLV), Incr2).addReg(ShiftAmt).addReg(Incr);
|
||||
|
||||
|
||||
// atomic.load.binop
|
||||
// loopMBB:
|
||||
// ll oldval,0(alignedaddr)
|
||||
@ -1201,8 +1193,7 @@ MipsTargetLowering::EmitAtomicCmpSwap(MachineInstr *MI,
|
||||
|
||||
// Transfer the remainder of BB and its successor edges to exitMBB.
|
||||
exitMBB->splice(exitMBB->begin(), BB,
|
||||
llvm::next(MachineBasicBlock::iterator(MI)),
|
||||
BB->end());
|
||||
llvm::next(MachineBasicBlock::iterator(MI)), BB->end());
|
||||
exitMBB->transferSuccessorsAndUpdatePHIs(BB);
|
||||
|
||||
// thisMBB:
|
||||
@ -1290,8 +1281,7 @@ MipsTargetLowering::EmitAtomicCmpSwapPartword(MachineInstr *MI,
|
||||
|
||||
// Transfer the remainder of BB and its successor edges to exitMBB.
|
||||
exitMBB->splice(exitMBB->begin(), BB,
|
||||
llvm::next(MachineBasicBlock::iterator(MI)),
|
||||
BB->end());
|
||||
llvm::next(MachineBasicBlock::iterator(MI)), BB->end());
|
||||
exitMBB->transferSuccessorsAndUpdatePHIs(BB);
|
||||
|
||||
BB->addSuccessor(loop1MBB);
|
||||
@ -1493,9 +1483,8 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op,
|
||||
(HasGotOfst ? MipsII::MO_GOT : MipsII::MO_GOT16);
|
||||
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, ValTy, 0, GotFlag);
|
||||
GA = DAG.getNode(MipsISD::Wrapper, dl, ValTy, GA);
|
||||
SDValue ResNode = DAG.getLoad(ValTy, dl,
|
||||
DAG.getEntryNode(), GA, MachinePointerInfo(),
|
||||
false, false, false, 0);
|
||||
SDValue ResNode = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), GA,
|
||||
MachinePointerInfo(), false, false, false, 0);
|
||||
// On functions and global targets not internal linked only
|
||||
// a load from got/GP is necessary for PIC to work.
|
||||
if (!HasGotOfst)
|
||||
@ -1515,10 +1504,8 @@ SDValue MipsTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
|
||||
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64) {
|
||||
// %hi/%lo relocation
|
||||
SDValue BAHi = DAG.getBlockAddress(BA, MVT::i32, true,
|
||||
MipsII::MO_ABS_HI);
|
||||
SDValue BALo = DAG.getBlockAddress(BA, MVT::i32, true,
|
||||
MipsII::MO_ABS_LO);
|
||||
SDValue BAHi = DAG.getBlockAddress(BA, MVT::i32, true, MipsII::MO_ABS_HI);
|
||||
SDValue BALo = DAG.getBlockAddress(BA, MVT::i32, true, MipsII::MO_ABS_LO);
|
||||
SDValue Hi = DAG.getNode(MipsISD::Hi, dl, MVT::i32, BAHi);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, BALo);
|
||||
return DAG.getNode(ISD::ADD, dl, MVT::i32, Hi, Lo);
|
||||
@ -1530,8 +1517,7 @@ SDValue MipsTargetLowering::LowerBlockAddress(SDValue Op,
|
||||
SDValue BAGOTOffset = DAG.getBlockAddress(BA, ValTy, true, GOTFlag);
|
||||
BAGOTOffset = DAG.getNode(MipsISD::Wrapper, dl, ValTy, BAGOTOffset);
|
||||
SDValue BALOOffset = DAG.getBlockAddress(BA, ValTy, true, OFSTFlag);
|
||||
SDValue Load = DAG.getLoad(ValTy, dl,
|
||||
DAG.getEntryNode(), BAGOTOffset,
|
||||
SDValue Load = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), BAGOTOffset,
|
||||
MachinePointerInfo(), false, false, false, 0);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, ValTy, BALOOffset);
|
||||
return DAG.getNode(ISD::ADD, dl, ValTy, Load, Lo);
|
||||
@ -1672,9 +1658,9 @@ LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
|
||||
SDValue CP = DAG.getTargetConstantPool(C, ValTy, N->getAlignment(),
|
||||
N->getOffset(), GOTFlag);
|
||||
CP = DAG.getNode(MipsISD::Wrapper, dl, ValTy, CP);
|
||||
SDValue Load = DAG.getLoad(ValTy, dl, DAG.getEntryNode(),
|
||||
CP, MachinePointerInfo::getConstantPool(),
|
||||
false, false, false, 0);
|
||||
SDValue Load = DAG.getLoad(ValTy, dl, DAG.getEntryNode(), CP,
|
||||
MachinePointerInfo::getConstantPool(), false,
|
||||
false, false, 0);
|
||||
SDValue CPLo = DAG.getTargetConstantPool(C, ValTy, N->getAlignment(),
|
||||
N->getOffset(), OFSTFlag);
|
||||
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, ValTy, CPLo);
|
||||
@ -1696,8 +1682,7 @@ SDValue MipsTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) const {
|
||||
// memory location argument.
|
||||
const Value *SV = cast<SrcValueSDNode>(Op.getOperand(2))->getValue();
|
||||
return DAG.getStore(Op.getOperand(0), dl, FI, Op.getOperand(1),
|
||||
MachinePointerInfo(SV),
|
||||
false, false, 0);
|
||||
MachinePointerInfo(SV), false, false, 0);
|
||||
}
|
||||
|
||||
// Called if the size of integer registers is large enough to hold the whole
|
||||
@ -1750,16 +1735,16 @@ LowerFCOPYSIGNSmallIntReg(SDValue Op, SelectionDAG &DAG, bool isLittle) {
|
||||
return DAG.getNode(MipsISD::BuildPairF64, dl, MVT::f64, Word0, Word1);
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG)
|
||||
const {
|
||||
SDValue
|
||||
MipsTargetLowering::LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const {
|
||||
EVT Ty = Op.getValueType();
|
||||
|
||||
assert(Ty == MVT::f32 || Ty == MVT::f64);
|
||||
|
||||
if (Ty == MVT::f32 || HasMips64)
|
||||
return LowerFCOPYSIGNLargeIntReg(Op, DAG);
|
||||
else
|
||||
return LowerFCOPYSIGNSmallIntReg(Op, DAG, Subtarget->isLittle());
|
||||
|
||||
return LowerFCOPYSIGNSmallIntReg(Op, DAG, Subtarget->isLittle());
|
||||
}
|
||||
|
||||
SDValue MipsTargetLowering::
|
||||
@ -1778,8 +1763,8 @@ LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
|
||||
}
|
||||
|
||||
// TODO: set SType according to the desired memory barrier behavior.
|
||||
SDValue MipsTargetLowering::LowerMEMBARRIER(SDValue Op,
|
||||
SelectionDAG& DAG) const {
|
||||
SDValue
|
||||
MipsTargetLowering::LowerMEMBARRIER(SDValue Op, SelectionDAG& DAG) const {
|
||||
unsigned SType = 0;
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
return DAG.getNode(MipsISD::Sync, dl, MVT::Other, Op.getOperand(0),
|
||||
@ -2007,9 +1992,8 @@ WriteByValArg(SDValue& ByValChain, SDValue Chain, DebugLoc dl,
|
||||
SDValue LoadPtr = DAG.getNode(ISD::ADD, dl, MVT::i32, Arg,
|
||||
DAG.getConstant(Offset, MVT::i32));
|
||||
SDValue LoadVal = DAG.getLoad(MVT::i32, dl, Chain, LoadPtr,
|
||||
MachinePointerInfo(),
|
||||
false, false, false, std::min(ByValAlign,
|
||||
(unsigned )4));
|
||||
MachinePointerInfo(), false, false, false,
|
||||
std::min(ByValAlign, (unsigned )4));
|
||||
MemOpChains.push_back(LoadVal.getValue(1));
|
||||
unsigned DstReg = O32IntRegs[LocMemOffset / 4];
|
||||
RegsToPass.push_back(std::make_pair(DstReg, LoadVal));
|
||||
@ -2190,7 +2174,7 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee,
|
||||
// Analyze operands of the call, assigning locations to each operand.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||
|
||||
if (IsO32)
|
||||
CCInfo.AnalyzeCallOperands(Outs, CC_MipsO32);
|
||||
@ -2323,8 +2307,7 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee,
|
||||
// emit ISD::STORE whichs stores the
|
||||
// parameter value to a stack Location
|
||||
MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff,
|
||||
MachinePointerInfo(),
|
||||
false, false, 0));
|
||||
MachinePointerInfo(), false, false, 0));
|
||||
}
|
||||
|
||||
// Extend range of indices of frame objects for outgoing arguments that were
|
||||
@ -2376,8 +2359,8 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee,
|
||||
OpFlag = MipsII::MO_NO_FLAG;
|
||||
else // O32 & PIC
|
||||
OpFlag = MipsII::MO_GOT_CALL;
|
||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(),
|
||||
getPointerTy(), OpFlag);
|
||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy(),
|
||||
OpFlag);
|
||||
GlobalOrExternal = true;
|
||||
}
|
||||
|
||||
@ -2552,8 +2535,7 @@ SDValue
|
||||
MipsTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
CallingConv::ID CallConv,
|
||||
bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg>
|
||||
&Ins,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals)
|
||||
const {
|
||||
@ -2569,7 +2551,7 @@ MipsTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
// Assign locations to all of the incoming arguments.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||
|
||||
if (IsO32)
|
||||
CCInfo.AnalyzeFormalArguments(Ins, CC_MipsO32);
|
||||
@ -2719,8 +2701,7 @@ MipsTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
LastFI = MFI->CreateFixedObject(RegSize, StackOffset, true);
|
||||
SDValue PtrOff = DAG.getFrameIndex(LastFI, getPointerTy());
|
||||
OutChains.push_back(DAG.getStore(Chain, dl, ArgValue, PtrOff,
|
||||
MachinePointerInfo(),
|
||||
false, false, 0));
|
||||
MachinePointerInfo(), false, false, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2774,8 +2755,7 @@ MipsTargetLowering::LowerReturn(SDValue Chain,
|
||||
CCValAssign &VA = RVLocs[i];
|
||||
assert(VA.isRegLoc() && "Can only return in registers!");
|
||||
|
||||
Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(),
|
||||
OutVals[i], Flag);
|
||||
Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), OutVals[i], Flag);
|
||||
|
||||
// guarantee that all emitted copies are
|
||||
// stuck together, avoiding something bad
|
||||
|
@ -246,21 +246,21 @@ static unsigned GetAnalyzableBrOpc(unsigned Opc) {
|
||||
unsigned Mips::GetOppositeBranchOpc(unsigned Opc)
|
||||
{
|
||||
switch (Opc) {
|
||||
default: llvm_unreachable("Illegal opcode!");
|
||||
case Mips::BEQ : return Mips::BNE;
|
||||
case Mips::BNE : return Mips::BEQ;
|
||||
case Mips::BGTZ : return Mips::BLEZ;
|
||||
case Mips::BGEZ : return Mips::BLTZ;
|
||||
case Mips::BLTZ : return Mips::BGEZ;
|
||||
case Mips::BLEZ : return Mips::BGTZ;
|
||||
case Mips::BEQ64 : return Mips::BNE64;
|
||||
case Mips::BNE64 : return Mips::BEQ64;
|
||||
case Mips::BGTZ64 : return Mips::BLEZ64;
|
||||
case Mips::BGEZ64 : return Mips::BLTZ64;
|
||||
case Mips::BLTZ64 : return Mips::BGEZ64;
|
||||
case Mips::BLEZ64 : return Mips::BGTZ64;
|
||||
case Mips::BC1T : return Mips::BC1F;
|
||||
case Mips::BC1F : return Mips::BC1T;
|
||||
default: llvm_unreachable("Illegal opcode!");
|
||||
case Mips::BEQ: return Mips::BNE;
|
||||
case Mips::BNE: return Mips::BEQ;
|
||||
case Mips::BGTZ: return Mips::BLEZ;
|
||||
case Mips::BGEZ: return Mips::BLTZ;
|
||||
case Mips::BLTZ: return Mips::BGEZ;
|
||||
case Mips::BLEZ: return Mips::BGTZ;
|
||||
case Mips::BEQ64: return Mips::BNE64;
|
||||
case Mips::BNE64: return Mips::BEQ64;
|
||||
case Mips::BGTZ64: return Mips::BLEZ64;
|
||||
case Mips::BGEZ64: return Mips::BLTZ64;
|
||||
case Mips::BLTZ64: return Mips::BGEZ64;
|
||||
case Mips::BLEZ64: return Mips::BGTZ64;
|
||||
case Mips::BC1T: return Mips::BC1F;
|
||||
case Mips::BC1F: return Mips::BC1T;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,24 +229,26 @@ def addr : ComplexPattern<iPTR, 2, "SelectAddr", [frameindex], []>;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Pattern fragment for load/store
|
||||
//===----------------------------------------------------------------------===//
|
||||
class UnalignedLoad<PatFrag Node> : PatFrag<(ops node:$ptr), (Node node:$ptr), [{
|
||||
class UnalignedLoad<PatFrag Node> :
|
||||
PatFrag<(ops node:$ptr), (Node node:$ptr), [{
|
||||
LoadSDNode *LD = cast<LoadSDNode>(N);
|
||||
return LD->getMemoryVT().getSizeInBits()/8 > LD->getAlignment();
|
||||
}]>;
|
||||
|
||||
class AlignedLoad<PatFrag Node> : PatFrag<(ops node:$ptr), (Node node:$ptr), [{
|
||||
class AlignedLoad<PatFrag Node> :
|
||||
PatFrag<(ops node:$ptr), (Node node:$ptr), [{
|
||||
LoadSDNode *LD = cast<LoadSDNode>(N);
|
||||
return LD->getMemoryVT().getSizeInBits()/8 <= LD->getAlignment();
|
||||
}]>;
|
||||
|
||||
class UnalignedStore<PatFrag Node> : PatFrag<(ops node:$val, node:$ptr),
|
||||
(Node node:$val, node:$ptr), [{
|
||||
class UnalignedStore<PatFrag Node> :
|
||||
PatFrag<(ops node:$val, node:$ptr), (Node node:$val, node:$ptr), [{
|
||||
StoreSDNode *SD = cast<StoreSDNode>(N);
|
||||
return SD->getMemoryVT().getSizeInBits()/8 > SD->getAlignment();
|
||||
}]>;
|
||||
|
||||
class AlignedStore<PatFrag Node> : PatFrag<(ops node:$val, node:$ptr),
|
||||
(Node node:$val, node:$ptr), [{
|
||||
class AlignedStore<PatFrag Node> :
|
||||
PatFrag<(ops node:$val, node:$ptr), (Node node:$val, node:$ptr), [{
|
||||
StoreSDNode *SD = cast<StoreSDNode>(N);
|
||||
return SD->getMemoryVT().getSizeInBits()/8 <= SD->getAlignment();
|
||||
}]>;
|
||||
|
@ -37,26 +37,26 @@ MCOperand MipsMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
const MCSymbol *Symbol;
|
||||
|
||||
switch(MO.getTargetFlags()) {
|
||||
default: assert(0 && "Invalid target flag!");
|
||||
case MipsII::MO_NO_FLAG: Kind = MCSymbolRefExpr::VK_None; break;
|
||||
case MipsII::MO_GPREL: Kind = MCSymbolRefExpr::VK_Mips_GPREL; break;
|
||||
case MipsII::MO_GOT_CALL: Kind = MCSymbolRefExpr::VK_Mips_GOT_CALL; break;
|
||||
case MipsII::MO_GOT16: Kind = MCSymbolRefExpr::VK_Mips_GOT16; break;
|
||||
case MipsII::MO_GOT: Kind = MCSymbolRefExpr::VK_Mips_GOT; break;
|
||||
case MipsII::MO_ABS_HI: Kind = MCSymbolRefExpr::VK_Mips_ABS_HI; break;
|
||||
case MipsII::MO_ABS_LO: Kind = MCSymbolRefExpr::VK_Mips_ABS_LO; break;
|
||||
case MipsII::MO_TLSGD: Kind = MCSymbolRefExpr::VK_Mips_TLSGD; break;
|
||||
case MipsII::MO_TLSLDM: Kind = MCSymbolRefExpr::VK_Mips_TLSLDM; break;
|
||||
case MipsII::MO_DTPREL_HI:Kind = MCSymbolRefExpr::VK_Mips_DTPREL_HI; break;
|
||||
case MipsII::MO_DTPREL_LO:Kind = MCSymbolRefExpr::VK_Mips_DTPREL_LO; break;
|
||||
case MipsII::MO_GOTTPREL: Kind = MCSymbolRefExpr::VK_Mips_GOTTPREL; break;
|
||||
case MipsII::MO_TPREL_HI: Kind = MCSymbolRefExpr::VK_Mips_TPREL_HI; break;
|
||||
case MipsII::MO_TPREL_LO: Kind = MCSymbolRefExpr::VK_Mips_TPREL_LO; break;
|
||||
case MipsII::MO_GPOFF_HI: Kind = MCSymbolRefExpr::VK_Mips_GPOFF_HI; break;
|
||||
case MipsII::MO_GPOFF_LO: Kind = MCSymbolRefExpr::VK_Mips_GPOFF_LO; break;
|
||||
case MipsII::MO_GOT_DISP: Kind = MCSymbolRefExpr::VK_Mips_GOT_DISP; break;
|
||||
case MipsII::MO_GOT_PAGE: Kind = MCSymbolRefExpr::VK_Mips_GOT_PAGE; break;
|
||||
case MipsII::MO_GOT_OFST: Kind = MCSymbolRefExpr::VK_Mips_GOT_OFST; break;
|
||||
default: assert(0 && "Invalid target flag!");
|
||||
case MipsII::MO_NO_FLAG: Kind = MCSymbolRefExpr::VK_None; break;
|
||||
case MipsII::MO_GPREL: Kind = MCSymbolRefExpr::VK_Mips_GPREL; break;
|
||||
case MipsII::MO_GOT_CALL: Kind = MCSymbolRefExpr::VK_Mips_GOT_CALL; break;
|
||||
case MipsII::MO_GOT16: Kind = MCSymbolRefExpr::VK_Mips_GOT16; break;
|
||||
case MipsII::MO_GOT: Kind = MCSymbolRefExpr::VK_Mips_GOT; break;
|
||||
case MipsII::MO_ABS_HI: Kind = MCSymbolRefExpr::VK_Mips_ABS_HI; break;
|
||||
case MipsII::MO_ABS_LO: Kind = MCSymbolRefExpr::VK_Mips_ABS_LO; break;
|
||||
case MipsII::MO_TLSGD: Kind = MCSymbolRefExpr::VK_Mips_TLSGD; break;
|
||||
case MipsII::MO_TLSLDM: Kind = MCSymbolRefExpr::VK_Mips_TLSLDM; break;
|
||||
case MipsII::MO_DTPREL_HI: Kind = MCSymbolRefExpr::VK_Mips_DTPREL_HI; break;
|
||||
case MipsII::MO_DTPREL_LO: Kind = MCSymbolRefExpr::VK_Mips_DTPREL_LO; break;
|
||||
case MipsII::MO_GOTTPREL: Kind = MCSymbolRefExpr::VK_Mips_GOTTPREL; break;
|
||||
case MipsII::MO_TPREL_HI: Kind = MCSymbolRefExpr::VK_Mips_TPREL_HI; break;
|
||||
case MipsII::MO_TPREL_LO: Kind = MCSymbolRefExpr::VK_Mips_TPREL_LO; break;
|
||||
case MipsII::MO_GPOFF_HI: Kind = MCSymbolRefExpr::VK_Mips_GPOFF_HI; break;
|
||||
case MipsII::MO_GPOFF_LO: Kind = MCSymbolRefExpr::VK_Mips_GPOFF_LO; break;
|
||||
case MipsII::MO_GOT_DISP: Kind = MCSymbolRefExpr::VK_Mips_GOT_DISP; break;
|
||||
case MipsII::MO_GOT_PAGE: Kind = MCSymbolRefExpr::VK_Mips_GOT_PAGE; break;
|
||||
case MipsII::MO_GOT_OFST: Kind = MCSymbolRefExpr::VK_Mips_GOT_OFST; break;
|
||||
}
|
||||
|
||||
switch (MOTy) {
|
||||
|
Loading…
Reference in New Issue
Block a user