OSDN Git Service

[ORC] Add support for emulated TLS to ORCv2.
authorLang Hames <lhames@gmail.com>
Wed, 22 Jan 2020 00:28:30 +0000 (16:28 -0800)
committerLang Hames <lhames@gmail.com>
Wed, 22 Jan 2020 03:55:33 +0000 (19:55 -0800)
commitce2207abaf9a925b35f15ef92aaff6b301ba6d22
tree712c801de52846de1579d5df6091822891a91aa5
parentdac7cda3a84e5405f7dd915f09c336d20dfdf00d
[ORC] Add support for emulated TLS to ORCv2.

This commit adds a ManglingOptions struct to IRMaterializationUnit, and replaces
IRCompileLayer::CompileFunction with a new IRCompileLayer::IRCompiler class. The
ManglingOptions struct defines the emulated-TLS state (via a bool member,
EmulatedTLS, which is true if emulated-TLS is enabled and false otherwise). The
IRCompileLayer::IRCompiler class wraps an IRCompiler (the same way that the
CompileFunction typedef used to), but adds a method to return the
IRCompileLayer::ManglingOptions that the compiler will use.

These changes allow us to correctly determine the symbols that will be produced
when a thread local global variable defined at the IR level is compiled with or
without emulated TLS. This is required for ORCv2, where MaterializationUnits
must declare their interface up-front.

Most ORCv2 clients should not require any changes. Clients writing custom IR
compilers will need to wrap their compiler in an IRCompileLayer::IRCompiler,
rather than an IRCompileLayer::CompileFunction, however this should be a
straightforward change (see modifications to CompileUtils.* in this patch for an
example).
18 files changed:
llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h
llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/include/llvm/ExecutionEngine/Orc/Layer.h
llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp
llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/ExecutionEngine/Orc/Layer.cpp
llvm/test/ExecutionEngine/OrcLazy/emulated-tls.ll [new file with mode: 0644]
llvm/tools/lli/lli.cpp
llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp
llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp