get fancy: support basic block operands. Yay for jumps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-10-20 00:52:47 +00:00
parent 233917c072
commit 96bc2173bb
3 changed files with 12 additions and 15 deletions

View File

@ -1311,7 +1311,7 @@ extern "C" void LLVMInitializeARMAsmPrinter() {
//===----------------------------------------------------------------------===//
void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
ARMMCInstLower MCInstLowering(OutContext, *Mang, getFunctionNumber(), *MAI);
ARMMCInstLower MCInstLowering(OutContext, *Mang, *this);
switch (MI->getOpcode()) {
default: break;
case TargetInstrInfo::DBG_LABEL:

View File

@ -14,7 +14,8 @@
#include "ARMMCInstLower.h"
//#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@ -57,8 +58,8 @@ GetGlobalAddressSymbol(const MachineOperand &MO) const {
MCSymbol *ARMMCInstLower::
GetJumpTableSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
raw_svector_ostream(Name) << MAI.getPrivateGlobalPrefix() << "JTI"
<< CurFunctionNumber << '_' << MO.getIndex();
raw_svector_ostream(Name) << Printer.MAI->getPrivateGlobalPrefix() << "JTI"
<< Printer.getFunctionNumber() << '_' << MO.getIndex();
#if 0
switch (MO.getTargetFlags()) {
@ -73,8 +74,8 @@ GetJumpTableSymbol(const MachineOperand &MO) const {
MCSymbol *ARMMCInstLower::
GetConstantPoolIndexSymbol(const MachineOperand &MO) const {
SmallString<256> Name;
raw_svector_ostream(Name) << MAI.getPrivateGlobalPrefix() << "CPI"
<< CurFunctionNumber << '_' << MO.getIndex();
raw_svector_ostream(Name) << Printer.MAI->getPrivateGlobalPrefix() << "CPI"
<< Printer.getFunctionNumber() << '_' << MO.getIndex();
#if 0
switch (MO.getTargetFlags()) {
@ -125,12 +126,10 @@ void ARMMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
case MachineOperand::MO_Immediate:
MCOp = MCOperand::CreateImm(MO.getImm());
break;
#if 0
case MachineOperand::MO_MachineBasicBlock:
MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
AsmPrinter.GetMBBSymbol(MO.getMBB()->getNumber()), Ctx));
Printer.GetMBBSymbol(MO.getMBB()->getNumber()), Ctx));
break;
#endif
case MachineOperand::MO_GlobalAddress:
MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
break;

View File

@ -13,6 +13,7 @@
#include "llvm/Support/Compiler.h"
namespace llvm {
class AsmPrinter;
class MCAsmInfo;
class MCContext;
class MCInst;
@ -28,15 +29,12 @@ namespace llvm {
class VISIBILITY_HIDDEN ARMMCInstLower {
MCContext &Ctx;
Mangler &Mang;
const unsigned CurFunctionNumber;
const MCAsmInfo &MAI;
AsmPrinter &Printer;
//const ARMSubtarget &getSubtarget() const;
public:
ARMMCInstLower(MCContext &ctx, Mangler &mang, unsigned FuncNum,
const MCAsmInfo &mai)
: Ctx(ctx), Mang(mang), CurFunctionNumber(FuncNum), MAI(mai) {}
ARMMCInstLower(MCContext &ctx, Mangler &mang, AsmPrinter &printer)
: Ctx(ctx), Mang(mang), Printer(printer) {}
void Lower(const MachineInstr *MI, MCInst &OutMI) const;