comparison tools/binding/llvm/c/Target.d @ 1273:1ba61de8796b

Committing LLVM binding for D as it currently exists in the SVN repository.
author Frits van Bommel <fvbommel wxs.nl>
date Mon, 27 Apr 2009 22:33:17 +0200
parents
children 29b0f2d11c92
comparison
equal deleted inserted replaced
1272:dd4766851b37 1273:1ba61de8796b
1 // Converted to the D programming language by Tomas Lindquist Olsen 2008
2 // Original file header:
3 /*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*\
4 |* *|
5 |* The LLVM Compiler Infrastructure *|
6 |* *|
7 |* This file is distributed under the University of Illinois Open Source *|
8 |* License. See LICENSE.TXT for details. *|
9 |* *|
10 |*===----------------------------------------------------------------------===*|
11 |* *|
12 |* This header declares the C interface to libLLVMTarget.a, which *|
13 |* implements target information. *|
14 |* *|
15 |* Many exotic languages can interoperate with C code but have a harder time *|
16 |* with C++ due to name mangling. So in addition to C, this interface enables *|
17 |* tools written in such languages. *|
18 |* *|
19 \*===----------------------------------------------------------------------===*/
20
21 module llvm.c.Target;
22
23 import llvm.c.Core;
24
25 extern(C):
26
27 enum { LLVMBigEndian, LLVMLittleEndian };
28 alias int LLVMByteOrdering;
29
30 private
31 {
32 struct LLVM_OpaqueTargetData {}
33 struct LLVM_OpaqueStructLayout {}
34 }
35 typedef LLVM_OpaqueTargetData* LLVMTargetDataRef;
36 typedef LLVM_OpaqueStructLayout* LLVMStructLayoutRef;
37
38
39 /*===-- Target Data -------------------------------------------------------===*/
40
41 /** Creates target data from a target layout string.
42 See the constructor llvm::TargetData::TargetData. */
43 LLVMTargetDataRef LLVMCreateTargetData( /*const*/ char *StringRep);
44
45 /** Adds target data information to a pass manager. This does not take ownership
46 of the target data.
47 See the method llvm::PassManagerBase::add. */
48 void LLVMAddTargetData(LLVMTargetDataRef, LLVMPassManagerRef);
49
50 /** Converts target data to a target layout string. The string must be disposed
51 with LLVMDisposeMessage.
52 See the constructor llvm::TargetData::TargetData. */
53 char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef);
54
55 /** Returns the byte order of a target, either LLVMBigEndian or
56 LLVMLittleEndian.
57 See the method llvm::TargetData::isLittleEndian. */
58 LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef);
59
60 /** Returns the pointer size in bytes for a target.
61 See the method llvm::TargetData::getPointerSize. */
62 uint LLVMPointerSize(LLVMTargetDataRef);
63
64 /** Returns the integer type that is the same size as a pointer on a target.
65 See the method llvm::TargetData::getIntPtrType. */
66 LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef);
67
68 /** Computes the size of a type in bytes for a target.
69 See the method llvm::TargetData::getTypeSizeInBits. */
70 ulong LLVMSizeOfTypeInBits(LLVMTargetDataRef, LLVMTypeRef);
71
72 /** Computes the storage size of a type in bytes for a target.
73 See the method llvm::TargetData::getTypeStoreSize. */
74 ulong LLVMStoreSizeOfType(LLVMTargetDataRef, LLVMTypeRef);
75
76 /** Computes the ABI size of a type in bytes for a target.
77 See the method llvm::TargetData::getABITypeSize. */
78 ulong LLVMABISizeOfType(LLVMTargetDataRef, LLVMTypeRef);
79
80 /** Computes the ABI alignment of a type in bytes for a target.
81 See the method llvm::TargetData::getTypeABISize. */
82 uint LLVMABIAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
83
84 /** Computes the call frame alignment of a type in bytes for a target.
85 See the method llvm::TargetData::getTypeABISize. */
86 uint LLVMCallFrameAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
87
88 /** Computes the preferred alignment of a type in bytes for a target.
89 See the method llvm::TargetData::getTypeABISize. */
90 uint LLVMPreferredAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
91
92 /** Computes the preferred alignment of a global variable in bytes for a target.
93 See the method llvm::TargetData::getPreferredAlignment. */
94 uint LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef,
95 LLVMValueRef GlobalVar);
96
97 /** Computes the structure element that contains the byte offset for a target.
98 See the method llvm::StructLayout::getElementContainingOffset. */
99 uint LLVMElementAtOffset(LLVMTargetDataRef, LLVMTypeRef StructTy,
100 ulong Offset);
101
102 /** Computes the byte offset of the indexed struct element for a target.
103 See the method llvm::StructLayout::getElementContainingOffset. */
104 ulong LLVMOffsetOfElement(LLVMTargetDataRef, LLVMTypeRef StructTy,
105 uint Element);
106
107 /** Struct layouts are speculatively cached. If a TargetDataRef is alive when
108 types are being refined and removed, this method must be called whenever a
109 struct type is removed to avoid a dangling pointer in this cache.
110 See the method llvm::TargetData::InvalidateStructLayoutInfo. */
111 void LLVMInvalidateStructLayout(LLVMTargetDataRef, LLVMTypeRef StructTy);
112
113 /** Deallocates a TargetData.
114 See the destructor llvm::TargetData::~TargetData. */
115 void LLVMDisposeTargetData(LLVMTargetDataRef);