llvm.org GIT mirror llvm / 3069b87
Follow Chris' suggestion; change the PseudoSourceValue accessors to return pointers instead of references, since this is always what is needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46857 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 12 years ago
6 changed file(s) with 44 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
3636
3737 /// A pseudo source value referencing to the stack frame of a function,
3838 /// e.g., a spill slot.
39 static const PseudoSourceValue &getFixedStack();
39 static const PseudoSourceValue *getFixedStack();
4040
4141 /// A source value referencing the area below the stack frame of a function,
4242 /// e.g., the argument space.
43 static const PseudoSourceValue &getStack();
43 static const PseudoSourceValue *getStack();
4444
4545 /// A source value referencing the global offset table (or something the
4646 /// like).
47 static const PseudoSourceValue &getGOT();
47 static const PseudoSourceValue *getGOT();
4848
4949 /// A SV referencing the constant pool
50 static const PseudoSourceValue &getConstantPool();
50 static const PseudoSourceValue *getConstantPool();
5151
5252 /// A SV referencing the jump table
53 static const PseudoSourceValue &getJumpTable();
53 static const PseudoSourceValue *getJumpTable();
5454 };
5555 } // End llvm namespace
5656
1717 namespace llvm {
1818 static ManagedStatic PSVs;
1919
20 const PseudoSourceValue &PseudoSourceValue::getFixedStack() { return (*PSVs)[0]; }
21 const PseudoSourceValue &PseudoSourceValue::getStack() { return (*PSVs)[1]; }
22 const PseudoSourceValue &PseudoSourceValue::getGOT() { return (*PSVs)[2]; }
23 const PseudoSourceValue &PseudoSourceValue::getConstantPool() { return (*PSVs)[3]; }
24 const PseudoSourceValue &PseudoSourceValue::getJumpTable() { return (*PSVs)[4]; }
20 const PseudoSourceValue *PseudoSourceValue::getFixedStack() { return &(*PSVs)[0]; }
21 const PseudoSourceValue *PseudoSourceValue::getStack() { return &(*PSVs)[1]; }
22 const PseudoSourceValue *PseudoSourceValue::getGOT() { return &(*PSVs)[2]; }
23 const PseudoSourceValue *PseudoSourceValue::getConstantPool() { return &(*PSVs)[3]; }
24 const PseudoSourceValue *PseudoSourceValue::getJumpTable() { return &(*PSVs)[4]; }
2525
2626 static const char *PSVNames[] = {
2727 "FixedStack",
509509 SDOperand CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy());
510510 if (Extend) {
511511 return DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(),
512 CPIdx, &PseudoSourceValue::getConstantPool(),
512 CPIdx, PseudoSourceValue::getConstantPool(),
513513 0, MVT::f32);
514514 } else {
515515 return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
516 &PseudoSourceValue::getConstantPool(), 0);
516 PseudoSourceValue::getConstantPool(), 0);
517517 }
518518 }
519519
13261326
13271327 // Store the vector.
13281328 SDOperand Ch = DAG.getStore(DAG.getEntryNode(), Tmp1, StackPtr,
1329 &PseudoSourceValue::getFixedStack(),
1329 PseudoSourceValue::getFixedStack(),
13301330 SPFI);
13311331
13321332 // Truncate or zero extend offset to target pointer type.
13381338 SDOperand StackPtr2 = DAG.getNode(ISD::ADD, IdxVT, Tmp3, StackPtr);
13391339 // Store the scalar value.
13401340 Ch = DAG.getStore(Ch, Tmp2, StackPtr2,
1341 &PseudoSourceValue::getFixedStack(), SPFI);
1341 PseudoSourceValue::getFixedStack(), SPFI);
13421342 // Load the updated vector.
13431343 Result = DAG.getLoad(VT, Ch, StackPtr,
1344 &PseudoSourceValue::getFixedStack(), SPFI);
1344 PseudoSourceValue::getFixedStack(), SPFI);
13451345 break;
13461346 }
13471347 }
16911691 switch (EntrySize) {
16921692 default: assert(0 && "Size of jump table not supported yet."); break;
16931693 case 4: LD = DAG.getLoad(MVT::i32, Chain, Addr,
1694 &PseudoSourceValue::getJumpTable(), 0); break;
1694 PseudoSourceValue::getJumpTable(), 0); break;
16951695 case 8: LD = DAG.getLoad(MVT::i64, Chain, Addr,
1696 &PseudoSourceValue::getJumpTable(), 0); break;
1696 PseudoSourceValue::getJumpTable(), 0); break;
16971697 }
16981698
16991699 Addr = LD;
47714771 SDOperand Store;
47724772 if (SrcSize > SlotSize)
47734773 Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr,
4774 &PseudoSourceValue::getFixedStack(),
4774 PseudoSourceValue::getFixedStack(),
47754775 SPFI, SlotVT);
47764776 else {
47774777 assert(SrcSize == SlotSize && "Invalid store");
47784778 Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr,
4779 &PseudoSourceValue::getFixedStack(),
4779 PseudoSourceValue::getFixedStack(),
47804780 SPFI, SlotVT);
47814781 }
47824782
47984798 int SPFI = StackPtrFI->getIndex();
47994799
48004800 SDOperand Ch = DAG.getStore(DAG.getEntryNode(), Node->getOperand(0), StackPtr,
4801 &PseudoSourceValue::getFixedStack(), SPFI);
4801 PseudoSourceValue::getFixedStack(), SPFI);
48024802 return DAG.getLoad(Node->getValueType(0), Ch, StackPtr,
4803 &PseudoSourceValue::getFixedStack(), SPFI);
4803 PseudoSourceValue::getFixedStack(), SPFI);
48044804 }
48054805
48064806
48654865 Constant *CP = ConstantVector::get(CV);
48664866 SDOperand CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy());
48674867 return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
4868 &PseudoSourceValue::getConstantPool(), 0);
4868 PseudoSourceValue::getConstantPool(), 0);
48694869 }
48704870
48714871 if (SplatValue.Val) { // Splat of one value?
52085208 SDOperand FudgeInReg;
52095209 if (DestTy == MVT::f32)
52105210 FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx,
5211 &PseudoSourceValue::getConstantPool(), 0);
5211 PseudoSourceValue::getConstantPool(), 0);
52125212 else if (MVT::getSizeInBits(DestTy) > MVT::getSizeInBits(MVT::f32))
52135213 // FIXME: Avoid the extend by construction the right constantpool?
52145214 FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(),
52155215 CPIdx,
5216 &PseudoSourceValue::getConstantPool(), 0,
5216 PseudoSourceValue::getConstantPool(), 0,
52175217 MVT::f32);
52185218 else
52195219 assert(0 && "Unexpected conversion");
53575357 SDOperand FudgeInReg;
53585358 if (DestVT == MVT::f32)
53595359 FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx,
5360 &PseudoSourceValue::getConstantPool(), 0);
5360 PseudoSourceValue::getConstantPool(), 0);
53615361 else {
53625362 FudgeInReg =
53635363 LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, DestVT,
53645364 DAG.getEntryNode(), CPIdx,
5365 &PseudoSourceValue::getConstantPool(), 0,
5365 PseudoSourceValue::getConstantPool(), 0,
53665366 MVT::f32));
53675367 }
53685368
67776777
67786778 SDOperand St = DAG.getStore(DAG.getEntryNode(),
67796779 InOp, Ptr,
6780 &PseudoSourceValue::getFixedStack(),
6780 PseudoSourceValue::getFixedStack(),
67816781 FI->getIndex());
67826782 InOp = DAG.getLoad(Op.getValueType(), St, Ptr,
6783 &PseudoSourceValue::getFixedStack(),
6783 PseudoSourceValue::getFixedStack(),
67846784 FI->getIndex());
67856785 }
67866786 // Split the vector and convert each of the pieces now.
35473547 const FrameIndexSDNode *FI =
35483548 dyn_cast(getBasePtr().Val);
35493549 if (!getSrcValue() && FI)
3550 return MemOperand(&PseudoSourceValue::getFixedStack(), Flags,
3550 return MemOperand(PseudoSourceValue::getFixedStack(), Flags,
35513551 FI->getIndex(), Size, Alignment);
35523552 else
35533553 return MemOperand(getSrcValue(), Flags,
22022202 Op.getOperand(0));
22032203
22042204 // STD the extended value into the stack slot.
2205 MemOperand MO(&PseudoSourceValue::getFixedStack(),
2205 MemOperand MO(PseudoSourceValue::getFixedStack(),
22062206 MemOperand::MOStore, FrameIdx, 8, 8);
22072207 SDOperand Store = DAG.getNode(PPCISD::STD_32, MVT::Other,
22082208 DAG.getEntryNode(), Ext64, FIdx,
10901090 if (isByVal)
10911091 return FIN;
10921092 return DAG.getLoad(VA.getValVT(), Root, FIN,
1093 &PseudoSourceValue::getFixedStack(), FI);
1093 PseudoSourceValue::getFixedStack(), FI);
10941094 }
10951095
10961096 SDOperand
12201220 SDOperand Val = DAG.getCopyFromReg(Root, VReg, MVT::i64);
12211221 SDOperand Store =
12221222 DAG.getStore(Val.getValue(1), Val, FIN,
1223 &PseudoSourceValue::getFixedStack(),
1223 PseudoSourceValue::getFixedStack(),
12241224 RegSaveFrameIndex);
12251225 MemOps.push_back(Store);
12261226 FIN = DAG.getNode(ISD::ADD, getPointerTy(), FIN,
12361236 SDOperand Val = DAG.getCopyFromReg(Root, VReg, MVT::v4f32);
12371237 SDOperand Store =
12381238 DAG.getStore(Val.getValue(1), Val, FIN,
1239 &PseudoSourceValue::getFixedStack(),
1239 PseudoSourceValue::getFixedStack(),
12401240 RegSaveFrameIndex);
12411241 MemOps.push_back(Store);
12421242 FIN = DAG.getNode(ISD::ADD, getPointerTy(), FIN,
12981298 return CreateCopyOfByValArgument(Arg, PtrOff, Chain, Flags, DAG);
12991299 }
13001300 return DAG.getStore(Chain, Arg, PtrOff,
1301 &PseudoSourceValue::getStack(), LocMemOffset);
1301 PseudoSourceValue::getStack(), LocMemOffset);
13021302 }
13031303
13041304 /// ClassifyX86_64SRetCallReturn - Classify how to implement a x86-64
15701570 // Store relative to framepointer.
15711571 MemOpChains2.push_back(
15721572 DAG.getStore(Chain, Source, FIN,
1573 &PseudoSourceValue::getFixedStack(), FI));
1573 PseudoSourceValue::getFixedStack(), FI));
15741574 }
15751575 }
15761576 }
38003800 // The same applies for external symbols during PIC codegen
38013801 if (Subtarget->GVRequiresExtraLoad(GV, getTargetMachine(), false))
38023802 Result = DAG.getLoad(getPointerTy(), DAG.getEntryNode(), Result,
3803 &PseudoSourceValue::getGOT(), 0);
3803 PseudoSourceValue::getGOT(), 0);
38043804
38053805 return Result;
38063806 }
38593859
38603860 if (GA->getGlobal()->isDeclaration()) // initial exec TLS model
38613861 Offset = DAG.getLoad(PtrVT, DAG.getEntryNode(), Offset,
3862 &PseudoSourceValue::getGOT(), 0);
3862 PseudoSourceValue::getGOT(), 0);
38633863
38643864 // The address of the thread local variable is the add of the thread
38653865 // pointer with the offset of the variable.
39923992 SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
39933993 SDOperand Chain = DAG.getStore(DAG.getEntryNode(), Op.getOperand(0),
39943994 StackSlot,
3995 &PseudoSourceValue::getFixedStack(),
3995 PseudoSourceValue::getFixedStack(),
39963996 SSFI);
39973997
39983998 // These are really Legal; caller falls through into that case.
40354035 Ops.push_back(InFlag);
40364036 Chain = DAG.getNode(X86ISD::FST, Tys, &Ops[0], Ops.size());
40374037 Result = DAG.getLoad(Op.getValueType(), Chain, StackSlot,
4038 &PseudoSourceValue::getFixedStack(), SSFI);
4038 PseudoSourceValue::getFixedStack(), SSFI);
40394039 }
40404040
40414041 return Result;
40744074 if (isScalarFPTypeInSSEReg(Op.getOperand(0).getValueType())) {
40754075 assert(Op.getValueType() == MVT::i64 && "Invalid FP_TO_SINT to lower!");
40764076 Chain = DAG.getStore(Chain, Value, StackSlot,
4077 &PseudoSourceValue::getFixedStack(), SSFI);
4077 PseudoSourceValue::getFixedStack(), SSFI);
40784078 SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other);
40794079 SDOperand Ops[] = {
40804080 Chain, StackSlot, DAG.getValueType(Op.getOperand(0).getValueType())
41344134 Constant *C = ConstantVector::get(CV);
41354135 SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
41364136 SDOperand Mask = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
4137 &PseudoSourceValue::getConstantPool(), 0,
4137 PseudoSourceValue::getConstantPool(), 0,
41384138 false, 16);
41394139 return DAG.getNode(X86ISD::FAND, VT, Op.getOperand(0), Mask);
41404140 }
41634163 Constant *C = ConstantVector::get(CV);
41644164 SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
41654165 SDOperand Mask = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
4166 &PseudoSourceValue::getConstantPool(), 0,
4166 PseudoSourceValue::getConstantPool(), 0,
41674167 false, 16);
41684168 if (MVT::isVector(VT)) {
41694169 return DAG.getNode(ISD::BIT_CONVERT, VT,
42124212 Constant *C = ConstantVector::get(CV);
42134213 SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
42144214 SDOperand Mask1 = DAG.getLoad(SrcVT, DAG.getEntryNode(), CPIdx,
4215 &PseudoSourceValue::getConstantPool(), 0,
4215 PseudoSourceValue::getConstantPool(), 0,
42164216 false, 16);
42174217 SDOperand SignBit = DAG.getNode(X86ISD::FAND, SrcVT, Op1, Mask1);
42184218
42414241 C = ConstantVector::get(CV);
42424242 CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
42434243 SDOperand Mask2 = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
4244 &PseudoSourceValue::getConstantPool(), 0,
4244 PseudoSourceValue::getConstantPool(), 0,
42454245 false, 16);
42464246 SDOperand Val = DAG.getNode(X86ISD::FAND, VT, Op0, Mask2);
42474247