From: Guillaume Emont Date: Tue, 16 Oct 2012 12:17:41 +0000 (+0100) Subject: mips: added rules for loadb, storel, storeb and copyb X-Git-Tag: orc-0.4.17~93 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed6bfd1dea63a9a1acc94a3451ade5247aeafa8e;p=platform%2Fupstream%2Forc.git mips: added rules for loadb, storel, storeb and copyb --- diff --git a/orc/orcmips.c b/orc/orcmips.c index bcffc90..d455b22 100644 --- a/orc/orcmips.c +++ b/orc/orcmips.c @@ -45,6 +45,15 @@ orc_mips_emit_sw (OrcCompiler *compiler, OrcMipsRegister reg, } void +orc_mips_emit_sb (OrcCompiler *compiler, OrcMipsRegister reg, + OrcMipsRegister base, unsigned int offset) +{ + ORC_ASM_CODE (compiler, " sb %s, %d(%s)\n", + orc_mips_reg_name (reg), + offset, orc_mips_reg_name (base)); +} + +void orc_mips_emit_lw (OrcCompiler *compiler, OrcMipsRegister dest, OrcMipsRegister base, unsigned int offset) { @@ -54,6 +63,15 @@ orc_mips_emit_lw (OrcCompiler *compiler, OrcMipsRegister dest, } void +orc_mips_emit_lb (OrcCompiler *compiler, OrcMipsRegister dest, + OrcMipsRegister base, unsigned int offset) +{ + ORC_ASM_CODE (compiler, " lb %s, %d(%s)\n", + orc_mips_reg_name (dest), + offset, orc_mips_reg_name (base)); +} + +void orc_mips_emit_jr (OrcCompiler *compiler, OrcMipsRegister address_reg) { ORC_ASM_CODE (compiler, " jr %s\n", orc_mips_reg_name (address_reg)); diff --git a/orc/orcmips.h b/orc/orcmips.h index f1993a8..313b558 100644 --- a/orc/orcmips.h +++ b/orc/orcmips.h @@ -49,9 +49,12 @@ void orc_mips_emit_nop (OrcCompiler *compiler); void orc_mips_emit_sw (OrcCompiler *compiler, OrcMipsRegister reg, OrcMipsRegister base, unsigned int offset); - +void orc_mips_emit_sb (OrcCompiler *compiler, OrcMipsRegister reg, + OrcMipsRegister base, unsigned int offset); void orc_mips_emit_lw (OrcCompiler *compiler, OrcMipsRegister dest, OrcMipsRegister base, unsigned int offset); +void orc_mips_emit_lb (OrcCompiler *compiler, OrcMipsRegister dest, + OrcMipsRegister base, unsigned int offset); void orc_mips_emit_jr (OrcCompiler *compiler, OrcMipsRegister address_reg); void orc_mips_emit_blez (OrcCompiler *compiler, OrcMipsRegister reg, unsigned int label); diff --git a/orc/orcrules-mips.c b/orc/orcrules-mips.c index d930562..3e1280e 100644 --- a/orc/orcrules-mips.c +++ b/orc/orcrules-mips.c @@ -11,6 +11,15 @@ mips_rule_loadl (OrcCompiler *compiler, void *user, OrcInstruction *insn) } void +mips_rule_loadb (OrcCompiler *compiler, void *user, OrcInstruction *insn) +{ + int src = compiler->vars[insn->src_args[0]].ptr_register; + int dest = compiler->vars[insn->dest_args[0]].alloc; + + orc_mips_emit_lb (compiler, dest, src, 0); +} + +void mips_rule_storel (OrcCompiler *compiler, void *user, OrcInstruction *insn) { int src = compiler->vars[insn->src_args[0]].alloc; @@ -20,6 +29,16 @@ mips_rule_storel (OrcCompiler *compiler, void *user, OrcInstruction *insn) } void +mips_rule_storeb (OrcCompiler *compiler, void *user, OrcInstruction *insn) +{ + int src = compiler->vars[insn->src_args[0]].alloc; + int dest = compiler->vars[insn->dest_args[0]].ptr_register; + + orc_mips_emit_sb (compiler, src, dest, 0); +} + + +void mips_rule_addl (OrcCompiler *compiler, void *user, OrcInstruction *insn) { int src1 = ORC_SRC_ARG (compiler, insn, 0); @@ -39,6 +58,15 @@ mips_rule_copyl (OrcCompiler *compiler, void *user, OrcInstruction *insn) } void +mips_rule_copyb (OrcCompiler *compiler, void *user, OrcInstruction *insn) +{ + int src = ORC_SRC_ARG (compiler, insn, 0); + int dest = ORC_DEST_ARG (compiler, insn, 0); + + orc_mips_emit_move (compiler, dest, src); +} + +void orc_compiler_orc_mips_register_rules (OrcTarget *target) { OrcRuleSet *rule_set; @@ -46,7 +74,10 @@ orc_compiler_orc_mips_register_rules (OrcTarget *target) rule_set = orc_rule_set_new (orc_opcode_set_get("sys"), target, 0); orc_rule_register (rule_set, "loadl", mips_rule_loadl, NULL); - orc_rule_register (rule_set, "storel", mips_rule_storel, NULL); + orc_rule_register (rule_set, "loadb", mips_rule_loadb, NULL); + orc_rule_register (rule_set, "storel", mips_rule_storeb, NULL); + orc_rule_register (rule_set, "storeb", mips_rule_storel, NULL); orc_rule_register (rule_set, "addl", mips_rule_addl, NULL); orc_rule_register (rule_set, "copyl", mips_rule_copyl, NULL); + orc_rule_register (rule_set, "copyb", mips_rule_copyb, NULL); }