]> git.sur5r.net Git - cc65/blobdiff - src/cc65/main.c
Avoid a copy of the line contents
[cc65] / src / cc65 / main.c
index f1840a74d4542ab76280a6dae326d1318a812409..32adcb7251229b565cfbdacba061c771a496c3c8 100644 (file)
@@ -9,7 +9,7 @@
 /* (C) 2000-2001 Ullrich von Bassewitz                                       */
 /*               Wacholderweg 14                                             */
 /*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -52,6 +52,7 @@
 /* cc65 */
 #include "asmcode.h"
 #include "compile.h"
+#include "codeopt.h"
 #include "cpu.h"
 #include "error.h"
 #include "global.h"
@@ -59,7 +60,7 @@
 #include "input.h"
 #include "macrotab.h"
 #include "scanner.h"
-#include "segname.h"
+#include "segments.h"
 
 
 
@@ -98,11 +99,13 @@ static void Usage (void)
             "  --bss-name seg\tSet the name of the BSS segment\n"
                     "  --check-stack\t\tGenerate stack overflow checks\n"
                     "  --code-name seg\tSet the name of the CODE segment\n"
-            "  --codesize x\tAccept larger code by factor x\n"
+            "  --codesize x\t\tAccept larger code by factor x\n"
                     "  --cpu type\t\tSet cpu type\n"
                     "  --data-name seg\tSet the name of the DATA segment\n"
                     "  --debug\t\tDebug mode\n"
                     "  --debug-info\t\tAdd debug info to object file\n"
+            "  --disable-opt name\tDisable an optimization step\n"
+                    "  --enable-opt name\tEnable an optimization step\n"
             "  --help\t\tHelp (this text)\n"
                     "  --include-dir dir\tSet an include directory search path\n"
                     "  --rodata-name seg\tSet the name of the RODATA segment\n"
@@ -377,6 +380,22 @@ static void OptDebugInfo (const char* Opt, const char* Arg)
 
 
 
+static void OptDisableOpt (const char* Opt, const char* Arg)
+/* Disable an optimization step */
+{
+    DisableOpt (Arg);
+}
+
+
+
+static void OptEnableOpt (const char* Opt, const char* Arg)
+/* Enable an optimization step */
+{
+    EnableOpt (Arg);
+}
+
+
+
 static void OptHelp (const char* Opt, const char* Arg)
 /* Print usage information and exit */
 {
@@ -463,6 +482,8 @@ int main (int argc, char* argv[])
        { "--data-name",        1,      OptDataName             },
                { "--debug",            0,      OptDebug                },
        { "--debug-info",       0,      OptDebugInfo            },
+       { "--disable-opt",      1,      OptDisableOpt           },
+       { "--enable-opt",       1,      OptEnableOpt,           },
        { "--help",             0,      OptHelp                 },
        { "--include-dir",      1,      OptIncludeDir           },
        { "--rodata-name",      1,      OptRodataName           },
@@ -567,21 +588,19 @@ int main (int argc, char* argv[])
                    P = Arg + 2;
                    while (*P) {
                        switch (*P++) {
-#if 0
                            case 'f':
                                sscanf (P, "%lx", (long*) &OptDisable);
                                break;
-#endif
                            case 'i':
                                FavourSize = 0;
-                               CodeSizeFactor = 200;
+                               CodeSizeFactor = 200;
                                break;
                            case 'r':
-                               EnableRegVars = 1;
+                               EnableRegVars = 1;
                                break;
                            case 's':
                                InlineStdFuncs = 1;
-                               break;
+                               break;
                        }
                    }
                    break;
@@ -619,19 +638,13 @@ int main (int argc, char* argv[])
        AbEnd ("No input files");
     }
 
-    /* Open the input file */
-    OpenMainFile (InputFile);
-
     /* Create the output file name if it was not explicitly given */
     if (OutputFile == 0) {
        OutputFile = MakeFilename (InputFile, ".s");
     }
 
-
-
-
     /* Go! */
-    Compile ();
+    Compile (InputFile);
 
     /* Create the output file if we didn't had any errors */
     if (ErrorCount == 0 || Debug) {