//===- ARMBaseInstrInfo.cpp - ARM Instruction Information -------*- C++ -*-===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file contains the Base ARM implementation of the TargetInstrInfo class.////===----------------------------------------------------------------------===//#include"ARMBaseInstrInfo.h"#include"ARM.h"#include"ARMAddressingModes.h"#include"ARMConstantPoolValue.h"#include"ARMGenInstrInfo.inc"#include"ARMMachineFunctionInfo.h"#include"ARMRegisterInfo.h"#include"llvm/Constants.h"#include"llvm/Function.h"#include"llvm/GlobalValue.h"#include"llvm/ADT/STLExtras.h"#include"llvm/CodeGen/LiveVariables.h"#include"llvm/CodeGen/MachineConstantPool.h"#include"llvm/CodeGen/MachineFrameInfo.h"#include"llvm/CodeGen/MachineInstrBuilder.h"#include"llvm/CodeGen/MachineJumpTableInfo.h"#include"llvm/CodeGen/MachineMemOperand.h"#include"llvm/CodeGen/PseudoSourceValue.h"#include"llvm/MC/MCAsmInfo.h"#include"llvm/Support/CommandLine.h"#include"llvm/Support/Debug.h"#include"llvm/Support/ErrorHandling.h"usingnamespacellvm;staticcl::opt<bool>EnableARM3Addr("enable-arm-3-addr-conv",cl::Hidden,cl::desc("Enable ARM 2-addr to 3-addr conv"));ARMBaseInstrInfo::ARMBaseInstrInfo(constARMSubtarget&STI):TargetInstrInfoImpl(ARMInsts,array_lengthof(ARMInsts)),Subtarget(STI){}MachineInstr*ARMBaseInstrInfo::convertToThreeAddress(MachineFunction::iterator&MFI,MachineBasicBlock::iterator&MBBI,LiveVariables*LV)const{// FIXME: Thumb2 support.if(!EnableARM3Addr)returnNULL;MachineInstr*MI=MBBI;MachineFunction&MF=*MI->getParent()->getParent();unsignedTSFlags=MI->getDesc().TSFlags;boolisPre=false;switch((TSFlags&ARMII::IndexModeMask)>>ARMII::IndexModeShift){default:returnNULL;caseARMII::IndexModePre:isPre=true;break;caseARMII::IndexModePost:break;}// Try splitting an indexed load/store to an un-indexed one plus an add/sub// operation.unsignedMemOpc=getUnindexedOpcode(MI->getOpcode());if(MemOpc==0)returnNULL;MachineInstr*UpdateMI=NULL;MachineInstr*MemMI=NULL;unsignedAddrMode=(TSFlags&ARMII::AddrModeMask);constTargetInstrDesc&TID=MI->getDesc();unsignedNumOps=TID.getNumOperands();boolisLoad=!TID.mayStore();constMachineOperand&WB=isLoad?MI->getOperand(1):