Commit c5bc5cb3 by John Porto

Subzero. Flags refactoring.

BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1803403002 .
parent 4c16ac0f
......@@ -166,14 +166,13 @@ void BrowserCompileServer::getParsedFlags(uint32_t NumThreads, int argc,
char **argv) {
ClFlags::parseFlags(argc, argv);
ClFlags::getParsedClFlags(*Flags);
ClFlags::getParsedClFlagsExtra(*ExtraFlags);
// Set some defaults which aren't specified via the argv string.
Flags->setNumTranslationThreads(NumThreads);
Flags->setUseSandboxing(true);
Flags->setOutFileType(FT_Elf);
Flags->setTargetArch(getTargetArch());
ExtraFlags->setBuildOnRead(true);
ExtraFlags->setInputFileFormat(llvm::PNaClFormat);
Flags->setBuildOnRead(true);
Flags->setInputFileFormat(llvm::PNaClFormat);
}
bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) {
......@@ -220,7 +219,7 @@ void BrowserCompileServer::startCompileThread(int ObjFD) {
CompileThread = std::thread([this]() {
llvm::install_fatal_error_handler(fatalErrorHandler, this);
Ctx->initParserThread();
this->getCompiler().run(*ExtraFlags, *Ctx.get(),
this->getCompiler().run(*Flags, *Ctx.get(),
// Retain original reference, but the compiler
// (LLVM's MemoryObject) wants to handle deletion.
std::unique_ptr<llvm::DataStreamer>(InputStream));
......
......@@ -16,7 +16,6 @@
#define SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceCompileServer.h"
#include "IceDefs.h"
#include "IceELFStreamer.h"
......@@ -42,9 +41,7 @@ class BrowserCompileServer : public CompileServer {
class StringStream;
public:
BrowserCompileServer()
: Flags(&GlobalContext::Flags), ExtraFlags(&GlobalContext::ExtraFlags),
HadError(false) {}
BrowserCompileServer() : Flags(&GlobalContext::Flags), HadError(false) {}
~BrowserCompileServer() final;
......@@ -105,7 +102,6 @@ private:
std::unique_ptr<StringStream> ErrorStream;
std::unique_ptr<ELFStreamer> ELFStream;
ClFlags *Flags;
ClFlagsExtra *ExtraFlags;
std::thread CompileThread;
std::atomic<bool> HadError;
};
......
......@@ -441,7 +441,7 @@ void getRandomPostOrder(CfgNode *Node, BitVector &ToVisit,
} // end of anonymous namespace
void Cfg::shuffleNodes() {
if (!Ctx->getFlags().shouldReorderBasicBlocks())
if (!Ctx->getFlags().getReorderBasicBlocks())
return;
NodeList ReversedReachable;
......@@ -764,7 +764,7 @@ void Cfg::doAddressOpt() {
}
void Cfg::doNopInsertion() {
if (!Ctx->getFlags().shouldDoNopInsertion())
if (!Ctx->getFlags().getShouldDoNopInsertion())
return;
TimerMarker T(TimerStack::TT_doNopInsertion, this);
RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(), RPE_NopInsertion,
......
......@@ -17,7 +17,7 @@
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceClFlags.def"
#ifdef __clang__
#pragma clang diagnostic push
......@@ -30,576 +30,167 @@
#pragma clang diagnostic pop
#endif // __clang__
namespace cl = llvm::cl;
/// Options which are captured in Ice::ClFlags and propagated.
#include <utility>
namespace {
// cl is used to alias the llvm::cl types and functions that we need.
namespace cl {
using alias = llvm::cl::alias;
using aliasopt = llvm::cl::aliasopt;
using llvm::cl::CommaSeparated;
using desc = llvm::cl::desc;
template <typename T> using initializer = llvm::cl::initializer<T>;
template <typename T> initializer<T> init(const T &Val) {
return initializer<T>(Val);
}
template <typename T> using list = llvm::cl::list<T>;
using llvm::cl::NotHidden;
template <typename T> using opt = llvm::cl::opt<T>;
using llvm::cl::ParseCommandLineOptions;
using llvm::cl::Positional;
template <typename T> using ValuesClass = llvm::cl::ValuesClass<T>;
template <typename T, typename... A>
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);
}
using llvm::cl::value_desc;
} // end of namespace cl
// cl_type_traits is used to convert between a tuple of <T, cl_detail::*flag> to
// the appropriate (llvm::)cl object.
template <typename B, typename CL> struct cl_type_traits {};
template <typename T>
struct cl_type_traits<T, ::Ice::cl_detail::dev_list_flag> {
using cl_type = cl::list<T>;
};
template <typename T> struct cl_type_traits<T, ::Ice::cl_detail::dev_opt_flag> {
using cl_type = cl::opt<T>;
};
template <typename T>
struct cl_type_traits<T, ::Ice::cl_detail::release_opt_flag> {
using cl_type = cl::opt<T>;
};
/// Allow error recovery when reading PNaCl bitcode.
cl::opt<bool> AllowErrorRecovery(
"allow-pnacl-reader-error-recovery",
cl::desc("Allow error recovery when reading PNaCl bitcode."),
cl::init(false));
/// Allow global symbols to be externally defined (other than _start and
/// __pnacl_pso_root).
cl::opt<bool> AllowExternDefinedSymbols(
"allow-externally-defined-symbols",
cl::desc("Allow global symbols to be externally defined (other than _start "
"and __pnacl_pso_root)."),
cl::init(false));
/// Alias for --allow-externally-defined-symbols.
#define X(Name, Type, ClType, ...) \
cl_type_traits<Type, Ice::cl_detail::ClType>::cl_type Name##Obj(__VA_ARGS__);
COMMAND_LINE_FLAGS
#undef X
// Add declarations that do not need to add members to ClFlags below.
cl::alias AllowExternDefinedSymbolsA(
"allow-extern", cl::desc("Alias for --allow-externally-defined-symbols"),
cl::NotHidden, cl::aliasopt(AllowExternDefinedSymbols));
/// Allow IACA (Intel Architecture Code Analyzer) marks to be inserted. These
/// binaries are not executable.
cl::opt<bool> AllowIacaMarks(
"allow-iaca-marks",
cl::desc("Allow IACA (Intel Architecture Code Analyzer) marks to be "
"inserted. These binaries are not executable."),
cl::init(false));
/// Allow global variables to be uninitialized. This is currently needed by the
/// cross tests.
cl::opt<bool> AllowUninitializedGlobals(
"allow-uninitialized-globals",
cl::desc("Allow global variables to be uninitialized"));
/// Emit (global) data into separate sections.
cl::opt<bool>
DataSections("fdata-sections",
cl::desc("Emit (global) data into separate sections"));
/// Decorate textual asm output with register liveness info.
cl::opt<bool> DecorateAsm(
"asm-verbose",
cl::desc("Decorate textual asm output with register liveness info"));
/// Define default function prefix for naming unnamed functions.
cl::opt<std::string>
DefaultFunctionPrefix("default-function-prefix",
cl::desc("Define default function prefix for naming "
"unnamed functions"),
cl::init(Ice::BuildDefs::dump() ? "Function" : "F"));
/// Define default global prefix for naming unnamed globals.
cl::opt<std::string>
DefaultGlobalPrefix("default-global-prefix",
cl::desc("Define default global prefix for naming "
"unnamed globals"),
cl::init(Ice::BuildDefs::dump() ? "Global" : "G"));
/// Disable hybrid assembly when -filetype=iasm.
cl::opt<bool> DisableHybridAssembly(
"no-hybrid-asm", cl::desc("Disable hybrid assembly when -filetype=iasm"),
cl::init(false));
/// Externalize all symbols.
cl::opt<bool> DisableInternal("externalize",
cl::desc("Externalize all symbols"));
/// Disable Subzero translation.
cl::opt<bool> DisableTranslation("notranslate",
cl::desc("Disable Subzero translation"));
/// Print statistics after translating each function.
cl::opt<bool>
DumpStats("szstats",
cl::desc("Print statistics after translating each function"));
// TODO(stichnot): The implementation of block profiling introduces some
// oddities to be aware of. First, empty basic blocks that don't normally
// appear in the asm output, may be profiled anyway, so one might see profile
// counts for blocks not in the original asm output. Second, edge-split nodes
// for advanced phi lowering are added too late, at which point it is not
// practical to add profiling.
/// Instrument basic blocks, and output profiling information to stdout at the
/// end of program execution.
cl::opt<bool> EnableBlockProfile(
"enable-block-profile",
cl::desc("Instrument basic blocks, and output profiling "
"information to stdout at the end of program execution."),
cl::init(false));
/// Force optimization of memory intrinsics.
cl::opt<bool>
ForceMemIntrinOpt("fmem-intrin-opt",
cl::desc("Force optimization of memory intrinsics."));
/// Emit functions into separate sections.
cl::opt<bool>
FunctionSections("ffunction-sections",
cl::desc("Emit functions into separate sections"));
/// Retain deleted instructions in the Cfg. Defaults to true in DUMP-enabled
/// build, and false in a non-DUMP build, but is ignored in a MINIMAL build.
/// This flag allows overriding the default primarily for debugging.
cl::opt<bool>
KeepDeletedInsts("keep-deleted-insts",
cl::desc("Retain deleted instructions in the Cfg"),
cl::init(Ice::BuildDefs::dump()));
/// Mock bounds checking on loads/stores.
cl::opt<bool> MockBoundsCheck("mock-bounds-check",
cl::desc("Mock bounds checking on loads/stores"));
/// Number of translation threads (in addition to the parser thread and the
/// emitter thread). The special case of 0 means purely sequential, i.e. parser,
/// translator, and emitter all within the same single thread. (This may need a
/// slight rework if we expand to multiple parser or emitter threads.)
cl::opt<uint32_t> NumThreads(
"threads",
cl::desc("Number of translation threads (0 for purely sequential)"),
// TODO(stichnot): Settle on a good default. Consider something related to
// std::thread::hardware_concurrency().
cl::init(2));
/// Optimization level Om1, O-1, O0, O0, O1, O2.
cl::opt<Ice::OptLevel> OLevel(cl::desc("Optimization level"),
cl::init(Ice::Opt_m1), cl::value_desc("level"),
cl::values(clEnumValN(Ice::Opt_m1, "Om1", "-1"),
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));
/// Enable edge splitting for Phi lowering.
cl::opt<bool>
EnablePhiEdgeSplit("phi-edge-split",
cl::desc("Enable edge splitting for Phi lowering"),
cl::init(true));
/// TODO(stichnot): See if we can easily use LLVM's -rng-seed option and
/// implementation. I expect the implementation is different and therefore the
/// tests would need to be changed.
cl::opt<unsigned long long>
RandomSeed("sz-seed", cl::desc("Seed the random number generator"),
cl::init(1));
/// Randomly insert NOPs.
cl::opt<bool> ShouldDoNopInsertion("nop-insertion",
cl::desc("Randomly insert NOPs"),
cl::init(false));
/// Randomize register allocation.
cl::opt<bool>
RandomizeRegisterAllocation("randomize-regalloc",
cl::desc("Randomize register allocation"),
cl::init(false));
/// Allow failsafe access to registers that were restricted via -reg-use or
/// -reg-exclude.
cl::opt<bool>
RegAllocReserve("reg-reserve",
cl::desc("Let register allocation use reserve registers"),
cl::init(false));
/// Repeat register allocation until convergence.
cl::opt<bool>
RepeatRegAlloc("regalloc-repeat",
cl::desc("Repeat register allocation until convergence"),
cl::init(true));
/// Skip through unimplemented lowering code instead of aborting.
cl::opt<bool> SkipUnimplemented(
"skip-unimplemented",
cl::desc("Skip through unimplemented lowering code instead of aborting."),
cl::init(false));
/// Enable breakdown timing of Subzero translation.
cl::opt<bool> SubzeroTimingEnabled(
"timing", cl::desc("Enable breakdown timing of Subzero translation"));
/// Target architecture.
cl::opt<Ice::TargetArch> TargetArch(
"target", cl::desc("Target architecture:"), cl::init(Ice::Target_X8632),
cl::values(
clEnumValN(Ice::Target_X8632, "x8632", "x86-32"),
clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"),
clEnumValN(Ice::Target_X8632, "x86_32", "x86-32 (same as x8632)"),
clEnumValN(Ice::Target_X8664, "x8664", "x86-64"),
clEnumValN(Ice::Target_X8664, "x86-64", "x86-64 (same as x8664)"),
clEnumValN(Ice::Target_X8664, "x86_64", "x86-64 (same as x8664)"),
clEnumValN(Ice::Target_ARM32, "arm", "arm32"),
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));
/// Extra amount of stack to add to the frame in bytes (for testing).
cl::opt<uint32_t> TestStackExtra(
"test-stack-extra",
cl::desc(
"Extra amount of stack to add to the frame in bytes (for testing)."),
cl::init(0));
/// Target architecture attributes.
cl::opt<Ice::TargetInstructionSet> TargetInstructionSet(
"mattr", cl::desc("Target architecture attributes"),
cl::init(Ice::BaseInstructionSet),
cl::values(clEnumValN(Ice::BaseInstructionSet, "base",
"Target chooses baseline instruction set (default)"),
clEnumValN(Ice::X86InstructionSet_SSE2, "sse2",
"Enable X86 SSE2 instructions"),
clEnumValN(Ice::X86InstructionSet_SSE4_1, "sse4.1",
"Enable X86 SSE 4.1 instructions"),
clEnumValN(Ice::ARM32InstructionSet_Neon, "neon",
"Enable ARM Neon instructions"),
clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm",
"Enable ARM integer divide instructions in ARM mode"),
clEnumValEnd));
/// Prepend a prefix to symbol names for testing.
cl::opt<std::string>
TestPrefix("prefix",
cl::desc("Prepend a prefix to symbol names for testing"),
cl::init(""), cl::value_desc("prefix"));
/// Print total translation time for each function.
cl::opt<bool> TimeEachFunction(
"timing-funcs", cl::desc("Print total translation time for each function"));
/// Break down timing for a specific function (use '*' for all).
cl::opt<std::string> TimingFocusOn(
"timing-focus",
cl::desc("Break down timing for a specific function (use '*' for all)"),
cl::init(""));
/// Translate only the given function.
cl::opt<std::string>
TranslateOnly("translate-only",
cl::desc("Translate only the given function"), cl::init(""));
/// Enable Non-SFI mode.
cl::opt<bool> UseNonsfi("nonsfi", cl::desc("Enable Non-SFI mode"));
/// Use sandboxing.
cl::opt<bool> UseSandboxing("sandbox", cl::desc("Use sandboxing"));
/// Override with -verbose=none except for the specified function.
cl::opt<std::string> VerboseFocusOn(
"verbose-focus",
cl::desc("Override with -verbose=none except for the specified function"),
cl::init(""));
/// Output file type.
cl::opt<Ice::FileType> OutFileType(
"filetype", cl::desc("Output file type"), cl::init(Ice::FT_Iasm),
cl::values(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));
/// Max number of nops to insert per instruction.
cl::opt<int> MaxNopsPerInstruction(
"max-nops-per-instruction",
cl::desc("Max number of nops to insert per instruction"), cl::init(1));
/// Nop insertion probability as percentage.
cl::opt<int> NopProbabilityAsPercentage(
"nop-insertion-percentage",
cl::desc("Nop insertion probability as percentage"), cl::init(10));
/// Restricts registers in corresponding register classes to specified list.
cl::list<std::string> UseRestrictedRegisters(
"reg-use", cl::CommaSeparated,
cl::desc(
"Only use specified registers for corresponding register classes"));
/// List of excluded registers.
cl::list<std::string>
ExcludedRegisters("reg-exclude", cl::CommaSeparated,
cl::desc("Don't use specified registers"));
/// Verbose options (can be comma-separated).
cl::list<Ice::VerboseItem> VerboseList(
"verbose", cl::CommaSeparated,
cl::desc("Verbose options (can be comma-separated):"),
cl::values(
clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"),
clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"),
clEnumValN(Ice::IceV_InstNumbers, "instnum",
"Print instruction numbers"),
clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"),
clEnumValN(Ice::IceV_Succs, "succ", "Show successors"),
clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"),
clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"),
clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"),
clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"),
clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"),
clEnumValN(Ice::IceV_Random, "random", "Randomization details"),
clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"),
clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"),
clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"),
clEnumValN(Ice::IceV_Mem, "mem", "Memory usage details"),
clEnumValN(Ice::IceV_Status, "status",
"Print the name of the function being translated"),
clEnumValN(Ice::IceV_AvailableRegs, "registers",
"Show available registers for register allocation"),
clEnumValN(Ice::IceV_GlobalInit, "global_init", "Global initializers"),
clEnumValN(Ice::IceV_ConstPoolStats, "cpool", "Constant pool counters"),
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));
// Options not captured in Ice::ClFlags and propagated.
/// Exit with success status, even if errors found.
cl::opt<bool> AlwaysExitSuccess(
"exit-success", cl::desc("Exit with success status, even if errors found"),
cl::init(false));
/// Note: While this flag isn't used in the minimal build, we keep this flag so
/// that tests can set this command-line flag without concern to the type of
/// build. We double check this flag at runtime to make sure the
/// consistency is maintained.
cl::opt<bool>
BuildOnRead("build-on-read",
cl::desc("Build ICE instructions when reading bitcode"),
cl::init(true));
/// Define format of input file.
cl::opt<llvm::NaClFileFormat> InputFileFormat(
"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),
cl::init(llvm::LLVMFormat));
/// Generate list of build attributes associated with this executable.
cl::opt<bool> GenerateBuildAtts(
"build-atts", cl::desc("Generate list of build attributes associated with "
"this executable."),
cl::init(false));
/// <Input file>
cl::opt<std::string> IRFilename(cl::Positional, cl::desc("<IR file>"),
cl::init("-"));
/// Set log filename.
cl::opt<std::string> LogFilename("log", cl::desc("Set log filename"),
cl::init("-"), cl::value_desc("filename"));
/// Print out more descriptive PNaCl bitcode parse errors when building LLVM
/// IR first.
cl::opt<bool> LLVMVerboseErrors(
"verbose-llvm-parse-errors",
cl::desc("Print out more descriptive PNaCl bitcode parse errors when "
"building LLVM IR first"),
cl::init(false));
cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"),
cl::init("-"), cl::value_desc("filename"));
Ice::IceString AppName;
/// Define the command line options for immediates pooling and randomization.
cl::opt<Ice::RandomizeAndPoolImmediatesEnum> RandomizeAndPoolImmediatesOption(
"randomize-pool-immediates",
cl::desc("Randomize or pooling the representation of immediates"),
cl::init(Ice::RPI_None),
cl::values(clEnumValN(Ice::RPI_None, "none",
"Do not randomize or pooling immediates (default)"),
clEnumValN(Ice::RPI_Randomize, "randomize",
"Turn on immediate constants blinding"),
clEnumValN(Ice::RPI_Pool, "pool",
"Turn on immediate constants pooling"),
clEnumValEnd));
/// Command line option for x86 immediate integer randomization/pooling
/// threshold. Immediates whose representation are between:
/// -RandomizeAndPoolImmediatesThreshold/2 and
/// +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled.
cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold(
"randomize-pool-threshold",
cl::desc("The threshold for immediates randomization and pooling"),
cl::init(0xffff));
/// Shuffle the layout of basic blocks in each functions.
cl::opt<bool> ReorderBasicBlocks(
"reorder-basic-blocks",
cl::desc("Shuffle the layout of basic blocks in each function"),
cl::init(false));
/// Randomize function ordering.
cl::opt<bool> ReorderFunctions("reorder-functions",
cl::desc("Randomize function ordering"),
cl::init(false));
/// The shuffling window size for function reordering. 1 or 0 means no effective
/// shuffling. The default size is 8.
cl::opt<uint32_t> ReorderFunctionsWindowSize(
"reorder-functions-window-size",
cl::desc("The shuffling window size for function reordering. 1 or 0 means "
"no effective shuffling."),
cl::init(8));
/// Randomize global data ordering.
cl::opt<bool> ReorderGlobalVariables("reorder-global-variables",
cl::desc("Randomize global data ordering"),
cl::init(false));
/// Randomize constant pool entry ordering.
cl::opt<bool>
ReorderPooledConstants("reorder-pooled-constants",
cl::desc("Randomize constant pool entry ordering"),
cl::init(false));
/// Command line option for accepting textual bitcode.
cl::opt<bool> BitcodeAsText(
"bitcode-as-text",
cl::desc(
"Accept textual form of PNaCl bitcode records (i.e. not .ll assembly)"),
cl::init(false));
cl::NotHidden, cl::aliasopt(AllowExternDefinedSymbolsObj));
std::string AppNameObj;
} // end of anonymous namespace
namespace Ice {
void ClFlags::parseFlags(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv);
AppName = IceString(argv[0]);
AppNameObj = IceString(argv[0]);
}
void ClFlags::resetClFlags(ClFlags &OutFlags) {
// bool fields
OutFlags.AllowErrorRecovery = false;
OutFlags.AllowExternDefinedSymbols = false;
OutFlags.AllowIacaMarks = false;
OutFlags.AllowUninitializedGlobals = false;
OutFlags.DataSections = false;
OutFlags.DecorateAsm = false;
OutFlags.DisableHybridAssembly = false;
OutFlags.DisableInternal = false;
OutFlags.DisableTranslation = false;
OutFlags.DumpStats = false;
OutFlags.EnableBlockProfile = false;
OutFlags.ForceMemIntrinOpt = false;
OutFlags.FunctionSections = false;
OutFlags.GenerateUnitTestMessages = false;
OutFlags.KeepDeletedInsts = Ice::BuildDefs::dump();
OutFlags.MockBoundsCheck = false;
OutFlags.PhiEdgeSplit = false;
OutFlags.RandomNopInsertion = false;
OutFlags.RandomRegAlloc = false;
OutFlags.RepeatRegAlloc = false;
OutFlags.ReorderBasicBlocks = false;
OutFlags.ReorderFunctions = false;
OutFlags.ReorderGlobalVariables = false;
OutFlags.ReorderPooledConstants = false;
OutFlags.SkipUnimplemented = false;
OutFlags.SubzeroTimingEnabled = false;
OutFlags.TimeEachFunction = false;
OutFlags.UseNonsfi = false;
OutFlags.UseSandboxing = false;
// Enum and integer fields.
OutFlags.Opt = Opt_m1;
OutFlags.OutFileType = FT_Iasm;
OutFlags.RandomMaxNopsPerInstruction = 0;
OutFlags.RandomNopProbabilityAsPercentage = 0;
OutFlags.RandomizeAndPoolImmediatesOption = RPI_None;
OutFlags.RandomizeAndPoolImmediatesThreshold = 0xffff;
OutFlags.ReorderFunctionsWindowSize = 8;
OutFlags.TArch = TargetArch_NUM;
OutFlags.TestStackExtra = 0;
OutFlags.VMask = IceV_None;
// IceString fields.
OutFlags.DefaultFunctionPrefix = "";
OutFlags.DefaultGlobalPrefix = "";
OutFlags.TestPrefix = "";
OutFlags.TimingFocusOn = "";
OutFlags.TranslateOnly = "";
OutFlags.VerboseFocusOn = "";
// size_t and 64-bit fields.
OutFlags.NumTranslationThreads = 0;
OutFlags.RandomSeed = 0;
// Unordered set fields.
OutFlags.clearExcludedRegisters();
OutFlags.clearUseRestrictedRegisters();
namespace {
// flagInitOrStorageTypeDefault is some template voodoo for peeling off the
// llvm::cl modifiers from a flag's declaration, until its initial value is
// found. If none is found, then the default value for the storage type is
// returned.
template <typename Ty> Ty flagInitOrStorageTypeDefault() { return Ty(); }
template <typename Ty, typename T, typename... A>
Ty flagInitOrStorageTypeDefault(cl::initializer<T> &&Value, A &&...) {
return Value.Init;
}
void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
// is_cl_initializer is used to prevent an ambiguous call between the previous
// version of flagInitOrStorageTypeDefault, and the next, which is flagged by
// g++.
template <typename T> struct is_cl_initializer {
static constexpr bool value = false;
};
template <typename T> struct is_cl_initializer<cl::initializer<T>> {
static constexpr bool value = true;
};
template <typename Ty, typename T, typename... A>
typename std::enable_if<!is_cl_initializer<T>::value, Ty>::type
flagInitOrStorageTypeDefault(T &&, A &&... Other) {
return flagInitOrStorageTypeDefault<Ty>(std::forward<A>(Other)...);
}
} // end of anonymous namespace
void ClFlags::resetClFlags() {
#define X(Name, Type, ClType, ...) \
Name = flagInitOrStorageTypeDefault< \
detail::cl_type_traits<Type, cl_detail::ClType>::storage_type>( \
__VA_ARGS__);
COMMAND_LINE_FLAGS
#undef X
}
namespace {
// toSetterParam is template magic that is needed to convert between (llvm::)cl
// objects and the arguments to ClFlags' setters. ToSetterParam is a traits
// object that we need in order for the multiple specializations to
// toSetterParam to agree on their return type.
template <typename T> struct ToSetterParam { using ReturnType = const T &; };
template <> struct ToSetterParam<cl::list<Ice::VerboseItem>> {
using ReturnType = Ice::VerboseMask;
};
template <typename T>
typename ToSetterParam<T>::ReturnType toSetterParam(const T &Param) {
return Param;
}
template <>
ToSetterParam<cl::list<Ice::VerboseItem>>::ReturnType
toSetterParam(const cl::list<Ice::VerboseItem> &Param) {
Ice::VerboseMask VMask = Ice::IceV_None;
// Don't generate verbose messages if routines to dump messages are not
// available.
if (BuildDefs::dump()) {
for (unsigned i = 0; i != VerboseList.size(); ++i)
VMask |= VerboseList[i];
for (unsigned i = 0; i != Param.size(); ++i)
VMask |= Param[i];
}
OutFlags.setAllowErrorRecovery(::AllowErrorRecovery);
OutFlags.setAllowExternDefinedSymbols(::AllowExternDefinedSymbols ||
::DisableInternal);
OutFlags.setAllowIacaMarks(::AllowIacaMarks);
OutFlags.setAllowUninitializedGlobals(::AllowUninitializedGlobals);
OutFlags.setDataSections(::DataSections);
OutFlags.setDecorateAsm(::DecorateAsm);
OutFlags.setDefaultFunctionPrefix(::DefaultFunctionPrefix);
OutFlags.setDefaultGlobalPrefix(::DefaultGlobalPrefix);
OutFlags.setDisableHybridAssembly(::DisableHybridAssembly ||
(::OutFileType != Ice::FT_Iasm));
OutFlags.setDisableInternal(::DisableInternal);
OutFlags.setDisableTranslation(::DisableTranslation);
OutFlags.setDumpStats(::DumpStats);
OutFlags.setEnableBlockProfile(::EnableBlockProfile);
OutFlags.setExcludedRegisters(::ExcludedRegisters);
OutFlags.setForceMemIntrinOpt(::ForceMemIntrinOpt);
OutFlags.setFunctionSections(::FunctionSections);
OutFlags.setNumTranslationThreads(::NumThreads);
OutFlags.setOptLevel(::OLevel);
OutFlags.setKeepDeletedInsts(::KeepDeletedInsts);
OutFlags.setMockBoundsCheck(::MockBoundsCheck);
OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit);
OutFlags.setRandomSeed(::RandomSeed);
OutFlags.setRandomizeAndPoolImmediatesOption(
::RandomizeAndPoolImmediatesOption);
OutFlags.setRandomizeAndPoolImmediatesThreshold(
::RandomizeAndPoolImmediatesThreshold);
OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize);
OutFlags.setShouldReorderBasicBlocks(::ReorderBasicBlocks);
OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion);
OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation);
OutFlags.setRegAllocReserve(::RegAllocReserve);
OutFlags.setShouldRepeatRegAlloc(::RepeatRegAlloc);
OutFlags.setShouldReorderFunctions(::ReorderFunctions);
OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables);
OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants);
OutFlags.setSkipUnimplemented(::SkipUnimplemented);
OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled);
OutFlags.setTargetArch(::TargetArch);
OutFlags.setTargetInstructionSet(::TargetInstructionSet);
OutFlags.setTestPrefix(::TestPrefix);
OutFlags.setTestStackExtra(::TestStackExtra);
OutFlags.setTimeEachFunction(::TimeEachFunction);
OutFlags.setTimingFocusOn(::TimingFocusOn);
OutFlags.setTranslateOnly(::TranslateOnly);
OutFlags.setUseNonsfi(::UseNonsfi);
OutFlags.setUseRestrictedRegisters(::UseRestrictedRegisters);
OutFlags.setUseSandboxing(::UseSandboxing);
OutFlags.setVerboseFocusOn(::VerboseFocusOn);
OutFlags.setOutFileType(::OutFileType);
OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction);
OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage);
OutFlags.setVerbose(VMask);
return VMask;
}
void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) {
OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess);
OutFlagsExtra.setBitcodeAsText(BitcodeAsText);
OutFlagsExtra.setBuildOnRead(BuildOnRead);
OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts);
OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors);
OutFlagsExtra.setAppName(AppName);
OutFlagsExtra.setInputFileFormat(InputFileFormat);
OutFlagsExtra.setIRFilename(IRFilename);
OutFlagsExtra.setLogFilename(LogFilename);
OutFlagsExtra.setOutputFilename(OutputFilename);
} // end of anonymous namespace
void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
#define X(Name, Type, ClType, ...) OutFlags.set##Name(toSetterParam(Name##Obj));
COMMAND_LINE_FLAGS
#undef X
// If any value needs a non-trivial parsed value, set it below.
OutFlags.setAllowExternDefinedSymbols(AllowExternDefinedSymbolsObj ||
DisableInternalObj);
OutFlags.setDisableHybridAssembly(DisableHybridAssemblyObj ||
(OutFileTypeObj != Ice::FT_Iasm));
}
} // end of namespace Ice
//===- subzero/src/IceClFlags.def - Cl Flags for translation ----*- C++ -*-===//
//
// The Subzero Code Generator
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Declares the command line flags used by Subzero.
///
//===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_ICECLFLAGS_DEF
#define SUBZERO_SRC_ICECLFLAGS_DEF
namespace Ice {
// cl_detail defines tags (i.e., structs) for specifying the type of a flag
// (either single-, or multi-value), and whether or not the flag is available in
// non-LLVM_CL build.
namespace cl_detail {
// Single-value flag, available in a non-LLVM_CL build.
struct release_opt_flag {};
// Single-value flag, not available in a non-LLVM_CL build.
struct dev_opt_flag {};
// Multi-value flag, not available in a non-LLVM_CL build.
struct dev_list_flag {};
} // end of namespace detail
#define COMMAND_LINE_FLAGS \
/* Name, Type, ClType, <<flag declaration ctor arguments>> */ \
X(IRFilename, std::string, release_opt_flag, cl::Positional, \
cl::desc("IR File"), cl::init("-")) \
\
X(NumTranslationThreads, uint32_t, release_opt_flag, "threads", \
cl::desc("Number of translation threads (0 for purely sequential)"), \
cl::init(2)) \
\
X(OptLevel, Ice::OptLevel, release_opt_flag, cl::desc("Optimization level"), \
cl::init(Ice::Opt_m1), cl::value_desc("level"), \
cl::values(clEnumValN(Ice::Opt_m1, "Om1", "-1"), \
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)) \
\
X(OutputFilename, std::string, release_opt_flag, "o", \
cl::desc("Override output filename"), cl::init("-"), \
cl::value_desc("filename")) \
\
X(TargetArch, Ice::TargetArch, release_opt_flag, "target", \
cl::desc("Target architecture:"), cl::init(Ice::Target_X8632), \
cl::values( \
clEnumValN(Ice::Target_X8632, "x8632", "x86-32"), \
clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"), \
clEnumValN(Ice::Target_X8632, "x86_32", "x86-32 (same as x8632)"), \
clEnumValN(Ice::Target_X8664, "x8664", "x86-64"), \
clEnumValN(Ice::Target_X8664, "x86-64", "x86-64 (same as x8664)"), \
clEnumValN(Ice::Target_X8664, "x86_64", "x86-64 (same as x8664)"), \
clEnumValN(Ice::Target_ARM32, "arm", "arm32"), \
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)) \
\
/* The following are development flags, and ideally should not appear in a \
* release build. */ \
\
X(AllowErrorRecovery, bool, dev_opt_flag, \
"allow-pnacl-reader-error-recovery", \
cl::desc("Allow error recovery when reading PNaCl bitcode."), \
cl::init(false)) \
\
X(AllowExternDefinedSymbols, bool, dev_opt_flag, \
"allow-externally-defined-symbols", \
cl::desc( \
"Allow global symbols to be externally defined (other than _start " \
"and __pnacl_pso_root)."), \
cl::init(false)) \
\
X(AllowIacaMarks, bool, dev_opt_flag, "allow-iaca-marks", \
cl::desc("Allow IACA (Intel Architecture Code Analyzer) marks to be " \
"inserted. These binaries are not executable."), \
cl::init(false)) \
\
X(AllowUninitializedGlobals, bool, dev_opt_flag, \
"allow-uninitialized-globals", \
cl::desc("Allow global variables to be uninitialized")) \
\
X(AlwaysExitSuccess, bool, dev_opt_flag, "exit-success", \
cl::desc("Exit with success status, even if errors found"), \
cl::init(false)) \
\
X(BitcodeAsText, bool, dev_opt_flag, "bitcode-as-text", \
cl::desc("Accept textual form of PNaCl bitcode " \
"records (i.e. not .ll assembly)"), \
cl::init(false)) \
\
X(BuildOnRead, bool, dev_opt_flag, "build-on-read", \
cl::desc("Build ICE instructions when reading bitcode"), cl::init(true)) \
\
X(DataSections, bool, dev_opt_flag, "fdata-sections", \
cl::desc("Emit (global) data into separate sections")) \
\
X(DecorateAsm, bool, dev_opt_flag, "asm-verbose", \
cl::desc("Decorate textual asm output with register liveness info")) \
\
X(DefaultFunctionPrefix, std::string, dev_opt_flag, \
"default-function-prefix", \
cl::desc("Define default function prefix for naming " \
"unnamed functions"), \
cl::init(Ice::BuildDefs::dump() ? "Function" : "F")) \
\
X(DefaultGlobalPrefix, std::string, dev_opt_flag, "default-global-prefix", \
cl::desc("Define default global prefix for naming " \
"unnamed globals"), \
cl::init(Ice::BuildDefs::dump() ? "Global" : "G")) \
\
X(DisableHybridAssembly, bool, dev_opt_flag, "no-hybrid-asm", \
cl::desc("Disable hybrid assembly when -filetype=iasm"), cl::init(false)) \
\
X(DisableInternal, bool, dev_opt_flag, "externalize", \
cl::desc("Externalize all symbols")) \
\
X(DisableTranslation, bool, dev_opt_flag, "notranslate", \
cl::desc("Disable Subzero translation")) \
\
X(DumpStats, bool, dev_opt_flag, "szstats", \
cl::desc("Print statistics after translating each function")) \
\
X(EnableBlockProfile, bool, dev_opt_flag, "enable-block-profile", \
cl::desc("Instrument basic blocks, and output profiling " \
"information to stdout at the end of program execution."), \
cl::init(false)) \
\
X(EnablePhiEdgeSplit, bool, dev_opt_flag, "phi-edge-split", \
cl::desc("Enable edge splitting for Phi lowering"), cl::init(true)) \
\
X(ExcludedRegisters, std::string, dev_list_flag, "reg-exclude", \
cl::CommaSeparated, cl::desc("Don't use specified registers")) \
\
X(ForceMemIntrinOpt, bool, dev_opt_flag, "fmem-intrin-opt", \
cl::desc("Force optimization of memory intrinsics.")) \
\
X(FunctionSections, bool, dev_opt_flag, "ffunction-sections", \
cl::desc("Emit functions into separate sections")) \
\
X(GenerateBuildAtts, bool, release_opt_flag, "build-atts", \
cl::desc("Generate list of build attributes associated with " \
"this executable."), \
cl::init(false)) \
\
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), \
cl::init(llvm::LLVMFormat)) \
\
X(KeepDeletedInsts, bool, dev_opt_flag, "keep-deleted-insts", \
cl::desc("Retain deleted instructions in the Cfg"), \
cl::init(Ice::BuildDefs::dump())) \
\
X(LLVMVerboseErrors, bool, dev_opt_flag, "verbose-llvm-parse-errors", \
cl::desc("Print out more descriptive PNaCl bitcode parse errors when " \
"building LLVM IR first"), \
cl::init(false)) \
\
X(LogFilename, std::string, dev_opt_flag, "log", \
cl::desc("Set log filename"), cl::init("-"), cl::value_desc("filename")) \
\
X(MaxNopsPerInstruction, int, dev_opt_flag, "max-nops-per-instruction", \
cl::desc("Max number of nops to insert per instruction"), cl::init(1)) \
\
X(MockBoundsCheck, bool, dev_opt_flag, "mock-bounds-check", \
cl::desc("Mock bounds checking on loads/stores")) \
\
X(NopProbabilityAsPercentage, int, dev_opt_flag, "nop-insertion-percentage", \
cl::desc("Nop insertion probability as percentage"), cl::init(10)) \
\
X(OutFileType, Ice::FileType, dev_opt_flag, "filetype", \
cl::desc("Output file type"), cl::init(Ice::FT_Iasm), \
cl::values( \
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)) \
\
X(RandomizeAndPoolImmediatesOption, Ice::RandomizeAndPoolImmediatesEnum, \
dev_opt_flag, "randomize-pool-immediates", \
cl::desc("Randomize or pooling the representation of immediates"), \
cl::init(Ice::RPI_None), \
cl::values(clEnumValN(Ice::RPI_None, "none", \
"Do not randomize or pooling immediates (default)"), \
clEnumValN(Ice::RPI_Randomize, "randomize", \
"Turn on immediate constants blinding"), \
clEnumValN(Ice::RPI_Pool, "pool", \
"Turn on immediate constants pooling"), \
clEnumValEnd)) \
\
X(RandomizeAndPoolImmediatesThreshold, uint32_t, dev_opt_flag, \
"randomize-pool-threshold", \
cl::desc("The threshold for immediates randomization and pooling"), \
cl::init(0xffff)) \
\
X(RandomizeRegisterAllocation, bool, dev_opt_flag, "randomize-regalloc", \
cl::desc("Randomize register allocation"), cl::init(false)) \
\
X(RandomSeed, unsigned long long, dev_opt_flag, "sz-seed", \
cl::desc("Seed the random number generator"), cl::init(1)) \
\
X(RegAllocReserve, bool, dev_opt_flag, "reg-reserve", \
cl::desc("Let register allocation use reserve registers"), \
cl::init(false)) \
\
X(ReorderBasicBlocks, bool, dev_opt_flag, "reorder-basic-blocks", \
cl::desc("Shuffle the layout of basic blocks in each function"), \
cl::init(false)) \
\
X(ReorderFunctions, bool, dev_opt_flag, "reorder-functions", \
cl::desc("Randomize function ordering"), cl::init(false)) \
\
X(ReorderFunctionsWindowSize, uint32_t, dev_opt_flag, \
"reorder-functions-window-size", \
cl::desc( \
"The shuffling window size for function reordering. 1 or 0 means " \
"no effective shuffling."), \
cl::init(8)) \
\
X(ReorderGlobalVariables, bool, dev_opt_flag, "reorder-global-variables", \
cl::desc("Randomize global data ordering"), cl::init(false)) \
\
X(ReorderPooledConstants, bool, dev_opt_flag, "reorder-pooled-constants", \
cl::desc("Randomize constant pool entry ordering"), cl::init(false)) \
\
X(RepeatRegAlloc, bool, dev_opt_flag, "regalloc-repeat", \
cl::desc("Repeat register allocation until convergence"), cl::init(true)) \
\
X(ShouldDoNopInsertion, bool, dev_opt_flag, "nop-insertion", \
cl::desc("Randomly insert NOPs"), cl::init(false)) \
\
X(SkipUnimplemented, bool, dev_opt_flag, "skip-unimplemented", \
cl::desc("Skip through unimplemented lowering code instead of aborting."), \
cl::init(false)) \
\
X(SubzeroTimingEnabled, bool, dev_opt_flag, "timing", \
cl::desc("Enable breakdown timing of Subzero translation")) \
\
X(TargetInstructionSet, Ice::TargetInstructionSet, dev_opt_flag, "mattr", \
cl::desc("Target architecture attributes"), \
cl::init(Ice::BaseInstructionSet), \
cl::values( \
clEnumValN(Ice::BaseInstructionSet, "base", \
"Target chooses baseline instruction set (default)"), \
clEnumValN(Ice::X86InstructionSet_SSE2, "sse2", \
"Enable X86 SSE2 instructions"), \
clEnumValN(Ice::X86InstructionSet_SSE4_1, "sse4.1", \
"Enable X86 SSE 4.1 instructions"), \
clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", \
"Enable ARM Neon instructions"), \
clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", \
"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(""), \
cl::value_desc("prefix")) \
\
X(TestStackExtra, uint32_t, dev_opt_flag, "test-stack-extra", \
cl::desc("Extra amount of stack to add to the " \
"frame in bytes (for testing)."), \
cl::init(0)) \
\
X(TimeEachFunction, bool, dev_opt_flag, "timing-funcs", \
cl::desc("Print total translation time for each function")) \
\
X(TimingFocusOn, std::string, dev_opt_flag, "timing-focus", \
cl::desc("Break down timing for a specific function (use '*' for all)"), \
cl::init("")) \
\
X(TranslateOnly, std::string, dev_opt_flag, "translate-only", \
cl::desc("Translate only the given function"), cl::init("")) \
\
X(UseNonsfi, bool, dev_opt_flag, "nonsfi", cl::desc("Enable Non-SFI mode")) \
\
X(UseRestrictedRegisters, std::string, dev_list_flag, "reg-use", \
cl::CommaSeparated, \
cl::desc("Only use specified registers for corresponding register " \
"classes")) \
\
X(UseSandboxing, bool, dev_opt_flag, "sandbox", cl::desc("Use sandboxing")) \
\
X(Verbose, Ice::VerboseItem, dev_list_flag, "verbose", cl::CommaSeparated, \
cl::desc("Verbose options (can be comma-separated):"), \
cl::values( \
clEnumValN(Ice::IceV_Instructions, "inst", \
"Print basic instructions"), \
clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), \
clEnumValN(Ice::IceV_InstNumbers, "instnum", \
"Print instruction numbers"), \
clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), \
clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), \
clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), \
clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), \
clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), \
clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), \
clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), \
clEnumValN(Ice::IceV_Random, "random", "Randomization details"), \
clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"), \
clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"), \
clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), \
clEnumValN(Ice::IceV_Mem, "mem", "Memory usage details"), \
clEnumValN(Ice::IceV_Status, "status", \
"Print the name of the function being translated"), \
clEnumValN(Ice::IceV_AvailableRegs, "registers", \
"Show available registers for register allocation"), \
clEnumValN(Ice::IceV_GlobalInit, "global_init", \
"Global initializers"), \
clEnumValN(Ice::IceV_ConstPoolStats, "cpool", \
"Constant pool counters"), \
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)) \
\
X(VerboseFocusOn, std::string, dev_opt_flag, "verbose-focus", \
cl::desc("Override with -verbose=none except for the specified function"), \
cl::init(""))
//#define X(Name, Type, ClType, ...)
} // end of namespace Ice
#endif // SUBZERO_SRC_ICECLFLAGS_DEF
......@@ -16,26 +16,54 @@
#define SUBZERO_SRC_ICECLFLAGS_H
#include "IceDefs.h"
#include "IceBuildDefs.h"
#include "IceClFlags.def"
#include "IceTypes.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif // __clang__
#include "llvm/IRReader/IRReader.h"
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
#include <string>
#include <utility>
#include <vector>
namespace Ice {
// detail defines the type cl_type_traits, which is used to define the
// getters/setters for the ClFlags class. It converts the cl_detail::*_flag
// types to appropriate types for the several getters and setters created.
namespace detail {
// Base cl_type_traits.
template <typename B, typename CL> struct cl_type_traits {};
// cl_type_traits specialized cl::list<std::string>, non-MINIMAL build.
template <> struct cl_type_traits<std::string, cl_detail::dev_list_flag> {
using storage_type = std::vector<std::string>;
};
// TODO(stichnot): Fix the separation between ClFlags and ClFlagsExtra.
//
// The original intention was that ClFlags would be the core set of flags for a
// release build, while ClFlagsExtra had optional flags that would be locked to
// default values in a release build. However, the division has evolved to be
// fairly arbitrary.
//
// The variable flags in a release (browser) build should be limited to opt
// level, number of threads, output file, and perhaps input file.
//
// The core flags should remain part of the GlobalContext object, but the
// optional flags might as well be global, i.e. static members of GlobalContext,
// so that they are easily accessed from anywhere without needing to plumb in
// the GlobalContext object.
// cl_type_traits specialized cl::list<Ice::VerboseItem>, non-MINIMAL build.
template <> struct cl_type_traits<Ice::VerboseItem, cl_detail::dev_list_flag> {
using storage_type = Ice::VerboseMask;
};
class ClFlagsExtra;
// cl_type_traits specialized cl::opt<T>, non-MINIMAL build.
template <typename T> struct cl_type_traits<T, cl_detail::dev_opt_flag> {
using storage_type = T;
};
// cl_type_traits specialized cl::opt<T>, MINIMAL build.
template <typename T> struct cl_type_traits<T, cl_detail::release_opt_flag> {
using storage_type = T;
};
} // end of namespace detail
/// Define variables which configure translation and related support functions.
class ClFlags {
......@@ -43,114 +71,67 @@ class ClFlags {
ClFlags &operator=(const ClFlags &) = delete;
public:
using StringVector = std::vector<IceString>;
/// User defined constructor.
ClFlags() { resetClFlags(*this); }
ClFlags() { resetClFlags(); }
/// \brief Parse commmand line options for Subzero.
///
/// This is done use cl::ParseCommandLineOptions() and the static variables of
/// type cl::opt defined in IceClFlags.cpp
static void parseFlags(int argc, char *argv[]);
/// Reset all configuration options to their nominal values.
static void resetClFlags(ClFlags &OutFlags);
void resetClFlags();
/// \brief Retrieve the configuration option state
///
/// This is defined by static variables
/// anonymous_namespace{IceClFlags.cpp}::AllowErrorRecovery,
/// anonymous_namespace{IceClFlags.cpp}::AllowIacaMarks,
/// anonymous_namespace{IceClFlags.cpp}::AllowErrorRecoveryObj,
/// anonymous_namespace{IceClFlags.cpp}::AllowIacaMarksObj,
/// ...
static void getParsedClFlags(ClFlags &OutFlags);
/// Retrieve the extra configuration options state.
static void getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra);
// bool accessors.
/// Get the value of ClFlags::AllowErrorRecovery
bool getAllowErrorRecovery() const { return AllowErrorRecovery; }
/// Set ClFlags::AllowErrorRecovery to a new value
void setAllowErrorRecovery(bool NewValue) { AllowErrorRecovery = NewValue; }
/// Get the value of ClFlags::AllowExternDefinedSymbols
bool getAllowExternDefinedSymbols() const {
return AllowExternDefinedSymbols;
}
/// Set ClFlags::AllowExternDefinedSymbols to a new value
void setAllowExternDefinedSymbols(bool NewValue) {
AllowExternDefinedSymbols = NewValue;
}
/// Get the value of ClFlags::AllowIacaMarks
bool getAllowIacaMarks() const { return AllowIacaMarks; }
/// Set ClFlags::AllowIacaMarks to a new value
void setAllowIacaMarks(bool NewValue) { AllowIacaMarks = NewValue; }
/// Get the value of ClFlags::AllowUninitializedGlobals
bool getAllowUninitializedGlobals() const {
return AllowUninitializedGlobals;
}
/// Set ClFlags::AllowUninitializedGlobals to a new value
void setAllowUninitializedGlobals(bool NewValue) {
AllowUninitializedGlobals = NewValue;
}
/// Get the value of ClFlags::DataSections
bool getDataSections() const { return DataSections; }
/// Set ClFlags::DataSections to a new value
void setDataSections(bool NewValue) { DataSections = NewValue; }
/// Get the value of ClFlags::DecorateAsm
bool getDecorateAsm() const { return DecorateAsm; }
/// Set ClFlags::DecorateAsm to a new value
void setDecorateAsm(bool NewValue) { DecorateAsm = NewValue; }
/// Get the value of ClFlags::DisableHybridAssembly
bool getDisableHybridAssembly() const { return DisableHybridAssembly; }
/// Set ClFlags::DisableHybridAssembly to a new value
void setDisableHybridAssembly(bool NewValue) {
DisableHybridAssembly = NewValue;
}
/// Get the value of ClFlags::DisableInternal
bool getDisableInternal() const { return DisableInternal; }
/// Set ClFlags::DisableInternal to a new value
void setDisableInternal(bool NewValue) { DisableInternal = NewValue; }
/// Get the value of ClFlags::DisableTranslation
bool getDisableTranslation() const { return DisableTranslation; }
/// Set ClFlags::DisableTranslation to a new value
void setDisableTranslation(bool NewValue) { DisableTranslation = NewValue; }
/// Get the value of ClFlags::DumpStats
bool getDumpStats() const { return BuildDefs::dump() && DumpStats; }
/// Set ClFlags::DumpStats to a new value
void setDumpStats(bool NewValue) { DumpStats = NewValue; }
/// Get the value of ClFlags::EnableBlockProfile
bool getEnableBlockProfile() const { return EnableBlockProfile; }
/// Set ClFlags::EnableBlockProfile to a new value
void setEnableBlockProfile(bool NewValue) { EnableBlockProfile = NewValue; }
/// Get the restricted list of registers to use, for corresponding register
/// classes, in register allocation.
const StringVector &getUseRestrictedRegisters() const {
return UseRestrictedRegisters;
}
void clearUseRestrictedRegisters() { UseRestrictedRegisters.clear(); }
void setUseRestrictedRegisters(const StringVector &Registers) {
UseRestrictedRegisters = Registers;
}
/// Get the value of ClFlags::ForceMemIntrinOpt
bool getForceMemIntrinOpt() const { return ForceMemIntrinOpt; }
/// Set ClFlags::ForceMemIntrinOpt to a new value
void setForceMemIntrinOpt(bool NewValue) { ForceMemIntrinOpt = NewValue; }
#define X(Name, Type, ClType, ...) \
private: \
typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type Name; \
\
template <bool E> \
typename std::enable_if<E, void>::type set##Name##Impl( \
typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \
Value) { \
Name = std::move(Value); \
} \
\
template <bool E> \
typename std::enable_if<!E, void>::type set##Name##Impl( \
typename detail::cl_type_traits<Type, \
cl_detail::ClType>::storage_type) {} \
\
public: \
typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \
get##Name() const { \
return Name; \
} \
\
void set##Name( \
typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \
Value) { \
/* TODO(jpp): figure out which optional flags are used in minimal, and \
what are the defaults for them. */ \
static constexpr bool Enable = \
std::is_same<cl_detail::ClType, cl_detail::release_opt_flag>::value || \
!BuildDefs::minimal() || true; \
set##Name##Impl<Enable>(std::move(Value)); \
} \
\
private:
COMMAND_LINE_FLAGS
#undef X
/// Get the value of ClFlags::FunctionSections
bool getFunctionSections() const { return FunctionSections; }
/// Set ClFlags::FunctionSections to a new value
void setFunctionSections(bool NewValue) { FunctionSections = NewValue; }
public:
bool isSequential() const { return NumTranslationThreads == 0; }
std::string getAppName() const { return AppName; }
void setAppName(const std::string &Value) { AppName = Value; }
/// \brief Get the value of ClFlags::GenerateUnitTestMessages
///
......@@ -164,358 +145,11 @@ public:
GenerateUnitTestMessages = NewValue;
}
/// Get the value of ClFlags::KeepDeletedInsts
bool getKeepDeletedInsts() const { return KeepDeletedInsts; }
/// Set ClFlags::KeepDeletedInsts to a new value
void setKeepDeletedInsts(bool NewValue) { KeepDeletedInsts = NewValue; }
/// Get the value of ClFlags::MockBoundsCheck
bool getMockBoundsCheck() const { return MockBoundsCheck; }
/// Set ClFlags::MockBoundsCheck to a new value
void setMockBoundsCheck(bool NewValue) { MockBoundsCheck = NewValue; }
/// Get the value of ClFlags::PhiEdgeSplit
bool getPhiEdgeSplit() const { return PhiEdgeSplit; }
/// Set ClFlags::PhiEdgeSplit to a new value
void setPhiEdgeSplit(bool NewValue) { PhiEdgeSplit = NewValue; }
/// Get the value of ClFlags::RandomNopInsertion
bool shouldDoNopInsertion() const { return RandomNopInsertion; }
/// Set ClFlags::RandomNopInsertion to a new value
void setShouldDoNopInsertion(bool NewValue) { RandomNopInsertion = NewValue; }
/// Get the value of ClFlags::RandomRegAlloc
bool shouldRandomizeRegAlloc() const { return RandomRegAlloc; }
/// Set ClFlags::RandomRegAlloc to a new value
void setShouldRandomizeRegAlloc(bool NewValue) { RandomRegAlloc = NewValue; }
/// Get the value of ClFlags::RegAllocReserve
bool getRegAllocReserve() const { return RegAllocReserve; }
/// Set ClFlags::RegAllocReserve to a new value
void setRegAllocReserve(bool NewValue) { RegAllocReserve = NewValue; }
/// Get the value of ClFlags::RepeatRegAlloc
bool shouldRepeatRegAlloc() const { return RepeatRegAlloc; }
/// Set ClFlags::RepeatRegAlloc to a new value
void setShouldRepeatRegAlloc(bool NewValue) { RepeatRegAlloc = NewValue; }
/// Get the value of ClFlags::SkipUnimplemented
bool getSkipUnimplemented() const { return SkipUnimplemented; }
/// Set ClFlags::SkipUnimplemented to a new value
void setSkipUnimplemented(bool NewValue) { SkipUnimplemented = NewValue; }
/// Get the value of ClFlags::SubzeroTimingEnabled
bool getSubzeroTimingEnabled() const { return SubzeroTimingEnabled; }
/// Set ClFlags::SubzeroTimingEnableds to a new value
void setSubzeroTimingEnabled(bool NewValue) {
SubzeroTimingEnabled = NewValue;
}
/// Get the value of ClFlags::TimeEachFunction
bool getTimeEachFunction() const {
return BuildDefs::dump() && TimeEachFunction;
}
/// Set ClFlags::TimeEachFunction to a new value
void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; }
/// Get the value of ClFlags::UseNonsfi
bool getUseNonsfi() const { return UseNonsfi; }
/// Set ClFlags::UseNonsfi to a new value
void setUseNonsfi(bool NewValue) { UseNonsfi = NewValue; }
/// Get the list of registers exluded in register allocation.
const StringVector &getExcludedRegisters() const { return ExcludedRegisters; }
void clearExcludedRegisters() { ExcludedRegisters.clear(); }
void setExcludedRegisters(const StringVector &Registers) {
ExcludedRegisters = Registers;
}
/// Get the value of ClFlags::UseSandboxing
bool getUseSandboxing() const { return UseSandboxing; }
/// Set ClFlags::UseSandboxing to a new value
void setUseSandboxing(bool NewValue) { UseSandboxing = NewValue; }
// Enum and integer accessors.
/// Get the value of ClFlags::Opt
OptLevel getOptLevel() const { return Opt; }
/// Set ClFlags::Opt to a new value
void setOptLevel(OptLevel NewValue) { Opt = NewValue; }
/// Get the value of ClFlags::OutFileType
FileType getOutFileType() const { return OutFileType; }
/// Set ClFlags::OutFileType to a new value
void setOutFileType(FileType NewValue) { OutFileType = NewValue; }
/// Get the value of ClFlags::RandomMaxNopsPerInstruction
int getMaxNopsPerInstruction() const { return RandomMaxNopsPerInstruction; }
/// Set ClFlags::RandomMaxNopsPerInstruction to a new value
void setMaxNopsPerInstruction(int NewValue) {
RandomMaxNopsPerInstruction = NewValue;
}
/// Get the value of ClFlags::RandomNopProbabilityAsPercentage
int getNopProbabilityAsPercentage() const {
return RandomNopProbabilityAsPercentage;
}
/// Set ClFlags::RandomNopProbabilityAsPercentage to a new value
void setNopProbabilityAsPercentage(int NewValue) {
RandomNopProbabilityAsPercentage = NewValue;
}
/// Get the value of ClFlags::TArch
TargetArch getTargetArch() const { return TArch; }
/// Set ClFlags::TArch to a new value
void setTargetArch(TargetArch NewValue) { TArch = NewValue; }
/// Get the value of ClFlags::TInstrSet
TargetInstructionSet getTargetInstructionSet() const { return TInstrSet; }
/// Set ClFlags::TInstrSet to a new value
void setTargetInstructionSet(TargetInstructionSet NewValue) {
TInstrSet = NewValue;
}
/// \brief Get the value of ClFlags::TestStackExtra
///
/// Always 0 if BuildDefs::minimal()
uint32_t getTestStackExtra() const {
return BuildDefs::minimal() ? 0 : TestStackExtra;
}
/// \brief Set ClFlags::TestStackExtra to a new value
///
/// Always 0 if BuildDefs::minimal()
void setTestStackExtra(uint32_t NewValue) {
if (BuildDefs::minimal())
return;
TestStackExtra = NewValue;
}
/// \brief Get the value of ClFlags::VMask
///
/// None if BuildDefs::dump()
VerboseMask getVerbose() const {
return BuildDefs::dump() ? VMask : (VerboseMask)IceV_None;
}
/// \brief Set ClFlags::VMask to a new value
///
/// None if BuildDefs::dump()
void setVerbose(VerboseMask NewValue) { VMask = NewValue; }
/// Set ClFlags::RandomizeAndPoolImmediatesOption to a new value
void
setRandomizeAndPoolImmediatesOption(RandomizeAndPoolImmediatesEnum Option) {
RandomizeAndPoolImmediatesOption = Option;
}
/// Get the value of ClFlags::RandomizeAndPoolImmediatesOption
RandomizeAndPoolImmediatesEnum getRandomizeAndPoolImmediatesOption() const {
return RandomizeAndPoolImmediatesOption;
}
/// Set ClFlags::RandomizeAndPoolImmediatesThreshold to a new value
void setRandomizeAndPoolImmediatesThreshold(uint32_t Threshold) {
RandomizeAndPoolImmediatesThreshold = Threshold;
}
/// Get the value of ClFlags::RandomizeAndPoolImmediatesThreshold
uint32_t getRandomizeAndPoolImmediatesThreshold() const {
return RandomizeAndPoolImmediatesThreshold;
}
/// Get the value of ClFlags::ReorderBasicBlocks
bool shouldReorderBasicBlocks() const { return ReorderBasicBlocks; }
/// Set ClFlags::ReorderBasicBlocks to a new value
void setShouldReorderBasicBlocks(bool NewValue) {
ReorderBasicBlocks = NewValue;
}
/// Set ClFlags::ReorderFunctions to a new value
void setShouldReorderFunctions(bool Option) { ReorderFunctions = Option; }
/// Get the value of ClFlags::ReorderFunctions
bool shouldReorderFunctions() const { return ReorderFunctions; }
/// Set ClFlags::ReorderFunctionsWindowSize to a new value
void setReorderFunctionsWindowSize(uint32_t Size) {
ReorderFunctionsWindowSize = Size;
}
/// Get the value of ClFlags::ReorderFunctionsWindowSize
uint32_t getReorderFunctionsWindowSize() const {
return ReorderFunctionsWindowSize;
}
/// Set ClFlags::ReorderGlobalVariables to a new value
void setShouldReorderGlobalVariables(bool Option) {
ReorderGlobalVariables = Option;
}
/// Get the value of ClFlags::ReorderGlobalVariables
bool shouldReorderGlobalVariables() const { return ReorderGlobalVariables; }
/// Set ClFlags::ReorderPooledConstants to a new value
void setShouldReorderPooledConstants(bool Option) {
ReorderPooledConstants = Option;
}
/// Get the value of ClFlags::ReorderPooledConstants
bool shouldReorderPooledConstants() const { return ReorderPooledConstants; }
// IceString accessors.
/// Get the value of ClFlags::DefaultFunctionPrefix
const IceString &getDefaultFunctionPrefix() const {
return DefaultFunctionPrefix;
}
/// Set ClFlags::DefaultFunctionPrefix to a new value
void setDefaultFunctionPrefix(const IceString &NewValue) {
DefaultFunctionPrefix = NewValue;
}
/// Get the value of ClFlags::DefaultGlobalPrefix
const IceString &getDefaultGlobalPrefix() const {
return DefaultGlobalPrefix;
}
/// Set ClFlags::DefaultGlobalPrefix to a new value
void setDefaultGlobalPrefix(const IceString &NewValue) {
DefaultGlobalPrefix = NewValue;
}
/// Get the value of ClFlags::TestPrefix
const IceString &getTestPrefix() const { return TestPrefix; }
/// Set ClFlags::TestPrefix to a new value
void setTestPrefix(const IceString &NewValue) { TestPrefix = NewValue; }
/// Get the value of ClFlags::TimingFocusOn
const IceString &getTimingFocusOn() const { return TimingFocusOn; }
/// Set ClFlags::TimingFocusOn to a new value
void setTimingFocusOn(const IceString &NewValue) { TimingFocusOn = NewValue; }
/// Get the value of ClFlags::TranslateOnly
const IceString &getTranslateOnly() const { return TranslateOnly; }
/// Set ClFlags::TranslateOnly to a new value
void setTranslateOnly(const IceString &NewValue) { TranslateOnly = NewValue; }
/// Get the value of ClFlags::VerboseFocusOn
const IceString &getVerboseFocusOn() const { return VerboseFocusOn; }
/// Set ClFlags::VerboseFocusOns to a new value
void setVerboseFocusOn(const IceString &NewValue) {
VerboseFocusOn = NewValue;
}
// size_t and 64-bit accessors.
/// Get the value of ClFlags::NumTranslationThreads
size_t getNumTranslationThreads() const { return NumTranslationThreads; }
bool isSequential() const { return NumTranslationThreads == 0; }
/// Set ClFlags::NumTranslationThreads to a new value
void setNumTranslationThreads(size_t NewValue) {
NumTranslationThreads = NewValue;
}
/// Get the value of ClFlags::RandomSeed
uint64_t getRandomSeed() const { return RandomSeed; }
/// Set ClFlags::RandomSeed to a new value
void setRandomSeed(size_t NewValue) { RandomSeed = NewValue; }
private:
/// see anonymous_namespace{IceClFlags.cpp}::AllowErrorRecovery
bool AllowErrorRecovery;
/// see anonymous_namespace{IceClFlags.cpp}::AllowExternDefinedSymbols
bool AllowExternDefinedSymbols;
/// see anonymous_namespace{IceClFlags.cpp}::AllowIacaMarks
bool AllowIacaMarks;
/// see anonymous_namespace{IceClFlags.cpp}::AllowUninitializedGlobals
bool AllowUninitializedGlobals;
/// see anonymous_namespace{IceClFlags.cpp}::DataSections
bool DataSections;
/// see anonymous_namespace{IceClFlags.cpp}::DecorateAsm
bool DecorateAsm;
/// see anonymous_namespace{IceClFlags.cpp}::DisableHybridAssembly
bool DisableHybridAssembly;
/// see anonymous_namespace{IceClFlags.cpp}::DisableInternal
bool DisableInternal;
/// see anonymous_namespace{IceClFlags.cpp}::DisableTranslation
bool DisableTranslation;
/// see anonymous_namespace{IceClFlags.cpp}::DumpStats
bool DumpStats;
/// see anonymous_namespace{IceClFlags.cpp}::EnableBlockProfile
bool EnableBlockProfile;
/// see anonymous_namespace{IceClFlags.cpp}::ExcludedRegisters;
StringVector ExcludedRegisters;
/// see anonymous_namespace{IceClFlags.cpp}::ForceMemIntrinOpt
bool ForceMemIntrinOpt;
/// see anonymous_namespace{IceClFlags.cpp}::FunctionSections
bool FunctionSections;
std::string AppName;
/// Initialized to false; not set by the command line.
bool GenerateUnitTestMessages;
/// see anonymous_namespace{IceClFlags.cpp}::KeepDeletedInsts
bool KeepDeletedInsts;
/// see anonymous_namespace{IceClFlags.cpp}::MockBoundsCheck
bool MockBoundsCheck;
/// see anonymous_namespace{IceClFlags.cpp}::EnablePhiEdgeSplit
bool PhiEdgeSplit;
/// see anonymous_namespace{IceClFlags.cpp}::ShouldDoNopInsertion
bool RandomNopInsertion;
/// see anonymous_namespace{IceClFlags.cpp}::RandomizeRegisterAllocation
bool RandomRegAlloc;
/// see anonymous_namespace{IceClFlags.cpp}::RegAllocReserve
bool RegAllocReserve;
/// see anonymous_namespace{IceClFlags.cpp}::RepeatRegAlloc
bool RepeatRegAlloc;
/// see anonymous_namespace{IceClFlags.cpp}::ReorderBasicBlocks
bool ReorderBasicBlocks;
/// see anonymous_namespace{IceClFlags.cpp}::ReorderFunctions
bool ReorderFunctions;
/// see anonymous_namespace{IceClFlags.cpp}::ReorderGlobalVariables
bool ReorderGlobalVariables;
/// see anonymous_namespace{IceClFlags.cpp}::ReorderPooledConstants
bool ReorderPooledConstants;
/// see anonymous_namespace{IceClFlags.cpp}::SkipUnimplemented
bool SkipUnimplemented;
/// see anonymous_namespace{IceClFlags.cpp}::SubzeroTimingEnabled
bool SubzeroTimingEnabled;
/// see anonymous_namespace{IceClFlags.cpp}::TimeEachFunction
bool TimeEachFunction;
/// see anonymous_namespace{IceClFlags.cpp}::UseNonsfi
bool UseNonsfi;
/// see anonymous_namespace{IceClFlags.cpp}::UseRegistrictedRegisters;
StringVector UseRestrictedRegisters;
/// see anonymous_namespace{IceClFlags.cpp}::UseSandboxing
bool UseSandboxing;
/// see anonymous_namespace{IceClFlags.cpp}::OLevel
OptLevel Opt;
/// see anonymous_namespace{IceClFlags.cpp}::OutFileType
FileType OutFileType;
/// see anonymous_namespace{IceClFlags.cpp}::RandomizeAndPoolImmediatesOption
RandomizeAndPoolImmediatesEnum RandomizeAndPoolImmediatesOption;
/// see
/// anonymous_namespace{IceClFlags.cpp}::RandomizeAndPoolImmediatesThreshold
uint32_t RandomizeAndPoolImmediatesThreshold;
/// see anonymous_namespace{IceClFlags.cpp}::MaxNopsPerInstruction
int RandomMaxNopsPerInstruction;
/// see anonymous_namespace{IceClFlags.cpp}::NopProbabilityAsPercentage
int RandomNopProbabilityAsPercentage;
/// see anonymous_namespace{IceClFlags.cpp}::ReorderFunctionsWindowSize
uint32_t ReorderFunctionsWindowSize;
/// see anonymous_namespace{IceClFlags.cpp}::TargetArch
TargetArch TArch;
/// see anonymous_namespace{IceClFlags.cpp}::TestStackExtra
uint32_t TestStackExtra;
/// see anonymous_namespace{IceClFlags.cpp}::TargetInstructionSet
TargetInstructionSet TInstrSet;
/// see anonymous_namespace{IceClFlags.cpp}::VerboseList
VerboseMask VMask;
/// see anonymous_namespace{IceClFlags.cpp}::DefaultFunctionPrefix
IceString DefaultFunctionPrefix;
/// see anonymous_namespace{IceClFlags.cpp}::DefaultGlobalPrefix
IceString DefaultGlobalPrefix;
/// see anonymous_namespace{IceClFlags.cpp}::TestPrefix
IceString TestPrefix;
/// see anonymous_namespace{IceClFlags.cpp}::TimingFocusOn
IceString TimingFocusOn;
/// see anonymous_namespace{IceClFlags.cpp}::TranslateOnly
IceString TranslateOnly;
/// see anonymous_namespace{IceClFlags.cpp}::VerboseFocusOn
IceString VerboseFocusOn;
/// see anonymous_namespace{IceClFlags.cpp}::NumThreads
size_t NumTranslationThreads; // 0 means completely sequential
/// see anonymous_namespace{IceClFlags.cpp}::RandomSeed
uint64_t RandomSeed;
};
} // end of namespace Ice
......
//===- subzero/src/IceClFlagsExtra.h - Extra Cl Flags -----------*- C++ -*-===//
//
// The Subzero Code Generator
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Defines class Ice::ClFlagsExtra
///
//===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_ICECLFLAGSEXTRA_H
#define SUBZERO_SRC_ICECLFLAGSEXTRA_H
#include "IceDefs.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wredundant-move"
#endif // __clang__
#include "llvm/IRReader/IRReader.h"
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
namespace Ice {
/// Declares command line flags primarily used for non-minimal builds.
class ClFlagsExtra {
ClFlagsExtra(const ClFlagsExtra &) = delete;
ClFlagsExtra &operator=(const ClFlagsExtra &) = delete;
public:
ClFlagsExtra() = default;
/// Get the value of ClFlagsExtra::AlwaysExitSuccess
bool getAlwaysExitSuccess() const { return AlwaysExitSuccess; }
/// Set ClFlagsExtra::AlwaysExitSuccess to a new value
void setAlwaysExitSuccess(bool NewValue) { AlwaysExitSuccess = NewValue; }
/// Get the value of ClFlagsExtra::BuildOnRead
bool getBuildOnRead() const { return BuildOnRead; }
/// Set ClFlagsExtra::BuildOnRead to a new value
void setBuildOnRead(bool NewValue) { BuildOnRead = NewValue; }
/// Get the value of ClFlagsExtra::GenerateBuildAtts
bool getGenerateBuildAtts() const { return GenerateBuildAtts; }
/// Set ClFlagsExtra::GenerateBuildAtts to a new value
void setGenerateBuildAtts(bool NewValue) { GenerateBuildAtts = NewValue; }
/// Get the value of ClFlagsExtra::LLVMVerboseErrors
bool getLLVMVerboseErrors() const { return LLVMVerboseErrors; }
/// Set ClFlagsExtra::LLVMVerboseErrors to a new value
void setLLVMVerboseErrors(bool NewValue) { LLVMVerboseErrors = NewValue; }
/// Get the value of ClFlagsExtra::BitcodeAsText
bool getBitcodeAsText() const { return BitcodeAsText; }
/// Set ClFlagsExtra::BitcodeAsText to a new value
void setBitcodeAsText(bool NewValue) { BitcodeAsText = NewValue; }
/// Get the value of ClFlagsExtra::InputFileFormat
llvm::NaClFileFormat getInputFileFormat() const { return InputFileFormat; }
/// Set ClFlagsExtra::InputFileFormat to a new value
void setInputFileFormat(llvm::NaClFileFormat NewValue) {
InputFileFormat = NewValue;
}
/// Get the value of ClFlagsExtra::AppName
const IceString &getAppName() const { return AppName; }
/// Set ClFlagsExtra::AppName to a new value
void setAppName(const IceString &NewValue) { AppName = NewValue; }
/// Get the value of ClFlagsExtra::IRFilename
const IceString &getIRFilename() const { return IRFilename; }
/// Set ClFlagsExtra::IRFilename to a new value
void setIRFilename(const IceString &NewValue) { IRFilename = NewValue; }
/// Get the value of ClFlagsExtra::LogFilename
const IceString &getLogFilename() const { return LogFilename; }
/// Set ClFlagsExtra::LogFilename to a new value
void setLogFilename(const IceString &NewValue) { LogFilename = NewValue; }
/// Get the value of ClFlagsExtra::OutputFilename
const IceString &getOutputFilename() const { return OutputFilename; }
/// Set ClFlagsExtra::OutputFilename to a new value
void setOutputFilename(const IceString &NewValue) {
OutputFilename = NewValue;
}
private:
/// see anonymous_namespace{IceClFlags.cpp}::AlwaysExitSuccess
bool AlwaysExitSuccess = false;
/// see anonymous_namespace{IceClFlags.cpp}::BitcodeAsText
bool BitcodeAsText = false;
/// see anonymous_namespace{IceClFlags.cpp}::BuildOnRead
bool BuildOnRead = false;
/// see anonymous_namespace{IceClFlags.cpp}::GenerateBuildAtts
bool GenerateBuildAtts = false;
/// see anonymous_namespace{IceClFlags.cpp}::LLVMVerboseErrors
bool LLVMVerboseErrors = false;
/// see anonymous_namespace{IceClFlags.cpp}::InputFileFormat
llvm::NaClFileFormat InputFileFormat = llvm::LLVMFormat;
/// see anonymous_namespace{IceClFlags.cpp}::AppName
IceString AppName = "";
/// see anonymous_namespace{IceClFlags.cpp}::IRFilename
IceString IRFilename = "";
/// see anonymous_namespace{IceClFlags.cpp}::LogFilename
IceString LogFilename = "";
/// see anonymous_namespace{IceClFlags.cpp}::OutputFilename
IceString OutputFilename = "";
};
} // end of namespace Ice
#endif // SUBZERO_SRC_ICECLFLAGSEXTRA_H
......@@ -15,7 +15,6 @@
#include "IceCompileServer.h"
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceELFStreamer.h"
#include "IceGlobalContext.h"
#include "LinuxMallocProfiling.h"
......@@ -96,7 +95,7 @@ std::unique_ptr<Ostream> makeStream(const IceString &Filename,
}
ErrorCodes getReturnValue(ErrorCodes Val) {
if (GlobalContext::ExtraFlags.getAlwaysExitSuccess())
if (GlobalContext::Flags.getAlwaysExitSuccess())
return EC_None;
return Val;
}
......@@ -160,16 +159,14 @@ void CLCompileServer::run() {
}
ClFlags::parseFlags(argc, argv);
ClFlags &Flags = GlobalContext::Flags;
ClFlagsExtra &ExtraFlags = GlobalContext::ExtraFlags;
ClFlags::getParsedClFlags(Flags);
ClFlags::getParsedClFlagsExtra(ExtraFlags);
// Override report_fatal_error if we want to exit with 0 status.
if (ExtraFlags.getAlwaysExitSuccess())
if (Flags.getAlwaysExitSuccess())
llvm::install_fatal_error_handler(reportFatalErrorThenExitSuccess, this);
std::error_code EC;
std::unique_ptr<Ostream> Ls = makeStream(ExtraFlags.getLogFilename(), EC);
std::unique_ptr<Ostream> Ls = makeStream(Flags.getLogFilename(), EC);
if (EC) {
llvm::report_fatal_error("Unable to open log file");
}
......@@ -180,14 +177,14 @@ void CLCompileServer::run() {
std::unique_ptr<ELFStreamer> ELFStr;
switch (Flags.getOutFileType()) {
case FT_Elf: {
if (ExtraFlags.getOutputFilename() == "-") {
if (Flags.getOutputFilename() == "-" && !Flags.getGenerateBuildAtts()) {
*Ls << "Error: writing binary ELF to stdout is unsupported\n";
return transferErrorCode(getReturnValue(Ice::EC_Args));
}
std::unique_ptr<llvm::raw_fd_ostream> FdOs(new llvm::raw_fd_ostream(
ExtraFlags.getOutputFilename(), EC, llvm::sys::fs::F_None));
Flags.getOutputFilename(), EC, llvm::sys::fs::F_None));
if (EC) {
*Ls << "Failed to open output file: " << ExtraFlags.getOutputFilename()
*Ls << "Failed to open output file: " << Flags.getOutputFilename()
<< ":\n" << EC.message() << "\n";
return transferErrorCode(getReturnValue(Ice::EC_Args));
}
......@@ -199,9 +196,9 @@ void CLCompileServer::run() {
} break;
case FT_Asm:
case FT_Iasm: {
Os = makeStream(ExtraFlags.getOutputFilename(), EC);
Os = makeStream(Flags.getOutputFilename(), EC);
if (EC) {
*Ls << "Failed to open output file: " << ExtraFlags.getOutputFilename()
*Ls << "Failed to open output file: " << Flags.getOutputFilename()
<< ":\n" << EC.message() << "\n";
return transferErrorCode(getReturnValue(Ice::EC_Args));
}
......@@ -209,36 +206,36 @@ void CLCompileServer::run() {
} break;
}
if (BuildDefs::minimal() && ExtraFlags.getBitcodeAsText())
if (BuildDefs::minimal() && Flags.getBitcodeAsText())
llvm::report_fatal_error("Can't specify 'bitcode-as-text' flag in "
"minimal build");
IceString StrError;
std::unique_ptr<llvm::DataStreamer> InputStream(
(!BuildDefs::minimal() && ExtraFlags.getBitcodeAsText())
? TextDataStreamer::create(ExtraFlags.getIRFilename(), &StrError)
: llvm::getDataFileStreamer(ExtraFlags.getIRFilename(), &StrError));
(!BuildDefs::minimal() && Flags.getBitcodeAsText())
? TextDataStreamer::create(Flags.getIRFilename(), &StrError)
: llvm::getDataFileStreamer(Flags.getIRFilename(), &StrError));
if (!StrError.empty() || !InputStream) {
llvm::SMDiagnostic Err(ExtraFlags.getIRFilename(),
llvm::SourceMgr::DK_Error, StrError);
Err.print(ExtraFlags.getAppName().c_str(), *Ls);
llvm::SMDiagnostic Err(Flags.getIRFilename(), llvm::SourceMgr::DK_Error,
StrError);
Err.print(Flags.getAppName().c_str(), *Ls);
return transferErrorCode(getReturnValue(Ice::EC_Bitcode));
}
if (ExtraFlags.getGenerateBuildAtts()) {
if (Flags.getGenerateBuildAtts()) {
dumpBuildAttributes(*Os.get());
return transferErrorCode(getReturnValue(Ice::EC_None));
}
Ctx.reset(new GlobalContext(Ls.get(), Os.get(), Ls.get(), ELFStr.get()));
if (Ctx->getFlags().getNumTranslationThreads() != 0) {
std::thread CompileThread([this, &ExtraFlags, &InputStream]() {
std::thread CompileThread([this, &Flags, &InputStream]() {
Ctx->initParserThread();
getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream));
getCompiler().run(Flags, *Ctx.get(), std::move(InputStream));
});
CompileThread.join();
} else {
getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream));
getCompiler().run(Flags, *Ctx.get(), std::move(InputStream));
}
transferErrorCode(
getReturnValue(static_cast<ErrorCodes>(Ctx->getErrorStatus()->value())));
......
......@@ -22,7 +22,7 @@
#include "IceBuildDefs.h"
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceClFlags.h"
#include "IceConverter.h"
#include "IceELFObjectWriter.h"
#include "PNaClTranslator.h"
......@@ -57,7 +57,7 @@ bool llvmIRInput(const IceString &Filename) {
} // end of anonymous namespace
void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx,
void Compiler::run(const Ice::ClFlags &Flags, GlobalContext &Ctx,
std::unique_ptr<llvm::DataStreamer> &&InputStream) {
// The Minimal build (specifically, when dump()/emit() are not implemented)
// allows only --filetype=obj. Check here to avoid cryptic error messages
......@@ -77,9 +77,8 @@ void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx,
Ctx.startWorkerThreads();
std::unique_ptr<Translator> Translator;
const IceString &IRFilename = ExtraFlags.getIRFilename();
const bool BuildOnRead =
ExtraFlags.getBuildOnRead() && !llvmIRInput(IRFilename);
const IceString &IRFilename = Flags.getIRFilename();
const bool BuildOnRead = Flags.getBuildOnRead() && !llvmIRInput(IRFilename);
if (BuildOnRead) {
std::unique_ptr<PNaClTranslator> PTranslator(new PNaClTranslator(&Ctx));
std::unique_ptr<llvm::StreamingMemoryObject> MemObj(
......@@ -100,14 +99,14 @@ void Compiler::run(const Ice::ClFlagsExtra &ExtraFlags, GlobalContext &Ctx,
llvm::SMDiagnostic Err;
TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
llvm::DiagnosticHandlerFunction DiagnosticHandler =
ExtraFlags.getLLVMVerboseErrors()
Flags.getLLVMVerboseErrors()
? redirectNaClDiagnosticToStream(llvm::errs())
: nullptr;
std::unique_ptr<llvm::Module> Mod =
NaClParseIRFile(IRFilename, ExtraFlags.getInputFileFormat(), Err,
NaClParseIRFile(IRFilename, Flags.getInputFileFormat(), Err,
llvm::getGlobalContext(), DiagnosticHandler);
if (!Mod) {
Err.print(ExtraFlags.getAppName().c_str(), llvm::errs());
Err.print(Flags.getAppName().c_str(), llvm::errs());
Ctx.getErrorStatus()->assign(EC_Bitcode);
return;
}
......
......@@ -23,7 +23,7 @@ class DataStreamer;
namespace Ice {
class ClFlagsExtra;
class ClFlags;
/// A compiler driver. It may be called to handle a single compile request.
class Compiler {
......@@ -35,7 +35,7 @@ public:
/// Run the compiler with the given GlobalContext for compilation state. Upon
/// error, the Context's error status will be set.
void run(const ClFlagsExtra &ExtraFlags, GlobalContext &Ctx,
void run(const ClFlags &ExtraFlags, GlobalContext &Ctx,
std::unique_ptr<llvm::DataStreamer> &&InputStream);
};
......
......@@ -532,7 +532,7 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) {
// If the -reorder-pooled-constant option is set to true, we should shuffle
// the constants before we emit them.
if (Ctx.getFlags().shouldReorderPooledConstants() && !Pool.empty()) {
if (Ctx.getFlags().getReorderPooledConstants() && !Pool.empty()) {
// Use the constant's kind value as the salt for creating random number
// generator.
Operand::OperandKind K = (*Pool.begin())->getKind();
......
......@@ -18,7 +18,6 @@
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceDefs.h"
#include "IceELFObjectWriter.h"
#include "IceGlobalInits.h"
......@@ -427,7 +426,7 @@ void GlobalContext::lowerGlobals(const IceString &SectionSuffix) {
saveBlockInfoPtrs();
// If we need to shuffle the layout of global variables, shuffle them now.
if (getFlags().shouldReorderGlobalVariables()) {
if (getFlags().getReorderGlobalVariables()) {
// Create a random number generator for global variable reordering.
RandomNumberGenerator RNG(getFlags().getRandomSeed(),
RPE_GlobalVariableReordering);
......@@ -494,7 +493,7 @@ void GlobalContext::emitItems() {
bool EmitQueueEmpty = false;
const uint32_t ShuffleWindowSize =
std::max(1u, getFlags().getReorderFunctionsWindowSize());
bool Shuffle = Threaded && getFlags().shouldReorderFunctions();
bool Shuffle = Threaded && getFlags().getReorderFunctions();
// Create a random number generator for function reordering.
RandomNumberGenerator RNG(getFlags().getRandomSeed(), RPE_FunctionReordering);
......@@ -801,7 +800,7 @@ JumpTableDataList GlobalContext::getJumpTables() {
return A.getId() < B.getId();
});
if (getFlags().shouldReorderPooledConstants()) {
if (getFlags().getReorderPooledConstants()) {
// If reorder-pooled-constants option is set to true, we also shuffle the
// jump tables before emitting them.
......@@ -919,7 +918,6 @@ void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
}
ClFlags GlobalContext::Flags;
ClFlagsExtra GlobalContext::ExtraFlags;
TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx,
const IceString &FuncName) {
......
......@@ -492,7 +492,6 @@ public:
}
static ClFlags Flags;
static ClFlagsExtra ExtraFlags;
/// DisposeGlobalVariablesAfterLowering controls whether the memory used by
/// GlobaleVariables can be reclaimed right after they have been lowered.
......
......@@ -30,7 +30,6 @@
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wredundant-move"
#endif // __clang__
#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" // for NaClBitcodeRecord.
......
......@@ -27,6 +27,9 @@
#include "IceOperand.h"
#include "IceRegAlloc.h"
#include <string>
#include <vector>
#define TARGET_LOWERING_CLASS_FOR(t) Target_##t
// We prevent target-specific implementation details from leaking outside their
......@@ -179,14 +182,14 @@ void TargetLowering::filterTypeToRegisterSet(
RegNameToIndex[getRegName(RegNum)] = RegNum;
}
ClFlags::StringVector BadRegNames;
std::vector<std::string> BadRegNames;
// The processRegList function iterates across the RegNames vector. Each
// entry in the vector is a string of the form "<reg>" or "<class>:<reg>".
// The register class and register number are computed, and the corresponding
// bit is set in RegSet[][]. If "<class>:" is missing, then the bit is set
// for all classes.
auto processRegList = [&](const ClFlags::StringVector &RegNames,
auto processRegList = [&](const std::vector<std::string> &RegNames,
std::vector<SmallBitVector> &RegSet) {
for (const IceString &RegClassAndName : RegNames) {
IceString RClass;
......@@ -474,10 +477,10 @@ void TargetLowering::regAlloc(RegAllocKind Kind) {
if (hasFramePointer())
RegExclude |= RegSet_FramePointer;
SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude);
bool Repeat = (Kind == RAK_Global && Ctx->getFlags().shouldRepeatRegAlloc());
bool Repeat = (Kind == RAK_Global && Ctx->getFlags().getRepeatRegAlloc());
do {
LinearScan.init(Kind);
LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc());
LinearScan.scan(RegMask, Ctx->getFlags().getRandomizeRegisterAllocation());
if (!LinearScan.hasEvictions())
Repeat = false;
Kind = RAK_SecondChance;
......
......@@ -1032,7 +1032,7 @@ void TargetARM32::translateO2() {
Func->processAllocas(SortAndCombineAllocas);
Func->dump("After Alloca processing");
if (!Ctx->getFlags().getPhiEdgeSplit()) {
if (!Ctx->getFlags().getEnablePhiEdgeSplit()) {
// Lower Phi instructions.
Func->placePhiLoads();
if (Func->hasError())
......@@ -1100,7 +1100,7 @@ void TargetARM32::translateO2() {
copyRegAllocFromInfWeightVariable64On32(Func->getVariables());
Func->dump("After linear scan regalloc");
if (Ctx->getFlags().getPhiEdgeSplit()) {
if (Ctx->getFlags().getEnablePhiEdgeSplit()) {
Func->advancedPhiLowering();
Func->dump("After advanced Phi lowering");
}
......@@ -1129,7 +1129,7 @@ void TargetARM32::translateO2() {
Func->dump("After branch optimization");
// Nop insertion
if (Ctx->getFlags().shouldDoNopInsertion()) {
if (Ctx->getFlags().getShouldDoNopInsertion()) {
Func->doNopInsertion();
}
}
......@@ -1191,7 +1191,7 @@ void TargetARM32::translateOm1() {
Func->dump("After postLowerLegalization");
// Nop insertion
if (Ctx->getFlags().shouldDoNopInsertion()) {
if (Ctx->getFlags().getShouldDoNopInsertion()) {
Func->doNopInsertion();
}
}
......@@ -6803,7 +6803,7 @@ template <typename T> void emitConstantPool(GlobalContext *Ctx) {
<< "\n"
<< "\t.align\t" << Align << "\n";
if (Ctx->getFlags().shouldReorderPooledConstants()) {
if (Ctx->getFlags().getReorderPooledConstants()) {
// TODO(jpp): add constant pooling.
UnimplementedError(Ctx->getFlags());
}
......
......@@ -137,7 +137,7 @@ void TargetMIPS32::translateO2() {
Func->processAllocas(SortAndCombineAllocas);
Func->dump("After Alloca processing");
if (!Ctx->getFlags().getPhiEdgeSplit()) {
if (!Ctx->getFlags().getEnablePhiEdgeSplit()) {
// Lower Phi instructions.
Func->placePhiLoads();
if (Func->hasError())
......@@ -200,7 +200,7 @@ void TargetMIPS32::translateO2() {
return;
Func->dump("After linear scan regalloc");
if (Ctx->getFlags().getPhiEdgeSplit()) {
if (Ctx->getFlags().getEnablePhiEdgeSplit()) {
Func->advancedPhiLowering();
Func->dump("After advanced Phi lowering");
}
......@@ -222,7 +222,7 @@ void TargetMIPS32::translateO2() {
Func->dump("After branch optimization");
// Nop insertion
if (Ctx->getFlags().shouldDoNopInsertion()) {
if (Ctx->getFlags().getShouldDoNopInsertion()) {
Func->doNopInsertion();
}
}
......@@ -267,7 +267,7 @@ void TargetMIPS32::translateOm1() {
Func->dump("After stack frame mapping");
// Nop insertion
if (Ctx->getFlags().shouldDoNopInsertion()) {
if (Ctx->getFlags().getShouldDoNopInsertion()) {
Func->doNopInsertion();
}
}
......
......@@ -391,7 +391,7 @@ template <typename TraitsType> void TargetX86Base<TraitsType>::translateO2() {
Func->processAllocas(SortAndCombineAllocas);
Func->dump("After Alloca processing");
if (!Ctx->getFlags().getPhiEdgeSplit()) {
if (!Ctx->getFlags().getEnablePhiEdgeSplit()) {
// Lower Phi instructions.
Func->placePhiLoads();
if (Func->hasError())
......@@ -477,7 +477,7 @@ template <typename TraitsType> void TargetX86Base<TraitsType>::translateO2() {
return;
Func->dump("After linear scan regalloc");
if (Ctx->getFlags().getPhiEdgeSplit()) {
if (Ctx->getFlags().getEnablePhiEdgeSplit()) {
Func->advancedPhiLowering();
Func->dump("After advanced Phi lowering");
}
......@@ -7303,7 +7303,7 @@ void TargetDataX86<TraitsType>::emitConstantPool(GlobalContext *Ctx) {
// If reorder-pooled-constants option is set to true, we need to shuffle the
// constant pool before emitting it.
if (Ctx->getFlags().shouldReorderPooledConstants() && !Pool.empty()) {
if (Ctx->getFlags().getReorderPooledConstants() && !Pool.empty()) {
// Use the constant's kind value as the salt for creating random number
// generator.
Operand::OperandKind K = (*Pool.begin())->getKind();
......
......@@ -22,7 +22,6 @@
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wredundant-move"
#endif // __clang__
#include "llvm/IR/DerivedTypes.h"
......
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