mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
Implement global variable support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user