2012-02-18 13:03:15 +01:00
|
|
|
//===- HexagonInstrInfo.h - Hexagon Instruction Information -----*- C++ -*-===//
|
2011-12-12 22:14:40 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the Hexagon implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef HexagonINSTRUCTIONINFO_H
|
|
|
|
#define HexagonINSTRUCTIONINFO_H
|
|
|
|
|
2012-03-17 19:46:09 +01:00
|
|
|
#include "HexagonRegisterInfo.h"
|
2012-02-08 19:25:47 +01:00
|
|
|
#include "MCTargetDesc/HexagonBaseInfo.h"
|
2011-12-12 22:14:40 +01:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "HexagonGenInstrInfo.inc"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class HexagonInstrInfo : public HexagonGenInstrInfo {
|
|
|
|
const HexagonRegisterInfo RI;
|
|
|
|
const HexagonSubtarget& Subtarget;
|
|
|
|
public:
|
|
|
|
explicit HexagonInstrInfo(HexagonSubtarget &ST);
|
|
|
|
|
|
|
|
/// 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).
|
|
|
|
///
|
|
|
|
virtual const HexagonRegisterInfo &getRegisterInfo() const { return RI; }
|
|
|
|
|
|
|
|
/// isLoadFromStackSlot - If the specified machine instruction is a direct
|
|
|
|
/// load from a stack slot, return the virtual or physical register number of
|
|
|
|
/// the destination along with the FrameIndex of the loaded stack slot. If
|
|
|
|
/// not, return 0. This predicate must return 0 if the instruction has
|
|
|
|
/// any side effects other than loading from the stack slot.
|
|
|
|
virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
|
|
|
|
|
|
|
/// isStoreToStackSlot - If the specified machine instruction is a direct
|
|
|
|
/// store to a stack slot, return the virtual or physical register number of
|
|
|
|
/// the source reg along with the FrameIndex of the loaded stack slot. If
|
|
|
|
/// not, return 0. This predicate must return 0 if the instruction has
|
|
|
|
/// any side effects other than storing to the stack slot.
|
|
|
|
virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const;
|
|
|
|
|
|
|
|
|
|
|
|
virtual bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const;
|
|
|
|
|
|
|
|
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
|
|
|
|
|
|
|
|
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const;
|
|
|
|
|
|
|
|
virtual void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const;
|
|
|
|
|
|
|
|
virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
|
|
|
|
|
|
|
virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill,
|
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
|
|
|
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
|
|
|
|
|
|
|
virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
|
|
|
|
SmallVectorImpl<MachineOperand> &Addr,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
SmallVectorImpl<MachineInstr*> &NewMIs) const;
|
|
|
|
|
|
|
|
virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
int FrameIndex) const;
|
|
|
|
|
|
|
|
virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
|
|
|
MachineInstr* MI,
|
|
|
|
const SmallVectorImpl<unsigned> &Ops,
|
|
|
|
MachineInstr* LoadMI) const {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned createVR(MachineFunction* MF, MVT VT) const;
|
|
|
|
|
|
|
|
virtual bool isPredicable(MachineInstr *MI) const;
|
|
|
|
virtual bool
|
|
|
|
PredicateInstruction(MachineInstr *MI,
|
|
|
|
const SmallVectorImpl<MachineOperand> &Cond) const;
|
|
|
|
|
2012-06-13 17:53:04 +02:00
|
|
|
virtual bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
|
2011-12-12 22:14:40 +01:00
|
|
|
unsigned ExtraPredCycles,
|
|
|
|
const BranchProbability &Probability) const;
|
|
|
|
|
|
|
|
virtual bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
|
|
|
|
unsigned NumTCycles, unsigned ExtraTCycles,
|
|
|
|
MachineBasicBlock &FMBB,
|
|
|
|
unsigned NumFCycles, unsigned ExtraFCycles,
|
|
|
|
const BranchProbability &Probability) const;
|
|
|
|
|
|
|
|
virtual bool isPredicated(const MachineInstr *MI) const;
|
|
|
|
virtual bool DefinesPredicate(MachineInstr *MI,
|
|
|
|
std::vector<MachineOperand> &Pred) const;
|
|
|
|
virtual bool
|
|
|
|
SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
|
|
|
|
const SmallVectorImpl<MachineOperand> &Pred2) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
isProfitableToDupForIfCvt(MachineBasicBlock &MBB,unsigned NumCycles,
|
|
|
|
const BranchProbability &Probability) const;
|
|
|
|
|
2012-02-01 23:13:57 +01:00
|
|
|
virtual DFAPacketizer*
|
|
|
|
CreateTargetScheduleState(const TargetMachine *TM,
|
|
|
|
const ScheduleDAG *DAG) const;
|
|
|
|
|
|
|
|
virtual bool isSchedulingBoundary(const MachineInstr *MI,
|
|
|
|
const MachineBasicBlock *MBB,
|
|
|
|
const MachineFunction &MF) const;
|
2011-12-12 22:14:40 +01:00
|
|
|
bool isValidOffset(const int Opcode, const int Offset) const;
|
|
|
|
bool isValidAutoIncImm(const EVT VT, const int Offset) const;
|
|
|
|
bool isMemOp(const MachineInstr *MI) const;
|
|
|
|
bool isSpillPredRegOp(const MachineInstr *MI) const;
|
|
|
|
bool isU6_3Immediate(const int value) const;
|
|
|
|
bool isU6_2Immediate(const int value) const;
|
|
|
|
bool isU6_1Immediate(const int value) const;
|
|
|
|
bool isU6_0Immediate(const int value) const;
|
|
|
|
bool isS4_3Immediate(const int value) const;
|
|
|
|
bool isS4_2Immediate(const int value) const;
|
|
|
|
bool isS4_1Immediate(const int value) const;
|
|
|
|
bool isS4_0Immediate(const int value) const;
|
|
|
|
bool isS12_Immediate(const int value) const;
|
|
|
|
bool isU6_Immediate(const int value) const;
|
|
|
|
bool isS8_Immediate(const int value) const;
|
|
|
|
bool isS6_Immediate(const int value) const;
|
|
|
|
|
2012-05-03 23:52:53 +02:00
|
|
|
bool isSaveCalleeSavedRegsCall(const MachineInstr* MI) const;
|
|
|
|
bool isConditionalTransfer(const MachineInstr* MI) const;
|
2012-04-23 20:25:57 +02:00
|
|
|
bool isConditionalALU32 (const MachineInstr* MI) const;
|
|
|
|
bool isConditionalLoad (const MachineInstr* MI) const;
|
2012-05-03 23:52:53 +02:00
|
|
|
bool isConditionalStore(const MachineInstr* MI) const;
|
2011-12-12 22:14:40 +01:00
|
|
|
bool isDeallocRet(const MachineInstr *MI) const;
|
2012-04-23 20:25:57 +02:00
|
|
|
unsigned getInvertedPredicatedOpcode(const int Opc) const;
|
2012-05-03 23:52:53 +02:00
|
|
|
bool isExtendable(const MachineInstr* MI) const;
|
|
|
|
bool isExtended(const MachineInstr* MI) const;
|
|
|
|
bool isPostIncrement(const MachineInstr* MI) const;
|
|
|
|
bool isNewValueStore(const MachineInstr* MI) const;
|
|
|
|
bool isNewValueJump(const MachineInstr* MI) const;
|
2012-05-12 07:10:30 +02:00
|
|
|
bool isNewValueJumpCandidate(const MachineInstr *MI) const;
|
2012-05-03 23:52:53 +02:00
|
|
|
unsigned getImmExtForm(const MachineInstr* MI) const;
|
|
|
|
unsigned getNormalBranchForm(const MachineInstr* MI) const;
|
2011-12-12 22:14:40 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int getMatchingCondBranchOpcode(int Opc, bool sense) const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|