-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[llvm] Restore the ppc64le support that we lost in llvm8. #9380
Conversation
Starting build on |
Just to have my patch fixing other things serialized: diff --git a/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp b/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
index 93a48f3..18c7029 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
+++ b/interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
@@ -34,6 +34,8 @@
#include <iostream>
+#include "llvm/Support/Debug.h"
+
using namespace llvm;
namespace cling {
@@ -112,6 +114,8 @@ IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& /*diags*/,
: m_Diags(diags)
#endif
{
+ //llvm::DebugFlag = true;
+ //setCurrentDebugType("dyld");
// MSVC doesn't support m_AtExitFuncsSpinLock=ATOMIC_FLAG_INIT; in the class definition
std::atomic_flag_clear( &m_AtExitFuncsSpinLock );
diff --git a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
index e20543b..668bf0b 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
+++ b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
@@ -352,7 +352,7 @@ IncrementalJIT::IncrementalJIT(IncrementalExecutor& exe,
this->m_Resolver};
},
m_NotifyObjectLoaded, NotifyFinalizedT(*this)),
- m_CompileLayer(m_ObjectLayer, llvm::orc::SimpleCompiler(*m_TM)),
+ m_CompileLayer(m_ObjectLayer, MySimpleCompiler(*m_TM)),
m_LazyEmitLayer(m_CompileLayer) {
m_CompileLayer.setNotifyCompiled(NCC);
diff --git a/interpreter/cling/lib/Interpreter/IncrementalJIT.h b/interpreter/cling/lib/Interpreter/IncrementalJIT.h
index df4360f..ac4c851 100644
--- a/interpreter/cling/lib/Interpreter/IncrementalJIT.h
+++ b/interpreter/cling/lib/Interpreter/IncrementalJIT.h
@@ -38,6 +38,37 @@ namespace cling {
class Azog;
class IncrementalExecutor;
+ class MySimpleCompiler : public llvm::orc::SimpleCompiler {
+ public:
+ MySimpleCompiler(llvm::TargetMachine &TM, llvm::ObjectCache *ObjCache = nullptr)
+ : SimpleCompiler(TM, ObjCache) {}
+ CompileResult operator()(llvm::Module &M) {
+ auto R = SimpleCompiler::operator()(M);
+ //auto Filename = "output.o";
+ std::error_code EC;
+ //llvm::raw_fd_ostream dest(Filename, EC, sys::fs::F_None);
+
+ static unsigned counter = 0;
+ std::string FileStem;
+ {
+ llvm::raw_string_ostream FileStemStream(FileStem);
+ FileStemStream << M.getModuleIdentifier() << "." << ++counter;
+ }
+ llvm::raw_fd_ostream ModuleStream(FileStem + ".ll", EC, llvm::sys::fs::F_None);
+ ModuleStream << M;
+ llvm::raw_fd_ostream ObjectStream(FileStem + ".o", EC, llvm::sys::fs::F_None);
+ ObjectStream.write(R->getBufferStart(), R->getBufferSize());
+
+/* if (R) {
+ M.dump();
+ //printf("MemBuf '%.*s'\n", (int) R->getBufferSize(), R->getBufferStart());
+ printf("MemBuf '%s'\n", R->getBuffer().data());
+ // dump M and object file *R here.
+ }*/
+ return R;
+ }
+ };
+
class IncrementalJIT {
public:
using SymbolMapT = llvm::StringMap<llvm::JITTargetAddress>;
@@ -131,9 +162,24 @@ private:
SymbolMapT& m_SymbolMap;
};
+/* class MySimpleCompiler : public llvm::orc::SimpleCompiler {
+ public:
+ MySimpleCompiler(llvm::TargetMachine &TM, llvm::ObjectCache *ObjCache = nullptr)
+ : SimpleCompiler(TM, ObjCache) {}
+ CompileResult operator()(llvm::Module &M) {
+ auto R = SimpleCompiler::operator()(M);
+ if (R) {
+ M.dump();
+ printf("MemBuf '%.*s'", (int) R->getBufferSize(), R->getBufferStart());
+ // dump M and object file *R here.
+ }
+ return R;
+ }
+ };*/
+
typedef RemovableObjectLinkingLayer ObjectLayerT;
typedef llvm::orc::LegacyIRCompileLayer<ObjectLayerT,
- llvm::orc::SimpleCompiler> CompileLayerT;
+ MySimpleCompiler> CompileLayerT;
typedef llvm::orc::LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
std::unique_ptr<llvm::TargetMachine> m_TM;
diff --git a/interpreter/cling/lib/Interpreter/Interpreter.cpp b/interpreter/cling/lib/Interpreter/Interpreter.cpp
index 544d946..d10eaea 100644
--- a/interpreter/cling/lib/Interpreter/Interpreter.cpp
+++ b/interpreter/cling/lib/Interpreter/Interpreter.cpp
@@ -251,10 +251,9 @@ namespace cling {
// Enable incremental processing, which prevents the preprocessor destroying
// the lexer on EOF token.
PP.enableIncrementalProcessing();
-
- m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,
- /*SkipFunctionBodies*/false,
- /*isTemp*/true), this));
+ Parser* TempParser = new Parser(PP, SemaRef,/*SkipFunctionBodies*/false,/*isTemp*/true);
+ TempParser->Initialize();
+ m_LookupHelper.reset(new LookupHelper(TempParser, this));
if (!m_LookupHelper)
return;
diff --git a/interpreter/llvm/src/tools/clang/lib/Parse/Parser.cpp b/interpreter/llvm/src/tools/clang/lib/Parse/Parser.cpp
index f3d7ec8..bbb2c21 100644
--- a/interpreter/llvm/src/tools/clang/lib/Parse/Parser.cpp
+++ b/interpreter/llvm/src/tools/clang/lib/Parse/Parser.cpp
@@ -452,10 +452,11 @@ Parser::~Parser() {
///
void Parser::Initialize() {
// Create the translation unit scope. Install it as the current scope.
+ if (!IsTemporary) {
assert(getCurScope() == nullptr && "A scope is already active?");
EnterScope(Scope::DeclScope);
Actions.ActOnTranslationUnitScope(getCurScope());
-
+ }
// Initialization for Objective-C context sensitive keywords recognition.
// Referenced in Parser::ParseObjCTypeQualifierList.
if (getLangOpts().ObjC) {
@@ -535,10 +536,12 @@ void Parser::Initialize() {
Ident_module = PP.getIdentifierInfo("module");
}
+ if (!IsTemporary) {
Actions.Initialize();
// Prime the lexer look-ahead.
ConsumeToken();
+ }
}
void Parser::LateTemplateParserCleanupCallback(void *P) { |
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
@vgvassilev , I am testing this change ( along with fb3367f ) here https://github.com/cms-sw/root/pull/160/files but root still failed to build for ppc64le |
@smuzaffar, the jenkins link does not open for me. Can you attach the log here. |
The build works for me -- |
@vgvassilev did you build root master or root v6.24 plus your change and fb3367f ? |
if you have cms account then you should be able to access the logs. It fails (segmentation faults) at the end again with error
|
@smuzaffar, I am on v6-24-00-patches with the patches you mentioned. |
@vgvassilev , this looks good ( I have tested it here cms-sw/cmsdist#7445 ) . Can you please back port it to v6.24 branch too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't claim that I fully understand what's going on here (had to look up TOCs, https://reverseengineering.stackexchange.com/questions/21944/powerpc-toc-and-sda#21962 if you're interested), but LGTM.
@vgvassilev can you please update the commit message to point to https://reviews.llvm.org/D91983, which was the original review? The other is just the (attempted) backport to LLVM 10.
This patch is backported from https://reviews.llvm.org/D91983 also in https://reviews.llvm.org/D94183 For more discussion see numba/numba#4026 Fixes root-project#8072 and root-project#9297
55ae047
to
c78011d
Compare
Starting build on |
Build failed on mac11/cxx17. Errors:
|
Build failed on mac1015/python3. Errors:
|
This patch is backported from https://reviews.llvm.org/D94183
For more discussion see numba/numba#4026
Fixes #8072 and #9297
cc: @smuzaffar