@asmlift/core 0.9.0 → 0.10.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/README.md +25 -24
- package/package.json +1 -1
- package/src/aggregate.ts +149 -0
- package/src/backend/c.ts +1 -0
- package/src/backend/cfamily.ts +165 -50
- package/src/backend/cpp.ts +2 -1
- package/src/backend/pascal.ts +31 -12
- package/src/contracts.ts +173 -16
- package/src/declare.ts +69 -20
- package/src/frontend/asmdata.ts +7 -1
- package/src/frontend/call-plan.ts +964 -60
- package/src/frontend/dead-reads.ts +628 -0
- package/src/frontend/device-pins.ts +23 -4
- package/src/frontend/emit.ts +4 -3
- package/src/frontend/fpu.ts +224 -17
- package/src/frontend/frame-objects.ts +1232 -192
- package/src/frontend/frontend.ts +64 -3
- package/src/frontend/high-half.ts +53 -4
- package/src/frontend/jump-table.ts +530 -0
- package/src/frontend/local-object.ts +158 -32
- package/src/frontend/mips.ts +2076 -215
- package/src/frontend/own-struct-return.ts +500 -0
- package/src/frontend/ppc.ts +2711 -232
- package/src/frontend/register-struct-call.ts +484 -0
- package/src/frontend/reloc-symbol.ts +22 -7
- package/src/frontend/ssa.ts +1460 -44
- package/src/frontend/stackargs.ts +106 -57
- package/src/frontend/thumb.ts +2044 -318
- package/src/ir/alias.ts +42 -0
- package/src/ir/bits.ts +681 -1
- package/src/ir/core.ts +100 -5
- package/src/ir/discipline.ts +86 -21
- package/src/ir/entry.ts +159 -0
- package/src/{structure → ir}/loops.ts +6 -2
- package/src/ir/opcodes.ts +109 -9
- package/src/ir/types.ts +86 -2
- package/src/ir/verify.ts +80 -11
- package/src/l3/ast.ts +290 -18
- package/src/l3/basecse.ts +33 -5
- package/src/l3/constinit.ts +382 -0
- package/src/l3/dce.ts +2 -2
- package/src/l3/initfirst.ts +42 -11
- package/src/l3/intcell.ts +2 -1
- package/src/l3/narrowdecl.ts +77 -36
- package/src/l3/pollguard.ts +8 -2
- package/src/l3/ptrcell.ts +31 -34
- package/src/l3/ptrfield.ts +123 -8
- package/src/l3/regspell.ts +9 -4
- package/src/l3/reindex.ts +283 -96
- package/src/l3/storage.ts +98 -1
- package/src/l3/symbol-refs.ts +84 -6
- package/src/l3/tailmerge.ts +4 -2
- package/src/l3/typing.ts +108 -15
- package/src/l3/unreduce.ts +6 -5
- package/src/l3/volatileptr.ts +17 -54
- package/src/mangle.ts +30 -0
- package/src/pattern/engine.ts +361 -73
- package/src/pipeline.ts +541 -24
- package/src/proto-context.ts +905 -45
- package/src/proto.ts +555 -40
- package/src/raise/aggmembers.ts +290 -0
- package/src/raise/arrays.ts +5 -1
- package/src/raise/declared-volatile.ts +207 -31
- package/src/raise/floathelpers.ts +254 -33
- package/src/raise/gvn.ts +3 -3
- package/src/raise/latch.ts +162 -6
- package/src/raise/memberarrays.ts +10 -4
- package/src/raise/offsetnames.ts +10 -26
- package/src/raise/pairparams.ts +33 -0
- package/src/raise/paramwidth.ts +196 -6
- package/src/raise/pre-recovery.ts +102 -19
- package/src/raise/pre-structure.ts +54 -0
- package/src/raise/recover.ts +12 -5
- package/src/raise/reroll.ts +694 -0
- package/src/raise/shortcircuit.ts +26 -12
- package/src/raise/softdiv.ts +1 -1
- package/src/raise/storesign.ts +153 -0
- package/src/raise/struct-arrays.ts +30 -11
- package/src/raise/structs.ts +396 -33
- package/src/raise/truncload.ts +4 -3
- package/src/raise/unthread.ts +400 -0
- package/src/rank-declare.ts +118 -12
- package/src/rank-variations.ts +89 -31
- package/src/rank.ts +307 -54
- package/src/runtime-helpers.ts +140 -22
- package/src/structure/analysis.ts +165 -2
- package/src/structure/arith-ops.ts +23 -0
- package/src/structure/globalaccess.ts +111 -9
- package/src/structure/hazards.ts +16 -64
- package/src/structure/local-statics.ts +145 -9
- package/src/structure/namecoalesce.ts +1 -1
- package/src/structure/pointer-spelling.ts +1106 -0
- package/src/structure/redundant-test.ts +1 -1
- package/src/structure/structure.ts +2180 -1054
- package/src/structure/switch-recover.ts +244 -100
- package/src/symbols.ts +6 -0
- package/src/target.ts +765 -52
- package/src/trace.ts +26 -8
- package/src/variation-definitions.ts +126 -14
- package/src/variation-gates.ts +2 -0
- package/src/variation-tokens.ts +5 -1
package/src/ir/alias.ts
CHANGED
|
@@ -139,6 +139,48 @@ export function constAddressOf(defs: Map<Value, Op>, addr: Value, off: number):
|
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* A constant DISPLACEMENT off a root, read through defs alone: `add(p, K)`, `add(K, p)`, `sub(p, K)`,
|
|
144
|
+
* or a chain of them, as the root `p`, the summed `K`, and the chain's values from `addr` toward
|
|
145
|
+
* `p`. Null when `addr` is not such a link. `sub` is not commutative, so `K - p` stops the walk; a
|
|
146
|
+
* link whose two operands are both constants stops it too (that is a literal address,
|
|
147
|
+
* {@link constAddressOf}'s question). The one reading of address arithmetic that raise/structs.ts
|
|
148
|
+
* (which accesses share a base) and raise/offsetnames.ts (which named global an address stands on)
|
|
149
|
+
* both ask, so the two cannot disagree about where a chain ends.
|
|
150
|
+
*/
|
|
151
|
+
export function constDisplacementOf(
|
|
152
|
+
defs: Map<Value, Op>,
|
|
153
|
+
addr: Value,
|
|
154
|
+
): { root: Value; k: number; chain: Value[] } | null {
|
|
155
|
+
const constOf = (x: Value): number | null => {
|
|
156
|
+
const d = defs.get(x);
|
|
157
|
+
return d?.opcode === 'const' && typeof d.attrs.value === 'number' ? d.attrs.value : null;
|
|
158
|
+
};
|
|
159
|
+
let k = 0;
|
|
160
|
+
const chain: Value[] = [];
|
|
161
|
+
let cur = addr;
|
|
162
|
+
for (;;) {
|
|
163
|
+
const d = defs.get(cur);
|
|
164
|
+
if (!d || (d.opcode !== 'add' && d.opcode !== 'sub') || d.operands.length !== 2) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
const [x, y] = d.operands;
|
|
168
|
+
const ky = constOf(y);
|
|
169
|
+
const kx = d.opcode === 'add' ? constOf(x) : null;
|
|
170
|
+
if (ky !== null && kx === null) {
|
|
171
|
+
k += d.opcode === 'add' ? ky : -ky;
|
|
172
|
+
cur = x;
|
|
173
|
+
} else if (kx !== null && ky === null) {
|
|
174
|
+
k += kx;
|
|
175
|
+
cur = y;
|
|
176
|
+
} else {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
chain.push(d.results[0]);
|
|
180
|
+
}
|
|
181
|
+
return chain.length === 0 ? null : { root: cur, k, chain };
|
|
182
|
+
}
|
|
183
|
+
|
|
142
184
|
/**
|
|
143
185
|
* Are these two accesses through ONE base provably different byte cells — same base value, both at
|
|
144
186
|
* a constant offset and width, ranges non-overlapping? The everyday struct interleave
|