Enable loop bb placement optimization.
[llvm/msp430.git] / include / llvm-c / Target.h
blob2aa5bd9f76e365b23a47e980638466bfd671103c
1 /*===-- llvm-c/Target.h - Target 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 libLLVMTarget.a, which *|
11 |* implements target information. *|
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 \*===----------------------------------------------------------------------===*/
19 #ifndef LLVM_C_TARGET_H
20 #define LLVM_C_TARGET_H
22 #include "llvm-c/Core.h"
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 enum { LLVMBigEndian, LLVMLittleEndian };
29 typedef int LLVMByteOrdering;
31 typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
32 typedef struct LLVMStructLayout *LLVMStructLayoutRef;
35 /*===-- Target Data -------------------------------------------------------===*/
37 /** Creates target data from a target layout string.
38 See the constructor llvm::TargetData::TargetData. */
39 LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep);
41 /** Adds target data information to a pass manager. This does not take ownership
42 of the target data.
43 See the method llvm::PassManagerBase::add. */
44 void LLVMAddTargetData(LLVMTargetDataRef, LLVMPassManagerRef);
46 /** Converts target data to a target layout string. The string must be disposed
47 with LLVMDisposeMessage.
48 See the constructor llvm::TargetData::TargetData. */
49 char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef);
51 /** Returns the byte order of a target, either LLVMBigEndian or
52 LLVMLittleEndian.
53 See the method llvm::TargetData::isLittleEndian. */
54 LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef);
56 /** Returns the pointer size in bytes for a target.
57 See the method llvm::TargetData::getPointerSize. */
58 unsigned LLVMPointerSize(LLVMTargetDataRef);
60 /** Returns the integer type that is the same size as a pointer on a target.
61 See the method llvm::TargetData::getIntPtrType. */
62 LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef);
64 /** Computes the size of a type in bytes for a target.
65 See the method llvm::TargetData::getTypeSizeInBits. */
66 unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef, LLVMTypeRef);
68 /** Computes the storage size of a type in bytes for a target.
69 See the method llvm::TargetData::getTypeStoreSize. */
70 unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef, LLVMTypeRef);
72 /** Computes the ABI size of a type in bytes for a target.
73 See the method llvm::TargetData::getTypePaddedSize. */
74 unsigned long long LLVMABISizeOfType(LLVMTargetDataRef, LLVMTypeRef);
76 /** Computes the ABI alignment of a type in bytes for a target.
77 See the method llvm::TargetData::getTypeABISize. */
78 unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
80 /** Computes the call frame alignment of a type in bytes for a target.
81 See the method llvm::TargetData::getTypeABISize. */
82 unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
84 /** Computes the preferred alignment of a type in bytes for a target.
85 See the method llvm::TargetData::getTypeABISize. */
86 unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
88 /** Computes the preferred alignment of a global variable in bytes for a target.
89 See the method llvm::TargetData::getPreferredAlignment. */
90 unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef,
91 LLVMValueRef GlobalVar);
93 /** Computes the structure element that contains the byte offset for a target.
94 See the method llvm::StructLayout::getElementContainingOffset. */
95 unsigned LLVMElementAtOffset(LLVMTargetDataRef, LLVMTypeRef StructTy,
96 unsigned long long Offset);
98 /** Computes the byte offset of the indexed struct element for a target.
99 See the method llvm::StructLayout::getElementContainingOffset. */
100 unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef, LLVMTypeRef StructTy,
101 unsigned Element);
103 /** Struct layouts are speculatively cached. If a TargetDataRef is alive when
104 types are being refined and removed, this method must be called whenever a
105 struct type is removed to avoid a dangling pointer in this cache.
106 See the method llvm::TargetData::InvalidateStructLayoutInfo. */
107 void LLVMInvalidateStructLayout(LLVMTargetDataRef, LLVMTypeRef StructTy);
109 /** Deallocates a TargetData.
110 See the destructor llvm::TargetData::~TargetData. */
111 void LLVMDisposeTargetData(LLVMTargetDataRef);
114 #ifdef __cplusplus
117 namespace llvm {
118 class TargetData;
120 inline TargetData *unwrap(LLVMTargetDataRef P) {
121 return reinterpret_cast<TargetData*>(P);
124 inline LLVMTargetDataRef wrap(const TargetData *P) {
125 return reinterpret_cast<LLVMTargetDataRef>(const_cast<TargetData*>(P));
129 #endif /* defined(__cplusplus) */
131 #endif