[llvm] r277465 - [CodeGen] Generalize MachineFunctionProperties::print comma handling.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 2 07:42:57 PDT 2016
Author: ab
Date: Tue Aug 2 09:42:57 2016
New Revision: 277465
URL: http://llvm.org/viewvc/llvm-project?rev=277465&view=rev
Log:
[CodeGen] Generalize MachineFunctionProperties::print comma handling.
This is only used for debug prints, but the previous hardcoded ", "
caused it to be printed unnecessarily when OnlySet, and is annoying
when adding new properties.
Modified:
llvm/trunk/lib/CodeGen/MachineFunction.cpp
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=277465&r1=277464&r2=277465&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Aug 2 09:42:57 2016
@@ -57,16 +57,21 @@ 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)
continue;
+ if (NeedsComma)
+ ROS << ", ";
+ else
+ NeedsComma = true;
switch(static_cast<Property>(i)) {
case Property::IsSSA:
- ROS << (HasProperty ? "SSA, " : "Post SSA, ");
+ ROS << (HasProperty ? "SSA" : "Post SSA");
break;
case Property::TracksLiveness:
- ROS << (HasProperty ? "" : "not ") << "tracking liveness, ";
+ ROS << (HasProperty ? "" : "not ") << "tracking liveness";
break;
case Property::AllVRegsAllocated:
ROS << (HasProperty ? "AllVRegsAllocated" : "HasVRegs");
More information about the llvm-commits
mailing list