#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Host.h"
namespace llvm {
namespace orc {
JITTargetMachineBuilder::JITTargetMachineBuilder(Triple TT)
: … { … }
Expected<JITTargetMachineBuilder> JITTargetMachineBuilder::detectHost() { … }
Expected<std::unique_ptr<TargetMachine>>
JITTargetMachineBuilder::createTargetMachine() { … }
JITTargetMachineBuilder &JITTargetMachineBuilder::addFeatures(
const std::vector<std::string> &FeatureVec) { … }
#ifndef NDEBUG
void JITTargetMachineBuilderPrinter::print(raw_ostream &OS) const {
OS << Indent << "{\n"
<< Indent << " Triple = \"" << JTMB.TT.str() << "\"\n"
<< Indent << " CPU = \"" << JTMB.CPU << "\"\n"
<< Indent << " Features = \"" << JTMB.Features.getString() << "\"\n"
<< Indent << " Options = <not-printable>\n"
<< Indent << " Relocation Model = ";
if (JTMB.RM) {
switch (*JTMB.RM) {
case Reloc::Static:
OS << "Static";
break;
case Reloc::PIC_:
OS << "PIC_";
break;
case Reloc::DynamicNoPIC:
OS << "DynamicNoPIC";
break;
case Reloc::ROPI:
OS << "ROPI";
break;
case Reloc::RWPI:
OS << "RWPI";
break;
case Reloc::ROPI_RWPI:
OS << "ROPI_RWPI";
break;
}
} else
OS << "unspecified (will use target default)";
OS << "\n"
<< Indent << " Code Model = ";
if (JTMB.CM) {
switch (*JTMB.CM) {
case CodeModel::Tiny:
OS << "Tiny";
break;
case CodeModel::Small:
OS << "Small";
break;
case CodeModel::Kernel:
OS << "Kernel";
break;
case CodeModel::Medium:
OS << "Medium";
break;
case CodeModel::Large:
OS << "Large";
break;
}
} else
OS << "unspecified (will use target default)";
OS << "\n"
<< Indent << " Optimization Level = ";
switch (JTMB.OptLevel) {
case CodeGenOptLevel::None:
OS << "None";
break;
case CodeGenOptLevel::Less:
OS << "Less";
break;
case CodeGenOptLevel::Default:
OS << "Default";
break;
case CodeGenOptLevel::Aggressive:
OS << "Aggressive";
break;
}
OS << "\n" << Indent << "}\n";
}
#endif
}
}