llvm.org GIT mirror llvm / 7ff6fa2
Removed LowerRETURADDR, fixed small bug into LowerRET, LowerGlobalAddress fixed to generate instructions (add, lui) glued! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41158 91177308-0d34-0410-b5e6-96231b3b80d8 Bruno Cardoso Lopes 13 years ago
2 changed file(s) with 11 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
141141 Addr.getOpcode() == ISD::TargetGlobalAddress))
142142 return false;
143143
144 // Operand is an result from an ADD.
144 // Operand is a result from an ADD.
145145 if (Addr.getOpcode() == ISD::ADD)
146146 {
147147 if (ConstantSDNode *CN = dyn_cast(Addr.getOperand(1)))
4141 case MipsISD::Hi : return "MipsISD::Hi";
4242 case MipsISD::Lo : return "MipsISD::Lo";
4343 case MipsISD::Ret : return "MipsISD::Ret";
44 case MipsISD::Add : return "MipsISD::Add";
4445 default : return NULL;
4546 }
4647 }
118119 case ISD::RET: return LowerRET(Op, DAG);
119120 case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG);
120121 case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
121 case ISD::RETURNADDR: return LowerRETURNADDR(Op, DAG);
122122 }
123123 return SDOperand();
124124 }
139139 return VReg;
140140 }
141141
142 // Set up a frame object for the return address.
143 //SDOperand MipsTargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) {
144 // if (ReturnAddrIndex == 0) {
145 // MachineFunction &MF = DAG.getMachineFunction();
146 // ReturnAddrIndex = MF.getFrameInfo()->CreateFixedObject(4, 0);
147 // }
148 //
149 // return DAG.getFrameIndex(ReturnAddrIndex, getPointerTy());
150 //}
151
152
153142 //===----------------------------------------------------------------------===//
154143 // Misc Lower Operation implementation
155144 //===----------------------------------------------------------------------===//
159148 GlobalValue *GV = cast(Op)->getGlobal();
160149
161150 SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i32);
162 SDOperand Hi = DAG.getNode(MipsISD::Hi, MVT::i32, GA);
151
152 const MVT::ValueType *VTs = DAG.getNodeValueTypes(MVT::i32, MVT::Flag);
153 SDOperand Ops[] = { GA };
154
155 SDOperand Hi = DAG.getNode(MipsISD::Hi, VTs, 2, Ops, 1);
163156 SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA);
164157
165 return DAG.getNode(ISD::ADD, MVT::i32, Lo, Hi);
158 SDOperand InFlag = Hi.getValue(1);
159 return DAG.getNode(MipsISD::Add, MVT::i32, Lo, Hi, InFlag);
166160 }
167161
168162 SDOperand MipsTargetLowering::
369363 SmallVector ResultVals;
370364
371365 // Returns void
372 if (!RVLocs.size())
373 return Chain.Val;
366 //if (!RVLocs.size())
367 // return Chain.Val;
374368
375369 // Copy all of the result registers out of their specified physreg.
376370 for (unsigned i = 0; i != RVLocs.size(); ++i) {