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