forked from OSchip/llvm-project
Clean up some uses of getSubtarget in AArch64.
llvm-svn: 227530
This commit is contained in:
parent
f761d901aa
commit
125898a2a1
|
@ -16,8 +16,6 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "AArch64.h"
|
#include "AArch64.h"
|
||||||
#include "AArch64InstrInfo.h"
|
|
||||||
#include "AArch64Subtarget.h"
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
|
@ -26,6 +24,7 @@
|
||||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ static bool isSecondInstructionInSequence(MachineInstr *MI) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class AArch64A53Fix835769 : public MachineFunctionPass {
|
class AArch64A53Fix835769 : public MachineFunctionPass {
|
||||||
const AArch64InstrInfo *TII;
|
const TargetInstrInfo *TII;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
|
@ -107,17 +106,13 @@ char AArch64A53Fix835769::ID = 0;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AArch64A53Fix835769::runOnMachineFunction(MachineFunction &F) {
|
AArch64A53Fix835769::runOnMachineFunction(MachineFunction &F) {
|
||||||
const TargetMachine &TM = F.getTarget();
|
|
||||||
|
|
||||||
bool Changed = false;
|
|
||||||
DEBUG(dbgs() << "***** AArch64A53Fix835769 *****\n");
|
DEBUG(dbgs() << "***** AArch64A53Fix835769 *****\n");
|
||||||
|
bool Changed = false;
|
||||||
TII = TM.getSubtarget<AArch64Subtarget>().getInstrInfo();
|
TII = F.getSubtarget().getInstrInfo();
|
||||||
|
|
||||||
for (auto &MBB : F) {
|
for (auto &MBB : F) {
|
||||||
Changed |= runOnBasicBlock(MBB);
|
Changed |= runOnBasicBlock(MBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ static const char *ColorNames[2] = { "Even", "Odd" };
|
||||||
class Chain;
|
class Chain;
|
||||||
|
|
||||||
class AArch64A57FPLoadBalancing : public MachineFunctionPass {
|
class AArch64A57FPLoadBalancing : public MachineFunctionPass {
|
||||||
const AArch64InstrInfo *TII;
|
|
||||||
MachineRegisterInfo *MRI;
|
MachineRegisterInfo *MRI;
|
||||||
const TargetRegisterInfo *TRI;
|
const TargetRegisterInfo *TRI;
|
||||||
RegisterClassInfo RCI;
|
RegisterClassInfo RCI;
|
||||||
|
@ -311,10 +310,8 @@ bool AArch64A57FPLoadBalancing::runOnMachineFunction(MachineFunction &F) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
DEBUG(dbgs() << "***** AArch64A57FPLoadBalancing *****\n");
|
DEBUG(dbgs() << "***** AArch64A57FPLoadBalancing *****\n");
|
||||||
|
|
||||||
const TargetMachine &TM = F.getTarget();
|
|
||||||
MRI = &F.getRegInfo();
|
MRI = &F.getRegInfo();
|
||||||
TRI = F.getRegInfo().getTargetRegisterInfo();
|
TRI = F.getRegInfo().getTargetRegisterInfo();
|
||||||
TII = TM.getSubtarget<AArch64Subtarget>().getInstrInfo();
|
|
||||||
RCI.runOnMachineFunction(F);
|
RCI.runOnMachineFunction(F);
|
||||||
|
|
||||||
for (auto &MBB : F) {
|
for (auto &MBB : F) {
|
||||||
|
|
|
@ -92,8 +92,7 @@ struct LDTLSCleanup : public MachineFunctionPass {
|
||||||
MachineInstr *replaceTLSBaseAddrCall(MachineInstr *I,
|
MachineInstr *replaceTLSBaseAddrCall(MachineInstr *I,
|
||||||
unsigned TLSBaseAddrReg) {
|
unsigned TLSBaseAddrReg) {
|
||||||
MachineFunction *MF = I->getParent()->getParent();
|
MachineFunction *MF = I->getParent()->getParent();
|
||||||
const AArch64InstrInfo *TII = static_cast<const AArch64InstrInfo *>(
|
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
|
||||||
MF->getSubtarget().getInstrInfo());
|
|
||||||
|
|
||||||
// Insert a Copy from TLSBaseAddrReg to x0, which is where the rest of the
|
// Insert a Copy from TLSBaseAddrReg to x0, which is where the rest of the
|
||||||
// code sequence assumes the address will be.
|
// code sequence assumes the address will be.
|
||||||
|
@ -111,8 +110,7 @@ struct LDTLSCleanup : public MachineFunctionPass {
|
||||||
// inserting a copy instruction after I. Returns the new instruction.
|
// inserting a copy instruction after I. Returns the new instruction.
|
||||||
MachineInstr *setRegister(MachineInstr *I, unsigned *TLSBaseAddrReg) {
|
MachineInstr *setRegister(MachineInstr *I, unsigned *TLSBaseAddrReg) {
|
||||||
MachineFunction *MF = I->getParent()->getParent();
|
MachineFunction *MF = I->getParent()->getParent();
|
||||||
const AArch64InstrInfo *TII = static_cast<const AArch64InstrInfo *>(
|
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
|
||||||
MF->getSubtarget().getInstrInfo());
|
|
||||||
|
|
||||||
// Create a virtual register for the TLS base address.
|
// Create a virtual register for the TLS base address.
|
||||||
MachineRegisterInfo &RegInfo = MF->getRegInfo();
|
MachineRegisterInfo &RegInfo = MF->getRegInfo();
|
||||||
|
|
|
@ -1040,8 +1040,7 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) {
|
||||||
|
|
||||||
MachineInstr *DummyOp = nullptr;
|
MachineInstr *DummyOp = nullptr;
|
||||||
if (BasicBlockScopeOnly) {
|
if (BasicBlockScopeOnly) {
|
||||||
const AArch64InstrInfo *TII =
|
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
||||||
static_cast<const AArch64InstrInfo *>(MF.getSubtarget().getInstrInfo());
|
|
||||||
// For local analysis, create a dummy operation to record uses that are not
|
// For local analysis, create a dummy operation to record uses that are not
|
||||||
// local.
|
// local.
|
||||||
DummyOp = MF.CreateMachineInstr(TII->get(AArch64::COPY), DebugLoc());
|
DummyOp = MF.CreateMachineInstr(TII->get(AArch64::COPY), DebugLoc());
|
||||||
|
|
|
@ -245,9 +245,10 @@ public:
|
||||||
unsigned fastMaterializeFloatZero(const ConstantFP* CF) override;
|
unsigned fastMaterializeFloatZero(const ConstantFP* CF) override;
|
||||||
|
|
||||||
explicit AArch64FastISel(FunctionLoweringInfo &FuncInfo,
|
explicit AArch64FastISel(FunctionLoweringInfo &FuncInfo,
|
||||||
const TargetLibraryInfo *LibInfo)
|
const TargetLibraryInfo *LibInfo)
|
||||||
: FastISel(FuncInfo, LibInfo, /*SkipTargetIndependentISel=*/true) {
|
: FastISel(FuncInfo, LibInfo, /*SkipTargetIndependentISel=*/true) {
|
||||||
Subtarget = &TM.getSubtarget<AArch64Subtarget>();
|
Subtarget =
|
||||||
|
&static_cast<const AArch64Subtarget &>(FuncInfo.MF->getSubtarget());
|
||||||
Context = &FuncInfo.Fn->getContext();
|
Context = &FuncInfo.Fn->getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3324,8 +3325,7 @@ bool AArch64FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
|
||||||
MFI->setFrameAddressIsTaken(true);
|
MFI->setFrameAddressIsTaken(true);
|
||||||
|
|
||||||
const AArch64RegisterInfo *RegInfo =
|
const AArch64RegisterInfo *RegInfo =
|
||||||
static_cast<const AArch64RegisterInfo *>(
|
static_cast<const AArch64RegisterInfo *>(Subtarget->getRegisterInfo());
|
||||||
FuncInfo.MF->getSubtarget().getRegisterInfo());
|
|
||||||
unsigned FramePtr = RegInfo->getFrameRegister(*(FuncInfo.MF));
|
unsigned FramePtr = RegInfo->getFrameRegister(*(FuncInfo.MF));
|
||||||
unsigned SrcReg = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
|
unsigned SrcReg = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
FnAttrs.hasAttribute(AttributeSet::FunctionIndex,
|
FnAttrs.hasAttribute(AttributeSet::FunctionIndex,
|
||||||
Attribute::OptimizeForSize) ||
|
Attribute::OptimizeForSize) ||
|
||||||
FnAttrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize);
|
FnAttrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize);
|
||||||
Subtarget = &TM.getSubtarget<AArch64Subtarget>();
|
Subtarget = &static_cast<const AArch64Subtarget &>(MF.getSubtarget());
|
||||||
return SelectionDAGISel::runOnMachineFunction(MF);
|
return SelectionDAGISel::runOnMachineFunction(MF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue