blaise/vendor/qbe/test/_alt.ssa
Graeme Geldenhuys 25de8be212 Fix compilation errors; vendor QBE 1.2; end-to-end Hello World works
Fix TProgram.Uses reserved-word clash (renamed to UsedUnits), nested
brace-comment in uParser.pas, and missing uAST in Blaise.pas uses clause.

Vendor QBE 1.2 source in vendor/qbe/ (built locally with make; binary
excluded via .gitignore). End-to-end pipeline confirmed: Blaise compiles
Hello World and Calc (6*7=42) to native x86_64 Linux binaries.

71/71 FPCUnit tests passing.
2026-04-20 16:38:57 +01:00

26 lines
529 B
Plaintext

# an example with reducible control
# flow graph that exposes poor
# handling of looping constructs
function $test() {
@start
%ten =w copy 10
%dum =w copy 0 # dummy live-through temporary
@loop
%alt =w phi @start 0, @left %alt1, @right %alt1
%cnt =w phi @start 100, @left %cnt, @right %cnt1
%alt1 =w sub 1, %alt
jnz %alt1, @right, @left
@left
%x =w phi @loop 10, @left %x1
%x1 =w sub %x, 1
%z =w copy %x
jnz %z, @left, @loop
@right
%cnt1 =w sub %cnt, %ten
jnz %cnt1, @loop, @end
@end
%ret =w add %cnt, %dum
ret
}