From fd3b594ca553abd7281ca42f885b1206a2b6fa15 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 25 Jan 2011 15:45:31 +0900 Subject: [PATCH] Move label relocs to the relevant statement block. --- tools/qfcc/include/statements.h | 2 ++ tools/qfcc/source/statements.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/qfcc/include/statements.h b/tools/qfcc/include/statements.h index b44caeb79..72105ac1b 100644 --- a/tools/qfcc/include/statements.h +++ b/tools/qfcc/include/statements.h @@ -60,6 +60,8 @@ typedef struct statement_s { typedef struct sblock_s { struct sblock_s *next; + struct reloc_s *relocs; + int offset; ///< offset of first statement of block statement_t *statements; statement_t **tail; } sblock_t; diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 70d2f6ac6..ccf38cde7 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -46,6 +46,7 @@ #include "options.h" #include "qc-parse.h" #include "qfcc.h" +#include "reloc.h" #include "statements.h" #include "strpool.h" #include "symtab.h" @@ -652,11 +653,20 @@ statement_bool (sblock_t *sblock, expr_t *e) static sblock_t * statement_label (sblock_t *sblock, expr_t *e) { + reloc_t *r; + if (sblock->statements) { sblock->next = new_sblock (); sblock = sblock->next; } e->e.label.dest = sblock; + for (r = e->e.label.refs; r && r->next; r = r->next) + ; + if (r) { + r->next = sblock->relocs; + sblock->relocs = e->e.label.refs; + e->e.label.refs = 0; + } return sblock; }