Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support LLVM12 #503

Merged
merged 15 commits into from
Jul 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix for LLVM12, linked dynamically
Jcd1230 authored and elliottslaughter committed Jul 12, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6e92cb269ede92de23915e61166127d226f9f168
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -197,13 +197,11 @@ add_dependencies(TerraObjectFiles TerraGeneratedFiles)
add_library(TerraLibrary
STATIC
$<TARGET_OBJECTS:TerraObjectFiles>
${ALL_LLVM_OBJECTS}
${LUAJIT_OBJECTS}
)
add_library(TerraLibraryShared
SHARED
$<TARGET_OBJECTS:TerraObjectFiles>
${ALL_LLVM_OBJECTS}
${LUAJIT_OBJECTS}
)

@@ -231,8 +229,7 @@ set_target_properties(TerraLibraryShared PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${
target_link_libraries(TerraLibraryShared
PRIVATE
${LUAJIT_LIBRARIES}
${ALL_LLVM_LIBRARIES}
${LLVM_SYSTEM_LIBRARIES}
-lclang-cpp
)

if(APPLE)
@@ -333,6 +330,8 @@ elseif(UNIX)
-Wl,--whole-archive
TerraLibrary
-Wl,--no-whole-archive
LLVM
-lclang-cpp
${LUAJIT_LIBRARIES}
${ALL_LLVM_LIBRARIES}
${LLVM_SYSTEM_LIBRARIES}
2 changes: 1 addition & 1 deletion src/llvmheaders.h
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@
#include "llvmheaders_90.h"
#elif LLVM_VERSION == 100
#include "llvmheaders_100.h"
#elif LLVM_VERSION >= 110 && LLVM_VERSION < 120
#elif LLVM_VERSION >= 110 && LLVM_VERSION < 130
Jcd1230 marked this conversation as resolved.
Show resolved Hide resolved
#include "llvmheaders_110.h"
#else
#error "unsupported LLVM version"
8 changes: 2 additions & 6 deletions src/tcompiler.cpp
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@ extern "C" {

#if LLVM_VERSION < 50
#include "llvm/ExecutionEngine/MCJIT.h"
#else
#include "llvm/ExecutionEngine/OrcMCJITReplacement.h"
#endif

#include "llvm/Support/Atomic.h"
@@ -390,7 +388,7 @@ static void InitializeJIT(TerraCompilationUnit *CU) {
#else
.setMCJITMemoryManager(std::make_unique<TerraSectionMemoryManager>(CU))
#endif
.setUseOrcMCJITReplacement(true);
;
#endif

CU->ee = eb.create();
@@ -2488,9 +2486,7 @@ struct FunctionEmitter {
DEBUG_ONLY(T) {
MDNode *scope = debugScopeForFile(customfilename ? customfilename
: obj->string("filename"));
B->SetCurrentDebugLocation(DebugLoc::get(
customfilename ? customlinenumber : obj->number("linenumber"), 0,
scope));
B->SetCurrentDebugLocation(DILocation::get(scope->getContext(), customfilename ? customlinenumber : obj->number("linenumber"), 0, scope));
}
}

12 changes: 10 additions & 2 deletions src/tcwrapper.cpp
Original file line number Diff line number Diff line change
@@ -328,8 +328,16 @@ class IncludeCVisitor : public RecursiveASTVisitor<IncludeCVisitor> {
}
CStyleCastExpr *CreateCast(QualType Ty, CastKind Kind, Expr *E) {
TypeSourceInfo *TInfo = Context->getTrivialTypeSourceInfo(Ty, SourceLocation());
return CStyleCastExpr::Create(*Context, Ty, VK_RValue, Kind, E, 0, TInfo,
SourceLocation(), SourceLocation());
return CStyleCastExpr::Create(*Context,
Ty,
VK_RValue,
Kind,
E,
0, // CXXCastPath BasePath (?)
FPOptionsOverride::getFromOpaqueInt(0),
TInfo,
SourceLocation(),
SourceLocation());
}
IntegerLiteral *LiteralZero() {
unsigned IntSize = static_cast<unsigned>(Context->getTypeSize(Context->IntTy));