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.
20 * This file contains the datatypes hidden in tpop.h.
22 * @author Goetz Lindenmaier
26 /** possible flags for a type opcode */
28 TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
31 /** The type opcode */
33 tp_opcode code; /**< the tpop code */
34 ident *name; /**< the name of the type opcode */
35 size_t attr_size; /**< the attribute size for a type of this opcode */
36 unsigned flags; /**< flags for this opcode */
40 * Returns a new type opcode.
42 * Allocates a new tp_op struct and initializes it's fields with
43 * the passed values. This function is only to be used during
44 * initialization of the library.
46 * @param code the enum for this type opcode.
47 * @param name an ident for the name of the type opcode.
48 * @param flags additional flags
49 * @param attr_size the size of the attributes necessary for a type with
51 * @return A new type opcode.
53 tp_op *new_tpop (tp_opcode code, ident *name, unsigned flags, size_t attr_size);
56 * Free a tpop datastructure.
58 void free_tpop(tp_op* tpop);
61 * Initialize the tpop module.
63 * Must be called during the initialization of the library. Allocates
64 * opcodes and sets the globals that are external visible as specified
66 * Allocates opcodes for classes, struct, method, union, array,
67 * enumeration, pointer and primitive and sets the according values.
69 void init_tpop (void);
72 * Finalize the tpop module.
74 * Frees all type opcodes.
76 void finish_tpop(void);
79 * Returns the size of the attribute to this kind
84 * @param op The type opcode to get the size for.
85 * @return The size of the attribute of types with this opcode.
88 int get_tpop_attr_size (const tp_op *op);
95 static INLINE tp_opcode
96 __get_tpop_code(const tp_op *op) {
100 static INLINE ident *
101 __get_tpop_ident(const tp_op *op){
106 __get_tpop_attr_size(const tp_op *op) {
107 return op->attr_size;
110 #define get_tpop_code(op) __get_tpop_code(op)
111 #define get_tpop_ident(op) __get_tpop_ident(op)
112 #define get_tpop_attr_size(op) __get_tpop_attr_size(op)
114 #endif /* _TPOP_T_H_ */