X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=main.c;h=dd1b82d9e290c36603a4394bdaa00da1667f17b5;hb=9de06381987e3b71a9efea26cb9b596fd433191c;hp=4930eaf4712e8c78d53d81d6222d3d35daa57350;hpb=cdca5b5a7f3a8d64d426cf8fc99345179e9cca46;p=cparser diff --git a/main.c b/main.c index 4930eaf..dd1b82d 100644 --- a/main.c +++ b/main.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -21,6 +22,7 @@ #include "parser.h" #include "ast2firm.h" #include "adt/error.h" +#include "write_fluffy.h" #ifndef PREPROCESSOR #define PREPROCESSOR "cpp" @@ -36,7 +38,8 @@ #define pclose(file) _pclose(file) #endif /* _WIN32 */ -static int verbose; +static int verbose; +static bool do_dump; static const ir_settings_if_conv_t *if_conv_info = NULL; static const backend_params *be_params = NULL; @@ -61,6 +64,8 @@ static void initialize_firm(void) params.arch_op_settings = be_params->arch_op_settings; if_conv_info = be_params->if_conv_info; + (void) if_conv_info; /* avoid unused warning */ + /* intialize firm itself */ init_firm(¶ms); dbg_init(NULL, NULL, dbg_snprint); @@ -88,12 +93,9 @@ static void initialize_firm(void) static void dump(ir_graph *irg, const char *suffix) { -#if 0 - dump_ir_block_graph(irg, suffix); -#else - (void)irg; - (void)suffix; -#endif + if(do_dump) { + dump_ir_block_graph(irg, suffix); + } } static void get_output_name(char *buf, size_t buflen, const char *inputname, @@ -223,6 +225,15 @@ static void create_firm_prog(translation_unit_t *unit) dump(irg, "-start"); } + lower_params_t params; + + params.def_ptr_alignment = 4; + params.flags = LF_COMPOUND_RETURN | LF_RETURN_HIDDEN; + params.hidden_params = ADD_HIDDEN_ALWAYS_IN_FRONT; + params.find_pointer_type = NULL; + params.ret_compound_in_regs = NULL; + lower_calls_with_compounds(¶ms); + lower_highlevel(); for(int i = 0; i < n_irgs; ++i) { ir_graph *const irg = get_irp_irg(i); @@ -272,8 +283,6 @@ static void optimize(void) } } -void write_fluffy_decls(translation_unit_t *unit); - typedef enum compile_mode_t { Compile, CompileAssemble, @@ -324,6 +333,8 @@ int main(int argc, char **argv) mode = PrintAst; } else if(strcmp(arg, "--print-fluffy") == 0) { mode = PrintFluffy; + } else if(strcmp(arg, "--dump") == 0) { + do_dump = true; } else if(strcmp(arg, "-v") == 0) { verbose = 1; } else if(arg[0] == '-' && arg[1] == 'f') {