2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Representation of opcode of intermediate operation -- private header.
9 * @author Christian Schaefer, Goetz Lindenmaier, Michael Beck
11 #ifndef FIRM_IR_IROP_T_H
12 #define FIRM_IR_IROP_T_H
21 #define get_op_code(op) get_op_code_(op)
22 #define get_op_ident(op) get_op_ident_(op)
23 #define get_op_pinned(op) get_op_pinned_(op)
24 #define get_op_ops(op) get_op_ops_(op)
25 #define set_op_tag(op, tag) set_op_tag_((op), (tag))
26 #define get_op_tag(op) get_op_tag_(op)
27 #define set_op_attr(op, attr) set_op_attr_((op), (attr))
28 #define get_op_attr(op) get_op_attr_(op)
30 #define set_generic_function_ptr(op, func) set_generic_function_ptr_((op), (op_func)(func))
31 #define get_generic_function_ptr(type, op) ((type*)get_generic_function_ptr_((op)))
34 * Frees a newly created ir operation.
36 void free_ir_op(ir_op *code);
38 /** Initialize the irop module. */
39 void firm_init_op(void);
41 /** frees memory allocated by irop module */
42 void firm_finish_op(void);
45 * Returns the attribute size of nodes of this opcode.
46 * @note Use not encouraged, internal feature.
48 static inline size_t get_op_attr_size (const ir_op *op)
54 * Returns non-zero if op is a control flow opcode,
55 * like Start, End, Jmp, Cond, Return, Raise or Bad.
57 static inline bool is_op_cfopcode(const ir_op *op)
59 return op->flags & irop_flag_cfopcode;
62 static inline bool is_op_unknown_jump(const ir_op *op)
64 return op->flags & irop_flag_unknown_jump;
67 /** Returns non-zero if operation is commutative */
68 static inline bool is_op_commutative(const ir_op *op)
70 return op->flags & irop_flag_commutative;
73 /** Returns non-zero if operation is fragile */
74 static inline bool is_op_fragile(const ir_op *op)
76 return op->flags & irop_flag_fragile;
79 /** Returns non-zero if operation is forking control flow */
80 static inline bool is_op_forking(const ir_op *op)
82 return op->flags & irop_flag_forking;
85 /** Returns non-zero if operation is a high-level op */
86 static inline bool is_op_highlevel(const ir_op *op)
88 return op->flags & irop_flag_highlevel;
91 /** Returns non-zero if operation is a const-like op */
92 static inline bool is_op_constlike(const ir_op *op)
94 return op->flags & irop_flag_constlike;
97 static inline bool is_op_uses_memory(const ir_op *op)
99 return op->flags & irop_flag_uses_memory;
102 /** Returns non-zero if operation is a keep-like op */
103 static inline bool is_op_keep(const ir_op *op)
105 return op->flags & irop_flag_keep;
108 /** Returns non-zero if operation must always be placed in the start block. */
109 static inline bool is_op_start_block_placed(const ir_op *op)
111 return op->flags & irop_flag_start_block;
114 /** Returns non-zero if operation is CSE neutral */
115 static inline bool is_op_cse_neutral(const ir_op *op)
117 return op->flags & irop_flag_cse_neutral;
120 static inline unsigned get_op_code_(const ir_op *op)
125 static inline ident *get_op_ident_(const ir_op *op)
130 static inline op_pin_state get_op_pinned_(const ir_op *op)
132 return op->pin_state;
135 static inline void set_generic_function_ptr_(ir_op *op, op_func func)
137 op->ops.generic = func;
140 static inline op_func get_generic_function_ptr_(const ir_op *op)
142 return op->ops.generic;
145 static inline ir_op_ops *get_op_ops_(ir_op *op)
150 static inline void set_op_tag_(ir_op *op, unsigned tag)
155 static inline unsigned get_op_tag_(const ir_op *op)
160 static inline void set_op_attr_(ir_op *op, void *attr)
165 static inline void *get_op_attr_(const ir_op *op)