From 505d8a2d364b3012455068d433ccec73cac38a50 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Wed, 8 Jan 2020 20:17:50 +0000 Subject: Add option to enable/disable boxing Only affects atomic types, not structs. Accepts three options: - "-u always": always boxes - "-u never": never boxes - "-u smart": inserts a comparison of sizes, and boxes only if the item is bigger than a pointer. "smart" is smart in name only; I expected the comparison to be optimised away (since the sizes of the types are known at compile-time), but it seems to run significantly slower than the other options. Steps to improve: - try making the comparison compile-time (or, if it already is, find out why it's so slow); --- llvm_codegen.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'llvm_codegen.h') diff --git a/llvm_codegen.h b/llvm_codegen.h index 0662a67..7c97223 100644 --- a/llvm_codegen.h +++ b/llvm_codegen.h @@ -3,7 +3,13 @@ #include "sinter.h" -void llvm_codegen_prologue(char *filename); +typedef enum { + ALWAYS_BOX, + NEVER_BOX, + SMART_BOX +} boxing_rule_t; + +void llvm_codegen_prologue(char *filename, boxing_rule_t boxing_rule); void llvm_codegen(sexpr *ast); int llvm_codegen_epilogue(char *output_filename, format_t format); -- cgit v1.2.1