2017-10-20 05:37:38 +08:00
|
|
|
//===-- RISCVInstrInfo.h - RISCV Instruction Information --------*- C++ -*-===//
|
|
|
|
//
|
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
|
2017-10-20 05:37:38 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the RISCV implementation of the TargetInstrInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_RISCV_RISCVINSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_RISCV_RISCVINSTRINFO_H
|
|
|
|
|
|
|
|
#include "RISCVRegisterInfo.h"
|
2017-11-08 09:01:31 +08:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
2017-10-20 05:37:38 +08:00
|
|
|
|
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "RISCVGenInstrInfo.inc"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class RISCVInstrInfo : public RISCVGenInstrInfo {
|
|
|
|
|
|
|
|
public:
|
|
|
|
RISCVInstrInfo();
|
2017-11-08 20:20:01 +08:00
|
|
|
|
2018-04-26 23:34:27 +08:00
|
|
|
unsigned isLoadFromStackSlot(const MachineInstr &MI,
|
|
|
|
int &FrameIndex) const override;
|
|
|
|
unsigned isStoreToStackSlot(const MachineInstr &MI,
|
|
|
|
int &FrameIndex) const override;
|
|
|
|
|
2017-11-08 20:20:01 +08:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
|
|
|
const DebugLoc &DL, unsigned DstReg, unsigned SrcReg,
|
|
|
|
bool KillSrc) const override;
|
2017-11-08 21:31:40 +08:00
|
|
|
|
|
|
|
void storeRegToStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI, unsigned SrcReg,
|
|
|
|
bool IsKill, int FrameIndex,
|
|
|
|
const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
|
|
|
|
|
|
|
void loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI, unsigned DstReg,
|
|
|
|
int FrameIndex, const TargetRegisterClass *RC,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2018-01-11 03:53:46 +08:00
|
|
|
|
|
|
|
// Materializes the given int32 Val into DstReg.
|
|
|
|
void movImm32(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
|
|
|
const DebugLoc &DL, unsigned DstReg, uint64_t Val,
|
|
|
|
MachineInstr::MIFlag Flag = MachineInstr::NoFlags) const;
|
2018-01-11 04:47:00 +08:00
|
|
|
|
2018-01-11 05:05:07 +08:00
|
|
|
unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
|
|
|
|
|
2018-01-11 04:47:00 +08:00
|
|
|
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const override;
|
|
|
|
|
|
|
|
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
|
|
|
const DebugLoc &dl,
|
|
|
|
int *BytesAdded = nullptr) const override;
|
|
|
|
|
2018-01-11 05:05:07 +08:00
|
|
|
unsigned insertIndirectBranch(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock &NewDestBB,
|
|
|
|
const DebugLoc &DL, int64_t BrOffset,
|
|
|
|
RegScavenger *RS = nullptr) const override;
|
|
|
|
|
2018-01-11 04:47:00 +08:00
|
|
|
unsigned removeBranch(MachineBasicBlock &MBB,
|
|
|
|
int *BytesRemoved = nullptr) const override;
|
|
|
|
|
|
|
|
bool
|
|
|
|
reverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
|
2018-01-11 05:05:07 +08:00
|
|
|
|
|
|
|
MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
|
|
|
|
|
|
|
|
bool isBranchOffsetInRange(unsigned BranchOpc,
|
|
|
|
int64_t BrOffset) const override;
|
2019-01-26 04:22:49 +08:00
|
|
|
|
|
|
|
bool isAsCheapAsAMove(const MachineInstr &MI) const override;
|
2017-10-20 05:37:38 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|