aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ir.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-23 23:38:53 +0100
committerlemon <lsof@mailbox.org>2026-03-23 23:43:52 +0100
commit62d995124c0cc2eaeec79e18edc3e044f3e524c9 (patch)
tree4c79a80efca09f8050109aa0440ec75351d72c17 /src/ir.h
parent8630aeb8b43c507cd00f5b091ddcee4def464f4d (diff)
IR: emit inline function standalone bodies lazily
If a function is stashed for inlining and inlined in all of its callsites or unused, it never ends up in the object file. If any symbol reference to it is emitted, then it must be de-inlined (rematerialized), and this is done near the end before emitting the actual object file.
Diffstat (limited to 'src/ir.h')
-rw-r--r--src/ir.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ir.h b/src/ir.h
index 2d7cb42..2070ffd 100644
--- a/src/ir.h
+++ b/src/ir.h
@@ -28,7 +28,7 @@ enum symflags {
typedef struct IRCon {
bool issym, isdat, deref;
uchar cls;
- uchar flag;
+ uchar flag; /* enum symflags */
union {
internstr sym;
int dat;
@@ -262,6 +262,7 @@ extern int visitmark;
#define mkarginstr(ty, x) mkinstr2(Oarg, 0, mktyperef(ty), (x))
void irinit(Function *);
void irfini(Function *);
+void irfini_end(Function *);
#define cls2type(k) ((IRType){.cls=(k)})
IRType mkirtype(Type);
Ref newxcon(const IRCon *);
@@ -279,6 +280,7 @@ Ref mksymref(internstr, enum symflags);
Ref mkdatref(internstr sym, Type ctype, uint siz, uint align,
const void *, uint n, bool deref, bool funclocal);
internstr xcon2sym(int ref);
+#define objrelocxcon(xc, ...) objreloc(xcon2sym(xc), contab.p[xc].flag, __VA_ARGS__)
Instr mkalloca(uint siz, uint align);
Ref mkcallarg(IRType ret, uint narg, int vararg);
#define mkintrin(B, C, N) mkinstr2(Ointrin, C, mkref(RICON, B), mkcallarg((IRType){{0}},N,-1))
@@ -350,6 +352,7 @@ void cselim(Function *);
/** inliner.c **/
bool maybeinlinee(Function *);
void doinline(Function *);
+void emitxinlfns(bool all);
/** intrin.c **/
void lowerintrin(Function *);