[llvm] r230143 - [Orc] Move Orc code into a namespace (llvm::orc), update Kaleidoscope code.
Lang Hames
lhames at gmail.com
Sat Feb 21 12:44:37 PST 2015
Author: lhames
Date: Sat Feb 21 14:44:36 2015
New Revision: 230143
URL: http://llvm.org/viewvc/llvm-project?rev=230143&view=rev
Log:
[Orc] Move Orc code into a namespace (llvm::orc), update Kaleidoscope code.
NFC.
Modified:
llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp
llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
llvm/trunk/include/llvm/ExecutionEngine/Orc/CloneSubModule.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/JITSymbol.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h
llvm/trunk/lib/ExecutionEngine/Orc/CloneSubModule.cpp
llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp
llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp
Modified: llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp Sat Feb 21 14:44:36 2015
@@ -20,7 +20,9 @@
#include <sstream>
#include <string>
#include <vector>
+
using namespace llvm;
+using namespace llvm::orc;
//===----------------------------------------------------------------------===//
// Lexer
Modified: llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp Sat Feb 21 14:44:36 2015
@@ -20,7 +20,9 @@
#include <sstream>
#include <string>
#include <vector>
+
using namespace llvm;
+using namespace llvm::orc;
//===----------------------------------------------------------------------===//
// Lexer
Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp Sat Feb 21 14:44:36 2015
@@ -19,7 +19,9 @@
#include <sstream>
#include <string>
#include <vector>
+
using namespace llvm;
+using namespace llvm::orc;
//===----------------------------------------------------------------------===//
// Lexer
Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp Sat Feb 21 14:44:36 2015
@@ -19,7 +19,9 @@
#include <sstream>
#include <string>
#include <vector>
+
using namespace llvm;
+using namespace llvm::orc;
//===----------------------------------------------------------------------===//
// Lexer
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CloneSubModule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CloneSubModule.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CloneSubModule.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CloneSubModule.h Sat Feb 21 14:44:36 2015
@@ -25,21 +25,36 @@ class Function;
class GlobalVariable;
class Module;
+namespace orc {
+
+/// @brief Functor type for describing how CloneSubModule should mutate a
+/// GlobalVariable.
typedef std::function<void(GlobalVariable &, const GlobalVariable &,
ValueToValueMapTy &)> HandleGlobalVariableFtor;
+/// @brief Functor type for describing how CloneSubModule should mutate a
+/// Function.
typedef std::function<void(Function &, const Function &, ValueToValueMapTy &)>
HandleFunctionFtor;
+/// @brief Copies the initializer from Orig to New.
+///
+/// Type is suitable for implicit conversion to a HandleGlobalVariableFtor.
void copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
ValueToValueMapTy &VMap);
+/// @brief Copies the body of Orig to New.
+///
+/// Type is suitable for implicit conversion to a HandleFunctionFtor.
void copyFunctionBody(Function &New, const Function &Orig,
ValueToValueMapTy &VMap);
+/// @brief Clone a subset of the module Src into Dst.
void CloneSubModule(Module &Dst, const Module &Src,
HandleGlobalVariableFtor HandleGlobalVariable,
HandleFunctionFtor HandleFunction, bool KeepInlineAsm);
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_CLONESUBMODULE_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Sat Feb 21 14:44:36 2015
@@ -22,6 +22,7 @@
#include <list>
namespace llvm {
+namespace orc {
/// @brief Compile-on-demand layer.
///
@@ -347,6 +348,8 @@ private:
CompileCallbackMgrT CompileCallbackMgr;
ModuleSetInfoListT ModuleSetInfos;
};
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_COMPILEONDEMANDLAYER_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h Sat Feb 21 14:44:36 2015
@@ -21,6 +21,7 @@
#include "llvm/Target/TargetMachine.h"
namespace llvm {
+namespace orc {
/// @brief Simple compile functor: Takes a single IR module and returns an
/// ObjectFile.
@@ -54,6 +55,8 @@ public:
private:
TargetMachine &TM;
};
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h Sat Feb 21 14:44:36 2015
@@ -21,6 +21,7 @@
#include <memory>
namespace llvm {
+namespace orc {
/// @brief Eager IR compiling layer.
///
@@ -138,6 +139,8 @@ private:
CompileFtor Compile;
ObjectCache *ObjCache;
};
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h Sat Feb 21 14:44:36 2015
@@ -22,6 +22,7 @@
#include <sstream>
namespace llvm {
+namespace orc {
/// @brief Base class for JITLayer independent aspects of
/// JITCompileCallbackManager.
@@ -239,6 +240,7 @@ public:
FullyPartitionedModule fullyPartition(Module &M);
-}
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_INDIRECTIONUTILS_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/JITSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/JITSymbol.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/JITSymbol.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/JITSymbol.h Sat Feb 21 14:44:36 2015
@@ -19,6 +19,7 @@
#include <functional>
namespace llvm {
+namespace orc {
/// @brief Represents an address in the target process's address space.
typedef uint64_t TargetAddress;
@@ -67,6 +68,7 @@ private:
GetAddressFtor GetAddress;
};
-}
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Sat Feb 21 14:44:36 2015
@@ -22,6 +22,7 @@
#include <list>
namespace llvm {
+namespace orc {
/// @brief Lazy-emitting IR layer.
///
@@ -273,6 +274,8 @@ LazyEmittingLayer<BaseLayerT>::EmissionD
return llvm::make_unique<EmissionDeferredSetImpl<ModuleSetT>>(std::move(Ms),
std::move(MM));
}
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_LAZYEMITTINGLAYER_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LookasideRTDyldMM.h Sat Feb 21 14:44:36 2015
@@ -20,6 +20,7 @@
#include <vector>
namespace llvm {
+namespace orc {
/// @brief Defines an adapter for RuntimeDyldMM that allows lookups for external
/// symbols to go via a functor, before falling back to the lookup logic
@@ -84,6 +85,8 @@ createLookasideRTDyldMM(ExternalLookupFt
std::forward<ExternalLookupFtor>(ExternalLookup),
std::forward<DylibLookupFtor>(DylibLookup));
}
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_LOOKASIDERTDYLDMM_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h Sat Feb 21 14:44:36 2015
@@ -22,6 +22,7 @@
#include <memory>
namespace llvm {
+namespace orc {
class ObjectLinkingLayerBase {
protected:
@@ -260,6 +261,7 @@ private:
CreateRTDyldMMFtor CreateMemoryManager;
};
-} // end namespace llvm
+} // End namespace orc.
+} // End namespace llvm
#endif // LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h Sat Feb 21 14:44:36 2015
@@ -17,6 +17,7 @@
#include "IndirectionUtils.h"
namespace llvm {
+namespace orc {
class OrcX86_64 {
public:
@@ -49,6 +50,7 @@ public:
};
-}
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_EXECUTIONENGINE_ORC_ORCTARGETSUPPORT_H
Modified: llvm/trunk/lib/ExecutionEngine/Orc/CloneSubModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/CloneSubModule.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/CloneSubModule.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/CloneSubModule.cpp Sat Feb 21 14:44:36 2015
@@ -4,15 +4,16 @@
#include "llvm/IR/Module.h"
#include "llvm/Transforms/Utils/Cloning.h"
-using namespace llvm;
+namespace llvm {
+namespace orc {
-void llvm::copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
+void copyGVInitializer(GlobalVariable &New, const GlobalVariable &Orig,
ValueToValueMapTy &VMap) {
if (Orig.hasInitializer())
New.setInitializer(MapValue(Orig.getInitializer(), VMap));
}
-void llvm::copyFunctionBody(Function &New, const Function &Orig,
+void copyFunctionBody(Function &New, const Function &Orig,
ValueToValueMapTy &VMap) {
if (!Orig.isDeclaration()) {
Function::arg_iterator DestI = New.arg_begin();
@@ -27,9 +28,9 @@ void llvm::copyFunctionBody(Function &Ne
}
}
-void llvm::CloneSubModule(llvm::Module &Dst, const Module &Src,
- HandleGlobalVariableFtor HandleGlobalVariable,
- HandleFunctionFtor HandleFunction, bool CloneInlineAsm) {
+void CloneSubModule(llvm::Module &Dst, const Module &Src,
+ HandleGlobalVariableFtor HandleGlobalVariable,
+ HandleFunctionFtor HandleFunction, bool CloneInlineAsm) {
ValueToValueMapTy VMap;
@@ -102,3 +103,6 @@ void llvm::CloneSubModule(llvm::Module &
}
}
+
+} // End namespace orc.
+} // End namespace llvm.
Modified: llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp Sat Feb 21 14:44:36 2015
@@ -8,6 +8,7 @@
using namespace llvm;
namespace llvm {
+namespace orc {
GlobalVariable* createImplPointer(Function &F, const Twine &Name,
Constant *Initializer) {
@@ -106,4 +107,5 @@ FullyPartitionedModule fullyPartition(Mo
return MP;
}
-}
+} // End namespace orc.
+} // End namespace llvm.
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp Sat Feb 21 14:44:36 2015
@@ -13,7 +13,7 @@
namespace {
static struct RegisterJIT {
- RegisterJIT() { llvm::OrcMCJITReplacement::Register(); }
+ RegisterJIT() { llvm::orc::OrcMCJITReplacement::Register(); }
} JITRegistrator;
}
@@ -21,6 +21,7 @@ static struct RegisterJIT {
extern "C" void LLVMLinkInOrcMCJITReplacement() {}
namespace llvm {
+namespace orc {
GenericValue
OrcMCJITReplacement::runFunction(Function *F,
@@ -122,4 +123,6 @@ OrcMCJITReplacement::runFunction(Functio
llvm_unreachable("Full-featured argument passing not supported yet!");
}
-}
+
+} // End namespace orc.
+} // End namespace llvm.
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Sat Feb 21 14:44:36 2015
@@ -22,6 +22,7 @@
#include "llvm/Object/Archive.h"
namespace llvm {
+namespace orc {
class OrcMCJITReplacement : public ExecutionEngine {
@@ -104,11 +105,12 @@ class OrcMCJITReplacement : public Execu
};
private:
+
static ExecutionEngine *
createOrcMCJITReplacement(std::string *ErrorMsg,
std::unique_ptr<RTDyldMemoryManager> OrcJMM,
- std::unique_ptr<llvm::TargetMachine> TM) {
- return new llvm::OrcMCJITReplacement(std::move(OrcJMM), std::move(TM));
+ std::unique_ptr<TargetMachine> TM) {
+ return new OrcMCJITReplacement(std::move(OrcJMM), std::move(TM));
}
public:
@@ -323,6 +325,8 @@ private:
std::vector<object::OwningBinary<object::Archive>> Archives;
};
-}
+
+} // End namespace orc.
+} // End namespace llvm.
#endif // LLVM_LIB_EXECUTIONENGINE_ORC_MCJITREPLACEMENT_H
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp?rev=230143&r1=230142&r2=230143&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp Sat Feb 21 14:44:36 2015
@@ -2,7 +2,7 @@
#include "llvm/ExecutionEngine/Orc/OrcTargetSupport.h"
#include <array>
-using namespace llvm;
+using namespace llvm::orc;
namespace {
@@ -47,6 +47,7 @@ uint64_t executeCompileCallback(JITCompi
}
namespace llvm {
+namespace orc {
const char* OrcX86_64::ResolverBlockName = "orc_resolver_block";
@@ -123,4 +124,5 @@ OrcX86_64::insertCompileCallbackTrampoli
return GetLabelName;
}
-}
+} // End namespace orc.
+} // End namespace llvm.
More information about the llvm-commits
mailing list