summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp52
-rw-r--r--llvm/lib/CodeGen/MachineFunctionPass.cpp2
2 files changed, 19 insertions, 35 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 4cdb6c890a5..2ed6517cb3d 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -54,40 +54,26 @@ static cl::opt<unsigned>
void MachineFunctionInitializer::anchor() {}
-void MachineFunctionProperties::print(raw_ostream &ROS, bool OnlySet) const {
- // Leave this function even in NDEBUG as an out-of-line anchor.
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- bool NeedsComma = false;
- for (BitVector::size_type i = 0; i < Properties.size(); ++i) {
- bool HasProperty = Properties[i];
- if (OnlySet && !HasProperty)
+static const char *getPropertyName(MachineFunctionProperties::Property Prop) {
+ typedef MachineFunctionProperties::Property P;
+ switch(Prop) {
+ case P::AllVRegsAllocated: return "AllVRegsAllocated";
+ case P::IsSSA: return "IsSSA";
+ case P::Legalized: return "Legalized";
+ case P::RegBankSelected: return "RegBankSelected";
+ case P::Selected: return "Selected";
+ case P::TracksLiveness: return "TracksLiveness";
+ }
+}
+
+void MachineFunctionProperties::print(raw_ostream &OS) const {
+ const char *Separator = "";
+ for (BitVector::size_type I = 0; I < Properties.size(); ++I) {
+ if (!Properties[I])
continue;
- if (NeedsComma)
- ROS << ", ";
- else
- NeedsComma = true;
- switch(static_cast<Property>(i)) {
- case Property::IsSSA:
- ROS << (HasProperty ? "SSA" : "Post SSA");
- break;
- case Property::TracksLiveness:
- ROS << (HasProperty ? "" : "not ") << "tracking liveness";
- break;
- case Property::AllVRegsAllocated:
- ROS << (HasProperty ? "AllVRegsAllocated" : "HasVRegs");
- break;
- case Property::Legalized:
- ROS << (HasProperty ? "" : "not ") << "legalized";
- break;
- case Property::RegBankSelected:
- ROS << (HasProperty ? "" : "not ") << "RegBank-selected";
- break;
- case Property::Selected:
- ROS << (HasProperty ? "" : "not ") << "selected";
- break;
- }
+ OS << Separator << getPropertyName(static_cast<Property>(I));
+ Separator = ", ";
}
-#endif
}
//===----------------------------------------------------------------------===//
@@ -418,9 +404,7 @@ StringRef MachineFunction::getName() const {
void MachineFunction::print(raw_ostream &OS, const SlotIndexes *Indexes) const {
OS << "# Machine code for function " << getName() << ": ";
- OS << "Properties: <";
getProperties().print(OS);
- OS << ">\n";
// Print Frame Information
FrameInfo->print(*this, OS);
diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index 228fe170ab4..524ebdbf657 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -49,7 +49,7 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
errs() << "MachineFunctionProperties required by " << getPassName()
<< " pass are not met by function " << F.getName() << ".\n"
<< "Required properties: ";
- RequiredProperties.print(errs(), /*OnlySet=*/true);
+ RequiredProperties.print(errs());
errs() << "\nCurrent properties: ";
MFProps.print(errs());
errs() << "\n";
OpenPOWER on IntegriCloud