Skip to content

Commit

Permalink
Add LLVM setup step to CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Jul 14, 2021
1 parent 22ce128 commit 3266625
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ../llvm
key: llvm-12-0-1

- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
mkdir -p ../llvm/build
cd ../llvm
curl -fsSL https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-12.0.1.tar.gz -o llvm.tar.gz
tar -zxf llvm.tar.gz
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS_RELEASE="-O2" -G "Unix Makefiles" ../llvm
cmake --build .
- name: Download Libs
run: |
mkdir -p ./compiler/lib
Expand Down
4 changes: 0 additions & 4 deletions compiler/src/ir/GeneratorVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ antlrcpp::Any GeneratorVisitor::visitFunctionCall(SpiceParser::FunctionCallConte
return builder->CreateCall(fct, argValues);
}

antlrcpp::Any GeneratorVisitor::visitImportStmt(SpiceParser::ImportStmtContext *ctx) {
return SpiceBaseVisitor::visitImportStmt(ctx);
}

antlrcpp::Any GeneratorVisitor::visitReturnStmt(SpiceParser::ReturnStmtContext *ctx) {
auto returnValue = visit(ctx->assignment()).as<llvm::Value*>();
// Build return value
Expand Down
1 change: 0 additions & 1 deletion compiler/src/ir/GeneratorVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class GeneratorVisitor : public SpiceBaseVisitor {
antlrcpp::Any visitIfStmt(SpiceParser::IfStmtContext *ctx) override;
antlrcpp::Any visitDeclStmt(SpiceParser::DeclStmtContext *ctx) override;
antlrcpp::Any visitFunctionCall(SpiceParser::FunctionCallContext *ctx) override;
antlrcpp::Any visitImportStmt(SpiceParser::ImportStmtContext *ctx) override;
antlrcpp::Any visitReturnStmt(SpiceParser::ReturnStmtContext *ctx) override;
antlrcpp::Any visitPrintfStmt(SpiceParser::PrintfStmtContext *ctx) override;
antlrcpp::Any visitAssignment(SpiceParser::AssignmentContext *ctx) override;
Expand Down
21 changes: 5 additions & 16 deletions media/test.spice
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
f<int> testFunc() {
printf("Hello from testFunc!\n");
return 1;
}

p testProcedure() {
double result = true || false ? 5.1 : 4.12;
printf("Computation result: %d", result);
}

f<int> main() {
for int j = 0; j < 5; j++ {
printf("For round: %d \n", j);
}
int testFuncResult = testFunc();
printf("Result of testFunc: %d \n", testFuncResult);
testProcedure();
int operand1 = 6;
int operand2 = 5;
int res = operand1 | operand2;
printf("Computation result is: %d", res);

return 0;
}

0 comments on commit 3266625

Please sign in to comment.