2012-02-18 20:03:15 +08:00
|
|
|
//===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//
|
2009-05-03 20:57:15 +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 MSP430 implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
|
2009-05-03 20:57:15 +08:00
|
|
|
|
|
|
|
#include "MSP430RegisterInfo.h"
|
2012-03-18 02:46:09 +08:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2009-05-03 20:57:15 +08:00
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "MSP430GenInstrInfo.inc"
|
|
|
|
|
2009-05-03 20:57:15 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
2014-06-27 09:14:50 +08:00
|
|
|
class MSP430Subtarget;
|
2009-05-03 20:57:15 +08:00
|
|
|
|
2010-01-16 05:19:05 +08:00
|
|
|
/// MSP430II - This namespace holds all of the target specific flags that
|
|
|
|
/// instruction info tracks.
|
|
|
|
///
|
|
|
|
namespace MSP430II {
|
|
|
|
enum {
|
|
|
|
SizeShift = 2,
|
|
|
|
SizeMask = 7 << SizeShift,
|
|
|
|
|
|
|
|
SizeUnknown = 0 << SizeShift,
|
|
|
|
SizeSpecial = 1 << SizeShift,
|
|
|
|
Size2Bytes = 2 << SizeShift,
|
|
|
|
Size4Bytes = 3 << SizeShift,
|
|
|
|
Size6Bytes = 4 << SizeShift
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2011-07-02 01:57:27 +08:00
|
|
|
class MSP430InstrInfo : public MSP430GenInstrInfo {
|
2009-05-03 20:57:15 +08:00
|
|
|
const MSP430RegisterInfo RI;
|
2013-11-19 08:57:56 +08:00
|
|
|
virtual void anchor();
|
2009-05-03 20:57:15 +08:00
|
|
|
public:
|
2014-06-27 09:14:50 +08:00
|
|
|
explicit MSP430InstrInfo(MSP430Subtarget &STI);
|
2009-05-03 20:57:15 +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:58:09 +08:00
|
|
|
const TargetRegisterInfo &getRegisterInfo() const { return RI; }
|
2009-05-03 21:02:04 +08:00
|
|
|
|
2010-07-11 14:53:30 +08:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
|
|
|
unsigned DestReg, unsigned SrcReg,
|
2014-04-29 15:58:09 +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 FrameIdx,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2009-05-03 21:11:04 +08:00
|
|
|
|
2010-01-16 05:19:05 +08:00
|
|
|
unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
|
|
|
|
|
2009-10-22 03:17:18 +08:00
|
|
|
// Branch folding goodness
|
2014-04-29 15:58:09 +08:00
|
|
|
bool
|
|
|
|
ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
|
|
|
|
bool isUnpredicatedTerminator(const MachineInstr *MI) const override;
|
2009-10-22 03:17:18 +08:00
|
|
|
bool AnalyzeBranch(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock *&TBB, MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
2014-04-29 15:58:09 +08:00
|
|
|
bool AllowModify) const override;
|
2009-10-22 03:17:18 +08:00
|
|
|
|
2014-04-29 15:58:09 +08:00
|
|
|
unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
|
2009-10-22 03:17:18 +08:00
|
|
|
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2015-06-12 03:30:37 +08:00
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
2014-04-29 15:58:09 +08:00
|
|
|
DebugLoc DL) const override;
|
2009-05-03 21:15:22 +08:00
|
|
|
|
2009-05-03 20:57:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|