summaryrefslogtreecommitdiff
path: root/6/asm.h
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-06-27 13:38:48 -0700
committerOri Bernstein <ori@eigenstate.org>2015-06-27 13:42:46 -0700
commita16c4e637079bb3d7f1cb93ae9b2348d710c003f (patch)
tree838d8df86ac165e931d62fa295c75d168b1f75cc /6/asm.h
parentfa8e0920764f9f298d6b6ac9471c862aec024e01 (diff)
downloadmc-a16c4e637079bb3d7f1cb93ae9b2348d710c003f.tar.gz
Factor out blob generation.
The logic for our type layout is common between platforms.
Diffstat (limited to '6/asm.h')
-rw-r--r--6/asm.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/6/asm.h b/6/asm.h
index 4d55ac4..598bf12 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -68,6 +68,7 @@ typedef enum {
Btref,
Btbytes,
Btseq,
+ Btpad,
} Blobtype;
struct Blob {
@@ -75,10 +76,12 @@ struct Blob {
char *lbl; /* may be null */
char isglobl;
union {
+ uint64_t npad;
uint64_t ival;
struct {
char *str;
char isextern;
+ size_t off;
} ref;
struct {
size_t len;
@@ -238,7 +241,17 @@ 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 stuff */
+Blob *mkblobpad(size_t sz);
+Blob *mkblobi(Blobtype type, uint64_t ival);
+Blob *mkblobbytes(char *buf, size_t len);
+Blob *mkblobseq(Blob **sub, size_t nsub);
+Blob *mkblobref(char *lbl, size_t off, int isextern);
+void blobfree(Blob *b);
+
Blob *tydescblob(Type *t);
+Blob *litblob(Htab *globls, Htab *strtab, Node *n);
size_t blobsz(Blob *b);
/* location generation */