[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue May 2 17:31:33 PDT 2006
Changes in directory llvm/lib/Target/Alpha:
AlphaCodeEmitter.cpp updated: 1.12 -> 1.13
---
Log message:
Keep the alpha JIT similar to the PPC/X86 jits
---
Diffs of the changes: (+6 -4)
AlphaCodeEmitter.cpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
Index: llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp
diff -u llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.12 llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.13
--- llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.12 Tue May 2 18:22:24 2006
+++ llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp Tue May 2 19:31:21 2006
@@ -35,7 +35,7 @@
class AlphaCodeEmitter : public MachineFunctionPass {
const AlphaInstrInfo *II;
MachineCodeEmitter &MCE;
- std::map<const MachineBasicBlock*, unsigned*> BasicBlockAddrs;
+ std::vector<unsigned*> BasicBlockAddrs;
std::vector<std::pair<const MachineBasicBlock *, unsigned*> > BBRefs;
/// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr
@@ -87,7 +87,7 @@
// 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 @@
}
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) {
More information about the llvm-commits
mailing list