annotate tools/binding/llvm/c/Target.d @ 1585:29b0f2d11c92

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