aboutsummaryrefslogtreecommitdiff
path: root/src/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.c')
-rw-r--r--src/compile.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/src/compile.c b/src/compile.c
index 11b75a5..dd4c73d 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -4,12 +4,11 @@
#include <posthaste/compile.h>
#include <posthaste/lower.h>
+#include <posthaste/utils.h>
#include <posthaste/date.h>
#include <lightening/lightening.h>
-#define UNUSED(x) (void)x
-
static void compile_fn(struct fn *f);
static void *alloc_arena(size_t size)
@@ -393,19 +392,7 @@ static void compile_load_day(jit_state_t *j, struct insn i)
static int64_t load_weekday(int64_t i0)
{
struct tm time = tm_from_date((ph_date_t)i0);
-
- const char *day = "Sunday";
- switch (time.tm_wday) {
- case 0: day = "Sunday"; break;
- case 1: day = "Monday"; break;
- case 2: day = "Tuesday"; break;
- case 3: day = "Wednesday"; break;
- case 4: day = "Thursday"; break;
- case 5: day = "Friday"; break;
- case 6: day = "Saturday"; break;
- }
-
- return (int64_t)day;
+ return (int64_t)time.tm_wday;
}
static void compile_load_weekday(jit_state_t *j, struct insn i)
@@ -638,16 +625,3 @@ void compile()
struct fn *f = find_fn(0);
compile_fn(f);
}
-
-void execute_compilation()
-{
- struct fn *f = find_fn(0);
- void (*p)(int64_t *globals) = f->arena;
-
- struct vec globals = vec_create(sizeof(int64_t));
- vec_reserve(&globals, 65535);
-
- p(globals.buf);
-
- vec_destroy(&globals);
-}