+2006-09-09 Aleksey Demakov <ademakov@gmail.com>
+
+ * jit/jit-reg-alloc.h, jit/jit-reg-alloc.c:
+ * tools/gen-rules-parser.y: add _JIT_REGS_CLOBBER_STACK flag and use
+ it in the code genearted for "only" rules instead of the explicit
+ stack top check followed by the _jit_regs_spill_all() call.
+
2006-09-02 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-interp.c (_jit_run_function):
}
if(regs->descs[2].value
- && regs->descs[2].value->in_register
- && regs->descs[2].value->reg == regs->descs[0].reg
- && regs->descs[2].value != regs->descs[1].value)
+ && regs->descs[2].value->in_register
+ && regs->descs[2].value->reg == regs->descs[0].reg
+ && regs->descs[2].value != regs->descs[1].value)
{
if(regs->on_stack && regs->x87_arith)
{
}
/* Choose between pop and no-pop instructions. */
- if(regs->on_stack && regs->x87_arith
- && !regs->no_pop && !regs->clobber_all
- && regs->descs[1].value
- && regs->descs[2].value)
+ if(regs->on_stack && regs->x87_arith && !regs->no_pop
+ && !regs->clobber_all && !regs->clobber_stack
+ && regs->descs[1].value && regs->descs[2].value)
{
/* Determine if we might want to keep either of input values
in registers after the instruction completion. */
int index;
regs->clobber_all = (flags & _JIT_REGS_CLOBBER_ALL) != 0;
+ regs->clobber_stack = (flags & _JIT_REGS_CLOBBER_STACK) != 0;
regs->ternary = (flags & _JIT_REGS_TERNARY) != 0;
regs->branch = (flags & _JIT_REGS_BRANCH) != 0;
regs->copy = (flags & _JIT_REGS_COPY) != 0;
/* Set clobber flags. */
regs->clobber = jit_regused_init;
- if(regs->clobber_all)
+ if(regs->clobber_all || regs->clobber_stack)
{
for(index = 0; index < JIT_NUM_REGS; index++)
{
{
continue;
}
- jit_reg_set_used(regs->clobber, index);
+ if(regs->clobber_all || IS_STACK_REG(index))
+ {
+ jit_reg_set_used(regs->clobber, index);
+ }
}
}
#define _JIT_REGS_COMMUTATIVE 0x0040
#define _JIT_REGS_REVERSIBLE 0x0080
#define _JIT_REGS_FREE_DEST 0x0100
+#define _JIT_REGS_CLOBBER_STACK 0x0200
/*
* Flags for _jit_regs_init_dest(), _jit_regs_init_value1(), and
typedef struct
{
unsigned clobber_all : 1;
+ unsigned clobber_stack : 1;
unsigned ternary : 1;
unsigned branch : 1;
unsigned copy : 1;
static int gensel_reserve_space = 32;
static int gensel_reserve_more_space = 128;
-/*
- * First register in a stack arrangement.
- */
-static int gensel_first_stack_reg = 8; /* st0 under x86 */
-
/*
* Maximal number of input values in a pattern.
*/
printf("\telse\n\t{\n");
}
- if(gensel_search_option(options, GENSEL_OPT_STACK)
- && gensel_search_option(options, GENSEL_OPT_ONLY))
- {
- printf("\t\tif(!_jit_regs_is_top(gen, insn->value1) ||\n");
- printf("\t\t _jit_regs_num_used(gen, %d) != 1)\n",
- gensel_first_stack_reg);
- printf("\t\t{\n");
- printf("\t\t\t_jit_regs_spill_all(gen);\n");
- printf("\t\t}\n");
- }
-
if(gensel_search_option(options, GENSEL_OPT_BINARY_BRANCH)
|| gensel_search_option(options, GENSEL_OPT_UNARY_BRANCH))
{
}
printf("_JIT_REGS_STACK");
}
+ if(gensel_search_option(options, GENSEL_OPT_ONLY))
+ {
+ if(seen_option)
+ {
+ printf(" | ");
+ }
+ else
+ {
+ seen_option = 1;
+ }
+ printf("_JIT_REGS_CLOBBER_STACK");
+ }
if(gensel_search_option(options, GENSEL_OPT_X87ARITH))
{
if(seen_option)