@@ -2,7 +2,7 @@ module ALIGNMENT-SYNTAX
2
2
imports SYMLOC-SORTS
3
3
imports INT-SYNTAX
4
4
5
- syntax Int ::= getAlign(SymLoc) [function]
5
+ syntax Int ::= getAlign(SymLoc) [function, withConfig ]
6
6
syntax Int ::= getNativeAlign(address: Int, max: Int) [function]
7
7
endmodule
8
8
@@ -14,16 +14,24 @@ module ALIGNMENT
14
14
imports C-SETTINGS-SYNTAX
15
15
16
16
rule getAlign(NullPointer) => cfg:alignofMalloc
17
- rule getAlign(Loc::SymLoc) => getAlign'(base(Loc), offset(Loc)) [owise]
18
- syntax Int ::= "getAlign'" "(" SymBase "," Int ")" [function, withConfig]
17
+ rule getAlign(Loc::SymLoc) => getAlign'(base(Loc), offset(Loc))
18
+ requires notBool isLinkerLoc(Loc)
19
+ rule [[ getAlign(Loc::SymLoc => resolveLinking(Loc, Linkings)) ]]
20
+ <linkings> Linkings::Map </linkings>
21
+ requires isLinkerLoc(Loc) andBool base(Loc) in_keys(Linkings)
22
+ rule getAlign(Loc::SymLoc) => getAlign'(base(Loc), offset(Loc))
23
+ [owise]
24
+
25
+ syntax Int ::= "getAlign'" "(" SymBase "," Int ")" [function]
26
+ rule getAlign'(obj(... align: Align::Int)::DirectBase, I::Int) => getNativeAlign(I, Align)
27
+ rule getAlign'(obj(... align: Align::Int)::LinkBase, I::Int) => getNativeAlign(I, Align)
28
+
29
+ rule getNativeAlign(_, 0) => 0
30
+ rule getNativeAlign(Address::Int, Max::Int) => #getNativeAlign(Address %Int Max, Max, 1) [owise]
19
31
20
- rule getAlign'(obj(... align: 0)::DirectBase, _) => 0
21
- rule [[ getAlign'((obj(... d: link(_)) #as Base::SymBase => Base'), _) ]]
22
- <linkings>... Base |-> Base'::SymBase ...</linkings>
23
- rule getAlign'(obj(... align: Align::Int)::DirectBase, I::Int) => getNativeAlign(I %Int Align, Align) [owise]
24
32
syntax Int ::= #getNativeAlign(Int, Int, Int) [function]
25
- rule getNativeAlign(Address::Int, Max::Int) => #getNativeAlign(Address, Max, 1 )
26
- rule #getNativeAlign(Address::Int, Max::Int, Accum::Int) => #getNativeAlign(Address, Max, Accum <<Int 1)
33
+ rule # getNativeAlign(Address::Int, Max::Int, Accum::Int )
34
+ => #getNativeAlign(Address, Max, Accum <<Int 1)
27
35
requires Address &Int Accum ==Int 0 andBool Accum <Int Max
28
36
rule #getNativeAlign(_, Accum::Int, _) => Accum [owise]
29
37
0 commit comments