[llvm-commits] [llvm] r119074 - in /llvm/trunk/lib/Target/PowerPC: PPC.h PPCAsmPrinter.cpp PPCMCInstLower.cpp PPCMCInstLower.h
Chris Lattner
sabre at nondot.org
Sun Nov 14 13:12:33 PST 2010
Author: lattner
Date: Sun Nov 14 15:12:33 2010
New Revision: 119074
URL: http://llvm.org/viewvc/llvm-project?rev=119074&view=rev
Log:
switch PPC to a simplified MCInstLowering model.
Removed:
llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.h
Modified:
llvm/trunk/lib/Target/PowerPC/PPC.h
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPC.h?rev=119074&r1=119073&r2=119074&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPC.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPC.h Sun Nov 14 15:12:33 2010
@@ -24,12 +24,18 @@
class formatted_raw_ostream;
class JITCodeEmitter;
class Target;
+ class MachineInstr;
+ class MCInst;
+ class AsmPrinter;
FunctionPass *createPPCBranchSelectionPass();
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
JITCodeEmitter &MCE);
+void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
+ AsmPrinter &AP);
+
extern Target ThePPC32Target;
extern Target ThePPC64Target;
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=119074&r1=119073&r2=119074&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Nov 14 15:12:33 2010
@@ -20,7 +20,6 @@
#include "PPC.h"
#include "PPCPredicates.h"
#include "PPCTargetMachine.h"
-#include "PPCMCInstLower.h"
#include "PPCSubtarget.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Constants.h"
@@ -59,7 +58,9 @@
// This option tells the asmprinter to use the new (experimental) MCInstPrinter
// path.
static cl::opt<bool> UseInstPrinter("enable-ppc-inst-printer",
- cl::ReallyHidden);
+ cl::ReallyHidden
+ //, cl::init(true)
+ );
namespace {
class PPCAsmPrinter : public AsmPrinter {
@@ -553,8 +554,6 @@
///
void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
if (UseInstPrinter) {
- PPCMCInstLower MCInstLowering(OutContext, *Mang, *this);
-
// Lower multi-instruction pseudo operations.
switch (MI->getOpcode()) {
default: break;
@@ -562,7 +561,7 @@
}
MCInst TmpInst;
- MCInstLowering.Lower(MI, TmpInst);
+ LowerPPCMachineInstrToMCInst(MI, TmpInst, *this);
OutStreamer.EmitInstruction(TmpInst);
return;
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=119074&r1=119073&r2=119074&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Sun Nov 14 15:12:33 2010
@@ -12,15 +12,15 @@
//
//===----------------------------------------------------------------------===//
-#include "PPCMCInstLower.h"
+#include "PPC.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
-
using namespace llvm;
-void PPCMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
+void llvm::LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
+ AsmPrinter &Printer) {
OutMI.setOpcode(MI->getOpcode());
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
@@ -38,36 +38,6 @@
case MachineOperand::MO_Immediate:
MCOp = MCOperand::CreateImm(MO.getImm());
break;
- case MachineOperand::MO_MachineBasicBlock:
- MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
- MO.getMBB()->getSymbol(), Ctx));
- break;
-#if 0
- case MachineOperand::MO_GlobalAddress:
- MCOp = LowerSymbolRefOperand(MO, GetSymbolRef(MO));
- break;
- case MachineOperand::MO_ExternalSymbol:
- MCOp = LowerSymbolRefOperand(MO, GetExternalSymbolSymbol(MO));
- break;
- case MachineOperand::MO_JumpTableIndex:
- MCOp = LowerSymbolOperand(MO, GetJumpTableSymbol(MO));
- break;
- case MachineOperand::MO_ConstantPoolIndex:
- MCOp = LowerSymbolOperand(MO, GetConstantPoolIndexSymbol(MO));
- break;
- case MachineOperand::MO_BlockAddress:
- MCOp = LowerSymbolOperand(MO, Printer.GetBlockAddressSymbol(
- MO.getBlockAddress()));
- break;
-#endif
-#if 0
- case MachineOperand::MO_FPImmediate:
- APFloat Val = MO.getFPImm()->getValueAPF();
- bool ignored;
- Val.convert(APFloat::IEEEdouble, APFloat::rmTowardZero, &ignored);
- MCOp = MCOperand::CreateFPImm(Val.convertToDouble());
- break;
-#endif
}
OutMI.addOperand(MCOp);
Removed: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.h?rev=119073&view=auto
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.h (removed)
@@ -1,54 +0,0 @@
-//===-- PPCMCInstLower.h - Lower MachineInstr to MCInst -------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef PPC_MCINSTLOWER_H
-#define PPC_MCINSTLOWER_H
-
-#include "llvm/Support/Compiler.h"
-
-namespace llvm {
- class AsmPrinter;
- class GlobalValue;
- class MCAsmInfo;
- class MCContext;
- class MCInst;
- class MCOperand;
- class MCSymbol;
- class MCSymbolRefExpr;
- class MachineInstr;
- class MachineModuleInfoMachO;
- class MachineOperand;
- class Mangler;
-
-/// PPCMCInstLower - This class is used to lower an MachineInstr into an MCInst.
-class LLVM_LIBRARY_VISIBILITY PPCMCInstLower {
- MCContext &Ctx;
- Mangler &Mang;
- AsmPrinter &Printer;
-public:
- PPCMCInstLower(MCContext &ctx, Mangler &mang, AsmPrinter &printer)
- : Ctx(ctx), Mang(mang), Printer(printer) {}
-
- void Lower(const MachineInstr *MI, MCInst &OutMI) const;
-
-private:
- MCSymbol *GetGlobalAddressSymbol(const GlobalValue *GV) const;
- const MCSymbolRefExpr *GetSymbolRef(const MachineOperand &MO) const;
- const MCSymbolRefExpr *GetExternalSymbolSymbol(const MachineOperand &MO)
- const;
- MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const;
- MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const;
- MCOperand LowerSymbolRefOperand(const MachineOperand &MO,
- const MCSymbolRefExpr *Expr) const;
- MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
-
-};
-} // end namespace llvm
-
-#endif
More information about the llvm-commits
mailing list