summaryrefslogtreecommitdiff
path: root/parser.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-09 20:10:47 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-09 20:10:47 +0200
commit89cbdbe9e4cb6f142154292cac462e2d130d912a (patch)
tree406fe40478334824d8c7dbb3e56e28794c12179c /parser.fun
parent9bc877d781b988768c79d40a0f6a7055e9ad14e7 (diff)
x86 instruction selection for some IR ops
Diffstat (limited to 'parser.fun')
-rw-r--r--parser.fun15
1 files changed, 13 insertions, 2 deletions
diff --git a/parser.fun b/parser.fun
index d49f895..ca4171a 100644
--- a/parser.fun
+++ b/parser.fun
@@ -1150,7 +1150,7 @@ functor Parser(structure Tree: TREE; structure P: PPC;
if Char.isDigit c then
SOME $ ord c - ord #"0"
else if Char.isHexDigit c then
- SOME $ ord c - ord #"a" + 10
+ SOME $ ord (Char.toLower c) - ord #"a" + 10
else
NONE
@@ -3253,8 +3253,19 @@ functor Parser(structure Tree: TREE; structure P: PPC;
)
end
+ fun makeDivBy8 v =
+ let
+ open Word
+ in
+ (v + 0w7) div 0w8 * 0w8
+ end
+
fun registerLayout layout t toplev =
- D.pushAndGetId iniLayouts (toplev, sizeOfType t, layout)
+ let
+ val size = makeDivBy8 $ sizeOfType t
+ in
+ D.pushAndGetId iniLayouts (toplev, size, layout)
+ end
fun getLayoutSize id = #2 $ D.get iniLayouts id