Skip to content

Commit 30021dd

Browse files
Adding machine info (#575)
The `MachineInfo` semantics productions are now connected to the JSON which now includes it with an update. This is ignored in the `Pgm` currently, but could be used to make `isize` and `usize` dynamic on `pointer-width` - although, I am not sure how to do that atm. This is currently pointing to a different branch of stable mir json --------- Co-authored-by: devops <[email protected]>
1 parent f902748 commit 30021dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+15886
-4515
lines changed

kmir/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "kmir"
7-
version = "0.3.153"
7+
version = "0.3.154"
88
description = ""
99
requires-python = "~=3.10"
1010
dependencies = [

kmir/src/kmir/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from typing import Final
22

3-
VERSION: Final = '0.3.153'
3+
VERSION: Final = '0.3.154'

kmir/src/kmir/kdist/mir-semantics/kmir-ast.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module KMIR-AST
1717
imports TYPES
1818
1919
20-
syntax Pgm ::= Symbol GlobalAllocs FunctionNames MonoItems TypeMappings
21-
[symbol(pgm), group(mir---name--allocs--functions--items--types)]
20+
syntax Pgm ::= Symbol GlobalAllocs FunctionNames MonoItems TypeMappings MachineInfo
21+
[symbol(pgm), group(mir---name--allocs--functions--items--types--machine)]
2222
2323
syntax FunctionKind ::= functionNormalSym(Symbol) [symbol(FunctionKind::NormalSym), group(mir-enum)]
2424
| functionIntrinsic(Symbol) [symbol(FunctionKind::IntrinsicSym), group(mir-enum)]

kmir/src/kmir/kdist/mir-semantics/kmir.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function map and the initial memory have to be set up.
4545

4646
```k
4747
// #init step, assuming a singleton in the K cell
48-
rule <k> #init(_NAME:Symbol _ALLOCS:GlobalAllocs FUNCTIONS:FunctionNames ITEMS:MonoItems TYPES:TypeMappings)
48+
rule <k> #init(_NAME:Symbol _ALLOCS:GlobalAllocs FUNCTIONS:FunctionNames ITEMS:MonoItems TYPES:TypeMappings _MACHINE:MachineInfo)
4949
=>
5050
#execFunction(#findItem(ITEMS, FUNCNAME), FUNCTIONS)
5151
</k>

kmir/src/kmir/kdist/mir-semantics/target.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
```k
2+
requires "ty.md"
3+
24
module TARGET-SORTS
35
46
syntax MachineSize
@@ -8,10 +10,12 @@ endmodule
810
module TARGET
911
imports TARGET-SORTS
1012
imports INT
13+
imports TYPES
1114
12-
syntax MachineInfo ::= machineInfo(endian: Endian, pointerWidth: MachineSize)
13-
syntax Endian ::= "endianLittle" | "endianBig"
14-
syntax MachineSize ::= machineSize(numBits: Int)
15+
syntax MachineInfo ::= machineInfo(endian: Endian, pointerWidth: MachineSize) [group(mir---endian--pointer-width)]
16+
syntax Endian ::= "endianLittle" [group(mir-enum), symbol(Endian::Little)]
17+
| "endianBig" [group(mir-enum), symbol(Endian::Big)]
18+
syntax MachineSize ::= machineSize(numBits: MIRInt) [group(mir---num-bits), symbol(MachineSize::num_bits)]
1519
1620
endmodule
1721
```

0 commit comments

Comments
 (0)