1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

PoC for Flang Driver Plugins

This commit is contained in:
Stuart Ellis 2021-06-23 18:05:29 +01:00 committed by Andrzej Warzynski
parent e9c11e84f4
commit c930f37268
2 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/CommandLine.h"
#include <memory>
namespace llvm {
@ -120,7 +121,10 @@ namespace llvm {
public:
Add(StringRef Name, StringRef Desc)
: Entry(Name, Desc, CtorFn), Node(Entry) {
llvm::outs() << " -------------- (Registry) --------------\n";
llvm::outs() << " \tAdd :: " << Name << "\n";
add_node(&Node);
llvm::outs() << " ------------- (\\Registry) --------------\n";
}
};
};
@ -145,8 +149,14 @@ namespace llvm {
else \
Head = N; \
Tail = N; \
llvm::outs() << " REGISTRY_CLASS :: list >> \n"; \
for (const REGISTRY_CLASS::entry &plugin : REGISTRY_CLASS::entries()) { \
llvm::outs() << " " << plugin.getName() << " \t-- " << plugin.getDesc() << "\n"; \
} \
} \
template<typename T> typename Registry<T>::iterator Registry<T>::begin() { \
llvm::outs() << "iterator (head)\n"; \
llvm::outs() << Head << "\n"; \
return iterator(Head); \
} \
template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Head; \

View File

@ -149,12 +149,18 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *FileName,
// ManagedStatic can be added from static constructors in HandleSet::DLOpen.
HandleSet& HS = *OpenedHandles;
printf(" -------- (getPermantentLibrary) --------\n");
printf(" get Lib: %s \n", FileName);
void *Handle = HandleSet::DLOpen(FileName, Err);
if (Handle != &Invalid) {
printf(" Handle != Invalid \n");
SmartScopedLock<true> Lock(*SymbolsMutex);
HS.AddLibrary(Handle, /*IsProcess*/ FileName == nullptr);
}
printf(" ------- (\\getPermantentLibrary) --------\n");
return DynamicLibrary(Handle);
}