From 2836001e82b23ed83c100b74e44f23b57bc5f343 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Fri, 15 Feb 2019 18:00:21 -0800 Subject: Rename emit.h -> backend.h --- backend.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ decl.c | 2 +- deps.mk | 10 +++++----- emit.h | 49 ------------------------------------------------- eval.c | 2 +- qbe.c | 2 +- stmt.c | 2 +- type.c | 2 +- 8 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 backend.h delete mode 100644 emit.h diff --git a/backend.h b/backend.h new file mode 100644 index 0000000..c4b1eaf --- /dev/null +++ b/backend.h @@ -0,0 +1,49 @@ +struct gotolabel { + struct value *label; + _Bool defined; +}; + +struct function { + char *name; + struct declaration *namedecl; + struct type *type; + struct block *start, *end; + struct hashtable *gotos; + uint64_t lastid; +}; + +struct switchcases { + void *root; + struct value *defaultlabel; +}; + +struct representation; +struct declaration; +struct expression; +struct initializer; +struct scope; +struct type; + +struct switchcases *mkswitch(void); +void switchcase(struct switchcases *, uint64_t, struct value *); + +struct value *mkblock(char *); +struct value *mkglobal(char *, _Bool); +struct value *mkintconst(struct representation *, uint64_t); + +uint64_t intconstvalue(struct value *); + +struct function *mkfunc(char *, struct type *, struct scope *); +void funclabel(struct function *, struct value *); +struct value *funcexpr(struct function *, struct expression *); +void funcjmp(struct function *, struct value *); +void funcjnz(struct function *, struct value *, struct value *, struct value *); +void funcret(struct function *, struct value *); +struct gotolabel *funcgoto(struct function *, char *); +void funcswitch(struct function *, struct value *, struct switchcases *, struct value *); +void funcinit(struct function *, struct declaration *, struct initializer *); + +void emitfunc(struct function *, _Bool); +void emitdata(struct declaration *, struct initializer *); + +extern struct representation i8, i16, i32, i64, f32, f64; diff --git a/decl.c b/decl.c index 6d6bd84..03dfb3d 100644 --- a/decl.c +++ b/decl.c @@ -7,8 +7,8 @@ #include #include #include "util.h" +#include "backend.h" #include "decl.h" -#include "emit.h" #include "expr.h" #include "htab.h" #include "init.h" diff --git a/deps.mk b/deps.mk index fa3afd0..4872d72 100644 --- a/deps.mk +++ b/deps.mk @@ -1,8 +1,8 @@ driver.o: driver.c util.h config.h util.o: util.c util.h -decl.o: decl.c util.h decl.h emit.h expr.h htab.h init.h pp.h scope.h \ +decl.o: decl.c util.h backend.h decl.h expr.h htab.h init.h pp.h scope.h \ stmt.h token.h type.h -eval.o: eval.c util.h decl.h emit.h eval.h expr.h token.h type.h +eval.o: eval.c util.h backend.h decl.h eval.h expr.h token.h type.h expr.o: expr.c util.h decl.h eval.h expr.h init.h pp.h scope.h token.h \ type.h htab.o: htab.c util.h htab.h @@ -12,11 +12,11 @@ pp.o: pp.c util.h pp.h scan.h token.h scan.o: scan.c util.h scan.h token.h scope.o: scope.c util.h htab.h scope.h siphash.o: siphash.c -stmt.o: stmt.c util.h decl.h emit.h expr.h pp.h scope.h stmt.h token.h \ +stmt.o: stmt.c util.h backend.h decl.h expr.h pp.h scope.h stmt.h token.h \ type.h tree.o: tree.c util.h tree.h token.o: token.c util.h token.h -type.o: type.c util.h emit.h type.h +type.o: type.c util.h backend.h type.h util.o: util.c util.h -qbe.o: qbe.c util.h decl.h emit.h eval.h expr.h htab.h init.h scope.h \ +qbe.o: qbe.c util.h backend.h decl.h eval.h expr.h htab.h init.h scope.h \ token.h tree.h type.h ops.h diff --git a/emit.h b/emit.h deleted file mode 100644 index c4b1eaf..0000000 --- a/emit.h +++ /dev/null @@ -1,49 +0,0 @@ -struct gotolabel { - struct value *label; - _Bool defined; -}; - -struct function { - char *name; - struct declaration *namedecl; - struct type *type; - struct block *start, *end; - struct hashtable *gotos; - uint64_t lastid; -}; - -struct switchcases { - void *root; - struct value *defaultlabel; -}; - -struct representation; -struct declaration; -struct expression; -struct initializer; -struct scope; -struct type; - -struct switchcases *mkswitch(void); -void switchcase(struct switchcases *, uint64_t, struct value *); - -struct value *mkblock(char *); -struct value *mkglobal(char *, _Bool); -struct value *mkintconst(struct representation *, uint64_t); - -uint64_t intconstvalue(struct value *); - -struct function *mkfunc(char *, struct type *, struct scope *); -void funclabel(struct function *, struct value *); -struct value *funcexpr(struct function *, struct expression *); -void funcjmp(struct function *, struct value *); -void funcjnz(struct function *, struct value *, struct value *, struct value *); -void funcret(struct function *, struct value *); -struct gotolabel *funcgoto(struct function *, char *); -void funcswitch(struct function *, struct value *, struct switchcases *, struct value *); -void funcinit(struct function *, struct declaration *, struct initializer *); - -void emitfunc(struct function *, _Bool); -void emitdata(struct declaration *, struct initializer *); - -extern struct representation i8, i16, i32, i64, f32, f64; diff --git a/eval.c b/eval.c index df53561..ef84943 100644 --- a/eval.c +++ b/eval.c @@ -2,8 +2,8 @@ #include #include #include "util.h" +#include "backend.h" #include "decl.h" -#include "emit.h" #include "eval.h" #include "expr.h" #include "token.h" diff --git a/qbe.c b/qbe.c index 72f4a2e..f0e37c5 100644 --- a/qbe.c +++ b/qbe.c @@ -6,8 +6,8 @@ #include #include #include "util.h" +#include "backend.h" #include "decl.h" -#include "emit.h" #include "eval.h" #include "expr.h" #include "htab.h" diff --git a/stmt.c b/stmt.c index 866d3ff..8eced24 100644 --- a/stmt.c +++ b/stmt.c @@ -5,8 +5,8 @@ #include #include #include "util.h" +#include "backend.h" #include "decl.h" -#include "emit.h" #include "expr.h" #include "pp.h" #include "scope.h" diff --git a/type.c b/type.c index 89f4d0d..90b35c2 100644 --- a/type.c +++ b/type.c @@ -4,7 +4,7 @@ #include #include #include "util.h" -#include "emit.h" +#include "backend.h" #include "type.h" struct type typevoid = {.kind = TYPEVOID}; -- cgit v1.2.3