1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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").

llvm-svn: 267070
This commit is contained in:
Derek Schuff 2016-04-21 22:19:24 +00:00
parent 7f6d758981
commit ba44d83fd8
3 changed files with 7 additions and 3 deletions

View File

@ -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 =

View File

@ -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, ");

View File

@ -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());
RequiredProperties.print(errs(), /*OnlySet=*/true);
errs() << "\nCurrent properties: ";
MFProps.print(errs());
errs() << "\n";