summaryrefslogtreecommitdiff
path: root/6/asm.h
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-12-21 18:41:45 -0800
committerOri Bernstein <ori@eigenstate.org>2014-12-21 18:41:45 -0800
commitb85c69ca0c686edc76fcf4bb2da54e3b5263bbba (patch)
tree7cc4491fbc41c90a84ace02c2c327af64e346b5f /6/asm.h
parent2433e863b1b3e802f38dd6db534b52867f670269 (diff)
downloadmc-b85c69ca0c686edc76fcf4bb2da54e3b5263bbba.tar.gz
First attempt at supporting plan9 assemblers.
Diffstat (limited to '6/asm.h')
-rw-r--r--6/asm.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/6/asm.h b/6/asm.h
index f6372a3..8eb7fc2 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -20,7 +20,7 @@ typedef enum {
} AsmOp;
typedef enum {
-#define Reg(r, name, mode) r,
+#define Reg(r, gasname, p9name, mode) r,
#include "regs.def"
#undef Reg
Nreg
@@ -54,6 +54,11 @@ typedef enum {
Nclass,
} Rclass;
+typedef enum {
+ Gnugas,
+ Plan9,
+} Asmsyntax;
+
/* a register, label, or memory location */
struct Loc {
Loctype type; /* the type of loc */
@@ -186,7 +191,6 @@ struct Isel {
};
/* globals */
-extern char *modenames[];
extern Type *tyintptr;
extern Type *tyword;
extern Type *tyvoid;
@@ -197,7 +201,9 @@ extern int extracheck;
void simpglobl(Node *dcl, Htab *globls, Func ***fn, size_t *nfn, Node ***blob, size_t *nblob);
void selfunc(Isel *is, Func *fn, Htab *globls, Htab *strtab);
-void gen(Node *file, char *out);
+void gen(Asmsyntax syn, Node *file, char *out);
+void gengas(Node *file, char *out);
+void genp9(Node *file, char *out);
/* location generation */
extern size_t maxregid;
@@ -222,13 +228,10 @@ int isintmode(Mode m);
/* emitting instructions */
Insn *mkinsn(AsmOp op, ...);
-void iprintf(FILE *fd, Insn *insn);
-void locprint(FILE *fd, Loc *l, char spec);
+void dbgiprintf(FILE *fd, Insn *insn);
+void dbglocprint(FILE *fd, Loc *l, char spec);
/* register allocation */
-extern char *regnames[]; /* name table */
-extern Mode regmodes[]; /* mode table */
-extern size_t modesize[]; /* mode size table */
void regalloc(Isel *s);
Rclass rclass(Loc *l);