Move label relocs to the relevant statement block.

This commit is contained in:
Bill Currie 2011-01-25 15:45:31 +09:00
parent 849d013f5e
commit fd3b594ca5
2 changed files with 12 additions and 0 deletions

View file

@ -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;

View file

@ -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;
}