using namespace llvm;
namespace {
-
+
class AlphaCodeEmitter {
MachineCodeEmitter &MCE;
public:
};
template <class CodeEmitter>
- class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass,
- public AlphaCodeEmitter
+ class Emitter : public MachineFunctionPass, public AlphaCodeEmitter
{
const AlphaInstrInfo *II;
TargetMachine &TM;
public:
static char ID;
explicit Emitter(TargetMachine &tm, CodeEmitter &mce)
- : MachineFunctionPass(&ID), AlphaCodeEmitter(mce),
+ : MachineFunctionPass(&ID), AlphaCodeEmitter(mce),
II(0), TM(tm), MCE(mce) {}
Emitter(TargetMachine &tm, CodeEmitter &mce, const AlphaInstrInfo& ii)
: MachineFunctionPass(&ID), AlphaCodeEmitter(mce),
return "Alpha Machine Code Emitter";
}
- void emitInstruction(const MachineInstr &MI);
-
private:
void emitBasicBlock(MachineBasicBlock &MBB);
};
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
I != E; ++I) {
const MachineInstr &MI = *I;
+ MCE.processDebugLoc(MI.getDebugLoc(), true);
switch(MI.getOpcode()) {
default:
MCE.emitWordLE(getBinaryCodeForInstr(*I));
case Alpha::PCLABEL:
case Alpha::MEMLABEL:
case TargetInstrInfo::IMPLICIT_DEF:
+ case TargetInstrInfo::KILL:
break; //skip these
}
+ MCE.processDebugLoc(MI.getDebugLoc(), false);
}
}
case Alpha::R30 : case Alpha::F30 : return 30;
case Alpha::R31 : case Alpha::F31 : return 31;
default:
- LLVM_UNREACHABLE("Unhandled reg");
+ llvm_unreachable("Unhandled reg");
}
}
unsigned AlphaCodeEmitter::getMachineOpValue(const MachineInstr &MI,
- const MachineOperand &MO) {
+ const MachineOperand &MO) {
unsigned rv = 0; // Return value; defaults to 0 for unhandled cases
// or things that get fixed up later by the JIT.
} else if (MO.isImm()) {
rv = MO.getImm();
} else if (MO.isGlobal() || MO.isSymbol() || MO.isCPI()) {
- DOUT << MO << " is a relocated op for " << MI << "\n";
+ DEBUG(errs() << MO << " is a relocated op for " << MI << "\n");
unsigned Reloc = 0;
int Offset = 0;
bool useGOT = false;
Offset = MI.getOperand(3).getImm();
break;
default:
- LLVM_UNREACHABLE("unknown relocatable instruction");
+ llvm_unreachable("unknown relocatable instruction");
}
if (MO.isGlobal())
MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(),
Alpha::reloc_bsr, MO.getMBB()));
} else {
#ifndef NDEBUG
- cerr << "ERROR: Unknown type of MachineOperand: " << MO << "\n";
+ errs() << "ERROR: Unknown type of MachineOperand: " << MO << "\n";
#endif
- llvm_unreachable();
+ llvm_unreachable(0);
}
return rv;
}
#include "AlphaGenCodeEmitter.inc"
-
-