summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-26 18:40:14 +0000
committerChris Lattner <sabre@nondot.org>2002-07-26 18:40:14 +0000
commit64eea749debc5952df9819759de3269e8d08e3b0 (patch)
treed5f9ca8278d3335f2a24ec1a97e095017bbc3f69 /llvm/lib/Bytecode
parentd4879400ca7bb8f9599b0dc42a5ba9bda459561c (diff)
downloadbcm5719-llvm-64eea749debc5952df9819759de3269e8d08e3b0.tar.gz
bcm5719-llvm-64eea749debc5952df9819759de3269e8d08e3b0.zip
*** empty log message ***
llvm-svn: 3105
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Writer/InstructionWriter.cpp11
-rw-r--r--llvm/lib/Bytecode/Writer/Writer.cpp6
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
index 36414bea943..fdc5c5c1435 100644
--- a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -16,8 +16,14 @@
#include "llvm/DerivedTypes.h"
#include "llvm/iOther.h"
#include "llvm/iTerminators.h"
+#include "Support/StatisticReporter.h"
#include <algorithm>
+static Statistic<>
+NumOversized("bytecodewriter\t- Number of oversized instructions");
+static Statistic<>
+NumNormal("bytecodewriter\t- Number of normal instructions");
+
typedef unsigned char uchar;
// outputInstructionFormat0 - Output those wierd instructions that have a large
@@ -48,6 +54,7 @@ static void outputInstructionFormat0(const Instruction *I,
}
align32(Out); // We must maintain correct alignment!
+ ++NumOversized;
}
@@ -97,6 +104,7 @@ static void outputInstrVarArgsCall(const Instruction *I,
output_vbr((unsigned)Slot, Out);
}
align32(Out); // We must maintain correct alignment!
+ ++NumOversized;
}
@@ -118,6 +126,7 @@ static void outputInstructionFormat1(const Instruction *I,
unsigned Bits = 1 | (Opcode << 2) | (Type << 8) | (Slots[0] << 20);
// cerr << "1 " << IType << " " << Type << " " << Slots[0] << endl;
output(Bits, Out);
+ ++NumNormal;
}
@@ -142,6 +151,7 @@ static void outputInstructionFormat2(const Instruction *I,
// cerr << "2 " << IType << " " << Type << " " << Slots[0] << " "
// << Slots[1] << endl;
output(Bits, Out);
+ ++NumNormal;
}
@@ -167,6 +177,7 @@ static void outputInstructionFormat3(const Instruction *I,
//cerr << "3 " << IType << " " << Type << " " << Slots[0] << " "
// << Slots[1] << " " << Slots[2] << endl;
output(Bits, Out);
+ ++NumNormal;
}
void BytecodeWriter::processInstruction(const Instruction &I) {
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp
index f7219ea08e4..4eade882758 100644
--- a/llvm/lib/Bytecode/Writer/Writer.cpp
+++ b/llvm/lib/Bytecode/Writer/Writer.cpp
@@ -25,11 +25,14 @@
#include "llvm/SymbolTable.h"
#include "llvm/DerivedTypes.h"
#include "Support/STLExtras.h"
+#include "Support/StatisticReporter.h"
#include <string.h>
#include <algorithm>
static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
+static Statistic<>
+BytesWritten("bytecodewriter\t- Number of bytecode bytes written");
BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
@@ -234,6 +237,9 @@ void WriteBytecodeToFile(const Module *C, std::ostream &Out) {
// This object populates buffer for us...
BytecodeWriter BCW(Buffer, C);
+ // Keep track of how much we've written...
+ BytesWritten += Buffer.size();
+
// Okay, write the deque out to the ostream now... the deque is not
// sequential in memory, however, so write out as much as possible in big
// chunks, until we're done.
OpenPOWER on IntegriCloud