#include "revision.h"
#include "warning.h"
#include "mangle.h"
+#include "printer.h"
#ifndef PREPROCESSOR
#ifndef __WIN32__
}
assert(obstack_object_size(&cppflags_obst) == 0);
- obstack_printf(&cppflags_obst, "%s ", PREPROCESSOR);
+
+ const char *preprocessor = getenv("CPARSER_PP");
+ if (preprocessor == NULL)
+ preprocessor = PREPROCESSOR;
+
+ obstack_printf(&cppflags_obst, "%s ", preprocessor);
switch (filetype) {
case FILETYPE_C:
add_flag(&cppflags_obst, "-std=c99");
{
char buf[65536];
- snprintf(buf, sizeof(buf), "%s %s -o %s", ASSEMBLER, in, out);
+ const char *assembler = getenv("CPARSER_AS");
+ if (assembler == NULL)
+ assembler = ASSEMBLER;
+
+ snprintf(buf, sizeof(buf), "%s %s -o %s", assembler, in, out);
if (verbose) {
puts(buf);
}
const char *flags = obstack_finish(&ldflags_obst);
/* construct commandline */
- obstack_printf(&ldflags_obst, "%s ", LINKER);
+ const char *linker = getenv("CPARSER_LINK");
+ if (linker == NULL)
+ linker = LINKER;
+ obstack_printf(&ldflags_obst, "%s ", linker);
obstack_printf(&ldflags_obst, "%s", flags);
obstack_1grow(&ldflags_obst, '\0');
/* fallthrough */
case 3:
set_option("thread-jumps");
- set_option("if-conv");
+ set_option("if-conversion");
/* fallthrough */
case 2:
set_option("strict-aliasing");
char_is_signed = !truth_value;
} else if (streq(opt, "fast-math") ||
streq(opt, "jump-tables") ||
- streq(opt, "unroll-loops") ||
streq(opt, "expensive-optimizations") ||
streq(opt, "common") ||
streq(opt, "PIC") ||
c_mode |= features_on;
c_mode &= ~features_off;
- timer_push(TV_PARSING);
+ /* do the actual parsing */
+ ir_timer_t *t_parsing = ir_timer_new();
+ timer_register(t_parsing, "Frontend: Parsing");
+ timer_push(t_parsing);
init_tokens();
translation_unit_t *const unit = do_parsing(in, filename);
- timer_pop();
+ timer_pop(t_parsing);
/* prints the AST even if errors occurred */
if (mode == PrintAst) {
- type_set_output(out);
- ast_set_output(out);
+ print_to_file(out);
print_ast(unit);
}
continue;
}
- timer_push(TV_CONSTRUCT);
+ /* build the firm graph */
+ ir_timer_t *t_construct = ir_timer_new();
+ timer_register(t_construct, "Frontend: Graph construction");
+ timer_push(t_construct);
translation_unit_to_firm(unit);
- timer_pop();
+ timer_pop(t_construct);
graph_built:
if (mode == ParseOnly) {
const char *flags = obstack_finish(&ldflags_obst);
/* construct commandline */
- obstack_printf(&file_obst, "%s", LINKER);
+ const char *linker = getenv("CPARSER_LINK");
+ if (linker == NULL)
+ linker = LINKER;
+ obstack_printf(&file_obst, "%s", linker);
for (file_list_entry_t *entry = files; entry != NULL;
entry = entry->next) {
if (entry->type != FILETYPE_OBJECT)