Jlm
CallingConvention.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2026 HÃ¥vard Krogstie <krogstie.havard@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_IR_CALLINGCONVENTION_HPP
7 #define JLM_LLVM_IR_CALLINGCONVENTION_HPP
8 
9 #include <llvm/IR/CallingConv.h>
10 
11 namespace jlm::llvm
12 {
13 
21 {
22  // The default llvm calling convention, compatible with C.
23  // Only convention to support varargs. Supports some prototype mismatch.
24  C,
25 
26  // Default is defined as an alias for the C calling convention
27  Default = C,
28 
29  // The following are generic LLVM calling conventions. None of these support varargs calls,
30  // and all assume that the caller and callee prototype exactly match.
31 
32  // Attempts to make calls as fast as possible (e.g. by passing things in
33  // registers).
34  Fast,
35 
36  // Attempts to make code in the caller as efficient as possible under the
37  // assumption that the call is not commonly executed. As such, these calls
38  // often preserve all registers so that the call does not break any live
39  // ranges in the caller side.
40  Cold,
41 
42  // Attemps to make calls as fast as possible while guaranteeing that tail
43  // call optimization can always be performed.
44  Tail,
45 };
46 
53 [[nodiscard]] jlm::llvm::CallingConvention
54 convertCallingConventionToJlm(::llvm::CallingConv::ID cc);
55 
62 [[nodiscard]] ::llvm::CallingConv::ID
64 
65 }
66 
67 #endif // JLM_LLVM_IR_CALLINGCONVENTION_HPP
Global memory state passed between functions.
jlm::llvm::CallingConvention convertCallingConventionToJlm(::llvm::CallingConv::ID cc)
::llvm::CallingConv::ID convertCallingConventionToLlvm(jlm::llvm::CallingConvention cc)