2012-02-18 20:03:15 +08:00
|
|
|
//===-- Thumb2InstrInfo.h - Thumb-2 Instruction Information -----*- C++ -*-===//
|
2009-06-27 05:28:53 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-06-27 05:28:53 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-07-03 06:18:33 +08:00
|
|
|
// This file contains the Thumb-2 implementation of the TargetInstrInfo class.
|
2009-06-27 05:28:53 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
|
2009-06-27 05:28:53 +08:00
|
|
|
|
2012-03-26 07:49:58 +08:00
|
|
|
#include "ARMBaseInstrInfo.h"
|
2015-03-13 06:48:50 +08:00
|
|
|
#include "ThumbRegisterInfo.h"
|
2009-06-27 05:28:53 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-06-19 07:09:54 +08:00
|
|
|
class ARMSubtarget;
|
|
|
|
class ScheduleHazardRecognizer;
|
2009-06-27 05:28:53 +08:00
|
|
|
|
2009-07-03 06:18:33 +08:00
|
|
|
class Thumb2InstrInfo : public ARMBaseInstrInfo {
|
2015-03-13 06:48:50 +08:00
|
|
|
ThumbRegisterInfo RI;
|
2009-06-27 05:28:53 +08:00
|
|
|
public:
|
2009-07-03 06:18:33 +08:00
|
|
|
explicit Thumb2InstrInfo(const ARMSubtarget &STI);
|
2009-06-27 05:28:53 +08:00
|
|
|
|
2017-04-22 05:48:41 +08:00
|
|
|
/// Return the noop instruction to use for a noop.
|
|
|
|
void getNoop(MCInst &NopInst) const override;
|
2012-02-29 07:53:30 +08:00
|
|
|
|
2009-07-09 00:09:28 +08:00
|
|
|
// Return the non-pre/post incrementing version of 'Opc'. Return 0
|
|
|
|
// if there is not such an opcode.
|
2014-03-10 10:09:33 +08:00
|
|
|
unsigned getUnindexedOpcode(unsigned Opc) const override;
|
2009-07-09 00:09:28 +08:00
|
|
|
|
2010-06-19 07:09:54 +08:00
|
|
|
void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
|
2014-03-10 10:09:33 +08:00
|
|
|
MachineBasicBlock *NewDest) const override;
|
2010-06-19 07:09:54 +08:00
|
|
|
|
2010-06-22 09:18:16 +08:00
|
|
|
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
|
2014-03-10 10:09:33 +08:00
|
|
|
MachineBasicBlock::iterator MBBI) const override;
|
2010-06-22 09:18:16 +08:00
|
|
|
|
2016-06-12 23:39:02 +08:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
2019-11-11 16:24:21 +08:00
|
|
|
const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
|
2014-03-10 10:09:33 +08:00
|
|
|
bool KillSrc) const override;
|
2009-07-17 07:26:06 +08:00
|
|
|
|
2009-07-27 11:14:20 +08:00
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
[NFC] unsigned->Register in storeRegTo/loadRegFromStack
Summary:
This patch makes progress on the 'unsigned -> Register' rewrite for
`TargetInstrInfo::loadRegFromStack` and `TII::storeRegToStack`.
Reviewers: arsenm, craig.topper, uweigand, jpienaar, atanasyan, venkatra, robertlytton, dylanmckay, t.p.northover, kparzysz, tstellar, k-ishizaka
Reviewed By: arsenm
Subscribers: wuzish, merge_guards_bot, jyknight, sdardis, nemanjai, jvesely, wdng, nhaehnle, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73870
2020-02-03 21:22:06 +08:00
|
|
|
Register SrcReg, bool isKill, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
2014-03-10 10:09:33 +08:00
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2009-07-27 11:14:20 +08:00
|
|
|
|
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
[NFC] unsigned->Register in storeRegTo/loadRegFromStack
Summary:
This patch makes progress on the 'unsigned -> Register' rewrite for
`TargetInstrInfo::loadRegFromStack` and `TII::storeRegToStack`.
Reviewers: arsenm, craig.topper, uweigand, jpienaar, atanasyan, venkatra, robertlytton, dylanmckay, t.p.northover, kparzysz, tstellar, k-ishizaka
Reviewed By: arsenm
Subscribers: wuzish, merge_guards_bot, jyknight, sdardis, nemanjai, jvesely, wdng, nhaehnle, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73870
2020-02-03 21:22:06 +08:00
|
|
|
Register DestReg, int FrameIndex,
|
2010-05-07 03:06:44 +08:00
|
|
|
const TargetRegisterClass *RC,
|
2014-03-10 10:09:33 +08:00
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2009-07-27 11:14:20 +08:00
|
|
|
|
2009-06-27 20:16:40 +08:00
|
|
|
/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
|
|
|
|
/// such, whenever a client has an instance of instruction info, it should
|
|
|
|
/// always be able to get register info as well (through this method).
|
|
|
|
///
|
2015-03-13 06:48:50 +08:00
|
|
|
const ThumbRegisterInfo &getRegisterInfo() const override { return RI; }
|
2014-07-26 03:31:34 +08:00
|
|
|
|
2020-07-14 17:04:55 +08:00
|
|
|
MachineInstr *optimizeSelect(MachineInstr &MI,
|
|
|
|
SmallPtrSetImpl<MachineInstr *> &SeenMIs,
|
|
|
|
bool) const override;
|
|
|
|
|
2020-08-14 01:01:11 +08:00
|
|
|
MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI,
|
|
|
|
unsigned OpIdx1,
|
|
|
|
unsigned OpIdx2) const override;
|
|
|
|
|
2014-07-26 03:31:34 +08:00
|
|
|
private:
|
2016-06-28 23:18:26 +08:00
|
|
|
void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override;
|
2009-06-27 05:28:53 +08:00
|
|
|
};
|
2010-06-22 09:18:16 +08:00
|
|
|
|
|
|
|
/// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical
|
|
|
|
/// to llvm::getInstrPredicate except it returns AL for conditional branch
|
|
|
|
/// instructions which are "predicated", but are not in IT blocks.
|
2020-04-08 05:28:53 +08:00
|
|
|
ARMCC::CondCodes getITInstrPredicate(const MachineInstr &MI, Register &PredReg);
|
2019-06-14 19:46:05 +08:00
|
|
|
|
|
|
|
// getVPTInstrPredicate: VPT analogue of that, plus a helper function
|
|
|
|
// corresponding to MachineInstr::findFirstPredOperandIdx.
|
|
|
|
int findFirstVPTPredOperandIdx(const MachineInstr &MI);
|
|
|
|
ARMVCC::VPTCodes getVPTInstrPredicate(const MachineInstr &MI,
|
2020-04-08 05:28:53 +08:00
|
|
|
Register &PredReg);
|
2020-03-10 00:40:33 +08:00
|
|
|
inline ARMVCC::VPTCodes getVPTInstrPredicate(const MachineInstr &MI) {
|
2020-04-08 05:28:53 +08:00
|
|
|
Register PredReg;
|
2020-03-10 00:40:33 +08:00
|
|
|
return getVPTInstrPredicate(MI, PredReg);
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2020-04-08 18:55:09 +08:00
|
|
|
|
|
|
|
// Recomputes the Block Mask of Instr, a VPT or VPST instruction.
|
|
|
|
// This rebuilds the block mask of the instruction depending on the predicates
|
|
|
|
// of the instructions following it. This should only be used after the
|
|
|
|
// MVEVPTBlockInsertion pass has run, and should be used whenever a predicated
|
|
|
|
// instruction is added to/removed from the block.
|
|
|
|
void recomputeVPTBlockMask(MachineInstr &Instr);
|
2020-03-10 00:40:33 +08:00
|
|
|
} // namespace llvm
|
2009-06-27 05:28:53 +08:00
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|