From: Ahmed Bougacha Date: Tue, 2 Aug 2016 14:42:57 +0000 (+0000) Subject: [CodeGen] Generalize MachineFunctionProperties::print comma handling. X-Git-Tag: llvmorg-4.0.0-rc1~13561 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8454a77c18f9e70ca19aa1bcbbe2dce1dc133f4;p=platform%2Fupstream%2Fllvm.git [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. llvm-svn: 277465 --- diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index a7c63ef..a4c4ea4 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -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(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");