OrcInstruction *cinsn;
int multiplier;
- if (var->vartype == ORC_VAR_TYPE_CONST) {
- if (var->replaced) {
- insn.src_args[i] = var->replacement;
- continue;
- }
- }
-
cinsn = compiler->insns + compiler->n_insns;
compiler->n_insns++;
cinsn->opcode = get_loadp_opcode_for_size (opcode->src_size[i]);
cinsn->dest_args[0] = orc_compiler_new_temporary (compiler,
opcode->src_size[i] * multiplier);
-
if (var->vartype == ORC_VAR_TYPE_CONST) {
- var->replaced = TRUE;
- var->replacement = cinsn->dest_args[0];
-
compiler->vars[cinsn->dest_args[0]].flags |=
ORC_VAR_FLAG_VOLATILE_WORKAROUND;
}
cinsn->src_args[0] = insn.src_args[i];
insn.src_args[i] = cinsn->dest_args[0];
+
}
}
}
for(k=0;k<ORC_STATIC_OPCODE_N_SRC;k++) {
OrcCodeVariable *var = code->vars + insn->src_args[k];
- int src_size = opcode->src_size[k];
- if (src_size == 0) continue;
+ if (opcode->src_size[k] == 0) continue;
if (var->vartype == ORC_VAR_TYPE_CONST) {
opcode_ex[j].src_ptrs[k] = tmpspace[insn->src_args[k]];
/* FIXME hack */
load_constant (tmpspace[insn->src_args[k]], 8,
var->value.i);
- if (src_size == 1)
- opcode_ex[j].shift = 3;
- else if (src_size == 2)
- opcode_ex[j].shift = 2;
- else if (src_size == 4)
- opcode_ex[j].shift = 1;
} else if (var->vartype == ORC_VAR_TYPE_PARAM) {
opcode_ex[j].src_ptrs[k] = tmpspace[insn->src_args[k]];
/* FIXME hack */
if (o) {
int n_args = opcode_n_args (o);
int i, j;
- char *args[4] = { 0 };
if (n_tokens != 1 + offset + n_args) {
orc_parse_log (parser, "error: line %d: too %s arguments for %s (expected %d)\n",
unused = strtod (token[i], &end);
if (end != token[i]) {
- char *varname;
- int opsize = opcode_arg_size(o, j), cvar;
-
- ORC_DEBUG ("arg size %d %d, flags %d", j, opsize, flags);
- opsize *= (flags & ORC_INSTRUCTION_FLAG_X2 ? 2 : 1);
- opsize *= (flags & ORC_INSTRUCTION_FLAG_X4 ? 4 : 1);
-
- varname = malloc (strlen(token[i]) + 10);
- sprintf(varname, "%s.%d", token[i], opsize);
- cvar = orc_program_add_constant_str (parser->program, opsize,
- token[i], varname);
- free(varname);
- /* use name of variable, it could be reused */
- args[j] = parser->program->vars[cvar].name;
- } else {
- args[j] = token[i];
+ orc_program_add_constant_str (parser->program, opcode_arg_size(o, j),
+ token[i], token[i]);
}
}
- orc_program_append_str_2 (parser->program, token[offset], flags,
- args[0], args[1], args[2], args[3]);
+
+ if (n_tokens - offset == 5) {
+ orc_program_append_str_2 (parser->program, token[offset], flags,
+ token[offset+1], token[offset+2], token[offset+3], token[offset+4]);
+ } else if (n_tokens - offset == 4) {
+ orc_program_append_str_2 (parser->program, token[offset], flags,
+ token[offset+1], token[offset+2], token[offset+3], NULL);
+ } else {
+ orc_program_append_str_2 (parser->program, token[offset], flags,
+ token[offset+1], token[offset+2], NULL, NULL);
+ }
} else {
orc_parse_log (parser, "error: line %d: unknown opcode: %s\n",
parser->line_number,