Mercurial > projects > ldc
annotate gen/metadata.h @ 1555:ed0cffe895ec
use the new NamedMDNode class
this will need a LLVM >= r77619
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Thu, 30 Jul 2009 20:54:03 +0200 |
parents | 259b031f3d22 |
children | 3adcb70700cb |
rev | line source |
---|---|
1284
5851c18e4c6d
Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff
changeset
|
1 #ifndef LDC_GEN_METADATA_H |
5851c18e4c6d
Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff
changeset
|
2 #define LDC_GEN_METADATA_H |
5851c18e4c6d
Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff
changeset
|
3 |
1547 | 4 // MDNode was moved into its own header, and contains Value*s |
1555
ed0cffe895ec
use the new NamedMDNode class
Benjamin Kramer <benny.kra@gmail.com>
parents:
1547
diff
changeset
|
5 #include "llvm/Metadata.h" |
1547 | 6 typedef llvm::Value MDNodeField; |
1284
5851c18e4c6d
Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff
changeset
|
7 |
1547 | 8 // Use getNumElements() and getElement() to access elements. |
9 inline unsigned MD_GetNumElements(llvm::MDNode* N) { | |
10 return N->getNumElements(); | |
11 } | |
12 | |
13 inline MDNodeField* MD_GetElement(llvm::MDNode* N, unsigned i) { | |
14 return N->getElement(i); | |
15 } | |
1343
c21a6654cce2
Update for metadata changes in LLVM trunk.
Frits van Bommel <fvbommel wxs.nl>
parents:
1317
diff
changeset
|
16 |
1291
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
17 #define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
18 |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
19 // *** Metadata for TypeInfo instances *** |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
20 #define TD_PREFIX "llvm.ldc.typeinfo." |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
21 |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
22 /// The fields in the metadata node for a TypeInfo instance. |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
23 /// (Its name will be TD_PREFIX ~ <Name of TypeInfo global>) |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
24 enum TypeDataFields { |
1344
3297edb697eb
Re-enable consistency check for fixed LLVM versions.
Frits van Bommel <fvbommel wxs.nl>
parents:
1343
diff
changeset
|
25 TD_Confirm, /// The TypeInfo this node is for. |
1316
8c65217be813
Work around an LLVM bug by not referring to globals from metadata. This was
Frits van Bommel <fvbommel wxs.nl>
parents:
1291
diff
changeset
|
26 |
1291
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
27 TD_Type, /// A value of the LLVM type corresponding to this D type |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
28 |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
29 // Must be kept last: |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
30 TD_NumFields /// The number of fields in TypeInfo metadata |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
31 }; |
875afb7a93b6
Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents:
1284
diff
changeset
|
32 |
1317
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
33 |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
34 // *** Metadata for ClassInfo instances *** |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
35 #define CD_PREFIX "llvm.ldc.classinfo." |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
36 |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
37 /// The fields in the metadata node for a ClassInfo instance. |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
38 /// (Its name will be CD_PREFIX ~ <Name of ClassInfo global>) |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
39 enum ClassDataFields { |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
40 CD_BodyType, /// A value of the LLVM type corresponding to the class body. |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
41 CD_Finalize, /// True if this class (or a base class) has a destructor. |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
42 CD_CustomDelete,/// True if this class has an overridden delete operator. |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
43 |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
44 // Must be kept last |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
45 CD_NumFields /// The number of fields in ClassInfo metadata |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
46 }; |
4099548c80e0
Allocate objects on the stack if they (a) don't have a destructor, and
Frits van Bommel <fvbommel wxs.nl>
parents:
1316
diff
changeset
|
47 |
1284
5851c18e4c6d
Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff
changeset
|
48 #endif |