2012-02-18 20:03:15 +08:00
|
|
|
//===-- MSP430InstrInfo.h - MSP430 Instruction Information ------*- C++ -*-===//
|
2009-05-03 20:57:15 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08: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 20:57:15 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// 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"
|
2017-11-08 09:01:31 +08:00
|
|
|
#include "llvm/CodeGen/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
|
|
|
|
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
|
|
|
|
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: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
|
|
|
|
2016-07-29 16:16:16 +08:00
|
|
|
unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
|
2010-01-16 05:19:05 +08:00
|
|
|
|
2009-10-22 03:17:18 +08:00
|
|
|
// Branch folding goodness
|
2014-04-29 15:58:09 +08:00
|
|
|
bool
|
2016-09-15 04:43:16 +08:00
|
|
|
reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
|
2016-02-23 10:46:52 +08:00
|
|
|
bool isUnpredicatedTerminator(const MachineInstr &MI) const override;
|
2016-07-15 22:41:04 +08:00
|
|
|
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
2009-10-22 03:17:18 +08:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
2014-04-29 15:58:09 +08:00
|
|
|
bool AllowModify) const override;
|
2009-10-22 03:17:18 +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;
|
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;
|
2017-05-09 21:35:13 +08: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 20:57:15 +08:00
|
|
|
};
|
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2009-05-03 20:57:15 +08:00
|
|
|
|
|
|
|
#endif
|