diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /lib/Target/MSP430 | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'lib/Target/MSP430')
26 files changed, 281 insertions, 278 deletions
diff --git a/lib/Target/MSP430/InstPrinter/MSP430InstPrinter.h b/lib/Target/MSP430/InstPrinter/MSP430InstPrinter.h index 5afbd20..7fae505 100644 --- a/lib/Target/MSP430/InstPrinter/MSP430InstPrinter.h +++ b/lib/Target/MSP430/InstPrinter/MSP430InstPrinter.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430INSTPRINTER_H -#define MSP430INSTPRINTER_H +#ifndef LLVM_LIB_TARGET_MSP430_INSTPRINTER_MSP430INSTPRINTER_H +#define LLVM_LIB_TARGET_MSP430_INSTPRINTER_MSP430INSTPRINTER_H #include "llvm/MC/MCInstPrinter.h" diff --git a/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h b/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h index ef805bb..2c9532d 100644 --- a/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h +++ b/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430TARGETASMINFO_H -#define MSP430TARGETASMINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430MCASMINFO_H +#define LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430MCASMINFO_H #include "llvm/MC/MCAsmInfoELF.h" diff --git a/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.cpp b/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.cpp index 72adb45..4c70803 100644 --- a/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.cpp +++ b/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.cpp @@ -39,7 +39,7 @@ static MCInstrInfo *createMSP430MCInstrInfo() { static MCRegisterInfo *createMSP430MCRegisterInfo(StringRef TT) { MCRegisterInfo *X = new MCRegisterInfo(); - InitMSP430MCRegisterInfo(X, MSP430::PCW); + InitMSP430MCRegisterInfo(X, MSP430::PC); return X; } diff --git a/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.h b/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.h index 7f3505c..586f5d9 100644 --- a/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.h +++ b/lib/Target/MSP430/MCTargetDesc/MSP430MCTargetDesc.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430MCTARGETDESC_H -#define MSP430MCTARGETDESC_H +#ifndef LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430MCTARGETDESC_H +#define LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430MCTARGETDESC_H namespace llvm { class Target; diff --git a/lib/Target/MSP430/MSP430.h b/lib/Target/MSP430/MSP430.h index 4574ce5..796f252 100644 --- a/lib/Target/MSP430/MSP430.h +++ b/lib/Target/MSP430/MSP430.h @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430_H -#define LLVM_TARGET_MSP430_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430_H +#define LLVM_LIB_TARGET_MSP430_MSP430_H #include "MCTargetDesc/MSP430MCTargetDesc.h" #include "llvm/Target/TargetMachine.h" diff --git a/lib/Target/MSP430/MSP430BranchSelector.cpp b/lib/Target/MSP430/MSP430BranchSelector.cpp index a96930a..ffcf222 100644 --- a/lib/Target/MSP430/MSP430BranchSelector.cpp +++ b/lib/Target/MSP430/MSP430BranchSelector.cpp @@ -17,6 +17,7 @@ #include "MSP430.h" #include "MSP430InstrInfo.h" +#include "MSP430Subtarget.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -54,7 +55,7 @@ FunctionPass *llvm::createMSP430BranchSelectionPass() { bool MSP430BSel::runOnMachineFunction(MachineFunction &Fn) { const MSP430InstrInfo *TII = - static_cast<const MSP430InstrInfo*>(Fn.getTarget().getInstrInfo()); + static_cast<const MSP430InstrInfo *>(Fn.getSubtarget().getInstrInfo()); // Give the blocks of the function a dense, in-order, numbering. Fn.RenumberBlocks(); BlockSizes.resize(Fn.getNumBlockIDs()); diff --git a/lib/Target/MSP430/MSP430CallingConv.td b/lib/Target/MSP430/MSP430CallingConv.td index 8a69d1e..b38f578 100644 --- a/lib/Target/MSP430/MSP430CallingConv.td +++ b/lib/Target/MSP430/MSP430CallingConv.td @@ -17,7 +17,7 @@ def RetCC_MSP430 : CallingConv<[ CCIfType<[i8], CCAssignToReg<[R15B, R14B, R13B, R12B]>>, // i16 are returned in registers R15, R14, R13, R12 - CCIfType<[i16], CCAssignToReg<[R15W, R14W, R13W, R12W]>> + CCIfType<[i16], CCAssignToReg<[R15, R14, R13, R12]>> ]>; //===----------------------------------------------------------------------===// diff --git a/lib/Target/MSP430/MSP430FrameLowering.cpp b/lib/Target/MSP430/MSP430FrameLowering.cpp index 82c8b29..d6cb9f6 100644 --- a/lib/Target/MSP430/MSP430FrameLowering.cpp +++ b/lib/Target/MSP430/MSP430FrameLowering.cpp @@ -14,6 +14,7 @@ #include "MSP430FrameLowering.h" #include "MSP430InstrInfo.h" #include "MSP430MachineFunctionInfo.h" +#include "MSP430Subtarget.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -43,7 +44,7 @@ void MSP430FrameLowering::emitPrologue(MachineFunction &MF) const { MachineFrameInfo *MFI = MF.getFrameInfo(); MSP430MachineFunctionInfo *MSP430FI = MF.getInfo<MSP430MachineFunctionInfo>(); const MSP430InstrInfo &TII = - *static_cast<const MSP430InstrInfo*>(MF.getTarget().getInstrInfo()); + *static_cast<const MSP430InstrInfo *>(MF.getSubtarget().getInstrInfo()); MachineBasicBlock::iterator MBBI = MBB.begin(); DebugLoc DL = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc(); @@ -62,18 +63,18 @@ void MSP430FrameLowering::emitPrologue(MachineFunction &MF) const { // Update the frame offset adjustment. MFI->setOffsetAdjustment(-NumBytes); - // Save FPW into the appropriate stack slot... + // Save FP into the appropriate stack slot... BuildMI(MBB, MBBI, DL, TII.get(MSP430::PUSH16r)) - .addReg(MSP430::FPW, RegState::Kill); + .addReg(MSP430::FP, RegState::Kill); - // Update FPW with the new base value... - BuildMI(MBB, MBBI, DL, TII.get(MSP430::MOV16rr), MSP430::FPW) - .addReg(MSP430::SPW); + // Update FP with the new base value... + BuildMI(MBB, MBBI, DL, TII.get(MSP430::MOV16rr), MSP430::FP) + .addReg(MSP430::SP); // Mark the FramePtr as live-in in every block except the entry. for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); I != E; ++I) - I->addLiveIn(MSP430::FPW); + I->addLiveIn(MSP430::FP); } else NumBytes = StackSize - MSP430FI->getCalleeSavedFrameSize(); @@ -85,18 +86,18 @@ void MSP430FrameLowering::emitPrologue(MachineFunction &MF) const { if (MBBI != MBB.end()) DL = MBBI->getDebugLoc(); - if (NumBytes) { // adjust stack pointer: SPW -= numbytes - // If there is an SUB16ri of SPW immediately before this instruction, merge + if (NumBytes) { // adjust stack pointer: SP -= numbytes + // If there is an SUB16ri of SP immediately before this instruction, merge // the two. //NumBytes -= mergeSPUpdates(MBB, MBBI, true); - // If there is an ADD16ri or SUB16ri of SPW immediately after this + // If there is an ADD16ri or SUB16ri of SP immediately after this // instruction, merge the two instructions. // mergeSPUpdatesDown(MBB, MBBI, &NumBytes); if (NumBytes) { MachineInstr *MI = - BuildMI(MBB, MBBI, DL, TII.get(MSP430::SUB16ri), MSP430::SPW) - .addReg(MSP430::SPW).addImm(NumBytes); + BuildMI(MBB, MBBI, DL, TII.get(MSP430::SUB16ri), MSP430::SP) + .addReg(MSP430::SP).addImm(NumBytes); // The SRW implicit def is dead. MI->getOperand(3).setIsDead(); } @@ -108,7 +109,7 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, const MachineFrameInfo *MFI = MF.getFrameInfo(); MSP430MachineFunctionInfo *MSP430FI = MF.getInfo<MSP430MachineFunctionInfo>(); const MSP430InstrInfo &TII = - *static_cast<const MSP430InstrInfo*>(MF.getTarget().getInstrInfo()); + *static_cast<const MSP430InstrInfo *>(MF.getSubtarget().getInstrInfo()); MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr(); unsigned RetOpcode = MBBI->getOpcode(); @@ -131,8 +132,8 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, uint64_t FrameSize = StackSize - 2; NumBytes = FrameSize - CSSize; - // pop FPW. - BuildMI(MBB, MBBI, DL, TII.get(MSP430::POP16r), MSP430::FPW); + // pop FP. + BuildMI(MBB, MBBI, DL, TII.get(MSP430::POP16r), MSP430::FP); } else NumBytes = StackSize - CSSize; @@ -147,28 +148,28 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, DL = MBBI->getDebugLoc(); - // If there is an ADD16ri or SUB16ri of SPW immediately before this + // If there is an ADD16ri or SUB16ri of SP immediately before this // instruction, merge the two instructions. //if (NumBytes || MFI->hasVarSizedObjects()) // mergeSPUpdatesUp(MBB, MBBI, StackPtr, &NumBytes); if (MFI->hasVarSizedObjects()) { BuildMI(MBB, MBBI, DL, - TII.get(MSP430::MOV16rr), MSP430::SPW).addReg(MSP430::FPW); + TII.get(MSP430::MOV16rr), MSP430::SP).addReg(MSP430::FP); if (CSSize) { MachineInstr *MI = BuildMI(MBB, MBBI, DL, - TII.get(MSP430::SUB16ri), MSP430::SPW) - .addReg(MSP430::SPW).addImm(CSSize); + TII.get(MSP430::SUB16ri), MSP430::SP) + .addReg(MSP430::SP).addImm(CSSize); // The SRW implicit def is dead. MI->getOperand(3).setIsDead(); } } else { - // adjust stack pointer back: SPW += numbytes + // adjust stack pointer back: SP += numbytes if (NumBytes) { MachineInstr *MI = - BuildMI(MBB, MBBI, DL, TII.get(MSP430::ADD16ri), MSP430::SPW) - .addReg(MSP430::SPW).addImm(NumBytes); + BuildMI(MBB, MBBI, DL, TII.get(MSP430::ADD16ri), MSP430::SP) + .addReg(MSP430::SP).addImm(NumBytes); // The SRW implicit def is dead. MI->getOperand(3).setIsDead(); } @@ -188,7 +189,7 @@ MSP430FrameLowering::spillCalleeSavedRegisters(MachineBasicBlock &MBB, if (MI != MBB.end()) DL = MI->getDebugLoc(); MachineFunction &MF = *MBB.getParent(); - const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); + const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); MSP430MachineFunctionInfo *MFI = MF.getInfo<MSP430MachineFunctionInfo>(); MFI->setCalleeSavedFrameSize(CSI.size() * 2); @@ -214,7 +215,7 @@ MSP430FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, if (MI != MBB.end()) DL = MI->getDebugLoc(); MachineFunction &MF = *MBB.getParent(); - const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); + const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); for (unsigned i = 0, e = CSI.size(); i != e; ++i) BuildMI(MBB, MI, DL, TII.get(MSP430::POP16r), CSI[i].getReg()); @@ -226,13 +227,13 @@ void MSP430FrameLowering:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { const MSP430InstrInfo &TII = - *static_cast<const MSP430InstrInfo*>(MF.getTarget().getInstrInfo()); + *static_cast<const MSP430InstrInfo *>(MF.getSubtarget().getInstrInfo()); unsigned StackAlign = getStackAlignment(); if (!hasReservedCallFrame(MF)) { // If the stack pointer can be changed after prologue, turn the - // adjcallstackup instruction into a 'sub SPW, <amt>' and the - // adjcallstackdown instruction into 'add SPW, <amt>' + // adjcallstackup instruction into a 'sub SP, <amt>' and the + // adjcallstackdown instruction into 'add SP, <amt>' // TODO: consider using push / pop instead of sub + store / add MachineInstr *Old = I; uint64_t Amount = Old->getOperand(0).getImm(); @@ -245,8 +246,8 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineInstr *New = nullptr; if (Old->getOpcode() == TII.getCallFrameSetupOpcode()) { New = BuildMI(MF, Old->getDebugLoc(), - TII.get(MSP430::SUB16ri), MSP430::SPW) - .addReg(MSP430::SPW).addImm(Amount); + TII.get(MSP430::SUB16ri), MSP430::SP) + .addReg(MSP430::SP).addImm(Amount); } else { assert(Old->getOpcode() == TII.getCallFrameDestroyOpcode()); // factor out the amount the callee already popped. @@ -254,8 +255,8 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, Amount -= CalleeAmt; if (Amount) New = BuildMI(MF, Old->getDebugLoc(), - TII.get(MSP430::ADD16ri), MSP430::SPW) - .addReg(MSP430::SPW).addImm(Amount); + TII.get(MSP430::ADD16ri), MSP430::SP) + .addReg(MSP430::SP).addImm(Amount); } if (New) { @@ -273,7 +274,7 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineInstr *Old = I; MachineInstr *New = BuildMI(MF, Old->getDebugLoc(), TII.get(MSP430::SUB16ri), - MSP430::SPW).addReg(MSP430::SPW).addImm(CalleeAmt); + MSP430::SP).addReg(MSP430::SP).addImm(CalleeAmt); // The SRW implicit def is dead. New->getOperand(3).setIsDead(); @@ -287,11 +288,11 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, void MSP430FrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *) const { - // Create a frame entry for the FPW register that must be saved. + // Create a frame entry for the FP register that must be saved. if (hasFP(MF)) { int FrameIdx = MF.getFrameInfo()->CreateFixedObject(2, -4, true); (void)FrameIdx; assert(FrameIdx == MF.getFrameInfo()->getObjectIndexBegin() && - "Slot for FPW register must be last in order to be found!"); + "Slot for FP register must be last in order to be found!"); } } diff --git a/lib/Target/MSP430/MSP430FrameLowering.h b/lib/Target/MSP430/MSP430FrameLowering.h index fadfeed..1941af2 100644 --- a/lib/Target/MSP430/MSP430FrameLowering.h +++ b/lib/Target/MSP430/MSP430FrameLowering.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430_FRAMEINFO_H -#define MSP430_FRAMEINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H +#define LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H #include "MSP430.h" #include "llvm/Target/TargetFrameLowering.h" diff --git a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp index a9b9035..81c176b 100644 --- a/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp +++ b/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp @@ -97,9 +97,9 @@ namespace { public: MSP430DAGToDAGISel(MSP430TargetMachine &TM, CodeGenOpt::Level OptLevel) - : SelectionDAGISel(TM, OptLevel), - Lowering(*TM.getTargetLowering()), - Subtarget(*TM.getSubtargetImpl()) { } + : SelectionDAGISel(TM, OptLevel), + Lowering(*TM.getSubtargetImpl()->getTargetLowering()), + Subtarget(*TM.getSubtargetImpl()) {} const char *getPassName() const override { return "MSP430 DAG->DAG Pattern Instruction Selection"; diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index 3d3ee92..22936dd 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -58,7 +58,7 @@ HWMultMode("msp430-hwmult-mode", cl::Hidden, clEnumValEnd)); MSP430TargetLowering::MSP430TargetLowering(const TargetMachine &TM) - : TargetLowering(TM, new TargetLoweringObjectFileELF()) { + : TargetLowering(TM) { // Set up the register classes. addRegisterClass(MVT::i8, &MSP430::GR8RegClass); @@ -72,7 +72,7 @@ MSP430TargetLowering::MSP430TargetLowering(const TargetMachine &TM) // Division is expensive setIntDivIsCheap(false); - setStackPointerRegisterToSaveRestore(MSP430::SPW); + setStackPointerRegisterToSaveRestore(MSP430::SP); setBooleanContents(ZeroOrOneBooleanContent); setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct? @@ -282,7 +282,7 @@ static void AnalyzeArguments(CCState &State, SmallVectorImpl<CCValAssign> &ArgLocs, const SmallVectorImpl<ArgT> &Args) { static const MCPhysReg RegList[] = { - MSP430::R15W, MSP430::R14W, MSP430::R13W, MSP430::R12W + MSP430::R15, MSP430::R14, MSP430::R13, MSP430::R12 }; static const unsigned NbRegs = array_lengthof(RegList); @@ -437,8 +437,8 @@ MSP430TargetLowering::LowerCCCArguments(SDValue Chain, // Assign locations to all of the incoming arguments. SmallVector<CCValAssign, 16> ArgLocs; - CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), - getTargetMachine(), ArgLocs, *DAG.getContext()); + CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), ArgLocs, + *DAG.getContext()); AnalyzeArguments(CCInfo, ArgLocs, Ins); // Create frame index for the start of the first vararg value @@ -533,8 +533,8 @@ MSP430TargetLowering::LowerReturn(SDValue Chain, report_fatal_error("ISRs cannot return any value"); // CCState - Info about the registers and stack slot. - CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), - getTargetMachine(), RVLocs, *DAG.getContext()); + CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), RVLocs, + *DAG.getContext()); // Analize return values. AnalyzeReturnValues(CCInfo, RVLocs, Outs); @@ -583,8 +583,8 @@ MSP430TargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee, SmallVectorImpl<SDValue> &InVals) const { // Analyze operands of the call, assigning locations to each operand. SmallVector<CCValAssign, 16> ArgLocs; - CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), - getTargetMachine(), ArgLocs, *DAG.getContext()); + CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), ArgLocs, + *DAG.getContext()); AnalyzeArguments(CCInfo, ArgLocs, Outs); // Get a count of how many bytes are to be pushed on the stack. @@ -627,7 +627,7 @@ MSP430TargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee, assert(VA.isMemLoc()); if (!StackPtr.getNode()) - StackPtr = DAG.getCopyFromReg(Chain, dl, MSP430::SPW, getPointerTy()); + StackPtr = DAG.getCopyFromReg(Chain, dl, MSP430::SP, getPointerTy()); SDValue PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(), StackPtr, @@ -719,8 +719,8 @@ MSP430TargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag, // Assign locations to each value returned by this call. SmallVector<CCValAssign, 16> RVLocs; - CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), - getTargetMachine(), RVLocs, *DAG.getContext()); + CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), RVLocs, + *DAG.getContext()); AnalyzeReturnValues(CCInfo, RVLocs, Ins); @@ -941,31 +941,31 @@ SDValue MSP430TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const { Convert = false; break; case MSP430CC::COND_HS: - // Res = SRW & 1, no processing is required + // Res = SR & 1, no processing is required break; case MSP430CC::COND_LO: - // Res = ~(SRW & 1) + // Res = ~(SR & 1) Invert = true; break; case MSP430CC::COND_NE: if (andCC) { - // C = ~Z, thus Res = SRW & 1, no processing is required + // C = ~Z, thus Res = SR & 1, no processing is required } else { - // Res = ~((SRW >> 1) & 1) + // Res = ~((SR >> 1) & 1) Shift = true; Invert = true; } break; case MSP430CC::COND_E: Shift = true; - // C = ~Z for AND instruction, thus we can put Res = ~(SRW & 1), however, - // Res = (SRW >> 1) & 1 is 1 word shorter. + // C = ~Z for AND instruction, thus we can put Res = ~(SR & 1), however, + // Res = (SR >> 1) & 1 is 1 word shorter. break; } EVT VT = Op.getValueType(); SDValue One = DAG.getConstant(1, VT); if (Convert) { - SDValue SR = DAG.getCopyFromReg(DAG.getEntryNode(), dl, MSP430::SRW, + SDValue SR = DAG.getCopyFromReg(DAG.getEntryNode(), dl, MSP430::SR, MVT::i16, Flag); if (Shift) // FIXME: somewhere this is turned into a SRL, lower it MSP specific? @@ -1074,7 +1074,7 @@ SDValue MSP430TargetLowering::LowerFRAMEADDR(SDValue Op, SDLoc dl(Op); // FIXME probably not meaningful unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue(); SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, - MSP430::FPW, VT); + MSP430::FP, VT); while (Depth--) FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr, MachinePointerInfo(), @@ -1199,7 +1199,8 @@ MSP430TargetLowering::EmitShiftInstr(MachineInstr *MI, MachineFunction *F = BB->getParent(); MachineRegisterInfo &RI = F->getRegInfo(); DebugLoc dl = MI->getDebugLoc(); - const TargetInstrInfo &TII = *getTargetMachine().getInstrInfo(); + const TargetInstrInfo &TII = + *getTargetMachine().getSubtargetImpl()->getInstrInfo(); unsigned Opc; const TargetRegisterClass * RC; @@ -1310,7 +1311,8 @@ MSP430TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, Opc == MSP430::Srl8 || Opc == MSP430::Srl16) return EmitShiftInstr(MI, BB); - const TargetInstrInfo &TII = *getTargetMachine().getInstrInfo(); + const TargetInstrInfo &TII = + *getTargetMachine().getSubtargetImpl()->getInstrInfo(); DebugLoc dl = MI->getDebugLoc(); assert((Opc == MSP430::Select16 || Opc == MSP430::Select8) && diff --git a/lib/Target/MSP430/MSP430ISelLowering.h b/lib/Target/MSP430/MSP430ISelLowering.h index 3e2f344..073ddc9 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.h +++ b/lib/Target/MSP430/MSP430ISelLowering.h @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430_ISELLOWERING_H -#define LLVM_TARGET_MSP430_ISELLOWERING_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430ISELLOWERING_H +#define LLVM_LIB_TARGET_MSP430_MSP430ISELLOWERING_H #include "MSP430.h" #include "llvm/CodeGen/SelectionDAG.h" @@ -170,4 +170,4 @@ namespace llvm { }; } // namespace llvm -#endif // LLVM_TARGET_MSP430_ISELLOWERING_H +#endif diff --git a/lib/Target/MSP430/MSP430InstrInfo.cpp b/lib/Target/MSP430/MSP430InstrInfo.cpp index ccb6c09..27681aa 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.cpp +++ b/lib/Target/MSP430/MSP430InstrInfo.cpp @@ -307,7 +307,7 @@ unsigned MSP430InstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { return 0; case TargetOpcode::INLINEASM: { const MachineFunction *MF = MI->getParent()->getParent(); - const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); + const TargetInstrInfo &TII = *MF->getSubtarget().getInstrInfo(); return TII.getInlineAsmLength(MI->getOperand(0).getSymbolName(), *MF->getTarget().getMCAsmInfo()); } diff --git a/lib/Target/MSP430/MSP430InstrInfo.h b/lib/Target/MSP430/MSP430InstrInfo.h index e6baaef..f9b25b6 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.h +++ b/lib/Target/MSP430/MSP430InstrInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430INSTRINFO_H -#define LLVM_TARGET_MSP430INSTRINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H +#define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H #include "MSP430RegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" diff --git a/lib/Target/MSP430/MSP430InstrInfo.td b/lib/Target/MSP430/MSP430InstrInfo.td index 50e3fda..7c5aa11 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.td +++ b/lib/Target/MSP430/MSP430InstrInfo.td @@ -111,8 +111,8 @@ def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{ // a stack adjustment and the codegen must know that they may modify the stack // pointer before prolog-epilog rewriting occurs. // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become -// sub / add which can clobber SRW. -let Defs = [SPW, SRW], Uses = [SPW] in { +// sub / add which can clobber SR. +let Defs = [SP, SR], Uses = [SP] in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i16imm:$amt), "#ADJCALLSTACKDOWN", [(MSP430callseq_start timm:$amt)]>; @@ -130,7 +130,7 @@ let usesCustomInserter = 1 in { "# Select16 PSEUDO", [(set GR16:$dst, (MSP430selectcc GR16:$src, GR16:$src2, imm:$cc))]>; - let Defs = [SRW] in { + let Defs = [SR] in { def Shl8 : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$cnt), "# Shl8 PSEUDO", [(set GR8:$dst, (MSP430shl GR8:$src, GR8:$cnt))]>; @@ -192,7 +192,7 @@ let isBarrier = 1 in { } // Conditional branches -let Uses = [SRW] in +let Uses = [SR] in def JCC : CJForm<0, 0, (outs), (ins jmptarget:$dst, cc:$cc), "j$cc\t$dst", @@ -207,8 +207,8 @@ let isCall = 1 in // a use to prevent stack-pointer assignments that appear immediately // before calls from potentially appearing dead. Uses for argument // registers are added manually. - let Defs = [R12W, R13W, R14W, R15W, SRW], - Uses = [SPW] in { + let Defs = [R12, R13, R14, R15, SR], + Uses = [SP] in { def CALLi : II16i<0x0, (outs), (ins i16imm:$dst), "call\t$dst", [(MSP430call imm:$dst)]>; @@ -224,7 +224,7 @@ let isCall = 1 in //===----------------------------------------------------------------------===// // Miscellaneous Instructions... // -let Defs = [SPW], Uses = [SPW], neverHasSideEffects=1 in { +let Defs = [SP], Uses = [SP], neverHasSideEffects=1 in { let mayLoad = 1 in def POP16r : IForm16<0x0, DstReg, SrcPostInc, Size2Bytes, (outs GR16:$reg), (ins), "pop.w\t$reg", []>; @@ -337,7 +337,7 @@ def MOV16mm : I16mm<0x0, let Constraints = "$src = $dst" in { -let Defs = [SRW] in { +let Defs = [SR] in { let isCommutable = 1 in { // X = ADD Y, Z == X = ADD Z, Y @@ -345,24 +345,24 @@ def ADD8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "add.b\t{$src2, $dst}", [(set GR8:$dst, (add GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def ADD16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "add.w\t{$src2, $dst}", [(set GR16:$dst, (add GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; } def ADD8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "add.b\t{$src2, $dst}", [(set GR8:$dst, (add GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def ADD16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "add.w\t{$src2, $dst}", [(set GR16:$dst, (add GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let mayLoad = 1, hasExtraDefRegAllocReq = 1, Constraints = "$base = $base_wb, $src = $dst" in { @@ -381,160 +381,160 @@ def ADD8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "add.b\t{$src2, $dst}", [(set GR8:$dst, (add GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def ADD16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "add.w\t{$src2, $dst}", [(set GR16:$dst, (add GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; let Constraints = "" in { def ADD8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "add.b\t{$src, $dst}", [(store (add (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADD16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "add.w\t{$src, $dst}", [(store (add (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADD8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "add.b\t{$src, $dst}", [(store (add (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADD16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "add.w\t{$src, $dst}", [(store (add (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADD8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "add.b\t{$src, $dst}", [(store (add (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADD16mm : I16mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "add.w\t{$src, $dst}", [(store (add (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } -let Uses = [SRW] in { +let Uses = [SR] in { let isCommutable = 1 in { // X = ADDC Y, Z == X = ADDC Z, Y def ADC8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "addc.b\t{$src2, $dst}", [(set GR8:$dst, (adde GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def ADC16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "addc.w\t{$src2, $dst}", [(set GR16:$dst, (adde GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; } // isCommutable def ADC8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "addc.b\t{$src2, $dst}", [(set GR8:$dst, (adde GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def ADC16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "addc.w\t{$src2, $dst}", [(set GR16:$dst, (adde GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def ADC8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "addc.b\t{$src2, $dst}", [(set GR8:$dst, (adde GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def ADC16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "addc.w\t{$src2, $dst}", [(set GR16:$dst, (adde GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let Constraints = "" in { def ADC8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "addc.b\t{$src, $dst}", [(store (adde (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADC16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "addc.w\t{$src, $dst}", [(store (adde (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADC8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "addc.b\t{$src, $dst}", [(store (adde (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADC16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "addc.w\t{$src, $dst}", [(store (adde (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADC8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "addc.b\t{$src, $dst}", [(store (adde (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def ADC16mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "addc.w\t{$src, $dst}", [(store (adde (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } -} // Uses = [SRW] +} // Uses = [SR] let isCommutable = 1 in { // X = AND Y, Z == X = AND Z, Y def AND8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "and.b\t{$src2, $dst}", [(set GR8:$dst, (and GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def AND16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "and.w\t{$src2, $dst}", [(set GR16:$dst, (and GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; } def AND8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "and.b\t{$src2, $dst}", [(set GR8:$dst, (and GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def AND16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "and.w\t{$src2, $dst}", [(set GR16:$dst, (and GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def AND8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "and.b\t{$src2, $dst}", [(set GR8:$dst, (and GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def AND16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "and.w\t{$src2, $dst}", [(set GR16:$dst, (and GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let mayLoad = 1, hasExtraDefRegAllocReq = 1, Constraints = "$base = $base_wb, $src = $dst" in { @@ -553,36 +553,36 @@ def AND8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "and.b\t{$src, $dst}", [(store (and (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def AND16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "and.w\t{$src, $dst}", [(store (and (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def AND8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "and.b\t{$src, $dst}", [(store (and (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def AND16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "and.w\t{$src, $dst}", [(store (and (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def AND8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "and.b\t{$src, $dst}", [(store (and (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def AND16mm : I16mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "and.w\t{$src, $dst}", [(store (and (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } let isCommutable = 1 in { // X = OR Y, Z == X = OR Z, Y @@ -703,35 +703,35 @@ def XOR8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "xor.b\t{$src2, $dst}", [(set GR8:$dst, (xor GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def XOR16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "xor.w\t{$src2, $dst}", [(set GR16:$dst, (xor GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; } def XOR8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "xor.b\t{$src2, $dst}", [(set GR8:$dst, (xor GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def XOR16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "xor.w\t{$src2, $dst}", [(set GR16:$dst, (xor GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def XOR8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "xor.b\t{$src2, $dst}", [(set GR8:$dst, (xor GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def XOR16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "xor.w\t{$src2, $dst}", [(set GR16:$dst, (xor GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let mayLoad = 1, hasExtraDefRegAllocReq = 1, Constraints = "$base = $base_wb, $src = $dst" in { @@ -750,34 +750,34 @@ def XOR8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "xor.b\t{$src, $dst}", [(store (xor (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def XOR16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "xor.w\t{$src, $dst}", [(store (xor (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def XOR8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "xor.b\t{$src, $dst}", [(store (xor (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def XOR16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "xor.w\t{$src, $dst}", [(store (xor (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def XOR8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "xor.b\t{$src, $dst}", [(store (xor (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def XOR16mm : I16mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "xor.w\t{$src, $dst}", [(store (xor (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } @@ -785,34 +785,34 @@ def SUB8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "sub.b\t{$src2, $dst}", [(set GR8:$dst, (sub GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SUB16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "sub.w\t{$src2, $dst}", [(set GR16:$dst, (sub GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SUB8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "sub.b\t{$src2, $dst}", [(set GR8:$dst, (sub GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SUB16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "sub.w\t{$src2, $dst}", [(set GR16:$dst, (sub GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SUB8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "sub.b\t{$src2, $dst}", [(set GR8:$dst, (sub GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def SUB16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "sub.w\t{$src2, $dst}", [(set GR16:$dst, (sub GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let mayLoad = 1, hasExtraDefRegAllocReq = 1, Constraints = "$base = $base_wb, $src = $dst" in { @@ -831,153 +831,153 @@ def SUB8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "sub.b\t{$src, $dst}", [(store (sub (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SUB16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "sub.w\t{$src, $dst}", [(store (sub (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SUB8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "sub.b\t{$src, $dst}", [(store (sub (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SUB16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "sub.w\t{$src, $dst}", [(store (sub (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SUB8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "sub.b\t{$src, $dst}", [(store (sub (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SUB16mm : I16mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "sub.w\t{$src, $dst}", [(store (sub (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } -let Uses = [SRW] in { +let Uses = [SR] in { def SBC8rr : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src, GR8:$src2), "subc.b\t{$src2, $dst}", [(set GR8:$dst, (sube GR8:$src, GR8:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SBC16rr : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src, GR16:$src2), "subc.w\t{$src2, $dst}", [(set GR16:$dst, (sube GR16:$src, GR16:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SBC8ri : I8ri<0x0, (outs GR8:$dst), (ins GR8:$src, i8imm:$src2), "subc.b\t{$src2, $dst}", [(set GR8:$dst, (sube GR8:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SBC16ri : I16ri<0x0, (outs GR16:$dst), (ins GR16:$src, i16imm:$src2), "subc.w\t{$src2, $dst}", [(set GR16:$dst, (sube GR16:$src, imm:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def SBC8rm : I8rm<0x0, (outs GR8:$dst), (ins GR8:$src, memsrc:$src2), "subc.b\t{$src2, $dst}", [(set GR8:$dst, (sube GR8:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; def SBC16rm : I16rm<0x0, (outs GR16:$dst), (ins GR16:$src, memsrc:$src2), "subc.w\t{$src2, $dst}", [(set GR16:$dst, (sube GR16:$src, (load addr:$src2))), - (implicit SRW)]>; + (implicit SR)]>; let Constraints = "" in { def SBC8mr : I8mr<0x0, (outs), (ins memdst:$dst, GR8:$src), "subc.b\t{$src, $dst}", [(store (sube (load addr:$dst), GR8:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SBC16mr : I16mr<0x0, (outs), (ins memdst:$dst, GR16:$src), "subc.w\t{$src, $dst}", [(store (sube (load addr:$dst), GR16:$src), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SBC8mi : I8mi<0x0, (outs), (ins memdst:$dst, i8imm:$src), "subc.b\t{$src, $dst}", [(store (sube (load addr:$dst), (i8 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SBC16mi : I16mi<0x0, (outs), (ins memdst:$dst, i16imm:$src), "subc.w\t{$src, $dst}", [(store (sube (load addr:$dst), (i16 imm:$src)), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SBC8mm : I8mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "subc.b\t{$src, $dst}", [(store (sube (load addr:$dst), (i8 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; def SBC16mm : I16mm<0x0, (outs), (ins memdst:$dst, memsrc:$src), "subc.w\t{$src, $dst}", [(store (sube (load addr:$dst), (i16 (load addr:$src))), addr:$dst), - (implicit SRW)]>; + (implicit SR)]>; } -} // Uses = [SRW] +} // Uses = [SR] // FIXME: memory variant! def SAR8r1 : II8r<0x0, (outs GR8:$dst), (ins GR8:$src), "rra.b\t$dst", [(set GR8:$dst, (MSP430rra GR8:$src)), - (implicit SRW)]>; + (implicit SR)]>; def SAR16r1 : II16r<0x0, (outs GR16:$dst), (ins GR16:$src), "rra.w\t$dst", [(set GR16:$dst, (MSP430rra GR16:$src)), - (implicit SRW)]>; + (implicit SR)]>; def SHL8r1 : I8rr<0x0, (outs GR8:$dst), (ins GR8:$src), "rla.b\t$dst", [(set GR8:$dst, (MSP430rla GR8:$src)), - (implicit SRW)]>; + (implicit SR)]>; def SHL16r1 : I16rr<0x0, (outs GR16:$dst), (ins GR16:$src), "rla.w\t$dst", [(set GR16:$dst, (MSP430rla GR16:$src)), - (implicit SRW)]>; + (implicit SR)]>; def SAR8r1c : Pseudo<(outs GR8:$dst), (ins GR8:$src), "clrc\n\t" "rrc.b\t$dst", [(set GR8:$dst, (MSP430rrc GR8:$src)), - (implicit SRW)]>; + (implicit SR)]>; def SAR16r1c : Pseudo<(outs GR16:$dst), (ins GR16:$src), "clrc\n\t" "rrc.w\t$dst", [(set GR16:$dst, (MSP430rrc GR16:$src)), - (implicit SRW)]>; + (implicit SR)]>; // FIXME: Memory sext's ? def SEXT16r : II16r<0x0, (outs GR16:$dst), (ins GR16:$src), "sxt\t$dst", [(set GR16:$dst, (sext_inreg GR16:$src, i8)), - (implicit SRW)]>; + (implicit SR)]>; -} // Defs = [SRW] +} // Defs = [SR] def ZEXT16r : I8rr<0x0, (outs GR16:$dst), (ins GR16:$src), @@ -993,57 +993,57 @@ def SWPB16r : II16r<0x0, } // Constraints = "$src = $dst" // Integer comparisons -let Defs = [SRW] in { +let Defs = [SR] in { def CMP8rr : I8rr<0x0, (outs), (ins GR8:$src, GR8:$src2), "cmp.b\t{$src2, $src}", - [(MSP430cmp GR8:$src, GR8:$src2), (implicit SRW)]>; + [(MSP430cmp GR8:$src, GR8:$src2), (implicit SR)]>; def CMP16rr : I16rr<0x0, (outs), (ins GR16:$src, GR16:$src2), "cmp.w\t{$src2, $src}", - [(MSP430cmp GR16:$src, GR16:$src2), (implicit SRW)]>; + [(MSP430cmp GR16:$src, GR16:$src2), (implicit SR)]>; def CMP8ri : I8ri<0x0, (outs), (ins GR8:$src, i8imm:$src2), "cmp.b\t{$src2, $src}", - [(MSP430cmp GR8:$src, imm:$src2), (implicit SRW)]>; + [(MSP430cmp GR8:$src, imm:$src2), (implicit SR)]>; def CMP16ri : I16ri<0x0, (outs), (ins GR16:$src, i16imm:$src2), "cmp.w\t{$src2, $src}", - [(MSP430cmp GR16:$src, imm:$src2), (implicit SRW)]>; + [(MSP430cmp GR16:$src, imm:$src2), (implicit SR)]>; def CMP8mi : I8mi<0x0, (outs), (ins memsrc:$src, i8imm:$src2), "cmp.b\t{$src2, $src}", [(MSP430cmp (load addr:$src), - (i8 imm:$src2)), (implicit SRW)]>; + (i8 imm:$src2)), (implicit SR)]>; def CMP16mi : I16mi<0x0, (outs), (ins memsrc:$src, i16imm:$src2), "cmp.w\t{$src2, $src}", [(MSP430cmp (load addr:$src), - (i16 imm:$src2)), (implicit SRW)]>; + (i16 imm:$src2)), (implicit SR)]>; def CMP8rm : I8rm<0x0, (outs), (ins GR8:$src, memsrc:$src2), "cmp.b\t{$src2, $src}", [(MSP430cmp GR8:$src, (load addr:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def CMP16rm : I16rm<0x0, (outs), (ins GR16:$src, memsrc:$src2), "cmp.w\t{$src2, $src}", [(MSP430cmp GR16:$src, (load addr:$src2)), - (implicit SRW)]>; + (implicit SR)]>; def CMP8mr : I8mr<0x0, (outs), (ins memsrc:$src, GR8:$src2), "cmp.b\t{$src2, $src}", [(MSP430cmp (load addr:$src), GR8:$src2), - (implicit SRW)]>; + (implicit SR)]>; def CMP16mr : I16mr<0x0, (outs), (ins memsrc:$src, GR16:$src2), "cmp.w\t{$src2, $src}", [(MSP430cmp (load addr:$src), GR16:$src2), - (implicit SRW)]>; + (implicit SR)]>; // BIT TESTS, just sets condition codes @@ -1053,56 +1053,56 @@ def BIT8rr : I8rr<0x0, (outs), (ins GR8:$src, GR8:$src2), "bit.b\t{$src2, $src}", [(MSP430cmp (and_su GR8:$src, GR8:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16rr : I16rr<0x0, (outs), (ins GR16:$src, GR16:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su GR16:$src, GR16:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; } def BIT8ri : I8ri<0x0, (outs), (ins GR8:$src, i8imm:$src2), "bit.b\t{$src2, $src}", [(MSP430cmp (and_su GR8:$src, imm:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16ri : I16ri<0x0, (outs), (ins GR16:$src, i16imm:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su GR16:$src, imm:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT8rm : I8rm<0x0, (outs), (ins GR8:$src, memdst:$src2), "bit.b\t{$src2, $src}", [(MSP430cmp (and_su GR8:$src, (load addr:$src2)), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16rm : I16rm<0x0, (outs), (ins GR16:$src, memdst:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su GR16:$src, (load addr:$src2)), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT8mr : I8mr<0x0, (outs), (ins memsrc:$src, GR8:$src2), "bit.b\t{$src2, $src}", [(MSP430cmp (and_su (load addr:$src), GR8:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16mr : I16mr<0x0, (outs), (ins memsrc:$src, GR16:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su (load addr:$src), GR16:$src2), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT8mi : I8mi<0x0, (outs), (ins memsrc:$src, i8imm:$src2), "bit.b\t{$src2, $src}", [(MSP430cmp (and_su (load addr:$src), (i8 imm:$src2)), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16mi : I16mi<0x0, (outs), (ins memsrc:$src, i16imm:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su (load addr:$src), (i16 imm:$src2)), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT8mm : I8mm<0x0, (outs), (ins memsrc:$src, memsrc:$src2), @@ -1110,15 +1110,15 @@ def BIT8mm : I8mm<0x0, [(MSP430cmp (and_su (i8 (load addr:$src)), (load addr:$src2)), 0), - (implicit SRW)]>; + (implicit SR)]>; def BIT16mm : I16mm<0x0, (outs), (ins memsrc:$src, memsrc:$src2), "bit.w\t{$src2, $src}", [(MSP430cmp (and_su (i16 (load addr:$src)), (load addr:$src2)), 0), - (implicit SRW)]>; -} // Defs = [SRW] + (implicit SR)]>; +} // Defs = [SR] //===----------------------------------------------------------------------===// // Non-Instruction Patterns diff --git a/lib/Target/MSP430/MSP430MCInstLower.cpp b/lib/Target/MSP430/MSP430MCInstLower.cpp index 05352a2..77b91b7 100644 --- a/lib/Target/MSP430/MSP430MCInstLower.cpp +++ b/lib/Target/MSP430/MSP430MCInstLower.cpp @@ -26,6 +26,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetSubtargetInfo.h" using namespace llvm; MCSymbol *MSP430MCInstLower:: @@ -50,7 +51,7 @@ GetExternalSymbolSymbol(const MachineOperand &MO) const { MCSymbol *MSP430MCInstLower:: GetJumpTableSymbol(const MachineOperand &MO) const { - const DataLayout *DL = Printer.TM.getDataLayout(); + const DataLayout *DL = Printer.TM.getSubtargetImpl()->getDataLayout(); SmallString<256> Name; raw_svector_ostream(Name) << DL->getPrivateGlobalPrefix() << "JTI" << Printer.getFunctionNumber() << '_' @@ -67,7 +68,7 @@ GetJumpTableSymbol(const MachineOperand &MO) const { MCSymbol *MSP430MCInstLower:: GetConstantPoolIndexSymbol(const MachineOperand &MO) const { - const DataLayout *DL = Printer.TM.getDataLayout(); + const DataLayout *DL = Printer.TM.getSubtargetImpl()->getDataLayout(); SmallString<256> Name; raw_svector_ostream(Name) << DL->getPrivateGlobalPrefix() << "CPI" << Printer.getFunctionNumber() << '_' diff --git a/lib/Target/MSP430/MSP430MCInstLower.h b/lib/Target/MSP430/MSP430MCInstLower.h index 794aa56..ebd6397 100644 --- a/lib/Target/MSP430/MSP430MCInstLower.h +++ b/lib/Target/MSP430/MSP430MCInstLower.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430_MCINSTLOWER_H -#define MSP430_MCINSTLOWER_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430MCINSTLOWER_H +#define LLVM_LIB_TARGET_MSP430_MSP430MCINSTLOWER_H #include "llvm/Support/Compiler.h" diff --git a/lib/Target/MSP430/MSP430MachineFunctionInfo.h b/lib/Target/MSP430/MSP430MachineFunctionInfo.h index d1697f4..fcc5f5b 100644 --- a/lib/Target/MSP430/MSP430MachineFunctionInfo.h +++ b/lib/Target/MSP430/MSP430MachineFunctionInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430MACHINEFUNCTIONINFO_H -#define MSP430MACHINEFUNCTIONINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H +#define LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H #include "llvm/CodeGen/MachineFunction.h" diff --git a/lib/Target/MSP430/MSP430RegisterInfo.cpp b/lib/Target/MSP430/MSP430RegisterInfo.cpp index 691bcee..614467b 100644 --- a/lib/Target/MSP430/MSP430RegisterInfo.cpp +++ b/lib/Target/MSP430/MSP430RegisterInfo.cpp @@ -33,32 +33,32 @@ using namespace llvm; // FIXME: Provide proper call frame setup / destroy opcodes. MSP430RegisterInfo::MSP430RegisterInfo() - : MSP430GenRegisterInfo(MSP430::PCW) {} + : MSP430GenRegisterInfo(MSP430::PC) {} const MCPhysReg* MSP430RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { - const TargetFrameLowering *TFI = MF->getTarget().getFrameLowering(); + const TargetFrameLowering *TFI = MF->getSubtarget().getFrameLowering(); const Function* F = MF->getFunction(); static const MCPhysReg CalleeSavedRegs[] = { - MSP430::FPW, MSP430::R5W, MSP430::R6W, MSP430::R7W, - MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, + MSP430::FP, MSP430::R5, MSP430::R6, MSP430::R7, + MSP430::R8, MSP430::R9, MSP430::R10, MSP430::R11, 0 }; static const MCPhysReg CalleeSavedRegsFP[] = { - MSP430::R5W, MSP430::R6W, MSP430::R7W, - MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, + MSP430::R5, MSP430::R6, MSP430::R7, + MSP430::R8, MSP430::R9, MSP430::R10, MSP430::R11, 0 }; static const MCPhysReg CalleeSavedRegsIntr[] = { - MSP430::FPW, MSP430::R5W, MSP430::R6W, MSP430::R7W, - MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, - MSP430::R12W, MSP430::R13W, MSP430::R14W, MSP430::R15W, + MSP430::FP, MSP430::R5, MSP430::R6, MSP430::R7, + MSP430::R8, MSP430::R9, MSP430::R10, MSP430::R11, + MSP430::R12, MSP430::R13, MSP430::R14, MSP430::R15, 0 }; static const MCPhysReg CalleeSavedRegsIntrFP[] = { - MSP430::R5W, MSP430::R6W, MSP430::R7W, - MSP430::R8W, MSP430::R9W, MSP430::R10W, MSP430::R11W, - MSP430::R12W, MSP430::R13W, MSP430::R14W, MSP430::R15W, + MSP430::R5, MSP430::R6, MSP430::R7, + MSP430::R8, MSP430::R9, MSP430::R10, MSP430::R11, + MSP430::R12, MSP430::R13, MSP430::R14, MSP430::R15, 0 }; @@ -73,22 +73,22 @@ MSP430RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { BitVector MSP430RegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); - const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering(); + const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); // Mark 4 special registers with subregisters as reserved. Reserved.set(MSP430::PCB); Reserved.set(MSP430::SPB); Reserved.set(MSP430::SRB); Reserved.set(MSP430::CGB); - Reserved.set(MSP430::PCW); - Reserved.set(MSP430::SPW); - Reserved.set(MSP430::SRW); - Reserved.set(MSP430::CGW); + Reserved.set(MSP430::PC); + Reserved.set(MSP430::SP); + Reserved.set(MSP430::SR); + Reserved.set(MSP430::CG); // Mark frame pointer as reserved if needed. if (TFI->hasFP(MF)) { Reserved.set(MSP430::FPB); - Reserved.set(MSP430::FPW); + Reserved.set(MSP430::FP); } return Reserved; @@ -109,11 +109,11 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, MachineInstr &MI = *II; MachineBasicBlock &MBB = *MI.getParent(); MachineFunction &MF = *MBB.getParent(); - const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering(); + const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); DebugLoc dl = MI.getDebugLoc(); int FrameIndex = MI.getOperand(FIOperandNum).getIndex(); - unsigned BasePtr = (TFI->hasFP(MF) ? MSP430::FPW : MSP430::SPW); + unsigned BasePtr = (TFI->hasFP(MF) ? MSP430::FP : MSP430::SP); int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex); // Skip the saved PC @@ -122,7 +122,7 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, if (!TFI->hasFP(MF)) Offset += MF.getFrameInfo()->getStackSize(); else - Offset += 2; // Skip the saved FPW + Offset += 2; // Skip the saved FP // Fold imm into offset Offset += MI.getOperand(FIOperandNum + 1).getImm(); @@ -131,7 +131,7 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, // This is actually "load effective address" of the stack slot // instruction. We have only two-address instructions, thus we need to // expand it into mov + add - const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); + const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo(); MI.setDesc(TII.get(MSP430::MOV16rr)); MI.getOperand(FIOperandNum).ChangeToRegister(BasePtr, false); @@ -156,7 +156,7 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, } unsigned MSP430RegisterInfo::getFrameRegister(const MachineFunction &MF) const { - const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering(); + const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); - return TFI->hasFP(MF) ? MSP430::FPW : MSP430::SPW; + return TFI->hasFP(MF) ? MSP430::FP : MSP430::SP; } diff --git a/lib/Target/MSP430/MSP430RegisterInfo.h b/lib/Target/MSP430/MSP430RegisterInfo.h index cb01961..3f88a69 100644 --- a/lib/Target/MSP430/MSP430RegisterInfo.h +++ b/lib/Target/MSP430/MSP430RegisterInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430REGISTERINFO_H -#define LLVM_TARGET_MSP430REGISTERINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430REGISTERINFO_H +#define LLVM_LIB_TARGET_MSP430_MSP430REGISTERINFO_H #include "llvm/Target/TargetRegisterInfo.h" @@ -44,4 +44,4 @@ public: } // end namespace llvm -#endif // LLVM_TARGET_MSP430REGISTERINFO_H +#endif diff --git a/lib/Target/MSP430/MSP430RegisterInfo.td b/lib/Target/MSP430/MSP430RegisterInfo.td index 4010781..b5a6ed0 100644 --- a/lib/Target/MSP430/MSP430RegisterInfo.td +++ b/lib/Target/MSP430/MSP430RegisterInfo.td @@ -46,22 +46,22 @@ def R15B : MSP430Reg<15, "r15">; def subreg_8bit : SubRegIndex<8> { let Namespace = "MSP430"; } let SubRegIndices = [subreg_8bit] in { -def PCW : MSP430RegWithSubregs<0, "r0", [PCB]>; -def SPW : MSP430RegWithSubregs<1, "r1", [SPB]>; -def SRW : MSP430RegWithSubregs<2, "r2", [SRB]>; -def CGW : MSP430RegWithSubregs<3, "r3", [CGB]>; -def FPW : MSP430RegWithSubregs<4, "r4", [FPB]>; -def R5W : MSP430RegWithSubregs<5, "r5", [R5B]>; -def R6W : MSP430RegWithSubregs<6, "r6", [R6B]>; -def R7W : MSP430RegWithSubregs<7, "r7", [R7B]>; -def R8W : MSP430RegWithSubregs<8, "r8", [R8B]>; -def R9W : MSP430RegWithSubregs<9, "r9", [R9B]>; -def R10W : MSP430RegWithSubregs<10, "r10", [R10B]>; -def R11W : MSP430RegWithSubregs<11, "r11", [R11B]>; -def R12W : MSP430RegWithSubregs<12, "r12", [R12B]>; -def R13W : MSP430RegWithSubregs<13, "r13", [R13B]>; -def R14W : MSP430RegWithSubregs<14, "r14", [R14B]>; -def R15W : MSP430RegWithSubregs<15, "r15", [R15B]>; +def PC : MSP430RegWithSubregs<0, "r0", [PCB]>; +def SP : MSP430RegWithSubregs<1, "r1", [SPB]>; +def SR : MSP430RegWithSubregs<2, "r2", [SRB]>; +def CG : MSP430RegWithSubregs<3, "r3", [CGB]>; +def FP : MSP430RegWithSubregs<4, "r4", [FPB]>; +def R5 : MSP430RegWithSubregs<5, "r5", [R5B]>; +def R6 : MSP430RegWithSubregs<6, "r6", [R6B]>; +def R7 : MSP430RegWithSubregs<7, "r7", [R7B]>; +def R8 : MSP430RegWithSubregs<8, "r8", [R8B]>; +def R9 : MSP430RegWithSubregs<9, "r9", [R9B]>; +def R10 : MSP430RegWithSubregs<10, "r10", [R10B]>; +def R11 : MSP430RegWithSubregs<11, "r11", [R11B]>; +def R12 : MSP430RegWithSubregs<12, "r12", [R12B]>; +def R13 : MSP430RegWithSubregs<13, "r13", [R13B]>; +def R14 : MSP430RegWithSubregs<14, "r14", [R14B]>; +def R15 : MSP430RegWithSubregs<15, "r15", [R15B]>; } def GR8 : RegisterClass<"MSP430", [i8], 8, @@ -74,8 +74,8 @@ def GR8 : RegisterClass<"MSP430", [i8], 8, def GR16 : RegisterClass<"MSP430", [i16], 16, // Volatile registers - (add R12W, R13W, R14W, R15W, R11W, R10W, R9W, R8W, R7W, R6W, R5W, + (add R12, R13, R14, R15, R11, R10, R9, R8, R7, R6, R5, // Frame pointer, sometimes allocable - FPW, + FP, // Volatile, but not allocable - PCW, SPW, SRW, CGW)>; + PC, SP, SR, CG)>; diff --git a/lib/Target/MSP430/MSP430SelectionDAGInfo.h b/lib/Target/MSP430/MSP430SelectionDAGInfo.h index cb04adc..61a6b19 100644 --- a/lib/Target/MSP430/MSP430SelectionDAGInfo.h +++ b/lib/Target/MSP430/MSP430SelectionDAGInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MSP430SELECTIONDAGINFO_H -#define MSP430SELECTIONDAGINFO_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430SELECTIONDAGINFO_H +#define LLVM_LIB_TARGET_MSP430_MSP430SELECTIONDAGINFO_H #include "llvm/Target/TargetSelectionDAGInfo.h" diff --git a/lib/Target/MSP430/MSP430Subtarget.cpp b/lib/Target/MSP430/MSP430Subtarget.cpp index dbddc52..cb83b92 100644 --- a/lib/Target/MSP430/MSP430Subtarget.cpp +++ b/lib/Target/MSP430/MSP430Subtarget.cpp @@ -34,6 +34,6 @@ MSP430Subtarget::MSP430Subtarget(const std::string &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM) : MSP430GenSubtargetInfo(TT, CPU, FS), // FIXME: Check DataLayout string. - DL("e-m:e-p:16:16-i32:16:32-n8:16"), FrameLowering(), + DL("e-m:e-p:16:16-i32:16:32-a:16-n8:16"), FrameLowering(), InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM), TSInfo(DL) {} diff --git a/lib/Target/MSP430/MSP430Subtarget.h b/lib/Target/MSP430/MSP430Subtarget.h index 0152ad1..d1845db 100644 --- a/lib/Target/MSP430/MSP430Subtarget.h +++ b/lib/Target/MSP430/MSP430Subtarget.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430_SUBTARGET_H -#define LLVM_TARGET_MSP430_SUBTARGET_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H +#define LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H #include "MSP430FrameLowering.h" #include "MSP430InstrInfo.h" @@ -51,14 +51,20 @@ public: /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(StringRef CPU, StringRef FS); - const TargetFrameLowering *getFrameLowering() const { return &FrameLowering; } - const MSP430InstrInfo *getInstrInfo() const { return &InstrInfo; } - const DataLayout *getDataLayout() const { return &DL; } - const TargetRegisterInfo *getRegisterInfo() const { + const TargetFrameLowering *getFrameLowering() const override { + return &FrameLowering; + } + const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; } + const DataLayout *getDataLayout() const override { return &DL; } + const TargetRegisterInfo *getRegisterInfo() const override { return &InstrInfo.getRegisterInfo(); } - const MSP430TargetLowering *getTargetLowering() const { return &TLInfo; } - const MSP430SelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; } + const MSP430TargetLowering *getTargetLowering() const override { + return &TLInfo; + } + const MSP430SelectionDAGInfo *getSelectionDAGInfo() const override { + return &TSInfo; + } }; } // End llvm namespace diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index 5ca36f2..8cee016 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "MSP430TargetMachine.h" +#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" #include "MSP430.h" #include "llvm/CodeGen/Passes.h" #include "llvm/MC/MCAsmInfo.h" @@ -30,10 +31,13 @@ MSP430TargetMachine::MSP430TargetMachine(const Target &T, StringRef TT, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), + TLOF(make_unique<TargetLoweringObjectFileELF>()), Subtarget(TT, CPU, FS, *this) { initAsmInfo(); } +MSP430TargetMachine::~MSP430TargetMachine() {} + namespace { /// MSP430 Code Generator Pass Configuration Options. class MSP430PassConfig : public TargetPassConfig { diff --git a/lib/Target/MSP430/MSP430TargetMachine.h b/lib/Target/MSP430/MSP430TargetMachine.h index efa8403..0e54ed6 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.h +++ b/lib/Target/MSP430/MSP430TargetMachine.h @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// -#ifndef LLVM_TARGET_MSP430_TARGETMACHINE_H -#define LLVM_TARGET_MSP430_TARGETMACHINE_H +#ifndef LLVM_LIB_TARGET_MSP430_MSP430TARGETMACHINE_H +#define LLVM_LIB_TARGET_MSP430_MSP430TARGETMACHINE_H #include "MSP430Subtarget.h" #include "llvm/Target/TargetFrameLowering.h" @@ -24,6 +24,7 @@ namespace llvm { /// MSP430TargetMachine /// class MSP430TargetMachine : public LLVMTargetMachine { + std::unique_ptr<TargetLoweringObjectFile> TLOF; MSP430Subtarget Subtarget; public: @@ -31,31 +32,18 @@ public: StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL); + ~MSP430TargetMachine() override; - const TargetFrameLowering *getFrameLowering() const override { - return getSubtargetImpl()->getFrameLowering(); - } - const MSP430InstrInfo *getInstrInfo() const override { - return getSubtargetImpl()->getInstrInfo(); - } - const DataLayout *getDataLayout() const override { - return getSubtargetImpl()->getDataLayout(); - } const MSP430Subtarget *getSubtargetImpl() const override { return &Subtarget; } - const TargetRegisterInfo *getRegisterInfo() const override { - return getSubtargetImpl()->getRegisterInfo(); - } - const MSP430TargetLowering *getTargetLowering() const override { - return getSubtargetImpl()->getTargetLowering(); - } - const MSP430SelectionDAGInfo *getSelectionDAGInfo() const override { - return getSubtargetImpl()->getSelectionDAGInfo(); - } TargetPassConfig *createPassConfig(PassManagerBase &PM) override; + + TargetLoweringObjectFile *getObjFileLowering() const override { + return TLOF.get(); + } }; // MSP430TargetMachine. } // end namespace llvm -#endif // LLVM_TARGET_MSP430_TARGETMACHINE_H +#endif |