2012-02-18 20:03:15 +08:00
|
|
|
//===-- MLxExpansionPass.cpp - Expand MLx instrs to avoid hazards ---------===//
|
2010-12-06 06:04:16 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Expand VFP / NEON floating point MLA / MLS instructions (each to a pair of
|
|
|
|
// multiple and add / sub instructions) when special VMLx hazards are detected.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ARM.h"
|
|
|
|
#include "ARMBaseInstrInfo.h"
|
2011-04-20 02:11:57 +08:00
|
|
|
#include "ARMSubtarget.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
|
|
#include "llvm/ADT/Statistic.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2010-12-06 06:04:16 +08:00
|
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/Target/TargetRegisterInfo.h"
|
2010-12-06 06:04:16 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 10:41:26 +08:00
|
|
|
#define DEBUG_TYPE "mlx-expansion"
|
|
|
|
|
2010-12-06 06:04:16 +08:00
|
|
|
static cl::opt<bool>
|
|
|
|
ForceExapnd("expand-all-fp-mlx", cl::init(false), cl::Hidden);
|
|
|
|
static cl::opt<unsigned>
|
|
|
|
ExpandLimit("expand-limit", cl::init(~0U), cl::Hidden);
|
|
|
|
|
|
|
|
STATISTIC(NumExpand, "Number of fp MLA / MLS instructions expanded");
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
struct MLxExpansion : public MachineFunctionPass {
|
|
|
|
static char ID;
|
|
|
|
MLxExpansion() : MachineFunctionPass(ID) {}
|
|
|
|
|
2014-03-10 10:09:33 +08:00
|
|
|
bool runOnMachineFunction(MachineFunction &Fn) override;
|
2010-12-06 06:04:16 +08:00
|
|
|
|
2014-03-10 10:09:33 +08:00
|
|
|
const char *getPassName() const override {
|
2010-12-06 06:04:16 +08:00
|
|
|
return "ARM MLA / MLS expansion pass";
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const ARMBaseInstrInfo *TII;
|
|
|
|
const TargetRegisterInfo *TRI;
|
|
|
|
MachineRegisterInfo *MRI;
|
|
|
|
|
2012-09-13 23:05:10 +08:00
|
|
|
bool isLikeA9;
|
2012-09-30 05:43:49 +08:00
|
|
|
bool isSwift;
|
2010-12-06 06:04:16 +08:00
|
|
|
unsigned MIIdx;
|
|
|
|
MachineInstr* LastMIs[4];
|
2011-04-20 02:11:57 +08:00
|
|
|
SmallPtrSet<MachineInstr*, 4> IgnoreStall;
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
void clearStack();
|
|
|
|
void pushStack(MachineInstr *MI);
|
|
|
|
MachineInstr *getAccDefMI(MachineInstr *MI) const;
|
|
|
|
unsigned getDefReg(MachineInstr *MI) const;
|
2012-09-30 05:43:49 +08:00
|
|
|
bool hasLoopHazard(MachineInstr *MI) const;
|
2010-12-06 06:04:16 +08:00
|
|
|
bool hasRAWHazard(unsigned Reg, MachineInstr *MI) const;
|
2011-04-20 02:11:57 +08:00
|
|
|
bool FindMLxHazard(MachineInstr *MI);
|
2010-12-06 06:04:16 +08:00
|
|
|
void ExpandFPMLxInstruction(MachineBasicBlock &MBB, MachineInstr *MI,
|
|
|
|
unsigned MulOpc, unsigned AddSubOpc,
|
|
|
|
bool NegAcc, bool HasLane);
|
|
|
|
bool ExpandFPMLxInstructions(MachineBasicBlock &MBB);
|
|
|
|
};
|
|
|
|
char MLxExpansion::ID = 0;
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
void MLxExpansion::clearStack() {
|
2014-04-25 13:30:21 +08:00
|
|
|
std::fill(LastMIs, LastMIs + 4, nullptr);
|
2010-12-06 06:04:16 +08:00
|
|
|
MIIdx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MLxExpansion::pushStack(MachineInstr *MI) {
|
|
|
|
LastMIs[MIIdx] = MI;
|
|
|
|
if (++MIIdx == 4)
|
|
|
|
MIIdx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
MachineInstr *MLxExpansion::getAccDefMI(MachineInstr *MI) const {
|
|
|
|
// Look past COPY and INSERT_SUBREG instructions to find the
|
|
|
|
// real definition MI. This is important for _sfp instructions.
|
|
|
|
unsigned Reg = MI->getOperand(1).getReg();
|
|
|
|
if (TargetRegisterInfo::isPhysicalRegister(Reg))
|
2014-04-25 13:30:21 +08:00
|
|
|
return nullptr;
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
MachineBasicBlock *MBB = MI->getParent();
|
|
|
|
MachineInstr *DefMI = MRI->getVRegDef(Reg);
|
|
|
|
while (true) {
|
|
|
|
if (DefMI->getParent() != MBB)
|
|
|
|
break;
|
|
|
|
if (DefMI->isCopyLike()) {
|
|
|
|
Reg = DefMI->getOperand(1).getReg();
|
|
|
|
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
|
|
|
DefMI = MRI->getVRegDef(Reg);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else if (DefMI->isInsertSubreg()) {
|
|
|
|
Reg = DefMI->getOperand(2).getReg();
|
|
|
|
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
|
|
|
DefMI = MRI->getVRegDef(Reg);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return DefMI;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned MLxExpansion::getDefReg(MachineInstr *MI) const {
|
|
|
|
unsigned Reg = MI->getOperand(0).getReg();
|
|
|
|
if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
|
|
|
|
!MRI->hasOneNonDBGUse(Reg))
|
|
|
|
return Reg;
|
|
|
|
|
|
|
|
MachineBasicBlock *MBB = MI->getParent();
|
2014-03-14 07:12:04 +08:00
|
|
|
MachineInstr *UseMI = &*MRI->use_instr_nodbg_begin(Reg);
|
2010-12-06 06:04:16 +08:00
|
|
|
if (UseMI->getParent() != MBB)
|
|
|
|
return Reg;
|
|
|
|
|
|
|
|
while (UseMI->isCopy() || UseMI->isInsertSubreg()) {
|
|
|
|
Reg = UseMI->getOperand(0).getReg();
|
|
|
|
if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
|
|
|
|
!MRI->hasOneNonDBGUse(Reg))
|
|
|
|
return Reg;
|
2014-03-14 07:12:04 +08:00
|
|
|
UseMI = &*MRI->use_instr_nodbg_begin(Reg);
|
2010-12-06 06:04:16 +08:00
|
|
|
if (UseMI->getParent() != MBB)
|
|
|
|
return Reg;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Reg;
|
|
|
|
}
|
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
/// hasLoopHazard - Check whether an MLx instruction is chained to itself across
|
|
|
|
/// a single-MBB loop.
|
|
|
|
bool MLxExpansion::hasLoopHazard(MachineInstr *MI) const {
|
|
|
|
unsigned Reg = MI->getOperand(1).getReg();
|
|
|
|
if (TargetRegisterInfo::isPhysicalRegister(Reg))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
MachineBasicBlock *MBB = MI->getParent();
|
|
|
|
MachineInstr *DefMI = MRI->getVRegDef(Reg);
|
|
|
|
while (true) {
|
|
|
|
outer_continue:
|
|
|
|
if (DefMI->getParent() != MBB)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (DefMI->isPHI()) {
|
|
|
|
for (unsigned i = 1, e = DefMI->getNumOperands(); i < e; i += 2) {
|
|
|
|
if (DefMI->getOperand(i + 1).getMBB() == MBB) {
|
|
|
|
unsigned SrcReg = DefMI->getOperand(i).getReg();
|
|
|
|
if (TargetRegisterInfo::isVirtualRegister(SrcReg)) {
|
|
|
|
DefMI = MRI->getVRegDef(SrcReg);
|
|
|
|
goto outer_continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (DefMI->isCopyLike()) {
|
|
|
|
Reg = DefMI->getOperand(1).getReg();
|
|
|
|
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
|
|
|
DefMI = MRI->getVRegDef(Reg);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else if (DefMI->isInsertSubreg()) {
|
|
|
|
Reg = DefMI->getOperand(2).getReg();
|
|
|
|
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
|
|
|
DefMI = MRI->getVRegDef(Reg);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DefMI == MI;
|
|
|
|
}
|
|
|
|
|
2010-12-06 06:04:16 +08:00
|
|
|
bool MLxExpansion::hasRAWHazard(unsigned Reg, MachineInstr *MI) const {
|
|
|
|
// FIXME: Detect integer instructions properly.
|
2011-06-29 03:10:37 +08:00
|
|
|
const MCInstrDesc &MCID = MI->getDesc();
|
|
|
|
unsigned Domain = MCID.TSFlags & ARMII::DomainMask;
|
2011-12-07 15:15:52 +08:00
|
|
|
if (MI->mayStore())
|
2010-12-06 06:04:16 +08:00
|
|
|
return false;
|
2011-06-29 03:10:37 +08:00
|
|
|
unsigned Opcode = MCID.getOpcode();
|
2011-02-23 03:53:14 +08:00
|
|
|
if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD)
|
|
|
|
return false;
|
|
|
|
if ((Domain & ARMII::DomainVFP) || (Domain & ARMII::DomainNEON))
|
|
|
|
return MI->readsRegister(Reg, TRI);
|
2010-12-06 06:04:16 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
static bool isFpMulInstruction(unsigned Opcode) {
|
|
|
|
switch (Opcode) {
|
|
|
|
case ARM::VMULS:
|
|
|
|
case ARM::VMULfd:
|
|
|
|
case ARM::VMULfq:
|
|
|
|
case ARM::VMULD:
|
|
|
|
case ARM::VMULslfd:
|
|
|
|
case ARM::VMULslfq:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2010-12-06 06:04:16 +08:00
|
|
|
|
2011-04-20 02:11:57 +08:00
|
|
|
bool MLxExpansion::FindMLxHazard(MachineInstr *MI) {
|
2010-12-06 06:04:16 +08:00
|
|
|
if (NumExpand >= ExpandLimit)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (ForceExapnd)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
MachineInstr *DefMI = getAccDefMI(MI);
|
2011-04-20 02:11:57 +08:00
|
|
|
if (TII->isFpMLxInstruction(DefMI->getOpcode())) {
|
2010-12-06 06:04:16 +08:00
|
|
|
// r0 = vmla
|
|
|
|
// r3 = vmla r0, r1, r2
|
|
|
|
// takes 16 - 17 cycles
|
|
|
|
//
|
|
|
|
// r0 = vmla
|
|
|
|
// r4 = vmul r1, r2
|
|
|
|
// r3 = vadd r0, r4
|
|
|
|
// takes about 14 - 15 cycles even with vmul stalling for 4 cycles.
|
2011-04-20 02:11:57 +08:00
|
|
|
IgnoreStall.insert(DefMI);
|
2010-12-06 06:04:16 +08:00
|
|
|
return true;
|
2011-04-20 02:11:57 +08:00
|
|
|
}
|
|
|
|
|
2012-09-30 05:43:49 +08:00
|
|
|
// On Swift, we mostly care about hazards from multiplication instructions
|
|
|
|
// writing the accumulator and the pipelining of loop iterations by out-of-
|
|
|
|
// order execution.
|
|
|
|
if (isSwift)
|
|
|
|
return isFpMulInstruction(DefMI->getOpcode()) || hasLoopHazard(MI);
|
|
|
|
|
2011-04-20 02:11:57 +08:00
|
|
|
if (IgnoreStall.count(MI))
|
|
|
|
return false;
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
// If a VMLA.F is followed by an VADD.F or VMUL.F with no RAW hazard, the
|
|
|
|
// VADD.F or VMUL.F will stall 4 cycles before issue. The 4 cycle stall
|
|
|
|
// preserves the in-order retirement of the instructions.
|
|
|
|
// Look at the next few instructions, if *most* of them can cause hazards,
|
|
|
|
// then the scheduler can't *fix* this, we'd better break up the VMLA.
|
2012-09-13 23:05:10 +08:00
|
|
|
unsigned Limit1 = isLikeA9 ? 1 : 4;
|
|
|
|
unsigned Limit2 = isLikeA9 ? 1 : 4;
|
2010-12-06 06:04:16 +08:00
|
|
|
for (unsigned i = 1; i <= 4; ++i) {
|
|
|
|
int Idx = ((int)MIIdx - i + 4) % 4;
|
|
|
|
MachineInstr *NextMI = LastMIs[Idx];
|
|
|
|
if (!NextMI)
|
|
|
|
continue;
|
|
|
|
|
2011-04-20 02:11:57 +08:00
|
|
|
if (TII->canCauseFpMLxStall(NextMI->getOpcode())) {
|
|
|
|
if (i <= Limit1)
|
|
|
|
return true;
|
|
|
|
}
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
// Look for VMLx RAW hazard.
|
2011-04-20 02:11:57 +08:00
|
|
|
if (i <= Limit2 && hasRAWHazard(getDefReg(MI), NextMI))
|
2010-12-06 06:04:16 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ExpandFPMLxInstructions - Expand a MLA / MLS instruction into a pair
|
|
|
|
/// of MUL + ADD / SUB instructions.
|
|
|
|
void
|
|
|
|
MLxExpansion::ExpandFPMLxInstruction(MachineBasicBlock &MBB, MachineInstr *MI,
|
|
|
|
unsigned MulOpc, unsigned AddSubOpc,
|
|
|
|
bool NegAcc, bool HasLane) {
|
|
|
|
unsigned DstReg = MI->getOperand(0).getReg();
|
|
|
|
bool DstDead = MI->getOperand(0).isDead();
|
|
|
|
unsigned AccReg = MI->getOperand(1).getReg();
|
|
|
|
unsigned Src1Reg = MI->getOperand(2).getReg();
|
|
|
|
unsigned Src2Reg = MI->getOperand(3).getReg();
|
|
|
|
bool Src1Kill = MI->getOperand(2).isKill();
|
|
|
|
bool Src2Kill = MI->getOperand(3).isKill();
|
|
|
|
unsigned LaneImm = HasLane ? MI->getOperand(4).getImm() : 0;
|
|
|
|
unsigned NextOp = HasLane ? 5 : 4;
|
|
|
|
ARMCC::CondCodes Pred = (ARMCC::CondCodes)MI->getOperand(NextOp).getImm();
|
|
|
|
unsigned PredReg = MI->getOperand(++NextOp).getReg();
|
|
|
|
|
2011-06-29 03:10:37 +08:00
|
|
|
const MCInstrDesc &MCID1 = TII->get(MulOpc);
|
|
|
|
const MCInstrDesc &MCID2 = TII->get(AddSubOpc);
|
2012-05-08 06:10:26 +08:00
|
|
|
const MachineFunction &MF = *MI->getParent()->getParent();
|
|
|
|
unsigned TmpReg = MRI->createVirtualRegister(
|
|
|
|
TII->getRegClass(MCID1, 0, TRI, MF));
|
2010-12-06 06:04:16 +08:00
|
|
|
|
2011-12-14 10:11:42 +08:00
|
|
|
MachineInstrBuilder MIB = BuildMI(MBB, MI, MI->getDebugLoc(), MCID1, TmpReg)
|
2010-12-06 06:04:16 +08:00
|
|
|
.addReg(Src1Reg, getKillRegState(Src1Kill))
|
|
|
|
.addReg(Src2Reg, getKillRegState(Src2Kill));
|
|
|
|
if (HasLane)
|
|
|
|
MIB.addImm(LaneImm);
|
|
|
|
MIB.addImm(Pred).addReg(PredReg);
|
|
|
|
|
2011-12-14 10:11:42 +08:00
|
|
|
MIB = BuildMI(MBB, MI, MI->getDebugLoc(), MCID2)
|
2010-12-06 06:04:16 +08:00
|
|
|
.addReg(DstReg, getDefRegState(true) | getDeadRegState(DstDead));
|
|
|
|
|
|
|
|
if (NegAcc) {
|
|
|
|
bool AccKill = MRI->hasOneNonDBGUse(AccReg);
|
|
|
|
MIB.addReg(TmpReg, getKillRegState(true))
|
|
|
|
.addReg(AccReg, getKillRegState(AccKill));
|
|
|
|
} else {
|
|
|
|
MIB.addReg(AccReg).addReg(TmpReg, getKillRegState(true));
|
|
|
|
}
|
|
|
|
MIB.addImm(Pred).addReg(PredReg);
|
|
|
|
|
|
|
|
DEBUG({
|
|
|
|
dbgs() << "Expanding: " << *MI;
|
|
|
|
dbgs() << " to:\n";
|
|
|
|
MachineBasicBlock::iterator MII = MI;
|
2014-03-02 20:27:27 +08:00
|
|
|
MII = std::prev(MII);
|
2010-12-06 06:04:16 +08:00
|
|
|
MachineInstr &MI2 = *MII;
|
2014-03-02 20:27:27 +08:00
|
|
|
MII = std::prev(MII);
|
2010-12-06 06:04:16 +08:00
|
|
|
MachineInstr &MI1 = *MII;
|
|
|
|
dbgs() << " " << MI1;
|
|
|
|
dbgs() << " " << MI2;
|
|
|
|
});
|
|
|
|
|
|
|
|
MI->eraseFromParent();
|
|
|
|
++NumExpand;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MLxExpansion::ExpandFPMLxInstructions(MachineBasicBlock &MBB) {
|
|
|
|
bool Changed = false;
|
|
|
|
|
|
|
|
clearStack();
|
2011-04-20 02:11:57 +08:00
|
|
|
IgnoreStall.clear();
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
unsigned Skip = 0;
|
|
|
|
MachineBasicBlock::reverse_iterator MII = MBB.rbegin(), E = MBB.rend();
|
|
|
|
while (MII != E) {
|
|
|
|
MachineInstr *MI = &*MII;
|
|
|
|
|
2014-03-07 14:08:31 +08:00
|
|
|
if (MI->isPosition() || MI->isImplicitDef() || MI->isCopy()) {
|
2010-12-06 06:04:16 +08:00
|
|
|
++MII;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-06-29 03:10:37 +08:00
|
|
|
const MCInstrDesc &MCID = MI->getDesc();
|
2011-12-07 15:15:52 +08:00
|
|
|
if (MI->isBarrier()) {
|
2010-12-06 06:04:16 +08:00
|
|
|
clearStack();
|
|
|
|
Skip = 0;
|
|
|
|
++MII;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-06-29 03:10:37 +08:00
|
|
|
unsigned Domain = MCID.TSFlags & ARMII::DomainMask;
|
2010-12-06 06:04:16 +08:00
|
|
|
if (Domain == ARMII::DomainGeneral) {
|
|
|
|
if (++Skip == 2)
|
|
|
|
// Assume dual issues of non-VFP / NEON instructions.
|
2014-04-25 13:30:21 +08:00
|
|
|
pushStack(nullptr);
|
2010-12-06 06:04:16 +08:00
|
|
|
} else {
|
|
|
|
Skip = 0;
|
|
|
|
|
|
|
|
unsigned MulOpc, AddSubOpc;
|
|
|
|
bool NegAcc, HasLane;
|
2011-06-29 03:10:37 +08:00
|
|
|
if (!TII->isFpMLxInstruction(MCID.getOpcode(),
|
2010-12-06 06:04:16 +08:00
|
|
|
MulOpc, AddSubOpc, NegAcc, HasLane) ||
|
|
|
|
!FindMLxHazard(MI))
|
|
|
|
pushStack(MI);
|
|
|
|
else {
|
|
|
|
ExpandFPMLxInstruction(MBB, MI, MulOpc, AddSubOpc, NegAcc, HasLane);
|
|
|
|
E = MBB.rend(); // May have changed if MI was the 1st instruction.
|
|
|
|
Changed = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
++MII;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MLxExpansion::runOnMachineFunction(MachineFunction &Fn) {
|
2016-04-26 06:01:04 +08:00
|
|
|
if (skipFunction(*Fn.getFunction()))
|
|
|
|
return false;
|
|
|
|
|
2014-08-05 10:39:49 +08:00
|
|
|
TII = static_cast<const ARMBaseInstrInfo *>(Fn.getSubtarget().getInstrInfo());
|
|
|
|
TRI = Fn.getSubtarget().getRegisterInfo();
|
2010-12-06 06:04:16 +08:00
|
|
|
MRI = &Fn.getRegInfo();
|
2015-02-20 16:24:37 +08:00
|
|
|
const ARMSubtarget *STI = &Fn.getSubtarget<ARMSubtarget>();
|
2015-03-05 08:23:40 +08:00
|
|
|
// Only run this for CortexA9.
|
|
|
|
if (!STI->isCortexA9())
|
|
|
|
return false;
|
2012-09-30 05:43:49 +08:00
|
|
|
isLikeA9 = STI->isLikeA9() || STI->isSwift();
|
|
|
|
isSwift = STI->isSwift();
|
2010-12-06 06:04:16 +08:00
|
|
|
|
|
|
|
bool Modified = false;
|
2014-03-12 01:37:48 +08:00
|
|
|
for (MachineBasicBlock &MBB : Fn)
|
2010-12-06 06:04:16 +08:00
|
|
|
Modified |= ExpandFPMLxInstructions(MBB);
|
|
|
|
|
|
|
|
return Modified;
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionPass *llvm::createMLxExpansionPass() {
|
|
|
|
return new MLxExpansion();
|
|
|
|
}
|