From: Chris Lattner Date: Wed, 3 May 2006 00:31:21 +0000 (+0000) Subject: Keep the alpha JIT similar to the PPC/X86 jits X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=23118b649e15774024e4d81566a16454a91c8e9a;p=oota-llvm.git Keep the alpha JIT similar to the PPC/X86 jits git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28068 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Alpha/AlphaCodeEmitter.cpp b/lib/Target/Alpha/AlphaCodeEmitter.cpp index 1c3398ea07a..8cadbd05622 100644 --- a/lib/Target/Alpha/AlphaCodeEmitter.cpp +++ b/lib/Target/Alpha/AlphaCodeEmitter.cpp @@ -35,7 +35,7 @@ namespace { class AlphaCodeEmitter : public MachineFunctionPass { const AlphaInstrInfo *II; MachineCodeEmitter &MCE; - std::map BasicBlockAddrs; + std::vector BasicBlockAddrs; std::vector > BBRefs; /// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr @@ -87,7 +87,7 @@ bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction &MF) { // Resolve all forward branches now... for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) { - unsigned* Location = (unsigned*)BasicBlockAddrs[BBRefs[i].first]; + unsigned* Location = BasicBlockAddrs[BBRefs[i].first->getNumber()]; unsigned* Ref = (unsigned*)BBRefs[i].second; intptr_t BranchTargetDisp = (((unsigned char*)Location - (unsigned char*)Ref) >> 2) - 1; @@ -103,8 +103,10 @@ bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction &MF) { } void AlphaCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) { - uintptr_t Addr = MCE.getCurrentPCValue(); - BasicBlockAddrs[&MBB] = (unsigned*)Addr; + if (BasicBlockAddrs.size() <= (unsigned)MBB.getNumber()) + BasicBlockAddrs.resize((MBB.getNumber()+1)*2); + + BasicBlockAddrs[MBB.getNumber()] = (unsigned*)MCE.getCurrentPCValue(); for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ++I) {