summaryrefslogtreecommitdiff
path: root/6/asm.h
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-05-18 10:26:33 -0700
committerOri Bernstein <ori@eigenstate.org>2015-05-18 10:26:33 -0700
commitac3d02cdfbafe7b887cbd8738d3df9b17c5c82c9 (patch)
treef23a7fd2a1259c6fa2be8079cdbb80760463c21d /6/asm.h
parent1520007d5fd0238f7ea3bf7aa7269043976bf3d6 (diff)
downloadmc-ac3d02cdfbafe7b887cbd8738d3df9b17c5c82c9.tar.gz
Improve type generation code.
This should be simpler to port to plan 9, and the data should be more compact.
Diffstat (limited to '6/asm.h')
-rw-r--r--6/asm.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/6/asm.h b/6/asm.h
index 31599b2..164c3dc 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -12,6 +12,7 @@ typedef struct Func Func;
typedef struct Blob Blob;
typedef struct Isel Isel;
typedef struct Asmbb Asmbb;
+typedef struct Blob Blob;
typedef enum {
#define Insn(val, gasfmt, p9fmt, use, def) val,
@@ -59,6 +60,35 @@ typedef enum {
Plan9,
} Asmsyntax;
+typedef enum {
+ Bti8,
+ Bti16,
+ Bti32,
+ Bti64,
+ Btimin, /* byte-packed uint */
+ Btref,
+ Btbytes,
+ Btseq,
+} Blobtype;
+
+struct Blob {
+ Blobtype type;
+ char *lbl; /* may be null */
+ char isglobl;
+ union {
+ uint64_t ival;
+ char *ref;
+ struct {
+ size_t len;
+ char *buf;
+ } bytes;
+ struct {
+ size_t nsub;
+ Blob **sub;
+ } seq;
+ };
+};
+
/* a register, label, or memory location */
struct Loc {
Loctype type; /* the type of loc */
@@ -205,6 +235,7 @@ void selfunc(Isel *is, Func *fn, Htab *globls, Htab *strtab);
void gen(Node *file, char *out);
void gengas(Node *file, char *out);
void genp9(Node *file, char *out);
+Blob *tydescblob(Type *t);
/* location generation */
extern size_t maxregid;
@@ -238,7 +269,6 @@ void dbglocprint(FILE *fd, Loc *l, char spec);
void regalloc(Isel *s);
Rclass rclass(Loc *l);
-
/* useful functions */
size_t tysize(Type *t);
size_t size(Node *n);