diff --git a/script/add_noinline_annotation.sh b/script/add_noinline_annotation.sh new file mode 100755 index 0000000000000000000000000000000000000000..fbbb0d0fbfb3f1a88192799ec255c62e46e61f05 --- /dev/null +++ b/script/add_noinline_annotation.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +if [ $# -ne 1 ]; then + echo "usage: $0 <tacle-bench-root-dir>" >&2 + exit 1 +fi + +TACLE_ROOT=$1 + +for i in $(grep -r "entrypoint" `find $TACLE_ROOT -name "*.c"` | cut -d: -f1) ; +do + # ugly workaround: run clang-format prior to the annotiation + # to have { at the end of the line + temp=$(tempfile) + clang-format $i > $temp + mv $temp $i + + exists=$(grep -c '__attribute__((noinline))' $i ) + if [ $exists -eq 0 ]; then + echo "annotating $i" + # get the line number: + line=$(grep -n "entrypoint" $i |cut -d: -f1) + echo "found in line $line" + sed -i "${line}s/{/__attribute__((noinline)){/g" $i + fi +done