Commit c02bd5d9 by Jan Brittenson

bytecode fixes

From-SVN: r5402
parent e9b7093a
...@@ -120,6 +120,16 @@ struct move_by_pieces ...@@ -120,6 +120,16 @@ struct move_by_pieces
int reverse; int reverse;
}; };
/* Used to generate bytecodes: keep track of size of local variables,
as well as depth of arithmetic stack. (Notice that variables are
stored on the machine's stack, not the arithmetic stack.) */
int local_vars_size;
extern int stack_depth;
extern int max_stack_depth;
struct obstack permanent_obstack;
static rtx enqueue_insn PROTO((rtx, rtx)); static rtx enqueue_insn PROTO((rtx, rtx));
static int queued_subexp_p PROTO((rtx)); static int queued_subexp_p PROTO((rtx));
static void init_queue PROTO((void)); static void init_queue PROTO((void));
...@@ -5754,11 +5764,17 @@ bc_expand_expr (exp) ...@@ -5754,11 +5764,17 @@ bc_expand_expr (exp)
case REAL_CST: case REAL_CST:
#if 0
#ifdef DEBUG_PRINT_CODE #ifdef DEBUG_PRINT_CODE
fprintf (stderr, " [%g]\n", (double) TREE_INT_CST_LOW (exp)); fprintf (stderr, " [%g]\n", (double) TREE_INT_CST_LOW (exp));
#endif #endif
/* FIX THIS: find a better way to pass real_cst's. -bson */
bc_emit_instruction (mode_to_const_map[TYPE_MODE (TREE_TYPE (exp))], bc_emit_instruction (mode_to_const_map[TYPE_MODE (TREE_TYPE (exp))],
(double) TREE_REAL_CST (exp)); (double) TREE_REAL_CST (exp));
#else
abort ();
#endif
return; return;
case CALL_EXPR: case CALL_EXPR:
...@@ -5875,7 +5891,7 @@ bc_expand_expr (exp) ...@@ -5875,7 +5891,7 @@ bc_expand_expr (exp)
case MODIFY_EXPR: case MODIFY_EXPR:
expand_assignment (TREE_TYPE (exp), TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1)); expand_assignment (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), 0, 0);
return; return;
case ADDR_EXPR: case ADDR_EXPR:
...@@ -5914,7 +5930,7 @@ bc_expand_expr (exp) ...@@ -5914,7 +5930,7 @@ bc_expand_expr (exp)
bc_expand_expr (TREE_OPERAND (exp, 0)); bc_expand_expr (TREE_OPERAND (exp, 0));
bc_expand_truth_conversion (TREE_TYPE (TREE_OPERAND (exp, 0))); bc_expand_truth_conversion (TREE_TYPE (TREE_OPERAND (exp, 0)));
lab = bc_get_bytecode_label (); lab = bc_get_bytecode_label ();
bc_emit_bytecode (jumpifnot); bc_emit_bytecode (xjumpifnot);
bc_emit_bytecode_labelref (lab); bc_emit_bytecode_labelref (lab);
#ifdef DEBUG_PRINT_CODE #ifdef DEBUG_PRINT_CODE
...@@ -5936,12 +5952,12 @@ bc_expand_expr (exp) ...@@ -5936,12 +5952,12 @@ bc_expand_expr (exp)
case TRUTH_ANDIF_EXPR: case TRUTH_ANDIF_EXPR:
opcode = jumpifnot; opcode = xjumpifnot;
goto andorif; goto andorif;
case TRUTH_ORIF_EXPR: case TRUTH_ORIF_EXPR:
opcode = jumpif; opcode = xjumpif;
goto andorif; goto andorif;
case PLUS_EXPR: case PLUS_EXPR:
...@@ -6186,10 +6202,10 @@ bc_expand_expr (exp) ...@@ -6186,10 +6202,10 @@ bc_expand_expr (exp)
bc_expand_conversion (TREE_TYPE (TREE_OPERAND (exp, 1)), type); bc_expand_conversion (TREE_TYPE (TREE_OPERAND (exp, 1)), type);
/* Push the address of the lvalue */ /* Push the address of the lvalue */
expand_expr (build1 (ADDR_EXPR, TYPE_POINTER_TO (type), TREE_OPERAND (exp, 0))); bc_expand_expr (build1 (ADDR_EXPR, TYPE_POINTER_TO (type), TREE_OPERAND (exp, 0)));
/* Perform actual increment */ /* Perform actual increment */
expand_increment (incroptab, type); bc_expand_increment (incroptab, type);
return; return;
} }
...@@ -7634,7 +7650,10 @@ expand_increment (exp, post) ...@@ -7634,7 +7650,10 @@ expand_increment (exp, post)
int single_insn = 0; int single_insn = 0;
if (output_bytecode) if (output_bytecode)
return bc_expand_increment (exp, post); {
bc_expand_expr (exp);
return NULL_RTX;
}
/* Stabilize any component ref that might need to be /* Stabilize any component ref that might need to be
evaluated more than once below. */ evaluated more than once below. */
...@@ -9198,7 +9217,7 @@ bc_expand_component_address (exp) ...@@ -9198,7 +9217,7 @@ bc_expand_component_address (exp)
break; break;
} }
expand_expr (tem); bc_expand_expr (tem);
/* For bitfields also push their offset and size */ /* For bitfields also push their offset and size */
......
...@@ -2516,10 +2516,14 @@ output_constant_def_contents (exp, reloc, labelno) ...@@ -2516,10 +2516,14 @@ output_constant_def_contents (exp, reloc, labelno)
if (align > BITS_PER_UNIT) if (align > BITS_PER_UNIT)
{ {
if (!output_bytecode) if (!output_bytecode)
{
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
}
else else
{
BC_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); BC_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
} }
}
/* Output the label itself. */ /* Output the label itself. */
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno); ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno);
...@@ -3613,6 +3617,8 @@ output_constructor (exp, size) ...@@ -3613,6 +3617,8 @@ output_constructor (exp, size)
} }
#ifdef HANDLE_SYSV_PRAGMA
/* Output asm to handle ``#pragma weak'' */ /* Output asm to handle ``#pragma weak'' */
void void
handle_pragma_weak (what, asm_out_file, name, value) handle_pragma_weak (what, asm_out_file, name, value)
...@@ -3650,3 +3656,5 @@ handle_pragma_weak (what, asm_out_file, name, value) ...@@ -3650,3 +3656,5 @@ handle_pragma_weak (what, asm_out_file, name, value)
else if (! (what == ps_done || what == ps_start)) else if (! (what == ps_done || what == ps_start))
warning ("malformed `#pragma weak'"); warning ("malformed `#pragma weak'");
} }
#endif /* HANDLE_SYSV_PRAGMA */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment