summaryrefslogtreecommitdiff
path: root/il.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-08 23:51:31 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-08 23:51:31 +0200
commitffee5da4dab26c8500add63da540ee252545370f (patch)
tree0306ad055672bb684687e342b318745df1e057ce /il.fun
parenta417225089fd78d53d73ad63cd79f57d1a4a8ff1 (diff)
Variadic function declarations and calls
Diffstat (limited to 'il.fun')
-rw-r--r--il.fun12
1 files changed, 10 insertions, 2 deletions
diff --git a/il.fun b/il.fun
index 55f97de..9f8c2b7 100644
--- a/il.fun
+++ b/il.fun
@@ -385,6 +385,14 @@ functor IL(P: PARSER) = struct
if isFunc then Reg v else Addr v
end
+ fun convStrlit ctx id t =
+ let
+ val v = getNew8 ctx
+ in
+ ctxPutOp ctx (IrSet (v, SaAddr (id, 0w0)));
+ (if P.isArray t then Addr else Reg) v
+ end
+
fun convId ctx (P.Gid p) = convGLconst ctx p
| convId (Lctx { localVars, paramNum, ... }) (P.Lid id) =
if id < paramNum then (* function parameter *)
@@ -994,7 +1002,7 @@ functor IL(P: PARSER) = struct
Reg vRes
end
- and convExpr ctx ea: ev =
+ and convExpr ctx ea =
let
val P.EA (e, _, _, t) = ea
in
@@ -1002,7 +1010,7 @@ functor IL(P: PARSER) = struct
P.Eid (_, loc) => convId ctx (valOf loc)
| P.Econst (_, P.Ninteger w) => convConst ctx (w, t)
| P.Econst (_, _) => raise Unreachable
- | P.Estrlit id => convGLconst ctx (id, false)
+ | P.Estrlit id => convStrlit ctx id t
| P.EmemberByV (ea, field) => convFieldAccessByV ctx ea field
| P.EmemberByP (ea, field) => convFieldAccesByP ctx ea field
| P.EsizeofType t => convSizeOfType ctx t