1c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/*===-- llvm-c/TargetMachine.h - Target Machine Library C Interface - C++ -*-=*\
2c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
3c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                     The LLVM Compiler Infrastructure                       *|
4c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
5c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* This file is distributed under the University of Illinois Open Source      *|
6c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* License. See LICENSE.TXT for details.                                      *|
7c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
8c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*===----------------------------------------------------------------------===*|
9c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
10c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* This header declares the C interface to the Target and TargetMachine       *|
11c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* classes, which can be used to generate assembly or object files.           *|
12c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
13c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* Many exotic languages can interoperate with C code but have a harder time  *|
14c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* with C++ due to name mangling. So in addition to C, this interface enables *|
15c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|* tools written in such languages.                                           *|
16c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot|*                                                                            *|
17c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot\*===----------------------------------------------------------------------===*/
18c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
19c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#ifndef LLVM_C_TARGETMACHINE_H
20c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#define LLVM_C_TARGETMACHINE_H
21c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
22c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm-c/Target.h"
23c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#include "llvm-c/Types.h"
24c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
25c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#ifdef __cplusplus
26c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotextern "C" {
27c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#endif
28c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef;
29c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef struct LLVMTarget *LLVMTargetRef;
30c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
31c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef enum {
32c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeGenLevelNone,
33c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeGenLevelLess,
34c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeGenLevelDefault,
35c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeGenLevelAggressive
36c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} LLVMCodeGenOptLevel;
37c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
38c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef enum {
39c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMRelocDefault,
40c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMRelocStatic,
41c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMRelocPIC,
42c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMRelocDynamicNoPic
43c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} LLVMRelocMode;
44c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
45c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef enum {
46c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelDefault,
47c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelJITDefault,
48c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelSmall,
49c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelKernel,
50c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelMedium,
51c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMCodeModelLarge
52c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} LLVMCodeModel;
53c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
54c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robottypedef enum {
55c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMAssemblyFile,
56c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot    LLVMObjectFile
57c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot} LLVMCodeGenFileType;
58c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
59c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the first llvm::Target in the registered targets list. */
60c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetRef LLVMGetFirstTarget(void);
61c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the next llvm::Target given a previous one (or null if there's none) */
62c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T);
63c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
64c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/*===-- Target ------------------------------------------------------------===*/
65c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Finds the target corresponding to the given name and stores it in \p T.
66c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  Returns 0 on success. */
67c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetRef LLVMGetTargetFromName(const char *Name);
68c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
69c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Finds the target corresponding to the given triple and stores it in \p T.
70c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  Returns 0 on success. Optionally returns any error in ErrorMessage.
71c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  Use LLVMDisposeMessage to dispose the message. */
72c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMGetTargetFromTriple(const char* Triple, LLVMTargetRef *T,
73c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot                                 char **ErrorMessage);
74c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
75c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the name of a target. See llvm::Target::getName */
76c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotconst char *LLVMGetTargetName(LLVMTargetRef T);
77c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
78c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the description  of a target. See llvm::Target::getDescription */
79c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotconst char *LLVMGetTargetDescription(LLVMTargetRef T);
80c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
81c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns if the target has a JIT */
82c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMTargetHasJIT(LLVMTargetRef T);
83c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
84c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns if the target has a TargetMachine associated */
85c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMTargetHasTargetMachine(LLVMTargetRef T);
86c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
87c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns if the target as an ASM backend (required for emitting output) */
88c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMTargetHasAsmBackend(LLVMTargetRef T);
89c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
90c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/*===-- Target Machine ----------------------------------------------------===*/
91c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Creates a new llvm::TargetMachine. See llvm::Target::createTargetMachine */
92c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T,
93c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  const char *Triple, const char *CPU, const char *Features,
94c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel);
95c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
96c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Dispose the LLVMTargetMachineRef instance generated by
97c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMCreateTargetMachine. */
98c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotvoid LLVMDisposeTargetMachine(LLVMTargetMachineRef T);
99c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
100c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the Target used in a TargetMachine */
101c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T);
102c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
103c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the triple used creating this target machine. See
104c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  llvm::TargetMachine::getTriple. The result needs to be disposed with
105c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMDisposeMessage. */
106c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotchar *LLVMGetTargetMachineTriple(LLVMTargetMachineRef T);
107c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
108c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the cpu used creating this target machine. See
109c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  llvm::TargetMachine::getCPU. The result needs to be disposed with
110c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMDisposeMessage. */
111c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotchar *LLVMGetTargetMachineCPU(LLVMTargetMachineRef T);
112c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
113c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Returns the feature string used creating this target machine. See
114c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  llvm::TargetMachine::getFeatureString. The result needs to be disposed with
115c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMDisposeMessage. */
116c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotchar *LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T);
117c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
118c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Create a DataLayout based on the targetMachine. */
119c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T);
120c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
121c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Set the target machine's ASM verbosity. */
122c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotvoid LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
123c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot                                      LLVMBool VerboseAsm);
124c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
125c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Emits an asm or object file for the given module to the filename. This
126c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  wraps several c++ only classes (among them a file stream). Returns any
127c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  error in ErrorMessage. Use LLVMDisposeMessage to dispose the message. */
128c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
129c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  char *Filename, LLVMCodeGenFileType codegen, char **ErrorMessage);
130c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
131c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Compile the LLVM IR stored in \p M and store the result in \p OutMemBuf. */
132c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team RobotLLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M,
133c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  LLVMCodeGenFileType codegen, char** ErrorMessage, LLVMMemoryBufferRef *OutMemBuf);
134c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
135c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/*===-- Triple ------------------------------------------------------------===*/
136c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Get a triple for the host machine as a string. The result needs to be
137c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot  disposed with LLVMDisposeMessage. */
138c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotchar* LLVMGetDefaultTargetTriple(void);
139c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
140c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot/** Adds the target-specific analysis passes to the pass manager. */
141c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robotvoid LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM);
142c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
143c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#ifdef __cplusplus
144c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot}
145c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#endif
146c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot
147c9cc9e7d29b8970d8ddb734c88fb62d01e0b727android-build-team Robot#endif
148