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