LLVM  13.0.0git
ExecutionEngineBindings.cpp
Go to the documentation of this file.
1 //===-- ExecutionEngineBindings.cpp - C bindings for EEs ------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the C bindings for the ExecutionEngine library.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm-c/ExecutionEngine.h"
18 #include "llvm/IR/DerivedTypes.h"
19 #include "llvm/IR/Module.h"
23 #include <cstring>
24 
25 using namespace llvm;
26 
27 #define DEBUG_TYPE "jit"
28 
29 // Wrapping the C bindings types.
31 
32 
34  return
35  reinterpret_cast<LLVMTargetMachineRef>(const_cast<TargetMachine*>(P));
36 }
37 
38 /*===-- Operations on generic values --------------------------------------===*/
39 
41  unsigned long long N,
42  LLVMBool IsSigned) {
43  GenericValue *GenVal = new GenericValue();
44  GenVal->IntVal = APInt(unwrap<IntegerType>(Ty)->getBitWidth(), N, IsSigned);
45  return wrap(GenVal);
46 }
47 
49  GenericValue *GenVal = new GenericValue();
50  GenVal->PointerVal = P;
51  return wrap(GenVal);
52 }
53 
55  GenericValue *GenVal = new GenericValue();
56  switch (unwrap(TyRef)->getTypeID()) {
57  case Type::FloatTyID:
58  GenVal->FloatVal = N;
59  break;
60  case Type::DoubleTyID:
61  GenVal->DoubleVal = N;
62  break;
63  default:
64  llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
65  }
66  return wrap(GenVal);
67 }
68 
70  return unwrap(GenValRef)->IntVal.getBitWidth();
71 }
72 
73 unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenValRef,
74  LLVMBool IsSigned) {
75  GenericValue *GenVal = unwrap(GenValRef);
76  if (IsSigned)
77  return GenVal->IntVal.getSExtValue();
78  else
79  return GenVal->IntVal.getZExtValue();
80 }
81 
83  return unwrap(GenVal)->PointerVal;
84 }
85 
87  switch (unwrap(TyRef)->getTypeID()) {
88  case Type::FloatTyID:
89  return unwrap(GenVal)->FloatVal;
90  case Type::DoubleTyID:
91  return unwrap(GenVal)->DoubleVal;
92  default:
93  llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
94  }
95 }
96 
98  delete unwrap(GenVal);
99 }
100 
101 /*===-- Operations on execution engines -----------------------------------===*/
102 
104  LLVMModuleRef M,
105  char **OutError) {
106  std::string Error;
107  EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
108  builder.setEngineKind(EngineKind::Either)
109  .setErrorStr(&Error);
110  if (ExecutionEngine *EE = builder.create()){
111  *OutEE = wrap(EE);
112  return 0;
113  }
114  *OutError = strdup(Error.c_str());
115  return 1;
116 }
117 
119  LLVMModuleRef M,
120  char **OutError) {
121  std::string Error;
122  EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
123  builder.setEngineKind(EngineKind::Interpreter)
124  .setErrorStr(&Error);
125  if (ExecutionEngine *Interp = builder.create()) {
126  *OutInterp = wrap(Interp);
127  return 0;
128  }
129  *OutError = strdup(Error.c_str());
130  return 1;
131 }
132 
134  LLVMModuleRef M,
135  unsigned OptLevel,
136  char **OutError) {
137  std::string Error;
138  EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
139  builder.setEngineKind(EngineKind::JIT)
140  .setErrorStr(&Error)
141  .setOptLevel((CodeGenOpt::Level)OptLevel);
142  if (ExecutionEngine *JIT = builder.create()) {
143  *OutJIT = wrap(JIT);
144  return 0;
145  }
146  *OutError = strdup(Error.c_str());
147  return 1;
148 }
149 
151  size_t SizeOfPassedOptions) {
153  memset(&options, 0, sizeof(options)); // Most fields are zero by default.
154  options.CodeModel = LLVMCodeModelJITDefault;
155 
156  memcpy(PassedOptions, &options,
157  std::min(sizeof(options), SizeOfPassedOptions));
158 }
159 
162  LLVMMCJITCompilerOptions *PassedOptions, size_t SizeOfPassedOptions,
163  char **OutError) {
165  // If the user passed a larger sized options struct, then they were compiled
166  // against a newer LLVM. Tell them that something is wrong.
167  if (SizeOfPassedOptions > sizeof(options)) {
168  *OutError = strdup(
169  "Refusing to use options struct that is larger than my own; assuming "
170  "LLVM library mismatch.");
171  return 1;
172  }
173 
174  // Defend against the user having an old version of the API by ensuring that
175  // any fields they didn't see are cleared. We must defend against fields being
176  // set to the bitwise equivalent of zero, and assume that this means "do the
177  // default" as if that option hadn't been available.
179  memcpy(&options, PassedOptions, SizeOfPassedOptions);
180 
181  TargetOptions targetOptions;
182  targetOptions.EnableFastISel = options.EnableFastISel;
183  std::unique_ptr<Module> Mod(unwrap(M));
184 
185  if (Mod)
186  // Set function attribute "frame-pointer" based on
187  // NoFramePointerElim.
188  for (auto &F : *Mod) {
189  auto Attrs = F.getAttributes();
190  StringRef Value = options.NoFramePointerElim ? "all" : "none";
192  "frame-pointer", Value);
193  F.setAttributes(Attrs);
194  }
195 
196  std::string Error;
198  builder.setEngineKind(EngineKind::JIT)
199  .setErrorStr(&Error)
200  .setOptLevel((CodeGenOpt::Level)options.OptLevel)
201  .setTargetOptions(targetOptions);
202  bool JIT;
203  if (Optional<CodeModel::Model> CM = unwrap(options.CodeModel, JIT))
204  builder.setCodeModel(*CM);
205  if (options.MCJMM)
206  builder.setMCJITMemoryManager(
207  std::unique_ptr<RTDyldMemoryManager>(unwrap(options.MCJMM)));
208  if (ExecutionEngine *JIT = builder.create()) {
209  *OutJIT = wrap(JIT);
210  return 0;
211  }
212  *OutError = strdup(Error.c_str());
213  return 1;
214 }
215 
217  delete unwrap(EE);
218 }
219 
221  unwrap(EE)->finalizeObject();
222  unwrap(EE)->runStaticConstructorsDestructors(false);
223 }
224 
226  unwrap(EE)->finalizeObject();
227  unwrap(EE)->runStaticConstructorsDestructors(true);
228 }
229 
231  unsigned ArgC, const char * const *ArgV,
232  const char * const *EnvP) {
233  unwrap(EE)->finalizeObject();
234 
235  std::vector<std::string> ArgVec(ArgV, ArgV + ArgC);
236  return unwrap(EE)->runFunctionAsMain(unwrap<Function>(F), ArgVec, EnvP);
237 }
238 
240  unsigned NumArgs,
242  unwrap(EE)->finalizeObject();
243 
244  std::vector<GenericValue> ArgVec;
245  ArgVec.reserve(NumArgs);
246  for (unsigned I = 0; I != NumArgs; ++I)
247  ArgVec.push_back(*unwrap(Args[I]));
248 
249  GenericValue *Result = new GenericValue();
250  *Result = unwrap(EE)->runFunction(unwrap<Function>(F), ArgVec);
251  return wrap(Result);
252 }
253 
255 }
256 
258  unwrap(EE)->addModule(std::unique_ptr<Module>(unwrap(M)));
259 }
260 
262  LLVMModuleRef *OutMod, char **OutError) {
263  Module *Mod = unwrap(M);
264  unwrap(EE)->removeModule(Mod);
265  *OutMod = wrap(Mod);
266  return 0;
267 }
268 
270  LLVMValueRef *OutFn) {
271  if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) {
272  *OutFn = wrap(F);
273  return 0;
274  }
275  return 1;
276 }
277 
279  LLVMValueRef Fn) {
280  return nullptr;
281 }
282 
284  return wrap(&unwrap(EE)->getDataLayout());
285 }
286 
289  return wrap(unwrap(EE)->getTargetMachine());
290 }
291 
293  void* Addr) {
294  unwrap(EE)->addGlobalMapping(unwrap<GlobalValue>(Global), Addr);
295 }
296 
298  unwrap(EE)->finalizeObject();
299 
300  return unwrap(EE)->getPointerToGlobal(unwrap<GlobalValue>(Global));
301 }
302 
304  return unwrap(EE)->getGlobalValueAddress(Name);
305 }
306 
308  return unwrap(EE)->getFunctionAddress(Name);
309 }
310 
312  char **OutError) {
313  assert(OutError && "OutError must be non-null");
314  auto *ExecEngine = unwrap(EE);
315  if (ExecEngine->hasError()) {
316  *OutError = strdup(ExecEngine->getErrorMessage().c_str());
317  ExecEngine->clearErrorMessage();
318  return true;
319  }
320  return false;
321 }
322 
323 /*===-- Operations on memory managers -------------------------------------===*/
324 
325 namespace {
326 
327 struct SimpleBindingMMFunctions {
332 };
333 
334 class SimpleBindingMemoryManager : public RTDyldMemoryManager {
335 public:
336  SimpleBindingMemoryManager(const SimpleBindingMMFunctions& Functions,
337  void *Opaque);
338  ~SimpleBindingMemoryManager() override;
339 
340  uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
341  unsigned SectionID,
342  StringRef SectionName) override;
343 
344  uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
345  unsigned SectionID, StringRef SectionName,
346  bool isReadOnly) override;
347 
348  bool finalizeMemory(std::string *ErrMsg) override;
349 
350 private:
351  SimpleBindingMMFunctions Functions;
352  void *Opaque;
353 };
354 
355 SimpleBindingMemoryManager::SimpleBindingMemoryManager(
356  const SimpleBindingMMFunctions& Functions,
357  void *Opaque)
358  : Functions(Functions), Opaque(Opaque) {
359  assert(Functions.AllocateCodeSection &&
360  "No AllocateCodeSection function provided!");
361  assert(Functions.AllocateDataSection &&
362  "No AllocateDataSection function provided!");
363  assert(Functions.FinalizeMemory &&
364  "No FinalizeMemory function provided!");
365  assert(Functions.Destroy &&
366  "No Destroy function provided!");
367 }
368 
369 SimpleBindingMemoryManager::~SimpleBindingMemoryManager() {
370  Functions.Destroy(Opaque);
371 }
372 
373 uint8_t *SimpleBindingMemoryManager::allocateCodeSection(
374  uintptr_t Size, unsigned Alignment, unsigned SectionID,
376  return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
377  SectionName.str().c_str());
378 }
379 
380 uint8_t *SimpleBindingMemoryManager::allocateDataSection(
381  uintptr_t Size, unsigned Alignment, unsigned SectionID,
382  StringRef SectionName, bool isReadOnly) {
383  return Functions.AllocateDataSection(Opaque, Size, Alignment, SectionID,
384  SectionName.str().c_str(),
385  isReadOnly);
386 }
387 
388 bool SimpleBindingMemoryManager::finalizeMemory(std::string *ErrMsg) {
389  char *errMsgCString = nullptr;
390  bool result = Functions.FinalizeMemory(Opaque, &errMsgCString);
391  assert((result || !errMsgCString) &&
392  "Did not expect an error message if FinalizeMemory succeeded");
393  if (errMsgCString) {
394  if (ErrMsg)
395  *ErrMsg = errMsgCString;
396  free(errMsgCString);
397  }
398  return result;
399 }
400 
401 } // anonymous namespace
402 
404  void *Opaque,
409 
410  if (!AllocateCodeSection || !AllocateDataSection || !FinalizeMemory ||
411  !Destroy)
412  return nullptr;
413 
414  SimpleBindingMMFunctions functions;
415  functions.AllocateCodeSection = AllocateCodeSection;
416  functions.AllocateDataSection = AllocateDataSection;
417  functions.FinalizeMemory = FinalizeMemory;
418  functions.Destroy = Destroy;
419  return wrap(new SimpleBindingMemoryManager(functions, Opaque));
420 }
421 
423  delete unwrap(MM);
424 }
425 
426 /*===-- JIT Event Listener functions -------------------------------------===*/
427 
428 
429 #if !LLVM_USE_INTEL_JITEVENTS
431 {
432  return nullptr;
433 }
434 #endif
435 
436 #if !LLVM_USE_OPROFILE
438 {
439  return nullptr;
440 }
441 #endif
442 
443 #if !LLVM_USE_PERF
445 {
446  return nullptr;
447 }
448 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
LLVMInitializeMCJITCompilerOptions
void LLVMInitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions *PassedOptions, size_t SizeOfPassedOptions)
Definition: ExecutionEngineBindings.cpp:150
functions
amdgpu propagate attributes Late propagate attributes from kernels to functions
Definition: AMDGPUPropagateAttributes.cpp:199
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition: Type.h:59
wrap
static LLVMTargetMachineRef wrap(const TargetMachine *P)
Definition: ExecutionEngineBindings.cpp:33
LLVMFindFunction
LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, LLVMValueRef *OutFn)
Definition: ExecutionEngineBindings.cpp:269
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition: Type.h:60
llvm
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
LLVMDisposeGenericValue
void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal)
Definition: ExecutionEngineBindings.cpp:97
LLVMMemoryManagerAllocateCodeSectionCallback
uint8_t *(* LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName)
Definition: ExecutionEngine.h:159
llvm::TargetOptions
Definition: TargetOptions.h:119
llvm::Function
Definition: Function.h:61
LLVMCreateGenericValueOfFloat
LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef TyRef, double N)
Definition: ExecutionEngineBindings.cpp:54
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
ExecutionEngine.h
LLVMExecutionEngineRef
struct LLVMOpaqueExecutionEngine * LLVMExecutionEngineRef
Definition: ExecutionEngine.h:40
llvm::GenericValue::PointerVal
PointerTy PointerVal
Definition: GenericValue.h:31
llvm::APInt::getSExtValue
int64_t getSExtValue() const
Get sign extended value.
Definition: APInt.h:1643
ErrorHandling.h
builder
assume builder
Definition: AssumeBundleBuilder.cpp:650
LLVMCreateJITCompilerForModule
LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M, unsigned OptLevel, char **OutError)
Definition: ExecutionEngineBindings.cpp:133
LLVMRunStaticConstructors
void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE)
Definition: ExecutionEngineBindings.cpp:220
Module.h
llvm::EngineBuilder
Builder class for ExecutionEngines.
Definition: ExecutionEngine.h:535
LLVMGenericValueToFloat
double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal)
Definition: ExecutionEngineBindings.cpp:86
LLVMMCJITMemoryManagerRef
struct LLVMOpaqueMCJITMemoryManager * LLVMMCJITMemoryManagerRef
Definition: ExecutionEngine.h:41
llvm::Optional< CodeModel::Model >
LLVMRecompileAndRelinkFunction
void * LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn)
Definition: ExecutionEngineBindings.cpp:278
getBitWidth
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Definition: ValueTracking.cpp:88
LLVMAddGlobalMapping
void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global, void *Addr)
Definition: ExecutionEngineBindings.cpp:292
F
#define F(x, y, z)
Definition: MD5.cpp:56
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition: CBindingWrapping.h:19
LLVMTargetDataRef
struct LLVMOpaqueTargetData * LLVMTargetDataRef
Definition: DataLayout.h:40
result
It looks like we only need to define PPCfmarto for these because according to these instructions perform RTO on fma s result
Definition: README_P9.txt:256
llvm::RTDyldMemoryManager
Definition: RTDyldMemoryManager.h:60
LLVMGenericValueToPointer
void * LLVMGenericValueToPointer(LLVMGenericValueRef GenVal)
Definition: ExecutionEngineBindings.cpp:82
llvm::GenericValue
Definition: GenericValue.h:23
llvm::GenericValue::IntVal
APInt IntVal
Definition: GenericValue.h:35
LLVMCreateOProfileJITEventListener
LLVMJITEventListenerRef LLVMCreateOProfileJITEventListener(void)
Definition: ExecutionEngineBindings.cpp:437
LLVMGetFunctionAddress
uint64_t LLVMGetFunctionAddress(LLVMExecutionEngineRef EE, const char *Name)
Definition: ExecutionEngineBindings.cpp:307
LLVMCreateGenericValueOfPointer
LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P)
Definition: ExecutionEngineBindings.cpp:48
LLVMCreateSimpleMCJITMemoryManager
LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager(void *Opaque, LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory, LLVMMemoryManagerDestroyCallback Destroy)
Create a simple custom MCJIT memory manager.
Definition: ExecutionEngineBindings.cpp:403
LLVMCodeModelJITDefault
@ LLVMCodeModelJITDefault
Definition: TargetMachine.h:50
LLVMRunFunctionAsMain
int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned ArgC, const char *const *ArgV, const char *const *EnvP)
Definition: ExecutionEngineBindings.cpp:230
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:244
llvm::APInt::getZExtValue
uint64_t getZExtValue() const
Get zero extended value.
Definition: APInt.h:1631
LLVMTypeRef
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
Definition: Types.h:68
GenericValue.h
LLVMCreateIntelJITEventListener
LLVMJITEventListenerRef LLVMCreateIntelJITEventListener(void)
Definition: ExecutionEngineBindings.cpp:430
LLVMCreatePerfJITEventListener
LLVMJITEventListenerRef LLVMCreatePerfJITEventListener(void)
Definition: ExecutionEngineBindings.cpp:444
CodeGenCWrappers.h
LLVMCreateGenericValueOfInt
LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty, unsigned long long N, LLVMBool IsSigned)
Definition: ExecutionEngineBindings.cpp:40
LLVMMemoryManagerFinalizeMemoryCallback
LLVMBool(* LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg)
Definition: ExecutionEngine.h:165
LLVMMCJITCompilerOptions
Definition: ExecutionEngine.h:43
LLVMDisposeMCJITMemoryManager
void LLVMDisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef MM)
Definition: ExecutionEngineBindings.cpp:422
LLVMDisposeExecutionEngine
void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE)
Definition: ExecutionEngineBindings.cpp:216
LLVMCreateExecutionEngineForModule
LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE, LLVMModuleRef M, char **OutError)
Definition: ExecutionEngineBindings.cpp:103
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:525
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
LLVMTargetMachineRef
typedefLLVM_C_EXTERN_C_BEGIN struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
Definition: TargetMachine.h:28
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
I
#define I(x, y, z)
Definition: MD5.cpp:59
LLVMGetExecutionEngineTargetData
LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE)
Definition: ExecutionEngineBindings.cpp:283
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
LLVMGetPointerToGlobal
void * LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global)
Definition: ExecutionEngineBindings.cpp:297
LLVMMemoryManagerAllocateDataSectionCallback
uint8_t *(* LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName, LLVMBool IsReadOnly)
Definition: ExecutionEngine.h:162
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::EngineKind::Either
const static Kind Either
Definition: ExecutionEngine.h:528
llvm::TargetOptions::EnableFastISel
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
Definition: TargetOptions.h:222
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:239
TargetOptions.h
llvm::min
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:357
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::GenericValue::DoubleVal
double DoubleVal
Definition: GenericValue.h:29
LLVMAddModule
void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M)
Definition: ExecutionEngineBindings.cpp:257
RTDyldMemoryManager.h
LLVMRunStaticDestructors
void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE)
Definition: ExecutionEngineBindings.cpp:225
llvm::GenericValue::FloatVal
float FloatVal
Definition: GenericValue.h:30
llvm::ExecutionEngine
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
Definition: ExecutionEngine.h:100
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
LLVMBool
int LLVMBool
Definition: Types.h:28
LLVMGenericValueToInt
unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenValRef, LLVMBool IsSigned)
Definition: ExecutionEngineBindings.cpp:73
llvm::SectionName
Definition: DWARFSection.h:21
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
options
The object format emitted by the WebAssembly backed is documented see the home and packaging for producing WebAssembly applications that can run in browsers and other environments wasi sdk provides a more minimal C C SDK based on llvm and a libc based on for producing WebAssemmbly applictions that use the WASI ABI Rust provides WebAssembly support integrated into Cargo There are two main options
Definition: README.txt:24
LLVMCreateInterpreterForModule
LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp, LLVMModuleRef M, char **OutError)
Definition: ExecutionEngineBindings.cpp:118
getTypeID
static char getTypeID(Type *Ty)
Definition: ExternalFunctions.cpp:73
llvm::Function::addAttribute
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
Definition: Function.cpp:527
ExecutionEngine.h
LLVMExecutionEngineGetErrMsg
LLVMBool LLVMExecutionEngineGetErrMsg(LLVMExecutionEngineRef EE, char **OutError)
Returns true on error, false on success.
Definition: ExecutionEngineBindings.cpp:311
LLVMRunFunction
LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned NumArgs, LLVMGenericValueRef *Args)
Definition: ExecutionEngineBindings.cpp:239
LLVMCreateMCJITCompilerForModule
LLVMBool LLVMCreateMCJITCompilerForModule(LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M, LLVMMCJITCompilerOptions *PassedOptions, size_t SizeOfPassedOptions, char **OutError)
Create an MCJIT execution engine for a module, with the given options.
Definition: ExecutionEngineBindings.cpp:160
LLVMGenericValueIntWidth
unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef)
Definition: ExecutionEngineBindings.cpp:69
llvm::AttributeList::FunctionIndex
@ FunctionIndex
Definition: Attributes.h:389
LLVMGetExecutionEngineTargetMachine
LLVMTargetMachineRef LLVMGetExecutionEngineTargetMachine(LLVMExecutionEngineRef EE)
Definition: ExecutionEngineBindings.cpp:288
LLVMFreeMachineCodeForFunction
void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F)
Definition: ExecutionEngineBindings.cpp:254
LLVMGetGlobalValueAddress
uint64_t LLVMGetGlobalValueAddress(LLVMExecutionEngineRef EE, const char *Name)
Definition: ExecutionEngineBindings.cpp:303
N
#define N
LLVMValueRef
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
Definition: Types.h:75
DerivedTypes.h
LLVMMemoryManagerDestroyCallback
void(* LLVMMemoryManagerDestroyCallback)(void *Opaque)
Definition: ExecutionEngine.h:167
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::EngineKind::Interpreter
@ Interpreter
Definition: ExecutionEngine.h:526
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
LLVMRemoveModule
LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M, LLVMModuleRef *OutMod, char **OutError)
Definition: ExecutionEngineBindings.cpp:261
LLVMJITEventListenerRef
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition: Types.h:163
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
JITEventListener.h
LLVMModuleRef
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition: Types.h:61
LLVMGenericValueRef
struct LLVMOpaqueGenericValue * LLVMGenericValueRef
Definition: ExecutionEngine.h:39