@asmlift/core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/backend/c.ts +1 -0
- package/src/backend/cfamily.ts +33 -12
- package/src/backend/cpp.ts +1 -0
- package/src/backend/lines.ts +10 -0
- package/src/backend/pascal.ts +17 -5
- package/src/cdecl/parse.ts +21 -0
- package/src/contracts.ts +73 -20
- package/src/frontend/arm-body.ts +155 -0
- package/src/frontend/asmdata.ts +2 -1
- package/src/frontend/call-plan.ts +197 -45
- package/src/frontend/callee-body.ts +370 -0
- package/src/frontend/device-pins.ts +18 -8
- package/src/frontend/frame-objects.ts +504 -61
- package/src/frontend/frontend.ts +20 -0
- package/src/frontend/jump-table.ts +35 -20
- package/src/frontend/mips.ts +226 -8
- package/src/frontend/ppc.ts +26 -2
- package/src/frontend/register-struct-call.ts +1 -86
- package/src/frontend/ssa.ts +263 -1
- package/src/frontend/stackargs.ts +95 -17
- package/src/frontend/thumb-entry.ts +340 -0
- package/src/frontend/thumb.ts +410 -61
- package/src/ir/alias.ts +29 -8
- package/src/ir/bits.ts +1081 -66
- package/src/ir/core.ts +154 -4
- package/src/ir/entry.ts +3 -5
- package/src/ir/opcodes.ts +28 -0
- package/src/ir/parse.ts +1 -0
- package/src/ir/simplify.ts +61 -10
- package/src/ir/verify.ts +16 -0
- package/src/l3/argbase.ts +2 -0
- package/src/l3/ast.ts +294 -2
- package/src/l3/basecse.ts +35 -10
- package/src/l3/caseendgoto.ts +223 -0
- package/src/l3/coalesce.ts +42 -14
- package/src/l3/constinit.ts +34 -6
- package/src/l3/dce.ts +52 -8
- package/src/l3/ptrcell.ts +2 -0
- package/src/l3/regspell.ts +2 -0
- package/src/l3/reindex.ts +13 -4
- package/src/l3/scopebase.ts +2 -0
- package/src/l3/tailmerge.ts +2 -0
- package/src/pipeline.ts +507 -23
- package/src/proto-context.ts +135 -1
- package/src/raise/const.ts +25 -0
- package/src/raise/declared-volatile.ts +1 -1
- package/src/raise/divpow2.ts +192 -0
- package/src/raise/offsetnames.ts +412 -10
- package/src/raise/pre-recovery.ts +8 -5
- package/src/raise/pre-structure.ts +24 -5
- package/src/raise/reroll.ts +4 -24
- package/src/raise/shortcircuit.ts +192 -23
- package/src/raise/unpre.ts +594 -0
- package/src/rank-variations.ts +97 -4
- package/src/rank.ts +258 -43
- package/src/structure/analysis.ts +56 -10
- package/src/structure/cross-jumped-tail.ts +216 -0
- package/src/structure/globalaccess.ts +46 -1
- package/src/structure/structure.ts +4221 -368
- package/src/structure/switch-recover.ts +345 -26
- package/src/structure/unfolded-branch-constant.ts +90 -0
- package/src/symbols.ts +52 -15
- package/src/target.ts +269 -8
- package/src/trace.ts +28 -14
- package/src/variation-definitions.ts +207 -6
- package/src/variation-gates.ts +2 -0
- package/src/variation-tokens.ts +63 -2
package/src/ir/alias.ts
CHANGED
|
@@ -12,8 +12,23 @@
|
|
|
12
12
|
// • two DIFFERENT named globals are different objects, so a store through one can never change
|
|
13
13
|
// what a read of the other sees. That is a C guarantee about distinct declared objects, not a
|
|
14
14
|
// heuristic about what the compiler happened to do.
|
|
15
|
-
// • name comparison suffices
|
|
16
|
-
//
|
|
15
|
+
// • name comparison suffices where a cell has ONE spelling per function and a name ONE cell, and
|
|
16
|
+
// that is enforced for every access whose address a symbol map places, through defs and
|
|
17
|
+
// joins alike and with constant arithmetic folded as the C compiler will fold it (an index or
|
|
18
|
+
// displacement built in several steps): raise/offsetnames.ts `cellSpelledTwice` declines a
|
|
19
|
+
// lift that reaches one byte under two names, or under a name and a numeric address, with a
|
|
20
|
+
// store among them, and one that reads a name the map places at several addresses at two of
|
|
21
|
+
// them. The pool promotion's one canonical name per address does not give it alone: an
|
|
22
|
+
// interior attribution into an object sized over its neighbour, a walk the offset-name gates
|
|
23
|
+
// leave as `base + K` past the base's end, a raw constant beside an unsized name, and any of
|
|
24
|
+
// them carried across a join each reach a named cell a second way. On a compiler that reloads
|
|
25
|
+
// across two spellings (`reloadsAcrossSpellings`, IDO 7.1) a pair in one block outside any
|
|
26
|
+
// loop with the store first is exempt, whoever chose them, because the C reads the cell back
|
|
27
|
+
// after the store as the asm did; IDO sinks a read placed before the store past it, so that
|
|
28
|
+
// order declines there too. agbcc and gcc 2.7.2 forward.
|
|
29
|
+
// KNOWN GAP: with no map (or a name the map does not hold) nothing is placed, so a relocation
|
|
30
|
+
// and a literal for one cell lift unchecked — faithful on IDO, wrong C on agbcc and gcc 2.7.2
|
|
31
|
+
// where the asm reloaded.
|
|
17
32
|
// • anything that does not resolve to a name — a materialized base, a variable index, a pointer
|
|
18
33
|
// parameter — is unknown, and unknown BARS. A call or an `opaque` bars unconditionally: it may
|
|
19
34
|
// write anything.
|
|
@@ -145,17 +160,23 @@ export function constAddressOf(defs: Map<Value, Op>, addr: Value, off: number):
|
|
|
145
160
|
* `p`. Null when `addr` is not such a link. `sub` is not commutative, so `K - p` stops the walk; a
|
|
146
161
|
* link whose two operands are both constants stops it too (that is a literal address,
|
|
147
162
|
* {@link constAddressOf}'s question). The one reading of address arithmetic that raise/structs.ts
|
|
148
|
-
* (which accesses share a base)
|
|
149
|
-
*
|
|
163
|
+
* (which accesses share a base), raise/offsetnames.ts (which named global an address stands on) and
|
|
164
|
+
* raise/shortcircuit.ts (which root a shared address the fold hoists stands on) all ask, so they
|
|
165
|
+
* cannot disagree about where a chain ends.
|
|
166
|
+
*
|
|
167
|
+
* `constOf` is what counts as a constant operand: a `const` def by default, which is where those
|
|
168
|
+
* two readers want a chain to end. raise/offsetnames.ts `cellSpelledTwice`, which must place an
|
|
169
|
+
* address the way the C compiler will once it folds the emitted arithmetic, passes a reader that
|
|
170
|
+
* folds constant subtrees too.
|
|
150
171
|
*/
|
|
151
172
|
export function constDisplacementOf(
|
|
152
|
-
defs:
|
|
173
|
+
defs: ReadonlyMap<Value, Op>,
|
|
153
174
|
addr: Value,
|
|
154
|
-
|
|
155
|
-
const constOf = (x: Value): number | null => {
|
|
175
|
+
constOf: (x: Value) => number | null = (x) => {
|
|
156
176
|
const d = defs.get(x);
|
|
157
177
|
return d?.opcode === 'const' && typeof d.attrs.value === 'number' ? d.attrs.value : null;
|
|
158
|
-
}
|
|
178
|
+
},
|
|
179
|
+
): { root: Value; k: number; chain: Value[] } | null {
|
|
159
180
|
let k = 0;
|
|
160
181
|
const chain: Value[] = [];
|
|
161
182
|
let cur = addr;
|