2
0

CallingConv.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //===-- llvm/CallingConv.h - LLVM Calling Conventions -----------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines LLVM's set of calling conventions.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_IR_CALLINGCONV_H
  14. #define LLVM_IR_CALLINGCONV_H
  15. namespace llvm {
  16. /// CallingConv Namespace - This namespace contains an enum with a value for
  17. /// the well-known calling conventions.
  18. ///
  19. namespace CallingConv {
  20. /// LLVM IR allows to use arbitrary numbers as calling convention identifiers.
  21. typedef unsigned ID;
  22. /// A set of enums which specify the assigned numeric values for known llvm
  23. /// calling conventions.
  24. /// @brief LLVM Calling Convention Representation
  25. enum {
  26. /// C - The default llvm calling convention, compatible with C. This
  27. /// convention is the only calling convention that supports varargs calls.
  28. /// As with typical C calling conventions, the callee/caller have to
  29. /// tolerate certain amounts of prototype mismatch.
  30. C = 0,
  31. // Generic LLVM calling conventions. None of these calling conventions
  32. // support varargs calls, and all assume that the caller and callee
  33. // prototype exactly match.
  34. /// Fast - This calling convention attempts to make calls as fast as
  35. /// possible (e.g. by passing things in registers).
  36. Fast = 8,
  37. // Cold - This calling convention attempts to make code in the caller as
  38. // efficient as possible under the assumption that the call is not commonly
  39. // executed. As such, these calls often preserve all registers so that the
  40. // call does not break any live ranges in the caller side.
  41. Cold = 9,
  42. // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
  43. GHC = 10,
  44. // HiPE - Calling convention used by the High-Performance Erlang Compiler
  45. // (HiPE).
  46. HiPE = 11,
  47. // WebKit JS - Calling convention for stack based JavaScript calls
  48. WebKit_JS = 12,
  49. // AnyReg - Calling convention for dynamic register based calls (e.g.
  50. // stackmap and patchpoint intrinsics).
  51. AnyReg = 13,
  52. // PreserveMost - Calling convention for runtime calls that preserves most
  53. // registers.
  54. PreserveMost = 14,
  55. // PreserveAll - Calling convention for runtime calls that preserves
  56. // (almost) all registers.
  57. PreserveAll = 15,
  58. // Target - This is the start of the target-specific calling conventions,
  59. // e.g. fastcall and thiscall on X86.
  60. FirstTargetCC = 64,
  61. /// X86_StdCall - stdcall is the calling conventions mostly used by the
  62. /// Win32 API. It is basically the same as the C convention with the
  63. /// difference in that the callee is responsible for popping the arguments
  64. /// from the stack.
  65. X86_StdCall = 64,
  66. /// X86_FastCall - 'fast' analog of X86_StdCall. Passes first two arguments
  67. /// in ECX:EDX registers, others - via stack. Callee is responsible for
  68. /// stack cleaning.
  69. X86_FastCall = 65,
  70. /// ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete,
  71. /// but still used on some targets).
  72. ARM_APCS = 66,
  73. /// ARM_AAPCS - ARM Architecture Procedure Calling Standard calling
  74. /// convention (aka EABI). Soft float variant.
  75. ARM_AAPCS = 67,
  76. /// ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
  77. ARM_AAPCS_VFP = 68,
  78. /// MSP430_INTR - Calling convention used for MSP430 interrupt routines.
  79. MSP430_INTR = 69,
  80. /// X86_ThisCall - Similar to X86_StdCall. Passes first argument in ECX,
  81. /// others via stack. Callee is responsible for stack cleaning. MSVC uses
  82. /// this by default for methods in its ABI.
  83. X86_ThisCall = 70,
  84. /// PTX_Kernel - Call to a PTX kernel.
  85. /// Passes all arguments in parameter space.
  86. PTX_Kernel = 71,
  87. /// PTX_Device - Call to a PTX device function.
  88. /// Passes all arguments in register or parameter space.
  89. PTX_Device = 72,
  90. /// SPIR_FUNC - Calling convention for SPIR non-kernel device functions.
  91. /// No lowering or expansion of arguments.
  92. /// Structures are passed as a pointer to a struct with the byval attribute.
  93. /// Functions can only call SPIR_FUNC and SPIR_KERNEL functions.
  94. /// Functions can only have zero or one return values.
  95. /// Variable arguments are not allowed, except for printf.
  96. /// How arguments/return values are lowered are not specified.
  97. /// Functions are only visible to the devices.
  98. SPIR_FUNC = 75,
  99. /// SPIR_KERNEL - Calling convention for SPIR kernel functions.
  100. /// Inherits the restrictions of SPIR_FUNC, except
  101. /// Cannot have non-void return values.
  102. /// Cannot have variable arguments.
  103. /// Can also be called by the host.
  104. /// Is externally visible.
  105. SPIR_KERNEL = 76,
  106. /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins
  107. Intel_OCL_BI = 77,
  108. /// \brief The C convention as specified in the x86-64 supplement to the
  109. /// System V ABI, used on most non-Windows systems.
  110. X86_64_SysV = 78,
  111. /// \brief The C convention as implemented on Windows/x86-64. This
  112. /// convention differs from the more common \c X86_64_SysV convention
  113. /// in a number of ways, most notably in that XMM registers used to pass
  114. /// arguments are shadowed by GPRs, and vice versa.
  115. X86_64_Win64 = 79,
  116. /// \brief MSVC calling convention that passes vectors and vector aggregates
  117. /// in SSE registers.
  118. X86_VectorCall = 80
  119. };
  120. } // End CallingConv namespace
  121. } // End llvm namespace
  122. #endif