Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/IceTargetLoweringX8664Traits.h

Issue 1592033002: Merge lowerCall and lowerRet between x86 and x64 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changed to use Variable::NoRegister Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8664Traits.h - x86-64 traits -*- C++ -*-=// 1 //===- subzero/src/IceTargetLoweringX8664Traits.h - x86-64 traits -*- C++ -*-=//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 713 }
714 Str << "}\n"; 714 Str << "}\n";
715 } 715 }
716 } 716 }
717 } 717 }
718 718
719 static int32_t getRaxOrDie() { return RegisterSet::Reg_rax; } 719 static int32_t getRaxOrDie() { return RegisterSet::Reg_rax; }
720 720
721 static int32_t getRdxOrDie() { return RegisterSet::Reg_rdx; } 721 static int32_t getRdxOrDie() { return RegisterSet::Reg_rdx; }
722 722
723 // x86-64 calling convention:
724 //
725 // * The first eight arguments of vector/fp type, regardless of their
726 // position relative to the other arguments in the argument list, are placed
727 // in registers %xmm0 - %xmm7.
728 //
729 // * The first six arguments of integer types, regardless of their position
730 // relative to the other arguments in the argument list, are placed in
731 // registers %rdi, %rsi, %rdx, %rcx, %r8, and %r9.
732 //
733 // This intends to match the section "Function Calling Sequence" of the
734 // document "System V Application Binary Interface."
735
723 /// The maximum number of arguments to pass in XMM registers 736 /// The maximum number of arguments to pass in XMM registers
724 static const uint32_t X86_MAX_XMM_ARGS = 8; 737 static const uint32_t X86_MAX_XMM_ARGS = 8;
725 /// The maximum number of arguments to pass in GPR registers 738 /// The maximum number of arguments to pass in GPR registers
726 static const uint32_t X86_MAX_GPR_ARGS = 6; 739 static const uint32_t X86_MAX_GPR_ARGS = 6;
740 /// Whether scalar floating point arguments are passed in XMM registers
741 static const bool X86_PASS_SCALAR_FP_IN_XMM = true;
742 /// Get the register for a given argument slot in the XMM registers.
743 static inline int32_t getRegisterForXmmArgNum(uint32_t ArgNum) {
744 if (ArgNum >= X86_MAX_XMM_ARGS) {
745 return Variable::NoRegister;
746 }
747 return static_cast<int32_t>(RegisterSet::Reg_xmm0 + ArgNum);
748 }
749 /// Get the register for a given argument slot in the GPRs.
750 static inline int32_t getRegisterForGprArgNum(Type Ty, uint32_t ArgNum) {
751 if (ArgNum >= X86_MAX_GPR_ARGS) {
752 return Variable::NoRegister;
753 }
754 static const RegisterSet::AllRegisters GprForArgNum[] = {
755 RegisterSet::Reg_rdi, RegisterSet::Reg_rsi, RegisterSet::Reg_rdx,
756 RegisterSet::Reg_rcx, RegisterSet::Reg_r8, RegisterSet::Reg_r9,
757 };
758 static_assert(llvm::array_lengthof(GprForArgNum) == X86_MAX_GPR_ARGS,
759 "Mismatch between MAX_GPR_ARGS and GprForArgNum.");
760 assert(Ty == IceType_i64 || Ty == IceType_i32);
761 return static_cast<int32_t>(getGprForType(Ty, GprForArgNum[ArgNum]));
762 }
763
727 /// The number of bits in a byte 764 /// The number of bits in a byte
728 static const uint32_t X86_CHAR_BIT = 8; 765 static const uint32_t X86_CHAR_BIT = 8;
729 /// Stack alignment. This is defined in IceTargetLoweringX8664.cpp because it 766 /// Stack alignment. This is defined in IceTargetLoweringX8664.cpp because it
730 /// is used as an argument to std::max(), and the default std::less<T> has an 767 /// is used as an argument to std::max(), and the default std::less<T> has an
731 /// operator(T const&, T const&) which requires this member to have an 768 /// operator(T const&, T const&) which requires this member to have an
732 /// address. 769 /// address.
733 static const uint32_t X86_STACK_ALIGNMENT_BYTES; 770 static const uint32_t X86_STACK_ALIGNMENT_BYTES;
734 /// Size of the return address on the stack 771 /// Size of the return address on the stack
735 static const uint32_t X86_RET_IP_SIZE_BYTES = 8; 772 static const uint32_t X86_RET_IP_SIZE_BYTES = 8;
736 /// The number of different NOP instructions 773 /// The number of different NOP instructions
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 const char *FldString; // s, l, or <blank> 1047 const char *FldString; // s, l, or <blank>
1011 } TypeAttributes[]; 1048 } TypeAttributes[];
1012 }; 1049 };
1013 1050
1014 using Traits = ::Ice::X8664::TargetX8664Traits; 1051 using Traits = ::Ice::X8664::TargetX8664Traits;
1015 } // end of namespace X8664 1052 } // end of namespace X8664
1016 1053
1017 } // end of namespace Ice 1054 } // end of namespace Ice
1018 1055
1019 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H 1056 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698