X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcc65%2Fasmcode.c;h=776e36f674e2b4efcf12693030eeac5bc5488f98;hb=60bf40f6dbec6618c0e1c659dfe030c9a7d27480;hp=046043f2b43c6fa8cf9dbb3379e6bd1396d4b056;hpb=e6484f85c7f440aa8b12bbf956bed0b87e4ddeed;p=cc65 diff --git a/src/cc65/asmcode.c b/src/cc65/asmcode.c index 046043f2b..776e36f67 100644 --- a/src/cc65/asmcode.c +++ b/src/cc65/asmcode.c @@ -47,31 +47,33 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ -void AddCodeHint (const char* Hint) -/* Add an optimizer hint */ +CodeMark GetCodePos (void) +/* Get a marker pointing to the current output position */ { - /* ### AddCodeLine ("+%s", Hint); */ + return CS_GetEntryCount (CS->Code); } -CodeMark GetCodePos (void) -/* Get a marker pointing to the current output position */ +void RemoveCode (CodeMark M) +/* Remove all code after the given code marker */ { - return GetCodeSegEntries (CS->Code); + CS_DelCodeAfter (CS->Code, M); } -void RemoveCode (CodeMark M) -/* Remove all code after the given code marker */ +void MoveCode (CodeMark Start, CodeMark End, CodeMark Target) +/* Move the code between Start (inclusive) and End (exclusive) to + * (before) Target. + */ { - DelCodeSegAfter (CS->Code, M); + CS_MoveEntries (CS->Code, Start, End - Start, Target); } @@ -83,7 +85,7 @@ void WriteOutput (FILE* F) SymEntry* Entry; /* Output the global data segment */ - CHECK (GetCodeSegEntries (CS->Code) == 0); + CHECK (!HaveGlobalCode ()); OutputSegments (CS, F); /* Output all global or referenced functions */ @@ -91,14 +93,14 @@ void WriteOutput (FILE* F) Entry = SymTab->SymHead; while (Entry) { if (IsTypeFunc (Entry->Type) && - (Entry->Flags & SC_DEF) != 0 && - (Entry->Flags & (SC_REF | SC_EXTERN)) != 0) { - /* Function which is defined and referenced or extern */ - MergeCodeLabels (Entry->V.F.Seg->Code); - RunOpt (Entry->V.F.Seg->Code); - OutputSegments (Entry->V.F.Seg, F); - } - Entry = Entry->NextSym; + SymIsDef (Entry) && + (Entry->Flags & (SC_REF | SC_EXTERN)) != 0) { + /* Function which is defined and referenced or extern */ + CS_MergeLabels (Entry->V.F.Seg->Code); + RunOpt (Entry->V.F.Seg->Code); + OutputSegments (Entry->V.F.Seg, F); + } + Entry = Entry->NextSym; } }