forked from OSchip/llvm-project
[ORC] Print CPU feature string in JITTargetMachineBuilder debugging output.
This commit is contained in:
parent
0ab3558b25
commit
0469256d35
|
@ -32,6 +32,9 @@ namespace orc {
|
||||||
|
|
||||||
/// A utility class for building TargetMachines for JITs.
|
/// A utility class for building TargetMachines for JITs.
|
||||||
class JITTargetMachineBuilder {
|
class JITTargetMachineBuilder {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
friend class JITTargetMachineBuilderPrinter;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
/// Create a JITTargetMachineBuilder based on the given triple.
|
/// Create a JITTargetMachineBuilder based on the given triple.
|
||||||
///
|
///
|
||||||
|
@ -139,12 +142,6 @@ public:
|
||||||
/// Access Triple.
|
/// Access Triple.
|
||||||
const Triple &getTargetTriple() const { return TT; }
|
const Triple &getTargetTriple() const { return TT; }
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
/// Debug-dump a JITTargetMachineBuilder.
|
|
||||||
friend raw_ostream &operator<<(raw_ostream &OS,
|
|
||||||
const JITTargetMachineBuilder &JTMB);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Triple TT;
|
Triple TT;
|
||||||
std::string CPU;
|
std::string CPU;
|
||||||
|
@ -155,6 +152,26 @@ private:
|
||||||
CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
|
CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
class JITTargetMachineBuilderPrinter {
|
||||||
|
public:
|
||||||
|
JITTargetMachineBuilderPrinter(JITTargetMachineBuilder &JTMB,
|
||||||
|
StringRef Indent)
|
||||||
|
: JTMB(JTMB), Indent(Indent) {}
|
||||||
|
void print(raw_ostream &OS) const;
|
||||||
|
|
||||||
|
friend raw_ostream &operator<<(raw_ostream &OS,
|
||||||
|
const JITTargetMachineBuilderPrinter &JTMBP) {
|
||||||
|
JTMBP.print(OS);
|
||||||
|
return OS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
JITTargetMachineBuilder &JTMB;
|
||||||
|
StringRef Indent;
|
||||||
|
};
|
||||||
|
#endif // NDEBUG
|
||||||
|
|
||||||
} // end namespace orc
|
} // end namespace orc
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,13 @@ JITTargetMachineBuilder &JITTargetMachineBuilder::addFeatures(
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
raw_ostream &operator<<(raw_ostream &OS, const JITTargetMachineBuilder &JTMB) {
|
void JITTargetMachineBuilderPrinter::print(raw_ostream &OS) const {
|
||||||
OS << "{ Triple = \"" << JTMB.TT.str() << "\", CPU = \"" << JTMB.CPU
|
OS << Indent << "{\n"
|
||||||
<< "\", Options = <not-printable>, Relocation Model = ";
|
<< 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) {
|
if (JTMB.RM) {
|
||||||
switch (*JTMB.RM) {
|
switch (*JTMB.RM) {
|
||||||
|
@ -91,9 +95,10 @@ raw_ostream &operator<<(raw_ostream &OS, const JITTargetMachineBuilder &JTMB) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OS << "unspecified";
|
OS << "unspecified (will use target default)";
|
||||||
|
|
||||||
OS << ", Code Model = ";
|
OS << "\n"
|
||||||
|
<< Indent << " Code Model = ";
|
||||||
|
|
||||||
if (JTMB.CM) {
|
if (JTMB.CM) {
|
||||||
switch (*JTMB.CM) {
|
switch (*JTMB.CM) {
|
||||||
|
@ -114,9 +119,10 @@ raw_ostream &operator<<(raw_ostream &OS, const JITTargetMachineBuilder &JTMB) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OS << "unspecified";
|
OS << "unspecified (will use target default)";
|
||||||
|
|
||||||
OS << ", Optimization Level = ";
|
OS << "\n"
|
||||||
|
<< Indent << " Optimization Level = ";
|
||||||
switch (JTMB.OptLevel) {
|
switch (JTMB.OptLevel) {
|
||||||
case CodeGenOpt::None:
|
case CodeGenOpt::None:
|
||||||
OS << "None";
|
OS << "None";
|
||||||
|
@ -132,8 +138,7 @@ raw_ostream &operator<<(raw_ostream &OS, const JITTargetMachineBuilder &JTMB) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " }";
|
OS << "\n" << Indent << "}\n";
|
||||||
return OS;
|
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
|
|
||||||
|
|
|
@ -922,7 +922,8 @@ Error LLJITBuilderState::prepareForConstruction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
dbgs() << " JITTargetMachineBuilder is " << JTMB << "\n"
|
dbgs() << " JITTargetMachineBuilder is "
|
||||||
|
<< JITTargetMachineBuilderPrinter(*JTMB, " ")
|
||||||
<< " Pre-constructed ExecutionSession: " << (ES ? "Yes" : "No")
|
<< " Pre-constructed ExecutionSession: " << (ES ? "Yes" : "No")
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " DataLayout: ";
|
<< " DataLayout: ";
|
||||||
|
|
Loading…
Reference in New Issue