]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeent.c
Added the lineinfo module. Changed the complete code generation to use the
[cc65] / src / cc65 / codeent.c
index c96a95ef81b05102185bef6ef70d16f830c908ea..ead59afaf98d268db50ac7d535ff6f18a888199e 100644 (file)
@@ -160,7 +160,8 @@ static void SetUseChgInfo (CodeEntry* E, const OPCDesc* D)
 
 
 
-CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, CodeLabel* JumpTo)
+CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg,
+                        CodeLabel* JumpTo, LineInfo* LI)
 /* Create a new code entry, initialize and return it */
 {
     /* Get the opcode description */
@@ -170,18 +171,14 @@ CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, CodeLabel* JumpTo)
     CodeEntry* E = xmalloc (sizeof (CodeEntry));
 
     /* Initialize the fields */
-    E->OPC     = D->OPC;
-    E->AM      = AM;
-    E->Size    = GetInsnSize (E->OPC, E->AM);
-    E->Hints   = 0;
-    E->Arg             = GetArgCopy (Arg);
-    if (NumArg (E->Arg, &E->Num)) {
-       E-> Flags = CEF_NUMARG;
-    } else {
-               E->Flags  = 0;
-    }
+    E->OPC    = D->OPC;
+    E->AM     = AM;
+    E->Arg    = GetArgCopy (Arg);
+    E->Flags  = NumArg (E->Arg, &E->Num)? CEF_NUMARG : 0;
+    E->Size   = GetInsnSize (E->OPC, E->AM);
     E->Info   = D->Info;
     E->JumpTo = JumpTo;
+    E->LI     = UseLineInfo (LI);
     SetUseChgInfo (E, D);
     InitCollection (&E->Labels);
 
@@ -205,6 +202,9 @@ void FreeCodeEntry (CodeEntry* E)
     /* Cleanup the collection */
     DoneCollection (&E->Labels);
 
+    /* Release the line info */
+    ReleaseLineInfo (E->LI);
+
     /* Free the entry */
     xfree (E);
 }
@@ -359,7 +359,7 @@ void OutputCodeEntry (const CodeEntry* E, FILE* F)
     /* Print usage info if requested by the debugging flag */
 //    if (Debug) {
        Chars += fprintf (F,
-                         "%*s; USE: %c%c%c CHG: %c%c%c SIZE: %u",
+                         "%*s; USE: %c%c%c CHG: %c%c%c SIZE: %u\n",
                          30-Chars, "",
                                  (E->Use & REG_A)? 'A' : '_',
                                  (E->Use & REG_X)? 'X' : '_',
@@ -375,3 +375,4 @@ void OutputCodeEntry (const CodeEntry* E, FILE* F)
 
 
 
+