diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.cpp | 63 | ||||
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.h | 3 | ||||
-rw-r--r-- | lib/Target/ARM/ARMInstrThumb.td | 7 | ||||
-rw-r--r-- | lib/Target/ARM/ARMSchedule.td | 10 | ||||
-rw-r--r-- | lib/Target/ARM/ARMScheduleV6.td | 5 | ||||
-rw-r--r-- | lib/Target/TargetInstrInfo.cpp | 17 |
6 files changed, 97 insertions, 8 deletions
diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp index 77cfcb9..c824b8b 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -1412,3 +1412,66 @@ ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr) const { return false; } + +unsigned +ARMBaseInstrInfo::getNumMicroOps(const MachineInstr *MI, + const InstrItineraryData &ItinData) const { + if (ItinData.isEmpty()) + return 1; + + const TargetInstrDesc &Desc = MI->getDesc(); + unsigned Class = Desc.getSchedClass(); + unsigned UOps = ItinData.Itineratries[Class].NumMicroOps; + if (UOps) + return UOps; + + unsigned Opc = MI->getOpcode(); + switch (Opc) { + default: + llvm_unreachable("Unexpected multi-uops instruction!"); + break; + case ARM::VSTMQ: + return 2; + + // The number of uOps for load / store multiple are determined by the number + // registers. + // On Cortex-A8, each odd / even pair of register loads / stores + // (e.g. r5 + r6) can be completed on the same cycle. The minimum is + // 2. For VFP / NEON load / store multiple, the formula is + // (#reg / 2) + (#reg % 2) + 1. + // On Cortex-A9, the formula is simply (#reg / 2) + (#reg % 2). + case ARM::VLDMD: + case ARM::VLDMS: + case ARM::VLDMD_UPD: + case ARM::VLDMS_UPD: + case ARM::VSTMD: + case ARM::VSTMS: + case ARM::VSTMD_UPD: + case ARM::VSTMS_UPD: { + unsigned NumRegs = MI->getNumOperands() - Desc.getNumOperands(); + return (NumRegs / 2) + (NumRegs % 2) + 1; + } + case ARM::LDM_RET: + case ARM::LDM: + case ARM::LDM_UPD: + case ARM::STM: + case ARM::STM_UPD: + case ARM::tLDM: + case ARM::tLDM_UPD: + case ARM::tSTM_UPD: + case ARM::tPOP_RET: + case ARM::tPOP: + case ARM::tPUSH: + case ARM::t2LDM_RET: + case ARM::t2LDM: + case ARM::t2LDM_UPD: + case ARM::t2STM: + case ARM::t2STM_UPD: { + // FIXME: Distinquish between Cortex-A8 / Cortex-A9 and other processor + // families. + unsigned NumRegs = MI->getNumOperands() - Desc.getNumOperands(); + UOps = (NumRegs / 2) + (NumRegs % 2); + return (UOps > 2) ? UOps : 2; + } + } +} diff --git a/lib/Target/ARM/ARMBaseInstrInfo.h b/lib/Target/ARM/ARMBaseInstrInfo.h index b4f4a33..b3abdee 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/lib/Target/ARM/ARMBaseInstrInfo.h @@ -348,6 +348,9 @@ public: /// that we can remove a "comparison with zero". virtual bool ConvertToSetZeroFlag(MachineInstr *Instr, MachineInstr *CmpInstr) const; + + virtual unsigned getNumMicroOps(const MachineInstr *MI, + const InstrItineraryData &ItinData) const; }; static inline diff --git a/lib/Target/ARM/ARMInstrThumb.td b/lib/Target/ARM/ARMInstrThumb.td index da2efb8..30bec0f 100644 --- a/lib/Target/ARM/ARMInstrThumb.td +++ b/lib/Target/ARM/ARMInstrThumb.td @@ -282,7 +282,8 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in { // FIXME: remove when we have a way to marking a MI with these properties. let isReturn = 1, isTerminator = 1, isBarrier = 1, mayLoad = 1, hasExtraDefRegAllocReq = 1 in -def tPOP_RET : T1I<(outs), (ins pred:$p, reglist:$dsts, variable_ops), IIC_Br, +def tPOP_RET : T1I<(outs), (ins pred:$p, reglist:$dsts, variable_ops), + IIC_iLoadmBr, "pop${p}\t$dsts", []>, T1Misc<{1,1,0,?,?,?,?}>; @@ -560,12 +561,12 @@ def tSTM_UPD : T1It<(outs tGPR:$wb), T1Encoding<{1,1,0,0,0,?}>; // A6.2 & A8.6.189 let mayLoad = 1, Uses = [SP], Defs = [SP], hasExtraDefRegAllocReq = 1 in -def tPOP : T1I<(outs), (ins pred:$p, reglist:$dsts, variable_ops), IIC_Br, +def tPOP : T1I<(outs), (ins pred:$p, reglist:$dsts, variable_ops), IIC_iLoadmBr, "pop${p}\t$dsts", []>, T1Misc<{1,1,0,?,?,?,?}>; let mayStore = 1, Uses = [SP], Defs = [SP], hasExtraSrcRegAllocReq = 1 in -def tPUSH : T1I<(outs), (ins pred:$p, reglist:$srcs, variable_ops), IIC_Br, +def tPUSH : T1I<(outs), (ins pred:$p, reglist:$srcs, variable_ops), IIC_iStorem, "push${p}\t$srcs", []>, T1Misc<{0,1,0,?,?,?,?}>; diff --git a/lib/Target/ARM/ARMSchedule.td b/lib/Target/ARM/ARMSchedule.td index 7566721..6151008 100644 --- a/lib/Target/ARM/ARMSchedule.td +++ b/lib/Target/ARM/ARMSchedule.td @@ -42,15 +42,15 @@ def IIC_iLoadsi : InstrItinClass; def IIC_iLoadiu : InstrItinClass; def IIC_iLoadru : InstrItinClass; def IIC_iLoadsiu : InstrItinClass; -def IIC_iLoadm : InstrItinClass; -def IIC_iLoadmBr : InstrItinClass; +def IIC_iLoadm : InstrItinClass<0>; // micro-coded +def IIC_iLoadmBr : InstrItinClass<0>; // micro-coded def IIC_iStorei : InstrItinClass; def IIC_iStorer : InstrItinClass; def IIC_iStoresi : InstrItinClass; def IIC_iStoreiu : InstrItinClass; def IIC_iStoreru : InstrItinClass; def IIC_iStoresiu : InstrItinClass; -def IIC_iStorem : InstrItinClass; +def IIC_iStorem : InstrItinClass<0>; // micro-coded def IIC_Br : InstrItinClass; def IIC_fpSTAT : InstrItinClass; def IIC_fpUNA32 : InstrItinClass; @@ -81,10 +81,10 @@ def IIC_fpSQRT32 : InstrItinClass; def IIC_fpSQRT64 : InstrItinClass; def IIC_fpLoad32 : InstrItinClass; def IIC_fpLoad64 : InstrItinClass; -def IIC_fpLoadm : InstrItinClass; +def IIC_fpLoadm : InstrItinClass<0>; // micro-coded def IIC_fpStore32 : InstrItinClass; def IIC_fpStore64 : InstrItinClass; -def IIC_fpStorem : InstrItinClass; +def IIC_fpStorem : InstrItinClass<0>; // micro-coded def IIC_VLD1 : InstrItinClass; def IIC_VLD2 : InstrItinClass; def IIC_VLD3 : InstrItinClass; diff --git a/lib/Target/ARM/ARMScheduleV6.td b/lib/Target/ARM/ARMScheduleV6.td index 08b560c..b382a7a 100644 --- a/lib/Target/ARM/ARMScheduleV6.td +++ b/lib/Target/ARM/ARMScheduleV6.td @@ -86,6 +86,11 @@ def ARMV6Itineraries : ProcessorItineraries< // Load multiple InstrItinData<IIC_iLoadm , [InstrStage<3, [V6_Pipe]>]>, + // + // Load multiple plus branch + InstrItinData<IIC_iLoadmBr , [InstrStage<3, [V6_Pipe]>, + InstrStage<1, [V6_Pipe]>]>, + // Integer store pipeline // // Immediate offset diff --git a/lib/Target/TargetInstrInfo.cpp b/lib/Target/TargetInstrInfo.cpp index c099a7e..118afd4 100644 --- a/lib/Target/TargetInstrInfo.cpp +++ b/lib/Target/TargetInstrInfo.cpp @@ -13,6 +13,7 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/Target/TargetInstrItineraries.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -47,6 +48,22 @@ TargetInstrInfo::TargetInstrInfo(const TargetInstrDesc* Desc, TargetInstrInfo::~TargetInstrInfo() { } +unsigned +TargetInstrInfo::getNumMicroOps(const MachineInstr *MI, + const InstrItineraryData &ItinData) const { + if (ItinData.isEmpty()) + return 1; + + unsigned Class = MI->getDesc().getSchedClass(); + unsigned UOps = ItinData.Itineratries[Class].NumMicroOps; + if (UOps) + return UOps; + + // The # of u-ops is dynamically determined. The specific target should + // override this function to return the right number. + return 1; +} + /// insertNoop - Insert a noop into the instruction stream at the specified /// point. void TargetInstrInfo::insertNoop(MachineBasicBlock &MBB, |