Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phi for da D #8

Merged
merged 125 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
15925e7
Phi cont
dleiferives May 16, 2024
72a6cf3
not passing,
dleiferives May 16, 2024
65de387
Todo overview updated, notes on how to do future work
dleiferives May 16, 2024
3423de2
Phi printing -> <-
dleiferives May 17, 2024
127cd06
haha
dleiferives May 18, 2024
128095b
More changes
dleiferives May 18, 2024
eb172b7
starting the blocks
dleiferives May 18, 2024
16f00df
cfg if implemented
dleiferives May 18, 2024
6c9f720
started while
dleiferives May 18, 2024
07105b7
dom tree
dleiferives May 20, 2024
da9d3b2
dom fronteir almost done, seg faulting tho
dleiferives May 20, 2024
bf9b614
dom fronteir almost perfect, need to clean up returns
dleiferives May 20, 2024
afaad42
I think Dominance Fronteir is working, I've no idea how to check, nor…
dleiferives May 21, 2024
3abaab0
add arrays to mini.ebnf selectors
probably-neb May 21, 2024
532b236
Phi cont
dleiferives May 16, 2024
8eaac7c
not passing,
dleiferives May 16, 2024
b267cd2
Todo overview updated, notes on how to do future work
dleiferives May 16, 2024
dc4e081
Phi printing -> <-
dleiferives May 17, 2024
09738e0
haha
dleiferives May 18, 2024
e42bfc7
More changes
dleiferives May 18, 2024
7ad2a8b
starting the blocks
dleiferives May 18, 2024
d54de2a
cfg if implemented
dleiferives May 18, 2024
4bc9754
started while
dleiferives May 18, 2024
5f5baf4
dom tree
dleiferives May 20, 2024
75dcbec
dom fronteir almost done, seg faulting tho
dleiferives May 20, 2024
900112e
dom fronteir almost perfect, need to clean up returns
dleiferives May 20, 2024
a35a8e9
I think Dominance Fronteir is working, I've no idea how to check, nor…
dleiferives May 21, 2024
7cd60de
add nix command to Justfile
probably-neb May 21, 2024
9756e7f
remove file named `'` ???
probably-neb May 21, 2024
9afa7ae
fix statement iteration in sema
probably-neb May 21, 2024
0624ea0
small fixes
probably-neb May 21, 2024
7731305
Filling BBs
dleiferives May 21, 2024
2dbe203
Phi generation v3 ready to implemented
dleiferives May 21, 2024
4610ed9
Filling BBs
dleiferives May 21, 2024
df7252c
Phi generation v3 ready to implemented
dleiferives May 21, 2024
219a99f
add int_arr IR type
probably-neb May 21, 2024
8a0f1ec
get array_sort outputting valid llvm
probably-neb May 21, 2024
4f6cd66
fix critical error in Justfile... time will tell how horrendously I h…
probably-neb May 21, 2024
c67e0c3
save test-suite-test output to file named "output" in respective dir
probably-neb May 21, 2024
17832ea
fix bug in NodeIter causing it to search past last
probably-neb May 21, 2024
36afd55
fix typo in gen_selector_chain
probably-neb May 21, 2024
96f091e
phi gen working
dleiferives May 21, 2024
e258a33
updated to using new stack
dleiferives May 22, 2024
ad6dd10
changes
dleiferives May 22, 2024
b4a53a8
phi gen working
dleiferives May 21, 2024
70066a0
updated to using new stack
dleiferives May 22, 2024
c97e300
changes
dleiferives May 22, 2024
f17283a
Merge branch 'phi_llmedaddy.biz' of https://github.com/probably-neb/m…
dleiferives May 22, 2024
d269251
fix bug in StatementsIter
probably-neb May 22, 2024
fb50825
use switch when comparing Null in Ast.Type
probably-neb May 22, 2024
c37c549
create (unused) isOneOf helper function in Ast.Type
probably-neb May 22, 2024
a1d5ca0
refactor printNodeLineTo to allow using a passed in print function
probably-neb May 22, 2024
c3c3290
make log messages threadlocal
probably-neb May 22, 2024
07dcc05
allow printing log messages with prefix
probably-neb May 22, 2024
9002406
create `empty` helper in log for clearing the current log messages bu…
probably-neb May 22, 2024
fb7706a
fix bug in log.clear()
probably-neb May 22, 2024
851ea66
refactor SelectorChainGetType in sema and use it in LValueGetType
probably-neb May 22, 2024
3fac7cc
remove unessessary allReturnPathsHaveReturnType in sema
probably-neb May 22, 2024
0f9bb6b
move typeCheck to top of file
probably-neb May 22, 2024
c561edb
create ensureSemanticallyValid function in sema that ACTUALLY CHECKS …
probably-neb May 22, 2024
84f424e
prefix sema (non type) checks with `check`
probably-neb May 22, 2024
16d8f22
rename all typeCheck to typecheck
probably-neb May 22, 2024
66bc441
enforce consistent naming scheme
probably-neb May 22, 2024
1f5d55d
make .Void -> error in getTypedIdentifierType
probably-neb May 22, 2024
81f04d7
use ast.getIdentValue
probably-neb May 22, 2024
16d11b8
fix halting problem
probably-neb May 22, 2024
1e5bdf2
first correct output
dleiferives May 22, 2024
9150a57
next working
dleiferives May 22, 2024
9f89399
remove prints
probably-neb May 22, 2024
ed46f6a
changes
dleiferives May 22, 2024
db2d6ab
rename ssa arg to phi
probably-neb May 21, 2024
169c8b3
run phi llvm ir gen when -phi passed
probably-neb May 21, 2024
292f259
rename test suite gh actions
probably-neb May 21, 2024
e224c6c
add support for passing build flags to just test-suite targets
probably-neb May 21, 2024
2e3c590
create phi test-suite workflow
probably-neb May 21, 2024
1fe4e12
fix bug in StatementsIter
probably-neb May 22, 2024
dc3a2b2
use switch when comparing Null in Ast.Type
probably-neb May 22, 2024
5d5936c
create (unused) isOneOf helper function in Ast.Type
probably-neb May 22, 2024
cf04f60
refactor printNodeLineTo to allow using a passed in print function
probably-neb May 22, 2024
c34d602
make log messages threadlocal
probably-neb May 22, 2024
0c8d2a9
allow printing log messages with prefix
probably-neb May 22, 2024
ef1a182
create `empty` helper in log for clearing the current log messages bu…
probably-neb May 22, 2024
1507d06
fix bug in log.clear()
probably-neb May 22, 2024
b9a6628
refactor SelectorChainGetType in sema and use it in LValueGetType
probably-neb May 22, 2024
6b6a209
remove unessessary allReturnPathsHaveReturnType in sema
probably-neb May 22, 2024
c7a86dc
move typeCheck to top of file
probably-neb May 22, 2024
e6d72d8
create ensureSemanticallyValid function in sema that ACTUALLY CHECKS …
probably-neb May 22, 2024
1602fa5
prefix sema (non type) checks with `check`
probably-neb May 22, 2024
8a16873
rename all typeCheck to typecheck
probably-neb May 22, 2024
d9e9657
enforce consistent naming scheme
probably-neb May 22, 2024
657149e
make .Void -> error in getTypedIdentifierType
probably-neb May 22, 2024
a8b17fb
use ast.getIdentValue
probably-neb May 22, 2024
adb70b1
fix halting problem
probably-neb May 22, 2024
dc19b7e
remove prints
probably-neb May 22, 2024
2669727
remove file named "'" (again)
probably-neb May 22, 2024
2a8d29f
Merge branch 'phi_llmedaddy-with-stack.biz' into phi_llmedaddy.biz
dleiferives May 22, 2024
0341526
add all non-stringify ir files to build.zig
probably-neb May 22, 2024
6c9555e
updates
dleiferives May 22, 2024
96571ee
cute test working
dleiferives May 22, 2024
ab0226f
first non trival test working
dleiferives May 22, 2024
fc33232
while loops are looking good, will need to dermine how to do the larg…
dleiferives May 22, 2024
12861c4
ahhhhh structs are grody
dleiferives May 22, 2024
0f27a4a
goofy aahh
dleiferives May 23, 2024
a3b9e92
Merge branch 'phi-test-suite-2' into phi_llmedaddy.biz
dleiferives May 23, 2024
bbf0c67
add stringify.zig
probably-neb May 23, 2024
6fe642c
make ast/stringify.into_tree public
probably-neb May 23, 2024
ab3be36
add missing nodes to ast/stringify
probably-neb May 23, 2024
cff360c
Merge branch 'stringify-ast-for-real' into phi_llmedaddy.biz
probably-neb May 23, 2024
d8b0577
some tests passing
dleiferives May 23, 2024
3214a08
Merge branch 'phi_llmedaddy.biz' of https://github.com/probably-neb/m…
dleiferives May 23, 2024
c0203da
new pr on the number of tests passed
dleiferives May 23, 2024
25b86ce
wanted killer bubbls but got others instead
dleiferives May 23, 2024
1ba559f
reg printing with no name and not param
dleiferives May 23, 2024
9682f96
Maybe fixed bubbs
dleiferives May 23, 2024
42036b8
more structured approach to find the solution to the param issue
dleiferives May 24, 2024
2a47c95
Killer Bubbles passing
dleiferives May 24, 2024
ba85ace
Stat passing
dleiferives May 24, 2024
441755a
most passing now
dleiferives May 24, 2024
690f50f
5 left
dleiferives May 24, 2024
40d67f3
4 left
dleiferives May 24, 2024
ff2763f
and there were 2
dleiferives May 24, 2024
e7ec890
and he now stands alone, bert the last purple boy
dleiferives May 24, 2024
b910241
small refactor to reduce holes in logic
dleiferives May 24, 2024
4d8e71e
And we are back to two
dleiferives May 24, 2024
9aa0412
Phi benchmarks passing
dleiferives May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .auto_run_cmd.file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zig test --main-pkg-path ./ ./src/ir/phi.zig
167 changes: 167 additions & 0 deletions .github/workflows/phi-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: PHI TEST SUITE
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
# cancel in progress checks when a push occurs
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
Fibonacci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test Fibonacci -phi
shell: bash
array_sort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test array_sort -phi
shell: bash
array_sum:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test array_sum -phi
shell: bash
BenchMarkishTopics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test BenchMarkishTopics -phi
shell: bash
bert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test bert -phi
shell: bash
biggest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test biggest -phi
shell: bash
binaryConverter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test binaryConverter -phi
shell: bash
brett:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test brett -phi
shell: bash
creativeBenchMarkName:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test creativeBenchMarkName -phi
shell: bash
fact_sum:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test fact_sum -phi
shell: bash
GeneralFunctAndOptimize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test GeneralFunctAndOptimize -phi
shell: bash
hailstone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test hailstone -phi
shell: bash
hanoi_benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test hanoi_benchmark -phi
shell: bash
killerBubbles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test killerBubbles -phi
shell: bash
mile1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test mile1 -phi
shell: bash
mixed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test mixed -phi
shell: bash
OptimizationBenchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test OptimizationBenchmark -phi
shell: bash
primes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test primes -phi
shell: bash
programBreaker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test programBreaker -phi
shell: bash
stats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test stats -phi
shell: bash
TicTac:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test TicTac -phi
shell: bash
wasteOfCycles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test-suite-setup
- run: just run-suite-test wasteOfCycles -phi
shell: bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Suite
name: STACK TEST SUITE
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests (zig files)
name: ZIG TEST
on:
push:
branches:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ zig-cache
zig-out
/kcov-output/
TODO.dylan
lazygit
lazygit.tar.gz
.auto_run_cmd.file
clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz
.zig_debug_last_executable.txt
tmp.ll
tmp.s
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 22 additions & 11 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make path exe="a.out": build
ensure-test-suite:
git submodule update --init --recursive

run-suite: ensure-test-suite
run-suite *BUILD_ARGS: ensure-test-suite
#!/usr/bin/env bash
set -uo pipefail

Expand All @@ -26,15 +26,15 @@ run-suite: ensure-test-suite
NC='\033[0m'

for test in $(ls {{TEST_SUITE}}); do
just run-suite-test $test > /dev/null 2>&1
just run-suite-test $test {{BUILD_ARGS}} > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "${GREEN}SUCCESS${NC} - ${test}"
else
echo -e "${RED}FAIL ${NC} - ${test}"
fi
done

run-suite-test name: ensure-test-suite
run-suite-test name *BUILD_ARGS: ensure-test-suite
#!/usr/bin/env bash
set -euo pipefail

Expand All @@ -46,34 +46,45 @@ run-suite-test name: ensure-test-suite

echo -e "Running Test Suite Test: ${YELLOW}{{name}}${NC}"
echo -e "${BLUE}Building Test Suite Test...${NC}"
just build-suite-test {{name}}
just build-suite-test {{name}} {{BUILD_ARGS}}
echo -e "${GREEN}BUILD SUCCESS${NC}"

dir="{{TEST_SUITE}}/{{name}}"
bin="$dir/{{name}}"


echo "Checking Normal Input..."
diff <($bin < "$dir/input") "$dir/output.expected" || true
$bin < "$dir/input" > "$dir/output"
diff "$dir/output" "$dir/output.expected"
if [ $? -eq 0 ]; then
echo -e "${GREEN}SUCCESS${NC}"
else
echo -e "${RED}FAIL${NC}"
fi

echo "Checking Longer Input..."
diff <($bin < "$dir/input.longer") "$dir/output.longer.expected" || true
if [ $? -eq 0 ]; then
echo -e "${GREEN}SUCCESS${NC}"
longer="$dir/input.longer"
if [ -f "$longer" ]; then
$bin < "$longer" > "$dir/output.longer"
diff "$dir/output.longer" "$dir/output.longer.expected"
if [ $? -eq 0 ]; then
echo -e "${GREEN}SUCCESS${NC}"
else
echo -e "${RED}FAIL${NC}"
fi
else
echo -e "${RED}FAIL${NC}"
echo "Longer Input Not Found"
echo -e "${GREEN}SUCCESS${NC}"
fi

build-suite-test name: build
build-suite-test name *BUILD_ARGS: build
#!/usr/bin/env bash
set -euxo pipefail
name="{{name}}"
name="${name#array_}"
dir="{{TEST_SUITE}}/{{name}}"
{{minipp}} -i "$dir/${name}.mini" -o "$dir/{{name}}.ll"
{{minipp}} -i "$dir/${name}.mini" -o "$dir/{{name}}.ll" {{BUILD_ARGS}}
clang "$dir/{{name}}.ll" -o "$dir/{{name}}"

nix:
sudo nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
6 changes: 4 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const files = [_]SourceFile{
.{ .path = "src/parser.zig", .name = "parser" },
.{ .path = "src/sema.zig", .name = "sema" },
.{ .path = "src/utils.zig", .name = "utils" },
.{ .path = "src/ir/ir.zig", .name = "ir" },
.{ .path = "src/ir/stack.zig", .name = "ir-stack" },
.{ .path = "src/ir/ir.zig", .name = "stack-ir" },
.{ .path = "src/ir/stack.zig", .name = "stack-ir-gen" },
.{ .path = "src/ir/phi.zig", .name = "phi-ir-gen" },
.{ .path = "src/ir/ir_phi.zig", .name = "phi-ir" },
};

pub fn build(b: *std.Build) void {
Expand Down
2 changes: 1 addition & 1 deletion mini.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ relterm -> simple {{ '<' | '>' | '<=' | '>=' } simple}∗
simple -> term {{ '+' | '−' } term}∗
term -> unary {{ '∗' | '/' } unary}∗
unary -> { '!' | '−' }∗ selector
selector -> factor {'.' id}∗
selector -> factor {{'.' id} | '[' number ']'}∗
factor -> '(' expression ')' | id {arguments}opt | number | 'true' |
| 'false' | 'new' id | 'null' | 'new' 'int_array' '[' number ']' |
arguments -> '(' {expression { ',' expression}∗}opt ')'
Expand Down
Loading
Loading