-/**
- * Returns node's offset as string.
- */
-static const char *node_offset_to_str(ir_node *n)
-{
- return "";
-}
-
-/* We always pass the ir_node which is a pointer. */
-static int mips_get_arg_type(const lc_arg_occ_t *occ) {
- return lc_arg_type_ptr;
-}
-
-
-/**
- * Returns the register at in position pos.
- */
-static const arch_register_t *get_in_reg(ir_node *irn, int pos)
-{
- ir_node *op;
- const arch_register_t *reg = NULL;
-
- assert(get_irn_arity(irn) > pos && "Invalid IN position");
-
- /* The out register of the operator at position pos is the
- in register we need. */
- op = get_irn_n(irn, pos);
-
- reg = arch_get_irn_register(arch_env, op);
-
- assert(reg && "no in register found");
- return reg;
-}
-
-/**
- * Returns the register at out position pos.
- */
-static const arch_register_t *get_out_reg(ir_node *irn, int pos)
-{
- ir_node *proj;
- const arch_register_t *reg = NULL;
-
- /* 1st case: irn is not of mode_T, so it has only */
- /* one OUT register -> good */
- /* 2nd case: irn is of mode_T -> collect all Projs and ask the */
- /* Proj with the corresponding projnum for the register */
-
- if (get_irn_mode(irn) != mode_T) {
- reg = arch_get_irn_register(arch_env, irn);
- }
- else if (is_mips_irn(irn)) {
- reg = get_mips_out_reg(irn, pos);
- }
- else {
- const ir_edge_t *edge;
-
- foreach_out_edge(irn, edge) {
- proj = get_edge_src_irn(edge);
- assert(is_Proj(proj) && "non-Proj from mode_T node");
- if (get_Proj_proj(proj) == pos) {
- reg = arch_get_irn_register(arch_env, proj);
- break;
- }
- }
- }
-
- assert(reg && "no out register found");
- return reg;
-}
-
-/**
- * Returns the number of the in register at position pos.
- */
-int get_mips_reg_nr(ir_node *irn, int pos, int in_out)
-{
- const arch_register_t *reg;
-
- if (in_out == 1) {
- reg = get_in_reg(irn, pos);
- }
- else {
- reg = get_out_reg(irn, pos);
- }
-
- return arch_register_get_index(reg);
-}
-
-/**
- * Returns the name of the in register at position pos.
- */
-const char *get_mips_reg_name(ir_node *irn, int pos, int in_out)
-{
- const arch_register_t *reg;
-
- if (in_out == 1) {
- reg = get_in_reg(irn, pos);
- }
- else {
- reg = get_out_reg(irn, pos);
- }
-
- return arch_register_get_name(reg);
-}
-
-/**
- * Get the register name for a node.
- */
-static int mips_get_reg_name(lc_appendable_t *app,
- const lc_arg_occ_t *occ, const lc_arg_value_t *arg)
-{
- const char *buf;
- int res;
- ir_node *X = arg->v_ptr;
- int nr = occ->width - 1;
-
- if (!X)
- return lc_arg_append(app, occ, "(null)", 6);
-
- if (occ->conversion == 'S') {
- buf = get_mips_reg_name(X, nr, 1);
- }
- else { /* 'D' */
- buf = get_mips_reg_name(X, nr, 0);
- }
-
- res = lc_appendable_chadd(app, '$');
- res += lc_appendable_snadd(app, buf, strlen(buf));
- return res;
-}
-
-/**
- * Returns the tarval or offset of an mips node as a string.
- */
-static int mips_const_to_str(lc_appendable_t *app,
- const lc_arg_occ_t *occ, const lc_arg_value_t *arg)
-{
- const char *buf;
- ir_node *X = arg->v_ptr;
-
- if (!X)
- return lc_arg_append(app, occ, "(null)", 6);
-
- if (occ->conversion == 'C') {
- buf = node_const_to_str(X);
- }
- else { /* 'O' */
- buf = node_offset_to_str(X);
- }
-
- return lc_arg_append(app, occ, buf, strlen(buf));
-}
-
-/**
- * Determines the SSE suffix depending on the mode.
- */
-static int mips_get_mode_suffix(lc_appendable_t *app,
- const lc_arg_occ_t *occ, const lc_arg_value_t *arg)
-{
- ir_node *X = arg->v_ptr;
-
- if (!X)
- return lc_arg_append(app, occ, "(null)", 6);
-
- if (get_mode_size_bits(get_irn_mode(X)) == 32)
- return lc_appendable_chadd(app, 's');
- else
- return lc_appendable_chadd(app, 'd');
-}
-
-/**
- * Return the mips printf arg environment.
- * We use the firm environment with some additional handlers.
- */
-const lc_arg_env_t *mips_get_arg_env(void)