1 //===- ARMInstrInfo.cpp - ARM Instruction Information -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the ARM implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "ARMInstrInfo.h"
16 #include "ARMAddressingModes.h"
17 #include "ARMGenInstrInfo.inc"
18 #include "ARMMachineFunctionInfo.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/CodeGen/LiveVariables.h"
21 #include "llvm/CodeGen/MachineFrameInfo.h"
22 #include "llvm/CodeGen/MachineInstrBuilder.h"
23 #include "llvm/CodeGen/MachineJumpTableInfo.h"
24 #include "llvm/MC/MCAsmInfo.h"
25 #include "llvm/Support/CommandLine.h"
28 ARMInstrInfo::ARMInstrInfo(const ARMSubtarget
&STI
)
29 : RI(*this, STI
), Subtarget(STI
) {
32 unsigned ARMInstrInfo::getUnindexedOpcode(unsigned Opc
) const {
64 bool ARMInstrInfo::BlockHasNoFallThrough(const MachineBasicBlock
&MBB
) const {
65 if (MBB
.empty()) return false;
67 switch (MBB
.back().getOpcode()) {
68 case ARM::BX_RET
: // Return.
71 case ARM::BR_JTr
: // Jumptable branch.
72 case ARM::BR_JTm
: // Jumptable branch through mem.
73 case ARM::BR_JTadd
: // Jumptable branch add to pc.
83 reMaterialize(MachineBasicBlock
&MBB
,
84 MachineBasicBlock::iterator I
,
85 unsigned DestReg
, unsigned SubIdx
,
86 const MachineInstr
*Orig
) const {
87 DebugLoc dl
= Orig
->getDebugLoc();
88 if (Orig
->getOpcode() == ARM::MOVi2pieces
) {
89 RI
.emitLoadConstPool(MBB
, I
, dl
,
91 Orig
->getOperand(1).getImm(),
92 (ARMCC::CondCodes
)Orig
->getOperand(2).getImm(),
93 Orig
->getOperand(3).getReg());
97 MachineInstr
*MI
= MBB
.getParent()->CloneMachineInstr(Orig
);
98 MI
->getOperand(0).setReg(DestReg
);