Commit 796babdf authored by Administrator's avatar Administrator
Browse files

now flowgraphs for every function in the cpp file

parent cb45b8ed
......@@ -353,7 +353,7 @@ foreach(src ${CPPSAMPLES})
OUTPUT ${CMAKE_SOURCE_DIR}/output/${src}.ll
COMMAND ${PATH_TO_LLVM}/bin/clang++ -O0 -emit-llvm ${CMAKE_SOURCE_DIR}/samples/${src}.cpp -Xclang -disable-O0-optnone -c -o ${CMAKE_SOURCE_DIR}/output/${src}.bc
COMMAND ${PATH_TO_LLVM}/bin/opt -S -mem2reg ${CMAKE_SOURCE_DIR}/output/${src}.bc -o ${CMAKE_SOURCE_DIR}/output/${src}.ll
COMMAND optdir=${PATH_TO_LLVM}/bin ${CMAKE_SOURCE_DIR}/helpers/flowgraph.sh ${CMAKE_SOURCE_DIR}/output/${src}.ll main
COMMAND optdir=${PATH_TO_LLVM}/bin ${CMAKE_SOURCE_DIR}/helpers/lsFunctions.sh ${CMAKE_SOURCE_DIR}/output/${src}.ll
COMMAND optdir=${PATH_TO_LLVM}/bin ${CMAKE_SOURCE_DIR}/helpers/callgraph.sh ${CMAKE_SOURCE_DIR}/output/${src}.ll
DEPENDS clang opt ${CMAKE_SOURCE_DIR}/samples/${src}.cpp
COMMENT "Generating LLVM IR for example ${src}.cpp"
......
......@@ -4,6 +4,7 @@ then
echo setting opt to default
optdir=$(dirname $(which opt))
fi
plaintext=$(echo "$2"|c++filt)
$optdir/opt --dot-cfg -cfg-func-name="$2" "$1" -disable-output
cat ".$2".dot | c++filt | dot -Tsvg > "$1.$2.svg"
cat ".$2".dot | c++filt | dot -Tsvg > "$1.$plaintext.svg"
rm ".$2".dot
\ No newline at end of file
#!/bin/bash
if [[ -z $optdir ]]
then
optdir=$(dirname $(which llvm-nm))
fi
# clang-query -c="match cxxMethodDecl()" "$1" --
# clang-query -c="match functionDecl()" "$1" --
# # set traversal IgnoreUnlessSpelledInSource
definednames=$($optdir/llvm-nm "${1/.ll/.bc}" --defined-only | awk '{ print $3; }' )
for n in $definednames ; do
plaintext=$(echo $n|c++filt| grep -v typeinfo | grep -v vtable)
if [[ -z $plaintext ]]
then
continue
fi
helpers/flowgraph.sh "$1" "$n"
#echo $n
done
# | grep -v typeinfo | grep -v vtable
\ No newline at end of file
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