-/**
- * Gets the type of an ia32_Const.
- */
-unsigned get_ia32_Const_type(const ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
-
- assert(is_ia32_Cnst(node) && "Need ia32_Const to get type");
-
- return attr->data.tp;
-}
-
-/**
- * Sets the type of an ia32_Const.
- */
-void set_ia32_Const_type(ir_node *node, int type) {
- ia32_attr_t *attr = get_ia32_attr(node);
-
- 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;
-}
-
-/**
- * Copy the attributes from an ia32_Const to an Immop (Add_i, Sub_i, ...) node
- */
-void set_ia32_Immop_attr(ir_node *node, ir_node *cnst) {
- ia32_attr_t *na = get_ia32_attr(node);
- ia32_attr_t *ca = get_ia32_attr(cnst);
-
- switch(get_ia32_Const_type(cnst)) {
- case ia32_Const:
- na->cnst_val.tv = ca->cnst_val.tv;
- na->cnst = ca->cnst;
- set_ia32_immop_type(node, ia32_ImmConst);
- break;
- case ia32_SymConst:
- na->cnst_val.sc = ca->cnst_val.sc;
- na->cnst = na->cnst_val.sc;
- set_ia32_immop_type(node, ia32_ImmSymConst);
- break;
- default:
- assert(0 && "Need ia32_Const to set Immop attr");
- }
-}
-
-/**
- * Copy the attributes from Immop to an Immop
- */
-void copy_ia32_Immop_attr(ir_node *dst, ir_node *src) {
- ia32_attr_t *da = get_ia32_attr(dst);
- ia32_attr_t *sa = get_ia32_attr(src);
-
- switch(get_ia32_immop_type(src)) {
- case ia32_ImmConst:
- da->cnst_val.tv = sa->cnst_val.tv;
- da->cnst = sa->cnst;
- set_ia32_immop_type(dst, ia32_ImmConst);
- break;
- case ia32_ImmSymConst:
- da->cnst_val.sc = sa->cnst_val.sc;
- da->cnst = sa->cnst;
- set_ia32_immop_type(dst, ia32_ImmSymConst);
- break;
- default:
- assert(0 && "Need Immop to copy Immop attr");
- }
-}
-
-/**
- * Copy the attributes from a Firm Const/SymConst to an ia32_Const
- */
-void set_ia32_Const_attr(ir_node *ia32_cnst, ir_node *cnst) {
- ia32_attr_t *attr = get_ia32_attr(ia32_cnst);
- ir_mode *mode;
-
- 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->cnst_val.tv = get_Const_tarval(cnst);
- mode = get_tarval_mode(attr->cnst_val.tv);
- if (mode_is_reference(mode) &&
- get_mode_null(mode) == attr->cnst_val.tv) {
- attr->cnst_val.tv = get_mode_null(mode_Iu);
- }
- attr->cnst = get_ident_for_tv(attr->cnst_val.tv);
- break;
- case iro_SymConst:
- attr->data.tp = ia32_SymConst;
- attr->cnst_val.sc = get_sc_ident(cnst);
- attr->cnst = attr->cnst_val.sc;
- break;
- case iro_Unknown:
- assert(0 && "Unknown Const NYI");
- break;
- default:
- assert(0 && "Cannot create ia32_Const for this opcode");
- }
-}
-
-/**
- * Sets the AddrMode(S|D) attribute
- */
-void set_ia32_AddrMode(ir_node *node, char direction) {
- ia32_attr_t *attr = get_ia32_attr(node);
-
- switch (direction) {
- case 'D':
- attr->data.tp = ia32_AddrModeD;
- break;
- case 'S':
- attr->data.tp = ia32_AddrModeS;
- break;
- default:
- assert(0 && "wrong AM type");
- }
-}
-
-/**
- * Returns whether or not the node is an immediate operation with Const.
- */
-int is_ia32_ImmConst(const ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
- return (attr->data.imm_tp == ia32_ImmConst);
-}
-
-/**
- * Returns whether or not the node is an immediate operation with SymConst.
- */
-int is_ia32_ImmSymConst(const ir_node *node) {
- ia32_attr_t *attr = get_ia32_attr(node);
- return (attr->data.imm_tp == ia32_ImmSymConst);
-}
-