|
P4C
The P4 Compiler
|
Loading...
Searching...
No Matches
17#ifndef IR_IR_TREE_MACROS_H_
18#define IR_IR_TREE_MACROS_H_
29#include "ir/gen-tree-macro.h"
31#define IRNODE_ALL_TEMPLATES_AND_DIRECT_AND_INDIRECT_BASES(M, D, B, TDA, ...) \
32 M(Vector, D(Node), template <class T>, <T>, ##__VA_ARGS__) \
33 M(IndexedVector, D(Vector<T>) B(Node), template <class T>, <T>, ##__VA_ARGS__) \
36 template <class T, template <class, class, class, class> class MAP TDA(= std::map), \
37 class COMP TDA(= std::less<cstring>), \
38 class ALLOC TDA(= std::allocator<std::pair<cstring, const T*>>)>), \
39 IR_TREE_COPY(<T, MAP, COMP, ALLOC>), ##__VA_ARGS__)
42#define IR_TREE_COPY(...) __VA_ARGS__
43#define IR_TREE_IGNORE(...)
46#define IRNODE_ALL_CLASSES_AND_BASES(M, B, ...) \
47 M(Node, , ##__VA_ARGS__) \
48 IRNODE_ALL_SUBCLASSES_AND_DIRECT_AND_INDIRECT_BASES(M, M, B, B, ##__VA_ARGS__)
50#define IRNODE_ALL_NON_TEMPLATE_CLASSES_AND_BASES(M, B, ...) \
51 M(Node, , ##__VA_ARGS__) \
52 IRNODE_ALL_SUBCLASSES_AND_DIRECT_AND_INDIRECT_BASES(M, IR_TREE_IGNORE, B, B, ##__VA_ARGS__)
55#define IRNODE_ALL_SUBCLASSES(M, ...) \
56 IRNODE_ALL_SUBCLASSES_AND_DIRECT_AND_INDIRECT_BASES(M, M, IR_TREE_COPY, IR_TREE_IGNORE, \
58#define IRNODE_ALL_NON_TEMPLATE_SUBCLASSES(M, ...) \
59 IRNODE_ALL_SUBCLASSES_AND_DIRECT_AND_INDIRECT_BASES(M, IR_TREE_IGNORE, IR_TREE_COPY, \
60 IR_TREE_IGNORE, ##__VA_ARGS__)
61#define IRNODE_ALL_TEMPLATES_AND_BASES(M, ...) \
62 IRNODE_ALL_TEMPLATES_AND_DIRECT_AND_INDIRECT_BASES(M, IR_TREE_COPY, IR_TREE_IGNORE, \
63 IR_TREE_IGNORE, ##__VA_ARGS__)
66#define REMOVE_BASES_ARG(CLASS, BASES, M, ...) M(IR_TREE_COPY(CLASS), ##__VA_ARGS__)
67#define IRNODE_ALL_CLASSES(M, ...) \
68 IRNODE_ALL_CLASSES_AND_BASES(REMOVE_BASES_ARG, IR_TREE_IGNORE, M, ##__VA_ARGS__)
69#define IRNODE_ALL_NON_TEMPLATE_CLASSES(M, ...) \
70 IRNODE_ALL_NON_TEMPLATE_CLASSES_AND_BASES(REMOVE_BASES_ARG, IR_TREE_IGNORE, M, ##__VA_ARGS__)
72#define REMOVE_TEMPLATE_BASES_ARG(CLASS, BASES, TEMPLATE, TARGS, M, ...) \
73 M(IR_TREE_COPY(CLASS), IR_TREE_COPY(TEMPLATE), IR_TREE_COPY(TARGS), ##__VA_ARGS__)
74#define IRNODE_ALL_TEMPLATES(M, ...) \
75 IRNODE_ALL_TEMPLATES_AND_DIRECT_AND_INDIRECT_BASES(REMOVE_TEMPLATE_BASES_ARG, IR_TREE_IGNORE, \
76 IR_TREE_IGNORE, IR_TREE_IGNORE, M, \
78#define IRNODE_ALL_TEMPLATES_WITH_DEFAULTS(M, ...) \
79 IRNODE_ALL_TEMPLATES_AND_DIRECT_AND_INDIRECT_BASES( \
80 REMOVE_TEMPLATE_BASES_ARG, IR_TREE_IGNORE, IR_TREE_IGNORE, IR_TREE_COPY, M, ##__VA_ARGS__)