Commit 3080bbd7 authored by David Schleef's avatar David Schleef

Convert printf's to errors and asm code

parent bdc3f067
......@@ -49,7 +49,7 @@ arm_emit (OrcProgram *program, uint32_t insn)
void
arm_emit_bx_lr (OrcProgram *program)
{
printf(" bx lr\n");
ORC_ASM_CODE(program," bx lr\n");
arm_emit (program, 0xe12fff1e);
}
......@@ -59,17 +59,17 @@ arm_emit_push (OrcProgram *program, int regs)
int i;
int x = 0;
printf(" push {");
ORC_ASM_CODE(program," push {");
for(i=0;i<16;i++){
if (regs & (1<<i)) {
x |= (1<<i);
printf("r%d", i);
ORC_ASM_CODE(program,"r%d", i);
if (x != regs) {
printf(", ");
ORC_ASM_CODE(program,", ");
}
}
}
printf("}\n");
ORC_ASM_CODE(program,"}\n");
arm_emit (program, 0xe92d0000 | regs);
}
......@@ -80,17 +80,17 @@ arm_emit_pop (OrcProgram *program, int regs)
int i;
int x = 0;
printf(" pop {");
ORC_ASM_CODE(program," pop {");
for(i=0;i<16;i++){
if (regs & (1<<i)) {
x |= (1<<i);
printf("r%d", i);
ORC_ASM_CODE(program,"r%d", i);
if (x != regs) {
printf(", ");
ORC_ASM_CODE(program,", ");
}
}
}
printf("}\n");
ORC_ASM_CODE(program,"}\n");
arm_emit (program, 0xe8bd0000 | regs);
}
......@@ -104,7 +104,7 @@ arm_emit_mov (OrcProgram *program, int dest, int src)
code |= (src&0xf) << 0;
code |= (dest&0xf) << 12;
printf(" mov %s, %s\n", arm_reg_name (dest), arm_reg_name (src));
ORC_ASM_CODE(program," mov %s, %s\n", arm_reg_name (dest), arm_reg_name (src));
arm_emit (program, code);
}
......@@ -112,7 +112,7 @@ arm_emit_mov (OrcProgram *program, int dest, int src)
void
arm_emit_label (OrcProgram *program, int label)
{
printf(".L%d:\n", label);
ORC_ASM_CODE(program,".L%d:\n", label);
program->labels[label] = program->codeptr;
}
......@@ -156,7 +156,7 @@ arm_emit_branch (OrcProgram *program, int cond, int label)
arm_add_fixup (program, label, 0);
arm_emit (program, code);
printf(" b%s .L%d\n", cond_names[cond], label);
ORC_ASM_CODE(program," b%s .L%d\n", cond_names[cond], label);
}
void
......@@ -176,7 +176,7 @@ arm_emit_loadimm (OrcProgram *program, int dest, int imm)
code |= (((16-shift2)&0xf) << 8);
code |= (imm&0xff);
printf(" mov %s, #0x%08x\n", arm_reg_name (dest), imm << (shift2*2));
ORC_ASM_CODE(program," mov %s, #0x%08x\n", arm_reg_name (dest), imm << (shift2*2));
arm_emit (program, code);
}
......@@ -190,7 +190,7 @@ arm_emit_add (OrcProgram *program, int dest, int src1, int src2)
code |= (dest&0xf) << 12;
code |= (src2&0xf) << 0;
printf(" add %s, %s, %s\n",
ORC_ASM_CODE(program," add %s, %s, %s\n",
arm_reg_name (dest),
arm_reg_name (src1),
arm_reg_name (src2));
......@@ -207,7 +207,7 @@ arm_emit_sub (OrcProgram *program, int dest, int src1, int src2)
code |= (dest&0xf) << 12;
code |= (src2&0xf) << 0;
printf(" sub %s, %s, %s\n",
ORC_ASM_CODE(program," sub %s, %s, %s\n",
arm_reg_name (dest),
arm_reg_name (src1),
arm_reg_name (src2));
......@@ -224,7 +224,7 @@ arm_emit_sub_imm (OrcProgram *program, int dest, int src1, int value)
code |= (dest&0xf) << 12;
code |= (value) << 0;
printf(" subs %s, %s, #%d\n",
ORC_ASM_CODE(program," subs %s, %s, #%d\n",
arm_reg_name (dest),
arm_reg_name (src1),
value);
......@@ -240,7 +240,7 @@ arm_emit_cmp_imm (OrcProgram *program, int src1, int value)
code |= (src1&0xf) << 16;
code |= (value) << 0;
printf(" cmp %s, #%d\n",
ORC_ASM_CODE(program," cmp %s, #%d\n",
arm_reg_name (src1),
value);
arm_emit (program, code);
......@@ -256,7 +256,7 @@ arm_emit_load_reg (OrcProgram *program, int dest, int src1, int offset)
code |= (dest&0xf) << 12;
code |= offset&0xfff;
printf(" ldr %s, [%s, #%d]\n",
ORC_ASM_CODE(program," ldr %s, [%s, #%d]\n",
arm_reg_name (dest),
arm_reg_name (src1), offset);
arm_emit (program, code);
......@@ -290,13 +290,13 @@ arm_emit_dp_reg (OrcProgram *program, int cond, int opcode, int dest,
code |= (src2&0xf) << 0;
if (shift_expn[opcode]) {
printf(" %s%s %s, %s\n",
ORC_ASM_CODE(program," %s%s %s, %s\n",
dp_insn_names[opcode],
update ? "s" : "",
arm_reg_name (src1),
arm_reg_name (src2));
} else {
printf(" %s%s %s, %s, %s\n",
ORC_ASM_CODE(program," %s%s %s, %s, %s\n",
dp_insn_names[opcode],
update ? "s" : "",
arm_reg_name (dest),
......
......@@ -185,7 +185,7 @@ arm_emit_load_src (OrcProgram *program, OrcVariable *var)
//arm_emit_mov_memoffset_arm (program, 16, 0, ptr_reg, var->alloc);
break;
default:
printf("ERROR bad size %d\n", var->size << program->loop_shift);
ORC_PROGRAM_ERROR(program, "bad size %d\n", var->size << program->loop_shift);
}
}
......@@ -223,7 +223,7 @@ arm_emit_store_dest (OrcProgram *program, OrcVariable *var)
// var->is_aligned, var->is_uncached);
break;
default:
printf("ERROR\n");
ORC_PROGRAM_ERROR(program, "bad size %d\n", var->size << program->loop_shift);
}
}
......
......@@ -24,28 +24,28 @@ orc_program_assemble_c (OrcProgram *program)
OrcOpcode *opcode;
OrcRule *rule;
orc_program_append_code(program,"\n");
orc_program_append_code(program,"void\n");
orc_program_append_code(program,"test (OrcExecutor *ex)\n");
orc_program_append_code(program,"{\n");
orc_program_append_code(program," int i;\n");
ORC_ASM_CODE(program,"\n");
ORC_ASM_CODE(program,"void\n");
ORC_ASM_CODE(program,"test (OrcExecutor *ex)\n");
ORC_ASM_CODE(program,"{\n");
ORC_ASM_CODE(program," int i;\n");
for(i=0;i<program->n_vars;i++){
OrcVariable *var = program->vars + i;
switch (var->vartype) {
case ORC_VAR_TYPE_CONST:
orc_program_append_code(program," int16_t var%d = %d;\n", i,
ORC_ASM_CODE(program," int16_t var%d = %d;\n", i,
(int16_t)var->value);
break;
case ORC_VAR_TYPE_TEMP:
orc_program_append_code(program," int16_t var%d;\n", i);
ORC_ASM_CODE(program," int16_t var%d;\n", i);
break;
case ORC_VAR_TYPE_SRC:
case ORC_VAR_TYPE_DEST:
orc_program_append_code(program," int16_t *var%d = ex->var%d;\n", i, i);
ORC_ASM_CODE(program," int16_t *var%d = ex->var%d;\n", i, i);
break;
case ORC_VAR_TYPE_PARAM:
orc_program_append_code(program," int16_t var%d = ex->var%d;\n", i, i);
ORC_ASM_CODE(program," int16_t var%d = ex->var%d;\n", i, i);
break;
default:
break;
......@@ -53,26 +53,26 @@ orc_program_assemble_c (OrcProgram *program)
}
orc_program_append_code(program,"\n");
orc_program_append_code(program," for (i = 0; i < n; i++) {\n");
ORC_ASM_CODE(program,"\n");
ORC_ASM_CODE(program," for (i = 0; i < n; i++) {\n");
for(j=0;j<program->n_insns;j++){
insn = program->insns + j;
opcode = insn->opcode;
orc_program_append_code(program," /* %d: %s */\n", j, insn->opcode->name);
ORC_ASM_CODE(program," /* %d: %s */\n", j, insn->opcode->name);
rule = insn->rule;
if (rule) {
rule->emit (program, rule->emit_user, insn);
} else {
orc_program_append_code(program,"#error No rule for: %s\n", opcode->name);
ORC_ASM_CODE(program,"#error No rule for: %s\n", opcode->name);
}
}
orc_program_append_code(program," }\n");
orc_program_append_code(program,"}\n");
orc_program_append_code(program,"\n");
ORC_ASM_CODE(program," }\n");
ORC_ASM_CODE(program,"}\n");
ORC_ASM_CODE(program,"\n");
}
......@@ -106,7 +106,7 @@ c_rule_copyw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (dest, p, insn->args[0]);
c_get_name (src1, p, insn->args[1]);
orc_program_append_code(p," %s = %s;\n", dest, src1);
ORC_ASM_CODE(p," %s = %s;\n", dest, src1);
}
static void
......@@ -118,7 +118,7 @@ c_rule_addw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (src1, p, insn->args[1]);
c_get_name (src2, p, insn->args[2]);
orc_program_append_code(p," %s = %s + %s;\n", dest, src1, src2);
ORC_ASM_CODE(p," %s = %s + %s;\n", dest, src1, src2);
}
static void
......@@ -130,7 +130,7 @@ c_rule_subw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (src1, p, insn->args[1]);
c_get_name (src2, p, insn->args[2]);
orc_program_append_code(p," %s = %s - %s;\n", dest, src1, src2);
ORC_ASM_CODE(p," %s = %s - %s;\n", dest, src1, src2);
}
static void
......@@ -142,7 +142,7 @@ c_rule_mullw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (src1, p, insn->args[1]);
c_get_name (src2, p, insn->args[2]);
orc_program_append_code(p," %s = %s * %s;\n", dest, src1, src2);
ORC_ASM_CODE(p," %s = %s * %s;\n", dest, src1, src2);
}
static void
......@@ -154,7 +154,7 @@ c_rule_shlw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (src1, p, insn->args[1]);
c_get_name (src2, p, insn->args[2]);
orc_program_append_code(p," %s = %s << %s;\n", dest, src1, src2);
ORC_ASM_CODE(p," %s = %s << %s;\n", dest, src1, src2);
}
static void
......@@ -166,7 +166,7 @@ c_rule_shrsw (OrcProgram *p, void *user, OrcInstruction *insn)
c_get_name (src1, p, insn->args[1]);
c_get_name (src2, p, insn->args[2]);
orc_program_append_code(p," %s = %s >> %s;\n", dest, src1, src2);
ORC_ASM_CODE(p," %s = %s >> %s;\n", dest, src1, src2);
}
......
......@@ -10,6 +10,7 @@
#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/orcdebug.h>
#define SIZE 65536
......@@ -24,7 +25,7 @@ orc_program_allocate_codemem (OrcProgram *program)
fd = mkstemp (filename);
if (fd == -1) {
/* FIXME oh crap */
printf("failed to create temp file\n");
ORC_ERROR ("failed to create temp file");
program->error = TRUE;
return;
}
......@@ -35,14 +36,14 @@ orc_program_allocate_codemem (OrcProgram *program)
program->code = mmap (NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (program->code == MAP_FAILED) {
/* FIXME oh crap */
printf("failed to create write map\n");
ORC_ERROR ("failed to create write map");
program->error = TRUE;
return;
}
program->code_exec = mmap (NULL, SIZE, PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0);
if (program->code_exec == MAP_FAILED) {
/* FIXME oh crap */
printf("failed to create exec map\n");
ORC_ERROR ("failed to create exec map");
program->error = TRUE;
return;
}
......
......@@ -8,7 +8,8 @@
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
#include <orc/orc.h>
#include <orc/orcdebug.h>
#include <orc/x86.h>
#define SIZE 65536
......@@ -92,8 +93,7 @@ mmx_load_constants (OrcProgram *program)
(int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), x86_exec_ptr,
program->vars[i].ptr_register);
} else {
/* FIXME */
printf("ERROR");
ORC_PROGRAM_ERROR(program, "unimplemented");
}
break;
default:
......@@ -125,7 +125,7 @@ mmx_emit_load_src (OrcProgram *program, OrcVariable *var)
x86_emit_mov_memoffset_mmx (program, 8, 0, ptr_reg, var->alloc);
break;
default:
printf("ERROR\n");
ORC_PROGRAM_ERROR(program, "bad size");
}
}
......@@ -144,7 +144,7 @@ mmx_emit_store_dest (OrcProgram *program, OrcVariable *var)
case 0:
/* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) {
printf("ERROR\n");
ORC_PROGRAM_ERROR(program, "unimplemented");
}
x86_emit_mov_mmx_reg (program, var->alloc, X86_ECX);
x86_emit_mov_reg_memoffset (program, 2, X86_ECX, 0, ptr_reg);
......@@ -156,7 +156,7 @@ mmx_emit_store_dest (OrcProgram *program, OrcVariable *var)
x86_emit_mov_mmx_memoffset (program, 8, var->alloc, 0, ptr_reg);
break;
default:
printf("ERROR\n");
ORC_PROGRAM_ERROR(program, "unimplemented");
}
}
......
......@@ -137,8 +137,8 @@ powerpc_emit_prologue (OrcProgram *program)
{
int i;
printf (".global test\n");
printf ("test:\n");
ORC_ASM_CODE (program, ".global test\n");
ORC_ASM_CODE (program, "test:\n");
powerpc_emit_stwu (program, POWERPC_R1, POWERPC_R1, -16);
......@@ -154,7 +154,7 @@ powerpc_emit_addi (OrcProgram *program, int regd, int rega, int imm)
{
unsigned int insn;
printf(" addi %s, %s, %d\n",
ORC_ASM_CODE(program," addi %s, %s, %d\n",
powerpc_get_regname(regd),
powerpc_get_regname(rega), imm);
insn = (14<<26) | (powerpc_regnum (regd)<<21) | (powerpc_regnum (rega)<<16);
......@@ -168,7 +168,7 @@ powerpc_emit_lwz (OrcProgram *program, int regd, int rega, int imm)
{
unsigned int insn;
printf(" lwz %s, %d(%s)\n",
ORC_ASM_CODE(program," lwz %s, %d(%s)\n",
powerpc_get_regname(regd),
imm, powerpc_get_regname(rega));
insn = (32<<26) | (powerpc_regnum (regd)<<21) | (powerpc_regnum (rega)<<16);
......@@ -182,7 +182,7 @@ powerpc_emit_stwu (OrcProgram *program, int regs, int rega, int offset)
{
unsigned int insn;
printf(" stwu %s, %d(%s)\n",
ORC_ASM_CODE(program," stwu %s, %d(%s)\n",
powerpc_get_regname(regs),
offset, powerpc_get_regname(rega));
insn = (37<<26) | (powerpc_regnum (regs)<<21) | (powerpc_regnum (rega)<<16);
......@@ -197,7 +197,7 @@ powerpc_emit_srawi (OrcProgram *program, int regd, int rega, int shift,
{
unsigned int insn;
printf(" srawi%s %s, %s, %d\n", (record)?".":"",
ORC_ASM_CODE(program," srawi%s %s, %s, %d\n", (record)?".":"",
powerpc_get_regname(regd),
powerpc_get_regname(rega), shift);
......@@ -268,7 +268,7 @@ powerpc_emit_epilogue (OrcProgram *program)
}
powerpc_emit_addi (program, POWERPC_R1, POWERPC_R1, 16);
printf(" blr\n");
ORC_ASM_CODE(program," blr\n");
powerpc_emit(program, 0x4e800020);
}
......@@ -351,7 +351,7 @@ powerpc_load_constants (OrcProgram *program)
for(i=0;i<program->n_vars;i++){
switch (program->vars[i].vartype) {
case ORC_VAR_TYPE_CONST:
printf(" vspltish %s, %d\n",
ORC_ASM_CODE(program," vspltish %s, %d\n",
powerpc_get_regname(program->vars[i].alloc),
(int)program->vars[i].value);
powerpc_emit_655510 (program, 4,
......@@ -367,7 +367,7 @@ powerpc_load_constants (OrcProgram *program)
(int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]));
} else {
/* FIXME */
printf("ERROR");
ORC_ASM_CODE(program,"ERROR");
}
break;
default:
......@@ -384,17 +384,17 @@ powerpc_emit_load_src (OrcProgram *program, OrcVariable *var)
switch (program->loop_shift) {
case 0:
printf(" lvehx %s, 0, %s\n",
ORC_ASM_CODE(program," lvehx %s, 0, %s\n",
powerpc_get_regname (var->alloc),
powerpc_get_regname (ptr_reg));
powerpc_emit_X (program, 31, powerpc_regnum(var->alloc),
0, powerpc_regnum(ptr_reg), 39);
printf(" lvsl %s, 0, %s\n",
ORC_ASM_CODE(program," lvsl %s, 0, %s\n",
powerpc_get_regname (POWERPC_V0),
powerpc_get_regname (ptr_reg));
powerpc_emit_X (program, 31, powerpc_regnum(POWERPC_V0),
0, powerpc_regnum(ptr_reg), 6);
printf(" vperm %s, %s, %s, %s\n",
ORC_ASM_CODE(program," vperm %s, %s, %s, %s\n",
powerpc_get_regname (var->alloc),
powerpc_get_regname (var->alloc),
powerpc_get_regname (var->alloc),
......@@ -406,7 +406,7 @@ powerpc_emit_load_src (OrcProgram *program, OrcVariable *var)
powerpc_regnum(POWERPC_V0), 43);
break;
default:
printf("ERROR\n");
ORC_ASM_CODE(program,"ERROR\n");
}
}
......@@ -418,12 +418,12 @@ powerpc_emit_store_dest (OrcProgram *program, OrcVariable *var)
switch (program->loop_shift) {
case 0:
printf(" lvsr %s, 0, %s\n",
ORC_ASM_CODE(program," lvsr %s, 0, %s\n",
powerpc_get_regname (POWERPC_V0),
powerpc_get_regname (ptr_reg));
powerpc_emit_X (program, 31, powerpc_regnum(POWERPC_V0),
0, powerpc_regnum(ptr_reg), 38);
printf(" vperm %s, %s, %s, %s\n",
ORC_ASM_CODE(program," vperm %s, %s, %s, %s\n",
powerpc_get_regname (var->alloc),
powerpc_get_regname (var->alloc),
powerpc_get_regname (var->alloc),
......@@ -433,7 +433,7 @@ powerpc_emit_store_dest (OrcProgram *program, OrcVariable *var)
powerpc_regnum(var->alloc),
powerpc_regnum(var->alloc),
powerpc_regnum(POWERPC_V0), 43);
printf(" stvehx %s, 0, %s\n",
ORC_ASM_CODE(program," stvehx %s, 0, %s\n",
powerpc_get_regname (var->alloc),
powerpc_get_regname (ptr_reg));
powerpc_emit_X (program, 31,
......@@ -441,7 +441,7 @@ powerpc_emit_store_dest (OrcProgram *program, OrcVariable *var)
0, powerpc_regnum(ptr_reg), 167);
break;
default:
printf("ERROR\n");
ORC_ASM_CODE(program,"ERROR\n");
}
}
......@@ -465,7 +465,7 @@ orc_program_assemble_powerpc (OrcProgram *program)
powerpc_emit_beq (program, 1);
powerpc_emit (program, 0x7c0903a6);
printf (" mtctr %s\n", powerpc_get_regname(POWERPC_R0));
ORC_ASM_CODE (program, " mtctr %s\n", powerpc_get_regname(POWERPC_R0));
powerpc_load_constants (program);
......@@ -475,17 +475,17 @@ orc_program_assemble_powerpc (OrcProgram *program)
insn = program->insns + j;
opcode = insn->opcode;
printf("# %d: %s", j, insn->opcode->name);
ORC_ASM_CODE(program,"# %d: %s", j, insn->opcode->name);
/* set up args */
for(k=0;k<opcode->n_src + opcode->n_dest;k++){
args[k] = program->vars + insn->args[k];
printf(" %d", args[k]->alloc);
ORC_ASM_CODE(program," %d", args[k]->alloc);
if (args[k]->is_chained) {
printf(" (chained)");
ORC_ASM_CODE(program," (chained)");
}
}
printf("\n");
ORC_ASM_CODE(program,"\n");
for(k=opcode->n_dest;k<opcode->n_src + opcode->n_dest;k++){
switch (args[k]->vartype) {
......@@ -505,7 +505,7 @@ orc_program_assemble_powerpc (OrcProgram *program)
if (rule) {
rule->emit (program, rule->emit_user, insn);
} else {
printf("No rule for: %s\n", opcode->name);
ORC_ASM_CODE(program,"No rule for: %s\n", opcode->name);
}
for(k=0;k<opcode->n_dest;k++){
......@@ -530,7 +530,7 @@ orc_program_assemble_powerpc (OrcProgram *program)
program->vars[k].ptr_register,
program->vars[k].size << program->loop_shift);
} else {
printf("ERROR\n");
ORC_ASM_CODE(program,"ERROR\n");
}
}
}
......@@ -553,7 +553,7 @@ powerpc_rule_addw (OrcProgram *p, void *user, OrcInstruction *insn)
{
unsigned int x;
printf(" vadduhm %s, %s, %s\n",
ORC_ASM_CODE(p," vadduhm %s, %s, %s\n",
powerpc_get_regname(p->vars[insn->args[0]].alloc),
powerpc_get_regname(p->vars[insn->args[1]].alloc),
powerpc_get_regname(p->vars[insn->args[2]].alloc));
......@@ -570,7 +570,7 @@ powerpc_rule_addw (OrcProgram *p, void *user, OrcInstruction *insn)
static void
powerpc_rule_subw (OrcProgram *p, void *user, OrcInstruction *insn)
{
printf(" vsubuhm %s, %s, %s\n",
ORC_ASM_CODE(p," vsubuhm %s, %s, %s\n",
powerpc_get_regname(p->vars[insn->args[0]].alloc),
powerpc_get_regname(p->vars[insn->args[1]].alloc),
powerpc_get_regname(p->vars[insn->args[2]].alloc));
......@@ -579,7 +579,7 @@ powerpc_rule_subw (OrcProgram *p, void *user, OrcInstruction *insn)
static void
powerpc_rule_mullw (OrcProgram *p, void *user, OrcInstruction *insn)
{
printf(" vxor %s, %s, %s\n",
ORC_ASM_CODE(p," vxor %s, %s, %s\n",
powerpc_get_regname(POWERPC_V0),
powerpc_get_regname(POWERPC_V0),
powerpc_get_regname(POWERPC_V0));
......@@ -588,7 +588,7 @@ powerpc_rule_mullw (OrcProgram *p, void *user, OrcInstruction *insn)
powerpc_regnum(POWERPC_V0),
powerpc_regnum(POWERPC_V0), 1220);
printf(" vmladduhm %s, %s, %s, %s\n",
ORC_ASM_CODE(p," vmladduhm %s, %s, %s, %s\n",
powerpc_get_regname(p->vars[insn->args[0]].alloc),
powerpc_get_regname(p->vars[insn->args[1]].alloc),
powerpc_get_regname(p->vars[insn->args[2]].alloc),
......@@ -604,7 +604,7 @@ powerpc_rule_mullw (OrcProgram *p, void *user, OrcInstruction *insn)
static void
powerpc_rule_shlw (OrcProgram *p, void *user, OrcInstruction *insn)
{
printf(" vrlh %s, %s, %s\n",
ORC_ASM_CODE(p," vrlh %s, %s, %s\n",
powerpc_get_regname(p->vars[insn->args[0]].alloc),
powerpc_get_regname(p->vars[insn->args[1]].alloc),
powerpc_get_regname(p->vars[insn->args[2]].alloc));
......@@ -619,7 +619,7 @@ powerpc_rule_shrsw (OrcProgram *p, void *user, OrcInstruction *insn)
{
unsigned int x;
printf(" vsrah %s, %s, %s\n",
ORC_ASM_CODE(p," vsrah %s, %s, %s\n",
powerpc_get_regname(p->vars[insn->args[0]].alloc),
powerpc_get_regname(p->vars[insn->args[1]].alloc),
powerpc_get_regname(p->vars[insn->args[2]].alloc));
......@@ -648,7 +648,7 @@ orc_program_powerpc_register_rules (void)
void powerpc_emit_ret (OrcProgram *program)
{
printf(" ret\n");
ORC_ASM_CODE(program," ret\n");
//*program->codeptr++ = 0xc3;
}
......@@ -669,7 +669,7 @@ powerpc_add_label (OrcProgram *program, unsigned char *ptr, int label)
void powerpc_emit_beq (OrcProgram *program, int label)
{
printf(" ble- .L%d\n", label);
ORC_ASM_CODE(program," ble- .L%d\n", label);
powerpc_add_fixup (program, program->codeptr, label);
powerpc_emit (program, 0x40810000);
......@@ -677,7 +677,7 @@ void powerpc_emit_beq (OrcProgram *program, int label)
void powerpc_emit_bne (OrcProgram *program, int label)
{
printf(" bdnz+ .L%d\n", label);
ORC_ASM_CODE(program," bdnz+ .L%d\n", label);
powerpc_add_fixup (program, program->codeptr, label);
powerpc_emit (program, 0x42000000);
......@@ -685,7 +685,7 @@ void powerpc_emit_bne (OrcProgram *program, int label)
void powerpc_emit_label (OrcProgram *program, int label)
{
printf(".L%d:\n", label);
ORC_ASM_CODE(program,".L%d:\n", label);
powerpc_add_label (program, program->codeptr, label);
}
......
......@@ -97,8 +97,7 @@ sse_load_constants (OrcProgram *program)
(int)ORC_STRUCT_OFFSET(OrcExecutor, arrays[i]), x86_exec_ptr,
program->vars[i].ptr_register);
} else {
/* FIXME */
printf("ERROR\n");
ORC_PROGRAM_ERROR(program,"unimplemented");
}
break;
default:
......@@ -140,7 +139,8 @@ sse_emit_load_src (OrcProgram *program, OrcVariable *var)
x86_emit_mov_memoffset_sse (program, 16, 0, ptr_reg, var->alloc);
break;
default:
printf("ERROR\n");
ORC_PROGRAM_ERROR(program,"unimplemented");
break;
}
}
......@@ -159,7 +159,7 @@ sse_emit_store_dest (OrcProgram *program, OrcVariable *var)
case 1:
/* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) {
printf("ERROR\n");
ORC_PROGRAM_ERROR(program,"unimplemented");
}
x86_emit_mov_sse_reg (program, var->alloc, X86_ECX);
x86_emit_mov_reg_memoffset (program, 1, X86_ECX, 0, ptr_reg);
......@@ -167,7 +167,7 @@ sse_emit_store_dest (OrcProgram *program, OrcVariable *var)
case 2:
/* FIXME we might be using ecx twice here */
if (ptr_reg == X86_ECX) {
printf("ERROR\n");
ORC_PROGRAM_ERROR(program,"unimplemented");
}
x86_emit_mov_sse_reg (program, var->alloc, X86_ECX);
x86_emit_mov_reg_memoffset (program, 2, X86_ECX, 0, ptr_reg);
......@@ -185,7 +185,8 @@ sse_emit_store_dest (OrcProgram *program, OrcVariable *var)
var->is_aligned, var->is_uncached);
break;
default:
printf("ERROR\n");
ORC_PROGRAM_ERROR(program,"bad size");
break;
}
}
......@@ -331,17 +332,17 @@ sse_emit_loop (OrcProgram *program)
insn = program->insns + j;
opcode = insn->opcode;
orc_program_append_code(program,"# %d: %s", j, insn->opcode->name);
ORC_ASM_CODE(program,"# %d: %s", j, insn->opcode->name);
/* set up args */
for(k=0;k<opcode->n_src + opcode->n_dest;k++){
args[k] = program->vars + insn->args[k];
orc_program_append_code(program," %d", args[k]->alloc);
ORC_ASM_CODE(program," %d", args[k]->alloc);
if (args[k]->is_chained) {
orc_program_append_code(program," (chained)");
ORC_ASM_CODE(program," (chained)");
}
}
orc_program_append_code(program,"\n");
ORC_ASM_CODE(program,"\n");
for(k=opcode->n_dest;k<opcode->n_src + opcode->n_dest;k++){
switch (args[k]->vartype) {
......@@ -366,7 +367,7 @@ sse_emit_loop (OrcProgram *program)
}
rule->emit (program, rule->emit_user, insn);
} else {
orc_program_append_code(program,"No rule for: %s\n", opcode->name);
ORC_ASM_CODE(program,"No rule for: %s\n", opcode->name);
program->error = TRUE;
}
......
......@@ -157,7 +157,7 @@ orc_program_append_ds (OrcProgram *program, const char *name, int arg0,
insn->opcode = orc_opcode_find_by_name (name);
if (!insn->opcode) {
printf("unknown opcode: %s\n", name);
ORC_ERROR ("unknown opcode: %s", name);
}
insn->args[0] = arg0;
insn->args[1] = arg1;
......@@ -175,7 +175,7 @@ orc_program_append (OrcProgram *program, const char *name, int arg0,
insn->opcode = orc_opcode_find_by_name (name);
if (!insn->opcode) {
printf("unknown opcode: %s\n", name);
ORC_ERROR ("unknown opcode: %s", name);
}
insn->args[0] = arg0;
insn->args[1] = arg1;
......@@ -209,7 +209,7 @@ orc_program_get_dest (OrcProgram *program)
}
}
ORC_ERROR("can't find dest");
ORC_PROGRAM_ERROR(program, "failed to find destination array");
return -1;
}
......@@ -223,7 +223,7 @@ orc_program_append_str (OrcProgram *program, const char *name,
insn->opcode = orc_opcode_find_by_name (name);
if (!insn->opcode) {