2 * mini-llvm-cpp.h: LLVM backend
5 * Zoltan Varga (vargaz@gmail.com)
7 * (C) 2009 Novell, Inc.
10 #ifndef __MONO_MINI_LLVM_CPP_H__
11 #define __MONO_MINI_LLVM_CPP_H__
15 #include "llvm-c/Core.h"
16 #include "llvm-c/ExecutionEngine.h"
21 * Keep in sync with the enum in utils/mono-memory-model.h.
24 LLVM_BARRIER_NONE = 0,
31 LLVM_ATOMICRMW_OP_XCHG = 0,
32 LLVM_ATOMICRMW_OP_ADD = 1,
35 typedef unsigned char * (AllocCodeMemoryCb) (LLVMValueRef function, int size);
36 typedef void (FunctionEmittedCb) (LLVMValueRef function, void *start, void *end);
37 typedef void (ExceptionTableCb) (void *data);
38 typedef char* (DlSymCb) (const char *name, void **symbol);
40 typedef void* MonoEERef;
43 mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, FunctionEmittedCb *emitted_cb, ExceptionTableCb *exception_cb, DlSymCb *dlsym_cb, LLVMExecutionEngineRef *ee);
46 mono_llvm_dispose_ee (MonoEERef *mono_ee);
49 mono_llvm_optimize_method (MonoEERef mono_ee, LLVMValueRef method);
52 mono_llvm_dump_value (LLVMValueRef value);
55 mono_llvm_build_alloca (LLVMBuilderRef builder, LLVMTypeRef Ty,
56 LLVMValueRef ArraySize,
57 int alignment, const char *Name);
60 mono_llvm_build_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
61 const char *Name, gboolean is_volatile, BarrierKind barrier);
64 mono_llvm_build_aligned_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
65 const char *Name, gboolean is_volatile, int alignment);
68 mono_llvm_build_store (LLVMBuilderRef builder, LLVMValueRef Val, LLVMValueRef PointerVal,
69 gboolean is_volatile, BarrierKind kind);
72 mono_llvm_build_aligned_store (LLVMBuilderRef builder, LLVMValueRef Val, LLVMValueRef PointerVal,
73 gboolean is_volatile, int alignment);
76 mono_llvm_build_atomic_rmw (LLVMBuilderRef builder, AtomicRMWOp op, LLVMValueRef ptr, LLVMValueRef val);
79 mono_llvm_build_fence (LLVMBuilderRef builder, BarrierKind kind);
82 mono_llvm_replace_uses_of (LLVMValueRef var, LLVMValueRef v);
85 mono_llvm_build_cmpxchg (LLVMBuilderRef builder, LLVMValueRef addr, LLVMValueRef comparand, LLVMValueRef value);
88 mono_llvm_set_must_tail (LLVMValueRef call_ins);
91 mono_llvm_create_constant_data_array (const uint8_t *data, int len);
94 mono_llvm_set_is_constant (LLVMValueRef global_var);
98 #endif /* __MONO_MINI_LLVM_CPP_H__ */