Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
X86CallingConv.cpp File Reference
#include "X86CallingConv.h"
#include "X86Subtarget.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/IR/Module.h"
#include "X86GenCallingConv.inc"

Go to the source code of this file.

Functions

static bool CC_X86_32_RegCall_Assign2Regs (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 When regcall calling convention compiled to 32 bit arch, special treatment is required for 64 bit masks.
static ArrayRef< MCPhysRegCC_X86_VectorCallGetSSEs (const MVT &ValVT)
static ArrayRef< MCPhysRegCC_X86_64_VectorCallGetGPRs ()
static bool CC_X86_VectorCallAssignRegister (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool CC_X86_64_VectorCall (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 Vectorcall calling convention has special handling for vector types or HVA for 64 bit arch.
static bool CC_X86_32_VectorCall (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 Vectorcall calling convention has special handling for vector types or HVA for 32 bit arch.
static bool CC_X86_AnyReg_Error (unsigned &, MVT &, MVT &, CCValAssign::LocInfo &, ISD::ArgFlagsTy &, CCState &)
static bool CC_X86_32_MCUInReg (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool CC_X86_Intr (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 X86 interrupt handlers can only take one or two stack arguments, but if there are two arguments, they are in the opposite order from the standard convention.
static bool CC_X86_64_Pointer (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool CC_X86_64_I128 (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 Special handling for i128: Either allocate the value to two consecutive i64 registers, or to the stack.
static bool CC_X86_32_I128_FP128 (unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
 Special handling for i128 and fp128: on x86-32, i128 and fp128 get legalized as four i32s, but fp128 must be passed on the stack with 16-byte alignment.

Function Documentation

◆ CC_X86_32_I128_FP128()

bool CC_X86_32_I128_FP128 ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

Special handling for i128 and fp128: on x86-32, i128 and fp128 get legalized as four i32s, but fp128 must be passed on the stack with 16-byte alignment.

Technically only fp128 has a specified ABI, but it makes sense to handle i128 the same until we hear differently.

Definition at line 381 of file X86CallingConv.cpp.

References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::CCValAssign::getPending(), llvm::ISD::ArgFlagsTy::isInConsecutiveRegsLast(), llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().

◆ CC_X86_32_MCUInReg()

◆ CC_X86_32_RegCall_Assign2Regs()

bool CC_X86_32_RegCall_Assign2Regs ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

When regcall calling convention compiled to 32 bit arch, special treatment is required for 64 bit masks.

The value should be assigned to two GPRs.

Returns
true if registers were allocated and false otherwise.

Definition at line 26 of file X86CallingConv.cpp.

References assert(), llvm::CCValAssign::getCustomReg(), I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, and llvm::SmallVectorTemplateCommon< T, typename >::size().

◆ CC_X86_32_VectorCall()

bool CC_X86_32_VectorCall ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

Vectorcall calling convention has special handling for vector types or HVA for 32 bit arch.

For HVAs actual XMM registers are allocated on the second pass. For vector types, actual XMM registers are allocated on the first pass.

Returns
true if registers were allocated and false otherwise.

Definition at line 188 of file X86CallingConv.cpp.

References CC_X86_VectorCallAssignRegister(), CC_X86_VectorCallGetSSEs(), llvm::CCValAssign::getReg(), llvm::MVT::getSizeInBits(), llvm::CCValAssign::Indirect, llvm::MVT::isFloatingPoint(), llvm::ISD::ArgFlagsTy::isHva(), llvm::ISD::ArgFlagsTy::isSecArgPass(), llvm::MVT::isVector(), Reg, and llvm::ISD::ArgFlagsTy::setInReg().

◆ CC_X86_64_I128()

bool CC_X86_64_I128 ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

Special handling for i128: Either allocate the value to two consecutive i64 registers, or to the stack.

Do not partially allocate in registers, and do not reserve any registers when allocating to the stack.

Definition at line 346 of file X86CallingConv.cpp.

References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::ArrayRef< T >::empty(), llvm::CCValAssign::getPending(), llvm::ISD::ArgFlagsTy::isInConsecutiveRegsLast(), llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().

◆ CC_X86_64_Pointer()

bool CC_X86_64_Pointer ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

Definition at line 333 of file X86CallingConv.cpp.

References llvm::CCValAssign::ZExt.

◆ CC_X86_64_VectorCall()

bool CC_X86_64_VectorCall ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

Vectorcall calling convention has special handling for vector types or HVA for 64 bit arch.

For HVAs shadow registers might be allocated on the first pass and actual XMM registers are allocated on the second pass. For vector types, actual XMM registers are allocated on the first pass.

Returns
true if registers were allocated and false otherwise.

Definition at line 128 of file X86CallingConv.cpp.

References CC_X86_64_VectorCallGetGPRs(), CC_X86_VectorCallAssignRegister(), CC_X86_VectorCallGetSSEs(), llvm::CCValAssign::getReg(), llvm::MVT::getSizeInBits(), llvm::MVT::isFloatingPoint(), llvm::ISD::ArgFlagsTy::isHva(), llvm::ISD::ArgFlagsTy::isHvaStart(), llvm::ISD::ArgFlagsTy::isSecArgPass(), llvm::MVT::isVector(), Reg, and TRI.

◆ CC_X86_64_VectorCallGetGPRs()

ArrayRef< MCPhysReg > CC_X86_64_VectorCallGetGPRs ( )
static

Definition at line 85 of file X86CallingConv.cpp.

Referenced by CC_X86_64_VectorCall().

◆ CC_X86_AnyReg_Error()

bool CC_X86_AnyReg_Error ( unsigned & ,
MVT & ,
MVT & ,
CCValAssign::LocInfo & ,
ISD::ArgFlagsTy & ,
CCState &  )
static

Definition at line 228 of file X86CallingConv.cpp.

References llvm_unreachable.

◆ CC_X86_Intr()

bool CC_X86_Intr ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

X86 interrupt handlers can only take one or two stack arguments, but if there are two arguments, they are in the opposite order from the standard convention.

Therefore, we have to look at the argument count up front before allocating stack for each argument.

Definition at line 297 of file X86CallingConv.cpp.

References llvm::Function::arg_size(), llvm::MachineFunction::getFunction(), llvm::CCValAssign::getMem(), llvm::MachineFunction::getSubtarget(), is64Bit(), llvm::Offset, and llvm::report_fatal_error().

◆ CC_X86_VectorCallAssignRegister()

bool CC_X86_VectorCallAssignRegister ( unsigned & ValNo,
MVT & ValVT,
MVT & LocVT,
CCValAssign::LocInfo & LocInfo,
ISD::ArgFlagsTy & ArgFlags,
CCState & State )
static

◆ CC_X86_VectorCallGetSSEs()

ArrayRef< MCPhysReg > CC_X86_VectorCallGetSSEs ( const MVT & ValVT)
static