mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Refactor PPC target to separate MC routines from Target routines.
llvm-svn: 135942
This commit is contained in:
parent
bbacc163bb
commit
43afb1ea2a
@ -10,7 +10,6 @@ tablegen(PPCGenCallingConv.inc -gen-callingconv)
|
|||||||
tablegen(PPCGenSubtargetInfo.inc -gen-subtarget)
|
tablegen(PPCGenSubtargetInfo.inc -gen-subtarget)
|
||||||
|
|
||||||
add_llvm_target(PowerPCCodeGen
|
add_llvm_target(PowerPCCodeGen
|
||||||
PPCAsmBackend.cpp
|
|
||||||
PPCAsmPrinter.cpp
|
PPCAsmPrinter.cpp
|
||||||
PPCBranchSelector.cpp
|
PPCBranchSelector.cpp
|
||||||
PPCCodeEmitter.cpp
|
PPCCodeEmitter.cpp
|
||||||
@ -20,7 +19,6 @@ add_llvm_target(PowerPCCodeGen
|
|||||||
PPCISelLowering.cpp
|
PPCISelLowering.cpp
|
||||||
PPCFrameLowering.cpp
|
PPCFrameLowering.cpp
|
||||||
PPCJITInfo.cpp
|
PPCJITInfo.cpp
|
||||||
PPCMCCodeEmitter.cpp
|
|
||||||
PPCMCInstLower.cpp
|
PPCMCInstLower.cpp
|
||||||
PPCPredicates.cpp
|
PPCPredicates.cpp
|
||||||
PPCRegisterInfo.cpp
|
PPCRegisterInfo.cpp
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
add_llvm_library(LLVMPowerPCDesc
|
add_llvm_library(LLVMPowerPCDesc
|
||||||
|
PPCAsmBackend.cpp
|
||||||
PPCMCTargetDesc.cpp
|
PPCMCTargetDesc.cpp
|
||||||
PPCMCAsmInfo.cpp
|
PPCMCAsmInfo.cpp
|
||||||
|
PPCMCCodeEmitter.cpp
|
||||||
)
|
)
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/MC/TargetAsmBackend.h"
|
#include "llvm/MC/TargetAsmBackend.h"
|
||||||
#include "PPC.h"
|
#include "MCTargetDesc/PPCMCTargetDesc.h"
|
||||||
#include "PPCFixupKinds.h"
|
#include "MCTargetDesc/PPCFixupKinds.h"
|
||||||
#include "llvm/MC/MCMachObjectWriter.h"
|
#include "llvm/MC/MCMachObjectWriter.h"
|
||||||
#include "llvm/MC/MCSectionMachO.h"
|
#include "llvm/MC/MCSectionMachO.h"
|
||||||
#include "llvm/MC/MCObjectWriter.h"
|
#include "llvm/MC/MCObjectWriter.h"
|
@ -12,9 +12,8 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#define DEBUG_TYPE "mccodeemitter"
|
#define DEBUG_TYPE "mccodeemitter"
|
||||||
#include "PPC.h"
|
#include "MCTargetDesc/PPCBaseInfo.h"
|
||||||
#include "PPCRegisterInfo.h"
|
#include "MCTargetDesc/PPCFixupKinds.h"
|
||||||
#include "PPCFixupKinds.h"
|
|
||||||
#include "llvm/MC/MCCodeEmitter.h"
|
#include "llvm/MC/MCCodeEmitter.h"
|
||||||
#include "llvm/MC/MCInst.h"
|
#include "llvm/MC/MCInst.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -170,7 +169,7 @@ get_crbitm_encoding(const MCInst &MI, unsigned OpNo,
|
|||||||
const MCOperand &MO = MI.getOperand(OpNo);
|
const MCOperand &MO = MI.getOperand(OpNo);
|
||||||
assert((MI.getOpcode() == PPC::MTCRF || MI.getOpcode() == PPC::MFOCRF) &&
|
assert((MI.getOpcode() == PPC::MTCRF || MI.getOpcode() == PPC::MFOCRF) &&
|
||||||
(MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
|
(MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
|
||||||
return 0x80 >> PPCRegisterInfo::getRegisterNumbering(MO.getReg());
|
return 0x80 >> getPPCRegisterNumbering(MO.getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
|||||||
// The GPR operand should come through here though.
|
// The GPR operand should come through here though.
|
||||||
assert((MI.getOpcode() != PPC::MTCRF && MI.getOpcode() != PPC::MFOCRF) ||
|
assert((MI.getOpcode() != PPC::MTCRF && MI.getOpcode() != PPC::MFOCRF) ||
|
||||||
MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
|
MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
|
||||||
return PPCRegisterInfo::getRegisterNumbering(MO.getReg());
|
return getPPCRegisterNumbering(MO.getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(MO.isImm() &&
|
assert(MO.isImm() &&
|
@ -16,6 +16,7 @@
|
|||||||
#include "llvm/MC/MachineLocation.h"
|
#include "llvm/MC/MachineLocation.h"
|
||||||
#include "llvm/MC/MCInstrInfo.h"
|
#include "llvm/MC/MCInstrInfo.h"
|
||||||
#include "llvm/MC/MCRegisterInfo.h"
|
#include "llvm/MC/MCRegisterInfo.h"
|
||||||
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSubtargetInfo.h"
|
#include "llvm/MC/MCSubtargetInfo.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
|
|
||||||
@ -87,6 +88,19 @@ static MCCodeGenInfo *createPPCMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is duplicated code. Refactor this.
|
||||||
|
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||||
|
MCContext &Ctx, TargetAsmBackend &TAB,
|
||||||
|
raw_ostream &OS,
|
||||||
|
MCCodeEmitter *Emitter,
|
||||||
|
bool RelaxAll,
|
||||||
|
bool NoExecStack) {
|
||||||
|
if (Triple(TT).isOSDarwin())
|
||||||
|
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializePowerPCTargetMC() {
|
extern "C" void LLVMInitializePowerPCTargetMC() {
|
||||||
// Register the MC asm info.
|
// Register the MC asm info.
|
||||||
RegisterMCAsmInfoFn C(ThePPC32Target, createPPCMCAsmInfo);
|
RegisterMCAsmInfoFn C(ThePPC32Target, createPPCMCAsmInfo);
|
||||||
@ -109,4 +123,16 @@ extern "C" void LLVMInitializePowerPCTargetMC() {
|
|||||||
createPPCMCSubtargetInfo);
|
createPPCMCSubtargetInfo);
|
||||||
TargetRegistry::RegisterMCSubtargetInfo(ThePPC64Target,
|
TargetRegistry::RegisterMCSubtargetInfo(ThePPC64Target,
|
||||||
createPPCMCSubtargetInfo);
|
createPPCMCSubtargetInfo);
|
||||||
|
|
||||||
|
// Register the MC Code Emitter
|
||||||
|
TargetRegistry::RegisterCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter);
|
||||||
|
TargetRegistry::RegisterCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter);
|
||||||
|
|
||||||
|
// Register the asm backend.
|
||||||
|
TargetRegistry::RegisterAsmBackend(ThePPC32Target, createPPCAsmBackend);
|
||||||
|
TargetRegistry::RegisterAsmBackend(ThePPC64Target, createPPCAsmBackend);
|
||||||
|
|
||||||
|
// Register the object streamer.
|
||||||
|
TargetRegistry::RegisterObjectStreamer(ThePPC32Target, createMCStreamer);
|
||||||
|
TargetRegistry::RegisterObjectStreamer(ThePPC64Target, createMCStreamer);
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,26 @@
|
|||||||
#ifndef PPCMCTARGETDESC_H
|
#ifndef PPCMCTARGETDESC_H
|
||||||
#define PPCMCTARGETDESC_H
|
#define PPCMCTARGETDESC_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MCCodeEmitter;
|
||||||
|
class MCContext;
|
||||||
|
class MCInstrInfo;
|
||||||
class MCSubtargetInfo;
|
class MCSubtargetInfo;
|
||||||
class Target;
|
class Target;
|
||||||
|
class TargetAsmBackend;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
|
|
||||||
extern Target ThePPC32Target;
|
extern Target ThePPC32Target;
|
||||||
extern Target ThePPC64Target;
|
extern Target ThePPC64Target;
|
||||||
|
|
||||||
|
MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
|
MCContext &Ctx);
|
||||||
|
|
||||||
|
TargetAsmBackend *createPPCAsmBackend(const Target &, const std::string &);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
// Defines symbolic names for PowerPC registers. This defines a mapping from
|
// Defines symbolic names for PowerPC registers. This defines a mapping from
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#ifndef LLVM_TARGET_POWERPC_H
|
#ifndef LLVM_TARGET_POWERPC_H
|
||||||
#define LLVM_TARGET_POWERPC_H
|
#define LLVM_TARGET_POWERPC_H
|
||||||
|
|
||||||
|
#include "MCTargetDesc/PPCBaseInfo.h"
|
||||||
#include "MCTargetDesc/PPCMCTargetDesc.h"
|
#include "MCTargetDesc/PPCMCTargetDesc.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -41,11 +42,6 @@ namespace llvm {
|
|||||||
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
||||||
FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
|
FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
|
||||||
JITCodeEmitter &MCE);
|
JITCodeEmitter &MCE);
|
||||||
MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
|
|
||||||
const MCSubtargetInfo &STI,
|
|
||||||
MCContext &Ctx);
|
|
||||||
TargetAsmBackend *createPPCAsmBackend(const Target &, const std::string &);
|
|
||||||
|
|
||||||
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
||||||
AsmPrinter &AP, bool isDarwin);
|
AsmPrinter &AP, bool isDarwin);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ unsigned PPCCodeEmitter::get_crbitm_encoding(const MachineInstr &MI,
|
|||||||
const MachineOperand &MO = MI.getOperand(OpNo);
|
const MachineOperand &MO = MI.getOperand(OpNo);
|
||||||
assert((MI.getOpcode() == PPC::MTCRF || MI.getOpcode() == PPC::MFOCRF) &&
|
assert((MI.getOpcode() == PPC::MTCRF || MI.getOpcode() == PPC::MFOCRF) &&
|
||||||
(MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
|
(MO.getReg() >= PPC::CR0 && MO.getReg() <= PPC::CR7));
|
||||||
return 0x80 >> PPCRegisterInfo::getRegisterNumbering(MO.getReg());
|
return 0x80 >> getPPCRegisterNumbering(MO.getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineRelocation PPCCodeEmitter::GetRelocation(const MachineOperand &MO,
|
MachineRelocation PPCCodeEmitter::GetRelocation(const MachineOperand &MO,
|
||||||
@ -250,7 +250,7 @@ unsigned PPCCodeEmitter::getMachineOpValue(const MachineInstr &MI,
|
|||||||
// The GPR operand should come through here though.
|
// The GPR operand should come through here though.
|
||||||
assert((MI.getOpcode() != PPC::MTCRF && MI.getOpcode() != PPC::MFOCRF) ||
|
assert((MI.getOpcode() != PPC::MTCRF && MI.getOpcode() != PPC::MFOCRF) ||
|
||||||
MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
|
MO.getReg() < PPC::CR0 || MO.getReg() > PPC::CR7);
|
||||||
return PPCRegisterInfo::getRegisterNumbering(MO.getReg());
|
return getPPCRegisterNumbering(MO.getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(MO.isImm() &&
|
assert(MO.isImm() &&
|
||||||
|
@ -109,14 +109,14 @@ static void HandleVRSaveUpdate(MachineInstr *MI, const TargetInstrInfo &TII) {
|
|||||||
for (MachineRegisterInfo::livein_iterator
|
for (MachineRegisterInfo::livein_iterator
|
||||||
I = MF->getRegInfo().livein_begin(),
|
I = MF->getRegInfo().livein_begin(),
|
||||||
E = MF->getRegInfo().livein_end(); I != E; ++I) {
|
E = MF->getRegInfo().livein_end(); I != E; ++I) {
|
||||||
unsigned RegNo = PPCRegisterInfo::getRegisterNumbering(I->first);
|
unsigned RegNo = getPPCRegisterNumbering(I->first);
|
||||||
if (VRRegNo[RegNo] == I->first) // If this really is a vector reg.
|
if (VRRegNo[RegNo] == I->first) // If this really is a vector reg.
|
||||||
UsedRegMask &= ~(1 << (31-RegNo)); // Doesn't need to be marked.
|
UsedRegMask &= ~(1 << (31-RegNo)); // Doesn't need to be marked.
|
||||||
}
|
}
|
||||||
for (MachineRegisterInfo::liveout_iterator
|
for (MachineRegisterInfo::liveout_iterator
|
||||||
I = MF->getRegInfo().liveout_begin(),
|
I = MF->getRegInfo().liveout_begin(),
|
||||||
E = MF->getRegInfo().liveout_end(); I != E; ++I) {
|
E = MF->getRegInfo().liveout_end(); I != E; ++I) {
|
||||||
unsigned RegNo = PPCRegisterInfo::getRegisterNumbering(*I);
|
unsigned RegNo = getPPCRegisterNumbering(*I);
|
||||||
if (VRRegNo[RegNo] == *I) // If this really is a vector reg.
|
if (VRRegNo[RegNo] == *I) // If this really is a vector reg.
|
||||||
UsedRegMask &= ~(1 << (31-RegNo)); // Doesn't need to be marked.
|
UsedRegMask &= ~(1 << (31-RegNo)); // Doesn't need to be marked.
|
||||||
}
|
}
|
||||||
@ -878,7 +878,7 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF)
|
|||||||
FFI->setObjectOffset(FI, LowerBound + FFI->getObjectOffset(FI));
|
FFI->setObjectOffset(FI, LowerBound + FFI->getObjectOffset(FI));
|
||||||
}
|
}
|
||||||
|
|
||||||
LowerBound -= (31 - PPCRegisterInfo::getRegisterNumbering(MinFPR) + 1) * 8;
|
LowerBound -= (31 - getPPCRegisterNumbering(MinFPR) + 1) * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the frame pointer register is allocated. If so, make sure it
|
// Check whether the frame pointer register is allocated. If so, make sure it
|
||||||
@ -912,8 +912,8 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned MinReg =
|
unsigned MinReg =
|
||||||
std::min<unsigned>(PPCRegisterInfo::getRegisterNumbering(MinGPR),
|
std::min<unsigned>(getPPCRegisterNumbering(MinGPR),
|
||||||
PPCRegisterInfo::getRegisterNumbering(MinG8R));
|
getPPCRegisterNumbering(MinG8R));
|
||||||
|
|
||||||
if (Subtarget.isPPC64()) {
|
if (Subtarget.isPPC64()) {
|
||||||
LowerBound -= (31 - MinReg + 1) * 8;
|
LowerBound -= (31 - MinReg + 1) * 8;
|
||||||
|
@ -402,7 +402,7 @@ PPCInstrInfo::StoreRegToStackSlot(MachineFunction &MF,
|
|||||||
// If the saved register wasn't CR0, shift the bits left so that they are
|
// If the saved register wasn't CR0, shift the bits left so that they are
|
||||||
// in CR0's slot.
|
// in CR0's slot.
|
||||||
if (SrcReg != PPC::CR0) {
|
if (SrcReg != PPC::CR0) {
|
||||||
unsigned ShiftBits = PPCRegisterInfo::getRegisterNumbering(SrcReg)*4;
|
unsigned ShiftBits = getPPCRegisterNumbering(SrcReg)*4;
|
||||||
// rlwinm scratch, scratch, ShiftBits, 0, 31.
|
// rlwinm scratch, scratch, ShiftBits, 0, 31.
|
||||||
NewMIs.push_back(BuildMI(MF, DL, get(PPC::RLWINM), ScratchReg)
|
NewMIs.push_back(BuildMI(MF, DL, get(PPC::RLWINM), ScratchReg)
|
||||||
.addReg(ScratchReg).addImm(ShiftBits)
|
.addReg(ScratchReg).addImm(ShiftBits)
|
||||||
@ -537,7 +537,7 @@ PPCInstrInfo::LoadRegFromStackSlot(MachineFunction &MF, DebugLoc DL,
|
|||||||
// If the reloaded register isn't CR0, shift the bits right so that they are
|
// If the reloaded register isn't CR0, shift the bits right so that they are
|
||||||
// in the right CR's slot.
|
// in the right CR's slot.
|
||||||
if (DestReg != PPC::CR0) {
|
if (DestReg != PPC::CR0) {
|
||||||
unsigned ShiftBits = PPCRegisterInfo::getRegisterNumbering(DestReg)*4;
|
unsigned ShiftBits = getPPCRegisterNumbering(DestReg)*4;
|
||||||
// rlwinm r11, r11, 32-ShiftBits, 0, 31.
|
// rlwinm r11, r11, 32-ShiftBits, 0, 31.
|
||||||
NewMIs.push_back(BuildMI(MF, DL, get(PPC::RLWINM), ScratchReg)
|
NewMIs.push_back(BuildMI(MF, DL, get(PPC::RLWINM), ScratchReg)
|
||||||
.addReg(ScratchReg).addImm(32-ShiftBits).addImm(0)
|
.addReg(ScratchReg).addImm(32-ShiftBits).addImm(0)
|
||||||
|
@ -67,49 +67,6 @@ PPCRegisterInfo::requiresRegisterScavenging(const MachineFunction &) const {
|
|||||||
(EnablePPC64RS && Subtarget.isPPC64()));
|
(EnablePPC64RS && Subtarget.isPPC64()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
|
||||||
/// PPC::F14, return the number that it corresponds to (e.g. 14).
|
|
||||||
unsigned PPCRegisterInfo::getRegisterNumbering(unsigned RegEnum) {
|
|
||||||
using namespace PPC;
|
|
||||||
switch (RegEnum) {
|
|
||||||
case 0: return 0;
|
|
||||||
case R0 : case X0 : case F0 : case V0 : case CR0: case CR0LT: return 0;
|
|
||||||
case R1 : case X1 : case F1 : case V1 : case CR1: case CR0GT: return 1;
|
|
||||||
case R2 : case X2 : case F2 : case V2 : case CR2: case CR0EQ: return 2;
|
|
||||||
case R3 : case X3 : case F3 : case V3 : case CR3: case CR0UN: return 3;
|
|
||||||
case R4 : case X4 : case F4 : case V4 : case CR4: case CR1LT: return 4;
|
|
||||||
case R5 : case X5 : case F5 : case V5 : case CR5: case CR1GT: return 5;
|
|
||||||
case R6 : case X6 : case F6 : case V6 : case CR6: case CR1EQ: return 6;
|
|
||||||
case R7 : case X7 : case F7 : case V7 : case CR7: case CR1UN: return 7;
|
|
||||||
case R8 : case X8 : case F8 : case V8 : case CR2LT: return 8;
|
|
||||||
case R9 : case X9 : case F9 : case V9 : case CR2GT: return 9;
|
|
||||||
case R10: case X10: case F10: case V10: case CR2EQ: return 10;
|
|
||||||
case R11: case X11: case F11: case V11: case CR2UN: return 11;
|
|
||||||
case R12: case X12: case F12: case V12: case CR3LT: return 12;
|
|
||||||
case R13: case X13: case F13: case V13: case CR3GT: return 13;
|
|
||||||
case R14: case X14: case F14: case V14: case CR3EQ: return 14;
|
|
||||||
case R15: case X15: case F15: case V15: case CR3UN: return 15;
|
|
||||||
case R16: case X16: case F16: case V16: case CR4LT: return 16;
|
|
||||||
case R17: case X17: case F17: case V17: case CR4GT: return 17;
|
|
||||||
case R18: case X18: case F18: case V18: case CR4EQ: return 18;
|
|
||||||
case R19: case X19: case F19: case V19: case CR4UN: return 19;
|
|
||||||
case R20: case X20: case F20: case V20: case CR5LT: return 20;
|
|
||||||
case R21: case X21: case F21: case V21: case CR5GT: return 21;
|
|
||||||
case R22: case X22: case F22: case V22: case CR5EQ: return 22;
|
|
||||||
case R23: case X23: case F23: case V23: case CR5UN: return 23;
|
|
||||||
case R24: case X24: case F24: case V24: case CR6LT: return 24;
|
|
||||||
case R25: case X25: case F25: case V25: case CR6GT: return 25;
|
|
||||||
case R26: case X26: case F26: case V26: case CR6EQ: return 26;
|
|
||||||
case R27: case X27: case F27: case V27: case CR6UN: return 27;
|
|
||||||
case R28: case X28: case F28: case V28: case CR7LT: return 28;
|
|
||||||
case R29: case X29: case F29: case V29: case CR7GT: return 29;
|
|
||||||
case R30: case X30: case F30: case V30: case CR7EQ: return 30;
|
|
||||||
case R31: case X31: case F31: case V31: case CR7UN: return 31;
|
|
||||||
default:
|
|
||||||
llvm_unreachable("Unhandled reg in PPCRegisterInfo::getRegisterNumbering!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PPCRegisterInfo::PPCRegisterInfo(const PPCSubtarget &ST,
|
PPCRegisterInfo::PPCRegisterInfo(const PPCSubtarget &ST,
|
||||||
const TargetInstrInfo &tii)
|
const TargetInstrInfo &tii)
|
||||||
: PPCGenRegisterInfo(ST.isPPC64() ? PPC::LR8 : PPC::LR,
|
: PPCGenRegisterInfo(ST.isPPC64() ? PPC::LR8 : PPC::LR,
|
||||||
@ -521,7 +478,7 @@ void PPCRegisterInfo::lowerCRSpilling(MachineBasicBlock::iterator II,
|
|||||||
// rlwinm rA, rA, ShiftBits, 0, 31.
|
// rlwinm rA, rA, ShiftBits, 0, 31.
|
||||||
BuildMI(MBB, II, dl, TII.get(PPC::RLWINM), Reg)
|
BuildMI(MBB, II, dl, TII.get(PPC::RLWINM), Reg)
|
||||||
.addReg(Reg, RegState::Kill)
|
.addReg(Reg, RegState::Kill)
|
||||||
.addImm(PPCRegisterInfo::getRegisterNumbering(SrcReg) * 4)
|
.addImm(getPPCRegisterNumbering(SrcReg) * 4)
|
||||||
.addImm(0)
|
.addImm(0)
|
||||||
.addImm(31);
|
.addImm(31);
|
||||||
|
|
||||||
|
@ -33,10 +33,6 @@ class PPCRegisterInfo : public PPCGenRegisterInfo {
|
|||||||
public:
|
public:
|
||||||
PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
|
PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
|
||||||
|
|
||||||
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
|
||||||
/// PPC::F14, return the number that it corresponds to (e.g. 14).
|
|
||||||
static unsigned getRegisterNumbering(unsigned RegEnum);
|
|
||||||
|
|
||||||
/// getPointerRegClass - Return the register class to use to hold pointers.
|
/// getPointerRegClass - Return the register class to use to hold pointers.
|
||||||
/// This is used for addressing modes.
|
/// This is used for addressing modes.
|
||||||
virtual const TargetRegisterClass *getPointerRegClass(unsigned Kind=0) const;
|
virtual const TargetRegisterClass *getPointerRegClass(unsigned Kind=0) const;
|
||||||
|
@ -20,36 +20,10 @@
|
|||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// This is duplicated code. Refactor this.
|
|
||||||
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
|
||||||
MCContext &Ctx, TargetAsmBackend &TAB,
|
|
||||||
raw_ostream &OS,
|
|
||||||
MCCodeEmitter *Emitter,
|
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
if (Triple(TT).isOSDarwin())
|
|
||||||
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void LLVMInitializePowerPCTarget() {
|
extern "C" void LLVMInitializePowerPCTarget() {
|
||||||
// Register the targets
|
// Register the targets
|
||||||
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
|
RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
|
||||||
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
|
RegisterTargetMachine<PPC64TargetMachine> B(ThePPC64Target);
|
||||||
|
|
||||||
// Register the MC Code Emitter
|
|
||||||
TargetRegistry::RegisterCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter);
|
|
||||||
TargetRegistry::RegisterCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter);
|
|
||||||
|
|
||||||
|
|
||||||
// Register the asm backend.
|
|
||||||
TargetRegistry::RegisterAsmBackend(ThePPC32Target, createPPCAsmBackend);
|
|
||||||
TargetRegistry::RegisterAsmBackend(ThePPC64Target, createPPCAsmBackend);
|
|
||||||
|
|
||||||
// Register the object streamer.
|
|
||||||
TargetRegistry::RegisterObjectStreamer(ThePPC32Target, createMCStreamer);
|
|
||||||
TargetRegistry::RegisterObjectStreamer(ThePPC64Target, createMCStreamer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT,
|
PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT,
|
||||||
|
Loading…
Reference in New Issue
Block a user