Add support for printing out statistics information when -stats is added to

the command line


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-05-10 15:38:35 +00:00
parent 55547274bc
commit 3dec1f2722
17 changed files with 109 additions and 17 deletions

View File

@@ -25,6 +25,10 @@
#include "llvm/Constant.h"
#include "llvm/Support/CFG.h"
#include "Support/PostOrderIterator.h"
#include "Support/StatisticReporter.h"
static Statistic<> NumChanged("reassociate\t- Number of insts reassociated");
static Statistic<> NumSwapped("reassociate\t- Number of insts with operands swapped");
namespace {
class Reassociate : public FunctionPass {
@@ -115,6 +119,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
std::swap(LHS, RHS);
std::swap(LHSRank, RHSRank);
Changed = true;
++NumSwapped;
//cerr << "Transposed: " << I << " Result BB: " << I->getParent();
}
@@ -136,6 +141,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
LHSI->setOperand(TakeOp, RHS);
I->setOperand(1, LHSI);
++NumChanged;
//cerr << "Reassociated: " << I << " Result BB: " << I->getParent();
// Since we modified the RHS instruction, make sure that we recheck it.