2012-02-18 12:03:15 +00:00
|
|
|
//===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//
|
2009-05-03 12:57:15 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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-05-03 12:57:15 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the MSP430 implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_MSP430_MSP430INSTRINFO_H
|
2009-05-03 12:57:15 +00:00
|
|
|
|
|
|
|
#include "MSP430RegisterInfo.h"
|
2017-11-08 01:01:31 +00:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
2009-05-03 12:57:15 +00:00
|
|
|
|
2011-07-01 17:57:27 +00:00
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "MSP430GenInstrInfo.inc"
|
|
|
|
|
2009-05-03 12:57:15 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2014-06-27 01:14:50 +00:00
|
|
|
class MSP430Subtarget;
|
2009-05-03 12:57:15 +00:00
|
|
|
|
2011-07-01 17:57:27 +00:00
|
|
|
class MSP430InstrInfo : public MSP430GenInstrInfo {
|
2009-05-03 12:57:15 +00:00
|
|
|
const MSP430RegisterInfo RI;
|
2013-11-19 00:57:56 +00:00
|
|
|
virtual void anchor();
|
2009-05-03 12:57:15 +00:00
|
|
|
public:
|
2014-06-27 01:14:50 +00:00
|
|
|
explicit MSP430InstrInfo(MSP430Subtarget &STI);
|
2009-05-03 12:57:15 +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:58:09 +00:00
|
|
|
const TargetRegisterInfo &getRegisterInfo() const { return RI; }
|
2009-05-03 13:02:04 +00:00
|
|
|
|
2016-06-12 15:39:02 +00:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
|
|
|
const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
|
2014-04-29 07:58:09 +00: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 13:11:04 +00:00
|
|
|
|
2016-07-29 08:16:16 +00:00
|
|
|
unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
|
2010-01-15 21:19:05 +00:00
|
|
|
|
2009-10-21 19:17:18 +00:00
|
|
|
// Branch folding goodness
|
2014-04-29 07:58:09 +00:00
|
|
|
bool
|
2016-09-14 20:43:16 +00:00
|
|
|
reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
|
2016-02-23 02:46:52 +00:00
|
|
|
bool isUnpredicatedTerminator(const MachineInstr &MI) const override;
|
2016-07-15 14:41:04 +00:00
|
|
|
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
2009-10-21 19:17:18 +00:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
2014-04-29 07:58:09 +00:00
|
|
|
bool AllowModify) const override;
|
2009-10-21 19:17:18 +00:00
|
|
|
|
2016-09-14 20:43:16 +00:00
|
|
|
unsigned removeBranch(MachineBasicBlock &MBB,
|
2016-09-14 17:23:48 +00:00
|
|
|
int *BytesRemoved = nullptr) const override;
|
2016-09-14 17:24:15 +00:00
|
|
|
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2015-06-11 19:30:37 +00:00
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
2016-09-14 17:23:48 +00:00
|
|
|
const DebugLoc &DL,
|
|
|
|
int *BytesAdded = nullptr) const override;
|
2017-05-09 13:35:13 +00:00
|
|
|
|
|
|
|
int64_t getFramePoppedByCallee(const MachineInstr &I) const {
|
|
|
|
assert(isFrameInstr(I) && "Not a frame instruction");
|
|
|
|
assert(I.getOperand(1).getImm() >= 0 && "Size must not be negative");
|
|
|
|
return I.getOperand(1).getImm();
|
|
|
|
}
|
2009-05-03 12:57:15 +00:00
|
|
|
};
|
|
|
|
|
2015-06-23 09:49:53 +00:00
|
|
|
}
|
2009-05-03 12:57:15 +00:00
|
|
|
|
|
|
|
#endif
|