From 09c024c004173bd52bb517f998697a55bc8b2cdb Mon Sep 17 00:00:00 2001 From: Aleksei Gutikov Date: Fri, 5 Mar 2021 00:34:27 +0300 Subject: [PATCH 1/2] compiled and tested with llvm 11 it works --- .gitignore | 4 + CMakeCache.txt | 322 ----------- CMakeLists.txt | 14 +- Makefile | 148 ----- README.org | 14 +- benchmark/.gitignore | 3 + benchmark/Makefile | 4 +- benchmark/out.dot | 1068 ------------------------------------ benchmark/simple-c-func.bc | Bin 2248 -> 0 bytes benchmark/simple-c-func.ll | 93 ---- benchmark/test.sh | 2 +- benchmark/test1.bc | Bin 17424 -> 0 bytes benchmark/test1.ll | 923 ------------------------------- hebicg/CMakeLists.txt | 4 +- hebicg/Makefile | 168 ------ hebicg/hebicg.cpp | 15 +- test.sh | 6 +- test_macos.sh | 5 + 18 files changed, 56 insertions(+), 2737 deletions(-) delete mode 100644 CMakeCache.txt delete mode 100644 Makefile create mode 100644 benchmark/.gitignore delete mode 100644 benchmark/out.dot delete mode 100644 benchmark/simple-c-func.bc delete mode 100644 benchmark/simple-c-func.ll delete mode 100644 benchmark/test1.bc delete mode 100644 benchmark/test1.ll delete mode 100644 hebicg/Makefile create mode 100755 test_macos.sh diff --git a/.gitignore b/.gitignore index c736bbf..e45207e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ CMakeFiles CMakeCache *.cmake *.so +build +compile_commands.json +.cache +*.dot diff --git a/CMakeCache.txt b/CMakeCache.txt deleted file mode 100644 index 6f41893..0000000 --- a/CMakeCache.txt +++ /dev/null @@ -1,322 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /home/hebi/github/callgraph -# It was generated by CMake: /usr/local/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//Path to a program. -CMAKE_AR:FILEPATH=/usr/bin/ar - -//For backwards compatibility, what version of CMake commands and -// syntax should this version of CMake try to support. -CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4 - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ - -//Flags used by the compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release builds for minimum -// size. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds. -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during release builds with debug info. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler -CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release builds for minimum -// size. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds. -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during release builds with debug info. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Path to a program. -CMAKE_LINKER:FILEPATH=/usr/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/usr/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=Project - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=/usr/bin/strip - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Single output directory for building all executables. -EXECUTABLE_OUTPUT_PATH:PATH= - -//Dependencies for target -HebiCallGraphPass_LIB_DEPENDS:STATIC= - -//Single output directory for building all libraries. -LIBRARY_OUTPUT_PATH:PATH= - -//The directory containing a CMake configuration file for LLVM. -LLVM_DIR:PATH=/usr/local/lib/cmake/llvm - -//Value Computed by CMake -Project_BINARY_DIR:STATIC=/home/hebi/github/callgraph - -//Value Computed by CMake -Project_SOURCE_DIR:STATIC=/home/hebi/github/callgraph - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/home/hebi/github/callgraph -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=4 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/local/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/local/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/local/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=/usr/local/bin/ccmake -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of external makefile project generator. -CMAKE_EXTRA_GENERATOR:INTERNAL= -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Name of generator platform. -CMAKE_GENERATOR_PLATFORM:INTERNAL= -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Source directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/home/hebi/github/callgraph -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=2 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/local/share/cmake-3.4 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/usr/bin/uname -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 - diff --git a/CMakeLists.txt b/CMakeLists.txt index e4258fc..258c201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,16 @@ -find_package(LLVM REQUIRED CONFIG) +project(LLVMCallGraph) +cmake_minimum_required(VERSION 3.19) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +find_package(LLVM REQUIRED CONFIG) +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") add_definitions(${LLVM_DEFINITIONS}) -add_definitions(-std=c++11) include_directories(${LLVM_INCLUDE_DIRS}) -SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti") +list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") +include(AddLLVM) + +SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti ") add_subdirectory(hebicg) diff --git a/Makefile b/Makefile deleted file mode 100644 index 3dc166b..0000000 --- a/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.4 - -# Default target executed when no arguments are given to make. -default_target: all - -.PHONY : default_target - -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: - - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - - -# A target that is always out of date. -cmake_force: - -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/local/bin/cmake - -# The command to remove a file. -RM = /usr/local/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/hebi/github/callgraph - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/hebi/github/callgraph - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache - -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache - -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/hebi/github/callgraph/CMakeFiles /home/hebi/github/callgraph/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/hebi/github/callgraph/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean - -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named HebiCallGraphPass - -# Build rule for target. -HebiCallGraphPass: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 HebiCallGraphPass -.PHONY : HebiCallGraphPass - -# fast build rule for target. -HebiCallGraphPass/fast: - $(MAKE) -f hebicg/CMakeFiles/HebiCallGraphPass.dir/build.make hebicg/CMakeFiles/HebiCallGraphPass.dir/build -.PHONY : HebiCallGraphPass/fast - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... rebuild_cache" - @echo "... HebiCallGraphPass" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/README.org b/README.org index d5810fc..b27587a 100644 --- a/README.org +++ b/README.org @@ -1,11 +1,11 @@ #+TITLE: Call Graph Construction -The code is tested under =LLVM 3.9.0= +The code is tested under =LLVM 11.0.1= * Compile and Run To compile the tool itself, run the following commands in root directory: #+BEGIN_SRC shell -cmake . -make +cmake -S . -B ./build/ +make -C ./build/ #+END_SRC This will generate =hebicg/libHebiCallGraphPass.so= @@ -42,7 +42,7 @@ llvm-link *.bc -o single.bc To run the tool against the bitcode file, issue the following command #+BEGIN_SRC shell -opt -load ../hebicg/libHebiCallGraphPass.so -hebicg /path/to/benchmark.bc +opt -load ../build/hebicg/libHebiCallGraphPass.so -hebicg /path/to/benchmark.bc #+END_SRC The call graph will be outputed as text format, as well as an =out.dot= file. @@ -88,3 +88,9 @@ Similarly, for another real world benchmark, the =make-4.1=, call graph for =mak the complete call graph is: [[./make-single.png]] + +* Related LLVM Documentation + +https://llvm.org/docs/WritingAnLLVMPass.html + +https://llvm.org/docs/CMake.html#cmake-out-of-source-pass diff --git a/benchmark/.gitignore b/benchmark/.gitignore new file mode 100644 index 0000000..52fe5b3 --- /dev/null +++ b/benchmark/.gitignore @@ -0,0 +1,3 @@ +*.bc +*.ll +*.dot diff --git a/benchmark/Makefile b/benchmark/Makefile index 5232177..544651c 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -9,8 +9,8 @@ simple-c-func.bc : simple-c-func.c llvm-dis $@ test: - opt -load ../hebicg/libHebiCallGraphPass.so -hebicg test1.bc - opt -load ../hebicg/libHebiCallGraphPass.so -hebicg simple-c-func.bc + opt -load ../build/hebicg/libHebiCallGraphPass.so -hebicg test1.bc + opt -load ../build/hebicg/libHebiCallGraphPass.so -hebicg simple-c-func.bc png: dot -Tpng out.dot -o out.png diff --git a/benchmark/out.dot b/benchmark/out.dot deleted file mode 100644 index cf77b6f..0000000 --- a/benchmark/out.dot +++ /dev/null @@ -1,1068 +0,0 @@ -digraph { -main -> debug_prog; -debug_prog -> push_cmd_src; -push_cmd_src -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -r_fatal -> err; -err -> gawk_exit; -gawk_exit -> final_exit; -final_exit -> close_extensions; -final_exit -> run_ext_exit_handlers; -debug_prog -> unserialize; -unserialize -> unserialize_breakpoint; -unserialize_breakpoint -> set_breakpoint_at; -set_breakpoint_at -> add_breakpoint; -add_breakpoint -> mk_breakpoint; -mk_breakpoint -> emalloc_real; -mk_breakpoint -> bcalloc; -bcalloc -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -unserialize_breakpoint -> unserialize_commands; -unserialize_commands -> push_cmd_src; -unserialize_commands -> pop_cmd_src; -unserialize_commands -> zzparse; -zzparse -> has_break_or_watch_point; -zzparse -> find_option; -zzparse -> negate_num; -zzparse -> in_cmd_src; -zzparse -> find_command; -zzparse -> zzlex; -zzlex -> pop_cmd_src; -zzlex -> make_str_node; -make_str_node -> set_loc; -make_str_node -> more_blocks; -more_blocks -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -make_str_node -> emalloc_real; -make_str_node -> parse_escape; -parse_escape -> r_warning; -r_warning -> err; -parse_escape -> set_loc; -make_str_node -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -zzlex -> is_alpha; -zzlex -> is_identchar; -is_identchar -> is_alnum; -is_alnum -> is_alpha; -zzlex -> get_eof_status; -zzlex -> find_command; -zzlex -> zzerror; -zzlex -> mk_cmdarg; -mk_cmdarg -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -zzlex -> emalloc_real; -zzlex -> append_cmdarg; -zzlex -> unref; -unref -> r_unref; -r_unref -> mpfr_unset; -r_unref -> r_free_wstr; -zzlex -> d_error; -zzlex -> estrdup; -estrdup -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -zzparse -> zzerror; -zzparse -> mk_cmdarg; -zzparse -> append_cmdarg; -zzparse -> free_cmdarg; -free_cmdarg -> unref; -zzparse -> append_statement; -append_statement -> mk_cmdarg; -append_statement -> emalloc_real; -append_statement -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -zzparse -> find_argument; -zzparse -> concat_args; -concat_args -> make_str_node; -concat_args -> emalloc_real; -concat_args -> force_string; -concat_args -> dupnode; -dupnode -> r_dupnode; -r_dupnode -> more_blocks; -r_dupnode -> emalloc_real; -zzparse -> yydestruct; -zzparse -> lookup; -lookup -> make_str_node; -lookup -> in_array; -lookup -> unref; -unref -> r_unref; -zzparse -> estrdup; -unserialize_breakpoint -> source_find; -source_find -> d_error; -source_find -> files_are_same; -source_find -> find_source; -find_source -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -find_source -> do_find_source; -do_find_source -> ispath; -do_find_source -> emalloc_real; -do_find_source -> init_awkpath; -init_awkpath -> isdirpunct; -init_awkpath -> emalloc_real; -init_awkpath -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -unserialize_breakpoint -> parse_condition; -parse_condition -> add_srcfile; -add_srcfile -> set_loc; -add_srcfile -> r_fatal; -add_srcfile -> lintwarn_ln; -lintwarn_ln -> err; -lintwarn_ln -> gawk_exit; -lintwarn_ln -> print_included_from; -print_included_from -> msg; -msg -> err; -add_srcfile -> do_add_srcfile; -do_add_srcfile -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -do_add_srcfile -> estrdup; -add_srcfile -> files_are_same; -add_srcfile -> find_source; -parse_condition -> parse_program; -parse_program -> yyparse; -yyparse -> msg; -yyparse -> set_loc; -yyparse -> r_fatal; -yyparse -> make_str_node; -yyparse -> yylex; -yylex -> r_warning; -yylex -> set_loc; -yylex -> get_numbase; -yylex -> make_str_node; -yylex -> nextc; -nextc -> get_src_buf; -get_src_buf -> error; -error -> err; -get_src_buf -> set_loc; -get_src_buf -> emalloc_real; -get_src_buf -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -get_src_buf -> optimal_bufsize; -optimal_bufsize -> set_loc; -optimal_bufsize -> r_fatal; -get_src_buf -> srcopen; -srcopen -> os_setbinmode; -srcopen -> devopen; -devopen -> os_close_on_exec; -os_close_on_exec -> r_warning; -os_close_on_exec -> set_loc; -devopen -> devopen_simple; -devopen_simple -> os_devopen; -devopen_simple -> os_close_on_exec; -devopen_simple -> str2mode; -str2mode -> r_fatal; -devopen -> str2mode; -devopen -> inetfile; -devopen -> socketopen; -socketopen -> set_loc; -socketopen -> r_fatal; -nextc -> check_bad_char; -check_bad_char -> set_loc; -check_bad_char -> r_fatal; -yylex -> check_special; -yylex -> emalloc_real; -yylex -> newline_eof; -newline_eof -> set_loc; -newline_eof -> pushback; -yylex -> pushback; -yylex -> yyerror; -yyerror -> err; -yyerror -> msg; -yyerror -> emalloc_real; -yyerror -> print_included_from; -yylex -> tokexpand; -tokexpand -> emalloc_real; -tokexpand -> erealloc_real; -yylex -> allow_newline; -allow_newline -> nextc; -allow_newline -> pushback; -yylex -> dumpintlstr; -dumpintlstr -> pp_string_fp; -pp_string_fp -> pp_string; -pp_string -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -pp_string -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -yylex -> is_alpha; -yylex -> is_identchar; -yylex -> error_ln; -error_ln -> err; -error_ln -> print_included_from; -yylex -> nondec2awknum; -yylex -> bcalloc; -yylex -> estrdup; -yyparse -> count_expressions; -count_expressions -> list_merge; -list_merge -> bcfree; -count_expressions -> bcfree; -yyparse -> optimize_assignment; -optimize_assignment -> list_append; -optimize_assignment -> bcfree; -optimize_assignment -> bcalloc; -yyparse -> force_number; -yyparse -> negate_num; -yyparse -> mk_condition; -mk_condition -> list_append; -mk_condition -> list_prepend; -mk_condition -> list_create; -list_create -> bcalloc; -mk_condition -> list_merge; -mk_condition -> add_lint; -add_lint -> list_append; -add_lint -> lintwarn_ln; -add_lint -> isnoeffect; -add_lint -> bcalloc; -mk_condition -> bcfree; -mk_condition -> bcalloc; -yyparse -> mk_expression_list; -mk_expression_list -> bcalloc; -yyparse -> mk_assignment; -mk_assignment -> opcode2str; -opcode2str -> set_loc; -opcode2str -> r_fatal; -mk_assignment -> yyerror; -mk_assignment -> list_append; -mk_assignment -> list_merge; -mk_assignment -> bcalloc; -yyparse -> mk_boolean; -mk_boolean -> list_append; -mk_boolean -> list_merge; -mk_boolean -> add_lint; -mk_boolean -> bcalloc; -yyparse -> mk_binary; -mk_binary -> calc_exp; -calc_exp -> calc_exp_posint; -mk_binary -> force_number; -mk_binary -> error_ln; -mk_binary -> list_append; -mk_binary -> list_create; -mk_binary -> list_merge; -mk_binary -> unref; -unref -> r_unref; -mk_binary -> bcfree; -yyparse -> emalloc_real; -yyparse -> erealloc_real; -yyparse -> yyerror; -yyparse -> error_ln; -yyparse -> next_sourcefile; -yyparse -> append_rule; -append_rule -> list_append; -append_rule -> list_prepend; -append_rule -> find_line; -append_rule -> list_create; -append_rule -> list_merge; -append_rule -> bcalloc; -yyparse -> list_append; -yyparse -> list_prepend; -yyparse -> list_create; -yyparse -> list_merge; -yyparse -> mk_function; -mk_function -> list_append; -mk_function -> list_prepend; -mk_function -> dupnode; -dupnode -> r_dupnode; -mk_function -> func_use; -func_use -> emalloc_real; -mk_function -> remove_params; -remove_params -> make_str_node; -remove_params -> in_array; -remove_params -> unref; -mk_function -> bcfree; -mk_function -> bcalloc; -yyparse -> dupnode; -yyparse -> func_use; -yyparse -> include_source; -include_source -> error_ln; -include_source -> lintwarn_ln; -include_source -> add_srcfile; -yyparse -> lintwarn_ln; -yyparse -> load_library; -load_library -> error_ln; -load_library -> lintwarn_ln; -load_library -> add_srcfile; -load_library -> load_ext; -load_ext -> r_warning; -load_ext -> set_loc; -load_ext -> r_fatal; -yyparse -> add_lint; -yyparse -> warning_ln; -warning_ln -> err; -warning_ln -> print_included_from; -yyparse -> install_function; -install_function -> error_ln; -install_function -> check_params; -check_params -> emalloc_real; -check_params -> error_ln; -check_params -> bcfree; -check_params -> is_std_var; -install_function -> install_symbol; -install_symbol -> install; -install -> make_str_node; -install -> make_symbol; -make_symbol -> more_blocks; -make_symbol -> null_array; -make_symbol -> dupnode; -dupnode -> r_dupnode; -install -> in_array; -install -> unref; -install_function -> lookup; -install_function -> make_params; -make_params -> emalloc_real; -install_function -> install_params; -install_params -> install; -yyparse -> make_regnode; -make_regnode -> more_blocks; -make_regnode -> make_regexp; -make_regexp -> error; -make_regexp -> set_loc; -make_regexp -> r_fatal; -make_regexp -> parse_escape; -make_regexp -> re_compile_pattern; -re_compile_pattern -> re_compile_internal; -re_compile_internal -> test_realloc; -re_compile_internal -> init_dfa; -init_dfa -> test_malloc; -re_compile_internal -> free_dfa_content; -free_dfa_content -> free_token; -free_token -> free_charset; -free_dfa_content -> free_state; -re_compile_internal -> re_string_construct; -re_string_construct -> re_string_construct_common; -re_string_construct -> re_string_realloc_buffers; -re_string_realloc_buffers -> test_realloc; -re_string_realloc_buffers -> MAX; -re_string_construct -> build_wcs_upper_buffer; -build_wcs_upper_buffer -> test_malloc; -re_string_construct -> build_upper_buffer; -re_string_construct -> build_wcs_buffer; -re_string_construct -> re_string_translate_buffer; -re_compile_internal -> free_workarea_compile; -re_compile_internal -> re_string_destruct; -re_compile_internal -> parse; -parse -> fetch_token; -fetch_token -> peek_token; -peek_token -> peek_token; -peek_token -> re_string_peek_byte_case; -peek_token -> re_string_wchar_at; -parse -> parse_reg_exp; -parse_reg_exp -> fetch_token; -parse_reg_exp -> parse_branch; -parse_branch -> parse_expression; -parse_expression -> fetch_token; -parse_expression -> parse_expression; -parse_expression -> create_token_tree; -create_token_tree -> test_malloc; -parse_expression -> create_tree; -create_tree -> create_token_tree; -parse_expression -> parse_sub_exp; -parse_sub_exp -> fetch_token; -parse_sub_exp -> parse_reg_exp; -parse_sub_exp -> create_tree; -parse_sub_exp -> postorder; -parse_expression -> postorder; -parse_expression -> parse_bracket_exp; -parse_bracket_exp -> test_realloc; -parse_bracket_exp -> free_charset; -parse_bracket_exp -> create_token_tree; -parse_bracket_exp -> create_tree; -parse_bracket_exp -> peek_token_bracket; -parse_bracket_exp -> parse_bracket_element; -parse_bracket_element -> re_string_wchar_at; -parse_bracket_element -> peek_token_bracket; -parse_bracket_element -> re_string_char_size_at; -parse_bracket_element -> parse_bracket_symbol; -parse_bracket_symbol -> re_string_fetch_byte_case; -re_string_fetch_byte_case -> re_string_char_size_at; -parse_bracket_exp -> build_range_exp; -build_range_exp -> test_realloc; -parse_bracket_exp -> build_equiv_class; -parse_bracket_exp -> build_collating_symbol; -parse_bracket_exp -> build_charclass; -build_charclass -> test_realloc; -build_charclass -> is_blank; -parse_bracket_exp -> bitset_not; -parse_bracket_exp -> bitset_mask; -parse_expression -> init_word_char; -parse_expression -> build_charclass_op; -build_charclass_op -> free_charset; -build_charclass_op -> create_token_tree; -build_charclass_op -> create_tree; -build_charclass_op -> build_charclass; -build_charclass_op -> bitset_not; -build_charclass_op -> bitset_mask; -parse_expression -> parse_dup_op; -parse_dup_op -> fetch_token; -parse_dup_op -> create_tree; -parse_dup_op -> postorder; -parse_dup_op -> fetch_number; -fetch_number -> fetch_token; -parse_dup_op -> duplicate_tree; -duplicate_tree -> create_token_tree; -parse_branch -> create_tree; -parse_branch -> postorder; -parse_reg_exp -> create_tree; -parse_reg_exp -> postorder; -parse -> create_tree; -re_compile_internal -> analyze; -analyze -> test_malloc; -analyze -> postorder; -analyze -> preorder; -analyze -> calc_eclosure; -calc_eclosure -> calc_eclosure_iter; -calc_eclosure_iter -> calc_eclosure_iter; -calc_eclosure_iter -> re_node_set_alloc; -re_node_set_alloc -> test_malloc; -calc_eclosure_iter -> duplicate_node_closure; -duplicate_node_closure -> duplicate_node_closure; -duplicate_node_closure -> duplicate_node; -duplicate_node -> re_dfa_add_node; -re_dfa_add_node -> test_realloc; -re_dfa_add_node -> MAX; -duplicate_node_closure -> re_node_set_insert; -re_node_set_insert -> test_realloc; -re_node_set_insert -> re_node_set_init_1; -re_node_set_init_1 -> test_malloc; -duplicate_node_closure -> search_duplicated_node; -calc_eclosure_iter -> re_node_set_insert; -calc_eclosure_iter -> re_node_set_merge; -re_node_set_merge -> test_realloc; -analyze -> calc_inveclosure; -calc_inveclosure -> re_node_set_insert_last; -re_node_set_insert_last -> test_realloc; -re_compile_internal -> optimize_utf8; -re_compile_internal -> create_initial_state; -create_initial_state -> re_node_set_merge; -create_initial_state -> re_node_set_init_copy; -re_node_set_init_copy -> test_malloc; -create_initial_state -> re_node_set_contains; -create_initial_state -> re_acquire_state_context; -re_acquire_state_context -> calc_state_hash; -re_acquire_state_context -> re_node_set_compare; -re_acquire_state_context -> create_cd_newstate; -create_cd_newstate -> test_malloc; -create_cd_newstate -> free_state; -create_cd_newstate -> re_node_set_init_copy; -create_cd_newstate -> re_node_set_remove_at; -create_cd_newstate -> register_state; -register_state -> test_realloc; -register_state -> re_node_set_alloc; -register_state -> re_node_set_insert_last; -make_regexp -> dfacomp; -dfacomp -> dfaanalyze; -dfaanalyze -> xnmalloc; -xnmalloc -> xalloc_die; -xalloc_die -> r_fatal; -xnmalloc -> xmalloc; -xmalloc -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -dfaanalyze -> alloc_position_set; -alloc_position_set -> xnmalloc; -dfaanalyze -> merge; -merge -> maybe_realloc; -maybe_realloc -> x2nrealloc; -x2nrealloc -> xrealloc; -xrealloc -> xalloc_die; -x2nrealloc -> xalloc_die; -dfaanalyze -> copy; -copy -> x2nrealloc; -dfaanalyze -> epsclosure; -epsclosure -> delete; -epsclosure -> insert; -insert -> maybe_realloc; -dfaanalyze -> insert; -dfaanalyze -> state_separate_contexts; -dfaanalyze -> state_index; -state_index -> alloc_position_set; -state_index -> copy; -state_index -> maybe_realloc; -dfaanalyze -> xcalloc; -xcalloc -> xmalloc; -dfacomp -> dfainit; -dfacomp -> dfambcache; -dfacomp -> dfamust; -dfamust -> tstbit; -dfamust -> allocmust; -allocmust -> xzalloc; -xzalloc -> xmalloc; -allocmust -> xmalloc; -dfamust -> resetmust; -resetmust -> freelist; -dfamust -> freelist; -dfamust -> inboth; -inboth -> freelist; -inboth -> comsubs; -comsubs -> enlist; -enlist -> xnrealloc; -xnrealloc -> xrealloc; -xnrealloc -> xalloc_die; -enlist -> xmalloc; -comsubs -> xzalloc; -inboth -> addlists; -addlists -> enlist; -inboth -> xzalloc; -dfamust -> enlist; -dfamust -> addlists; -dfamust -> freemust; -freemust -> freelist; -dfamust -> icatalloc; -icatalloc -> xrealloc; -dfamust -> xstrdup; -xstrdup -> r_fatal; -xstrdup -> xmemdup; -xmemdup -> xmalloc; -dfamust -> xmalloc; -dfacomp -> dfassbuild; -dfassbuild -> xnmalloc; -dfassbuild -> dfaalloc; -dfaalloc -> xmalloc; -dfassbuild -> dfafree; -dfafree -> dfafree; -dfafree -> free_mbdata; -dfassbuild -> zeroset; -dfassbuild -> notset; -dfassbuild -> dfa_charclass_index; -dfa_charclass_index -> equal; -dfa_charclass_index -> maybe_realloc; -dfa_charclass_index -> copyset; -dfacomp -> dfaoptimize; -dfaoptimize -> dfafree; -dfaoptimize -> free_mbdata; -dfaoptimize -> using_utf8; -dfacomp -> dfaparse; -dfaparse -> regexp; -regexp -> branch; -branch -> closure; -closure -> closure; -closure -> atom; -atom -> case_folded_counterparts; -atom -> regexp; -atom -> addtok; -addtok -> addtok; -addtok -> addtok_wc; -addtok_wc -> addtok; -addtok_wc -> addtok_mb; -addtok_mb -> xnrealloc; -addtok_mb -> x2nrealloc; -addtok -> addtok_mb; -atom -> addtok_wc; -atom -> add_utf8_anychar; -add_utf8_anychar -> addtok; -add_utf8_anychar -> clrbit; -add_utf8_anychar -> charclass_index; -charclass_index -> dfa_charclass_index; -add_utf8_anychar -> copyset; -atom -> using_utf8; -atom -> lex; -lex -> setbit_case_fold_c; -setbit_case_fold_c -> setbit; -lex -> setbit; -lex -> mbs_to_wchar; -lex -> to_uchar; -lex -> zeroset; -lex -> notset; -lex -> clrbit; -lex -> charclass_index; -lex -> parse_bracket_exp; -parse_bracket_exp -> setbit_case_fold_c; -parse_bracket_exp -> case_folded_counterparts; -parse_bracket_exp -> setbit_wc; -setbit_wc -> setbit; -parse_bracket_exp -> setbit; -parse_bracket_exp -> mbs_to_wchar; -parse_bracket_exp -> to_uchar; -parse_bracket_exp -> notset; -parse_bracket_exp -> clrbit; -parse_bracket_exp -> charclass_index; -parse_bracket_exp -> equal; -parse_bracket_exp -> maybe_realloc; -parse_bracket_exp -> using_simple_locale; -parse_bracket_exp -> find_pred; -parse_bracket_exp -> dfaerror; -dfaerror -> set_loc; -dfaerror -> r_fatal; -parse_bracket_exp -> dfawarn; -lex -> dfaerror; -atom -> dfaerror; -closure -> addtok; -closure -> nsubtoks; -nsubtoks -> nsubtoks; -closure -> copytoks; -copytoks -> addtok_mb; -closure -> lex; -branch -> addtok; -regexp -> addtok; -regexp -> lex; -dfaparse -> addtok; -dfaparse -> lex; -dfaparse -> dfaerror; -make_regexp -> dfaalloc; -make_regexp -> dfasyntax; -dfasyntax -> char_context; -dfasyntax -> setbit; -make_regexp -> re_set_syntax; -make_regexp -> check_bracket_exp; -check_bracket_exp -> r_warning; -check_bracket_exp -> set_loc; -make_regexp -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -make_regexp -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -make_regexp -> refree; -refree -> dfafree; -refree -> regfree; -regfree -> free_dfa_content; -yyparse -> unref; -yyparse -> force_string; -yyparse -> fix_break_continue; -yyparse -> make_assignable; -yyparse -> variable; -variable -> error_ln; -variable -> install_symbol; -variable -> lookup; -yyparse -> mk_for_loop; -mk_for_loop -> list_append; -mk_for_loop -> list_prepend; -mk_for_loop -> list_create; -mk_for_loop -> list_merge; -mk_for_loop -> add_lint; -mk_for_loop -> fix_break_continue; -mk_for_loop -> bcalloc; -yyparse -> mk_getline; -mk_getline -> list_append; -mk_getline -> list_create; -mk_getline -> list_merge; -mk_getline -> make_assignable; -mk_getline -> bcfree; -mk_getline -> bcalloc; -yyparse -> snode; -snode -> r_warning; -snode -> set_loc; -snode -> r_fatal; -snode -> count_expressions; -snode -> mk_expression_list; -snode -> yyerror; -snode -> dumpintlstr; -snode -> list_append; -snode -> list_prepend; -snode -> list_create; -snode -> make_assignable; -snode -> mk_rexp; -mk_rexp -> make_regnode; -mk_rexp -> bcalloc; -snode -> dumpintlstr2; -dumpintlstr2 -> pp_string_fp; -snode -> bcalloc; -yyparse -> param_sanity; -param_sanity -> warning_ln; -yyparse -> yydestruct; -yyparse -> lookup; -yyparse -> bcfree; -yyparse -> bcalloc; -yyparse -> estrdup; -yyparse -> is_std_var; -parse_program -> emalloc_real; -parse_program -> erealloc_real; -parse_program -> tokexpand; -parse_program -> mk_program; -mk_program -> list_append; -mk_program -> list_prepend; -mk_program -> list_create; -mk_program -> list_merge; -mk_program -> bcfree; -mk_program -> bcalloc; -parse_program -> check_funcs; -check_funcs -> set_loc; -parse_program -> check_param_names; -check_param_names -> error; -check_param_names -> assoc_list; -assoc_list -> set_loc; -assoc_list -> r_fatal; -assoc_list -> PUSH_CODE; -PUSH_CODE -> more_blocks; -PUSH_CODE -> grow_stack; -grow_stack -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -assoc_list -> POP_CODE; -assoc_list -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -assoc_list -> lookup; -assoc_list -> bcfree; -assoc_list -> bcalloc; -check_param_names -> in_array; -parse_program -> bcalloc; -parse_condition -> find_frame; -parse_condition -> find_breakpoint; -parse_condition -> find_rule; -parse_condition -> find_item; -parse_condition -> install_params; -parse_condition -> remove_params; -parse_condition -> bcalloc; -parse_condition -> new_context; -new_context -> emalloc_real; -parse_condition -> push_context; -push_context -> set_context; -parse_condition -> free_context; -free_context -> release_symbols; -release_symbols -> destroy_symbol; -destroy_symbol -> unref; -destroy_symbol -> remove_symbol; -remove_symbol -> dupnode; -remove_symbol -> in_array; -destroy_symbol -> bcfree; -free_context -> free_bcpool; -free_bcpool -> free_bc_internal; -free_bc_internal -> r_fatal; -free_bc_internal -> unref; -free_bc_internal -> refree; -unserialize_breakpoint -> find_rule; -unserialize_breakpoint -> estrdup; -unserialize -> unserialize_list_item; -unserialize_list_item -> initialize_watch_item; -initialize_watch_item -> find_subscript; -find_subscript -> in_array; -initialize_watch_item -> d_error; -initialize_watch_item -> dupnode; -dupnode -> r_dupnode; -initialize_watch_item -> get_field; -get_field -> rebuild_record; -rebuild_record -> more_blocks; -rebuild_record -> r_free_wstr; -rebuild_record -> make_str_node; -rebuild_record -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -rebuild_record -> force_string; -rebuild_record -> unref; -unref -> r_unref; -get_field -> grow_fields_arr; -grow_fields_arr -> more_blocks; -grow_fields_arr -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -unserialize_list_item -> unserialize_commands; -unserialize_list_item -> make_str_node; -unserialize_list_item -> find_symbol; -find_symbol -> find_param; -find_param -> find_frame; -find_symbol -> lookup; -unserialize_list_item -> emalloc_real; -unserialize_list_item -> add_item; -add_item -> emalloc_real; -unserialize_list_item -> parse_condition; -unserialize_list_item -> estrdup; -unserialize -> unserialize_option; -unserialize_option -> estrdup; -debug_prog -> do_run; -do_run -> pop_cmd_src; -do_run -> restart; -restart -> serialize; -serialize -> serialize_subscript; -serialize -> emalloc_real; -serialize -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -restart -> close_all; -close_all -> set_gawk_output; -set_gawk_output -> d_error; -set_gawk_output -> os_devopen; -set_gawk_output -> os_isatty; -set_gawk_output -> estrdup; -close_all -> close_extensions; -close_all -> nextfile; -nextfile -> set_loc; -nextfile -> r_fatal; -nextfile -> make_str_node; -nextfile -> update_ERRNO_int; -update_ERRNO_int -> make_str_node; -update_ERRNO_int -> unref; -unref -> r_unref; -nextfile -> iop_close; -iop_close -> r_warning; -iop_close -> set_loc; -iop_close -> make_str_node; -iop_close -> remap_std_file; -remap_std_file -> os_devopen; -iop_close -> unref; -unref -> r_unref; -nextfile -> unref; -nextfile -> force_string; -nextfile -> in_array; -nextfile -> dupnode; -dupnode -> r_dupnode; -nextfile -> devopen; -nextfile -> close_one; -close_one -> r_warning; -close_one -> set_loc; -close_one -> r_fatal; -nextfile -> iop_alloc; -iop_alloc -> emalloc_real; -nextfile -> iop_finish; -iop_finish -> set_loc; -iop_finish -> optimal_bufsize; -iop_finish -> os_isreadable; -iop_finish -> os_isatty; -iop_finish -> emalloc_real; -nextfile -> arg_assign; -arg_assign -> final_exit; -arg_assign -> set_loc; -arg_assign -> r_fatal; -arg_assign -> make_str_node; -arg_assign -> r_get_lhs; -r_get_lhs -> set_loc; -r_get_lhs -> r_fatal; -r_get_lhs -> dupnode; -dupnode -> r_dupnode; -r_get_lhs -> array_vname; -array_vname -> make_aname; -make_aname -> make_aname; -make_aname -> erealloc_real; -make_aname -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -array_vname -> erealloc_real; -array_vname -> emalloc_real; -arg_assign -> check_special; -arg_assign -> is_alpha; -arg_assign -> is_identchar; -arg_assign -> variable; -arg_assign -> lookup; -arg_assign -> usage; -usage -> r_warning; -usage -> set_loc; -arg_assign -> estrdup; -arg_assign -> unref; -unref -> r_unref; -arg_assign -> force_number; -close_all -> close_io; -close_io -> r_warning; -close_io -> set_loc; -close_io -> close_redir; -close_redir -> r_warning; -close_redir -> set_loc; -close_redir -> update_ERRNO_int; -close_redir -> close_rp; -close_rp -> os_setbinmode; -close_rp -> iop_close; -close_rp -> gawk_pclose; -gawk_pclose -> iop_close; -gawk_pclose -> wait_any; -close_redir -> free_rp; -do_run -> prompt_yes_no; -debug_prog -> open_readfd; -open_readfd -> os_isdir; -debug_prog -> zzparse; -debug_prog -> os_isatty; -debug_prog -> estrdup; -main -> final_exit; -main -> r_warning; -main -> set_loc; -main -> r_fatal; -main -> make_str_node; -main -> init_profiling_signals; -main -> dump_prog; -dump_prog -> print_lib_list; -dump_prog -> pprint; -pprint -> set_loc; -pprint -> r_fatal; -pprint -> pprint; -pprint -> indent; -pprint -> pp_pop; -pprint -> pp_free; -pprint -> indent_in; -pprint -> indent_out; -pprint -> pp_push; -pp_push -> more_blocks; -pprint -> pp_number; -pp_number -> emalloc_real; -pprint -> emalloc_real; -pprint -> pp_string; -pprint -> pp_group3; -pp_group3 -> emalloc_real; -pprint -> pp_node; -pp_node -> pp_number; -pp_node -> pp_string; -pprint -> pp_list; -pp_list -> pp_pop; -pp_list -> pp_free; -pp_list -> emalloc_real; -pp_list -> erealloc_real; -pprint -> parenthesize; -parenthesize -> prec_level; -parenthesize -> div_on_left_mul_on_right; -parenthesize -> pp_parenthesize; -pp_parenthesize -> emalloc_real; -pprint -> prec_level; -pprint -> pp_parenthesize; -pprint -> is_binary; -pprint -> pp_concat; -pp_concat -> pp_pop; -pp_concat -> pp_free; -pp_concat -> emalloc_real; -pp_concat -> erealloc_real; -pp_concat -> prec_level; -pp_concat -> is_unary_minus; -pp_concat -> is_scalar; -pprint -> redir2str; -redir2str -> set_loc; -redir2str -> r_fatal; -pprint -> nodetype2str; -pprint -> op2str; -op2str -> set_loc; -op2str -> r_fatal; -pprint -> getfname; -main -> array_init; -array_init -> register_array_func; -main -> add_srcfile; -main -> parse_program; -main -> dump_vars; -dump_vars -> r_warning; -dump_vars -> set_loc; -dump_vars -> print_vars; -print_vars -> valinfo; -valinfo -> pp_string_fp; -valinfo -> flags2str; -flags2str -> genflags2str; -genflags2str -> set_loc; -genflags2str -> r_fatal; -main -> dump_funcs; -dump_funcs -> function_list; -function_list -> get_symbols; -get_symbols -> assoc_list; -get_symbols -> emalloc_real; -dump_funcs -> foreach_func; -main -> shadow_funcs; -shadow_funcs -> set_loc; -shadow_funcs -> r_fatal; -shadow_funcs -> function_list; -shadow_funcs -> foreach_func; -main -> install_builtins; -install_builtins -> install_symbol; -main -> init_interpret; -init_interpret -> getenv_long; -init_interpret -> more_blocks; -init_interpret -> emalloc_real; -emalloc_real -> set_loc; -emalloc_real -> r_fatal; -main -> load_ext; -main -> release_all_vars; -main -> new_context; -main -> push_context; -main -> init_fields; -init_fields -> more_blocks; -init_fields -> emalloc_real; -init_fields -> dupnode; -dupnode -> r_dupnode; -main -> init_ext_api; -main -> gawk_name; -main -> os_arg_fixup; -main -> os_is_setuid; -main -> os_setbinmode; -main -> os_isatty; -main -> init_io; -init_io -> getenv_long; -init_io -> init_sockets; -main -> usage; -main -> emalloc_real; -main -> init_fds; -init_fds -> devopen; -main -> parse_args; -parse_args -> r_warning; -parse_args -> set_loc; -parse_args -> set_prof_file; -set_prof_file -> r_warning; -set_prof_file -> set_loc; -set_prof_file -> devopen_simple; -parse_args -> add_srcfile; -parse_args -> getopt_long; -getopt_long -> _getopt_internal; -_getopt_internal -> _getopt_internal_r; -_getopt_internal_r -> _getopt_initialize; -_getopt_internal_r -> exchange; -parse_args -> usage; -parse_args -> save_argv; -save_argv -> emalloc_real; -save_argv -> estrdup; -parse_args -> add_preassign; -add_preassign -> emalloc_real; -add_preassign -> estrdup; -add_preassign -> erealloc_real; -erealloc_real -> set_loc; -erealloc_real -> r_fatal; -parse_args -> copyleft; -copyleft -> r_warning; -copyleft -> set_loc; -main -> set_locale_stuff; -set_locale_stuff -> init_locale; -init_locale -> estrdup; -main -> nostalgia; -main -> init_groupset; -init_groupset -> emalloc_real; -main -> init_vars; -init_vars -> make_str_node; -init_vars -> install_symbol; -init_vars -> estrdup; -init_vars -> load_procinfo; -load_procinfo -> set_loc; -load_procinfo -> r_fatal; -load_procinfo -> install_symbol; -load_procinfo -> current_field_sep; -load_procinfo -> update_PROCINFO_str; -update_PROCINFO_str -> make_str_node; -update_PROCINFO_str -> unref; -load_procinfo -> update_PROCINFO_num; -update_PROCINFO_num -> make_str_node; -update_PROCINFO_num -> unref; -load_procinfo -> estrdup; -init_vars -> load_environ; -load_environ -> make_str_node; -load_environ -> install_symbol; -load_environ -> estrdup; -load_environ -> unref; -load_environ -> path_environ; -path_environ -> make_str_node; -path_environ -> unref; -main -> arg_assign; -main -> cmdline_fs; -cmdline_fs -> set_loc; -cmdline_fs -> make_str_node; -cmdline_fs -> set_FS; -set_FS -> r_warning; -set_FS -> set_loc; -set_FS -> dupnode; -set_FS -> force_string; -set_FS -> unref; -set_FS -> get_field; -set_FS -> current_field_sep; -set_FS -> update_PROCINFO_str; -set_FS -> make_regexp; -set_FS -> refree; -cmdline_fs -> unref; -main -> version; -version -> print_ext_versions; -version -> copyleft; -main -> init_args; -init_args -> make_str_node; -init_args -> install_symbol; -init_args -> estrdup; -init_args -> unref; -main -> resetup; -resetup -> dfasyntax; -resetup -> re_set_syntax; -} - diff --git a/benchmark/simple-c-func.bc b/benchmark/simple-c-func.bc deleted file mode 100644 index 1c265a17a0675656dc621df5d18d1cd078ad46cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2248 zcmaJ@e@q+K9e?LL{4QW0NANNe?%Xp8)JwDNFqs1d*28X@yE2I^4W-(qoqFv^fC2zOhlW4g^7LQsehu-Y>n7s zI?mP{c^#CQtyw!2E2)@iZ8{N%ZiN2$0%2@cpU?yFJhEB7c=+zW(ZFI7&&?UxoROIc zu=5G+mXTQuuqz^y4zSA(1L!58Coa1I=`qQ^xNMQ2&m{NQWh5;;^g3l12a}3&F2R5_ zyOz*qnhfcLVrqSZT}-iC2_~D+&Ij1V1PlBz*>8fPOYV2#y)oJ4l-*9;>y`Ul5bgV% zA-5>^Ib{n{aLE=?c9XCdko{iSVu$^_>_fLC*@B#o!ak5OG6>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()^cK2(bv49=(s=S zp65U8u9_NsZHE8F3JIZqQPUZ{eJD`heCiXI3czMW=$n5K<>4l-(8M3pS-p%=KmJVG@sXGP zCO-Lk+3{7U=j_e<`Rg$YGQEN3@85m2)prf^6~rNPga^!mfTk2k*AVe2v`P+a*a)$%T;*aQ^kQ54rq_CGrPkFQjVzM@1K%KIZ$ z9oI*VvOg3^UtIm^h&HUTab}H;qvTvR^!xE2_tbfAea0fAO^NEbg^y+j$1|b%vZ*hD zn3SBg`ohbv;C-@Z@3zWc#LkrbM`HYP9)}Fdu72^AiWo1pa|*Z_^YhommyT#tFJl>R z7u?I)wU+-f!Z&q^J2f6ln!J9O4D;~IQen$W*YAHBAMF)tqZirt&8b`>1@-^Q +#include +#include #include #include #include #include #include + std::string func_name(Function *func) { if (func->getName() == "main") return "main"; DISubprogram *disubprogram = func->getSubprogram(); @@ -14,6 +17,7 @@ std::string func_name(Function *func) { } return ""; } + class HebiCallGraph { public: HebiCallGraph(Function *main_func) : m_main(main_func) {} @@ -151,6 +155,8 @@ class HebiCallGraphPass : public ModulePass { public: static char ID; HebiCallGraphPass() : ModulePass(ID) {} + + virtual bool runOnModule (Module &M) override { // errs() << "hello world\n"; // for (Function &F : M) { @@ -211,7 +217,7 @@ class HebiCallGraphPass : public ModulePass { unsigned num = call_inst->getNumArgOperands(); if (num >0) { } - Value *v = call_inst->getCalledValue(); + Value *v = call_inst->getCalledOperand(); if (v) { errs() << "=== value: " << "\n"; errs() << *v << "\n"; @@ -254,3 +260,10 @@ char HebiCallGraphPass::ID = 0; static RegisterPass X("hebicg", "Hebi Call Graph Pass", false, false); + +#if 0 +static RegisterStandardPasses Y( + PassManagerBuilder::EP_EarlyAsPossible, + [](const PassManagerBuilder &Builder, + legacy::PassManagerBase &PM) { PM.add(new HebiCallGraphPass()); }); +#endif diff --git a/test.sh b/test.sh index 348141c..5cb5545 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,5 @@ #!/bin/bash -opt -load ./hebicg/libHebiCallGraphPass.so -hebicg benchmark/test1.bc -opt -load ./hebicg/libHebiCallGraphPass.so -hebicg benchmark/simple-c-func.bc +set -x +make -C ./benchmark/ +opt -load ./build/hebicg/libHebiCallGraphPass.so -hebicg benchmark/test1.bc +opt -load ./build/hebicg/libHebiCallGraphPass.so -hebicg benchmark/simple-c-func.bc diff --git a/test_macos.sh b/test_macos.sh new file mode 100755 index 0000000..429571f --- /dev/null +++ b/test_macos.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -x +make -C ./benchmark/ +opt -load ./build/hebicg/HebiCallGraphPass.dylib -hebicg benchmark/test1.bc +opt -load ./build/hebicg/HebiCallGraphPass.dylib -hebicg benchmark/simple-c-func.bc From 15572142a084c8ab1ca9626e64df68486f106edd Mon Sep 17 00:00:00 2001 From: Aleksei Gutikov Date: Fri, 5 Mar 2021 03:25:45 +0300 Subject: [PATCH 2/2] quote func names --- hebicg/hebicg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hebicg/hebicg.cpp b/hebicg/hebicg.cpp index b8e6808..20a28bb 100644 --- a/hebicg/hebicg.cpp +++ b/hebicg/hebicg.cpp @@ -13,7 +13,7 @@ std::string func_name(Function *func) { if (func->getName() == "main") return "main"; DISubprogram *disubprogram = func->getSubprogram(); if (disubprogram) { - return disubprogram->getName().str(); + return "\"" + disubprogram->getName().str() + "\""; } return ""; }