-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
*
* 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)
{
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;
}
}
}
-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))
}
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)
return true;
}
}
- if (defs_only)
+ if (islocal)
return true;
switch (global->vtype)
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) {
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);
return false;
}
}
+ else {
+ ast_delete(switchnode);
+ parseerror(parser, "expected 'case' or 'default'");
+ return false;
+ }
/* Now the colon and body */
if (parser->tok != ':') {