llvm.org GIT mirror llvm / aa8c194
Add versions of OutputArgReg, AnalyzeReturn, and AnalyzeCallOperands which do not depend on SelectionDAG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107666 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
3 changed file(s) with 56 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
184184 /// incorporating info about the result values into this state.
185185 void AnalyzeReturn(const SmallVectorImpl &Outs,
186186 CCAssignFn Fn);
187 void AnalyzeReturn(const SmallVectorImpl &Outs,
188 CCAssignFn Fn);
187189
188190 /// CheckReturn - Analyze the return values of a function, returning
189191 /// true if the return can be performed without sret-demotion, and
195197 /// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
196198 /// incorporating info about the passed values into this state.
197199 void AnalyzeCallOperands(const SmallVectorImpl &Outs,
200 CCAssignFn Fn);
201 void AnalyzeCallOperands(const SmallVectorImpl &Outs,
198202 CCAssignFn Fn);
199203
200204 /// AnalyzeCallOperands - Same as above except it takes vectors of types
15821582 "OutputArg value type must be Simple!");
15831583 }
15841584 };
1585
1586 /// OutputArgReg - This struct carries flags and a register value for a
1587 /// single outgoing (actual) argument or outgoing (from the perspective
1588 /// of the caller) return value virtual register.
1589 ///
1590 struct OutputArgReg {
1591 ArgFlagsTy Flags;
1592 EVT VT;
1593 unsigned Reg;
1594
1595 /// IsFixed - Is this a "fixed" value, ie not passed through a vararg "...".
1596 bool IsFixed;
1597
1598 OutputArgReg() : IsFixed(false) {}
1599 OutputArgReg(ISD::ArgFlagsTy flags, EVT vt, unsigned reg, bool isfixed)
1600 : Flags(flags), VT(vt), Reg(reg), IsFixed(isfixed) {}
1601 };
15851602 }
15861603
15871604 /// VTSDNode - This class is used to represent EVT's, which are used
110110 }
111111 }
112112
113 void CCState::AnalyzeReturn(const SmallVectorImpl &Outs,
114 CCAssignFn Fn) {
115 // Determine which register each value should be copied into.
116 for (unsigned i = 0, e = Outs.size(); i != e; ++i) {
117 EVT VT = Outs[i].VT;
118 ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
119 if (Fn(i, VT, VT, CCValAssign::Full, ArgFlags, *this)) {
120 #ifndef NDEBUG
121 dbgs() << "Return operand #" << i << " has unhandled type "
122 << VT.getEVTString();
123 #endif
124 llvm_unreachable(0);
125 }
126 }
127 }
128
113129
114130 /// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
115131 /// incorporating info about the passed values into this state.
118134 unsigned NumOps = Outs.size();
119135 for (unsigned i = 0; i != NumOps; ++i) {
120136 EVT ArgVT = Outs[i].Val.getValueType();
137 ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
138 if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
139 #ifndef NDEBUG
140 dbgs() << "Call operand #" << i << " has unhandled type "
141 << ArgVT.getEVTString();
142 #endif
143 llvm_unreachable(0);
144 }
145 }
146 }
147
148 /// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
149 /// incorporating info about the passed values into this state.
150 void
151 CCState::AnalyzeCallOperands(const SmallVectorImpl &Outs,
152 CCAssignFn Fn) {
153 unsigned NumOps = Outs.size();
154 for (unsigned i = 0; i != NumOps; ++i) {
155 EVT ArgVT = Outs[i].VT;
121156 ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
122157 if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
123158 #ifndef NDEBUG