summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2016-08-02 14:42:57 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2016-08-02 14:42:57 +0000
commit3797d93a1ea0a93d0835a86de0b69ad2f121eb04 (patch)
tree372fbd3fc94df9029dfe074b86afaf5cbe424626 /lib
parent6a35fcace7d5abc78ff4467ad1c8cde2c081f144 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachineFunction.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index a7c63ef4c85..a4c4ea4bb95 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/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<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");