aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-06-11 15:10:38 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-06-11 15:10:38 +0000
commit1cf5024de165001aad045934425f37d418f2c657 (patch)
tree932dfe7cc6e4820b5c820bca7176418ad7eb27db /lib
parentf6d023312fbc6b4e5242b760f2b5769d3290c2d4 (diff)
downloadexternal_llvm-1cf5024de165001aad045934425f37d418f2c657.zip
external_llvm-1cf5024de165001aad045934425f37d418f2c657.tar.gz
external_llvm-1cf5024de165001aad045934425f37d418f2c657.tar.bz2
Implement tracking of bytecode instruction size and the number of long
instructions generated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Bytecode/Analyzer/Analyzer.cpp8
-rw-r--r--lib/Bytecode/Analyzer/AnalyzerWrappers.cpp8
-rw-r--r--lib/Bytecode/Reader/Analyzer.cpp8
-rw-r--r--lib/Bytecode/Reader/AnalyzerWrappers.cpp8
4 files changed, 32 insertions, 0 deletions
diff --git a/lib/Bytecode/Analyzer/Analyzer.cpp b/lib/Bytecode/Analyzer/Analyzer.cpp
index d8e7595..9468094 100644
--- a/lib/Bytecode/Analyzer/Analyzer.cpp
+++ b/lib/Bytecode/Analyzer/Analyzer.cpp
@@ -52,6 +52,8 @@ public:
bca.fileDensity = 0.0;
bca.globalsDensity = 0.0;
bca.functionDensity = 0.0;
+ bca.instructionSize = 0;
+ bca.longInstructions = 0;
bca.vbrCount32 = 0;
bca.vbrCount64 = 0;
bca.vbrCompBytes = 0;
@@ -167,6 +169,8 @@ public:
currFunc->numPhis = 0;
currFunc->numOperands = 0;
currFunc->density = 0.0;
+ currFunc->instructionSize = 0;
+ currFunc->longInstructions = 0;
currFunc->vbrCount32 = 0;
currFunc->vbrCount64 = 0;
currFunc->vbrCompBytes = 0;
@@ -188,9 +192,13 @@ public:
std::vector<unsigned>& Operands, unsigned Size) {
bca.numInstructions++;
bca.numValues++;
+ bca.instructionSize += Size;
+ if (Size > 4 ) bca.longInstructions++;
bca.numOperands += Operands.size();
if ( currFunc ) {
currFunc->numInstructions++;
+ currFunc->instructionSize += Size;
+ if (Size > 4 ) currFunc->longInstructions++;
if ( Opcode == Instruction::PHI ) currFunc->numPhis++;
}
return Instruction::isTerminator(Opcode);
diff --git a/lib/Bytecode/Analyzer/AnalyzerWrappers.cpp b/lib/Bytecode/Analyzer/AnalyzerWrappers.cpp
index 9591dce..f849317 100644
--- a/lib/Bytecode/Analyzer/AnalyzerWrappers.cpp
+++ b/lib/Bytecode/Analyzer/AnalyzerWrappers.cpp
@@ -249,6 +249,10 @@ void llvm::PrintBytecodeAnalysis(BytecodeAnalysis& bca, std::ostream& Out )
print(Out, "Number Of Operands", bca.numOperands);
print(Out, "Number Of Compaction Tables", bca.numCmpctnTables);
print(Out, "Number Of Symbol Tables", bca.numSymTab);
+ print(Out, "Long Instructions", bca.longInstructions);
+ print(Out, "Instruction Size", bca.instructionSize);
+ print(Out, "Average Instruction Size",
+ double(bca.instructionSize)/double(bca.numInstructions));
print(Out, "Maximum Type Slot Number", bca.maxTypeSlot);
print(Out, "Maximum Value Slot Number", bca.maxValueSlot);
print(Out, "Bytes Thrown To Alignment", double(bca.numAlignment),
@@ -304,6 +308,10 @@ void llvm::PrintBytecodeAnalysis(BytecodeAnalysis& bca, std::ostream& Out )
print(Out, "Type:", I->second.description);
print(Out, "Byte Size", I->second.byteSize);
print(Out, "Instructions", I->second.numInstructions);
+ print(Out, "Long Instructions", I->second.longInstructions);
+ print(Out, "Instruction Size", I->second.instructionSize);
+ print(Out, "Average Instruction Size",
+ double(I->second.instructionSize)/double(I->second.numInstructions));
print(Out, "Basic Blocks", I->second.numBasicBlocks);
print(Out, "Operand", I->second.numOperands);
print(Out, "Function Density", I->second.density);
diff --git a/lib/Bytecode/Reader/Analyzer.cpp b/lib/Bytecode/Reader/Analyzer.cpp
index d8e7595..9468094 100644
--- a/lib/Bytecode/Reader/Analyzer.cpp
+++ b/lib/Bytecode/Reader/Analyzer.cpp
@@ -52,6 +52,8 @@ public:
bca.fileDensity = 0.0;
bca.globalsDensity = 0.0;
bca.functionDensity = 0.0;
+ bca.instructionSize = 0;
+ bca.longInstructions = 0;
bca.vbrCount32 = 0;
bca.vbrCount64 = 0;
bca.vbrCompBytes = 0;
@@ -167,6 +169,8 @@ public:
currFunc->numPhis = 0;
currFunc->numOperands = 0;
currFunc->density = 0.0;
+ currFunc->instructionSize = 0;
+ currFunc->longInstructions = 0;
currFunc->vbrCount32 = 0;
currFunc->vbrCount64 = 0;
currFunc->vbrCompBytes = 0;
@@ -188,9 +192,13 @@ public:
std::vector<unsigned>& Operands, unsigned Size) {
bca.numInstructions++;
bca.numValues++;
+ bca.instructionSize += Size;
+ if (Size > 4 ) bca.longInstructions++;
bca.numOperands += Operands.size();
if ( currFunc ) {
currFunc->numInstructions++;
+ currFunc->instructionSize += Size;
+ if (Size > 4 ) currFunc->longInstructions++;
if ( Opcode == Instruction::PHI ) currFunc->numPhis++;
}
return Instruction::isTerminator(Opcode);
diff --git a/lib/Bytecode/Reader/AnalyzerWrappers.cpp b/lib/Bytecode/Reader/AnalyzerWrappers.cpp
index 9591dce..f849317 100644
--- a/lib/Bytecode/Reader/AnalyzerWrappers.cpp
+++ b/lib/Bytecode/Reader/AnalyzerWrappers.cpp
@@ -249,6 +249,10 @@ void llvm::PrintBytecodeAnalysis(BytecodeAnalysis& bca, std::ostream& Out )
print(Out, "Number Of Operands", bca.numOperands);
print(Out, "Number Of Compaction Tables", bca.numCmpctnTables);
print(Out, "Number Of Symbol Tables", bca.numSymTab);
+ print(Out, "Long Instructions", bca.longInstructions);
+ print(Out, "Instruction Size", bca.instructionSize);
+ print(Out, "Average Instruction Size",
+ double(bca.instructionSize)/double(bca.numInstructions));
print(Out, "Maximum Type Slot Number", bca.maxTypeSlot);
print(Out, "Maximum Value Slot Number", bca.maxValueSlot);
print(Out, "Bytes Thrown To Alignment", double(bca.numAlignment),
@@ -304,6 +308,10 @@ void llvm::PrintBytecodeAnalysis(BytecodeAnalysis& bca, std::ostream& Out )
print(Out, "Type:", I->second.description);
print(Out, "Byte Size", I->second.byteSize);
print(Out, "Instructions", I->second.numInstructions);
+ print(Out, "Long Instructions", I->second.longInstructions);
+ print(Out, "Instruction Size", I->second.instructionSize);
+ print(Out, "Average Instruction Size",
+ double(I->second.instructionSize)/double(I->second.numInstructions));
print(Out, "Basic Blocks", I->second.numBasicBlocks);
print(Out, "Operand", I->second.numOperands);
print(Out, "Function Density", I->second.density);