Drop redundant functions dumpToString

They have been substituted with `print` methods, that are more general.
The `dumpToString` is emitted automatically with a template in a revng
header, for those classes that already have the `print` method anyway.
This commit is contained in:
Pietro Fezzardi
2021-03-09 16:25:58 +01:00
parent 6fbf5724d1
commit 7be0e6ab23
2 changed files with 21 additions and 25 deletions
+13 -21
View File
@@ -24,31 +24,24 @@
using namespace llvm;
std::string dumpToString(const dla::LayoutTypeSystemNode *N) {
std::string Result = "LTSN ID: " + std::to_string(N->ID);
return Result;
}
namespace dla {
std::string dumpToString(const dla::OffsetExpression &OE) {
std::string Result;
Result += "Off: " + std::to_string(OE.Offset);
auto NStrides = OE.Strides.size();
revng_assert(NStrides == OE.TripCounts.size());
if (not OE.Strides.empty()) {
void OffsetExpression::print(llvm::raw_ostream &OS) const {
OS << "Off: " << Offset;
auto NStrides = Strides.size();
revng_assert(NStrides == TripCounts.size());
if (not Strides.empty()) {
for (decltype(NStrides) N = 0; N < NStrides; ++N) {
Result += ", {" + std::to_string(OE.Strides[N]) + ',';
if (OE.TripCounts[N].has_value())
Result += std::to_string(OE.TripCounts[N].value());
OS << ", {" << Strides[N] << ',';
if (TripCounts[N].has_value())
OS << TripCounts[N].value();
else
Result += "none";
Result += '}';
OS << "none";
OS << '}';
}
}
return Result;
}
namespace dla {
void LayoutTypePtr::print(raw_ostream &Out) const {
Out << '{';
Out << "0x";
@@ -69,9 +62,8 @@ void LayoutTypePtr::print(raw_ostream &Out) const {
Out << '}';
}
void LayoutTypeSystemNode::printAsOperand(llvm::raw_ostream &OS,
bool /* unused */) {
OS << ID;
void LayoutTypeSystemNode::print(llvm::raw_ostream &OS) const {
OS << "LTSN ID: " << ID;
}
namespace {