aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-05-14 06:54:58 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-05-14 06:54:58 +0000
commit09015d9468abc3afb9880f9405bde31346d2b27d (patch)
tree72eec77812ee600ac22e29c414c98c6ed76efa9a /lib/Target
parent3fb5d1a6cc011247c304cd05b0e68c2f22fde658 (diff)
downloadexternal_llvm-09015d9468abc3afb9880f9405bde31346d2b27d.zip
external_llvm-09015d9468abc3afb9880f9405bde31346d2b27d.tar.gz
external_llvm-09015d9468abc3afb9880f9405bde31346d2b27d.tar.bz2
Don't keep track of references to LLVM BasicBlocks while emitting; use
MachineBasicBlocks instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86CodeEmitter.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index ddd5f56..185423a 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -172,8 +172,8 @@ namespace {
class Emitter : public MachineFunctionPass {
const X86InstrInfo *II;
MachineCodeEmitter &MCE;
- std::map<const BasicBlock*, unsigned> BasicBlockAddrs;
- std::vector<std::pair<const BasicBlock*, unsigned> > BBRefs;
+ std::map<const MachineBasicBlock*, unsigned> BasicBlockAddrs;
+ std::vector<std::pair<const MachineBasicBlock *, unsigned> > BBRefs;
public:
explicit Emitter(MachineCodeEmitter &mce) : II(0), MCE(mce) {}
Emitter(MachineCodeEmitter &mce, const X86InstrInfo& ii)
@@ -190,7 +190,7 @@ namespace {
private:
void emitBasicBlock(const MachineBasicBlock &MBB);
- void emitPCRelativeBlockAddress(const BasicBlock *BB);
+ void emitPCRelativeBlockAddress(const MachineBasicBlock *BB);
void emitMaybePCRelativeValue(unsigned Address, bool isPCRelative);
void emitGlobalAddressForCall(GlobalValue *GV);
void emitGlobalAddressForPtr(GlobalValue *GV);
@@ -249,22 +249,21 @@ bool Emitter::runOnMachineFunction(MachineFunction &MF) {
void Emitter::emitBasicBlock(const MachineBasicBlock &MBB) {
if (uint64_t Addr = MCE.getCurrentPCValue())
- BasicBlockAddrs[MBB.getBasicBlock()] = Addr;
+ BasicBlockAddrs[&MBB] = Addr;
for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end(); I != E; ++I)
emitInstruction(*I);
}
-
/// emitPCRelativeBlockAddress - This method emits the PC relative address of
/// the specified basic block, or if the basic block hasn't been emitted yet
/// (because this is a forward branch), it keeps track of the information
/// necessary to resolve this address later (and emits a dummy value).
///
-void Emitter::emitPCRelativeBlockAddress(const BasicBlock *BB) {
+void Emitter::emitPCRelativeBlockAddress(const MachineBasicBlock *MBB) {
// FIXME: Emit backward branches directly
- BBRefs.push_back(std::make_pair(BB, MCE.getCurrentPCValue()));
- MCE.emitWord(0); // Emit a dummy value
+ BBRefs.push_back(std::make_pair(MBB, MCE.getCurrentPCValue()));
+ MCE.emitWord(0);
}
/// emitMaybePCRelativeValue - Emit a 32-bit address which may be PC relative.
@@ -527,9 +526,8 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
MCE.emitByte(BaseOpcode);
if (MI.getNumOperands() == 1) {
const MachineOperand &MO = MI.getOperand(0);
- if (MO.isPCRelativeDisp()) {
- // Conditional branch... FIXME: this should use an MBB destination!
- emitPCRelativeBlockAddress(cast<BasicBlock>(MO.getVRegValue()));
+ if (MO.isMachineBasicBlock()) {
+ emitPCRelativeBlockAddress(MO.getMachineBasicBlock());
} else if (MO.isGlobalAddress()) {
assert(MO.isPCRelative() && "Call target is not PC Relative?");
emitGlobalAddressForCall(MO.getGlobal());