forked from OSchip/llvm-project
Revert r305313 & r305303, self-hosting build-bot isn’t liking it.
llvm-svn: 305318
This commit is contained in:
parent
769d8d185c
commit
6391c7e2a1
|
@ -60,10 +60,9 @@ class PassManagerBuilder {
|
|||
public:
|
||||
/// Extensions are passed the builder itself (so they can see how it is
|
||||
/// configured) as well as the pass manager to add stuff to.
|
||||
typedef void ExtensionProc(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM);
|
||||
typedef std::function<ExtensionProc> ExtensionFn;
|
||||
|
||||
typedef std::function<void(const PassManagerBuilder &Builder,
|
||||
legacy::PassManagerBase &PM)>
|
||||
ExtensionFn;
|
||||
enum ExtensionPointTy {
|
||||
/// EP_EarlyAsPossible - This extension point allows adding passes before
|
||||
/// any other transformations, allowing them to see the code as it is coming
|
||||
|
@ -180,7 +179,7 @@ public:
|
|||
/// Adds an extension that will be used by all PassManagerBuilder instances.
|
||||
/// This is intended to be used by plugins, to register a set of
|
||||
/// optimisations to run automatically.
|
||||
static void addGlobalExtension(ExtensionPointTy Ty, ExtensionProc Fn);
|
||||
static void addGlobalExtension(ExtensionPointTy Ty, ExtensionFn Fn);
|
||||
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn);
|
||||
|
||||
private:
|
||||
|
@ -209,12 +208,10 @@ public:
|
|||
/// used by optimizer plugins to allow all front ends to transparently use
|
||||
/// them. Create a static instance of this class in your plugin, providing a
|
||||
/// private function that the PassManagerBuilder can use to add your passes.
|
||||
/// Currently limited to real functions to avoid crashes when used within the
|
||||
/// main executable before a loaded plugin has a chance to use this.
|
||||
struct RegisterStandardPasses {
|
||||
RegisterStandardPasses(PassManagerBuilder::ExtensionPointTy Ty,
|
||||
PassManagerBuilder::ExtensionProc Fn) {
|
||||
PassManagerBuilder::addGlobalExtension(Ty, Fn);
|
||||
PassManagerBuilder::ExtensionFn Fn) {
|
||||
PassManagerBuilder::addGlobalExtension(Ty, std::move(Fn));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -198,9 +198,10 @@ PassManagerBuilder::~PassManagerBuilder() {
|
|||
static ManagedStatic<SmallVector<std::pair<PassManagerBuilder::ExtensionPointTy,
|
||||
PassManagerBuilder::ExtensionFn>, 8> > GlobalExtensions;
|
||||
|
||||
void PassManagerBuilder::addGlobalExtension(ExtensionPointTy Ty,
|
||||
ExtensionProc Fn) {
|
||||
GlobalExtensions->push_back(std::make_pair(Ty, Fn));
|
||||
void PassManagerBuilder::addGlobalExtension(
|
||||
PassManagerBuilder::ExtensionPointTy Ty,
|
||||
PassManagerBuilder::ExtensionFn Fn) {
|
||||
GlobalExtensions->push_back(std::make_pair(Ty, std::move(Fn)));
|
||||
}
|
||||
|
||||
void PassManagerBuilder::addExtension(ExtensionPointTy Ty, ExtensionFn Fn) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(LLVM_LINK_COMPONENTS Support IPO)
|
||||
set(LLVM_LINK_COMPONENTS Support)
|
||||
|
||||
add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx)
|
||||
|
||||
|
@ -20,7 +20,6 @@ function(dynlib_add_module NAME)
|
|||
)
|
||||
|
||||
add_dependencies(DynamicLibraryTests ${NAME})
|
||||
llvm_update_compile_flags(${NAME})
|
||||
endfunction(dynlib_add_module)
|
||||
|
||||
dynlib_add_module(PipSqueak)
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "PipSqueak.h"
|
||||
|
@ -53,28 +52,6 @@ template <class T> static void* PtrFunc(T *Func) {
|
|||
return Tmp.P;
|
||||
}
|
||||
|
||||
static void
|
||||
NoPassRegistration(const PassManagerBuilder &, legacy::PassManagerBase &) {
|
||||
}
|
||||
|
||||
static RegisterStandardPasses LocalPass(PassManagerBuilder::EP_LoopOptimizerEnd,
|
||||
NoPassRegistration);
|
||||
|
||||
typedef void (*TestPassReg)(void (*)(PassManagerBuilder::ExtensionPointTy,
|
||||
PassManagerBuilder::ExtensionProc));
|
||||
|
||||
TEST(DynamicLibrary, PassRegistration) {
|
||||
std::string Err;
|
||||
llvm_shutdown_obj Shutdown;
|
||||
DynamicLibrary DL =
|
||||
DynamicLibrary::getPermanentLibrary(LibPath().c_str(), &Err);
|
||||
EXPECT_TRUE(DL.isValid());
|
||||
EXPECT_TRUE(Err.empty());
|
||||
|
||||
TestPassReg RP = FuncPtr<TestPassReg>(DL.getAddressOfSymbol("TestPassReg"));
|
||||
RP(&PassManagerBuilder::addGlobalExtension);
|
||||
}
|
||||
|
||||
static const char *OverloadTestA() { return "OverloadCall"; }
|
||||
|
||||
std::string StdString(const char *Ptr) { return Ptr ? Ptr : ""; }
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PipSqueak.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
|
||||
#define PIPSQUEAK_TESTA_RETURN "LibCall"
|
||||
#include "ExportedFuncs.cxx"
|
||||
|
||||
struct Global {
|
||||
std::string *Str;
|
||||
|
@ -49,13 +45,5 @@ extern "C" PIPSQUEAK_EXPORT void TestOrder(std::vector<std::string> &V) {
|
|||
Glb.Vec = &V;
|
||||
}
|
||||
|
||||
|
||||
static void LibPassRegistration(const llvm::PassManagerBuilder &,
|
||||
llvm::legacy::PassManagerBase &) {}
|
||||
|
||||
extern "C" PIPSQUEAK_EXPORT void TestPassReg(
|
||||
void (*addGlobalExtension)(llvm::PassManagerBuilder::ExtensionPointTy,
|
||||
llvm::PassManagerBuilder::ExtensionProc)) {
|
||||
addGlobalExtension(llvm::PassManagerBuilder::EP_EarlyAsPossible,
|
||||
LibPassRegistration);
|
||||
}
|
||||
#define PIPSQUEAK_TESTA_RETURN "LibCall"
|
||||
#include "ExportedFuncs.cxx"
|
||||
|
|
Loading…
Reference in New Issue