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; ...@@ -60,6 +60,14 @@ using llvm::cl::ParseCommandLineOptions;
using llvm::cl::Positional; 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> using ValuesClass = llvm::cl::ValuesClass<T>;
template <typename T, typename... A> template <typename T, typename... A>
...@@ -67,6 +75,18 @@ ValuesClass<T> values(const char *Arg, T Val, const char *Desc, A &&... Args) { ...@@ -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); 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; using llvm::cl::value_desc;
} // end of namespace cl } // end of namespace cl
......
...@@ -45,7 +45,7 @@ struct dev_list_flag {}; ...@@ -45,7 +45,7 @@ struct dev_list_flag {};
clEnumValN(Ice::Opt_m1, "O-1", "-1"), \ clEnumValN(Ice::Opt_m1, "O-1", "-1"), \
clEnumValN(Ice::Opt_0, "O0", "0"), \ clEnumValN(Ice::Opt_0, "O0", "0"), \
clEnumValN(Ice::Opt_1, "O1", "1"), \ 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", \ X(OutputFilename, std::string, release_opt_flag, "o", \
cl::desc("Override output filename"), cl::init("-"), \ cl::desc("Override output filename"), cl::init("-"), \
...@@ -64,8 +64,8 @@ struct dev_list_flag {}; ...@@ -64,8 +64,8 @@ struct dev_list_flag {};
clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"), \ clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"), \
clEnumValN(Ice::Target_ARM64, "arm64", "arm64"), \ clEnumValN(Ice::Target_ARM64, "arm64", "arm64"), \
clEnumValN(Ice::Target_MIPS32, "mips", "mips32"), \ clEnumValN(Ice::Target_MIPS32, "mips", "mips32"), \
clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)"), \ clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
/* The following are development flags, and ideally should not appear in a \ /* The following are development flags, and ideally should not appear in a \
* release build. */ \ * release build. */ \
...@@ -150,8 +150,8 @@ struct dev_list_flag {}; ...@@ -150,8 +150,8 @@ struct dev_list_flag {};
cl::values( \ cl::values( \
clEnumValN(Ice::LCSE_Disabled, "0", "disabled"), \ clEnumValN(Ice::LCSE_Disabled, "0", "disabled"), \
clEnumValN(Ice::LCSE_EnabledSSA, "enabled", "assume-ssa"), \ clEnumValN(Ice::LCSE_EnabledSSA, "enabled", "assume-ssa"), \
clEnumValN(Ice::LCSE_EnabledNoSSA, "no-ssa", "no-assume-ssa"), \ clEnumValN(Ice::LCSE_EnabledNoSSA, "no-ssa", "no-assume-ssa") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
X(EmitRevision, bool, dev_opt_flag, "emit-revision", \ X(EmitRevision, bool, dev_opt_flag, "emit-revision", \
cl::desc("Emit Subzero revision string into the output"), cl::init(true)) \ cl::desc("Emit Subzero revision string into the output"), cl::init(true)) \
...@@ -189,8 +189,8 @@ struct dev_list_flag {}; ...@@ -189,8 +189,8 @@ struct dev_list_flag {};
X(InputFileFormat, llvm::NaClFileFormat, dev_opt_flag, "bitcode-format", \ X(InputFileFormat, llvm::NaClFileFormat, dev_opt_flag, "bitcode-format", \
cl::desc("Define format of input file:"), \ cl::desc("Define format of input file:"), \
cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"), \ cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"), \
clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file"), \ clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file") \
clEnumValEnd), \ CLENUMVALEND), \
cl::init(llvm::LLVMFormat)) \ cl::init(llvm::LLVMFormat)) \
\ \
X(KeepDeletedInsts, bool, dev_opt_flag, "keep-deleted-insts", \ X(KeepDeletedInsts, bool, dev_opt_flag, "keep-deleted-insts", \
...@@ -226,15 +226,15 @@ struct dev_list_flag {}; ...@@ -226,15 +226,15 @@ struct dev_list_flag {};
clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), \ clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), \
clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), \ clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), \
clEnumValN(Ice::FT_Iasm, "iasm", \ clEnumValN(Ice::FT_Iasm, "iasm", \
"Low-level integrated assembly ('.s') file"), \ "Low-level integrated assembly ('.s') file") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
X(ApplicationBinaryInterface, Ice::ABI, dev_opt_flag, "abi", \ X(ApplicationBinaryInterface, Ice::ABI, dev_opt_flag, "abi", \
cl::desc("ABI type"), cl::init(Ice::ABI_PNaCl), \ cl::desc("ABI type"), cl::init(Ice::ABI_PNaCl), \
cl::values( \ cl::values( \
clEnumValN(Ice::ABI_PNaCl, "pnacl", "x32 for unsandboxed 64-bit x86"), \ clEnumValN(Ice::ABI_PNaCl, "pnacl", "x32 for unsandboxed 64-bit x86"), \
clEnumValN(Ice::ABI_Platform, "platform", "Native executable ABI"), \ clEnumValN(Ice::ABI_Platform, "platform", "Native executable ABI") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
X(ParseParallel, bool, dev_opt_flag, "parse-parallel", \ X(ParseParallel, bool, dev_opt_flag, "parse-parallel", \
cl::desc("Parse function blocks in parallel"), cl::init(true)) \ cl::desc("Parse function blocks in parallel"), cl::init(true)) \
...@@ -248,8 +248,8 @@ struct dev_list_flag {}; ...@@ -248,8 +248,8 @@ struct dev_list_flag {};
clEnumValN(Ice::RPI_Randomize, "randomize", \ clEnumValN(Ice::RPI_Randomize, "randomize", \
"Turn on immediate constants blinding"), \ "Turn on immediate constants blinding"), \
clEnumValN(Ice::RPI_Pool, "pool", \ clEnumValN(Ice::RPI_Pool, "pool", \
"Turn on immediate constants pooling"), \ "Turn on immediate constants pooling") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
X(RandomizeAndPoolImmediatesThreshold, uint32_t, dev_opt_flag, \ X(RandomizeAndPoolImmediatesThreshold, uint32_t, dev_opt_flag, \
"randomize-pool-threshold", \ "randomize-pool-threshold", \
...@@ -320,8 +320,8 @@ struct dev_list_flag {}; ...@@ -320,8 +320,8 @@ struct dev_list_flag {};
clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", \ clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", \
"Enable ARM Neon instructions"), \ "Enable ARM Neon instructions"), \
clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", \ clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", \
"Enable ARM integer divide instructions in ARM mode"), \ "Enable ARM integer divide instructions in ARM mode") \
clEnumValEnd)) \ CLENUMVALEND)) \
\ \
X(TestPrefix, std::string, dev_opt_flag, "prefix", \ X(TestPrefix, std::string, dev_opt_flag, "prefix", \
cl::desc("Prepend a prefix to symbol names for testing"), cl::init(""), \ cl::desc("Prepend a prefix to symbol names for testing"), cl::init(""), \
...@@ -388,7 +388,7 @@ struct dev_list_flag {}; ...@@ -388,7 +388,7 @@ struct dev_list_flag {};
clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), \ clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), \
clEnumValN(Ice::IceV_Most, "most", \ clEnumValN(Ice::IceV_Most, "most", \
"Use all verbose options except 'regalloc,global_init'"), \ "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", \ X(VerboseFocusOnString, std::string, dev_opt_flag, "verbose-focus", \
cl::desc("Override with -verbose=none except for specified functions"), \ cl::desc("Override with -verbose=none except for specified functions"), \
......
...@@ -74,7 +74,7 @@ void dumpLiveRange(const Variable *Var, const Cfg *Func) { ...@@ -74,7 +74,7 @@ void dumpLiveRange(const Variable *Var, const Cfg *Func) {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
Str << "R="; Str << "R=";
if (Var->hasRegTmp()) { if (Var->hasRegTmp()) {
Str << llvm::format("%2d", Var->getRegNumTmp()); Str << llvm::format("%2d", int(Var->getRegNumTmp()));
} else { } else {
Str << "NA"; 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