LLVM 20.0.0git
XtensaInstrInfo.h
Go to the documentation of this file.
1//===-- XtensaInstrInfo.h - Xtensa Instruction Information ------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6// See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9//===----------------------------------------------------------------------===//
10//
11// This file contains the Xtensa implementation of the TargetInstrInfo class.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_XTENSA_XTENSAINSTRINFO_H
16#define LLVM_LIB_TARGET_XTENSA_XTENSAINSTRINFO_H
17
18#include "Xtensa.h"
19#include "XtensaRegisterInfo.h"
22
23#define GET_INSTRINFO_HEADER
24
25#include "XtensaGenInstrInfo.inc"
26
27namespace llvm {
28
29class XtensaTargetMachine;
30class XtensaSubtarget;
32 const XtensaRegisterInfo RI;
33 const XtensaSubtarget &STI;
34
35public:
37
38 void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB,
40
41 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
42
43 // Return the XtensaRegisterInfo, which this class owns.
44 const XtensaRegisterInfo &getRegisterInfo() const { return RI; }
45
47 int &FrameIndex) const override;
48
50 int &FrameIndex) const override;
51
53 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
54 bool KillSrc, bool RenamableDest = false,
55 bool RenamableSrc = false) const override;
56
59 bool isKill, int FrameIndex, const TargetRegisterClass *RC,
60 const TargetRegisterInfo *TRI, Register VReg,
61 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
62
65 Register DestReg, int FrameIdx, const TargetRegisterClass *RC,
66 const TargetRegisterInfo *TRI, Register VReg,
67 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
68
69 // Get the load and store opcodes for a given register class and offset.
70 void getLoadStoreOpcodes(const TargetRegisterClass *RC, unsigned &LoadOpcode,
71 unsigned &StoreOpcode, int64_t offset) const;
72
73 // Emit code before MBBI in MI to move immediate value Value into
74 // physical register Reg.
76 unsigned *Reg, int64_t Value) const;
77
78 bool
80
82
83 bool isBranchOffsetInRange(unsigned BranchOpc,
84 int64_t BrOffset) const override;
85
89 bool AllowModify) const override;
90
92 int *BytesRemoved = nullptr) const override;
93
96 const DebugLoc &DL,
97 int *BytesAdded = nullptr) const override;
98
100 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
101 int64_t BrOffset = 0,
102 RegScavenger *RS = nullptr) const override;
103
108 int *BytesAdded) const;
109
111 int64_t offset,
113 int *BytesAdded) const;
114
115 // Return true if MI is a conditional or unconditional branch.
116 // When returning true, set Cond to the mask of condition-code
117 // values on which the instruction will branch, and set Target
118 // to the operand that contains the branch target. This target
119 // can be a register or a basic block.
122 const MachineOperand *&Target) const;
123
124 const XtensaSubtarget &getSubtarget() const { return STI; }
125};
126} // end namespace llvm
127
128#endif /* LLVM_LIB_TARGET_XTENSA_XTENSAINSTRINFO_H */
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
unsigned Reg
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
A debug info location.
Definition: DebugLoc.h:33
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Representation of each machine instruction.
Definition: MachineInstr.h:70
MachineOperand class - Representation of each machine instruction operand.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:74
const XtensaSubtarget & getSubtarget() const
bool isBranch(const MachineBasicBlock::iterator &MI, SmallVectorImpl< MachineOperand > &Cond, const MachineOperand *&Target) const
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIdx, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
void loadImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned *Reg, int64_t Value) const
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &DestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset=0, RegScavenger *RS=nullptr) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
const XtensaRegisterInfo & getRegisterInfo() const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
unsigned insertConstBranchAtInst(MachineBasicBlock &MBB, MachineInstr *I, int64_t offset, ArrayRef< MachineOperand > Cond, DebugLoc DL, int *BytesAdded) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
Adjust SP by Amount bytes.
unsigned insertBranchAtInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, MachineBasicBlock *TBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded) const
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
void getLoadStoreOpcodes(const TargetRegisterClass *RC, unsigned &LoadOpcode, unsigned &StoreOpcode, int64_t offset) const
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18