Fix some bugs in C compiler asxxxx code generation / optimization
authorNick Downing <nick@ndcode.org>
Mon, 8 Aug 2022 01:40:05 +0000 (11:40 +1000)
committerNick Downing <nick@ndcode.org>
Mon, 8 Aug 2022 01:40:05 +0000 (11:40 +1000)
bin/aspdp11
usr/src/cmd/c/c2.h
usr/src/cmd/c/c20.c

index e0dbce6..73cae92 100755 (executable)
Binary files a/bin/aspdp11 and b/bin/aspdp11 differ
index 5a8c587..84e89ea 100644 (file)
@@ -9,6 +9,9 @@
 #define        JMP     3
 #define        LABEL   4
 #define        DLABEL  5
+#if 1 /* .globl is now accepted within code (occurs before jsr) */
+#define GLOBL  6
+#endif
 #define        EROU    7
 #define        JSW     9
 #define        MOV     10
index 9e5cc45..63627c8 100644 (file)
@@ -18,7 +18,11 @@ struct optab optab[] {
        "jlos", CBR | JLOS<<8,
        "jhis", CBR | JHIS<<8,
        "jmp",  JMP,
+#if 1 /* .globl is now accepted within code (occurs before jsr) */
+       ".globl",GLOBL,
+#else
        ".globl",EROU,
+#endif
        "mov",  MOV,
        "clr",  CLR,
        "com",  COM,
@@ -399,6 +403,14 @@ oplook()
        for (lp = line; *lp && *lp!=' ' && *lp!='\t';)
                *np++ = *lp++;
        *np++ = 0;
+#if 1 /* hack: treat .area\tname as a single token */
+ if (strcmp(tmpop, ".area") == 0 && *lp) {
+  np[-1] = *lp++;
+  for (lp = line; *lp && *lp!=' ' && *lp!='\t';)
+   *np++ = *lp++;
+  *np++ = 0;
+ }
+#endif
        while (*lp=='\t' || *lp==' ')
                lp++;
        curlp = lp;