Register the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to

assert if the setModuleInfo hasn't been called.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-09-21 05:58:35 +00:00
parent f716330c90
commit 003de66227
2 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
using namespace llvm;
JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : Jit(theJit) {}
JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : MMI(0), Jit(theJit) {}
unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F,
@ -38,6 +38,8 @@ unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F,
unsigned char* StartFunction,
unsigned char* EndFunction,
unsigned char* &EHFramePtr) {
assert(MMI && "MachineModuleInfo not registered!");
const TargetMachine& TM = F.getTarget();
TD = TM.getTargetData();
stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection();
@ -206,6 +208,8 @@ struct CallSiteEntry {
unsigned char* JITDwarfEmitter::EmitExceptionTable(MachineFunction* MF,
unsigned char* StartFunction,
unsigned char* EndFunction) const {
assert(MMI && "MachineModuleInfo not registered!");
// Map all labels and get rid of any dead landing pads.
MMI->TidyLandingPads();

View File

@ -31,6 +31,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
@ -67,6 +68,11 @@ namespace {
const std::vector<MachineJumpTableEntry> *MJTEs;
bool IsPIC;
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<MachineModuleInfo>();
MachineFunctionPass::getAnalysisUsage(AU);
}
public:
static char ID;
explicit Emitter(TargetMachine &tm, CodeEmitter &mce)
@ -204,6 +210,7 @@ bool Emitter<CodeEmitter>::runOnMachineFunction(MachineFunction &MF) {
MJTEs = &MF.getJumpTableInfo()->getJumpTables();
IsPIC = TM.getRelocationModel() == Reloc::PIC_;
JTI->Initialize(MF, IsPIC);
MCE.setModuleInfo(&getAnalysis<MachineModuleInfo>());
do {
DEBUG(errs() << "JITTing function '"