ia32_nodes_attr.h 4.5 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
2
3
4
5
6
/**
 * Type definitions for ia32 node attributes.
 * @author Christian Wuerdig
 * $Id$
 */

7
8
9
#ifndef _IA32_NODES_ATTR_H_
#define _IA32_NODES_ATTR_H_

Christian Würdig's avatar
Christian Würdig committed
10
11
#include "firm_config.h"

12
13
#include <obstack.h>

14
15
#include "firm_types.h"
#include "../bearch.h"
16
#include "../bemachine.h"
17

18
typedef enum { flavour_Div = 1, flavour_Mod, flavour_DivMod } ia32_op_flavour_t;
19
typedef enum { pn_EAX, pn_EDX } pn_ia32_Register;
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

typedef enum {
	ia32_Normal,
	ia32_Const,
	ia32_SymConst,
	ia32_AddrModeD,
	ia32_AddrModeS
} ia32_op_type_t;

typedef enum {
	ia32_ImmNone,
	ia32_ImmConst,
	ia32_ImmSymConst
} ia32_immop_type_t;

35
typedef	enum {
36
37
38
39
40
	ia32_am_None   = 0,   /**<< no addrmode support */
	ia32_am_Dest   = 1,   /**<< addrmode for destination only */
	ia32_am_Source = 2,   /**<< addrmode for source only */
	ia32_am_Full   = 3    /**<< full addmode support */
} ia32_am_type_t;
41

Christian Würdig's avatar
Christian Würdig committed
42
43
44
45
46
47
48
/**
 * Different AM types:
 * O - Offset is set
 * B - Base is set
 * I - Index is set
 * S - Scale is set
 */
49
50

enum {
51
52
53
54
	ia32_O = (1 << 0),
	ia32_B = (1 << 1),
	ia32_I = (1 << 2),
	ia32_S = (1 << 3)
55
56
};

Christian Würdig's avatar
Christian Würdig committed
57
typedef enum {
58
59
60
61
62
	ia32_am_N    = 0,
	ia32_am_O    = ia32_O,
	ia32_am_B    = ia32_B,
	ia32_am_I    = ia32_I,
	ia32_am_IS   = ia32_I | ia32_S,
63
	ia32_am_BI   = ia32_B | ia32_I,
64
65
66
67
	ia32_am_OB   = ia32_O | ia32_B,
	ia32_am_OI   = ia32_O | ia32_I,
	ia32_am_OIS  = ia32_O | ia32_I | ia32_S,
	ia32_am_OBIS = ia32_O | ia32_B | ia32_I | ia32_S
Christian Würdig's avatar
Christian Würdig committed
68
69
} ia32_am_flavour_t;

Christian Würdig's avatar
Christian Würdig committed
70
71
typedef struct _ia32_register_req_t {
	const arch_register_req_t req;
72
73
	int same_pos;        /**< in case of "should be same" we need to remember the pos to get the irn */
	int different_pos;   /**< in case of "should be different" we need to remember the pos to get the irn */
Christian Würdig's avatar
Christian Würdig committed
74
} ia32_register_req_t;
75

76
typedef struct _ia32_attr_t {
77
78
	struct {
		unsigned tp:3;              /**< ia32 node type */
79
		unsigned imm_tp:2;          /**< ia32 immop type */
80

81
82
83
		unsigned am_support:2;      /**< indicates addrmode type supported by this node */
		unsigned am_flavour:4;      /**< the concrete addrmode characteristics */
		unsigned am_scale:2;        /**< addrmode scale for index register */
Christian Würdig's avatar
Christian Würdig committed
84

85
		unsigned offs_sign:1;       /**< sign bit of the first offset */
86
		unsigned am_sc_sign:1;      /**< sign bit of the address mode symconst */
Christian Würdig's avatar
Christian Würdig committed
87

88
		unsigned use_frame:1;       /**< indicates whether the operation uses the frame pointer or not */
89

90
		unsigned op_flav:2;         /**< flavour of an op (flavour_Div/Mod/DivMod) */
91

92
		unsigned flags:4;           /**< indicating if spillable, rematerializeable, stack modifying and/or ignore */
93

94
		unsigned is_commutative:1;  /**< indicates whether op is commutative or not */
95

Christian Würdig's avatar
Christian Würdig committed
96
97
		unsigned emit_cl:1;         /**< indicates whether we must emit cl instead of ecx (needed for shifts) */

98
99
		unsigned got_lea:1;         /**< indicates whether or not this node already consumed a LEA */

Christian Würdig's avatar
Christian Würdig committed
100
101
102
		unsigned got_reload:1;      /**< set to 1 if node cosumed a reload */

		unsigned n_res:6;           /**< number of results produced by this node */
103
104
	} data;

105
106
	int *out_flags;     /**< flags for each produced value */

107
	int am_offs;        /**< offsets for AddrMode */
Christian Würdig's avatar
Christian Würdig committed
108
	ident *am_sc;       /**< SymConst for AddrMode */
109

110
111
112
113
114
115
	union {
		tarval *tv;     /**< tarval for immediate operations */
		ident  *sc;     /**< the symconst ident */
	} cnst_val;

	ident *cnst;        /**< points to the string representation of the constant value (either tv or sc) */
116

117
118
	ir_mode *ls_mode;   /**< the mode of the stored/loaded value */
	ir_mode *res_mode;  /**< the mode of the result */
119
120
	ir_mode *src_mode;  /**< source mode for conversion */
	ir_mode *tgt_mode;  /**< target mode for conversion */
121

122
	entity *frame_ent;  /**< the frame entity attached to this node */
123

124
	long pn_code;       /**< projnum "types" (e.g. indicate compare operators and argument numbers) */
Christian Würdig's avatar
Christian Würdig committed
125

Christian Würdig's avatar
Christian Würdig committed
126
127
	unsigned latency;   /**< the latency of the instruction in clock cycles */

Christian Würdig's avatar
Christian Würdig committed
128
129
130
#ifndef NDEBUG
	const char *orig_node;      /**< holds the name of the original ir node for debugging purposes */
#endif /* NDEBUG */
131

132
133
134
	const be_execution_unit_t **exec_units; /**< NULL terminated list of units this operation can be executed on */
	unsigned                  n_exec_units; /**< the number of available execution units for this operation */

135
136
137
	const ia32_register_req_t **in_req;  /**< register requirements for arguments */
	const ia32_register_req_t **out_req; /**< register requirements for results */

Michael Beck's avatar
Michael Beck committed
138
	const arch_register_t *x87[3];       /**< register slots for x87 register */
139
140
141

	/* must be last, dynamic */
	const arch_register_t *slots[1];     /**< register slots for assigned registers */
142
} ia32_attr_t;
143
144

#endif /* _IA32_NODES_ATTR_H_ */