Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
6.4 KiB

  1. /*===-- llvm-c/ExecutionEngine.h - ExecutionEngine Lib C Iface --*- 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 header declares the C interface to libLLVMExecutionEngine.o, which *|
  11. |* implements various analyses of the LLVM IR. *|
  12. |* *|
  13. |* Many exotic languages can interoperate with C code but have a harder time *|
  14. |* with C++ due to name mangling. So in addition to C, this interface enables *|
  15. |* tools written in such languages. *|
  16. |* *|
  17. \*===----------------------------------------------------------------------===*/
  18. #ifndef LLVM_C_EXECUTIONENGINE_H
  19. #define LLVM_C_EXECUTIONENGINE_H
  20. #include "llvm-c/Core.h"
  21. #include "llvm-c/Target.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /**
  26. * @defgroup LLVMCExecutionEngine Execution Engine
  27. * @ingroup LLVMC
  28. *
  29. * @{
  30. */
  31. void LLVMLinkInJIT(void);
  32. void LLVMLinkInInterpreter(void);
  33. typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
  34. typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
  35. /*===-- Operations on generic values --------------------------------------===*/
  36. LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
  37. unsigned long long N,
  38. LLVMBool IsSigned);
  39. LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P);
  40. LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty, double N);
  41. unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef);
  42. unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal,
  43. LLVMBool IsSigned);
  44. void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal);
  45. double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal);
  46. void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal);
  47. /*===-- Operations on execution engines -----------------------------------===*/
  48. LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
  49. LLVMModuleRef M,
  50. char **OutError);
  51. LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
  52. LLVMModuleRef M,
  53. char **OutError);
  54. LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
  55. LLVMModuleRef M,
  56. unsigned OptLevel,
  57. char **OutError);
  58. /** Deprecated: Use LLVMCreateExecutionEngineForModule instead. */
  59. LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
  60. LLVMModuleProviderRef MP,
  61. char **OutError);
  62. /** Deprecated: Use LLVMCreateInterpreterForModule instead. */
  63. LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
  64. LLVMModuleProviderRef MP,
  65. char **OutError);
  66. /** Deprecated: Use LLVMCreateJITCompilerForModule instead. */
  67. LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
  68. LLVMModuleProviderRef MP,
  69. unsigned OptLevel,
  70. char **OutError);
  71. void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE);
  72. void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE);
  73. void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE);
  74. int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F,
  75. unsigned ArgC, const char * const *ArgV,
  76. const char * const *EnvP);
  77. LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F,
  78. unsigned NumArgs,
  79. LLVMGenericValueRef *Args);
  80. void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);
  81. void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M);
  82. /** Deprecated: Use LLVMAddModule instead. */
  83. void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP);
  84. LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
  85. LLVMModuleRef *OutMod, char **OutError);
  86. /** Deprecated: Use LLVMRemoveModule instead. */
  87. LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
  88. LLVMModuleProviderRef MP,
  89. LLVMModuleRef *OutMod, char **OutError);
  90. LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
  91. LLVMValueRef *OutFn);
  92. void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn);
  93. LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE);
  94. void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
  95. void* Addr);
  96. void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global);
  97. /**
  98. * @}
  99. */
  100. #ifdef __cplusplus
  101. }
  102. namespace llvm {
  103. struct GenericValue;
  104. class ExecutionEngine;
  105. #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
  106. inline ty *unwrap(ref P) { \
  107. return reinterpret_cast<ty*>(P); \
  108. } \
  109. \
  110. inline ref wrap(const ty *P) { \
  111. return reinterpret_cast<ref>(const_cast<ty*>(P)); \
  112. }
  113. DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef )
  114. DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef)
  115. #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
  116. }
  117. #endif /* defined(__cplusplus) */
  118. #endif