summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Writer
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-10 07:58:01 +0000
committerChris Lattner <sabre@nondot.org>2001-09-10 07:58:01 +0000
commitda9755002f3ab593b745dd055f4c3ff1ad66aac7 (patch)
treea778381d84adcc740d5211ce9894bdce55d40532 /llvm/lib/Bytecode/Writer
parentbaf08eb2a7845d48a0945f26a3bd80098f63a116 (diff)
downloadbcm5719-llvm-da9755002f3ab593b745dd055f4c3ff1ad66aac7.tar.gz
bcm5719-llvm-da9755002f3ab593b745dd055f4c3ff1ad66aac7.zip
Implement global variable support
llvm-svn: 530
Diffstat (limited to 'llvm/lib/Bytecode/Writer')
-rw-r--r--llvm/lib/Bytecode/Writer/Writer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp
index 42351458229..e6562f5fb94 100644
--- a/llvm/lib/Bytecode/Writer/Writer.cpp
+++ b/llvm/lib/Bytecode/Writer/Writer.cpp
@@ -24,6 +24,7 @@
#include "WriterInternals.h"
#include "llvm/Module.h"
+#include "llvm/GlobalVariable.h"
#include "llvm/Method.h"
#include "llvm/BasicBlock.h"
#include "llvm/ConstPoolVals.h"
@@ -117,7 +118,15 @@ void BytecodeWriter::outputConstants(bool isMethod) {
void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfo, Out);
- // Output the types of the methods in this class
+ // Output the types for the global variables in the module...
+ for (Module::const_giterator I = M->gbegin(), End = M->gend(); I != End;++I) {
+ int Slot = Table.getValSlot((*I)->getType());
+ assert(Slot != -1 && "Module global vars is broken!");
+ output_vbr((unsigned)Slot, Out);
+ }
+ output_vbr((unsigned)Table.getValSlot(Type::VoidTy), Out);
+
+ // Output the types of the methods in this module...
for (Module::const_iterator I = M->begin(), End = M->end(); I != End; ++I) {
int Slot = Table.getValSlot((*I)->getType());
assert(Slot != -1 && "Module const pool is broken!");
@@ -125,6 +134,8 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
output_vbr((unsigned)Slot, Out);
}
output_vbr((unsigned)Table.getValSlot(Type::VoidTy), Out);
+
+
align32(Out);
}
OpenPOWER on IntegriCloud