Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsukha committed Oct 18, 2023
0 parents commit ba1182a
Show file tree
Hide file tree
Showing 23 changed files with 11,054 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
tools/
*.txt
*.sh
data/
.cache/
build/
release_build/
# Created by https://www.toptal.com/developers/gitignore/api/linux,c++,cmake,git
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,c++,cmake,git

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

### CMake Patch ###
# External projects
*-prefix/

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# End of https://www.toptal.com/developers/gitignore/api/linux,c++,cmake,git
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.10)

project(bfjit)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic")
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -g -march=native")

add_link_options("--ld-path=/usr/local/bin/ld64.sold")

add_executable(bfjit
src/main.cpp
src/bfjit/nodes/nodes.cpp
src/bfjit/codegen/single_module_context.cpp
src/bfjit/codegen/codegen.cpp
src/bfjit/optimizer/optimizer.cpp
src/bfjit/jit/jit.cpp
src/bfjit/util/cmdline.cpp)

find_package(Threads REQUIRED)
find_package(fmt REQUIRED)
# not the most portable approach I admit
find_package(LLVM REQUIRED PATHS "/opt/homebrew/opt/llvm")

llvm_map_components_to_libnames(llvm_libs
core
analysis
scalaropts
instcombine
transformutils
passes
orcjit
native)
message(STATUS "LLVM found at: ${LLVM_DIR}")
message(STATUS "LLVM lib list: ${llvm_libs}")

target_link_libraries(bfjit PRIVATE Threads::Threads fmt::fmt ${llvm_libs})

target_include_directories(bfjit PRIVATE
"include"
${LLVM_INCLUDE_DIRS})

Loading

0 comments on commit ba1182a

Please sign in to comment.