annotate gen/metadata.h @ 1578:1dee66f6ec0b

Removed a chunk of code in favour of a shorter and more portable method
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 11:21:30 +0100
parents 3adcb70700cb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1558
3adcb70700cb Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1555
diff changeset
1 #if USE_METADATA
3adcb70700cb Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1555
diff changeset
2
1284
5851c18e4c6d Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff changeset
3 #ifndef LDC_GEN_METADATA_H
5851c18e4c6d Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff changeset
4 #define LDC_GEN_METADATA_H
5851c18e4c6d Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff changeset
5
1547
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
6 // 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
7 #include "llvm/Metadata.h"
1547
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
8 typedef llvm::Value MDNodeField;
1284
5851c18e4c6d Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff changeset
9
1547
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
10 // Use getNumElements() and getElement() to access elements.
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
11 inline unsigned MD_GetNumElements(llvm::MDNode* N) {
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
12 return N->getNumElements();
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
13 }
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
14
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
15 inline MDNodeField* MD_GetElement(llvm::MDNode* N, unsigned i) {
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
16 return N->getElement(i);
259b031f3d22 Some minor cleanups
Benjamin Kramer <benny.kra@gmail.com>
parents: 1533
diff changeset
17 }
1343
c21a6654cce2 Update for metadata changes in LLVM trunk.
Frits van Bommel <fvbommel wxs.nl>
parents: 1317
diff changeset
18
1291
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
19 #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
20
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
21 // *** 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
22 #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
23
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
24 /// 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
25 /// (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
26 enum TypeDataFields {
1344
3297edb697eb Re-enable consistency check for fixed LLVM versions.
Frits van Bommel <fvbommel wxs.nl>
parents: 1343
diff changeset
27 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
28
1291
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
29 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
30
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
31 // 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
32 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
33 };
875afb7a93b6 Factor out some constants into the header so producers and consumers of
Frits van Bommel <fvbommel wxs.nl>
parents: 1284
diff changeset
34
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
35
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 // *** 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
37 #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
38
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 /// 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
40 /// (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
41 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
42 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
43 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
44 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
45
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 // 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
47 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
48 };
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
49
1284
5851c18e4c6d Add metadata for TypeInfo -> llvm::Type mapping.
Frits van Bommel <fvbommel wxs.nl>
parents:
diff changeset
50 #endif
1558
3adcb70700cb Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1555
diff changeset
51
3adcb70700cb Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1555
diff changeset
52 #endif // USE_METADATA