22#define GET_INSTRINFO_CTOR_DTOR
23#include "MSP430GenInstrInfo.inc"
26void MSP430InstrInfo::anchor() {}
38 if (
MI !=
MBB.end())
DL =
MI->getDebugLoc();
47 if (RC == &MSP430::GR16RegClass)
51 else if (RC == &MSP430::GR8RegClass)
64 if (
MI !=
MBB.end())
DL =
MI->getDebugLoc();
73 if (RC == &MSP430::GR16RegClass)
77 else if (RC == &MSP430::GR8RegClass)
89 bool RenamableDest,
bool RenamableSrc)
const {
91 if (MSP430::GR16RegClass.
contains(DestReg, SrcReg))
92 Opc = MSP430::MOV16rr;
93 else if (MSP430::GR8RegClass.
contains(DestReg, SrcReg))
103 int *BytesRemoved)
const {
104 assert(!BytesRemoved &&
"code size not handled");
109 while (
I !=
MBB.begin()) {
111 if (
I->isDebugInstr())
113 if (
I->getOpcode() != MSP430::JMP &&
114 I->getOpcode() != MSP430::JCC &&
115 I->getOpcode() != MSP430::Bi &&
116 I->getOpcode() != MSP430::Br &&
117 I->getOpcode() != MSP430::Bm)
120 I->eraseFromParent();
130 assert(
Cond.size() == 1 &&
"Invalid Xbranch condition!");
164 bool AllowModify)
const {
168 while (
I !=
MBB.begin()) {
170 if (
I->isDebugInstr())
175 if (!isUnpredicatedTerminator(*
I))
184 if (
I->getOpcode() == MSP430::Br ||
185 I->getOpcode() == MSP430::Bm)
189 if (
I->getOpcode() == MSP430::JMP ||
I->getOpcode() == MSP430::Bi) {
191 TBB =
I->getOperand(0).getMBB();
196 MBB.erase(std::next(
I),
MBB.end());
201 if (
MBB.isLayoutSuccessor(
I->getOperand(0).getMBB())) {
203 I->eraseFromParent();
209 TBB =
I->getOperand(0).getMBB();
214 assert(
I->getOpcode() == MSP430::JCC &&
"Invalid conditional branch");
223 TBB =
I->getOperand(0).getMBB();
235 if (
TBB !=
I->getOperand(0).getMBB())
240 if (OldBranchCode == BranchCode)
254 int *BytesAdded)
const {
256 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
258 "MSP430 branch conditions have one component!");
259 assert(!BytesAdded &&
"code size not handled");
263 assert(!FBB &&
"Unconditional branch with multiple successors!");
287 switch (
Desc.getOpcode()) {
288 case TargetOpcode::CFI_INSTRUCTION:
289 case TargetOpcode::EH_LABEL:
290 case TargetOpcode::IMPLICIT_DEF:
291 case TargetOpcode::KILL:
292 case TargetOpcode::DBG_VALUE:
294 case TargetOpcode::INLINEASM:
295 case TargetOpcode::INLINEASM_BR: {
298 return TII.getInlineAsmLength(
MI.getOperand(0).getSymbolName(),
303 return Desc.getSize();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Describe properties that are true of each instruction in the target description file.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIdx, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
MSP430InstrInfo(const MSP430Subtarget &STI)
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
MachineInstrBundleIterator< MachineInstr > iterator
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
Representation of each machine instruction.
A description of a memory reference used in the backend.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
static MachineOperand CreateImm(int64_t Val)
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
TargetInstrInfo - Interface to description of machine instruction set.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetInstrInfo * getInstrInfo() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
FunctionAddr VTableAddr Count
unsigned getDefRegState(bool B)
unsigned getKillRegState(bool B)
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.