3 * File name: ir/tr/tpop_t.h
4 * Purpose: Opcode of types -- private header.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2001-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 * This file contains the datatypes hidden in tpop.h.
24 * @autor Goetz Lindenmaier
28 /** possible flags for a type opcode */
30 TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
33 /** The type opcode */
35 tp_opcode code; /**< the tpop code */
36 ident *name; /**< the name of the type opcode */
37 size_t attr_size; /**< the attribute size for a type of this opcode */
38 unsigned flags; /**< flags for this opcode */
42 * Returns a new type opcode.
44 * Allocates a new tp_op struct and initializes it's fields with
45 * the passed values. This function is only to be used during
46 * initialization of the library.
48 * @param code the enum for this type opcode.
49 * @param name an ident for the name of the type opcode.
50 * @param flags additional flags
51 * @param attr_size the size of the attributes necessary for a type with
53 * @return A new type opcode.
55 tp_op *new_tpop (tp_opcode code, ident *name, unsigned flags, size_t attr_size);
58 * Free a tpop datastructure.
60 void free_tpop(tp_op* tpop);
63 * Initialize the tpop module.
65 * Must be called during the initialization of the library. Allocates
66 * opcodes and sets the globals that are external visible as specified
68 * Allocates opcodes for classes, struct, method, union, array,
69 * enumeration, pointer and primitive and sets the according values.
71 void init_tpop (void);
74 * Finalize the tpop module.
76 * Frees all type opcodes.
78 void finish_tpop(void);
81 * Returns the size of the attribute to this kind
86 * @param op The type opcode to get the size for.
87 * @return The size of the attribute of types with this opcode.
90 int get_tpop_attr_size (const tp_op *op);
97 static INLINE tp_opcode
98 __get_tpop_code(const tp_op *op) {
102 static INLINE ident *
103 __get_tpop_ident(const tp_op *op){
108 __get_tpop_attr_size(const tp_op *op) {
109 return op->attr_size;
112 #define get_tpop_code(op) __get_tpop_code(op)
113 #define get_tpop_ident(op) __get_tpop_ident(op)
114 #define get_tpop_attr_size(op) __get_tpop_attr_size(op)
116 #endif /* _TPOP_T_H_ */