diff options
Diffstat (limited to 'libyasm')
-rw-r--r-- | libyasm/bc-int.h | 3 | ||||
-rw-r--r-- | libyasm/bytecode.c | 2 | ||||
-rw-r--r-- | libyasm/section.c | 16 | ||||
-rw-r--r-- | libyasm/section.h | 4 | ||||
-rw-r--r-- | libyasm/symrec.c | 16 | ||||
-rw-r--r-- | libyasm/symrec.h | 4 |
6 files changed, 45 insertions, 0 deletions
diff --git a/libyasm/bc-int.h b/libyasm/bc-int.h index e5e98b28..0b8b20b4 100644 --- a/libyasm/bc-int.h +++ b/libyasm/bc-int.h @@ -65,6 +65,9 @@ struct bytecode { /* other assembler state info */ unsigned long offset; /* 0 if unknown */ + /* storage for optimizer flags */ + unsigned long opt_flags; + /* architecture-dependent data may be appended */ }; void *bc_get_data(bytecode *); diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index eaf05dc7..fe9f7006 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -143,6 +143,8 @@ bc_new_common(bytecode_type type, size_t datasize) bc->offset = 0; + bc->opt_flags = 0; + return bc; } diff --git a/libyasm/section.c b/libyasm/section.c index ef897913..07768922 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -53,6 +53,8 @@ struct section { /*@owned@*/ expr *start; } data; + + unsigned long opt_flags; /* storage for optimizer flags */ int res_only; /* allow only resb family of bytecodes? */ @@ -116,6 +118,7 @@ sections_switch_general(sectionhead *headp, const char *name, void *of_data, s->data.general.of_data = of_data; bytecodes_initialize(&s->bc); + s->opt_flags = 0; s->res_only = res_only; *isnew = 1; @@ -136,6 +139,7 @@ sections_switch_absolute(sectionhead *headp, expr *start) s->data.start = start; bytecodes_initialize(&s->bc); + s->opt_flags = 0; s->res_only = 1; return s; @@ -148,6 +152,18 @@ section_is_absolute(section *sect) return (sect->type == SECTION_ABSOLUTE); } +unsigned long +section_get_opt_flags(const section *sect) +{ + return sect->opt_flags; +} + +void +section_set_opt_flags(section *sect, unsigned long opt_flags) +{ + sect->opt_flags = opt_flags; +} + void sections_delete(sectionhead *headp) { diff --git a/libyasm/section.h b/libyasm/section.h index dd28cade..011d1c75 100644 --- a/libyasm/section.h +++ b/libyasm/section.h @@ -37,6 +37,10 @@ struct objfmt; int section_is_absolute(section *sect); +/* Get and set optimizer flags */ +unsigned long section_get_opt_flags(const section *sect); +void section_set_opt_flags(section *sect, unsigned long opt_flags); + void sections_delete(sectionhead *headp); void sections_print(FILE *f, const sectionhead *headp); diff --git a/libyasm/symrec.c b/libyasm/symrec.c index 76ba18d6..867e8c48 100644 --- a/libyasm/symrec.c +++ b/libyasm/symrec.c @@ -75,6 +75,9 @@ struct symrec { */ /*@null@*/ /*@owned@*/ void *of_data_vis_ce; /*@null@*/ /*@owned@*/ void *of_data_vis_g; + + /* storage for optimizer flags */ + unsigned long opt_flags; }; /* The symbol table: a ternary tree. */ @@ -116,6 +119,7 @@ symrec_get_or_new(const char *name, int in_table) rec->visibility = SYM_LOCAL; rec->of_data_vis_ce = NULL; rec->of_data_vis_g = NULL; + rec->opt_flags = 0; if (in_table) { rec->status = SYM_NOSTATUS; @@ -283,6 +287,18 @@ symrec_get_equ(const symrec *sym) return (const expr *)NULL; } +unsigned long +symrec_get_opt_flags(const symrec *sym) +{ + return sym->opt_flags; +} + +void +symrec_set_opt_flags(symrec *sym, unsigned long opt_flags) +{ + sym->opt_flags = opt_flags; +} + static unsigned long firstundef_line; static /*@dependent@*/ /*@null@*/ const char *firstundef_filename; static int diff --git a/libyasm/symrec.h b/libyasm/symrec.h index 105d48c4..c7d7da1d 100644 --- a/libyasm/symrec.h +++ b/libyasm/symrec.h @@ -47,6 +47,10 @@ SymVisibility symrec_get_visibility(const symrec *sym); /*@observer@*/ /*@null@*/ const expr *symrec_get_equ(const symrec *sym); +/* Get and set optimizer flags */ +unsigned long symrec_get_opt_flags(const symrec *sym); +void symrec_set_opt_flags(symrec *sym, unsigned long opt_flags); + int /*@alt void@*/ symrec_traverse(/*@null@*/ void *d, int (*func) (symrec *sym, /*@null@*/ void *d)); |