void orc_compiler_rewrite_vars2 (OrcCompiler *compiler);
void orc_compiler_do_regs (OrcCompiler *compiler);
int orc_compiler_dup_temporary (OrcCompiler *compiler, int var, int j);
+void orc_compiler_check_sizes (OrcCompiler *compiler);
int
compiler->target->compiler_init (compiler);
+ orc_compiler_check_sizes (compiler);
+ if (compiler->error) goto error;
+
orc_compiler_assign_rules (compiler);
if (compiler->error) goto error;
}
void
+orc_compiler_check_sizes (OrcCompiler *compiler)
+{
+ int i;
+ int j;
+
+ for(i=0;i<compiler->n_insns;i++) {
+ OrcInstruction *insn = compiler->insns + i;
+ OrcStaticOpcode *opcode = insn->opcode;
+
+ for(j=0;j<ORC_STATIC_OPCODE_N_DEST;j++){
+ if (opcode->dest_size[j] == 0) continue;
+ if (opcode->dest_size[j] != compiler->vars[insn->dest_args[j]].size) {
+ ORC_PROGRAM_ERROR(compiler, "size mismatch, opcode %s dest %d",
+ opcode->name, j);
+ return;
+ }
+ }
+ for(j=0;j<ORC_STATIC_OPCODE_N_SRC;j++){
+ if (opcode->src_size[j] == 0) continue;
+ if (opcode->src_size[j] != compiler->vars[insn->src_args[j]].size &&
+ compiler->vars[insn->src_args[j]].vartype != ORC_VAR_TYPE_PARAM) {
+ ORC_PROGRAM_ERROR(compiler, "size mismatch, opcode %s src %d",
+ opcode->name, j);
+ return;
+ }
+ }
+ }
+}
+
+void
orc_compiler_assign_rules (OrcCompiler *compiler)
{
int i;
if (insn->rule == NULL || insn->rule->emit == NULL) {
ORC_PROGRAM_ERROR(compiler, "No rule for: %s", insn->opcode->name);
+ return;
}
}
}
n = orc_parse (code, &programs);
-#if 1
+#if 0
for(i=0;i<n;i++){
printf("%s\n", programs[i]->name);
orc_test_gcc_compile (programs[i]);
}
#endif
-#if 0
+#if 1
for(i=0;i<n;i++){
- orc_program_compile_for_target (programs[i], orc_target_get_by_name("c"));
- printf("%s", orc_program_get_asm_code (programs[i]));
+ int ret;
+
+ ret = orc_program_compile_for_target (programs[i],
+ orc_target_get_by_name("neon"));
+ if (ret) {
+ printf("%s", orc_program_get_asm_code (programs[i]));
+ }
}
#endif