Skip to content

Commit

Permalink
add generators folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxic committed Apr 9, 2024
1 parent c3636aa commit 78f2f6b
Show file tree
Hide file tree
Showing 69 changed files with 3,880 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/generators/csmith/compile_csmith.sh
@@ -0,0 +1,19 @@

#!/bin/bash

compile_csmith() {
# echo "Generating program: $1"
clang -S -emit-llvm -O0 -o ./data/llO0/test$1.ll -I ./runtime ./data/c/test$1.c
clang -S -emit-llvm -O1 -o ./data/llO1/test$1.ll -I ./runtime ./data/c/test$1.c
clang -S -emit-llvm -O2 -o ./data/llO2/test$1.ll -I ./runtime ./data/c/test$1.c
# echo "Generate test$1.c"
}

# Run the function in parallel for arguments 1 to 1000
max=1000
for i in $(seq 1 $max); do
compile_csmith $i &
done

# Wait for all background processes to finish
wait
Binary file added src/generators/csmith/csmith
Binary file not shown.
2 changes: 2 additions & 0 deletions src/generators/csmith/platform.info
@@ -0,0 +1,2 @@
integer size = 4
pointer size = 8
22 changes: 22 additions & 0 deletions src/generators/csmith/run_csmith.sh
@@ -0,0 +1,22 @@
#!/bin/bash

gen_csmith() {
echo "Generating program: $1"
./csmith > data/test$1.c
echo "Generate test$1.c"
}

# Run the function in parallel for arguments 1 to 1000
max=1000
pids=()
for i in $(seq 1401 10000); do
gen_csmith $i &
pids+=($!)
if (($i % 400 == 0)); then
wait ${pids[@]}
pids=()
fi
done

# Wait for all background processes to finish
wait
6 changes: 6 additions & 0 deletions src/generators/csmith/runtime/.gitignore
@@ -0,0 +1,6 @@
# Additions to the patterns specified in the root `.gitignore' file.

# Files made by compilation.
safe_math.h
safe_math_macros.h
safe_math_macros_notmp.h
@@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.24

# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/garychen/csmith")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/garychen/csmith")

# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)


# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
@@ -0,0 +1,18 @@

# Consider dependencies only in project.
set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF)

# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
)

# The set of dependency files which are needed:
set(CMAKE_DEPENDS_DEPENDENCY_FILES
)

# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
)

# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")
103 changes: 103 additions & 0 deletions src/generators/csmith/runtime/CMakeFiles/headers.dir/build.make
@@ -0,0 +1,103 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.24

# Delete rule output on recipe failure.
.DELETE_ON_ERROR:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Disable VCS-based implicit rules.
% : %,v

# Disable VCS-based implicit rules.
% : RCS/%

# Disable VCS-based implicit rules.
% : RCS/%,v

# Disable VCS-based implicit rules.
% : SCCS/s.%

# Disable VCS-based implicit rules.
% : s.%

.SUFFIXES: .hpux_make_needs_suffix_list

# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#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/Cellar/cmake/3.24.2/bin/cmake

# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.24.2/bin/cmake -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/garychen/csmith

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/garychen/csmith

# Utility rule file for headers.

# Include any custom commands dependencies for this target.
include runtime/CMakeFiles/headers.dir/compiler_depend.make

# Include the progress variables for this target.
include runtime/CMakeFiles/headers.dir/progress.make

runtime/CMakeFiles/headers: runtime/safe_math.h
runtime/CMakeFiles/headers: runtime/safe_math_macros.h
runtime/CMakeFiles/headers: runtime/safe_math_macros_notmp.h

runtime/safe_math.h: runtime/safe_math.m4
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/Users/garychen/csmith/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Generating safe_math.h"
cd /Users/garychen/csmith/runtime && /usr/bin/m4 < /Users/garychen/csmith/runtime/safe_math.m4 > safe_math.h

runtime/safe_math_macros.h: runtime/safe_math_macros.m4
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/Users/garychen/csmith/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Generating safe_math_macros.h"
cd /Users/garychen/csmith/runtime && /usr/bin/m4 < /Users/garychen/csmith/runtime/safe_math_macros.m4 > safe_math_macros.h

runtime/safe_math_macros_notmp.h: runtime/safe_math_macros_notmp.m4
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/Users/garychen/csmith/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Generating safe_math_macros_notmp.h"
cd /Users/garychen/csmith/runtime && /usr/bin/m4 < /Users/garychen/csmith/runtime/safe_math_macros_notmp.m4 > safe_math_macros_notmp.h

headers: runtime/CMakeFiles/headers
headers: runtime/safe_math.h
headers: runtime/safe_math_macros.h
headers: runtime/safe_math_macros_notmp.h
headers: runtime/CMakeFiles/headers.dir/build.make
.PHONY : headers

# Rule to build all files generated by this target.
runtime/CMakeFiles/headers.dir/build: headers
.PHONY : runtime/CMakeFiles/headers.dir/build

runtime/CMakeFiles/headers.dir/clean:
cd /Users/garychen/csmith/runtime && $(CMAKE_COMMAND) -P CMakeFiles/headers.dir/cmake_clean.cmake
.PHONY : runtime/CMakeFiles/headers.dir/clean

runtime/CMakeFiles/headers.dir/depend:
cd /Users/garychen/csmith && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/garychen/csmith /Users/garychen/csmith/runtime /Users/garychen/csmith /Users/garychen/csmith/runtime /Users/garychen/csmith/runtime/CMakeFiles/headers.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : runtime/CMakeFiles/headers.dir/depend

@@ -0,0 +1,11 @@
file(REMOVE_RECURSE
"CMakeFiles/headers"
"safe_math.h"
"safe_math_macros.h"
"safe_math_macros_notmp.h"
)

# Per-language clean rules from dependency scanning.
foreach(lang )
include(CMakeFiles/headers.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
@@ -0,0 +1,2 @@
# Empty custom commands generated dependencies file for headers.
# This may be replaced when dependencies are built.
@@ -0,0 +1,2 @@
# CMAKE generated file: DO NOT EDIT!
# Timestamp file for custom commands dependencies management for headers.
@@ -0,0 +1,4 @@
CMAKE_PROGRESS_1 = 74
CMAKE_PROGRESS_2 = 75
CMAKE_PROGRESS_3 = 76

@@ -0,0 +1,19 @@

# Consider dependencies only in project.
set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF)

# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
)

# The set of dependency files which are needed:
set(CMAKE_DEPENDS_DEPENDENCY_FILES
"/Users/garychen/csmith/runtime/volatile_runtime.c" "runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o" "gcc" "runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o.d"
)

# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
)

# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")
111 changes: 111 additions & 0 deletions src/generators/csmith/runtime/CMakeFiles/libcsmith_a.dir/build.make
@@ -0,0 +1,111 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.24

# Delete rule output on recipe failure.
.DELETE_ON_ERROR:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Disable VCS-based implicit rules.
% : %,v

# Disable VCS-based implicit rules.
% : RCS/%

# Disable VCS-based implicit rules.
% : RCS/%,v

# Disable VCS-based implicit rules.
% : SCCS/s.%

# Disable VCS-based implicit rules.
% : s.%

.SUFFIXES: .hpux_make_needs_suffix_list

# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#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/Cellar/cmake/3.24.2/bin/cmake

# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.24.2/bin/cmake -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/garychen/csmith

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/garychen/csmith

# Include any dependencies generated for this target.
include runtime/CMakeFiles/libcsmith_a.dir/depend.make
# Include any dependencies generated by the compiler for this target.
include runtime/CMakeFiles/libcsmith_a.dir/compiler_depend.make

# Include the progress variables for this target.
include runtime/CMakeFiles/libcsmith_a.dir/progress.make

# Include the compile flags for this target's objects.
include runtime/CMakeFiles/libcsmith_a.dir/flags.make

runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o: runtime/CMakeFiles/libcsmith_a.dir/flags.make
runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o: runtime/volatile_runtime.c
runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o: runtime/CMakeFiles/libcsmith_a.dir/compiler_depend.ts
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/garychen/csmith/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o"
cd /Users/garychen/csmith/runtime && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o -MF CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o.d -o CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o -c /Users/garychen/csmith/runtime/volatile_runtime.c

runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/libcsmith_a.dir/volatile_runtime.c.i"
cd /Users/garychen/csmith/runtime && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/garychen/csmith/runtime/volatile_runtime.c > CMakeFiles/libcsmith_a.dir/volatile_runtime.c.i

runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/libcsmith_a.dir/volatile_runtime.c.s"
cd /Users/garychen/csmith/runtime && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/garychen/csmith/runtime/volatile_runtime.c -o CMakeFiles/libcsmith_a.dir/volatile_runtime.c.s

# Object files for target libcsmith_a
libcsmith_a_OBJECTS = \
"CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o"

# External object files for target libcsmith_a
libcsmith_a_EXTERNAL_OBJECTS =

runtime/libcsmith.a: runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o
runtime/libcsmith.a: runtime/CMakeFiles/libcsmith_a.dir/build.make
runtime/libcsmith.a: runtime/CMakeFiles/libcsmith_a.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/garychen/csmith/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C static library libcsmith.a"
cd /Users/garychen/csmith/runtime && $(CMAKE_COMMAND) -P CMakeFiles/libcsmith_a.dir/cmake_clean_target.cmake
cd /Users/garychen/csmith/runtime && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/libcsmith_a.dir/link.txt --verbose=$(VERBOSE)

# Rule to build all files generated by this target.
runtime/CMakeFiles/libcsmith_a.dir/build: runtime/libcsmith.a
.PHONY : runtime/CMakeFiles/libcsmith_a.dir/build

runtime/CMakeFiles/libcsmith_a.dir/clean:
cd /Users/garychen/csmith/runtime && $(CMAKE_COMMAND) -P CMakeFiles/libcsmith_a.dir/cmake_clean.cmake
.PHONY : runtime/CMakeFiles/libcsmith_a.dir/clean

runtime/CMakeFiles/libcsmith_a.dir/depend:
cd /Users/garychen/csmith && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/garychen/csmith /Users/garychen/csmith/runtime /Users/garychen/csmith /Users/garychen/csmith/runtime /Users/garychen/csmith/runtime/CMakeFiles/libcsmith_a.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : runtime/CMakeFiles/libcsmith_a.dir/depend

@@ -0,0 +1,11 @@
file(REMOVE_RECURSE
"CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o"
"CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o.d"
"libcsmith.a"
"libcsmith.pdb"
)

# Per-language clean rules from dependency scanning.
foreach(lang C)
include(CMakeFiles/libcsmith_a.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
@@ -0,0 +1,3 @@
file(REMOVE_RECURSE
"libcsmith.a"
)
@@ -0,0 +1,35 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.24

runtime/CMakeFiles/libcsmith_a.dir/volatile_runtime.c.o
/Users/garychen/csmith/runtime/volatile_runtime.c
/Users/garychen/csmith/config.h
/Users/garychen/csmith/runtime/volatile_runtime.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/stdint.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/stdint.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_int8_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_int16_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_int32_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_int64_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_uint8_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_uint16_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_uint32_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_uint64_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/cdefs.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_posix_availability.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/machine/_types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/i386/_types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_pthread/_pthread_types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_intptr_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/machine/types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/i386/types.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_u_int8_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_u_int16_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_u_int32_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_u_int64_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/_types/_uintptr_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_intmax_t.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/_types/_uintmax_t.h

0 comments on commit 78f2f6b

Please sign in to comment.