1 //===-- ARMFeatures.h - Checks for ARM instruction features -----*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file contains the code shared between ARM CodeGen and ARM MC
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_ARM_ARMFEATURES_H
14 #define LLVM_LIB_TARGET_ARM_ARMFEATURES_H
16 #include "MCTargetDesc/ARMMCTargetDesc.h"
20 template<typename InstrType
> // could be MachineInstr or MCInst
21 bool IsCPSRDead(const InstrType
*Instr
);
23 template<typename InstrType
> // could be MachineInstr or MCInst
24 inline bool isV8EligibleForIT(const InstrType
*Instr
) {
25 switch (Instr
->getOpcode()) {
51 // Outside of an IT block, these set CPSR.
52 return IsCPSRDead(Instr
);
75 // there are some "conditionally deprecated" opcodes
79 return Instr
->getOperand(2).getReg() != ARM::PC
;
80 // ADD PC, SP and BLX PC were always unpredictable,
81 // now on top of it they're deprecated
84 return Instr
->getOperand(0).getReg() != ARM::PC
;
86 return Instr
->getOperand(0).getReg() != ARM::PC
&&
87 Instr
->getOperand(2).getReg() != ARM::PC
;
90 return Instr
->getOperand(0).getReg() != ARM::PC
&&
91 Instr
->getOperand(1).getReg() != ARM::PC
;