#include "firm_common_t.h"
#include "irvrfy_t.h"
#include "irprintf.h"
+#include "iredges.h"
#include "../bearch.h"
* @return The ident of the SymConst
*/
static ident *get_sc_ident(ir_node *symc) {
- entity *ent;
- ir_type *owner;
- ident *id;
+ ir_entity *ent;
+ ir_type *owner;
+ ident *id;
switch (get_SymConst_kind(symc)) {
case symconst_addr_name:
}
fprintf(F, "\n");
+ /* dump AM symconst */
+ if(get_ia32_am_sc(n) != NULL) {
+ fprintf(F, "AM symconst = %s\n", get_id_str(get_ia32_am_sc(n)));
+ }
+
/* dump AM scale */
fprintf(F, "AM scale = %d\n", get_ia32_am_scale(n));
/* dump pn code */
- fprintf(F, "pn_code = %ld\n", get_ia32_pncode(n));
+ fprintf(F, "pn_code = %ld (%s)\n", get_ia32_pncode(n), get_pnc_string(get_ia32_pncode(n)));
/* dump n_res */
fprintf(F, "n_res = %d\n", get_ia32_n_res(n));
}
fprintf(F, "\n");
- fprintf(F, "src_mode = ");
- if (get_ia32_src_mode(n)) {
- ir_fprintf(F, "%+F", get_ia32_src_mode(n));
- }
- else {
- fprintf(F, "n/a");
- }
- fprintf(F, "\n");
-
- fprintf(F, "tgt_mode = ");
- if (get_ia32_tgt_mode(n)) {
- ir_fprintf(F, "%+F", get_ia32_tgt_mode(n));
- }
- else {
- fprintf(F, "n/a");
- }
- fprintf(F, "\n");
-
#ifndef NDEBUG
/* dump original ir node name */
fprintf(F, "orig node = ");
}
/**
- * Gets the addressmode offset as long.
+ * Gets the addressmode offset as int.
*/
int get_ia32_am_offs_int(const ir_node *node) {
ia32_attr_t *attr = get_ia32_attr(node);
return attr->am_offs;
}
+/**
+ * Sets the addressmode offset from an int.
+ */
+void set_ia32_am_offs_int(ir_node *node, int offset) {
+ ia32_attr_t *attr = get_ia32_attr(node);
+ attr->am_offs = offset;
+}
+
/**
* Add an offset for addrmode.
*/
attr->res_mode = mode;
}
-/**
- * Gets the source mode of conversion.
- */
-ir_mode *get_ia32_src_mode(const ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
- return attr->src_mode;
-}
-
-/**
- * Sets the source mode of conversion.
- */
-void set_ia32_src_mode(ir_node *node, ir_mode *mode) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->src_mode = mode;
-}
-
-/**
- * Gets the target mode of conversion.
- */
-ir_mode *get_ia32_tgt_mode(const ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
- return attr->tgt_mode;
-}
-
-/**
- * Sets the target mode of conversion.
- */
-void set_ia32_tgt_mode(ir_node *node, ir_mode *mode) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->tgt_mode = mode;
-}
-
/**
* Gets the frame entity assigned to this node.
*/
-entity *get_ia32_frame_ent(const ir_node *node) {
+ir_entity *get_ia32_frame_ent(const ir_node *node) {
ia32_attr_t *attr = get_ia32_attr(node);
return attr->frame_ent;
}
/**
* Sets the frame entity for this node.
*/
-void set_ia32_frame_ent(ir_node *node, entity *ent) {
+void set_ia32_frame_ent(ir_node *node, ir_entity *ent) {
ia32_attr_t *attr = get_ia32_attr(node);
attr->frame_ent = ent;
- set_ia32_use_frame(node);
+ if(ent != NULL)
+ set_ia32_use_frame(node);
+ else
+ clear_ia32_use_frame(node);
}
memset((void *)attr->slots, 0, n_res * sizeof(attr->slots[0]));
}
+ir_node *get_ia32_result_proj(const ir_node *node)
+{
+ const ir_edge_t *edge;
+
+ foreach_out_edge(node, edge) {
+ ir_node *proj = get_edge_src_irn(edge);
+ if(get_Proj_proj(proj) == 0) {
+ return proj;
+ }
+ }
+ return NULL;
+}
+
+ir_mode *get_ia32_Conv_src_mode(const ir_node *node)
+{
+ if(get_ia32_op_type(node) == ia32_AddrModeS) {
+ return get_ia32_ls_mode(node);
+ }
+
+ return get_irn_mode(get_irn_n(node, 2));
+}
+
+ir_mode *get_ia32_Conv_tgt_mode(const ir_node *node)
+{
+ return get_irn_mode(node);
+}
+
/***************************************************************************************
* _ _ _
* | | | | | |
int ia32_compare_immop_attr(ia32_attr_t *a, ia32_attr_t *b) {
int equ = 0;
- if (a->data.tp == b->data.tp) {
- equ = (a->cnst == b->cnst);
- equ = equ ? (a->data.use_frame == b->data.use_frame) : 0;
+ if (a->data.tp != b->data.tp)
+ return 1;
- if (equ && a->data.use_frame && b->data.use_frame)
- equ = (a->frame_ent == b->frame_ent);
- }
+ if (a->cnst != b->cnst)
+ return 1;
- return !equ;
-}
+ if (a->data.use_frame != b->data.use_frame)
+ return 1;
-/* compare converts */
-int ia32_compare_conv_attr(ia32_attr_t *a, ia32_attr_t *b) {
- int equ = ! ia32_compare_immop_attr(a, b);
+ if (a->data.use_frame && a->frame_ent != b->frame_ent)
+ return 1;
- equ = equ ? (a->src_mode == b->src_mode) && (a->tgt_mode == b->tgt_mode) : equ;
+ if (a->data.am_flavour != b->data.am_flavour
+ || a->data.am_scale != b->data.am_scale
+ || a->data.offs_sign != b->data.offs_sign
+ || a->data.am_sc_sign != b->data.am_sc_sign
+ || a->am_offs != b->am_offs
+ || a->am_sc != b->am_sc)
+ return 1;
+
+ if(a->pn_code != b->pn_code)
+ return 1;
return !equ;
}
-/* Copy attribute function not needed any more, but might be of use later. */
-#if 0
/* copies the ia32 attributes */
static void ia32_copy_attr(const ir_node *old_node, ir_node *new_node) {
- ia32_attr_t *attr_old = get_ia32_attr(old_node);
- ia32_attr_t *attr_new = get_ia32_attr(new_node);
- int n_res = get_ia32_n_res(old_node);
+ ia32_attr_t *attr_old = get_ia32_attr(old_node);
+ ia32_attr_t *attr_new = get_ia32_attr(new_node);
/* copy the attributes */
- memcpy(attr_new, attr_old, sizeof(*attr_new));
+ memcpy(attr_new, attr_old, get_op_attr_size(get_irn_op(old_node)));
+
+ /* copy out flags */
+ DUP_ARR_D(int, get_irg_obstack(get_irn_irg(new_node)), attr_old->out_flags);
}
/**
op->ops.copy_attr = ia32_copy_attr;
}
}
-#endif
/* Include the generated constructor functions */
#include "gen_ia32_new_nodes.c.inl"