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