[llvm-commits] CVS: llvm/lib/Analysis/InstCount.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Mar 21 19:55:26 PST 2005
Changes in directory llvm/lib/Analysis:
InstCount.cpp updated: 1.10 -> 1.11
---
Log message:
Directly count the number of memory instructions.
---
Diffs of the changes: (+9 -4)
InstCount.cpp | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
Index: llvm/lib/Analysis/InstCount.cpp
diff -u llvm/lib/Analysis/InstCount.cpp:1.10 llvm/lib/Analysis/InstCount.cpp:1.11
--- llvm/lib/Analysis/InstCount.cpp:1.10 Tue Nov 16 00:58:55 2004
+++ llvm/lib/Analysis/InstCount.cpp Mon Mar 21 21:55:10 2005
@@ -15,13 +15,13 @@
#include "llvm/Function.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/ADT/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> TotalInsts ("instcount", "Number of instructions (of all types)");
Statistic<> TotalBlocks("instcount", "Number of basic blocks");
Statistic<> TotalFuncs ("instcount", "Number of non-external functions");
+ Statistic<> TotalMemInst("instcount", "Number of memory instructions");
#define HANDLE_INST(N, OPCODE, CLASS) \
Statistic<> Num##OPCODE##Inst("instcount", "Number of " #OPCODE " insts");
@@ -61,8 +61,13 @@
// function.
//
bool InstCount::runOnFunction(Function &F) {
+ unsigned StartMemInsts =
+ NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
+ NumInvokeInst + NumAllocaInst + NumMallocInst + NumFreeInst;
visit(F);
+ unsigned EndMemInsts =
+ NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
+ NumInvokeInst + NumAllocaInst + NumMallocInst + NumFreeInst;
+ TotalMemInst += EndMemInsts-StartMemInsts;
return false;
}
-
-} // End llvm namespace
More information about the llvm-commits
mailing list