-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f872ccf
commit 1c44ab5
Showing
12 changed files
with
624 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
function(suppress_warnings TARGET_NAME) | ||
get_target_property(target_options ${TARGET_NAME} COMPILE_OPTIONS) | ||
|
||
if(target_options MATCHES "target_options-NOTFOUND") | ||
set(target_options "") | ||
endif() | ||
|
||
if(NOT MSVC) | ||
# [TODO]: Come up with a better way | ||
else() | ||
list(APPEND target_options -w) | ||
endif() | ||
|
||
set_property(TARGET ${TARGET_NAME} PROPERTY COMPILE_OPTIONS ${target_options}) | ||
endfunction() | ||
|
||
function(enable_warnings TARGET_NAME) | ||
if(MSVC) | ||
target_compile_options(${TARGET_NAME} /W4) | ||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||
target_compile_options( | ||
${TARGET_NAME} | ||
PRIVATE -Wall | ||
-Wextra | ||
-Wshadow | ||
-Wcast-align | ||
-Wunused | ||
-Wpedantic | ||
-Wmisleading-indentation | ||
-Wnull-dereference | ||
-Wformat=2 | ||
-Wimplicit-fallthrough | ||
-Wno-missing-field-initializers | ||
-Wno-nullability-extension) | ||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") | ||
target_compile_options( | ||
${TARGET_NAME} | ||
PRIVATE -Wall | ||
-Wextra | ||
-pedantic | ||
-Wshadow | ||
-Wcast-align | ||
-Wunused | ||
-Wmisleading-indentation | ||
-Wduplicated-cond | ||
-Wduplicated-branches | ||
-Wlogical-op | ||
-Wnull-dereference | ||
-Wformat=2 | ||
-Wimplicit-fallthrough | ||
-Wno-missing-field-initializers) | ||
endif() | ||
|
||
endfunction(enable_warnings) | ||
|
||
option(LINT OFF) | ||
if(${LINT}) | ||
find_program(CLANG_TIDY_EXECUTABLE "clang-tidy") | ||
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXECUTABLE}") | ||
|
||
function(target_enable_linter TARGET_NAME) | ||
set_target_properties(${TARGET_NAME} PROPERTIES CXX_CLANG_TIDY | ||
"${CLANG_TIDY_COMMAND}") | ||
endfunction() | ||
else() | ||
function(target_enable_linter TARGET_NAME) | ||
# Do nothing | ||
endfunction() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* ---------------------------------------------------------------------------- | ||
* "THE BEER-WARE LICENSE" (Revision 42): | ||
* <[email protected]> wrote this file. As long | ||
* as you retain this notice you can do whatever you want with this stuff. If we | ||
* meet some day, and you think this stuff is worth it, you can buy us a beer in | ||
* return. | ||
* ---------------------------------------------------------------------------- | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "frontend/frontend_driver.hpp" | ||
|
||
#include <llvm/IR/Module.h> | ||
|
||
#include <memory> | ||
|
||
namespace paracl::llvm_codegen { | ||
|
||
namespace intrinsics { | ||
void print(int32_t val); | ||
|
||
int32_t read(); | ||
} | ||
|
||
auto emit_llvm(const frontend::frontend_driver &drv, llvm::LLVMContext &ctx) -> std::unique_ptr<llvm::Module>; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
add_llvm_based_lib(paracl-llvm | ||
SHARED | ||
LLVM_COMPONENTS | ||
target | ||
core | ||
executionengine | ||
interpreter | ||
support | ||
SOURCES | ||
codegen.cpp | ||
) | ||
target_include_directories(paracl-llvm PUBLIC ${PARACL_INCLUDE_DIR}) | ||
target_link_libraries(paracl-llvm PUBLIC paracl_compiler) |
Oops, something went wrong.