mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[ORC] Add a method to JITTargetMachineBuilder to get the default data layout
for the target machine. This simplifies usage during setup of concurrent JIT stacks where the client needs a DataLayout, but not a TargetMachine (TargetMachines are created on the fly by the compile threads later). llvm-svn: 343429
This commit is contained in:
parent
d2f24433be
commit
5ecad6afdc
@ -56,6 +56,18 @@ public:
|
||||
/// also be registered.
|
||||
Expected<std::unique_ptr<TargetMachine>> createTargetMachine();
|
||||
|
||||
/// Get the default DataLayout for the target.
|
||||
///
|
||||
/// Note: This is reasonably expensive, as it creates a temporary
|
||||
/// TargetMachine instance under the hood. It is only suitable for use during
|
||||
/// JIT setup.
|
||||
Expected<DataLayout> getDefaultDataLayoutForTarget() {
|
||||
auto TM = createTargetMachine();
|
||||
if (!TM)
|
||||
return TM.takeError();
|
||||
return (*TM)->createDataLayout();
|
||||
}
|
||||
|
||||
/// Set the CPU string.
|
||||
JITTargetMachineBuilder &setCPU(std::string CPU) {
|
||||
this->CPU = std::move(CPU);
|
||||
|
@ -786,12 +786,7 @@ int runOrcLazyJIT(const char *ProgName) {
|
||||
? Optional<CodeModel::Model>(CMModel)
|
||||
: None);
|
||||
|
||||
DataLayout DL("");
|
||||
{
|
||||
// Create a throwaway TargetMachine to get the data layout.
|
||||
auto TM = ExitOnErr(JTMB.createTargetMachine());
|
||||
DL = TM->createDataLayout();
|
||||
}
|
||||
DataLayout DL = ExitOnErr(JTMB.getDefaultDataLayoutForTarget());
|
||||
auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(JTMB), DL, LazyJITCompileThreads));
|
||||
|
||||
if (PerModuleLazy)
|
||||
|
Loading…
Reference in New Issue
Block a user