Commit 69dd349f authored by Andrea Gussoni's avatar Andrea Gussoni
Browse files

Add revng script for lifting and isolation

parent 2c005a5f
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No arguments supplied"
exit 1
fi
basepath=$(pwd)
arch=$1
workdir=$basepath/workdir-$arch
isolated_dir=$workdir/revng-isolated
if [ ! -d $isolated_dir ]; then
mkdir $isolated_dir;
fi
timing_path=$workdir/timings
if [ ! -d $timing_path ]; then
mkdir $timing_path;
fi
cd $arch
for filename in *
do
echo "Isolating input: $filename"
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-lift.time" revng lift --use-debug-symbols --debug-info ll $filename $isolated_dir/$filename.ll
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-detect.time" revng opt -S $isolated_dir/$filename.ll -function-boundaries-function-symbol -simple-return-instruction-analysis -o $isolated_dir/$filename.ll.hints
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-detect.time" revng opt -S $isolated_dir/$filename.ll.hints -detect-function-boundaries -detect-abi -o $isolated_dir/$filename.ll.functions
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-isolate.time" revng opt -S $isolated_dir/$filename.ll.functions -isolate -enforce-abi -o $isolated_dir/$filename.ll.isolated
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-purge.time" revng opt -S $isolated_dir/$filename.ll.isolated -remove-pc-stores -remove-bad-pc -remove-switch -o $isolated_dir/$filename.ll.isolated.purged
/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_path/$filename.revng-purge.time" revng opt -S $isolated_dir/$filename.ll.isolated.purged -sroa -reassociate -instcombine -constprop -dce -early-cse -o $isolated_dir/$filename.ll.isolated.purged.sroa
rm $isolated_dir/$filename.ll.coverage.csv
rm $isolated_dir/$filename.ll.li.csv
rm $isolated_dir/$filename.ll.need.csv
rm $isolated_dir/$filename.ll.functions
rm $isolated_dir/$filename.ll.hints
rm $isolated_dir/$filename.ll.isolated
done;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment