llvm.org GIT mirror llvm / a2780e1
Move ReturnAddrIndex variable to X86MachineFunctionInfo structure. This fixed hard to catch bugs with retaddr lowering git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41104 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 13 years ago
3 changed file(s) with 25 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
780780
781781 BytesCallerReserves = StackSize;
782782 }
783
783
784784 RegSaveFrameIndex = 0xAAAAAAA; // X86-64 only.
785 ReturnAddrIndex = 0; // No return address slot generated yet.
786
787 MF.getInfo()
788 ->setBytesToPopOnReturn(BytesToPopOnReturn);
785
786 X86MachineFunctionInfo *FuncInfo = MF.getInfo();
787 FuncInfo->setBytesToPopOnReturn(BytesToPopOnReturn);
789788
790789 // Return the new list of results.
791790 return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(),
10261025
10271026 VarArgsFrameIndex = 0xAAAAAAA; // fastcc functions can't have varargs.
10281027 RegSaveFrameIndex = 0xAAAAAAA; // X86-64 only.
1029 ReturnAddrIndex = 0; // No return address slot generated yet.
10301028 BytesToPopOnReturn = StackSize; // Callee pops all stack arguments.
10311029 BytesCallerReserves = 0;
10321030
1033 MF.getInfo()
1034 ->setBytesToPopOnReturn(BytesToPopOnReturn);
1031 X86MachineFunctionInfo *FuncInfo = MF.getInfo();
1032 FuncInfo->setBytesToPopOnReturn(BytesToPopOnReturn);
10351033
10361034 // Return the new list of results.
10371035 return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(),
13181316
13191317 ArgValues.push_back(Root);
13201318
1321 ReturnAddrIndex = 0; // No return address slot generated yet.
13221319 BytesToPopOnReturn = 0; // Callee pops nothing.
13231320 BytesCallerReserves = StackSize;
1321
1322 X86MachineFunctionInfo *FuncInfo = MF.getInfo();
1323 FuncInfo->setBytesToPopOnReturn(BytesToPopOnReturn);
13241324
13251325 // Return the new list of results.
13261326 return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(),
14701470
14711471
14721472 SDOperand X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) {
1473 MachineFunction &MF = DAG.getMachineFunction();
1474 X86MachineFunctionInfo *FuncInfo = MF.getInfo();
1475 int ReturnAddrIndex = FuncInfo->getRAIndex();
1476
14731477 if (ReturnAddrIndex == 0) {
14741478 // Set up a frame object for the return address.
1475 MachineFunction &MF = DAG.getMachineFunction();
14761479 if (Subtarget->is64Bit())
14771480 ReturnAddrIndex = MF.getFrameInfo()->CreateFixedObject(8, -8);
14781481 else
14791482 ReturnAddrIndex = MF.getFrameInfo()->CreateFixedObject(4, -4);
1483
1484 FuncInfo->setRAIndex(ReturnAddrIndex);
14801485 }
14811486
14821487 return DAG.getFrameIndex(ReturnAddrIndex, getPointerTy());
281281 int RegSaveFrameIndex; // X86-64 vararg func register save area.
282282 unsigned VarArgsGPOffset; // X86-64 vararg func int reg offset.
283283 unsigned VarArgsFPOffset; // X86-64 vararg func fp reg offset.
284 int ReturnAddrIndex; // FrameIndex for return slot.
285284 int BytesToPopOnReturn; // Number of arg bytes ret should pop.
286285 int BytesCallerReserves; // Number of arg bytes caller makes.
287286 public:
4343 /// If the function requires additional name decoration, DecorationStyle holds
4444 /// the right way to do so.
4545 NameDecorationStyle DecorationStyle;
46
46
47 // FrameIndex for return slot.
48 int ReturnAddrIndex;
4749 public:
4850 X86MachineFunctionInfo() : ForceFramePointer(false),
4951 CalleeSavedFrameSize(0),
5052 BytesToPopOnReturn(0),
51 DecorationStyle(None) {}
53 DecorationStyle(None),
54 ReturnAddrIndex(0) {}
5255
5356 X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
5457 CalleeSavedFrameSize(0),
5558 BytesToPopOnReturn(0),
56 DecorationStyle(None) {}
59 DecorationStyle(None),
60 ReturnAddrIndex(0) {}
5761
5862 bool getForceFramePointer() const { return ForceFramePointer;}
5963 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
6670
6771 NameDecorationStyle getDecorationStyle() const { return DecorationStyle; }
6872 void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;}
69
73
74 int getRAIndex() const { return ReturnAddrIndex; }
75 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
7076 };
7177 } // End llvm namespace
7278