summaryrefslogtreecommitdiff
path: root/il.fun
diff options
context:
space:
mode:
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