mirror of
https://github.com/cc65/cc65.git
synced 2025-02-06 12:31:12 +00:00
SymEntry struct cleanups.
This commit is contained in:
parent
ad7c5a6617
commit
959be2c98c
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
/* cc65 */
|
/* cc65 */
|
||||||
#include "anonname.h"
|
#include "anonname.h"
|
||||||
|
#include "asmlabel.h"
|
||||||
#include "declare.h"
|
#include "declare.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "symentry.h"
|
#include "symentry.h"
|
||||||
@ -65,13 +66,12 @@ SymEntry* NewSymEntry (const char* Name, unsigned Flags)
|
|||||||
E->NextHash = 0;
|
E->NextHash = 0;
|
||||||
E->PrevSym = 0;
|
E->PrevSym = 0;
|
||||||
E->NextSym = 0;
|
E->NextSym = 0;
|
||||||
E->Link = 0;
|
|
||||||
E->Owner = 0;
|
E->Owner = 0;
|
||||||
E->Flags = Flags;
|
E->Flags = Flags;
|
||||||
E->Type = 0;
|
E->Type = 0;
|
||||||
E->Attr = 0;
|
E->Attr = 0;
|
||||||
E->AsmName = 0;
|
E->AsmName = 0;
|
||||||
E->V.BssName = 0;
|
memset (&E->V, 0, sizeof (E->V));
|
||||||
memcpy (E->Name, Name, Len+1);
|
memcpy (E->Name, Name, Len+1);
|
||||||
|
|
||||||
/* Return the new entry */
|
/* Return the new entry */
|
||||||
@ -250,7 +250,9 @@ void SymUseAttr (SymEntry* Sym, struct Declaration* D)
|
|||||||
|
|
||||||
|
|
||||||
void SymSetAsmName (SymEntry* Sym)
|
void SymSetAsmName (SymEntry* Sym)
|
||||||
/* Set the assembler name for an external symbol from the name of the symbol */
|
/* Set the assembler name for an external symbol from the name of the symbol.
|
||||||
|
** The symbol must have no assembler name set yet.
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
unsigned Len;
|
unsigned Len;
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ struct SymEntry {
|
|||||||
SymEntry* NextHash; /* Next entry in hash list */
|
SymEntry* NextHash; /* Next entry in hash list */
|
||||||
SymEntry* PrevSym; /* Previous symbol in dl list */
|
SymEntry* PrevSym; /* Previous symbol in dl list */
|
||||||
SymEntry* NextSym; /* Next symbol double linked list */
|
SymEntry* NextSym; /* Next symbol double linked list */
|
||||||
SymEntry* Link; /* General purpose single linked list */
|
|
||||||
struct SymTable* Owner; /* Symbol table the symbol is in */
|
struct SymTable* Owner; /* Symbol table the symbol is in */
|
||||||
unsigned Flags; /* Symbol flags */
|
unsigned Flags; /* Symbol flags */
|
||||||
Type* Type; /* Symbol type */
|
Type* Type; /* Symbol type */
|
||||||
@ -138,27 +137,9 @@ struct SymEntry {
|
|||||||
/* Data that differs for the different symbol types */
|
/* Data that differs for the different symbol types */
|
||||||
union {
|
union {
|
||||||
|
|
||||||
/* Offset for locals or struct members */
|
/* Offset for locals */
|
||||||
int Offs;
|
int Offs;
|
||||||
|
|
||||||
/* Data for anonymous struct or union members */
|
|
||||||
struct {
|
|
||||||
int Offs; /* Byte offset into struct */
|
|
||||||
unsigned ANumber; /* Numeric ID */
|
|
||||||
SymEntry* Field; /* The real field aliased */
|
|
||||||
} A;
|
|
||||||
|
|
||||||
|
|
||||||
/* Label name for static symbols */
|
|
||||||
struct {
|
|
||||||
unsigned Label;
|
|
||||||
Collection *DefsOrRefs;
|
|
||||||
struct CodeEntry *IndJumpFrom;
|
|
||||||
} L;
|
|
||||||
|
|
||||||
/* Value of SP adjustment needed after forward 'goto' */
|
|
||||||
unsigned short SPAdjustment;
|
|
||||||
|
|
||||||
/* Register bank offset and offset of the saved copy on stack for
|
/* Register bank offset and offset of the saved copy on stack for
|
||||||
** register variables.
|
** register variables.
|
||||||
*/
|
*/
|
||||||
@ -167,32 +148,50 @@ struct SymEntry {
|
|||||||
int SaveOffs;
|
int SaveOffs;
|
||||||
} R;
|
} R;
|
||||||
|
|
||||||
/* Value for constants (including enums) */
|
/* Segment name for tentantive global definitions */
|
||||||
|
const char* BssName;
|
||||||
|
|
||||||
|
/* Value for integer constants (including enumerators) */
|
||||||
long ConstVal;
|
long ConstVal;
|
||||||
|
|
||||||
/* Data for structs/unions */
|
|
||||||
struct {
|
|
||||||
struct SymTable* SymTab; /* Member symbol table */
|
|
||||||
unsigned Size; /* Size of the union/struct */
|
|
||||||
unsigned ACount; /* Count of anonymous fields */
|
|
||||||
} S;
|
|
||||||
|
|
||||||
/* Data for enums */
|
|
||||||
struct {
|
|
||||||
struct SymTable* SymTab; /* Member symbol table */
|
|
||||||
const Type* Type; /* Underlying type */
|
|
||||||
} E;
|
|
||||||
|
|
||||||
/* Data for functions */
|
/* Data for functions */
|
||||||
struct {
|
struct {
|
||||||
struct Segments* Seg; /* Segments for this function */
|
struct Segments* Seg; /* Segments for this function */
|
||||||
struct LiteralPool* LitPool; /* Literal pool for this function */
|
struct LiteralPool* LitPool; /* Literal pool for this function */
|
||||||
} F;
|
} F;
|
||||||
|
|
||||||
/* Segment name for tentantive global definitions */
|
/* Label name for static symbols */
|
||||||
const char* BssName;
|
struct {
|
||||||
|
unsigned Label;
|
||||||
|
Collection *DefsOrRefs;
|
||||||
|
struct CodeEntry *IndJumpFrom;
|
||||||
|
} L;
|
||||||
|
|
||||||
|
/* Value of SP adjustment needed after forward 'goto' */
|
||||||
|
unsigned short SPAdjustment;
|
||||||
|
|
||||||
|
/* Data for anonymous struct or union members */
|
||||||
|
struct {
|
||||||
|
int Offs; /* Byte offset into struct */
|
||||||
|
unsigned ANumber; /* Numeric ID */
|
||||||
|
SymEntry* Field; /* The real field aliased */
|
||||||
|
} A;
|
||||||
|
|
||||||
|
/* Data for structs/unions tags */
|
||||||
|
struct {
|
||||||
|
struct SymTable* SymTab; /* Member symbol table */
|
||||||
|
unsigned Size; /* Size of the union/struct */
|
||||||
|
unsigned ACount; /* Count of anonymous fields */
|
||||||
|
} S;
|
||||||
|
|
||||||
|
/* Data for enums tags */
|
||||||
|
struct {
|
||||||
|
struct SymTable* SymTab; /* Member symbol table */
|
||||||
|
const Type* Type; /* Underlying type */
|
||||||
|
} E;
|
||||||
|
|
||||||
} V;
|
} V;
|
||||||
char Name[1]; /* Name, dynamically allocated */
|
char Name[1]; /* Name, dynamically allocated */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -303,7 +302,9 @@ void SymUseAttr (SymEntry* Sym, struct Declaration* D);
|
|||||||
/* Use the attributes from the declaration for this symbol */
|
/* Use the attributes from the declaration for this symbol */
|
||||||
|
|
||||||
void SymSetAsmName (SymEntry* Sym);
|
void SymSetAsmName (SymEntry* Sym);
|
||||||
/* Set the assembler name for an external symbol from the name of the symbol */
|
/* Set the assembler name for an external symbol from the name of the symbol.
|
||||||
|
** The symbol must have no assembler name set yet.
|
||||||
|
*/
|
||||||
|
|
||||||
void CvtRegVarToAuto (SymEntry* Sym);
|
void CvtRegVarToAuto (SymEntry* Sym);
|
||||||
/* Convert a register variable to an auto variable */
|
/* Convert a register variable to an auto variable */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user