LLVM 18.0.0git
CallingConvLower.h
Go to the documentation of this file.
1//===- llvm/CallingConvLower.h - Calling Conventions ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the CCState and CCValAssign classes, used for lowering
10// and implementing calling conventions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_CALLINGCONVLOWER_H
15#define LLVM_CODEGEN_CALLINGCONVLOWER_H
16
20#include "llvm/IR/CallingConv.h"
22#include <variant>
23
24namespace llvm {
25
26class CCState;
27class MachineFunction;
28class MVT;
29class TargetRegisterInfo;
30
31/// CCValAssign - Represent assignment of one arg/retval to a location.
33public:
34 enum LocInfo {
35 Full, // The value fills the full location.
36 SExt, // The value is sign extended in the location.
37 ZExt, // The value is zero extended in the location.
38 AExt, // The value is extended with undefined upper bits.
39 SExtUpper, // The value is in the upper bits of the location and should be
40 // sign extended when retrieved.
41 ZExtUpper, // The value is in the upper bits of the location and should be
42 // zero extended when retrieved.
43 AExtUpper, // The value is in the upper bits of the location and should be
44 // extended with undefined upper bits when retrieved.
45 BCvt, // The value is bit-converted in the location.
46 Trunc, // The value is truncated in the location.
47 VExt, // The value is vector-widened in the location.
48 // FIXME: Not implemented yet. Code that uses AExt to mean
49 // vector-widen should be fixed to use VExt instead.
50 FPExt, // The floating-point value is fp-extended in the location.
51 Indirect // The location contains pointer to the value.
52 // TODO: a subset of the value is in the location.
53 };
54
55private:
56 // Holds one of:
57 // - the register that the value is assigned to;
58 // - the memory offset at which the value resides;
59 // - additional information about pending location; the exact interpretation
60 // of the data is target-dependent.
61 std::variant<Register, int64_t, unsigned> Data;
62
63 /// ValNo - This is the value number being assigned (e.g. an argument number).
64 unsigned ValNo;
65
66 /// isCustom - True if this arg/retval requires special handling.
67 unsigned isCustom : 1;
68
69 /// Information about how the value is assigned.
70 LocInfo HTP : 6;
71
72 /// ValVT - The type of the value being assigned.
73 MVT ValVT;
74
75 /// LocVT - The type of the location being assigned to.
76 MVT LocVT;
77
78 CCValAssign(LocInfo HTP, unsigned ValNo, MVT ValVT, MVT LocVT, bool IsCustom)
79 : ValNo(ValNo), isCustom(IsCustom), HTP(HTP), ValVT(ValVT), LocVT(LocVT) {
80 }
81
82public:
83 static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo,
84 MVT LocVT, LocInfo HTP, bool IsCustom = false) {
85 CCValAssign Ret(HTP, ValNo, ValVT, LocVT, IsCustom);
86 Ret.Data = Register(RegNo);
87 return Ret;
88 }
89
90 static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, unsigned RegNo,
91 MVT LocVT, LocInfo HTP) {
92 return getReg(ValNo, ValVT, RegNo, LocVT, HTP, /*IsCustom=*/true);
93 }
94
95 static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset,
96 MVT LocVT, LocInfo HTP, bool IsCustom = false) {
97 CCValAssign Ret(HTP, ValNo, ValVT, LocVT, IsCustom);
98 Ret.Data = Offset;
99 return Ret;
100 }
101
102 static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset,
103 MVT LocVT, LocInfo HTP) {
104 return getMem(ValNo, ValVT, Offset, LocVT, HTP, /*IsCustom=*/true);
105 }
106
107 static CCValAssign getPending(unsigned ValNo, MVT ValVT, MVT LocVT,
108 LocInfo HTP, unsigned ExtraInfo = 0) {
109 CCValAssign Ret(HTP, ValNo, ValVT, LocVT, false);
110 Ret.Data = ExtraInfo;
111 return Ret;
112 }
113
114 void convertToReg(unsigned RegNo) { Data = Register(RegNo); }
115
116 void convertToMem(int64_t Offset) { Data = Offset; }
117
118 unsigned getValNo() const { return ValNo; }
119 MVT getValVT() const { return ValVT; }
120
121 bool isRegLoc() const { return std::holds_alternative<Register>(Data); }
122 bool isMemLoc() const { return std::holds_alternative<int64_t>(Data); }
123 bool isPendingLoc() const { return std::holds_alternative<unsigned>(Data); }
124
125 bool needsCustom() const { return isCustom; }
126
127 Register getLocReg() const { return std::get<Register>(Data); }
128 int64_t getLocMemOffset() const { return std::get<int64_t>(Data); }
129 unsigned getExtraInfo() const { return std::get<unsigned>(Data); }
130
131 MVT getLocVT() const { return LocVT; }
132
133 LocInfo getLocInfo() const { return HTP; }
134 bool isExtInLoc() const {
135 return (HTP == AExt || HTP == SExt || HTP == ZExt);
136 }
137
138 bool isUpperBitsInLoc() const {
139 return HTP == AExtUpper || HTP == SExtUpper || HTP == ZExtUpper;
140 }
141};
142
143/// Describes a register that needs to be forwarded from the prologue to a
144/// musttail call.
147 : VReg(VReg), PReg(PReg), VT(VT) {}
151};
152
153/// CCAssignFn - This function assigns a location for Val, updating State to
154/// reflect the change. It returns 'true' if it failed to handle Val.
155typedef bool CCAssignFn(unsigned ValNo, MVT ValVT,
156 MVT LocVT, CCValAssign::LocInfo LocInfo,
157 ISD::ArgFlagsTy ArgFlags, CCState &State);
158
159/// CCCustomFn - This function assigns a location for Val, possibly updating
160/// all args to reflect changes and indicates if it handled it. It must set
161/// isCustom if it handles the arg and returns true.
162typedef bool CCCustomFn(unsigned &ValNo, MVT &ValVT,
163 MVT &LocVT, CCValAssign::LocInfo &LocInfo,
164 ISD::ArgFlagsTy &ArgFlags, CCState &State);
165
166/// CCState - This class holds information needed while lowering arguments and
167/// return values. It captures which registers are already assigned and which
168/// stack slots are used. It provides accessors to allocate these values.
169class CCState {
170private:
171 CallingConv::ID CallingConv;
172 bool IsVarArg;
173 bool AnalyzingMustTailForwardedRegs = false;
174 MachineFunction &MF;
175 const TargetRegisterInfo &TRI;
177 LLVMContext &Context;
178 // True if arguments should be allocated at negative offsets.
179 bool NegativeOffsets;
180
181 uint64_t StackSize;
182 Align MaxStackArgAlign;
184 SmallVector<CCValAssign, 4> PendingLocs;
185 SmallVector<ISD::ArgFlagsTy, 4> PendingArgFlags;
186
187 // ByValInfo and SmallVector<ByValInfo, 4> ByValRegs:
188 //
189 // Vector of ByValInfo instances (ByValRegs) is introduced for byval registers
190 // tracking.
191 // Or, in another words it tracks byval parameters that are stored in
192 // general purpose registers.
193 //
194 // For 4 byte stack alignment,
195 // instance index means byval parameter number in formal
196 // arguments set. Assume, we have some "struct_type" with size = 4 bytes,
197 // then, for function "foo":
198 //
199 // i32 foo(i32 %p, %struct_type* %r, i32 %s, %struct_type* %t)
200 //
201 // ByValRegs[0] describes how "%r" is stored (Begin == r1, End == r2)
202 // ByValRegs[1] describes how "%t" is stored (Begin == r3, End == r4).
203 //
204 // In case of 8 bytes stack alignment,
205 // In function shown above, r3 would be wasted according to AAPCS rules.
206 // ByValRegs vector size still would be 2,
207 // while "%t" goes to the stack: it wouldn't be described in ByValRegs.
208 //
209 // Supposed use-case for this collection:
210 // 1. Initially ByValRegs is empty, InRegsParamsProcessed is 0.
211 // 2. HandleByVal fills up ByValRegs.
212 // 3. Argument analysis (LowerFormatArguments, for example). After
213 // some byval argument was analyzed, InRegsParamsProcessed is increased.
214 struct ByValInfo {
215 ByValInfo(unsigned B, unsigned E) : Begin(B), End(E) {}
216
217 // First register allocated for current parameter.
218 unsigned Begin;
219
220 // First after last register allocated for current parameter.
221 unsigned End;
222 };
224
225 // InRegsParamsProcessed - shows how many instances of ByValRegs was proceed
226 // during argument analysis.
227 unsigned InRegsParamsProcessed;
228
229public:
230 CCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF,
232 bool NegativeOffsets = false);
233
234 void addLoc(const CCValAssign &V) {
235 Locs.push_back(V);
236 }
237
238 LLVMContext &getContext() const { return Context; }
239 MachineFunction &getMachineFunction() const { return MF; }
240 CallingConv::ID getCallingConv() const { return CallingConv; }
241 bool isVarArg() const { return IsVarArg; }
242
243 /// Returns the size of the currently allocated portion of the stack.
244 uint64_t getStackSize() const { return StackSize; }
245
246 /// getAlignedCallFrameSize - Return the size of the call frame needed to
247 /// be able to store all arguments and such that the alignment requirement
248 /// of each of the arguments is satisfied.
250 return alignTo(StackSize, MaxStackArgAlign);
251 }
252
253 /// isAllocated - Return true if the specified register (or an alias) is
254 /// allocated.
256 return UsedRegs[Reg / 32] & (1 << (Reg & 31));
257 }
258
259 /// AnalyzeFormalArguments - Analyze an array of argument values,
260 /// incorporating info about the formals into this state.
262 CCAssignFn Fn);
263
264 /// The function will invoke AnalyzeFormalArguments.
266 CCAssignFn Fn) {
267 AnalyzeFormalArguments(Ins, Fn);
268 }
269
270 /// AnalyzeReturn - Analyze the returned values of a return,
271 /// incorporating info about the result values into this state.
273 CCAssignFn Fn);
274
275 /// CheckReturn - Analyze the return values of a function, returning
276 /// true if the return can be performed without sret-demotion, and
277 /// false otherwise.
279 CCAssignFn Fn);
280
281 /// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
282 /// incorporating info about the passed values into this state.
284 CCAssignFn Fn);
285
286 /// AnalyzeCallOperands - Same as above except it takes vectors of types
287 /// and argument flags.
290 CCAssignFn Fn);
291
292 /// The function will invoke AnalyzeCallOperands.
294 CCAssignFn Fn) {
295 AnalyzeCallOperands(Outs, Fn);
296 }
297
298 /// AnalyzeCallResult - Analyze the return values of a call,
299 /// incorporating info about the passed values into this state.
301 CCAssignFn Fn);
302
303 /// A shadow allocated register is a register that was allocated
304 /// but wasn't added to the location list (Locs).
305 /// \returns true if the register was allocated as shadow or false otherwise.
307
308 /// AnalyzeCallResult - Same as above except it's specialized for calls which
309 /// produce a single value.
310 void AnalyzeCallResult(MVT VT, CCAssignFn Fn);
311
312 /// getFirstUnallocated - Return the index of the first unallocated register
313 /// in the set, or Regs.size() if they are all allocated.
315 for (unsigned i = 0; i < Regs.size(); ++i)
316 if (!isAllocated(Regs[i]))
317 return i;
318 return Regs.size();
319 }
320
322 assert(isAllocated(Reg) && "Trying to deallocate an unallocated register");
323 MarkUnallocated(Reg);
324 }
325
326 /// AllocateReg - Attempt to allocate one register. If it is not available,
327 /// return zero. Otherwise, return the register, marking it and any aliases
328 /// as allocated.
330 if (isAllocated(Reg))
331 return MCRegister();
332 MarkAllocated(Reg);
333 return Reg;
334 }
335
336 /// Version of AllocateReg with extra register to be shadowed.
338 if (isAllocated(Reg))
339 return MCRegister();
340 MarkAllocated(Reg);
341 MarkAllocated(ShadowReg);
342 return Reg;
343 }
344
345 /// AllocateReg - Attempt to allocate one of the specified registers. If none
346 /// are available, return zero. Otherwise, return the first one available,
347 /// marking it and any aliases as allocated.
349 unsigned FirstUnalloc = getFirstUnallocated(Regs);
350 if (FirstUnalloc == Regs.size())
351 return MCRegister(); // Didn't find the reg.
352
353 // Mark the register and any aliases as allocated.
354 MCPhysReg Reg = Regs[FirstUnalloc];
355 MarkAllocated(Reg);
356 return Reg;
357 }
358
359 /// AllocateRegBlock - Attempt to allocate a block of RegsRequired consecutive
360 /// registers. If this is not possible, return zero. Otherwise, return the first
361 /// register of the block that were allocated, marking the entire block as allocated.
362 MCPhysReg AllocateRegBlock(ArrayRef<MCPhysReg> Regs, unsigned RegsRequired) {
363 if (RegsRequired > Regs.size())
364 return 0;
365
366 for (unsigned StartIdx = 0; StartIdx <= Regs.size() - RegsRequired;
367 ++StartIdx) {
368 bool BlockAvailable = true;
369 // Check for already-allocated regs in this block
370 for (unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
371 if (isAllocated(Regs[StartIdx + BlockIdx])) {
372 BlockAvailable = false;
373 break;
374 }
375 }
376 if (BlockAvailable) {
377 // Mark the entire block as allocated
378 for (unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
379 MarkAllocated(Regs[StartIdx + BlockIdx]);
380 }
381 return Regs[StartIdx];
382 }
383 }
384 // No block was available
385 return 0;
386 }
387
388 /// Version of AllocateReg with list of registers to be shadowed.
390 unsigned FirstUnalloc = getFirstUnallocated(Regs);
391 if (FirstUnalloc == Regs.size())
392 return MCRegister(); // Didn't find the reg.
393
394 // Mark the register and any aliases as allocated.
395 MCRegister Reg = Regs[FirstUnalloc], ShadowReg = ShadowRegs[FirstUnalloc];
396 MarkAllocated(Reg);
397 MarkAllocated(ShadowReg);
398 return Reg;
399 }
400
401 /// AllocateStack - Allocate a chunk of stack space with the specified size
402 /// and alignment.
403 int64_t AllocateStack(unsigned Size, Align Alignment) {
404 int64_t Offset;
405 if (NegativeOffsets) {
406 StackSize = alignTo(StackSize + Size, Alignment);
407 Offset = -StackSize;
408 } else {
409 Offset = alignTo(StackSize, Alignment);
410 StackSize = Offset + Size;
411 }
412 MaxStackArgAlign = std::max(Alignment, MaxStackArgAlign);
413 ensureMaxAlignment(Alignment);
414 return Offset;
415 }
416
417 void ensureMaxAlignment(Align Alignment);
418
419 /// Version of AllocateStack with list of extra registers to be shadowed.
420 /// Note that, unlike AllocateReg, this shadows ALL of the shadow registers.
421 int64_t AllocateStack(unsigned Size, Align Alignment,
422 ArrayRef<MCPhysReg> ShadowRegs) {
423 for (MCPhysReg Reg : ShadowRegs)
424 MarkAllocated(Reg);
425 return AllocateStack(Size, Alignment);
426 }
427
428 // HandleByVal - Allocate a stack slot large enough to pass an argument by
429 // value. The size and alignment information of the argument is encoded in its
430 // parameter attribute.
431 void HandleByVal(unsigned ValNo, MVT ValVT, MVT LocVT,
432 CCValAssign::LocInfo LocInfo, int MinSize, Align MinAlign,
433 ISD::ArgFlagsTy ArgFlags);
434
435 // Returns count of byval arguments that are to be stored (even partly)
436 // in registers.
437 unsigned getInRegsParamsCount() const { return ByValRegs.size(); }
438
439 // Returns count of byval in-regs arguments processed.
440 unsigned getInRegsParamsProcessed() const { return InRegsParamsProcessed; }
441
442 // Get information about N-th byval parameter that is stored in registers.
443 // Here "ByValParamIndex" is N.
444 void getInRegsParamInfo(unsigned InRegsParamRecordIndex,
445 unsigned& BeginReg, unsigned& EndReg) const {
446 assert(InRegsParamRecordIndex < ByValRegs.size() &&
447 "Wrong ByVal parameter index");
448
449 const ByValInfo& info = ByValRegs[InRegsParamRecordIndex];
450 BeginReg = info.Begin;
451 EndReg = info.End;
452 }
453
454 // Add information about parameter that is kept in registers.
455 void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd) {
456 ByValRegs.push_back(ByValInfo(RegBegin, RegEnd));
457 }
458
459 // Goes either to next byval parameter (excluding "waste" record), or
460 // to the end of collection.
461 // Returns false, if end is reached.
463 unsigned e = ByValRegs.size();
464 if (InRegsParamsProcessed < e)
465 ++InRegsParamsProcessed;
466 return InRegsParamsProcessed < e;
467 }
468
469 // Clear byval registers tracking info.
471 InRegsParamsProcessed = 0;
472 ByValRegs.clear();
473 }
474
475 // Rewind byval registers tracking info.
477 InRegsParamsProcessed = 0;
478 }
479
480 // Get list of pending assignments
482 return PendingLocs;
483 }
484
485 // Get a list of argflags for pending assignments.
487 return PendingArgFlags;
488 }
489
490 /// Compute the remaining unused register parameters that would be used for
491 /// the given value type. This is useful when varargs are passed in the
492 /// registers that normal prototyped parameters would be passed in, or for
493 /// implementing perfect forwarding.
495 CCAssignFn Fn);
496
497 /// Compute the set of registers that need to be preserved and forwarded to
498 /// any musttail calls.
501 CCAssignFn Fn);
502
503 /// Returns true if the results of the two calling conventions are compatible.
504 /// This is usually part of the check for tailcall eligibility.
505 static bool resultsCompatible(CallingConv::ID CalleeCC,
506 CallingConv::ID CallerCC, MachineFunction &MF,
507 LLVMContext &C,
509 CCAssignFn CalleeFn, CCAssignFn CallerFn);
510
511 /// The function runs an additional analysis pass over function arguments.
512 /// It will mark each argument with the attribute flag SecArgPass.
513 /// After running, it will sort the locs list.
514 template <class T>
516 CCAssignFn Fn) {
517 unsigned NumFirstPassLocs = Locs.size();
518
519 /// Creates similar argument list to \p Args in which each argument is
520 /// marked using SecArgPass flag.
521 SmallVector<T, 16> SecPassArg;
522 // SmallVector<ISD::InputArg, 16> SecPassArg;
523 for (auto Arg : Args) {
524 Arg.Flags.setSecArgPass();
525 SecPassArg.push_back(Arg);
526 }
527
528 // Run the second argument pass
529 AnalyzeArguments(SecPassArg, Fn);
530
531 // Sort the locations of the arguments according to their original position.
533 TmpArgLocs.swap(Locs);
534 auto B = TmpArgLocs.begin(), E = TmpArgLocs.end();
535 std::merge(B, B + NumFirstPassLocs, B + NumFirstPassLocs, E,
536 std::back_inserter(Locs),
537 [](const CCValAssign &A, const CCValAssign &B) -> bool {
538 return A.getValNo() < B.getValNo();
539 });
540 }
541
542private:
543 /// MarkAllocated - Mark a register and all of its aliases as allocated.
544 void MarkAllocated(MCPhysReg Reg);
545
546 void MarkUnallocated(MCPhysReg Reg);
547};
548
549} // end namespace llvm
550
551#endif // LLVM_CODEGEN_CALLINGCONVLOWER_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
uint64_t Size
bool End
Definition: ELF_riscv.cpp:478
lazy value info
unsigned Reg
LLVMContext & Context
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
CCState - This class holds information needed while lowering arguments and return values.
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
void HandleByVal(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, int MinSize, Align MinAlign, ISD::ArgFlagsTy ArgFlags)
Allocate space on the stack large enough to pass an argument by value.
MachineFunction & getMachineFunction() const
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
void AnalyzeArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
The function will invoke AnalyzeFormalArguments.
void analyzeMustTailForwardedRegisters(SmallVectorImpl< ForwardedRegister > &Forwards, ArrayRef< MVT > RegParmTypes, CCAssignFn Fn)
Compute the set of registers that need to be preserved and forwarded to any musttail calls.
int64_t AllocateStack(unsigned Size, Align Alignment, ArrayRef< MCPhysReg > ShadowRegs)
Version of AllocateStack with list of extra registers to be shadowed.
void AnalyzeArgumentsSecondPass(const SmallVectorImpl< T > &Args, CCAssignFn Fn)
The function runs an additional analysis pass over function arguments.
static bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
bool IsShadowAllocatedReg(MCRegister Reg) const
A shadow allocated register is a register that was allocated but wasn't added to the location list (L...
void AnalyzeArguments(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
The function will invoke AnalyzeCallOperands.
CallingConv::ID getCallingConv() const
SmallVectorImpl< ISD::ArgFlagsTy > & getPendingArgFlags()
MCRegister AllocateReg(MCPhysReg Reg)
AllocateReg - Attempt to allocate one register.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
MCPhysReg AllocateRegBlock(ArrayRef< MCPhysReg > Regs, unsigned RegsRequired)
AllocateRegBlock - Attempt to allocate a block of RegsRequired consecutive registers.
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
LLVMContext & getContext() const
int64_t AllocateStack(unsigned Size, Align Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
void rewindByValRegsInfo()
void getRemainingRegParmsForType(SmallVectorImpl< MCPhysReg > &Regs, MVT VT, CCAssignFn Fn)
Compute the remaining unused register parameters that would be used for the given value type.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
unsigned getInRegsParamsProcessed() const
void ensureMaxAlignment(Align Alignment)
void DeallocateReg(MCPhysReg Reg)
MCPhysReg AllocateReg(ArrayRef< MCPhysReg > Regs)
AllocateReg - Attempt to allocate one of the specified registers.
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
MCRegister AllocateReg(ArrayRef< MCPhysReg > Regs, const MCPhysReg *ShadowRegs)
Version of AllocateReg with list of registers to be shadowed.
SmallVectorImpl< CCValAssign > & getPendingLocs()
bool isVarArg() const
uint64_t getAlignedCallFrameSize() const
getAlignedCallFrameSize - Return the size of the call frame needed to be able to store all arguments ...
bool isAllocated(MCRegister Reg) const
isAllocated - Return true if the specified register (or an alias) is allocated.
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
MCRegister AllocateReg(MCPhysReg Reg, MCPhysReg ShadowReg)
Version of AllocateReg with extra register to be shadowed.
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
void addLoc(const CCValAssign &V)
unsigned getInRegsParamsCount() const
void clearByValRegsInfo()
CCValAssign - Represent assignment of one arg/retval to a location.
bool isRegLoc() const
static CCValAssign getPending(unsigned ValNo, MVT ValVT, MVT LocVT, LocInfo HTP, unsigned ExtraInfo=0)
Register getLocReg() const
bool isPendingLoc() const
LocInfo getLocInfo() const
bool isUpperBitsInLoc() const
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP, bool IsCustom=false)
bool needsCustom() const
bool isMemLoc() const
static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP)
void convertToReg(unsigned RegNo)
unsigned getExtraInfo() const
bool isExtInLoc() const
int64_t getLocMemOffset() const
unsigned getValNo() const
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP)
void convertToMem(int64_t Offset)
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Machine Value Type.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
size_t size() const
Definition: SmallVector.h:91
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:577
void swap(SmallVectorImpl &RHS)
Definition: SmallVector.h:972
void push_back(const T &Elt)
Definition: SmallVector.h:416
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:456
bool CCCustomFn(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
CCCustomFn - This function assigns a location for Val, possibly updating all args to reflect changes ...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:155
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
Definition: MathExtras.h:338
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Describes a register that needs to be forwarded from the prologue to a musttail call.
ForwardedRegister(Register VReg, MCPhysReg PReg, MVT VT)