llvm.org GIT mirror llvm / bf12558
Rename getFixedStack to getStackObject. The stack objects represented are not necessarily fixed. Only those will negative frame indices are "fixed." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84315 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 10 years ago
16 changed file(s) with 51 addition(s) and 48 deletion(s). Raw diff Collapse all Expand all
4646 return V->getValueID() == PseudoSourceValueVal;
4747 }
4848
49 /// A pseudo source value referencing a fixed stack frame entry,
50 /// e.g., a spill slot.
51 static const PseudoSourceValue *getFixedStack(int FI);
49 /// A pseudo source value referencing a stack frame entry,
50 /// e.g., a spill slot or an incoming argument on stack.
51 static const PseudoSourceValue *getStackObject(int FI);
5252
5353 /// A pseudo source value referencing the area below the stack frame of
5454 /// a function, e.g., the argument space.
5151 }
5252
5353 namespace {
54 /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
55 /// for holding FixedStack values, which must include a frame
54 /// StackObjectPseudoSourceValue - A specialized PseudoSourceValue
55 /// for holding StackObject values, which must include a frame
5656 /// index.
57 class VISIBILITY_HIDDEN FixedStackPseudoSourceValue
57 class VISIBILITY_HIDDEN StackObjectPseudoSourceValue
5858 : public PseudoSourceValue {
5959 const int FI;
6060 public:
61 explicit FixedStackPseudoSourceValue(int fi) : FI(fi) {}
61 explicit StackObjectPseudoSourceValue(int fi) : FI(fi) {}
6262
6363 virtual bool isConstant(const MachineFrameInfo *MFI) const;
6464
6565 virtual void printCustom(raw_ostream &OS) const {
66 OS << "FixedStack" << FI;
66 if (FI < 0)
67 OS << "Fixed";
68 OS << "StackObject" << FI;
6769 }
6870 };
6971 }
7072
7173 static ManagedStatic > FSValues;
7274
73 const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) {
75 const PseudoSourceValue *PseudoSourceValue::getStackObject(int FI) {
7476 const PseudoSourceValue *&V = (*FSValues)[FI];
7577 if (!V)
76 V = new FixedStackPseudoSourceValue(FI);
78 V = new StackObjectPseudoSourceValue(FI);
7779 return V;
7880 }
7981
8890 return false;
8991 }
9092
91 bool FixedStackPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const{
93 bool
94 StackObjectPseudoSourceValue::isConstant(const MachineFrameInfo *MFI) const {
9295 return MFI && MFI->isImmutableObjectIndex(FI);
9396 }
642642
643643 // Store the vector.
644644 SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Tmp1, StackPtr,
645 PseudoSourceValue::getFixedStack(SPFI), 0);
645 PseudoSourceValue::getStackObject(SPFI), 0);
646646
647647 // Truncate or zero extend offset to target pointer type.
648648 unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
653653 SDValue StackPtr2 = DAG.getNode(ISD::ADD, dl, IdxVT, Tmp3, StackPtr);
654654 // Store the scalar value.
655655 Ch = DAG.getTruncStore(Ch, dl, Tmp2, StackPtr2,
656 PseudoSourceValue::getFixedStack(SPFI), 0, EltVT);
656 PseudoSourceValue::getStackObject(SPFI), 0, EltVT);
657657 // Load the updated vector.
658658 return DAG.getLoad(VT, dl, Ch, StackPtr,
659 PseudoSourceValue::getFixedStack(SPFI), 0);
659 PseudoSourceValue::getStackObject(SPFI), 0);
660660 }
661661
662662
15171517 DebugLoc dl = Node->getDebugLoc();
15181518 SDValue FIPtr = DAG.CreateStackTemporary(VT);
15191519 int FI = cast(FIPtr.getNode())->getIndex();
1520 const Value *SV = PseudoSourceValue::getFixedStack(FI);
1520 const Value *SV = PseudoSourceValue::getStackObject(FI);
15211521
15221522 // Emit a store of each element to the stack slot.
15231523 SmallVector Stores;
17131713
17141714 FrameIndexSDNode *StackPtrFI = cast(FIPtr);
17151715 int SPFI = StackPtrFI->getIndex();
1716 const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
1716 const Value *SV = PseudoSourceValue::getStackObject(SPFI);
17171717
17181718 unsigned SrcSize = SrcOp.getValueType().getSizeInBits();
17191719 unsigned SlotSize = SlotVT.getSizeInBits();
17541754
17551755 SDValue Ch = DAG.getTruncStore(DAG.getEntryNode(), dl, Node->getOperand(0),
17561756 StackPtr,
1757 PseudoSourceValue::getFixedStack(SPFI), 0,
1757 PseudoSourceValue::getStackObject(SPFI), 0,
17581758 Node->getValueType(0).getVectorElementType());
17591759 return DAG.getLoad(Node->getValueType(0), dl, Ch, StackPtr,
1760 PseudoSourceValue::getFixedStack(SPFI), 0);
1760 PseudoSourceValue::getStackObject(SPFI), 0);
17611761 }
17621762
17631763
118118 getTypeForEVT(*DAG.getContext()));
119119 SDValue StackPtr = DAG.CreateStackTemporary(InVT, Alignment);
120120 int SPFI = cast(StackPtr.getNode())->getIndex();
121 const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
121 const Value *SV = PseudoSourceValue::getStackObject(SPFI);
122122
123123 // Emit a store to the stack slot.
124124 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, InOp, StackPtr, SV, 0);
10571057 DebugLoc dl = N->getDebugLoc();
10581058 SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
10591059 int SPFI = cast(StackPtr.getNode())->getIndex();
1060 const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
1060 const Value *SV = PseudoSourceValue::getStackObject(SPFI);
10611061 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, SV, 0);
10621062
10631063 // Load back the required element.
35133513 if (!PtrVal)
35143514 if (const FrameIndexSDNode *FI =
35153515 dyn_cast(Ptr.getNode()))
3516 PtrVal = PseudoSourceValue::getFixedStack(FI->getIndex());
3516 PtrVal = PseudoSourceValue::getStackObject(FI->getIndex());
35173517
35183518 MachineFunction &MF = getMachineFunction();
35193519 unsigned Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
35663566 if (!PtrVal)
35673567 if (const FrameIndexSDNode *FI =
35683568 dyn_cast(Ptr.getNode()))
3569 PtrVal = PseudoSourceValue::getFixedStack(FI->getIndex());
3569 PtrVal = PseudoSourceValue::getStackObject(FI->getIndex());
35703570
35713571 MachineFunction &MF = getMachineFunction();
35723572 unsigned Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
37133713 if (!SV)
37143714 if (const FrameIndexSDNode *FI =
37153715 dyn_cast(Ptr.getNode()))
3716 SV = PseudoSourceValue::getFixedStack(FI->getIndex());
3716 SV = PseudoSourceValue::getStackObject(FI->getIndex());
37173717
37183718 MachineFunction &MF = getMachineFunction();
37193719 unsigned Flags = MachineMemOperand::MOLoad;
38123812 if (!SV)
38133813 if (const FrameIndexSDNode *FI =
38143814 dyn_cast(Ptr.getNode()))
3815 SV = PseudoSourceValue::getFixedStack(FI->getIndex());
3815 SV = PseudoSourceValue::getStackObject(FI->getIndex());
38163816
38173817 MachineFunction &MF = getMachineFunction();
38183818 unsigned Flags = MachineMemOperand::MOStore;
38583858 if (!SV)
38593859 if (const FrameIndexSDNode *FI =
38603860 dyn_cast(Ptr.getNode()))
3861 SV = PseudoSourceValue::getFixedStack(FI->getIndex());
3861 SV = PseudoSourceValue::getStackObject(FI->getIndex());
38623862
38633863 MachineFunction &MF = getMachineFunction();
38643864 unsigned Flags = MachineMemOperand::MOStore;
41964196
41974197 // Store the stack protector onto the stack.
41984198 SDValue Result = DAG.getStore(getRoot(), getCurDebugLoc(), Src, FIN,
4199 PseudoSourceValue::getFixedStack(FI),
4199 PseudoSourceValue::getStackObject(FI),
42004200 0, true);
42014201 setValue(&I, Result);
42024202 DAG.setRoot(Result);
465465 // Update the memory references. This changes the MachineMemOperands
466466 // directly. They may be in use by multiple instructions, however all
467467 // instructions using OldFI are being rewritten to use NewFI.
468 const Value *OldSV = PseudoSourceValue::getFixedStack(OldFI);
469 const Value *NewSV = PseudoSourceValue::getFixedStack(NewFI);
468 const Value *OldSV = PseudoSourceValue::getStackObject(OldFI);
469 const Value *NewSV = PseudoSourceValue::getStackObject(NewFI);
470470 for (MachineInstr::mmo_iterator I = MI->memoperands_begin(),
471471 E = MI->memoperands_end(); I != E; ++I)
472472 if ((*I)->getValue() == OldSV)
186186 const MachineFrameInfo &MFI = *MF.getFrameInfo();
187187 assert(MFI.getObjectOffset(FrameIndex) != -1);
188188 MachineMemOperand *MMO =
189 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FrameIndex),
189 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FrameIndex),
190190 Flags, /*Offset=*/0,
191191 MFI.getObjectSize(FrameIndex),
192192 MFI.getObjectAlignment(FrameIndex));
670670 MachineFrameInfo &MFI = *MF.getFrameInfo();
671671
672672 MachineMemOperand *MMO =
673 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
673 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FI),
674674 MachineMemOperand::MOStore, 0,
675675 MFI.getObjectSize(FI),
676676 MFI.getObjectAlignment(FI));
708708 MachineFrameInfo &MFI = *MF.getFrameInfo();
709709
710710 MachineMemOperand *MMO =
711 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
711 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FI),
712712 MachineMemOperand::MOLoad, 0,
713713 MFI.getObjectSize(FI),
714714 MFI.getObjectAlignment(FI));
308308 //from this parameter
309309 SDValue FIN = DAG.getFrameIndex(FI, MVT::i16);
310310 InVals.push_back(DAG.getLoad(VA.getLocVT(), dl, Chain, FIN,
311 PseudoSourceValue::getFixedStack(FI), 0));
311 PseudoSourceValue::getStackObject(FI), 0));
312312 }
313313 }
314314
22342234 int FI = TailCallArgs[i].FrameIdx;
22352235 // Store relative to framepointer.
22362236 MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, FIN,
2237 PseudoSourceValue::getFixedStack(FI),
2237 PseudoSourceValue::getStackObject(FI),
22382238 0));
22392239 }
22402240 }
22602260 EVT VT = isPPC64 ? MVT::i64 : MVT::i32;
22612261 SDValue NewRetAddrFrIdx = DAG.getFrameIndex(NewRetAddr, VT);
22622262 Chain = DAG.getStore(Chain, dl, OldRetAddr, NewRetAddrFrIdx,
2263 PseudoSourceValue::getFixedStack(NewRetAddr), 0);
2263 PseudoSourceValue::getStackObject(NewRetAddr), 0);
22642264
22652265 // When using the 32/64-bit SVR4 ABI there is no need to move the FP stack
22662266 // slot as the FP is never overwritten.
22702270 int NewFPIdx = MF.getFrameInfo()->CreateFixedObject(SlotSize, NewFPLoc);
22712271 SDValue NewFramePtrIdx = DAG.getFrameIndex(NewFPIdx, VT);
22722272 Chain = DAG.getStore(Chain, dl, OldFP, NewFramePtrIdx,
2273 PseudoSourceValue::getFixedStack(NewFPIdx), 0);
2273 PseudoSourceValue::getStackObject(NewFPIdx), 0);
22742274 }
22752275 }
22762276 return Chain;
33873387
33883388 // STD the extended value into the stack slot.
33893389 MachineMemOperand *MMO =
3390 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FrameIdx),
3390 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FrameIdx),
33913391 MachineMemOperand::MOStore, 0, 8, 8);
33923392 SDValue Ops[] = { DAG.getEntryNode(), Ext64, FIdx };
33933393 SDValue Store =
321321 // from this parameter
322322 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
323323 ArgValue = DAG.getLoad(LocVT, dl, Chain, FIN,
324 PseudoSourceValue::getFixedStack(FI), 0);
324 PseudoSourceValue::getStackObject(FI), 0);
325325 }
326326
327327 // If this is an 8/16/32-bit value, it is really passed promoted to 64
114114 if (TID.mayStore())
115115 Flags |= MachineMemOperand::MOStore;
116116 MachineMemOperand *MMO =
117 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
117 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FI),
118118 Flags, Offset,
119119 MFI.getObjectSize(FI),
120120 MFI.getObjectAlignment(FI));
13721372 if (Flags.isByVal())
13731373 return FIN;
13741374 return DAG.getLoad(ValVT, dl, Chain, FIN,
1375 PseudoSourceValue::getFixedStack(FI), 0);
1375 PseudoSourceValue::getStackObject(FI), 0);
13761376 }
13771377
13781378 SDValue
15611561 SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64);
15621562 SDValue Store =
15631563 DAG.getStore(Val.getValue(1), dl, Val, FIN,
1564 PseudoSourceValue::getFixedStack(RegSaveFrameIndex),
1564 PseudoSourceValue::getStackObject(RegSaveFrameIndex),
15651565 Offset);
15661566 MemOps.push_back(Store);
15671567 Offset += 8;
16721672 EVT VT = Is64Bit ? MVT::i64 : MVT::i32;
16731673 SDValue NewRetAddrFrIdx = DAG.getFrameIndex(NewReturnAddrFI, VT);
16741674 Chain = DAG.getStore(Chain, dl, RetAddrFrIdx, NewRetAddrFrIdx,
1675 PseudoSourceValue::getFixedStack(NewReturnAddrFI), 0);
1675 PseudoSourceValue::getStackObject(NewReturnAddrFI), 0);
16761676 return Chain;
16771677 }
16781678
17661766 SDValue SpillSlot = DAG.CreateStackTemporary(VA.getValVT());
17671767 int FI = cast(SpillSlot)->getIndex();
17681768 Chain = DAG.getStore(Chain, dl, Arg, SpillSlot,
1769 PseudoSourceValue::getFixedStack(FI), 0);
1769 PseudoSourceValue::getStackObject(FI), 0);
17701770 Arg = SpillSlot;
17711771 break;
17721772 }
18991899 // Store relative to framepointer.
19001900 MemOpChains2.push_back(
19011901 DAG.getStore(ArgChain, dl, Arg, FIN,
1902 PseudoSourceValue::getFixedStack(FI), 0));
1902 PseudoSourceValue::getStackObject(FI), 0));
19031903 }
19041904 }
19051905 }
48674867 SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
48684868 SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Op.getOperand(0),
48694869 StackSlot,
4870 PseudoSourceValue::getFixedStack(SSFI), 0);
4870 PseudoSourceValue::getStackObject(SSFI), 0);
48714871 return BuildFILD(Op, SrcVT, Chain, StackSlot, DAG);
48724872 }
48734873
49084908 Ops.push_back(InFlag);
49094909 Chain = DAG.getNode(X86ISD::FST, dl, Tys, &Ops[0], Ops.size());
49104910 Result = DAG.getLoad(Op.getValueType(), dl, Chain, StackSlot,
4911 PseudoSourceValue::getFixedStack(SSFI), 0);
4911 PseudoSourceValue::getStackObject(SSFI), 0);
49124912 }
49134913
49144914 return Result;
51235123 if (isScalarFPTypeInSSEReg(Op.getOperand(0).getValueType())) {
51245124 assert(DstTy == MVT::i64 && "Invalid FP_TO_SINT to lower!");
51255125 Chain = DAG.getStore(Chain, dl, Value, StackSlot,
5126 PseudoSourceValue::getFixedStack(SSFI), 0);
5126 PseudoSourceValue::getStackObject(SSFI), 0);
51275127 SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other);
51285128 SDValue Ops[] = {
51295129 Chain, StackSlot, DAG.getValueType(Op.getOperand(0).getValueType())
77537753 int64_t Offset = (i - 3) * 16 + VarArgsFPOffset;
77547754 MachineMemOperand *MMO =
77557755 F->getMachineMemOperand(
7756 PseudoSourceValue::getFixedStack(RegSaveFrameIndex),
7756 PseudoSourceValue::getStackObject(RegSaveFrameIndex),
77577757 MachineMemOperand::MOStore, Offset,
77587758 /*Size=*/16, /*Align=*/16);
77597759 BuildMI(XMMSaveMBB, DL, TII->get(X86::MOVAPSmr))
143143 if (TID.mayStore())
144144 Flags |= MachineMemOperand::MOStore;
145145 MachineMemOperand *MMO =
146 MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
146 MF.getMachineMemOperand(PseudoSourceValue::getStackObject(FI),
147147 Flags, Offset,
148148 MFI.getObjectSize(FI),
149149 MFI.getObjectAlignment(FI));