aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bytecode/Writer
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
committerChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
commit697954c15da58bd8b186dbafdedd8b06db770201 (patch)
treee119a71f09b5c2513c8c270161ae2a858c6f3b96 /lib/Bytecode/Writer
parent13c4659220bc78a0a3529f4d9e57546e898088e3 (diff)
downloadexternal_llvm-697954c15da58bd8b186dbafdedd8b06db770201.zip
external_llvm-697954c15da58bd8b186dbafdedd8b06db770201.tar.gz
external_llvm-697954c15da58bd8b186dbafdedd8b06db770201.tar.bz2
Changes to build successfully with GCC 3.02
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer')
-rw-r--r--lib/Bytecode/Writer/ConstantWriter.cpp4
-rw-r--r--lib/Bytecode/Writer/InstructionWriter.cpp10
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.cpp5
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.h8
-rw-r--r--lib/Bytecode/Writer/Writer.cpp14
-rw-r--r--lib/Bytecode/Writer/WriterInternals.h8
6 files changed, 26 insertions, 23 deletions
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index bcfa976..73130f3 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -13,6 +13,8 @@
#include "llvm/ConstantVals.h"
#include "llvm/SymbolTable.h"
#include "llvm/DerivedTypes.h"
+#include <iostream>
+using std::cerr;
void BytecodeWriter::outputType(const Type *T) {
output_vbr((unsigned)T->getPrimitiveID(), Out);
@@ -134,7 +136,7 @@ bool BytecodeWriter::outputConstant(const Constant *CPV) {
case Type::StructTyID: {
const ConstantStruct *CPS = cast<const ConstantStruct>(CPV);
- const vector<Use> &Vals = CPS->getValues();
+ const std::vector<Use> &Vals = CPS->getValues();
for (unsigned i = 0; i < Vals.size(); ++i) {
int Slot = Table.getValSlot(Vals[i]);
diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp
index 825fde6..f047ab5 100644
--- a/lib/Bytecode/Writer/InstructionWriter.cpp
+++ b/lib/Bytecode/Writer/InstructionWriter.cpp
@@ -28,7 +28,7 @@ typedef unsigned char uchar;
//
static void outputInstructionFormat0(const Instruction *I,
const SlotCalculator &Table,
- unsigned Type, deque<uchar> &Out) {
+ unsigned Type, std::deque<uchar> &Out) {
// Opcode must have top two bits clear...
output_vbr(I->getOpcode() << 2, Out); // Instruction Opcode ID
output_vbr(Type, Out); // Result type
@@ -63,7 +63,7 @@ static void outputInstructionFormat0(const Instruction *I,
//
static void outputInstrVarArgsCall(const Instruction *I,
const SlotCalculator &Table, unsigned Type,
- deque<uchar> &Out) {
+ std::deque<uchar> &Out) {
assert(isa<CallInst>(I) || isa<InvokeInst>(I));
// Opcode must have top two bits clear...
output_vbr(I->getOpcode() << 2, Out); // Instruction Opcode ID
@@ -106,7 +106,7 @@ static void outputInstrVarArgsCall(const Instruction *I,
//
static void outputInstructionFormat1(const Instruction *I,
const SlotCalculator &Table, int *Slots,
- unsigned Type, deque<uchar> &Out) {
+ unsigned Type, std::deque<uchar> &Out) {
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
// bits Instruction format:
@@ -127,7 +127,7 @@ static void outputInstructionFormat1(const Instruction *I,
//
static void outputInstructionFormat2(const Instruction *I,
const SlotCalculator &Table, int *Slots,
- unsigned Type, deque<uchar> &Out) {
+ unsigned Type, std::deque<uchar> &Out) {
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
// bits Instruction format:
@@ -151,7 +151,7 @@ static void outputInstructionFormat2(const Instruction *I,
//
static void outputInstructionFormat3(const Instruction *I,
const SlotCalculator &Table, int *Slots,
- unsigned Type, deque<uchar> &Out) {
+ unsigned Type, std::deque<uchar> &Out) {
unsigned Opcode = I->getOpcode(); // Instruction Opcode ID
// bits Instruction format:
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index ede8228..4738f71 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -196,7 +196,8 @@ void SlotCalculator::purgeMethod() {
while (CurPlane.size() != ModuleSize) {
//SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n");
- map<const Value *, unsigned>::iterator NI = NodeMap.find(CurPlane.back());
+ std::map<const Value *, unsigned>::iterator NI =
+ NodeMap.find(CurPlane.back());
assert(NI != NodeMap.end() && "Node not in nodemap?");
NodeMap.erase(NI); // Erase from nodemap
CurPlane.pop_back(); // Shrink plane
@@ -223,7 +224,7 @@ void SlotCalculator::purgeMethod() {
}
int SlotCalculator::getValSlot(const Value *D) const {
- map<const Value*, unsigned>::const_iterator I = NodeMap.find(D);
+ std::map<const Value*, unsigned>::const_iterator I = NodeMap.find(D);
if (I == NodeMap.end()) return -1;
return (int)I->second;
diff --git a/lib/Bytecode/Writer/SlotCalculator.h b/lib/Bytecode/Writer/SlotCalculator.h
index c7b3149..9528244 100644
--- a/lib/Bytecode/Writer/SlotCalculator.h
+++ b/lib/Bytecode/Writer/SlotCalculator.h
@@ -23,14 +23,14 @@ class SlotCalculator {
const Module *TheModule;
bool IgnoreNamedNodes; // Shall we not count named nodes?
- typedef vector<const Value*> TypePlane;
- vector<TypePlane> Table;
- map<const Value *, unsigned> NodeMap;
+ typedef std::vector<const Value*> TypePlane;
+ std::vector<TypePlane> Table;
+ std::map<const Value *, unsigned> NodeMap;
// ModuleLevel - Used to keep track of which values belong to the module,
// and which values belong to the currently incorporated method.
//
- vector<unsigned> ModuleLevel;
+ std::vector<unsigned> ModuleLevel;
public:
SlotCalculator(const Module *M, bool IgnoreNamed);
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 3091384..9ea5d37 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -34,7 +34,7 @@
#include <string.h>
#include <algorithm>
-BytecodeWriter::BytecodeWriter(deque<unsigned char> &o, const Module *M)
+BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
: Out(o), Table(M, false) {
outputSignature();
@@ -66,7 +66,7 @@ void BytecodeWriter::outputConstants(bool isMethod) {
unsigned NumPlanes = Table.getNumPlanes();
for (unsigned pno = 0; pno < NumPlanes; pno++) {
- const vector<const Value*> &Plane = Table.getPlane(pno);
+ const std::vector<const Value*> &Plane = Table.getPlane(pno);
if (Plane.empty()) continue; // Skip empty type planes...
unsigned ValNo = 0;
@@ -95,8 +95,8 @@ void BytecodeWriter::outputConstants(bool isMethod) {
assert (Slot != -1 && "Type in constant pool but not in method!!");
output_vbr((unsigned)Slot, Out);
- //cout << "Emitting " << NC << " constants of type '"
- // << Plane.front()->getType()->getName() << "' = Slot #" << Slot << endl;
+ //cerr << "Emitting " << NC << " constants of type '"
+ // << Plane.front()->getType()->getName() << "' = Slot #" << Slot << "\n";
for (unsigned i = ValNo; i < ValNo+NC; ++i) {
const Value *V = Plane[i];
@@ -211,7 +211,7 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
void WriteBytecodeToFile(const Module *C, ostream &Out) {
assert(C && "You can't write a null module!!");
- deque<unsigned char> Buffer;
+ std::deque<unsigned char> Buffer;
// This object populates buffer for us...
BytecodeWriter BCW(Buffer, C);
@@ -220,7 +220,7 @@ void WriteBytecodeToFile(const Module *C, ostream &Out) {
// sequential in memory, however, so write out as much as possible in big
// chunks, until we're done.
//
- deque<unsigned char>::const_iterator I = Buffer.begin(), E = Buffer.end();
+ std::deque<unsigned char>::const_iterator I = Buffer.begin(),E = Buffer.end();
while (I != E) { // Loop until it's all written
// Scan to see how big this chunk is...
const unsigned char *ChunkPtr = &*I;
@@ -235,7 +235,7 @@ void WriteBytecodeToFile(const Module *C, ostream &Out) {
}
// Write out the chunk...
- Out.write(ChunkPtr, LastPtr-ChunkPtr);
+ Out.write((char*)ChunkPtr, LastPtr-ChunkPtr);
}
Out.flush();
diff --git a/lib/Bytecode/Writer/WriterInternals.h b/lib/Bytecode/Writer/WriterInternals.h
index 8a92987..1017030 100644
--- a/lib/Bytecode/Writer/WriterInternals.h
+++ b/lib/Bytecode/Writer/WriterInternals.h
@@ -20,10 +20,10 @@
#include <deque>
class BytecodeWriter {
- deque<unsigned char> &Out;
+ std::deque<unsigned char> &Out;
SlotCalculator Table;
public:
- BytecodeWriter(deque<unsigned char> &o, const Module *M);
+ BytecodeWriter(std::deque<unsigned char> &o, const Module *M);
protected:
void outputConstants(bool isMethod);
@@ -51,12 +51,12 @@ private :
//
class BytecodeBlock {
unsigned Loc;
- deque<unsigned char> &Out;
+ std::deque<unsigned char> &Out;
BytecodeBlock(const BytecodeBlock &); // do not implement
void operator=(const BytecodeBlock &); // do not implement
public:
- inline BytecodeBlock(unsigned ID, deque<unsigned char> &o) : Out(o) {
+ inline BytecodeBlock(unsigned ID, std::deque<unsigned char> &o) : Out(o) {
output(ID, Out);
output((unsigned)0, Out); // Reserve the space for the block size...
Loc = Out.size();