| Index: src/IceTargetLoweringX8664Traits.h
|
| diff --git a/src/IceTargetLoweringX8664Traits.h b/src/IceTargetLoweringX8664Traits.h
|
| index b206817eea4a413744963eade01f362ba788425d..5df51f5a5bd000633b98022cb9bee1230809a4dc 100644
|
| --- a/src/IceTargetLoweringX8664Traits.h
|
| +++ b/src/IceTargetLoweringX8664Traits.h
|
| @@ -720,10 +720,47 @@ public:
|
|
|
| static int32_t getRdxOrDie() { return RegisterSet::Reg_rdx; }
|
|
|
| + // x86-64 calling convention:
|
| + //
|
| + // * The first eight arguments of vector/fp type, regardless of their
|
| + // position relative to the other arguments in the argument list, are placed
|
| + // in registers %xmm0 - %xmm7.
|
| + //
|
| + // * The first six arguments of integer types, regardless of their position
|
| + // relative to the other arguments in the argument list, are placed in
|
| + // registers %rdi, %rsi, %rdx, %rcx, %r8, and %r9.
|
| + //
|
| + // This intends to match the section "Function Calling Sequence" of the
|
| + // document "System V Application Binary Interface."
|
| +
|
| /// The maximum number of arguments to pass in XMM registers
|
| static const uint32_t X86_MAX_XMM_ARGS = 8;
|
| /// The maximum number of arguments to pass in GPR registers
|
| static const uint32_t X86_MAX_GPR_ARGS = 6;
|
| + /// Whether scalar floating point arguments are passed in XMM registers
|
| + static const bool X86_PASS_SCALAR_FP_IN_XMM = true;
|
| + /// Get the register for a given argument slot in the XMM registers.
|
| + static inline int32_t getRegisterForXmmArgNum(uint32_t ArgNum) {
|
| + if (ArgNum >= X86_MAX_XMM_ARGS) {
|
| + return Variable::NoRegister;
|
| + }
|
| + return static_cast<int32_t>(RegisterSet::Reg_xmm0 + ArgNum);
|
| + }
|
| + /// Get the register for a given argument slot in the GPRs.
|
| + static inline int32_t getRegisterForGprArgNum(Type Ty, uint32_t ArgNum) {
|
| + if (ArgNum >= X86_MAX_GPR_ARGS) {
|
| + return Variable::NoRegister;
|
| + }
|
| + static const RegisterSet::AllRegisters GprForArgNum[] = {
|
| + RegisterSet::Reg_rdi, RegisterSet::Reg_rsi, RegisterSet::Reg_rdx,
|
| + RegisterSet::Reg_rcx, RegisterSet::Reg_r8, RegisterSet::Reg_r9,
|
| + };
|
| + static_assert(llvm::array_lengthof(GprForArgNum) == X86_MAX_GPR_ARGS,
|
| + "Mismatch between MAX_GPR_ARGS and GprForArgNum.");
|
| + assert(Ty == IceType_i64 || Ty == IceType_i32);
|
| + return static_cast<int32_t>(getGprForType(Ty, GprForArgNum[ArgNum]));
|
| + }
|
| +
|
| /// The number of bits in a byte
|
| static const uint32_t X86_CHAR_BIT = 8;
|
| /// Stack alignment. This is defined in IceTargetLoweringX8664.cpp because it
|
|
|