Skip to content

Commit

Permalink
Migrate AArch64 except for TTI and AsmPrinter away from getSubtargetI…
Browse files Browse the repository at this point in the history
…mpl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227293 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Jan 28, 2015
1 parent dde94fb commit b99395a
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 48 deletions.
4 changes: 1 addition & 3 deletions lib/Target/AArch64/AArch64AdvSIMDScalarPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,8 @@ bool AArch64AdvSIMDScalar::runOnMachineFunction(MachineFunction &mf) {
bool Changed = false;
DEBUG(dbgs() << "***** AArch64AdvSIMDScalar *****\n");

const TargetMachine &TM = mf.getTarget();
MRI = &mf.getRegInfo();
TII = static_cast<const AArch64InstrInfo *>(
TM.getSubtargetImpl()->getInstrInfo());
TII = static_cast<const AArch64InstrInfo *>(mf.getSubtarget().getInstrInfo());

// Just check things on a one-block-at-a-time basis.
for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I)
Expand Down
4 changes: 1 addition & 3 deletions lib/Target/AArch64/AArch64BranchRelaxation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,7 @@ bool AArch64BranchRelaxation::runOnMachineFunction(MachineFunction &mf) {

DEBUG(dbgs() << "***** AArch64BranchRelaxation *****\n");

TII = (const AArch64InstrInfo *)MF->getTarget()
.getSubtargetImpl()
->getInstrInfo();
TII = (const AArch64InstrInfo *)MF->getSubtarget().getInstrInfo();

// Renumber all of the machine basic blocks in the function, guaranteeing that
// the numbers agree with the position of the block in the function.
Expand Down
10 changes: 4 additions & 6 deletions lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ struct LDTLSCleanup : public MachineFunctionPass {
MachineInstr *replaceTLSBaseAddrCall(MachineInstr *I,
unsigned TLSBaseAddrReg) {
MachineFunction *MF = I->getParent()->getParent();
const AArch64TargetMachine *TM =
static_cast<const AArch64TargetMachine *>(&MF->getTarget());
const AArch64InstrInfo *TII = TM->getSubtargetImpl()->getInstrInfo();
const AArch64InstrInfo *TII = static_cast<const AArch64InstrInfo *>(
MF->getSubtarget().getInstrInfo());

// Insert a Copy from TLSBaseAddrReg to x0, which is where the rest of the
// code sequence assumes the address will be.
Expand All @@ -112,9 +111,8 @@ struct LDTLSCleanup : public MachineFunctionPass {
// inserting a copy instruction after I. Returns the new instruction.
MachineInstr *setRegister(MachineInstr *I, unsigned *TLSBaseAddrReg) {
MachineFunction *MF = I->getParent()->getParent();
const AArch64TargetMachine *TM =
static_cast<const AArch64TargetMachine *>(&MF->getTarget());
const AArch64InstrInfo *TII = TM->getSubtargetImpl()->getInstrInfo();
const AArch64InstrInfo *TII = static_cast<const AArch64InstrInfo *>(
MF->getSubtarget().getInstrInfo());

// Create a virtual register for the TLS base address.
MachineRegisterInfo &RegInfo = MF->getRegInfo();
Expand Down
11 changes: 4 additions & 7 deletions lib/Target/AArch64/AArch64CollectLOH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ static void initReachingDef(MachineFunction &MF,
BlockToSetOfInstrsPerColor &ReachableUses,
const MapRegToId &RegToId,
const MachineInstr *DummyOp, bool ADRPMode) {
const TargetMachine &TM = MF.getTarget();
const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();

const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
unsigned NbReg = RegToId.size();

for (MachineBasicBlock &MBB : MF) {
Expand Down Expand Up @@ -1026,8 +1024,7 @@ static void collectInvolvedReg(MachineFunction &MF, MapRegToId &RegToId,
}

bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) {
const TargetMachine &TM = MF.getTarget();
const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
const MachineDominatorTree *MDT = &getAnalysis<MachineDominatorTree>();

MapRegToId RegToId;
Expand All @@ -1043,8 +1040,8 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) {

MachineInstr *DummyOp = nullptr;
if (BasicBlockScopeOnly) {
const AArch64InstrInfo *TII = static_cast<const AArch64InstrInfo *>(
TM.getSubtargetImpl()->getInstrInfo());
const AArch64InstrInfo *TII =
static_cast<const AArch64InstrInfo *>(MF.getSubtarget().getInstrInfo());
// For local analysis, create a dummy operation to record uses that are not
// local.
DummyOp = MF.CreateMachineInstr(TII->get(AArch64::COPY), DebugLoc());
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/AArch64/AArch64ConditionOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ bool AArch64ConditionOptimizer::adjustTo(MachineInstr *CmpMI,
bool AArch64ConditionOptimizer::runOnMachineFunction(MachineFunction &MF) {
DEBUG(dbgs() << "********** AArch64 Conditional Compares **********\n"
<< "********** Function: " << MF.getName() << '\n');
TII = MF.getTarget().getSubtargetImpl()->getInstrInfo();
TII = MF.getSubtarget().getInstrInfo();
DomTree = &getAnalysis<MachineDominatorTree>();

bool Changed = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/AArch64/AArch64FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3325,7 +3325,7 @@ bool AArch64FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {

const AArch64RegisterInfo *RegInfo =
static_cast<const AArch64RegisterInfo *>(
TM.getSubtargetImpl()->getRegisterInfo());
FuncInfo.MF->getSubtarget().getRegisterInfo());
unsigned FramePtr = RegInfo->getFrameRegister(*(FuncInfo.MF));
unsigned SrcReg = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
Expand Down
31 changes: 12 additions & 19 deletions lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,8 @@ AArch64TargetLowering::EmitF128CSEL(MachineInstr *MI,
// EndBB:
// Dest = PHI [IfTrue, TrueBB], [IfFalse, OrigBB]

const TargetInstrInfo *TII =
getTargetMachine().getSubtargetImpl()->getInstrInfo();
MachineFunction *MF = MBB->getParent();
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
const BasicBlock *LLVM_BB = MBB->getBasicBlock();
DebugLoc DL = MI->getDebugLoc();
MachineFunction::iterator It = MBB;
Expand Down Expand Up @@ -2797,19 +2796,17 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,

// Add a register mask operand representing the call-preserved registers.
const uint32_t *Mask;
const TargetRegisterInfo *TRI =
getTargetMachine().getSubtargetImpl()->getRegisterInfo();
const AArch64RegisterInfo *ARI =
static_cast<const AArch64RegisterInfo *>(TRI);
const AArch64RegisterInfo *TRI = static_cast<const AArch64RegisterInfo *>(
MF.getSubtarget().getRegisterInfo());
if (IsThisReturn) {
// For 'this' returns, use the X0-preserving mask if applicable
Mask = ARI->getThisReturnPreservedMask(CallConv);
Mask = TRI->getThisReturnPreservedMask(CallConv);
if (!Mask) {
IsThisReturn = false;
Mask = ARI->getCallPreservedMask(CallConv);
Mask = TRI->getCallPreservedMask(CallConv);
}
} else
Mask = ARI->getCallPreservedMask(CallConv);
Mask = TRI->getCallPreservedMask(CallConv);

assert(Mask && "Missing call preserved mask for calling convention");
Ops.push_back(DAG.getRegisterMask(Mask));
Expand Down Expand Up @@ -3029,11 +3026,9 @@ AArch64TargetLowering::LowerDarwinGlobalTLSAddress(SDValue Op,
// TLS calls preserve all registers except those that absolutely must be
// trashed: X0 (it takes an argument), LR (it's a call) and NZCV (let's not be
// silly).
const TargetRegisterInfo *TRI =
getTargetMachine().getSubtargetImpl()->getRegisterInfo();
const AArch64RegisterInfo *ARI =
static_cast<const AArch64RegisterInfo *>(TRI);
const uint32_t *Mask = ARI->getTLSCallPreservedMask();
const uint32_t *Mask =
static_cast<const AArch64RegisterInfo *>(
DAG.getSubtarget().getRegisterInfo())->getTLSCallPreservedMask();

// Finally, we can make the call. This is just a degenerate version of a
// normal AArch64 call node: x0 takes the address of the descriptor, and
Expand Down Expand Up @@ -3080,11 +3075,9 @@ SDValue AArch64TargetLowering::LowerELFTLSDescCall(SDValue SymAddr,
// TLS calls preserve all registers except those that absolutely must be
// trashed: X0 (it takes an argument), LR (it's a call) and NZCV (let's not be
// silly).
const TargetRegisterInfo *TRI =
getTargetMachine().getSubtargetImpl()->getRegisterInfo();
const AArch64RegisterInfo *ARI =
static_cast<const AArch64RegisterInfo *>(TRI);
const uint32_t *Mask = ARI->getTLSCallPreservedMask();
const uint32_t *Mask =
static_cast<const AArch64RegisterInfo *>(
DAG.getSubtarget().getRegisterInfo())->getTLSCallPreservedMask();

// The function takes only one argument: the address of the descriptor itself
// in X0.
Expand Down
5 changes: 2 additions & 3 deletions lib/Target/AArch64/AArch64InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,8 @@ static bool UpdateOperandRegClass(MachineInstr *Instr) {
assert(MBB && "Can't get MachineBasicBlock here");
MachineFunction *MF = MBB->getParent();
assert(MF && "Can't get MachineFunction here");
const TargetMachine *TM = &MF->getTarget();
const TargetInstrInfo *TII = TM->getSubtargetImpl()->getInstrInfo();
const TargetRegisterInfo *TRI = TM->getSubtargetImpl()->getRegisterInfo();
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
MachineRegisterInfo *MRI = &MF->getRegInfo();

for (unsigned OpIdx = 0, EndIdx = Instr->getNumOperands(); OpIdx < EndIdx;
Expand Down
6 changes: 2 additions & 4 deletions lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,10 +945,8 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB) {
}

bool AArch64LoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
const TargetMachine &TM = Fn.getTarget();
TII = static_cast<const AArch64InstrInfo *>(
TM.getSubtargetImpl()->getInstrInfo());
TRI = TM.getSubtargetImpl()->getRegisterInfo();
TII = static_cast<const AArch64InstrInfo *>(Fn.getSubtarget().getInstrInfo());
TRI = Fn.getSubtarget().getRegisterInfo();

bool Modified = false;
for (auto &MBB : Fn)
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/AArch64/AArch64PBQPRegAlloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ void A57ChainingConstraint::apply(PBQPRAGraph &G) {
const MachineFunction &MF = G.getMetadata().MF;
LiveIntervals &LIs = G.getMetadata().LIS;

TRI = MF.getTarget().getSubtargetImpl()->getRegisterInfo();
TRI = MF.getSubtarget().getRegisterInfo();
DEBUG(MF.dump());

for (const auto &MBB: MF) {
Expand Down

0 comments on commit b99395a

Please sign in to comment.