[llvm] r267070 - Improve error message reporting for MachineFunctionProperties
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 15:19:24 PDT 2016
Author: dschuff
Date: Thu Apr 21 17:19:24 2016
New Revision: 267070
URL: http://llvm.org/viewvc/llvm-project?rev=267070&view=rev
Log:
Improve error message reporting for MachineFunctionProperties
When printing the properties required by a pass, only print the
properties that are set, and not those that are clear (only properties
that are set are verified, clear properties are "don't-care").
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=267070&r1=267069&r2=267070&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Thu Apr 21 17:19:24 2016
@@ -148,7 +148,9 @@ public:
return !V.Properties.test(Properties);
}
- void print(raw_ostream &ROS) const;
+ // Print the MachineFunctionProperties in human-readable form. If OnlySet is
+ // true, only print the properties that are set.
+ void print(raw_ostream &ROS, bool OnlySet=false) const;
private:
BitVector Properties =
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=267070&r1=267069&r2=267070&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Thu Apr 21 17:19:24 2016
@@ -54,11 +54,13 @@ static cl::opt<unsigned>
void MachineFunctionInitializer::anchor() {}
-void MachineFunctionProperties::print(raw_ostream &ROS) const {
+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)
for (BitVector::size_type i = 0; i < Properties.size(); ++i) {
bool HasProperty = Properties[i];
+ if (OnlySet && !HasProperty)
+ continue;
switch(static_cast<Property>(i)) {
case Property::IsSSA:
ROS << (HasProperty ? "SSA, " : "Post SSA, ");
Modified: llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp?rev=267070&r1=267069&r2=267070&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp Thu Apr 21 17:19:24 2016
@@ -49,7 +49,7 @@ bool MachineFunctionPass::runOnFunction(
errs() << "MachineFunctionProperties required by " << getPassName()
<< " pass are not met by function " << F.getName() << ".\n"
<< "Required properties: ";
- RequiredProperties.print(errs());
+ RequiredProperties.print(errs(), /*OnlySet=*/true);
errs() << "\nCurrent properties: ";
MFProps.print(errs());
errs() << "\n";
More information about the llvm-commits
mailing list