From 5e9726946dcb9248dbd34ded1bdd4f7af8dc2d31 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 18 Dec 2022 17:35:19 +0100 Subject: new UNDEF Ref Crashing loads of uninitialized memory proved to be a problem when implementing unions using qbe. This patch introduces a new UNDEF Ref to represent data that is known to be uninitialized. Optimization passes can make use of it to eliminate some code. In the last compilation stages, UNDEF is treated as the constant 0xdeaddead. --- all.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'all.h') diff --git a/all.h b/all.h index 47a61d8..7eba443 100644 --- a/all.h +++ b/all.h @@ -90,10 +90,11 @@ enum { RMem, }; -#define R (Ref){0, 0} +#define R (Ref){RTmp, 0} +#define UNDEF (Ref){RCon, 0} /* represents uninitialized data */ +#define CON_Z (Ref){RCon, 1} #define TMP(x) (Ref){RTmp, x} #define CON(x) (Ref){RCon, x} -#define CON_Z CON(0) /* reserved zero constant */ #define SLOT(x) (Ref){RSlot, (x)&0x1fffffff} #define TYPE(x) (Ref){RType, x} #define CALL(x) (Ref){RCall, x} -- cgit 1.4.1