From: Wolfgang Bumiller Date: Wed, 26 Dec 2012 20:31:25 +0000 (-0800) Subject: Merge pull request #74 from matthiaskrgr/PKGBUILD X-Git-Tag: before-library~483 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=24161543d900dad56b5a7ae216a1e58057585309;hp=1f867e3920e17779542e1ebfe9b30500c377f43e Merge pull request #74 from matthiaskrgr/PKGBUILD add arch PKGBUILDs for git and release build. --- diff --git a/Makefile b/Makefile index 28f425e..d35726d 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ CYGWIN = $(findstring CYGWIN, $(UNAME)) MINGW = $(findstring MINGW32, $(UNAME)) CC ?= clang -CFLAGS += -Wall -Wextra -I. -pedantic-errors +CFLAGS += -Wall -Wextra -I. -pedantic-errors -fno-strict-aliasing #turn on tons of warnings if clang is present # but also turn off the STUPID ONES ifeq ($(CC), clang) diff --git a/doc/gmqcc.1 b/doc/gmqcc.1 index bbaaaf3..a87d465 100644 --- a/doc/gmqcc.1 +++ b/doc/gmqcc.1 @@ -121,6 +121,17 @@ them. -f\fIno-\fRcorrect-ternary .fi .in +.TP +.B "-dump" +DEBUG OPTION. Print the code's intermediate representation before the +optimization and finalization passes to stdout before generating the +binary. +.TP +.B "-dumpfin" +DEBUG OPTION. Print the code's intermediate representation after the +optimization and finalization passes to stdout before generating the +binary. The instructions will be enumerated, and values will contain a +list of liferanges. .SH COMPILE WARNINGS .TP .B -Wunused-variable diff --git a/ir.c b/ir.c index 66236f7..9a19a59 100644 --- a/ir.c +++ b/ir.c @@ -2623,7 +2623,7 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change * * Breaking conventions is annoying... */ -static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal, bool defs_only); +static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal); static bool gen_global_field(ir_value *global) { @@ -3154,7 +3154,7 @@ static bool gen_function_locals(ir_builder *ir, ir_value *global) vec_push(code_globals, 0); for (i = 0; i < vec_size(irfun->locals); ++i) { ir_value_code_setaddr(irfun->locals[i], firstlocal + irfun->locals[i]->code.local); - if (!ir_builder_gen_global(ir, irfun->locals[i], true, true)) { + if (!ir_builder_gen_global(ir, irfun->locals[i], true)) { irerror(irfun->locals[i]->context, "failed to generate local %s", irfun->locals[i]->name); return false; } @@ -3267,18 +3267,19 @@ static void gen_vector_fields(prog_section_field fld, const char *name) } } -static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal, bool defs_only) +static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal) { size_t i; int32_t *iptr; prog_section_def def; bool pushdef = false; + def.type = global->vtype; + def.offset = vec_size(code_globals); + def.name = 0; if (opts.g || !islocal) { pushdef = true; - def.type = global->vtype; - def.offset = vec_size(code_globals); if (OPTS_OPTIMIZATION(OPTIM_STRIP_CONSTANT_NAMES) && (global->name[0] == '#' || global->cvq == CV_CONST)) @@ -3297,7 +3298,7 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc } else def.name = 0; - if (defs_only) { + if (islocal) { def.offset = ir_value_code_addr(global); vec_push(code_defs, def); if (global->vtype == TYPE_VECTOR) @@ -3307,7 +3308,7 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc return true; } } - if (defs_only) + if (islocal) return true; switch (global->vtype) @@ -3525,7 +3526,7 @@ bool ir_builder_generate(ir_builder *self, const char *filename) for (i = 0; i < vec_size(self->globals); ++i) { - if (!ir_builder_gen_global(self, self->globals[i], false, false)) { + if (!ir_builder_gen_global(self, self->globals[i], false)) { return false; } if (self->globals[i]->vtype == TYPE_FUNCTION) { diff --git a/parser.c b/parser.c index 4058a8f..a11c709 100644 --- a/parser.c +++ b/parser.c @@ -2512,11 +2512,6 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou while (parser->tok != '}') { ast_block *caseblock; - if (parser->tok != TOKEN_KEYWORD) { - ast_delete(switchnode); - parseerror(parser, "expected 'case' or 'default'"); - return false; - } if (!strcmp(parser_tokval(parser), "case")) { if (!parser_next(parser)) { ast_delete(switchnode); @@ -2545,6 +2540,11 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou return false; } } + else { + ast_delete(switchnode); + parseerror(parser, "expected 'case' or 'default'"); + return false; + } /* Now the colon and body */ if (parser->tok != ':') {