Subzero: Reduce the amount of #ifdef'd code.
Try to make most #ifdef'd code be compiled under all configurations,
to catch code rot earlier. When #ifdef code is required, try to use
it only to guard trivial code like "return;".
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1197863003
diff --git a/src/IceAssembler.cpp b/src/IceAssembler.cpp
index e160612..757c3ea 100644
--- a/src/IceAssembler.cpp
+++ b/src/IceAssembler.cpp
@@ -45,15 +45,11 @@
return F;
}
-#ifndef NDEBUG
-AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) {
- if (buffer->cursor() >= buffer->limit())
- buffer->extendCapacity();
+void AssemblerBuffer::EnsureCapacity::validate(AssemblerBuffer *buffer) {
// In debug mode, we save the assembler buffer along with the gap
// size before we start emitting to the buffer. This allows us to
// check that any single generated instruction doesn't overflow the
// limit implied by the minimum gap size.
- Buffer = buffer;
Gap = computeGap();
// Make sure that extending the capacity leaves a big enough gap
// for any kind of instruction.
@@ -69,9 +65,9 @@
// Make sure the generated instruction doesn't take up more
// space than the minimum gap.
intptr_t delta = Gap - computeGap();
+ (void)delta;
assert(delta <= kMinimumGap);
}
-#endif // !NDEBUG
AssemblerBuffer::AssemblerBuffer(Assembler &Asm) : Assemblr(Asm) {
const intptr_t OneKB = 1024;
@@ -79,9 +75,7 @@
Contents = NewContents(Assemblr, kInitialBufferCapacity);
Cursor = Contents;
Limit = computeLimit(Contents, kInitialBufferCapacity);
-#ifndef NDEBUG
HasEnsuredCapacity = false;
-#endif // !NDEBUG
// Verify internal state.
assert(capacity() == kInitialBufferCapacity);
diff --git a/src/IceAssembler.h b/src/IceAssembler.h
index de4dd86..b6ddf08 100644
--- a/src/IceAssembler.h
+++ b/src/IceAssembler.h
@@ -63,49 +63,42 @@
intptr_t size() const { return Cursor - Contents; }
uintptr_t contents() const { return Contents; }
-// To emit an instruction to the assembler buffer, the EnsureCapacity helper
-// must be used to guarantee that the underlying data area is big enough to
-// hold the emitted instruction. Usage:
-//
-// AssemblerBuffer buffer;
-// AssemblerBuffer::EnsureCapacity ensured(&buffer);
-// ... emit bytes for single instruction ...
+ // To emit an instruction to the assembler buffer, the EnsureCapacity helper
+ // must be used to guarantee that the underlying data area is big enough to
+ // hold the emitted instruction. Usage:
+ //
+ // AssemblerBuffer buffer;
+ // AssemblerBuffer::EnsureCapacity ensured(&buffer);
+ // ... emit bytes for single instruction ...
-#ifndef NDEBUG
class EnsureCapacity {
EnsureCapacity(const EnsureCapacity &) = delete;
EnsureCapacity &operator=(const EnsureCapacity &) = delete;
public:
- explicit EnsureCapacity(AssemblerBuffer *Buffer);
+ explicit EnsureCapacity(AssemblerBuffer *Buffer) : Buffer(Buffer) {
+ if (Buffer->cursor() >= Buffer->limit())
+ Buffer->extendCapacity();
+ if (BuildDefs::asserts())
+ validate(Buffer);
+ }
~EnsureCapacity();
private:
AssemblerBuffer *Buffer;
- intptr_t Gap;
+ intptr_t Gap = 0;
+ void validate(AssemblerBuffer *Buffer);
intptr_t computeGap() { return Buffer->capacity() - Buffer->size(); }
};
bool HasEnsuredCapacity;
- bool hasEnsuredCapacity() const { return HasEnsuredCapacity; }
-#else // NDEBUG
- class EnsureCapacity {
- EnsureCapacity(const EnsureCapacity &) = delete;
- EnsureCapacity &operator=(const EnsureCapacity &) = delete;
-
- public:
- explicit EnsureCapacity(AssemblerBuffer *Buffer) {
- if (Buffer->cursor() >= Buffer->limit())
- Buffer->extendCapacity();
- }
- };
-
- // When building the C++ tests, assertion code is enabled. To allow
- // asserting that the user of the assembler buffer has ensured the
- // capacity needed for emitting, we add a dummy method in non-debug mode.
- bool hasEnsuredCapacity() const { return true; }
-#endif // NDEBUG
+ bool hasEnsuredCapacity() const {
+ if (BuildDefs::asserts())
+ return HasEnsuredCapacity;
+ // Disable the actual check in non-debug mode.
+ return true;
+ }
// Returns the position in the instruction stream.
intptr_t getPosition() const { return Cursor - Contents; }
@@ -124,7 +117,7 @@
// The limit is set to kMinimumGap bytes before the end of the data area.
// This leaves enough space for the longest possible instruction and allows
// for a single, fast space check per instruction.
- static const intptr_t kMinimumGap = 32;
+ static constexpr intptr_t kMinimumGap = 32;
uintptr_t Contents;
uintptr_t Cursor;
diff --git a/src/IceAssemblerX8632.cpp b/src/IceAssemblerX8632.cpp
index ecb6c5b..a864b17 100644
--- a/src/IceAssemblerX8632.cpp
+++ b/src/IceAssemblerX8632.cpp
@@ -32,14 +32,14 @@
}
AssemblerX8632::~AssemblerX8632() {
-#ifndef NDEBUG
- for (const Label *Label : CfgNodeLabels) {
- Label->FinalCheck();
+ if (BuildDefs::asserts()) {
+ for (const Label *Label : CfgNodeLabels) {
+ Label->FinalCheck();
+ }
+ for (const Label *Label : LocalLabels) {
+ Label->FinalCheck();
+ }
}
- for (const Label *Label : LocalLabels) {
- Label->FinalCheck();
- }
-#endif
}
void AssemblerX8632::alignFunction() {
diff --git a/src/IceAssemblerX8632.h b/src/IceAssemblerX8632.h
index 48a5f0a..132e72d 100644
--- a/src/IceAssemblerX8632.h
+++ b/src/IceAssemblerX8632.h
@@ -252,11 +252,11 @@
public:
Label() {
-#ifndef NDEBUG
- for (int i = 0; i < kMaxUnresolvedBranches; i++) {
- unresolved_near_positions_[i] = -1;
+ if (BuildDefs::asserts()) {
+ for (int i = 0; i < kMaxUnresolvedBranches; i++) {
+ unresolved_near_positions_[i] = -1;
+ }
}
-#endif // !NDEBUG
}
~Label() = default;
@@ -321,7 +321,7 @@
unresolved_near_positions_[num_unresolved_++] = position;
}
- static const int kMaxUnresolvedBranches = 20;
+ static constexpr int kMaxUnresolvedBranches = 20;
intptr_t position_ = 0;
intptr_t num_unresolved_ = 0;
diff --git a/src/IceBuildDefs.h b/src/IceBuildDefs.h
new file mode 100644
index 0000000..6af41f1
--- /dev/null
+++ b/src/IceBuildDefs.h
@@ -0,0 +1,50 @@
+//===- subzero/src/IceBuildDefs.h - Translator build defines ----*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines constexpr functions to query various #define values.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICEBUILDDEFS_H
+#define SUBZERO_SRC_ICEBUILDDEFS_H
+
+namespace Ice {
+namespace BuildDefs {
+
+// The ALLOW_* etc. symbols must be #defined to zero or non-zero.
+constexpr bool disableIrGen() { return ALLOW_DISABLE_IR_GEN; }
+constexpr bool dump() { return ALLOW_DUMP; }
+constexpr bool llvmCl() { return ALLOW_LLVM_CL; }
+constexpr bool llvmIr() { return ALLOW_LLVM_IR; }
+constexpr bool llvmIrAsInput() { return ALLOW_LLVM_IR_AS_INPUT; }
+constexpr bool minimal() { return ALLOW_MINIMAL_BUILD; }
+constexpr bool textualBitcode() { return INPUT_IS_TEXTUAL_BITCODE; }
+
+// NDEBUG can be undefined, or defined to something arbitrary.
+constexpr bool asserts() {
+#ifdef NDEBUG
+ return false;
+#else // !NDEBUG
+ return true;
+#endif // !NDEBUG
+}
+
+// ALLOW_EXTRA_VALIDATION can be undefined, or defined to something non-zero.
+constexpr bool extraValidation() {
+#if ALLOW_EXTRA_VALIDATION
+ return true;
+#else // !ALLOW_EXTRA_VALIDATION
+ return false;
+#endif // !ALLOW_EXTRA_VALIDATION
+}
+
+} // end of namespace BuildDefs
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICEBUILDDEFS_H
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 72c9120..659f460 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -143,7 +143,7 @@
// FunctionTimer conditionally pushes/pops a TimerMarker if
// TimeEachFunction is enabled.
std::unique_ptr<TimerMarker> FunctionTimer;
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
const IceString &TimingFocusOn =
getContext()->getFlags().getTimingFocusOn();
const IceString &Name = getFunctionName();
@@ -532,7 +532,7 @@
// the target lowering class.
void Cfg::emitTextHeader(const IceString &MangledName, GlobalContext *Ctx,
const Assembler *Asm) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
Str << "\t.text\n";
@@ -551,7 +551,7 @@
}
void Cfg::emit() {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
TimerMarker T(TimerStack::TT_emit, this);
if (Ctx->getFlags().getDecorateAsm()) {
@@ -579,7 +579,7 @@
// Dumps the IR with an optional introductory message.
void Cfg::dump(const IceString &Message) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (!isVerbose())
return;
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index ddadc57..bdb105a 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -222,7 +222,7 @@
// operand list.
CfgNode *CfgNode::splitIncomingEdge(CfgNode *Pred, SizeT EdgeIndex) {
CfgNode *NewNode = Func->makeNode();
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" +
std::to_string(EdgeIndex));
// The new node is added to the end of the node list, and will later
@@ -437,7 +437,7 @@
if (Desc[J].NumPred && sameVarOrReg(Dest, OtherSrc)) {
SizeT VarNum = Func->getNumVariables();
Variable *Tmp = Func->makeVariable(OtherSrc->getType());
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Tmp->setName(Func, "__split_" + std::to_string(VarNum));
Assignments.push_back(InstAssign::create(Func, Tmp, OtherSrc));
Desc[J].Src = Tmp;
@@ -609,7 +609,7 @@
// entry.
bool IsEntry = (Func->getEntryNode() == this);
if (!(IsEntry || Live == LiveOrig)) {
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
// This is a fatal liveness consistency error. Print some
// diagnostics and abort.
Ostream &Str = Func->getContext()->getStrDump();
@@ -782,7 +782,7 @@
void emitRegisterUsage(Ostream &Str, const Cfg *Func, const CfgNode *Node,
bool IsLiveIn, std::vector<SizeT> &LiveRegCount) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Liveness *Liveness = Func->getLiveness();
const LivenessBV *Live;
@@ -824,7 +824,7 @@
void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
std::vector<SizeT> &LiveRegCount) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
bool First = true;
Variable *Dest = Instr->getDest();
@@ -860,7 +860,7 @@
}
void updateStats(Cfg *Func, const Inst *I) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
// Update emitted instruction count, plus fill/spill count for
// Variable operands without a physical register.
@@ -882,7 +882,7 @@
} // end of anonymous namespace
void CfgNode::emit(Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Func->setCurrentNode(this);
Ostream &Str = Func->getContext()->getStrEmit();
@@ -1163,7 +1163,7 @@
}
void CfgNode::dump(Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Func->setCurrentNode(this);
Ostream &Str = Func->getContext()->getStrDump();
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp
index 282d014..7a6eaef 100644
--- a/src/IceClFlags.cpp
+++ b/src/IceClFlags.cpp
@@ -334,7 +334,7 @@
Ice::VerboseMask VMask = Ice::IceV_None;
// Don't generate verbose messages if routines
// to dump messages are not available.
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
for (unsigned i = 0; i != VerboseList.size(); ++i)
VMask |= VerboseList[i];
}
diff --git a/src/IceClFlags.h b/src/IceClFlags.h
index 3b9b006..b677e1c 100644
--- a/src/IceClFlags.h
+++ b/src/IceClFlags.h
@@ -55,14 +55,14 @@
void setDisableInternal(bool NewValue) { DisableInternal = NewValue; }
bool getDisableIRGeneration() const {
- return ALLOW_DISABLE_IR_GEN && DisableIRGeneration;
+ return BuildDefs::disableIrGen() && DisableIRGeneration;
}
void setDisableIRGeneration(bool NewValue) { DisableIRGeneration = NewValue; }
bool getDisableTranslation() const { return DisableTranslation; }
void setDisableTranslation(bool NewValue) { DisableTranslation = NewValue; }
- bool getDumpStats() const { return ALLOW_DUMP && DumpStats; }
+ bool getDumpStats() const { return BuildDefs::dump() && DumpStats; }
void setDumpStats(bool NewValue) { DumpStats = NewValue; }
bool getEnableBlockProfile() const { return EnableBlockProfile; }
@@ -74,7 +74,7 @@
bool getGenerateUnitTestMessages() const {
// Note: If dump routines have been turned off, the error messages
// will not be readable. Hence, turn off.
- return !ALLOW_DUMP || GenerateUnitTestMessages;
+ return !BuildDefs::dump() || GenerateUnitTestMessages;
}
void setGenerateUnitTestMessages(bool NewValue) {
GenerateUnitTestMessages = NewValue;
@@ -97,7 +97,9 @@
SubzeroTimingEnabled = NewValue;
}
- bool getTimeEachFunction() const { return ALLOW_DUMP && TimeEachFunction; }
+ bool getTimeEachFunction() const {
+ return BuildDefs::dump() && TimeEachFunction;
+ }
void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; }
bool getUseSandboxing() const { return UseSandboxing; }
@@ -131,7 +133,7 @@
}
VerboseMask getVerbose() const {
- return ALLOW_DUMP ? VMask : (VerboseMask)IceV_None;
+ return BuildDefs::dump() ? VMask : (VerboseMask)IceV_None;
}
void setVerbose(VerboseMask NewValue) { VMask = NewValue; }
diff --git a/src/IceCompileServer.cpp b/src/IceCompileServer.cpp
index 4456343..406d064 100644
--- a/src/IceCompileServer.cpp
+++ b/src/IceCompileServer.cpp
@@ -35,9 +35,9 @@
namespace {
-static_assert(
-!(INPUT_IS_TEXTUAL_BITCODE && PNACL_BROWSER_TRANSLATOR),
- "Can not define INPUT_IS_TEXTUAL_BITCODE when building browswer translator");
+static_assert(!(BuildDefs::textualBitcode() && PNACL_BROWSER_TRANSLATOR),
+ "Can not define INPUT_IS_TEXTUAL_BITCODE when building browswer "
+ "translator");
// Define a SmallVector backed buffer as a data stream, so that it
// can hold the generated binary version of the textual bitcode in the
@@ -48,6 +48,7 @@
~TextDataStreamer() final = default;
static TextDataStreamer *create(const IceString &Filename, std::string *Err);
size_t GetBytes(unsigned char *Buf, size_t Len) final;
+
private:
llvm::SmallVector<char, 1024> BitcodeBuffer;
size_t Cursor = 0;
@@ -98,7 +99,7 @@
} // end of anonymous namespace
void CLCompileServer::run() {
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
llvm::sys::PrintStackTraceOnErrorSignal();
}
ClFlags::parseFlags(argc, argv);
@@ -148,10 +149,9 @@
IceString StrError;
std::unique_ptr<llvm::DataStreamer> InputStream(
- INPUT_IS_TEXTUAL_BITCODE
- ? TextDataStreamer::create(ExtraFlags.getIRFilename(), &StrError)
- : llvm::getDataFileStreamer(ExtraFlags.getIRFilename(), &StrError)
- );
+ BuildDefs::textualBitcode()
+ ? TextDataStreamer::create(ExtraFlags.getIRFilename(), &StrError)
+ : llvm::getDataFileStreamer(ExtraFlags.getIRFilename(), &StrError));
if (!StrError.empty() || !InputStream) {
llvm::SMDiagnostic Err(ExtraFlags.getIRFilename(),
llvm::SourceMgr::DK_Error, StrError);
diff --git a/src/IceCompiler.cpp b/src/IceCompiler.cpp
index 7619b17..fb116e6 100644
--- a/src/IceCompiler.cpp
+++ b/src/IceCompiler.cpp
@@ -36,13 +36,14 @@
struct {
const char *FlagName;
int FlagValue;
-} ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP},
- {"disable_ir_gen", ALLOW_DISABLE_IR_GEN},
- {"llvm_cl", ALLOW_LLVM_CL},
- {"llvm_ir", ALLOW_LLVM_IR},
- {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT},
- {"minimal_build", ALLOW_MINIMAL_BUILD},
- {"browser_mode", PNACL_BROWSER_TRANSLATOR}};
+} ConditionalBuildAttributes[] = {
+ {"dump", BuildDefs::dump()},
+ {"disable_ir_gen", BuildDefs::disableIrGen()},
+ {"llvm_cl", BuildDefs::llvmCl()},
+ {"llvm_ir", BuildDefs::llvmIr()},
+ {"llvm_ir_as_input", BuildDefs::llvmIrAsInput()},
+ {"minimal_build", BuildDefs::minimal()},
+ {"browser_mode", PNACL_BROWSER_TRANSLATOR}};
// Validates values of build attributes. Prints them to Stream if
// Stream is non-null.
@@ -85,7 +86,7 @@
if (ExtraFlags.getGenerateBuildAtts())
return Ctx.getErrorStatus()->assign(EC_None);
- if (!ALLOW_DISABLE_IR_GEN && Ctx.getFlags().getDisableIRGeneration()) {
+ if (!BuildDefs::disableIrGen() && Ctx.getFlags().getDisableIRGeneration()) {
Ctx.getStrDump() << "Error: Build doesn't allow --no-ir-gen when not "
<< "ALLOW_DISABLE_IR_GEN!\n";
return Ctx.getErrorStatus()->assign(EC_Args);
@@ -95,7 +96,7 @@
const std::string LLSuffix = ".ll";
const IceString &IRFilename = ExtraFlags.getIRFilename();
bool BuildOnRead = ExtraFlags.getBuildOnRead();
- if (ALLOW_LLVM_IR_AS_INPUT && IRFilename.length() >= LLSuffix.length() &&
+ if (BuildDefs::llvmIrAsInput() && IRFilename.length() >= LLSuffix.length() &&
IRFilename.compare(IRFilename.length() - LLSuffix.length(),
LLSuffix.length(), LLSuffix) == 0)
BuildOnRead = false;
@@ -112,7 +113,7 @@
new llvm::StreamingMemoryObjectImpl(InputStream.release()));
PTranslator->translate(IRFilename, std::move(MemObj));
Translator.reset(PTranslator.release());
- } else if (ALLOW_LLVM_IR) {
+ } else if (BuildDefs::llvmIr()) {
if (PNACL_BROWSER_TRANSLATOR) {
Ctx.getStrDump()
<< "non BuildOnRead is not supported w/ PNACL_BROWSER_TRANSLATOR\n";
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp
index baa8eeb..afffb99 100644
--- a/src/IceConverter.cpp
+++ b/src/IceConverter.cpp
@@ -167,7 +167,7 @@
return nullptr;
if (VarMap.find(V) == VarMap.end()) {
VarMap[V] = Func->makeVariable(IceTy);
- if (ALLOW_DUMP)
+ if (Ice::BuildDefs::dump())
VarMap[V]->setName(Func.get(), V->getName());
}
return VarMap[V];
@@ -180,7 +180,7 @@
Ice::CfgNode *mapBasicBlockToNode(const BasicBlock *BB) {
if (NodeMap.find(BB) == NodeMap.end()) {
NodeMap[BB] = Func->makeNode();
- if (ALLOW_DUMP)
+ if (Ice::BuildDefs::dump())
NodeMap[BB]->setName(BB->getName());
}
return NodeMap[BB];
diff --git a/src/IceDefs.h b/src/IceDefs.h
index 4531275..583b34e 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -1,4 +1,4 @@
-//===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===//
+//===- subzero/src/IceDefs.h - Common Subzero declarations ------*- C++ -*-===//
//
// The Subzero Code Generator
//
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file declares various useful types and classes that have
-// widespread use across Subzero. Every Subzero source file is
-// expected to include IceDefs.h.
+// This file declares various useful types and classes that have widespread use
+// across Subzero. Every Subzero source file is expected to include IceDefs.h.
//
//===----------------------------------------------------------------------===//
@@ -41,6 +40,7 @@
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
+#include "IceBuildDefs.h" // TODO(stichnot): move into individual files
#include "IceTLS.h"
namespace Ice {
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 0549754..2a86a17 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -390,8 +390,9 @@
Var->getInitializers()) {
switch (Init->getKind()) {
case VariableDeclaration::Initializer::DataInitializerKind: {
- const auto Data = llvm::cast<VariableDeclaration::DataInitializer>(
- Init.get())->getContents();
+ const auto Data =
+ llvm::cast<VariableDeclaration::DataInitializer>(Init.get())
+ ->getContents();
Section->appendData(Str, llvm::StringRef(Data.data(), Data.size()));
break;
}
diff --git a/src/IceFixups.cpp b/src/IceFixups.cpp
index b6adf84..0e884da 100644
--- a/src/IceFixups.cpp
+++ b/src/IceFixups.cpp
@@ -47,7 +47,7 @@
}
void AssemblerFixup::emit(GlobalContext *Ctx, RelocOffsetT BaseOffset) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
if (isNullSymbol())
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index d4543c2..2f04535 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -198,7 +198,7 @@
};
void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
#define X(str, tag) \
Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n";
@@ -240,7 +240,7 @@
AllThreadContexts.push_back(MyTLS);
ICE_TLS_SET_FIELD(TLS, MyTLS);
// Pre-register built-in stack names.
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
// TODO(stichnot): There needs to be a strong relationship between
// the newTimerStackID() return values and TSK_Default/TSK_Funcs.
newTimerStackID("Total across all functions");
@@ -369,7 +369,7 @@
if (getFlags().getOutFileType() == FT_Elf) {
getObjectWriter()->writeInitialELFHeader();
} else {
- if (!ALLOW_DUMP) {
+ if (!BuildDefs::dump()) {
getStrError() << "emitFileHeader for non-ELF";
getErrorStatus()->assign(EC_Translation);
}
@@ -381,8 +381,8 @@
void GlobalContext::lowerGlobals(const IceString &SectionSuffix) {
TimerMarker T(TimerStack::TT_emitGlobalInitializers, this);
- const bool DumpGlobalVariables =
- ALLOW_DUMP && Flags.getVerbose() && Flags.getVerboseFocusOn().empty();
+ const bool DumpGlobalVariables = BuildDefs::dump() && Flags.getVerbose() &&
+ Flags.getVerboseFocusOn().empty();
if (DumpGlobalVariables) {
OstreamLocker L(this);
Ostream &Stream = getStrDump();
@@ -473,7 +473,7 @@
}
} break;
case EmitterWorkItem::WI_Cfg: {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
llvm::report_fatal_error("WI_Cfg work item created inappropriately");
lowerGlobalsIfNoCodeHasBeenSeen();
accumulateGlobals(Item->getGlobalInits());
@@ -596,7 +596,7 @@
// _Z3barxyz ==> ZN6Prefix3barExyz
// An unmangled, extern "C" style name, gets a simple prefix:
// bar ==> Prefixbar
- if (!ALLOW_DUMP || getFlags().getTestPrefix().empty())
+ if (!BuildDefs::dump() || getFlags().getTestPrefix().empty())
return Name;
const IceString &TestPrefix = getFlags().getTestPrefix();
@@ -815,7 +815,7 @@
}
TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return 0;
auto Timers = getTimers();
TimerStackIdT NewID = Timers->size();
@@ -894,7 +894,7 @@
}
void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
auto Timers = getTimers();
assert(Timers->size() > StackID);
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h
index 8854f69..88ee731 100644
--- a/src/IceGlobalContext.h
+++ b/src/IceGlobalContext.h
@@ -115,7 +115,7 @@
// timers, in the same order, with the same names, but initially
// empty of timing data.
void initInto(TimerList &Dest) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Dest.clear();
for (const TimerStack &Stack : *this) {
@@ -123,7 +123,7 @@
}
}
void mergeFrom(TimerList &Src) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(size() == Src.size());
size_type i = 0;
@@ -243,7 +243,7 @@
// Reset stats at the beginning of a function.
void resetStats() {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
ICE_TLS_GET_FIELD(TLS)->StatsFunction.reset();
}
void dumpStats(const IceString &Name, bool Final = false);
@@ -380,12 +380,12 @@
}
EmitterThreads.clear();
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
auto Timers = getTimers();
for (ThreadContext *TLS : AllThreadContexts)
Timers->mergeFrom(TLS->Timers);
}
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
// Do a separate loop over AllThreadContexts to avoid holding
// two locks at once.
auto Stats = getStatsCumulative();
@@ -560,19 +560,19 @@
TimerMarker(TimerIdT ID, GlobalContext *Ctx,
TimerStackIdT StackID = GlobalContext::TSK_Default)
: ID(ID), Ctx(Ctx), StackID(StackID) {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
push();
}
TimerMarker(TimerIdT ID, const Cfg *Func,
TimerStackIdT StackID = GlobalContext::TSK_Default)
: ID(ID), Ctx(nullptr), StackID(StackID) {
// Ctx gets set at the beginning of pushCfg().
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
pushCfg(Func);
}
~TimerMarker() {
- if (ALLOW_DUMP && Active)
+ if (BuildDefs::dump() && Active)
Ctx->popTimer(ID, StackID);
}
diff --git a/src/IceGlobalInits.cpp b/src/IceGlobalInits.cpp
index 2ee5e62..f9c57639 100644
--- a/src/IceGlobalInits.cpp
+++ b/src/IceGlobalInits.cpp
@@ -27,7 +27,7 @@
void dumpLinkage(Ice::Ostream &Stream,
llvm::GlobalValue::LinkageTypes Linkage) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
switch (Linkage) {
case llvm::GlobalValue::ExternalLinkage:
@@ -46,7 +46,7 @@
}
void dumpCallingConv(Ice::Ostream &, llvm::CallingConv::ID CallingConv) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
if (CallingConv == llvm::CallingConv::C)
return;
@@ -61,13 +61,13 @@
namespace Ice {
void FunctionDeclaration::dumpType(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << Signature;
}
void FunctionDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
if (IsProto)
Stream << "declare ";
@@ -87,7 +87,7 @@
}
void VariableDeclaration::dumpType(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
if (Initializers->size() == 1) {
Initializers->front()->dumpType(Stream);
@@ -107,7 +107,7 @@
}
void VariableDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << "@"
<< ((Ctx && !getSuppressMangling()) ? Ctx->mangleName(Name) : Name)
@@ -140,14 +140,14 @@
}
void VariableDeclaration::Initializer::dumpType(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]";
}
void VariableDeclaration::DataInitializer::dump(GlobalContext *,
Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
dumpType(Stream);
Stream << " c\"";
@@ -165,21 +165,21 @@
void VariableDeclaration::ZeroInitializer::dump(GlobalContext *,
Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
dumpType(Stream);
Stream << " zeroinitializer";
}
void VariableDeclaration::RelocInitializer::dumpType(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << Ice::IceType_i32;
}
void VariableDeclaration::RelocInitializer::dump(GlobalContext *Ctx,
Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
if (Offset != 0) {
dumpType(Stream);
diff --git a/src/IceGlobalInits.h b/src/IceGlobalInits.h
index cd66500..387c0e3 100644
--- a/src/IceGlobalInits.h
+++ b/src/IceGlobalInits.h
@@ -66,7 +66,7 @@
/// Prints out the global declaration.
virtual void dump(GlobalContext *Ctx, Ostream &Stream) const = 0;
void dump(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
GlobalContext *const Ctx = nullptr;
dump(Ctx, Stream);
@@ -153,7 +153,7 @@
virtual SizeT getNumBytes() const = 0;
virtual void dump(GlobalContext *Ctx, Ostream &Stream) const = 0;
void dump(Ostream &Stream) const {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
dump(nullptr, Stream);
}
virtual void dumpType(Ostream &Stream) const;
diff --git a/src/IceInst.cpp b/src/IceInst.cpp
index 74627ad..3547e07 100644
--- a/src/IceInst.cpp
+++ b/src/IceInst.cpp
@@ -398,7 +398,7 @@
Variable *Dest = getDest();
assert(Dest);
Variable *NewSrc = Func->makeVariable(Dest->getType());
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
NewSrc->setName(Func, Dest->getName(Func) + "_phi");
this->Dest = NewSrc;
return InstAssign::create(Func, Dest, NewSrc);
@@ -511,7 +511,7 @@
// ======================== Dump routines ======================== //
void Inst::dumpDecorated(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (!Func->isVerbose(IceV_Deleted) && (isDeleted() || isRedundantAssign()))
@@ -534,7 +534,7 @@
}
void Inst::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -543,7 +543,7 @@
}
void Inst::dumpExtras(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
bool First = true;
@@ -571,7 +571,7 @@
}
void Inst::dumpSources(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
for (SizeT I = 0; I < getSrcSize(); ++I) {
@@ -582,7 +582,7 @@
}
void Inst::emitSources(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
for (SizeT I = 0; I < getSrcSize(); ++I) {
@@ -593,14 +593,14 @@
}
void Inst::dumpDest(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (getDest())
getDest()->dump(Func);
}
void InstAlloca::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -611,7 +611,7 @@
}
void InstArithmetic::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -621,7 +621,7 @@
}
void InstAssign::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -630,7 +630,7 @@
}
void InstBr::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -644,7 +644,7 @@
}
void InstCall::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (getDest()) {
@@ -677,7 +677,7 @@
}
void InstCast::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -688,7 +688,7 @@
}
void InstIcmp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -698,7 +698,7 @@
}
void InstExtractElement::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -711,7 +711,7 @@
}
void InstInsertElement::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -727,7 +727,7 @@
}
void InstFcmp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -737,7 +737,7 @@
}
void InstLoad::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -748,7 +748,7 @@
}
void InstStore::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = getData()->getType();
@@ -767,7 +767,7 @@
}
void InstSwitch::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = getComparison()->getType();
@@ -782,7 +782,7 @@
}
void InstPhi::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -797,7 +797,7 @@
}
void InstRet::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = hasRetValue() ? getRetValue()->getType() : IceType_void;
@@ -809,7 +809,7 @@
}
void InstSelect::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -825,14 +825,14 @@
}
void InstUnreachable::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "unreachable";
}
void InstBundleLock::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t.bundle_lock";
@@ -846,7 +846,7 @@
}
void InstBundleLock::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "bundle_lock";
@@ -860,21 +860,21 @@
}
void InstBundleUnlock::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t.bundle_unlock";
}
void InstBundleUnlock::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "bundle_unlock";
}
void InstFakeDef::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
// Go ahead and "emit" these for now, since they are relatively
// rare.
@@ -886,7 +886,7 @@
}
void InstFakeDef::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -897,7 +897,7 @@
void InstFakeUse::emit(const Cfg *Func) const { (void)Func; }
void InstFakeUse::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "use.pseudo ";
@@ -907,7 +907,7 @@
void InstFakeKill::emit(const Cfg *Func) const { (void)Func; }
void InstFakeKill::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (Linked->isDeleted())
@@ -916,7 +916,7 @@
}
void InstTarget::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "[TARGET] ";
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index 4ba27e9..9c0cc0d 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -97,7 +97,7 @@
void InstARM32Pred::emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst,
const Cfg *Func) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2);
@@ -111,7 +111,7 @@
void InstARM32Pred::emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst,
const Cfg *Func, bool SetFlags) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2);
@@ -350,7 +350,7 @@
template <> const char *InstARM32Sub::Opcode = "sub";
void InstARM32::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "[ARM32] ";
@@ -358,7 +358,7 @@
}
template <> void InstARM32Mov::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -396,7 +396,7 @@
}
void InstARM32Br::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t"
@@ -419,7 +419,7 @@
}
void InstARM32Br::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "br ";
@@ -436,7 +436,7 @@
}
void InstARM32Call::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -467,7 +467,7 @@
}
void InstARM32Call::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (getDest()) {
@@ -479,7 +479,7 @@
}
void InstARM32Cmp::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -497,7 +497,7 @@
}
void InstARM32Cmp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpOpcodePred(Str, "cmp", getSrc(0)->getType());
@@ -505,7 +505,7 @@
}
void InstARM32Ldr::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -525,7 +525,7 @@
}
void InstARM32Ldr::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -536,7 +536,7 @@
}
void InstARM32Mla::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -559,7 +559,7 @@
}
void InstARM32Mla::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -570,7 +570,7 @@
}
template <> void InstARM32Movw::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -587,7 +587,7 @@
}
template <> void InstARM32Movt::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -605,7 +605,7 @@
}
void InstARM32Pop::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(Dests.size() > 0);
Ostream &Str = Func->getContext()->getStrEmit();
@@ -626,7 +626,7 @@
}
void InstARM32Pop::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "pop"
@@ -639,7 +639,7 @@
}
void InstARM32AdjustStack::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -661,7 +661,7 @@
}
void InstARM32AdjustStack::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
getDest()->dump(Func);
@@ -672,7 +672,7 @@
}
void InstARM32Push::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getSrcSize() > 0);
Ostream &Str = Func->getContext()->getStrEmit();
@@ -689,7 +689,7 @@
}
void InstARM32Push::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "push"
@@ -698,7 +698,7 @@
}
void InstARM32Ret::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getSrcSize() > 0);
Variable *LR = llvm::cast<Variable>(getSrc(0));
@@ -717,7 +717,7 @@
}
void InstARM32Ret::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType());
@@ -726,7 +726,7 @@
}
void InstARM32Str::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -745,7 +745,7 @@
}
void InstARM32Str::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = getSrc(0)->getType();
@@ -757,7 +757,7 @@
}
void InstARM32Umull::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -780,7 +780,7 @@
}
void InstARM32Umull::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -791,7 +791,7 @@
}
void OperandARM32Mem::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "[";
@@ -834,7 +834,7 @@
}
void OperandARM32Mem::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Str << "[";
if (Func)
@@ -861,7 +861,7 @@
}
void OperandARM32FlexImm::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
uint32_t Imm = getImm();
@@ -870,7 +870,7 @@
}
void OperandARM32FlexImm::dump(const Cfg * /* Func */, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
uint32_t Imm = getImm();
uint32_t RotateAmt = getRotateAmt();
@@ -878,7 +878,7 @@
}
void OperandARM32FlexReg::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
getReg()->emit(Func);
@@ -889,7 +889,7 @@
}
void OperandARM32FlexReg::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Variable *Reg = getReg();
if (Func)
diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h
index 2ec1356..8167ed4 100644
--- a/src/IceInstARM32.h
+++ b/src/IceInstARM32.h
@@ -52,7 +52,7 @@
using Operand::dump;
void dump(const Cfg *, Ostream &Str) const override {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Str << "<OperandARM32>";
}
@@ -347,7 +347,7 @@
InstARM32UnaryopGPR(Func, Dest, Src, Predicate);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
emitUnaryopGPR(Opcode, this, Func);
}
@@ -356,7 +356,7 @@
llvm_unreachable("Not yet implemented");
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -392,7 +392,7 @@
InstARM32TwoAddrGPR(Func, Dest, Src, Predicate);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
emitTwoAddr(Opcode, this, Func);
}
@@ -401,7 +401,7 @@
llvm::report_fatal_error("Not yet implemented");
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -444,7 +444,7 @@
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpOpcodePred(Str, Opcode, getDest()->getType());
@@ -484,7 +484,7 @@
InstARM32ThreeAddrGPR(Func, Dest, Src1, Src2, Predicate, SetFlags);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
emitThreeAddr(Opcode, this, Func, SetFlags);
}
@@ -493,7 +493,7 @@
llvm::report_fatal_error("Not yet implemented");
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 750377f..60a58c4 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -371,7 +371,7 @@
// ======================== Dump routines ======================== //
void InstX8632::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "[X8632] ";
@@ -379,7 +379,7 @@
}
void InstX8632FakeRMW::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = getData()->getType();
@@ -392,7 +392,7 @@
}
void InstX8632Label::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << getName(Func) << ":";
@@ -404,14 +404,14 @@
}
void InstX8632Label::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << getName(Func) << ":";
}
void InstX8632Br::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t";
@@ -470,7 +470,7 @@
}
void InstX8632Br::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "br ";
@@ -493,7 +493,7 @@
}
void InstX8632Jmp::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -538,7 +538,7 @@
}
void InstX8632Jmp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "jmp ";
@@ -546,7 +546,7 @@
}
void InstX8632Call::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -589,7 +589,7 @@
}
void InstX8632Call::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (getDest()) {
@@ -606,7 +606,7 @@
// template issues.
void InstX8632::emitTwoAddress(const char *Opcode, const Inst *Inst,
const Cfg *Func, bool ShiftHack) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2);
@@ -1154,7 +1154,7 @@
&X8632::AssemblerX8632::psrl};
template <> void InstX8632Sqrtss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -1167,7 +1167,7 @@
}
template <> void InstX8632Addss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "add%s",
@@ -1176,7 +1176,7 @@
}
template <> void InstX8632Padd::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "padd%s",
@@ -1185,7 +1185,7 @@
}
template <> void InstX8632Pmull::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
bool TypesAreValid = getDest()->getType() == IceType_v4i32 ||
@@ -1220,7 +1220,7 @@
}
template <> void InstX8632Subss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "sub%s",
@@ -1229,7 +1229,7 @@
}
template <> void InstX8632Psub::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "psub%s",
@@ -1238,7 +1238,7 @@
}
template <> void InstX8632Mulss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "mul%s",
@@ -1247,7 +1247,7 @@
}
template <> void InstX8632Pmuludq::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getSrc(0)->getType() == IceType_v4i32 &&
getSrc(1)->getType() == IceType_v4i32);
@@ -1255,7 +1255,7 @@
}
template <> void InstX8632Divss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "div%s",
@@ -1264,7 +1264,7 @@
}
template <> void InstX8632Div::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -1283,7 +1283,7 @@
}
template <> void InstX8632Idiv::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -1306,7 +1306,7 @@
// pblendvb and blendvps take xmm0 as a final implicit argument.
void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
const Cfg *Func) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 3);
@@ -1332,7 +1332,7 @@
} // end anonymous namespace
template <> void InstX8632Blendvps::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
TargetX8632::SSE4_1);
@@ -1348,7 +1348,7 @@
}
template <> void InstX8632Pblendvb::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
TargetX8632::SSE4_1);
@@ -1364,7 +1364,7 @@
}
template <> void InstX8632Imul::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1428,7 +1428,7 @@
}
template <> void InstX8632Cbwdq::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -1480,7 +1480,7 @@
}
void InstX8632Mul::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1504,7 +1504,7 @@
}
void InstX8632Mul::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1513,7 +1513,7 @@
}
void InstX8632Shld::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Variable *Dest = getDest();
@@ -1545,7 +1545,7 @@
}
void InstX8632Shld::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1554,7 +1554,7 @@
}
void InstX8632Shrd::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Variable *Dest = getDest();
@@ -1586,7 +1586,7 @@
}
void InstX8632Shrd::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1595,7 +1595,7 @@
}
void InstX8632Cmov::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Variable *Dest = getDest();
@@ -1638,7 +1638,7 @@
}
void InstX8632Cmov::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "cmov" << InstX8632BrAttributes[Condition].DisplayString << ".";
@@ -1649,7 +1649,7 @@
}
void InstX8632Cmpps::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1682,7 +1682,7 @@
}
void InstX8632Cmpps::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
assert(Condition < CondX86::Cmpps_Invalid);
@@ -1693,7 +1693,7 @@
}
void InstX8632Cmpxchg::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -1721,7 +1721,7 @@
}
void InstX8632Cmpxchg::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (Locked) {
@@ -1732,7 +1732,7 @@
}
void InstX8632Cmpxchg8b::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 5);
@@ -1753,7 +1753,7 @@
}
void InstX8632Cmpxchg8b::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (Locked) {
@@ -1764,7 +1764,7 @@
}
void InstX8632Cvt::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -1839,7 +1839,7 @@
}
void InstX8632Cvt::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1852,7 +1852,7 @@
}
void InstX8632Icmp::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1882,7 +1882,7 @@
}
void InstX8632Icmp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "cmp." << getSrc(0)->getType() << " ";
@@ -1890,7 +1890,7 @@
}
void InstX8632Ucomiss::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1914,7 +1914,7 @@
}
void InstX8632Ucomiss::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "ucomiss." << getSrc(0)->getType() << " ";
@@ -1922,7 +1922,7 @@
}
void InstX8632UD2::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 0);
@@ -1935,14 +1935,14 @@
}
void InstX8632UD2::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "ud2\n";
}
void InstX8632Test::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1973,7 +1973,7 @@
}
void InstX8632Test::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "test." << getSrc(0)->getType() << " ";
@@ -1981,7 +1981,7 @@
}
void InstX8632Mfence::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 0);
@@ -1994,14 +1994,14 @@
}
void InstX8632Mfence::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "mfence\n";
}
void InstX8632Store::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -2044,7 +2044,7 @@
}
void InstX8632Store::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "mov." << getSrc(0)->getType() << " ";
@@ -2054,7 +2054,7 @@
}
void InstX8632StoreP::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -2076,7 +2076,7 @@
}
void InstX8632StoreP::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "storep." << getSrc(0)->getType() << " ";
@@ -2086,7 +2086,7 @@
}
void InstX8632StoreQ::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -2110,7 +2110,7 @@
}
void InstX8632StoreQ::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "storeq." << getSrc(0)->getType() << " ";
@@ -2120,7 +2120,7 @@
}
template <> void InstX8632Lea::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -2140,7 +2140,7 @@
}
template <> void InstX8632Mov::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -2270,7 +2270,7 @@
}
template <> void InstX8632Movp::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
// TODO(wala,stichnot): movups works with all vector operands, but
// there exist other instructions (movaps, movdqa, movdqu) that may
@@ -2296,7 +2296,7 @@
}
template <> void InstX8632Movq::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -2357,7 +2357,7 @@
}
void InstX8632Nop::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
// TODO: Emit the right code for each variant.
@@ -2371,14 +2371,14 @@
}
void InstX8632Nop::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "nop (variant = " << Variant << ")";
}
void InstX8632Fld::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -2433,7 +2433,7 @@
}
void InstX8632Fld::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "fld." << getSrc(0)->getType() << " ";
@@ -2441,7 +2441,7 @@
}
void InstX8632Fstp::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 0);
@@ -2506,7 +2506,7 @@
}
void InstX8632Fstp::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -2515,7 +2515,7 @@
}
template <> void InstX8632Pcmpeq::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "pcmpeq%s",
@@ -2524,7 +2524,7 @@
}
template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "pcmpgt%s",
@@ -2533,7 +2533,7 @@
}
template <> void InstX8632Pextr::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -2579,7 +2579,7 @@
}
template <> void InstX8632Pinsr::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -2654,7 +2654,7 @@
}
void InstX8632Pop::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 0);
@@ -2674,7 +2674,7 @@
}
void InstX8632Pop::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -2682,7 +2682,7 @@
}
void InstX8632AdjustStack::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\tsubl\t$" << Amount << ", %esp";
@@ -2696,14 +2696,14 @@
}
void InstX8632AdjustStack::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "esp = sub.i32 esp, " << Amount;
}
void InstX8632Push::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -2724,7 +2724,7 @@
}
void InstX8632Push::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "push." << getSrc(0)->getType() << " ";
@@ -2732,7 +2732,7 @@
}
template <> void InstX8632Psll::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getDest()->getType() == IceType_v8i16 ||
getDest()->getType() == IceType_v8i1 ||
@@ -2745,7 +2745,7 @@
}
template <> void InstX8632Psra::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getDest()->getType() == IceType_v8i16 ||
getDest()->getType() == IceType_v8i1 ||
@@ -2758,7 +2758,7 @@
}
template <> void InstX8632Psrl::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
char buf[30];
snprintf(buf, llvm::array_lengthof(buf), "psrl%s",
@@ -2767,7 +2767,7 @@
}
void InstX8632Ret::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\tret";
@@ -2779,7 +2779,7 @@
}
void InstX8632Ret::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = (getSrcSize() == 0 ? IceType_void : getSrc(0)->getType());
@@ -2788,7 +2788,7 @@
}
void InstX8632Setcc::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\tset" << InstX8632BrAttributes[Condition].DisplayString << "\t";
@@ -2809,7 +2809,7 @@
}
void InstX8632Setcc::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "setcc." << InstX8632BrAttributes[Condition].DisplayString << " ";
@@ -2817,7 +2817,7 @@
}
void InstX8632Xadd::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
if (Locked) {
@@ -2844,7 +2844,7 @@
}
void InstX8632Xadd::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
if (Locked) {
@@ -2856,7 +2856,7 @@
}
void InstX8632Xchg::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\txchg" << getWidthString(getSrc(0)->getType()) << "\t";
@@ -2880,7 +2880,7 @@
}
void InstX8632Xchg::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Type Ty = getSrc(0)->getType();
@@ -2889,7 +2889,7 @@
}
void OperandX8632Mem::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
if (SegmentReg != DefaultSegment) {
@@ -2925,7 +2925,7 @@
}
void OperandX8632Mem::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (SegmentReg != DefaultSegment) {
assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM);
@@ -3026,7 +3026,7 @@
}
void VariableSplit::emit(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(!Var->hasReg());
@@ -3041,7 +3041,7 @@
}
void VariableSplit::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
switch (Part) {
case Low:
diff --git a/src/IceInstX8632.h b/src/IceInstX8632.h
index d64952b..51868b4 100644
--- a/src/IceInstX8632.h
+++ b/src/IceInstX8632.h
@@ -38,7 +38,7 @@
enum OperandKindX8632 { k__Start = Operand::kTarget, kMem, kSplit };
using Operand::dump;
void dump(const Cfg *, Ostream &Str) const override {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Str << "<OperandX8632>";
}
@@ -578,7 +578,7 @@
InstX8632InplaceopGPR(Func, SrcDest);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -592,7 +592,7 @@
emitIASOpTyGPR(Func, Ty, Var, Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -631,7 +631,7 @@
InstX8632UnaryopGPR(Func, Dest, Src);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -656,7 +656,7 @@
emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -691,7 +691,7 @@
InstX8632UnaryopXmm(Func, Dest, Src);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -706,7 +706,7 @@
emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -739,7 +739,7 @@
InstX8632BinopGPRShift(Func, Dest, Source);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool ShiftHack = true;
emitTwoAddress(Opcode, this, Func, ShiftHack);
@@ -750,7 +750,7 @@
emitIASGPRShift(Func, Ty, getDest(), getSrc(1), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -783,7 +783,7 @@
InstX8632BinopGPR(Func, Dest, Source);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool ShiftHack = false;
emitTwoAddress(Opcode, this, Func, ShiftHack);
@@ -794,7 +794,7 @@
emitIASRegOpTyGPR(Func, Ty, getDest(), getSrc(1), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -828,7 +828,7 @@
InstX8632BinopRMW(Func, DestSrc0, Src1);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool ShiftHack = false;
emitTwoAddress(Opcode, this, Func, ShiftHack);
@@ -839,7 +839,7 @@
emitIASAsAddrOpTyGPR(Func, Ty, getSrc(0), getSrc(1), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << Opcode << "." << getSrc(0)->getType() << " ";
@@ -870,7 +870,7 @@
InstX8632BinopXmm(Func, Dest, Source);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
validateVectorAddrMode();
const bool ShiftHack = false;
@@ -885,7 +885,7 @@
emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(1), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -923,7 +923,7 @@
InstX8632BinopXmmShift(Func, Dest, Source);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
validateVectorAddrMode();
const bool ShiftHack = false;
@@ -938,7 +938,7 @@
emitIASXmmShift(Func, ElementTy, getDest(), getSrc(1), Emitter);
}
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -971,7 +971,7 @@
InstX8632Ternop(Func, Dest, Source1, Source2);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
@@ -984,7 +984,7 @@
}
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1018,7 +1018,7 @@
InstX8632ThreeAddressop(Func, Dest, Source0, Source1);
}
void emit(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -1031,7 +1031,7 @@
}
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
@@ -1070,7 +1070,7 @@
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << Opcode << "." << getDest()->getType() << " ";
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index 459d0a0..db530db 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -91,13 +91,17 @@
break;
}
}
-#if 0
- // An equivalent but less inefficient implementation:
- LiveRange Temp;
- Temp.addSegment(OtherBegin, OtherBegin + 1);
- bool Validation = overlaps(Temp);
- assert(Result == Validation);
-#endif
+ // This is an equivalent but less inefficient implementation. It's
+ // expensive enough that we wouldn't want to run it under any build,
+ // but it could be enabled if e.g. the LiveRange implementation
+ // changes and extra testing is needed.
+ if (BuildDefs::extraValidation()) {
+ LiveRange Temp;
+ Temp.addSegment(OtherBegin, OtherBegin + 1);
+ bool Validation = overlaps(Temp);
+ (void)Validation;
+ assert(Result == Validation);
+ }
return Result;
}
@@ -129,7 +133,7 @@
Variable *Variable::asType(Type Ty) {
// Note: This returns a Variable, even if the "this" object is a
// subclass of Variable.
- if (!ALLOW_DUMP || getType() == Ty)
+ if (!BuildDefs::dump() || getType() == Ty)
return this;
Variable *V = new (getCurrentCfgAllocator()->Allocate<Variable>())
Variable(kVariable, Ty, Number);
@@ -388,12 +392,12 @@
// ======================== dump routines ======================== //
void Variable::emit(const Cfg *Func) const {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Func->getTarget()->emitVariable(this);
}
void Variable::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (Func == nullptr) {
Str << "%" << getName(Func);
@@ -447,7 +451,7 @@
}
void ConstantRelocatable::dump(const Cfg *Func, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Str << "@";
if (Func && !SuppressMangling) {
@@ -462,7 +466,7 @@
void ConstantUndef::emit(TargetLowering *Target) const { Target->emit(this); }
void LiveRange::dump(Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Str << "(weight=" << Weight << ") ";
bool First = true;
@@ -475,14 +479,14 @@
}
Ostream &operator<<(Ostream &Str, const LiveRange &L) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return Str;
L.dump(Str);
return Str;
}
Ostream &operator<<(Ostream &Str, const RegWeight &W) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return Str;
if (W.getWeight() == RegWeight::Inf)
Str << "Inf";
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 35342fa..786f51b 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -69,13 +69,13 @@
// situation where Func==nullptr.
virtual void dump(const Cfg *Func, Ostream &Str) const = 0;
void dump(const Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(Func);
dump(Func, Func->getContext()->getStrDump());
}
void dump(Ostream &Str) const {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
dump(nullptr, Str);
}
@@ -163,7 +163,7 @@
void emit(TargetLowering *Target) const final;
using Constant::dump;
void dump(const Cfg *, Ostream &Str) const override {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Str << getValue();
}
@@ -189,7 +189,7 @@
template <>
inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (getType() == IceType_i1)
Str << (getValue() ? "true" : "false");
@@ -203,7 +203,7 @@
template <>
inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
assert(getType() == IceType_i64);
Str << static_cast<int64_t>(getValue());
@@ -292,7 +292,7 @@
void emit(TargetLowering *Target) const final;
using Constant::dump;
void dump(const Cfg *, Ostream &Str) const override {
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
Str << "undef";
}
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index 7926123..c9a50dc 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -50,7 +50,7 @@
void dumpDisableOverlap(const Cfg *Func, const Variable *Var,
const char *Reason) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (Func->isVerbose(IceV_LinearScan)) {
VariablesMetadata *VMetadata = Func->getVMetadata();
@@ -68,7 +68,7 @@
}
void dumpLiveRange(const Variable *Var, const Cfg *Func) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
const static size_t BufLen = 30;
@@ -265,7 +265,7 @@
TimerMarker T(TimerStack::TT_linearScan, Func);
assert(RegMaskFull.any()); // Sanity check
GlobalContext *Ctx = Func->getContext();
- const bool Verbose = ALLOW_DUMP && Func->isVerbose(IceV_LinearScan);
+ const bool Verbose = BuildDefs::dump() && Func->isVerbose(IceV_LinearScan);
if (Verbose)
Ctx->lockStr();
Func->resetCurrentNode();
@@ -735,7 +735,7 @@
// ======================== Dump routines ======================== //
void LinearScan::dump(Cfg *Func) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (!Func->isVerbose(IceV_LinearScan))
return;
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 7c93463..64b00db 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -411,7 +411,7 @@
}
void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
if (C->getSuppressMangling())
@@ -427,7 +427,7 @@
}
void TargetLowering::emit(const ConstantRelocatable *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
Str << getConstantPrefix();
@@ -472,7 +472,7 @@
void TargetDataLowering::emitGlobal(const VariableDeclaration &Var,
const IceString &SectionSuffix) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
// If external and not initialized, this must be a cross test.
@@ -518,8 +518,9 @@
Var.getInitializers()) {
switch (Init->getKind()) {
case VariableDeclaration::Initializer::DataInitializerKind: {
- const auto &Data = llvm::cast<VariableDeclaration::DataInitializer>(
- Init.get())->getContents();
+ const auto &Data =
+ llvm::cast<VariableDeclaration::DataInitializer>(Init.get())
+ ->getContents();
for (SizeT i = 0; i < Init->getNumBytes(); ++i) {
Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
}
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index de39aac..6fca4a9 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -452,7 +452,7 @@
Variable *RegisterArg = Func->makeVariable(Ty);
Variable *RegisterLo = Func->makeVariable(IceType_i32);
Variable *RegisterHi = Func->makeVariable(IceType_i32);
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
RegisterArg->setName(Func, "home_reg:" + Arg->getName(Func));
RegisterLo->setName(Func, "home_reg_lo:" + Arg->getName(Func));
RegisterHi->setName(Func, "home_reg_hi:" + Arg->getName(Func));
@@ -474,7 +474,7 @@
if (!CC.I32InReg(&RegNum))
continue;
Variable *RegisterArg = Func->makeVariable(Ty);
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
RegisterArg->setName(Func, "home_reg:" + Arg->getName(Func));
}
RegisterArg->setRegNum(RegNum);
@@ -716,7 +716,7 @@
UsesFramePointer);
this->HasComputedFrame = true;
- if (ALLOW_DUMP && Func->isVerbose(IceV_Frame)) {
+ if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) {
OstreamLocker L(Func->getContext());
Ostream &Str = Func->getContext()->getStrDump();
@@ -834,7 +834,7 @@
assert(Hi == nullptr);
Lo = Func->makeVariable(IceType_i32);
Hi = Func->makeVariable(IceType_i32);
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
Lo->setName(Func, Var->getName(Func) + "__lo");
Hi->setName(Func, Var->getName(Func) + "__hi");
}
@@ -2292,7 +2292,7 @@
}
void TargetARM32::emit(const ConstantInteger32 *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
Str << getConstantPrefix() << C->getValue();
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 55a0bfc..4570d9f 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -229,7 +229,7 @@
template <typename T>
void TargetDataX8632::emitConstantPool(GlobalContext *Ctx) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
Type Ty = T::Ty;
diff --git a/src/IceTargetLoweringX8664.h b/src/IceTargetLoweringX8664.h
index 302fb0f..0107cfc 100644
--- a/src/IceTargetLoweringX8664.h
+++ b/src/IceTargetLoweringX8664.h
@@ -75,4 +75,4 @@
};
} // end of namespace Ice
-#endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H
+#endif // SUBZERO_SRC_ICETARGETLOWERINGX8664_H
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index b787c03..38ef4c1 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -249,7 +249,7 @@
template <class MachineTraits>
void BoolFolding<MachineTraits>::dump(const Cfg *Func) const {
- if (!ALLOW_DUMP || !Func->isVerbose(IceV_Folding))
+ if (!BuildDefs::dump() || !Func->isVerbose(IceV_Folding))
return;
OstreamLocker L(Func->getContext());
Ostream &Str = Func->getContext()->getStrDump();
@@ -842,7 +842,7 @@
int32_t RegNum = RegX8632::Reg_xmm0 + NumXmmArgs;
++NumXmmArgs;
Variable *RegisterArg = Func->makeVariable(Ty);
- if (ALLOW_DUMP)
+ if (BuildDefs::dump())
RegisterArg->setName(Func, "home_reg:" + Arg->getName(Func));
RegisterArg->setRegNum(RegNum);
RegisterArg->setIsArg();
@@ -1074,7 +1074,7 @@
}
this->HasComputedFrame = true;
- if (ALLOW_DUMP && Func->isVerbose(IceV_Frame)) {
+ if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) {
OstreamLocker L(Func->getContext());
Ostream &Str = Func->getContext()->getStrDump();
@@ -1190,7 +1190,7 @@
assert(Hi == nullptr);
Lo = Func->makeVariable(IceType_i32);
Hi = Func->makeVariable(IceType_i32);
- if (ALLOW_DUMP) {
+ if (BuildDefs::dump()) {
Lo->setName(Func, Var->getName(Func) + "__lo");
Hi->setName(Func, Var->getName(Func) + "__hi");
}
@@ -3402,10 +3402,11 @@
Func->setError("Unexpected memory ordering for AtomicRMW");
return;
}
- lowerAtomicRMW(Instr->getDest(),
- static_cast<uint32_t>(llvm::cast<ConstantInteger32>(
- Instr->getArg(0))->getValue()),
- Instr->getArg(1), Instr->getArg(2));
+ lowerAtomicRMW(
+ Instr->getDest(),
+ static_cast<uint32_t>(
+ llvm::cast<ConstantInteger32>(Instr->getArg(0))->getValue()),
+ Instr->getArg(1), Instr->getArg(2));
return;
case Intrinsics::AtomicStore: {
if (!Intrinsics::isMemoryOrderValid(
@@ -4019,7 +4020,7 @@
void dumpAddressOpt(const Cfg *Func, const Variable *Base,
const Variable *Index, uint16_t Shift, int32_t Offset,
const Inst *Reason) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
if (!Func->isVerbose(IceV_AddrOpt))
return;
@@ -5271,7 +5272,7 @@
template <class Machine>
void TargetX86Base<Machine>::emit(const ConstantInteger32 *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
Str << getConstantPrefix() << C->getValue();
@@ -5284,7 +5285,7 @@
template <class Machine>
void TargetX86Base<Machine>::emit(const ConstantFloat *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
C->emitPoolLabel(Str);
@@ -5292,7 +5293,7 @@
template <class Machine>
void TargetX86Base<Machine>::emit(const ConstantDouble *C) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
C->emitPoolLabel(Str);
@@ -5410,8 +5411,9 @@
// TO:
// insert: lea offset+cookie[base], RegTemp
// => -cookie[RegTemp, index, shift]
- uint32_t Value = llvm::dyn_cast<ConstantInteger32>(
- MemOperand->getOffset())->getValue();
+ uint32_t Value =
+ llvm::dyn_cast<ConstantInteger32>(MemOperand->getOffset())
+ ->getValue();
uint32_t Cookie = Ctx->getRandomizationCookie();
Constant *Mask1 = Ctx->getConstantInt(
MemOperand->getOffset()->getType(), Cookie + Value);
diff --git a/src/IceTimerTree.cpp b/src/IceTimerTree.cpp
index 6c92215..c5603fd 100644
--- a/src/IceTimerTree.cpp
+++ b/src/IceTimerTree.cpp
@@ -21,7 +21,7 @@
TimerStack::TimerStack(const IceString &Name)
: Name(Name), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel).
IDs.resize(TT__num);
@@ -39,7 +39,7 @@
// Returns the unique timer ID for the given Name, creating a new ID
// if needed.
TimerIdT TimerStack::getTimerID(const IceString &Name) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return 0;
if (IDsIndex.find(Name) == IDsIndex.end()) {
IDsIndex[Name] = IDs.size();
@@ -66,7 +66,7 @@
// Merges two timer stacks, by combining and summing corresponding
// entries. This timer stack is updated from Src.
void TimerStack::mergeFrom(const TimerStack &Src) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
TranslationType Mapping = translateIDsFrom(Src);
TTindex SrcIndex = 0;
@@ -137,7 +137,7 @@
// Pushes a new marker onto the timer stack.
void TimerStack::push(TimerIdT ID) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool UpdateCounts = false;
update(UpdateCounts);
@@ -148,7 +148,7 @@
// Pops the top marker from the timer stack. Validates via assert()
// that the expected marker is popped.
void TimerStack::pop(TimerIdT ID) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool UpdateCounts = true;
update(UpdateCounts);
@@ -165,7 +165,7 @@
// At a state change (e.g. push or pop), updates the flat and
// cumulative timings for everything on the timer stack.
void TimerStack::update(bool UpdateCounts) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
++StateChangeCount;
// Whenever the stack is about to change, we grab the time delta
@@ -201,7 +201,7 @@
}
void TimerStack::reset() {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
StateChangeCount = 0;
FirstTimestamp = LastTimestamp = timestamp();
@@ -219,7 +219,7 @@
// Dump the Map items in reverse order of their time contribution.
void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
for (auto &I : reverse_range(Map)) {
char buf[80];
@@ -235,7 +235,7 @@
// MaxVal=5 ==> "[%1lu] "
// MaxVal=9876 ==> "[%4lu] "
void makePrintfFormatString(char *Buf, size_t BufLen, size_t MaxVal) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
int NumDigits = 0;
do {
@@ -248,7 +248,7 @@
} // end of anonymous namespace
void TimerStack::dump(Ostream &Str, bool DumpCumulative) {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
const bool UpdateCounts = true;
update(UpdateCounts);
diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
index 793e175..f12f330 100644
--- a/src/IceTypes.cpp
+++ b/src/IceTypes.cpp
@@ -260,7 +260,7 @@
}
void FuncSigType::dump(Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!BuildDefs::dump())
return;
Stream << ReturnType << " (";
bool IsFirst = true;
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index cb05493..dfc3fb7 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -80,14 +80,14 @@
};
Ice::Ostream &operator<<(Ice::Ostream &Stream, const ExtendedType &Ty) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return Stream;
Ty.dump(Stream);
return Stream;
}
Ice::Ostream &operator<<(Ice::Ostream &Stream, ExtendedType::TypeKind Kind) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return Stream;
Stream << "ExtendedType::";
switch (Kind) {
@@ -136,7 +136,7 @@
};
void ExtendedType::dump(Ice::Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << Kind;
switch (Kind) {
@@ -1564,7 +1564,7 @@
void dumpVectorIndexCheckValue(raw_ostream &Stream,
VectorIndexCheckValue Value) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
switch (Value) {
case VectorIndexNotVector:
@@ -2838,7 +2838,7 @@
return;
Ice::Operand *Op = getFunctionParser()->getOperand(Index);
if (Ice::Variable *V = dyn_cast<Ice::Variable>(Op)) {
- if (ALLOW_DUMP) {
+ if (Ice::BuildDefs::dump()) {
std::string Nm(Name.data(), Name.size());
V->setName(getFunctionParser()->getFunc(), Nm);
}
@@ -2856,7 +2856,7 @@
return;
}
std::string Nm(Name.data(), Name.size());
- if (ALLOW_DUMP)
+ if (Ice::BuildDefs::dump())
getFunctionParser()->getFunc()->getNodes()[Index]->setName(Nm);
}