Rewrote literal handling. Literals are now saved together with other function
data, and at the end of compilation merged if possible. Literals for unused functions are removed together with the function. git-svn-id: svn://svn.cc65.org/cc65/trunk@4501 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "asmlabel.h"
|
||||
#include "asmstmt.h"
|
||||
#include "codegen.h"
|
||||
#include "codeopt.h"
|
||||
#include "compile.h"
|
||||
#include "declare.h"
|
||||
#include "error.h"
|
||||
@@ -373,30 +374,16 @@ void Compile (const char* FileName)
|
||||
/* Close the output file */
|
||||
CloseOutputFile ();
|
||||
|
||||
if (Debug) {
|
||||
PrintMacroStats (stdout);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* Ok, start the ball rolling... */
|
||||
Parse ();
|
||||
|
||||
/* Dump the literal pool. */
|
||||
DumpLiteralPool ();
|
||||
|
||||
/* Write imported/exported symbols */
|
||||
EmitExternals ();
|
||||
|
||||
if (Debug) {
|
||||
PrintLiteralPoolStats (stdout);
|
||||
PrintMacroStats (stdout);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Leave the main lexical level */
|
||||
LeaveGlobalLevel ();
|
||||
if (Debug) {
|
||||
PrintMacroStats (stdout);
|
||||
}
|
||||
|
||||
/* Print an error report */
|
||||
ErrorReport ();
|
||||
@@ -404,4 +391,34 @@ void Compile (const char* FileName)
|
||||
|
||||
|
||||
|
||||
void FinishCompile (void)
|
||||
/* Emit literals, externals, do cleanup and optimizations */
|
||||
{
|
||||
SymTable* SymTab;
|
||||
SymEntry* Func;
|
||||
|
||||
/* Walk over all functions, doing cleanup, optimizations ... */
|
||||
SymTab = GetGlobalSymTab ();
|
||||
Func = SymTab->SymHead;
|
||||
while (Func) {
|
||||
if (SymIsOutputFunc (Func)) {
|
||||
/* Function which is defined and referenced or extern */
|
||||
MoveLiteralPool (Func->V.F.LitPool);
|
||||
CS_MergeLabels (Func->V.F.Seg->Code);
|
||||
RunOpt (Func->V.F.Seg->Code);
|
||||
}
|
||||
Func = Func->NextSym;
|
||||
}
|
||||
|
||||
/* Dump the literal pool */
|
||||
DumpLiteralPool ();
|
||||
|
||||
/* Write imported/exported symbols */
|
||||
EmitExternals ();
|
||||
|
||||
/* Leave the main lexical level */
|
||||
LeaveGlobalLevel ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user