Jlm
CallingConvention.cpp
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 
8 #include <jlm/util/common.hpp>
9 
10 #include <llvm/IR/CallingConv.h>
11 
12 namespace jlm::llvm
13 {
14 
15 static const util::BijectiveMap<::llvm::CallingConv::ID, CallingConvention> &
17 {
19  { ::llvm::CallingConv::C, CallingConvention::C },
20  { ::llvm::CallingConv::Fast, CallingConvention::Fast },
21  { ::llvm::CallingConv::Cold, CallingConvention::Cold },
22  { ::llvm::CallingConv::Tail, CallingConvention::Tail },
23  };
24  return map;
25 }
26 
28 convertCallingConventionToJlm(::llvm::CallingConv::ID cc)
29 {
30  const auto & map = getCallingConventionMap();
31  // LookupKey throws if the calling convention could not be found
32  return map.LookupKey(cc);
33 }
34 
35 ::llvm::CallingConv::ID
37 {
38  const auto & map = getCallingConventionMap();
39  // LookupValue throws if the calling convention could not be found
40  return map.LookupValue(cc);
41 }
42 
43 }
Global memory state passed between functions.
jlm::llvm::CallingConvention convertCallingConventionToJlm(::llvm::CallingConv::ID cc)
::llvm::CallingConv::ID convertCallingConventionToLlvm(jlm::llvm::CallingConvention cc)
static const util::BijectiveMap<::llvm::CallingConv::ID, CallingConvention > & getCallingConventionMap()