[ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.
A search order is a list of VSOs to be searched linearly to find symbols. Each
VSO now has a search order that will be used when fixing up definitions in that
VSO. Each VSO's search order defaults to just that VSO itself.
This is a first step towards removing symbol resolvers from ORC altogether. In
practice symbol resolvers tended to be used to implement a search order anyway,
sometimes with additional programatic generation of symbols. Now that VSOs
support programmatic generation of definitions via fallback generators, search
orders provide a cleaner way to achieve the desired effect (while removing a lot
of boilerplate).
llvm-svn: 337593
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
index c4424e0..c6caaf0 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
@@ -24,12 +24,52 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeBuilder.h"
#include "llvm/Object/ObjectFile.h"
-#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "gtest/gtest.h"
+
#include <memory>
namespace llvm {
+namespace orc {
+// CoreAPIsStandardTest that saves a bunch of boilerplate by providing the
+// following:
+//
+// (1) ES -- An ExecutionSession
+// (2) Foo, Bar, Baz, Qux -- SymbolStringPtrs for strings "foo", "bar", "baz",
+// and "qux" respectively.
+// (3) FooAddr, BarAddr, BazAddr, QuxAddr -- Dummy addresses. Guaranteed
+// distinct and non-null.
+// (4) FooSym, BarSym, BazSym, QuxSym -- JITEvaluatedSymbols with FooAddr,
+// BarAddr, BazAddr, and QuxAddr respectively. All with default strong,
+// linkage and non-hidden visibility.
+// (5) V -- A VSO associated with ES.
+class CoreAPIsBasedStandardTest : public testing::Test {
+public:
+protected:
+ ExecutionSession ES;
+ VSO &V = ES.createVSO("V");
+ SymbolStringPtr Foo = ES.getSymbolStringPool().intern("foo");
+ SymbolStringPtr Bar = ES.getSymbolStringPool().intern("bar");
+ SymbolStringPtr Baz = ES.getSymbolStringPool().intern("baz");
+ SymbolStringPtr Qux = ES.getSymbolStringPool().intern("qux");
+ static const JITTargetAddress FooAddr = 1U;
+ static const JITTargetAddress BarAddr = 2U;
+ static const JITTargetAddress BazAddr = 3U;
+ static const JITTargetAddress QuxAddr = 4U;
+ JITEvaluatedSymbol FooSym =
+ JITEvaluatedSymbol(FooAddr, JITSymbolFlags::Exported);
+ JITEvaluatedSymbol BarSym =
+ JITEvaluatedSymbol(BarAddr, JITSymbolFlags::Exported);
+ JITEvaluatedSymbol BazSym =
+ JITEvaluatedSymbol(BazAddr, JITSymbolFlags::Exported);
+ JITEvaluatedSymbol QuxSym =
+ JITEvaluatedSymbol(QuxAddr, JITSymbolFlags::Exported);
+};
+
+} // end namespace orc
+
class OrcNativeTarget {
public:
static void initialize() {