Commit 4fac67ac authored by David Schleef's avatar David Schleef

hacking

parent 522a57e4
...@@ -28,7 +28,7 @@ orc_compiler_allocate_codemem (OrcCompiler *compiler) ...@@ -28,7 +28,7 @@ orc_compiler_allocate_codemem (OrcCompiler *compiler)
fd = mkstemp (filename); fd = mkstemp (filename);
if (fd == -1) { if (fd == -1) {
/* FIXME oh crap */ /* FIXME oh crap */
ORC_PROGRAM_ERROR (compiler, "failed to create temp file"); ORC_COMPILER_ERROR (compiler, "failed to create temp file");
return; return;
} }
unlink (filename); unlink (filename);
...@@ -37,12 +37,12 @@ orc_compiler_allocate_codemem (OrcCompiler *compiler) ...@@ -37,12 +37,12 @@ orc_compiler_allocate_codemem (OrcCompiler *compiler)
compiler->program->code = mmap (NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); compiler->program->code = mmap (NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (compiler->program->code == MAP_FAILED) { if (compiler->program->code == MAP_FAILED) {
ORC_PROGRAM_ERROR(compiler, "failed to create write map"); ORC_COMPILER_ERROR(compiler, "failed to create write map");
return; return;
} }
compiler->program->code_exec = mmap (NULL, SIZE, PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0); compiler->program->code_exec = mmap (NULL, SIZE, PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0);
if (compiler->program->code_exec == MAP_FAILED) { if (compiler->program->code_exec == MAP_FAILED) {
ORC_PROGRAM_ERROR(compiler, "failed to create exec map"); ORC_COMPILER_ERROR(compiler, "failed to create exec map");
return; return;
} }
......
...@@ -58,7 +58,9 @@ orc_compiler_allocate_register (OrcCompiler *compiler, int data_reg) ...@@ -58,7 +58,9 @@ orc_compiler_allocate_register (OrcCompiler *compiler, int data_reg)
} }
} }
/* FIXME on !x86, this is an error */
ORC_ERROR ("register overflow"); ORC_ERROR ("register overflow");
return 0; return 0;
} }
...@@ -168,7 +170,7 @@ orc_compiler_check_sizes (OrcCompiler *compiler) ...@@ -168,7 +170,7 @@ orc_compiler_check_sizes (OrcCompiler *compiler)
for(j=0;j<ORC_STATIC_OPCODE_N_DEST;j++){ for(j=0;j<ORC_STATIC_OPCODE_N_DEST;j++){
if (opcode->dest_size[j] == 0) continue; if (opcode->dest_size[j] == 0) continue;
if (opcode->dest_size[j] != compiler->vars[insn->dest_args[j]].size) { if (opcode->dest_size[j] != compiler->vars[insn->dest_args[j]].size) {
ORC_PROGRAM_ERROR(compiler, "size mismatch, opcode %s dest[%d] is %d should be %d", ORC_COMPILER_ERROR(compiler, "size mismatch, opcode %s dest[%d] is %d should be %d",
opcode->name, j, compiler->vars[insn->dest_args[j]].size, opcode->name, j, compiler->vars[insn->dest_args[j]].size,
opcode->dest_size[j]); opcode->dest_size[j]);
return; return;
...@@ -178,7 +180,7 @@ orc_compiler_check_sizes (OrcCompiler *compiler) ...@@ -178,7 +180,7 @@ orc_compiler_check_sizes (OrcCompiler *compiler)
if (opcode->src_size[j] == 0) continue; if (opcode->src_size[j] == 0) continue;
if (opcode->src_size[j] != compiler->vars[insn->src_args[j]].size && if (opcode->src_size[j] != compiler->vars[insn->src_args[j]].size &&
compiler->vars[insn->src_args[j]].vartype != ORC_VAR_TYPE_PARAM) { compiler->vars[insn->src_args[j]].vartype != ORC_VAR_TYPE_PARAM) {
ORC_PROGRAM_ERROR(compiler, "size mismatch, opcode %s src[%d] is %d should be %d", ORC_COMPILER_ERROR(compiler, "size mismatch, opcode %s src[%d] is %d should be %d",
opcode->name, j, compiler->vars[insn->src_args[j]].size, opcode->name, j, compiler->vars[insn->src_args[j]].size,
opcode->src_size[j]); opcode->src_size[j]);
return; return;
...@@ -199,7 +201,7 @@ orc_compiler_assign_rules (OrcCompiler *compiler) ...@@ -199,7 +201,7 @@ orc_compiler_assign_rules (OrcCompiler *compiler)
compiler->target_flags); compiler->target_flags);
if (insn->rule == NULL || insn->rule->emit == NULL) { if (insn->rule == NULL || insn->rule->emit == NULL) {
ORC_PROGRAM_ERROR(compiler, "No rule for: %s", insn->opcode->name); ORC_COMPILER_ERROR(compiler, "No rule for: %s", insn->opcode->name);
return; return;
} }
} }
...@@ -226,7 +228,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler) ...@@ -226,7 +228,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler)
var = insn->src_args[k]; var = insn->src_args[k];
#if 0 #if 0
if (compiler->vars[var].vartype == ORC_VAR_TYPE_DEST) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_DEST) {
ORC_PROGRAM_ERROR(compiler, "using dest var as source"); ORC_COMPILER_ERROR(compiler, "using dest var as source");
} }
#endif #endif
...@@ -238,7 +240,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler) ...@@ -238,7 +240,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler)
if (!compiler->vars[var].used) { if (!compiler->vars[var].used) {
if (compiler->vars[var].vartype == ORC_VAR_TYPE_TEMP) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_TEMP) {
ORC_PROGRAM_ERROR(compiler, "using uninitialized temp var"); ORC_COMPILER_ERROR(compiler, "using uninitialized temp var");
} }
compiler->vars[var].used = TRUE; compiler->vars[var].used = TRUE;
compiler->vars[var].first_use = j; compiler->vars[var].first_use = j;
...@@ -252,21 +254,21 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler) ...@@ -252,21 +254,21 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler)
var = insn->dest_args[k]; var = insn->dest_args[k];
if (compiler->vars[var].vartype == ORC_VAR_TYPE_SRC) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_SRC) {
ORC_PROGRAM_ERROR(compiler,"using src var as dest"); ORC_COMPILER_ERROR(compiler,"using src var as dest");
} }
if (compiler->vars[var].vartype == ORC_VAR_TYPE_CONST) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_CONST) {
ORC_PROGRAM_ERROR(compiler,"using const var as dest"); ORC_COMPILER_ERROR(compiler,"using const var as dest");
} }
if (compiler->vars[var].vartype == ORC_VAR_TYPE_PARAM) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_PARAM) {
ORC_PROGRAM_ERROR(compiler,"using param var as dest"); ORC_COMPILER_ERROR(compiler,"using param var as dest");
} }
if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) { if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) {
if (compiler->vars[var].vartype != ORC_VAR_TYPE_ACCUMULATOR) { if (compiler->vars[var].vartype != ORC_VAR_TYPE_ACCUMULATOR) {
ORC_PROGRAM_ERROR(compiler,"accumulating opcode to non-accumulator dest"); ORC_COMPILER_ERROR(compiler,"accumulating opcode to non-accumulator dest");
} }
} else { } else {
if (compiler->vars[var].vartype == ORC_VAR_TYPE_ACCUMULATOR) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_ACCUMULATOR) {
ORC_PROGRAM_ERROR(compiler,"non-accumulating opcode to accumulator dest"); ORC_COMPILER_ERROR(compiler,"non-accumulating opcode to accumulator dest");
} }
} }
...@@ -282,7 +284,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler) ...@@ -282,7 +284,7 @@ orc_compiler_rewrite_vars (OrcCompiler *compiler)
} else { } else {
#if 0 #if 0
if (compiler->vars[var].vartype == ORC_VAR_TYPE_DEST) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_DEST) {
ORC_PROGRAM_ERROR(compiler,"writing dest more than once"); ORC_COMPILER_ERROR(compiler,"writing dest more than once");
} }
#endif #endif
if (compiler->vars[var].vartype == ORC_VAR_TYPE_TEMP) { if (compiler->vars[var].vartype == ORC_VAR_TYPE_TEMP) {
...@@ -332,7 +334,7 @@ orc_compiler_global_reg_alloc (OrcCompiler *compiler) ...@@ -332,7 +334,7 @@ orc_compiler_global_reg_alloc (OrcCompiler *compiler)
case ORC_VAR_TYPE_TEMP: case ORC_VAR_TYPE_TEMP:
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad vartype"); ORC_COMPILER_ERROR(compiler, "bad vartype");
break; break;
} }
} }
......
...@@ -190,7 +190,7 @@ arm_emit_load_src (OrcCompiler *compiler, OrcVariable *var) ...@@ -190,7 +190,7 @@ arm_emit_load_src (OrcCompiler *compiler, OrcVariable *var)
//arm_emit_mov_memoffset_arm (compiler, 16, 0, ptr_reg, var->alloc); //arm_emit_mov_memoffset_arm (compiler, 16, 0, ptr_reg, var->alloc);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size %d\n", var->size << compiler->loop_shift); ORC_COMPILER_ERROR(compiler, "bad size %d\n", var->size << compiler->loop_shift);
} }
} }
...@@ -228,7 +228,7 @@ arm_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -228,7 +228,7 @@ arm_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
// var->is_aligned, var->is_uncached); // var->is_aligned, var->is_uncached);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size %d\n", var->size << compiler->loop_shift); ORC_COMPILER_ERROR(compiler, "bad size %d\n", var->size << compiler->loop_shift);
} }
} }
......
...@@ -110,7 +110,7 @@ mmx_load_constants (OrcCompiler *compiler) ...@@ -110,7 +110,7 @@ mmx_load_constants (OrcCompiler *compiler)
(int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), compiler->exec_reg, (int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), compiler->exec_reg,
compiler->vars[i].ptr_register); compiler->vars[i].ptr_register);
} else { } else {
ORC_PROGRAM_ERROR(compiler, "unimplemented"); ORC_COMPILER_ERROR(compiler, "unimplemented");
} }
break; break;
default: default:
...@@ -142,7 +142,7 @@ orc_mmx_emit_load_src (OrcCompiler *compiler, OrcVariable *var) ...@@ -142,7 +142,7 @@ orc_mmx_emit_load_src (OrcCompiler *compiler, OrcVariable *var)
orc_x86_emit_mov_memoffset_mmx (compiler, 8, 0, ptr_reg, var->alloc); orc_x86_emit_mov_memoffset_mmx (compiler, 8, 0, ptr_reg, var->alloc);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
} }
} }
...@@ -161,7 +161,7 @@ mmx_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -161,7 +161,7 @@ mmx_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
case 0: case 0:
/* FIXME we might be using ecx twice here */ /* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) { if (ptr_reg == X86_ECX) {
ORC_PROGRAM_ERROR(compiler, "unimplemented"); ORC_COMPILER_ERROR(compiler, "unimplemented");
} }
orc_x86_emit_mov_mmx_reg (compiler, var->alloc, X86_ECX); orc_x86_emit_mov_mmx_reg (compiler, var->alloc, X86_ECX);
orc_x86_emit_mov_reg_memoffset (compiler, 2, X86_ECX, 0, ptr_reg); orc_x86_emit_mov_reg_memoffset (compiler, 2, X86_ECX, 0, ptr_reg);
...@@ -173,7 +173,7 @@ mmx_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -173,7 +173,7 @@ mmx_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
orc_x86_emit_mov_mmx_memoffset (compiler, 8, var->alloc, 0, ptr_reg); orc_x86_emit_mov_mmx_memoffset (compiler, 8, var->alloc, 0, ptr_reg);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "unimplemented"); ORC_COMPILER_ERROR(compiler, "unimplemented");
} }
} }
......
...@@ -406,7 +406,7 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg) ...@@ -406,7 +406,7 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg)
powerpc_emit_VX(p, 0x1000020c, powerpc_emit_VX(p, 0x1000020c,
powerpc_regnum(reg), value & 0x1f, 0); powerpc_regnum(reg), value & 0x1f, 0);
} else { } else {
ORC_PROGRAM_ERROR(p,"can't load constant"); ORC_COMPILER_ERROR(p,"can't load constant");
} }
break; break;
case ORC_CONST_SPLAT_W: case ORC_CONST_SPLAT_W:
...@@ -416,7 +416,7 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg) ...@@ -416,7 +416,7 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg)
powerpc_emit_VX(p, 0x1000024c, powerpc_emit_VX(p, 0x1000024c,
powerpc_regnum(reg), value & 0x1f, 0); powerpc_regnum(reg), value & 0x1f, 0);
} else { } else {
ORC_PROGRAM_ERROR(p,"can't load constant"); ORC_COMPILER_ERROR(p,"can't load constant");
} }
break; break;
case ORC_CONST_SPLAT_L: case ORC_CONST_SPLAT_L:
...@@ -426,11 +426,11 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg) ...@@ -426,11 +426,11 @@ powerpc_load_constant (OrcCompiler *p, int i, int reg)
powerpc_emit_VX(p, 0x1000028c, powerpc_emit_VX(p, 0x1000028c,
powerpc_regnum(reg), value & 0x1f, 0); powerpc_regnum(reg), value & 0x1f, 0);
} else { } else {
ORC_PROGRAM_ERROR(p,"can't load constant"); ORC_COMPILER_ERROR(p,"can't load constant");
} }
break; break;
default: default:
ORC_PROGRAM_ERROR(p,"unhandled"); ORC_COMPILER_ERROR(p,"unhandled");
break; break;
} }
#endif #endif
...@@ -884,7 +884,7 @@ powerpc_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \ ...@@ -884,7 +884,7 @@ powerpc_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \
{ \ { \
if (p->vars[insn->src_args[1]].vartype != ORC_VAR_TYPE_CONST && \ if (p->vars[insn->src_args[1]].vartype != ORC_VAR_TYPE_CONST && \
p->vars[insn->src_args[1]].vartype != ORC_VAR_TYPE_PARAM) { \ p->vars[insn->src_args[1]].vartype != ORC_VAR_TYPE_PARAM) { \
ORC_PROGRAM_ERROR(p,"rule only works with constants or params"); \ ORC_COMPILER_ERROR(p,"rule only works with constants or params"); \
} \ } \
ORC_ASM_CODE(p," " opcode " %s, %s, %s\n", \ ORC_ASM_CODE(p," " opcode " %s, %s, %s\n", \
powerpc_get_regname(p->vars[insn->dest_args[0]].alloc), \ powerpc_get_regname(p->vars[insn->dest_args[0]].alloc), \
......
...@@ -72,7 +72,6 @@ orc_compiler_sse_init (OrcCompiler *compiler) ...@@ -72,7 +72,6 @@ orc_compiler_sse_init (OrcCompiler *compiler)
for(i=ORC_GP_REG_BASE;i<ORC_GP_REG_BASE+16;i++){ for(i=ORC_GP_REG_BASE;i<ORC_GP_REG_BASE+16;i++){
compiler->valid_regs[i] = 1; compiler->valid_regs[i] = 1;
} }
compiler->valid_regs[X86_ECX] = 0;
compiler->valid_regs[X86_EDI] = 0; compiler->valid_regs[X86_EDI] = 0;
compiler->valid_regs[X86_ESP] = 0; compiler->valid_regs[X86_ESP] = 0;
for(i=X86_XMM0;i<X86_XMM0+16;i++){ for(i=X86_XMM0;i<X86_XMM0+16;i++){
...@@ -88,7 +87,6 @@ orc_compiler_sse_init (OrcCompiler *compiler) ...@@ -88,7 +87,6 @@ orc_compiler_sse_init (OrcCompiler *compiler)
for(i=ORC_GP_REG_BASE;i<ORC_GP_REG_BASE+8;i++){ for(i=ORC_GP_REG_BASE;i<ORC_GP_REG_BASE+8;i++){
compiler->valid_regs[i] = 1; compiler->valid_regs[i] = 1;
} }
compiler->valid_regs[X86_ECX] = 0;
compiler->valid_regs[X86_ESP] = 0; compiler->valid_regs[X86_ESP] = 0;
if (compiler->use_frame_pointer) { if (compiler->use_frame_pointer) {
compiler->valid_regs[X86_EBP] = 0; compiler->valid_regs[X86_EBP] = 0;
...@@ -111,6 +109,9 @@ orc_compiler_sse_init (OrcCompiler *compiler) ...@@ -111,6 +109,9 @@ orc_compiler_sse_init (OrcCompiler *compiler)
compiler->tmpreg = X86_XMM0; compiler->tmpreg = X86_XMM0;
compiler->valid_regs[compiler->tmpreg] = 0; compiler->valid_regs[compiler->tmpreg] = 0;
compiler->gp_tmpreg = X86_ECX;
compiler->valid_regs[compiler->gp_tmpreg] = 0;
if (compiler->is_64bit) { if (compiler->is_64bit) {
compiler->exec_reg = X86_EDI; compiler->exec_reg = X86_EDI;
} else { } else {
...@@ -141,7 +142,7 @@ orc_compiler_sse_init (OrcCompiler *compiler) ...@@ -141,7 +142,7 @@ orc_compiler_sse_init (OrcCompiler *compiler)
break; break;
} }
compiler->long_jumps = FALSE; compiler->long_jumps = TRUE;
} }
void void
...@@ -220,7 +221,7 @@ sse_load_constants (OrcCompiler *compiler) ...@@ -220,7 +221,7 @@ sse_load_constants (OrcCompiler *compiler)
orc_sse_emit_loadil (compiler, compiler->vars[i].alloc, orc_sse_emit_loadil (compiler, compiler->vars[i].alloc,
(int)compiler->vars[i].value); (int)compiler->vars[i].value);
} else { } else {
ORC_PROGRAM_ERROR(compiler, "unimplemented"); ORC_COMPILER_ERROR(compiler, "unimplemented");
} }
break; break;
case ORC_VAR_TYPE_PARAM: case ORC_VAR_TYPE_PARAM:
...@@ -233,7 +234,7 @@ sse_load_constants (OrcCompiler *compiler) ...@@ -233,7 +234,7 @@ sse_load_constants (OrcCompiler *compiler)
} else if (compiler->vars[i].size == 8) { } else if (compiler->vars[i].size == 8) {
orc_sse_emit_loadpq (compiler, compiler->vars[i].alloc, i); orc_sse_emit_loadpq (compiler, compiler->vars[i].alloc, i);
} else { } else {
ORC_PROGRAM_ERROR(compiler, "unimplemented"); ORC_COMPILER_ERROR(compiler, "unimplemented");
} }
break; break;
case ORC_VAR_TYPE_SRC: case ORC_VAR_TYPE_SRC:
...@@ -243,7 +244,7 @@ sse_load_constants (OrcCompiler *compiler) ...@@ -243,7 +244,7 @@ sse_load_constants (OrcCompiler *compiler)
(int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), compiler->exec_reg, (int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), compiler->exec_reg,
compiler->vars[i].ptr_register); compiler->vars[i].ptr_register);
} else { } else {
ORC_PROGRAM_ERROR(compiler,"unimplemented"); ORC_COMPILER_ERROR(compiler,"unimplemented");
} }
break; break;
case ORC_VAR_TYPE_ACCUMULATOR: case ORC_VAR_TYPE_ACCUMULATOR:
...@@ -259,7 +260,7 @@ sse_load_constants (OrcCompiler *compiler) ...@@ -259,7 +260,7 @@ sse_load_constants (OrcCompiler *compiler)
case ORC_VAR_TYPE_TEMP: case ORC_VAR_TYPE_TEMP:
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler,"bad vartype"); ORC_COMPILER_ERROR(compiler,"bad vartype");
break; break;
} }
} }
...@@ -301,7 +302,7 @@ orc_sse_emit_load_src (OrcCompiler *compiler, OrcVariable *var) ...@@ -301,7 +302,7 @@ orc_sse_emit_load_src (OrcCompiler *compiler, OrcVariable *var)
var->is_aligned); var->is_aligned);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler,"bad load size %d", ORC_COMPILER_ERROR(compiler,"bad load size %d",
var->size << compiler->loop_shift); var->size << compiler->loop_shift);
break; break;
} }
...@@ -322,7 +323,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -322,7 +323,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
case 1: case 1:
/* FIXME we might be using ecx twice here */ /* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) { if (ptr_reg == X86_ECX) {
ORC_PROGRAM_ERROR(compiler,"unimplemented"); ORC_COMPILER_ERROR(compiler,"unimplemented");
} }
orc_x86_emit_mov_sse_reg (compiler, var->alloc, X86_ECX); orc_x86_emit_mov_sse_reg (compiler, var->alloc, X86_ECX);
orc_x86_emit_mov_reg_memoffset (compiler, 1, X86_ECX, 0, ptr_reg); orc_x86_emit_mov_reg_memoffset (compiler, 1, X86_ECX, 0, ptr_reg);
...@@ -330,7 +331,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -330,7 +331,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
case 2: case 2:
/* FIXME we might be using ecx twice here */ /* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) { if (ptr_reg == X86_ECX) {
ORC_PROGRAM_ERROR(compiler,"unimplemented"); ORC_COMPILER_ERROR(compiler,"unimplemented");
} }
orc_x86_emit_mov_sse_reg (compiler, var->alloc, X86_ECX); orc_x86_emit_mov_sse_reg (compiler, var->alloc, X86_ECX);
orc_x86_emit_mov_reg_memoffset (compiler, 2, X86_ECX, 0, ptr_reg); orc_x86_emit_mov_reg_memoffset (compiler, 2, X86_ECX, 0, ptr_reg);
...@@ -348,7 +349,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var) ...@@ -348,7 +349,7 @@ orc_sse_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
var->is_aligned, var->is_uncached); var->is_aligned, var->is_uncached);
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler,"bad size"); ORC_COMPILER_ERROR(compiler,"bad size");
break; break;
} }
} }
...@@ -359,7 +360,7 @@ get_align_var (OrcCompiler *compiler) ...@@ -359,7 +360,7 @@ get_align_var (OrcCompiler *compiler)
if (compiler->vars[ORC_VAR_D1].size) return ORC_VAR_D1; if (compiler->vars[ORC_VAR_D1].size) return ORC_VAR_D1;
if (compiler->vars[ORC_VAR_S1].size) return ORC_VAR_S1; if (compiler->vars[ORC_VAR_S1].size) return ORC_VAR_S1;
ORC_PROGRAM_ERROR(compiler, "could not find alignment variable"); ORC_COMPILER_ERROR(compiler, "could not find alignment variable");
return -1; return -1;
} }
...@@ -574,7 +575,7 @@ orc_sse_emit_loop (OrcCompiler *compiler) ...@@ -574,7 +575,7 @@ orc_sse_emit_loop (OrcCompiler *compiler)
} }
rule->emit (compiler, rule->emit_user, insn); rule->emit (compiler, rule->emit_user, insn);
} else { } else {
ORC_PROGRAM_ERROR(compiler,"No rule for: %s", opcode->name); ORC_COMPILER_ERROR(compiler,"No rule for: %s", opcode->name);
} }
for(k=0;k<ORC_STATIC_OPCODE_N_DEST;k++){ for(k=0;k<ORC_STATIC_OPCODE_N_DEST;k++){
......
...@@ -24,7 +24,7 @@ typedef void (*OrcRuleEmitFunc)(OrcCompiler *p, void *user, OrcInstruction *insn ...@@ -24,7 +24,7 @@ typedef void (*OrcRuleEmitFunc)(OrcCompiler *p, void *user, OrcInstruction *insn
#define ORC_N_REGS (32*4) #define ORC_N_REGS (32*4)
#define ORC_N_INSNS 100 #define ORC_N_INSNS 100
#define ORC_N_VARIABLES 40 #define ORC_N_VARIABLES 64
#define ORC_N_REGISTERS 20 #define ORC_N_REGISTERS 20
#define ORC_N_FIXUPS 20 #define ORC_N_FIXUPS 20
#define ORC_N_CONSTANTS 20 #define ORC_N_CONSTANTS 20
...@@ -67,6 +67,7 @@ typedef void (*OrcRuleEmitFunc)(OrcCompiler *p, void *user, OrcInstruction *insn ...@@ -67,6 +67,7 @@ typedef void (*OrcRuleEmitFunc)(OrcCompiler *p, void *user, OrcInstruction *insn
#define ORC_COMPILER_ERROR(compiler, ...) do { \ #define ORC_COMPILER_ERROR(compiler, ...) do { \
compiler->error = TRUE; \ compiler->error = TRUE; \
compiler->result = ORC_COMPILE_RESULT_UNKNOWN_PARSE; \
orc_debug_print(ORC_DEBUG_ERROR, __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \ orc_debug_print(ORC_DEBUG_ERROR, __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \
} while (0) } while (0)
...@@ -136,7 +137,14 @@ enum { ...@@ -136,7 +137,14 @@ enum {
ORC_VAR_T5, ORC_VAR_T5,
ORC_VAR_T6, ORC_VAR_T6,
ORC_VAR_T7, ORC_VAR_T7,
ORC_VAR_T8 ORC_VAR_T8,
ORC_VAR_T9,
ORC_VAR_T10,
ORC_VAR_T11,
ORC_VAR_T12,
ORC_VAR_T13,
ORC_VAR_T14,
ORC_VAR_T15
}; };
enum { enum {
...@@ -149,16 +157,17 @@ enum { ...@@ -149,16 +157,17 @@ enum {
typedef enum { typedef enum {
ORC_COMPILE_RESULT_OK = 0, ORC_COMPILE_RESULT_OK = 0,
ORC_COMPILE_RESULT_UNKNOWN_PARSE = 0x100, ORC_COMPILE_RESULT_UNKNOWN_COMPILE = 0x100,
ORC_COMPILE_RESULT_PARSE = 0x101, ORC_COMPILE_RESULT_MISSING_RULE = 0x101,
ORC_COMPILE_RESULT_VARIABLE = 0x102,
ORC_COMPILE_RESULT_UNKNOWN_PARSE = 0x200,
ORC_COMPILE_RESULT_PARSE = 0x201,
ORC_COMPILE_RESULT_VARIABLE = 0x202
ORC_COMPILE_RESULT_UNKNOWN_COMPILE = 0x200,
ORC_COMPILE_RESULT_MISSING_RULE = 0x201
} OrcCompileResult; } OrcCompileResult;
#define ORC_COMPILE_RESULT_IS_SUCCESSFUL(x) ((x) < 0x100) #define ORC_COMPILE_RESULT_IS_SUCCESSFUL(x) ((x) < 0x100)
#define ORC_COMPILE_RESULT_IS_FATAL(x) ((x) < 0x200) #define ORC_COMPILE_RESULT_IS_FATAL(x) ((x) >= 0x200)
struct _OrcVariable { struct _OrcVariable {
char *name; char *name;
......
...@@ -478,7 +478,7 @@ sse_rule_shift (OrcCompiler *p, void *user, OrcInstruction *insn) ...@@ -478,7 +478,7 @@ sse_rule_shift (OrcCompiler *p, void *user, OrcInstruction *insn)
*p->codeptr++ = reg_code[type]; *p->codeptr++ = reg_code[type];
orc_x86_emit_modrm_reg (p, p->tmpreg, p->vars[insn->dest_args[0]].alloc); orc_x86_emit_modrm_reg (p, p->tmpreg, p->vars[insn->dest_args[0]].alloc);
} else { } else {
ORC_PROGRAM_ERROR(p,"rule only works with constants or params"); ORC_COMPILER_ERROR(p,"rule only works with constants or params");
} }
} }
......
...@@ -141,7 +141,7 @@ orc_x86_emit_push (OrcCompiler *compiler, int size, int reg) ...@@ -141,7 +141,7 @@ orc_x86_emit_push (OrcCompiler *compiler, int size, int reg)
{ {
if (size == 1) { if (size == 1) {
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
} else if (size == 2) { } else if (size == 2) {
ORC_ASM_CODE(compiler," pushw %%%s\n", orc_x86_get_regname_16(reg)); ORC_ASM_CODE(compiler," pushw %%%s\n", orc_x86_get_regname_16(reg));
*compiler->codeptr++ = 0x66; *compiler->codeptr++ = 0x66;
...@@ -157,7 +157,7 @@ orc_x86_emit_pop (OrcCompiler *compiler, int size, int reg) ...@@ -157,7 +157,7 @@ orc_x86_emit_pop (OrcCompiler *compiler, int size, int reg)
{ {
if (size == 1) { if (size == 1) {
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
} else if (size == 2) { } else if (size == 2) {
ORC_ASM_CODE(compiler," popw %%%s\n", orc_x86_get_regname_16(reg)); ORC_ASM_CODE(compiler," popw %%%s\n", orc_x86_get_regname_16(reg));
*compiler->codeptr++ = 0x66; *compiler->codeptr++ = 0x66;
...@@ -248,7 +248,7 @@ orc_x86_emit_mov_memoffset_reg (OrcCompiler *compiler, int size, int offset, ...@@ -248,7 +248,7 @@ orc_x86_emit_mov_memoffset_reg (OrcCompiler *compiler, int size, int offset,
orc_x86_get_regname_64(reg2)); orc_x86_get_regname_64(reg2));
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
break; break;
} }
...@@ -316,7 +316,7 @@ orc_x86_emit_mov_memoffset_sse (OrcCompiler *compiler, int size, int offset, ...@@ -316,7 +316,7 @@ orc_x86_emit_mov_memoffset_sse (OrcCompiler *compiler, int size, int offset,
} }
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
break; break;
} }
orc_x86_emit_modrm_memoffset (compiler, reg2, offset, reg1); orc_x86_emit_modrm_memoffset (compiler, reg2, offset, reg1);
...@@ -348,7 +348,7 @@ orc_x86_emit_mov_reg_memoffset (OrcCompiler *compiler, int size, int reg1, int o ...@@ -348,7 +348,7 @@ orc_x86_emit_mov_reg_memoffset (OrcCompiler *compiler, int size, int reg1, int o
orc_x86_get_regname_ptr(compiler, reg2)); orc_x86_get_regname_ptr(compiler, reg2));
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
break; break;
} }
...@@ -425,7 +425,7 @@ orc_x86_emit_mov_sse_memoffset (OrcCompiler *compiler, int size, int reg1, int o ...@@ -425,7 +425,7 @@ orc_x86_emit_mov_sse_memoffset (OrcCompiler *compiler, int size, int reg1, int o
} }
break; break;
default: default:
ORC_PROGRAM_ERROR(compiler, "bad size"); ORC_COMPILER_ERROR(compiler, "bad size");
break; break;
} }
...@@ -980,7 +980,7 @@ x86_do_fixups (OrcCompiler *compiler) ...@@ -980,7 +980,7 @@ x86_do_fixups (OrcCompiler *compiler)
diff = ((int8_t)ptr[0]) + (label - ptr); diff = ((int8_t)ptr[0]) + (label - ptr);
if (diff != (int8_t)diff) { if (diff != (int8_t)diff) {
ORC_PROGRAM_ERROR(compiler, "short jump too long"); ORC_COMPILER_ERROR(compiler, "short jump too long");
} }
ptr[0] = diff; ptr[0] = diff;
......
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