diff options
| author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-08-27 19:57:56 +0000 | 
|---|---|---|
| committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-08-27 19:57:56 +0000 | 
| commit | e91191630beeafce1117ff2b4767e827a4fccec9 (patch) | |
| tree | a62e962a6b4b96b29ce01b34cf6d7268fb55f84d /llvm/lib/Target/Mips/MipsISelLowering.cpp | |
| parent | d5e8e862bbce832309316d0702bcebfdf55c70ee (diff) | |
| download | bcm5719-llvm-e91191630beeafce1117ff2b4767e827a4fccec9.tar.gz bcm5719-llvm-e91191630beeafce1117ff2b4767e827a4fccec9.zip  | |
Revert 80278 for now, it caused a lot of MIPS tests to fail
llvm-svn: 80280
Diffstat (limited to 'llvm/lib/Target/Mips/MipsISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.cpp | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 261c421aa3e..710bc945ef2 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -488,6 +488,7 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) {    // FIXME there isn't actually debug info here    DebugLoc dl = Op.getDebugLoc();    GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); +  SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32);    if (getTargetMachine().getRelocationModel() != Reloc::PIC_) {      SDVTList VTs = DAG.getVTList(MVT::i32); @@ -496,20 +497,16 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) {      // %gp_rel relocation      if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) {  -      SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, MipsII::MO_GPREL);        SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1);        SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32);        return DAG.getNode(ISD::ADD, dl, MVT::i32, GOT, GPRelNode);       }      // %hi/%lo relocation -    SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, MipsII::MO_ABS_HILO);      SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, &GA, 1); -      SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, GA);      return DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo); -  } else { -    SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, MipsII::MO_GOT); +  } else { // Abicall relocations, TODO: make this cleaner.      SDValue ResNode = DAG.getLoad(MVT::i32, dl,                                     DAG.getEntryNode(), GA, NULL, 0);      // On functions and global targets not internal linked only @@ -687,7 +684,6 @@ MipsTargetLowering::LowerCall(SDValue Chain, SDValue Callee,    MachineFunction &MF = DAG.getMachineFunction();    MachineFrameInfo *MFI = MF.getFrameInfo(); -  bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;    // Analyze operands of the call, assigning locations to each operand.    SmallVector<CCValAssign, 16> ArgLocs; @@ -796,11 +792,10 @@ MipsTargetLowering::LowerCall(SDValue Chain, SDValue Callee,    // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every    // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol     // node so that legalize doesn't hack it.  -  unsigned char OpFlag = IsPIC ? MipsII::MO_GOT_CALL : MipsII::MO_NO_FLAG;    if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))  -    Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy(), OpFlag); +    Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());    else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) -    Callee = DAG.getTargetExternalSymbol(S->getSymbol(),getPointerTy(), OpFlag); +    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());    // MipsJmpLink = #chain, #target_address, #opt_in_flags...    //             = Chain, Callee, Reg#1, Reg#2, ...   @@ -831,7 +826,7 @@ MipsTargetLowering::LowerCall(SDValue Chain, SDValue Callee,    // Create a stack location to hold GP when PIC is used. This stack     // location is used on function prologue to save GP and also after all     // emited CALL's to restore GP.  -  if (IsPIC) { +  if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {        // Function can have an arbitrary number of calls, so         // hold the LastArgStackLoc with the biggest offset.        int FI;  | 

