Commit 79810753 by Jim Stichnoth

Subzero: Fix some build problems against LLVM trunk.

This allows Subzero to build through LLVM e8516587a2604386a8faaab28c410663c2ec884c. 1. Mirror an internal change to the llvm::cl implementation. 2. Something changed in llvm::format() that now requires an explicit conversion from RegNumT. BUG= none R=kschimpf@google.com Review-Url: https://codereview.chromium.org/2602713002 .
parent f8c695b3
......@@ -60,6 +60,14 @@ using llvm::cl::ParseCommandLineOptions;
using llvm::cl::Positional;
// LLVM commit 3ffe113e11168abcd809ec5ac539538ade5db0cb changed the internals of
// llvm::cl that need to be mirrored here. That commit removed the clEnumValEnd
// macro, so we can use that to determine which version of LLVM we're compiling
// against.
#if defined(clEnumValEnd)
#define CLENUMVALEND , clEnumValEnd
template <typename T> using ValuesClass = llvm::cl::ValuesClass<T>;
template <typename T, typename... A>
......@@ -67,6 +75,18 @@ ValuesClass<T> values(const char *Arg, T Val, const char *Desc, A &&... Args) {
return llvm::cl::values(Arg, Val, Desc, std::forward<A>(Args)..., nullptr);
}
#else // !defined(clEnumValEnd)
#define CLENUMVALEND
using llvm::cl::OptionEnumValue;
template <typename... A> llvm::cl::ValuesClass values(A &&... Args) {
return llvm::cl::values(std::forward<A>(Args)...);
}
#endif // !defined(clEnumValEnd)
using llvm::cl::value_desc;
} // end of namespace cl
......
......@@ -45,7 +45,7 @@ struct dev_list_flag {};
clEnumValN(Ice::Opt_m1, "O-1", "-1"), \
clEnumValN(Ice::Opt_0, "O0", "0"), \
clEnumValN(Ice::Opt_1, "O1", "1"), \
clEnumValN(Ice::Opt_2, "O2", "2"), clEnumValEnd)) \
clEnumValN(Ice::Opt_2, "O2", "2") CLENUMVALEND)) \
\
X(OutputFilename, std::string, release_opt_flag, "o", \
cl::desc("Override output filename"), cl::init("-"), \
......@@ -64,8 +64,8 @@ struct dev_list_flag {};
clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"), \
clEnumValN(Ice::Target_ARM64, "arm64", "arm64"), \
clEnumValN(Ice::Target_MIPS32, "mips", "mips32"), \
clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)"), \
clEnumValEnd)) \
clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)") \
CLENUMVALEND)) \
\
/* The following are development flags, and ideally should not appear in a \
* release build. */ \
......@@ -150,8 +150,8 @@ struct dev_list_flag {};
cl::values( \
clEnumValN(Ice::LCSE_Disabled, "0", "disabled"), \
clEnumValN(Ice::LCSE_EnabledSSA, "enabled", "assume-ssa"), \
clEnumValN(Ice::LCSE_EnabledNoSSA, "no-ssa", "no-assume-ssa"), \
clEnumValEnd)) \
clEnumValN(Ice::LCSE_EnabledNoSSA, "no-ssa", "no-assume-ssa") \
CLENUMVALEND)) \
\
X(EmitRevision, bool, dev_opt_flag, "emit-revision", \
cl::desc("Emit Subzero revision string into the output"), cl::init(true)) \
......@@ -189,8 +189,8 @@ struct dev_list_flag {};
X(InputFileFormat, llvm::NaClFileFormat, dev_opt_flag, "bitcode-format", \
cl::desc("Define format of input file:"), \
cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"), \
clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file"), \
clEnumValEnd), \
clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file") \
CLENUMVALEND), \
cl::init(llvm::LLVMFormat)) \
\
X(KeepDeletedInsts, bool, dev_opt_flag, "keep-deleted-insts", \
......@@ -226,15 +226,15 @@ struct dev_list_flag {};
clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), \
clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), \
clEnumValN(Ice::FT_Iasm, "iasm", \
"Low-level integrated assembly ('.s') file"), \
clEnumValEnd)) \
"Low-level integrated assembly ('.s') file") \
CLENUMVALEND)) \
\
X(ApplicationBinaryInterface, Ice::ABI, dev_opt_flag, "abi", \
cl::desc("ABI type"), cl::init(Ice::ABI_PNaCl), \
cl::values( \
clEnumValN(Ice::ABI_PNaCl, "pnacl", "x32 for unsandboxed 64-bit x86"), \
clEnumValN(Ice::ABI_Platform, "platform", "Native executable ABI"), \
clEnumValEnd)) \
clEnumValN(Ice::ABI_Platform, "platform", "Native executable ABI") \
CLENUMVALEND)) \
\
X(ParseParallel, bool, dev_opt_flag, "parse-parallel", \
cl::desc("Parse function blocks in parallel"), cl::init(true)) \
......@@ -248,8 +248,8 @@ struct dev_list_flag {};
clEnumValN(Ice::RPI_Randomize, "randomize", \
"Turn on immediate constants blinding"), \
clEnumValN(Ice::RPI_Pool, "pool", \
"Turn on immediate constants pooling"), \
clEnumValEnd)) \
"Turn on immediate constants pooling") \
CLENUMVALEND)) \
\
X(RandomizeAndPoolImmediatesThreshold, uint32_t, dev_opt_flag, \
"randomize-pool-threshold", \
......@@ -320,8 +320,8 @@ struct dev_list_flag {};
clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", \
"Enable ARM Neon instructions"), \
clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", \
"Enable ARM integer divide instructions in ARM mode"), \
clEnumValEnd)) \
"Enable ARM integer divide instructions in ARM mode") \
CLENUMVALEND)) \
\
X(TestPrefix, std::string, dev_opt_flag, "prefix", \
cl::desc("Prepend a prefix to symbol names for testing"), cl::init(""), \
......@@ -388,7 +388,7 @@ struct dev_list_flag {};
clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), \
clEnumValN(Ice::IceV_Most, "most", \
"Use all verbose options except 'regalloc,global_init'"), \
clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)) \
clEnumValN(Ice::IceV_None, "none", "No verbosity") CLENUMVALEND)) \
\
X(VerboseFocusOnString, std::string, dev_opt_flag, "verbose-focus", \
cl::desc("Override with -verbose=none except for specified functions"), \
......
......@@ -74,7 +74,7 @@ void dumpLiveRange(const Variable *Var, const Cfg *Func) {
Ostream &Str = Func->getContext()->getStrDump();
Str << "R=";
if (Var->hasRegTmp()) {
Str << llvm::format("%2d", Var->getRegNumTmp());
Str << llvm::format("%2d", int(Var->getRegNumTmp()));
} else {
Str << "NA";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment