CBE: exploit Liveness analysis to reuse locals
This commit is contained in:
9
build.sh
Executable file
9
build.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ "x$1" != x--debug ]; then
|
||||
cmake -GNinja -S. -Bbuild -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=clang -DCMAKE_CXX_COMPILER:FILEPATH=clang++ -DZIG_NO_LIB:BOOL=ON
|
||||
cmake --build build
|
||||
cmake --install build
|
||||
fi
|
||||
build/stage3/bin/zig build -p debug -Dno-lib -Denable-stage1 -Denable-llvm -freference-trace
|
||||
#build/stage3/bin/zig build -p only-c -Dno-lib -Donly-c
|
||||
1718
src/codegen/c.zig
1718
src/codegen/c.zig
File diff suppressed because it is too large
Load Diff
@@ -136,16 +136,7 @@ pub fn updateFunc(self: *C, module: *Module, func: *Module.Fn, air: Air, livenes
|
||||
};
|
||||
|
||||
function.object.indent_writer = .{ .underlying_writer = function.object.code.writer() };
|
||||
defer {
|
||||
function.blocks.deinit(module.gpa);
|
||||
function.value_map.deinit();
|
||||
function.object.code.deinit();
|
||||
for (function.object.dg.typedefs.values()) |typedef| {
|
||||
module.gpa.free(typedef.rendered);
|
||||
}
|
||||
function.object.dg.typedefs.deinit();
|
||||
function.object.dg.fwd_decl.deinit();
|
||||
}
|
||||
defer function.deinit(module.gpa);
|
||||
|
||||
codegen.genFunc(&function) catch |err| switch (err) {
|
||||
error.AnalysisFail => {
|
||||
|
||||
20
test.sh
Executable file
20
test.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == --enable-fixed-behavior ]]; then
|
||||
declare -A offsets
|
||||
git g -n stage2_c test/behavior | while read -r match; do
|
||||
printf '\e[36mTrying to enable... %s\e[m\n' "$match"
|
||||
file=`cut -d: -f1 <<<"$match"`
|
||||
offset=${offsets[$file]:=0}
|
||||
let line=`cut -d: -f2 <<<"$match"`-$offset
|
||||
contents=`cut -d: -f3- <<<"$match"`
|
||||
sed --in-place "${line}d" "$file"
|
||||
if zigd test -Itest test/behavior.zig -fno-stage1 -fno-LLVM -ofmt=c; then
|
||||
printf '\e[32mTest was enabled! :)\e[m\n'
|
||||
let offsets[$file]+=1
|
||||
else
|
||||
printf '\e[31mTest kept disabled. :(\e[m\n'
|
||||
sed --in-place "${line}i\\
|
||||
$contents" "$file"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user