From: David Schleef Date: Mon, 19 Oct 2009 17:39:58 +0000 (-0700) Subject: orcc: implement --assembly for asm output X-Git-Tag: merge-base~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1660b02f0a99b38870a785f04cdaee7b15dbb3a8;p=platform%2Fupstream%2Forc.git orcc: implement --assembly for asm output Probably not useful yet. --- diff --git a/tools/orcc.c b/tools/orcc.c index 8ba33cb..e2fbb4a 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -16,6 +16,7 @@ void output_code_header (OrcProgram *p, FILE *output); void output_code_test (OrcProgram *p, FILE *output); void output_code_backup (OrcProgram *p, FILE *output); void output_code_no_orc (OrcProgram *p, FILE *output); +void output_code_assembly (OrcProgram *p, FILE *output); static void print_defines (FILE *output); static void print_exec_header (FILE *output); static char * get_barrier (const char *s); @@ -25,7 +26,8 @@ int verbose = 0; enum { MODE_IMPL, MODE_HEADER, - MODE_TEST + MODE_TEST, + MODE_ASSEMBLY }; int mode = MODE_IMPL; @@ -43,6 +45,7 @@ void help (void) printf(" --implementation Produce C code implementing functions\n"); printf(" --header Produce C header for functions\n"); printf(" --test Produce test code for functions\n"); + printf(" --assembly Produce assembly code for functions\n"); printf(" --include FILE Generate #include in code\n"); printf("\n"); @@ -71,6 +74,8 @@ main (int argc, char *argv[]) mode = MODE_IMPL; } else if (strcmp(argv[i], "--test") == 0) { mode = MODE_TEST; + } else if (strcmp(argv[i], "--assembly") == 0) { + mode = MODE_ASSEMBLY; } else if (strcmp(argv[i], "--include") == 0) { if (i+1 < argc) { include_file = argv[i+1]; @@ -216,6 +221,22 @@ main (int argc, char *argv[]) fprintf(output, " };\n"); fprintf(output, " return 0;\n"); fprintf(output, "}\n"); + } else if (mode == MODE_ASSEMBLY) { + //fprintf(output, "#ifndef DISABLE_ORC\n"); + //fprintf(output, "#include \n"); + //fprintf(output, "#else\n"); + //fprintf(output, "#include \n"); + //print_exec_header (output); + //fprintf(output, "#endif\n"); + //if (include_file) { + //fprintf(output, "#include <%s>\n", include_file); + //} + //fprintf(output, "\n"); + //print_defines (output); + //fprintf(output, "\n"); + for(i=0;iname); + //output_prototype (p, output); + { + OrcCompileResult result; + + //result = orc_program_compile_full (p, orc_target_get_by_name("sse"), 0); + result = orc_program_compile (p); + if (ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) { + fprintf(output, "%s\n", orc_program_get_asm_code (p)); + } else { + fprintf(output, "/* failed to compile */\n"); + } + } + fprintf(output, "\n"); + +} +