2012-02-18 12:03:15 +00:00
|
|
|
//===-- XCoreInstrInfo.h - XCore Instruction Information --------*- C++ -*-===//
|
2008-11-07 10:59:00 +00: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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef XCOREINSTRUCTIONINFO_H
|
|
|
|
#define XCOREINSTRUCTIONINFO_H
|
|
|
|
|
|
|
|
#include "XCoreRegisterInfo.h"
|
2012-03-17 18:46:09 +00:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2008-11-07 10:59:00 +00:00
|
|
|
|
2011-07-01 17:57:27 +00:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "XCoreGenInstrInfo.inc"
|
|
|
|
|
2008-11-07 10:59:00 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2011-07-01 17:57:27 +00:00
|
|
|
class XCoreInstrInfo : public XCoreGenInstrInfo {
|
2008-11-07 10:59:00 +00:00
|
|
|
const XCoreRegisterInfo RI;
|
2013-11-19 00:57:56 +00:00
|
|
|
virtual void anchor();
|
2008-11-07 10:59:00 +00:00
|
|
|
public:
|
2009-08-12 22:10:57 +00:00
|
|
|
XCoreInstrInfo();
|
2008-11-07 10:59:00 +00: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 07:57:00 +00:00
|
|
|
const TargetRegisterInfo &getRegisterInfo() const { return RI; }
|
2008-11-07 10:59:00 +00: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.
|
2014-04-29 07:57:00 +00:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
2008-11-07 10:59:00 +00: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.
|
2014-04-29 07:57:00 +00:00
|
|
|
unsigned isStoreToStackSlot(const MachineInstr *MI,
|
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
|
|
|
bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const override;
|
|
|
|
|
|
|
|
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB,
|
|
|
|
const SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
DebugLoc DL) const override;
|
|
|
|
|
|
|
|
unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
|
|
|
|
|
|
|
|
void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
|
|
|
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;
|
|
|
|
|
|
|
|
bool ReverseBranchCondition(
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond) const override;
|
2014-01-06 14:20:37 +00: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 10:59:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|