ir_mode *mode = NULL;
int bad = 0;
int i, n_res, am_flav, flags;
- ia32_attr_t *attr;
const ia32_register_req_t **reqs;
const arch_register_t **slots;
case dump_node_mode_txt:
mode = get_irn_mode(n);
- if (is_ia32_Load(n) || is_ia32_Store(n)) {
+ if (is_ia32_Ld(n) || is_ia32_St(n)) {
mode = get_ia32_ls_mode(n);
}
- if (mode) {
- fprintf(F, "[%s]", get_mode_name(mode));
- }
- else {
- fprintf(F, "[?NOMODE?]");
- }
+ fprintf(F, "[%s]", mode ? get_mode_name(mode) : "?NOMODE?");
break;
case dump_node_nodeattr_txt:
- if (is_ia32_Call(n)) {
- fprintf(F, "&%s ", get_ia32_sc(n));
- }
- else if (get_ia32_cnst(n)) {
+ if (get_ia32_cnst(n)) {
char *pref = "";
if (get_ia32_sc(n)) {
break;
case dump_node_info_txt:
- attr = get_ia32_attr(n);
n_res = get_ia32_n_res(n);
fprintf(F, "=== IA32 attr begin ===\n");
slots = get_ia32_slots(n);
if (slots && n_res > 0) {
for (i = 0; i < n_res; i++) {
- if (slots[i]) {
- fprintf(F, "reg #%d = %s\n", i, slots[i]->name);
- }
- else {
- fprintf(F, "reg #%d = n/a\n", i);
- }
+ fprintf(F, "reg #%d = %s\n", i, slots[i] ? slots[i]->name : "n/a");
}
+ fprintf(F, "\n");
}
- fprintf(F, "\n");
/* dump op type */
fprintf(F, "op = ");
/* offset could already have an explicit sign */
/* -> supersede op if necessary */
- if (offset[0] == '-' && op == '-') {
- op = '+';
- }
- else if (offset[0] == '-' && op == '+') {
- op = '-';
- }
-
- /* skip explicit sign */
if (offset[0] == '-' || offset[0] == '+') {
+ if (offset[0] == '-') {
+ op = (op == '-') ? '+' : '-';
+ }
+
+ /* skip explicit sign */
offset++;
}
* Sets the index register scale for addrmode.
*/
void set_ia32_am_scale(ir_node *node, int scale) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->data.am_scale = scale;
+ ia32_attr_t *attr = get_ia32_attr(node);
+ attr->data.am_scale = scale;
}
/**
* Sets the uses_frame flag.
*/
void set_ia32_use_frame(ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
+ ia32_attr_t *attr = get_ia32_attr(node);
attr->data.use_frame = 1;
}
* Clears the uses_frame flag.
*/
void clear_ia32_use_frame(ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
+ ia32_attr_t *attr = get_ia32_attr(node);
attr->data.use_frame = 0;
}
*/
int is_ia32_commutative(const ir_node *node) {
ia32_attr_t *attr = get_ia32_attr(node);
-
return attr->data.is_commutative;
}
unsigned get_ia32_Const_type(const ir_node *node) {
ia32_attr_t *attr = get_ia32_attr(node);
- assert((is_ia32_Const(node) || is_ia32_fConst(node)) && "Need ia32_Const to get type");
+ assert(is_ia32_Cnst(node) && "Need ia32_Const to get type");
return attr->data.tp;
}
void set_ia32_Const_type(ir_node *node, int type) {
ia32_attr_t *attr = get_ia32_attr(node);
- assert((is_ia32_Const(node) || is_ia32_fConst(node)) && "Need ia32_Const to set type");
+ assert(is_ia32_Cnst(node) && "Need ia32_Const to set type");
assert((type == ia32_Const || type == ia32_SymConst) && "Unsupported ia32_Const type");
attr->data.tp = type;
ia32_attr_t *na = get_ia32_attr(node);
ia32_attr_t *ca = get_ia32_attr(cnst);
- assert((is_ia32_Const(cnst) || is_ia32_fConst(cnst)) && "Need ia32_Const to set Immop attr");
+ assert(is_ia32_Cnst(cnst) && "Need ia32_Const to set Immop attr");
na->tv = ca->tv;
void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst) {
ia32_attr_t *attr = get_ia32_attr(ia32_cnst);
- assert((is_ia32_Const(ia32_cnst) || is_ia32_fConst(ia32_cnst)) && "Need ia32_Const to set Const attr");
+ assert(is_ia32_Cnst(ia32_cnst) && "Need ia32_Const to set Const attr");
switch (get_irn_opcode(cnst)) {
case iro_Const:
- attr->data.tp = ia32_Const;
- attr->tv = get_Const_tarval(cnst);
- attr->cnst = set_cnst_from_tv(attr->cnst, attr->tv);
+ attr->data.tp = ia32_Const;
+ attr->tv = get_Const_tarval(cnst);
+ attr->cnst = set_cnst_from_tv(attr->cnst, attr->tv);
break;
case iro_SymConst:
- attr->data.tp = ia32_SymConst;
- attr->tv = NULL;
- attr->sc = copy_str(attr->sc, get_sc_name(cnst));
- attr->cnst = attr->sc;
+ attr->data.tp = ia32_SymConst;
+ attr->tv = NULL;
+ attr->sc = copy_str(attr->sc, get_sc_name(cnst));
+ attr->cnst = attr->sc;
break;
case iro_Unknown:
assert(0 && "Unknown Const NYI");
return is_ia32_Store(node) || is_ia32_fStore(node);
}
+/**
+ * Checks if node is a Const or fConst.
+ */
+int is_ia32_Cnst(const ir_node *node) {
+ return is_ia32_Const(node) || is_ia32_fConst(node);
+}
+
/**
* Returns the name of the OUT register at position pos.
*/
attr->slots = NULL;
}
- attr->data.n_res;
+ attr->data.n_res = num;
}
/**
*
***************************************************************************************/
+/* default compare operation to compare immediate ops */
+int ia32_compare_immop_attr(ia32_attr_t *a, ia32_attr_t *b) {
+ if (a->data.tp == b->data.tp) {
+ if (! a->cnst || ! b->cnst)
+ return 1;
+
+ return strcmp(a->cnst, b->cnst);
+ }
+
+ return 1;
+}
+
/* Include the generated constructor functions */
#include "gen_ia32_new_nodes.c.inl"