commit ec7703e4c151033430e508661189279927d4848b
parent 1e9a3340c9007708fa3afbcb62bb8da290c8e7a2
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 1 Jul 2021 11:21:28 -0400
gen: pull in the type store
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/gen.h b/include/gen.h
@@ -3,6 +3,7 @@
#include <stddef.h>
#include "identifier.h"
#include "qbe.h"
+#include "type_store.h"
#include "types.h"
enum fixed_aborts {
@@ -23,6 +24,7 @@ struct gen_arch {
struct gen_context {
struct qbe_program *out;
+ struct type_store *store;
struct identifier *ns;
struct qbe_func *current;
struct gen_temp *rval;
@@ -31,7 +33,9 @@ struct gen_context {
};
struct unit;
-void gen(const struct unit *unit, struct qbe_program *out);
+void gen(const struct unit *unit,
+ struct type_store *store,
+ struct qbe_program *out);
// qinstr.c
enum qbe_instr alloc_for_align(size_t align);
diff --git a/src/gen.c b/src/gen.c
@@ -219,10 +219,11 @@ gen_decl(struct gen_context *ctx, const struct declaration *decl)
}
void
-gen(const struct unit *unit, struct qbe_program *out)
+gen(const struct unit *unit, struct type_store *store, struct qbe_program *out)
{
struct gen_context ctx = {
.out = out,
+ .store = store,
.ns = unit->ns,
.arch = {
.ptr = &qbe_long,
diff --git a/src/main.c b/src/main.c
@@ -191,7 +191,7 @@ main(int argc, char *argv[])
}
struct qbe_program prog = {0};
- gen(&unit, &prog);
+ gen(&unit, &ts, &prog);
if (stage == STAGE_GEN) {
return EXIT_SUCCESS;
}