2012-02-18 20:03:15 +08:00
|
|
|
//===-- XCoreInstrInfo.h - XCore Instruction Information --------*- C++ -*-===//
|
2008-11-07 18:59:00 +08: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 XCore implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_XCORE_XCOREINSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_XCORE_XCOREINSTRINFO_H
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
#include "XCoreRegisterInfo.h"
|
2017-11-08 09:01:31 +08:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
2008-11-07 18:59:00 +08:00
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "XCoreGenInstrInfo.inc"
|
|
|
|
|
2008-11-07 18:59:00 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
class XCoreInstrInfo : public XCoreGenInstrInfo {
|
2008-11-07 18:59:00 +08:00
|
|
|
const XCoreRegisterInfo RI;
|
2013-11-19 08:57:56 +08:00
|
|
|
virtual void anchor();
|
2008-11-07 18:59:00 +08:00
|
|
|
public:
|
2009-08-13 06:10:57 +08:00
|
|
|
XCoreInstrInfo();
|
2008-11-07 18:59:00 +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).
|
|
|
|
///
|
2014-04-29 15:57:00 +08:00
|
|
|
const TargetRegisterInfo &getRegisterInfo() const { return RI; }
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
/// 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.
|
2016-06-30 08:01:54 +08:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr &MI,
|
2014-04-29 15:57:00 +08:00
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
2008-11-07 18:59:00 +08:00
|
|
|
/// 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.
|
2016-06-30 08:01:54 +08:00
|
|
|
unsigned isStoreToStackSlot(const MachineInstr &MI,
|
2014-04-29 15:57:00 +08:00
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
2016-07-15 22:41:04 +08:00
|
|
|
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
2014-04-29 15:57:00 +08:00
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const override;
|
|
|
|
|
2016-09-15 01:24:15 +08:00
|
|
|
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2015-06-12 03:30:37 +08:00
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
2016-09-15 01:23:48 +08:00
|
|
|
const DebugLoc &DL,
|
|
|
|
int *BytesAdded = nullptr) const override;
|
2014-04-29 15:57:00 +08:00
|
|
|
|
2016-09-15 04:43:16 +08:00
|
|
|
unsigned removeBranch(MachineBasicBlock &MBB,
|
2016-09-15 01:23:48 +08:00
|
|
|
int *BytesRemoved = nullptr) const override;
|
2014-04-29 15:57:00 +08:00
|
|
|
|
2016-06-12 23:39:02 +08:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
|
|
|
const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
|
2014-04-29 15:57:00 +08:00
|
|
|
bool KillSrc) const override;
|
|
|
|
|
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned SrcReg, bool isKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
|
|
|
|
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned DestReg, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
|
|
|
|
2016-09-15 04:43:16 +08:00
|
|
|
bool reverseBranchCondition(
|
2014-04-29 15:57:00 +08:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond) const override;
|
2014-01-06 22:20:37 +08:00
|
|
|
|
|
|
|
// Emit code before MBBI to load immediate value into physical register Reg.
|
|
|
|
// Returns an iterator to the new instruction.
|
|
|
|
MachineBasicBlock::iterator loadImmediate(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
unsigned Reg, uint64_t Value) const;
|
2008-11-07 18:59:00 +08:00
|
|
|
};
|
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
#endif
|