llvm.org GIT mirror llvm / a86686e
Provide an ARMCCState subclass of CCState so that ARM clients will always set CallOrPrologue correctly and eliminate the existing setter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132856 91177308-0d34-0410-b5e6-96231b3b80d8 Cameron Zwarich 9 years ago
2 changed file(s) with 33 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
150150 /// return values. It captures which registers are already assigned and which
151151 /// stack slots are used. It provides accessors to allocate these values.
152152 class CCState {
153 private:
153154 CallingConv::ID CallingConv;
154155 bool IsVarArg;
155156 MachineFunction &MF;
162163 SmallVector UsedRegs;
163164 unsigned FirstByValReg;
164165 bool FirstByValRegValid;
166
167 protected:
165168 ParmContext CallOrPrologue;
169
166170 public:
167171 CCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
168172 const TargetMachine &TM, SmallVector &locs,
307311 bool isFirstByValRegValid() { return FirstByValRegValid; }
308312
309313 ParmContext getCallOrPrologue() { return CallOrPrologue; }
310 void setCallOrPrologue(ParmContext pc) { CallOrPrologue = pc; }
311314
312315 private:
313316 /// MarkAllocated - Mark a register and all of its aliases as allocated.
7070 ARMInterworking("arm-interworking", cl::Hidden,
7171 cl::desc("Enable / disable ARM interworking (for debugging only)"),
7272 cl::init(true));
73
74 namespace llvm {
75 class ARMCCState : public CCState {
76 public:
77 ARMCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
78 const TargetMachine &TM, SmallVector &locs,
79 LLVMContext &C, ParmContext PC)
80 : CCState(CC, isVarArg, MF, TM, locs, C) {
81 assert(((PC == Call) || (PC == Prologue)) &&
82 "ARMCCState users must specify whether their context is call"
83 "or prologue generation.");
84 CallOrPrologue = PC;
85 }
86 };
87 }
7388
7489 // The APCS parameter registers.
7590 static const unsigned GPRArgRegs[] = {
10701085
10711086 // Assign locations to each value returned by this call.
10721087 SmallVector RVLocs;
1073 CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1074 getTargetMachine(), RVLocs, *DAG.getContext());
1088 ARMCCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1089 getTargetMachine(), RVLocs, *DAG.getContext(), Call);
10751090 CCInfo.AnalyzeCallResult(Ins,
10761091 CCAssignFnForNode(CallConv, /* Return*/ true,
10771092 isVarArg));
12051220
12061221 // Analyze operands of the call, assigning locations to each operand.
12071222 SmallVector ArgLocs;
1208 CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1209 getTargetMachine(), ArgLocs, *DAG.getContext());
1210 CCInfo.setCallOrPrologue(Call);
1223 ARMCCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1224 getTargetMachine(), ArgLocs, *DAG.getContext(), Call);
12111225 CCInfo.AnalyzeCallOperands(Outs,
12121226 CCAssignFnForNode(CallConv, /* Return*/ false,
12131227 isVarArg));
16371651 // results are returned in the same way as what the caller expects.
16381652 if (!CCMatch) {
16391653 SmallVector RVLocs1;
1640 CCState CCInfo1(CalleeCC, false, DAG.getMachineFunction(),
1641 getTargetMachine(), RVLocs1, *DAG.getContext());
1654 ARMCCState CCInfo1(CalleeCC, false, DAG.getMachineFunction(),
1655 getTargetMachine(), RVLocs1, *DAG.getContext(), Call);
16421656 CCInfo1.AnalyzeCallResult(Ins, CCAssignFnForNode(CalleeCC, true, isVarArg));
16431657
16441658 SmallVector RVLocs2;
1645 CCState CCInfo2(CallerCC, false, DAG.getMachineFunction(),
1646 getTargetMachine(), RVLocs2, *DAG.getContext());
1659 ARMCCState CCInfo2(CallerCC, false, DAG.getMachineFunction(),
1660 getTargetMachine(), RVLocs2, *DAG.getContext(), Call);
16471661 CCInfo2.AnalyzeCallResult(Ins, CCAssignFnForNode(CallerCC, true, isVarArg));
16481662
16491663 if (RVLocs1.size() != RVLocs2.size())
16691683 // Check if stack adjustment is needed. For now, do not do this if any
16701684 // argument is passed on the stack.
16711685 SmallVector ArgLocs;
1672 CCState CCInfo(CalleeCC, isVarArg, DAG.getMachineFunction(),
1673 getTargetMachine(), ArgLocs, *DAG.getContext());
1674 CCInfo.setCallOrPrologue(Call);
1686 ARMCCState CCInfo(CalleeCC, isVarArg, DAG.getMachineFunction(),
1687 getTargetMachine(), ArgLocs, *DAG.getContext(), Call);
16751688 CCInfo.AnalyzeCallOperands(Outs,
16761689 CCAssignFnForNode(CalleeCC, false, isVarArg));
16771690 if (CCInfo.getNextStackOffset()) {
17301743 SmallVector RVLocs;
17311744
17321745 // CCState - Info about the registers and stack slots.
1733 CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1734 getTargetMachine(), RVLocs, *DAG.getContext());
1746 ARMCCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
1747 getTargetMachine(), RVLocs, *DAG.getContext(), Call);
17351748
17361749 // Analyze outgoing return values.
17371750 CCInfo.AnalyzeReturn(Outs, CCAssignFnForNode(CallConv, /* Return */ true,
24242437
24252438 // Assign locations to all of the incoming arguments.
24262439 SmallVector ArgLocs;
2427 CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
2428 getTargetMachine(), ArgLocs, *DAG.getContext());
2429 CCInfo.setCallOrPrologue(Prologue);
2440 ARMCCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
2441 getTargetMachine(), ArgLocs, *DAG.getContext(), Prologue);
24302442 CCInfo.AnalyzeFormalArguments(Ins,
24312443 CCAssignFnForNode(CallConv, /* Return*/ false,
24322444 isVarArg));