summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Gilles <sgilles@umd.edu>2020-03-26 01:42:47 -0400
committerS. Gilles <sgilles@umd.edu>2020-06-11 05:09:59 -0400
commitb32614e4bdf8f34fbdf12084a67bb9c3fcf75e77 (patch)
tree5314ca269da5be01ec311dbf2d7ad94b1a6471a0
parent58a13c39b7f3e6ab0bf950908e98b9f0dfb7c951 (diff)
downloadmc-b32614e4bdf8f34fbdf12084a67bb9c3fcf75e77.tar.gz
Add isaggregate for later use with abi conformity.
-rw-r--r--6/asm.h1
-rw-r--r--6/typeinfo.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/6/asm.h b/6/asm.h
index f4c0bad..04c088e 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -316,6 +316,7 @@ size_t tyalign(Type *t);
size_t size(Node *n);
ssize_t tyoffset(Type *ty, Node *memb);
ssize_t offset(Node *aggr, Node *memb);
+int isaggregate(Type *t);
int stacknode(Node *n);
int floatnode(Node *n);
void breakhere();
diff --git a/6/typeinfo.c b/6/typeinfo.c
index f7ec797..cc12f4a 100644
--- a/6/typeinfo.c
+++ b/6/typeinfo.c
@@ -408,3 +408,10 @@ offset(Node *aggr, Node *memb)
return tyoffset(exprtype(aggr), memb);
}
+int
+isaggregate(Type *t)
+{
+ t = tybase(t);
+ return (t->type == Tystruct || t->type == Tyarray || t->type == Tytuple ||
+ (t->type == Tyunion && !isenum(t)));
+}