Path: blob/main/contrib/llvm-project/llvm/lib/Target/ARM/ARMFeatures.h
35294 views
//===-- ARMFeatures.h - Checks for ARM instruction features -----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file contains the code shared between ARM CodeGen and ARM MC9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_ARM_ARMFEATURES_H13#define LLVM_LIB_TARGET_ARM_ARMFEATURES_H1415#include "MCTargetDesc/ARMMCTargetDesc.h"1617namespace llvm {1819template<typename InstrType> // could be MachineInstr or MCInst20bool IsCPSRDead(const InstrType *Instr);2122template<typename InstrType> // could be MachineInstr or MCInst23inline bool isV8EligibleForIT(const InstrType *Instr) {24switch (Instr->getOpcode()) {25default:26return false;27case ARM::tADC:28case ARM::tADDi3:29case ARM::tADDi8:30case ARM::tADDrr:31case ARM::tAND:32case ARM::tASRri:33case ARM::tASRrr:34case ARM::tBIC:35case ARM::tEOR:36case ARM::tLSLri:37case ARM::tLSLrr:38case ARM::tLSRri:39case ARM::tLSRrr:40case ARM::tMOVi8:41case ARM::tMUL:42case ARM::tMVN:43case ARM::tORR:44case ARM::tROR:45case ARM::tRSB:46case ARM::tSBC:47case ARM::tSUBi3:48case ARM::tSUBi8:49case ARM::tSUBrr:50// Outside of an IT block, these set CPSR.51return IsCPSRDead(Instr);52case ARM::tADDrSPi:53case ARM::tCMNz:54case ARM::tCMPi8:55case ARM::tCMPr:56case ARM::tLDRBi:57case ARM::tLDRBr:58case ARM::tLDRHi:59case ARM::tLDRHr:60case ARM::tLDRSB:61case ARM::tLDRSH:62case ARM::tLDRi:63case ARM::tLDRr:64case ARM::tLDRspi:65case ARM::tSTRBi:66case ARM::tSTRBr:67case ARM::tSTRHi:68case ARM::tSTRHr:69case ARM::tSTRi:70case ARM::tSTRr:71case ARM::tSTRspi:72case ARM::tTST:73return true;74// there are some "conditionally deprecated" opcodes75case ARM::tADDspr:76case ARM::tBLXr:77case ARM::tBLXr_noip:78return Instr->getOperand(2).getReg() != ARM::PC;79// ADD PC, SP and BLX PC were always unpredictable,80// now on top of it they're deprecated81case ARM::tADDrSP:82case ARM::tBX:83return Instr->getOperand(0).getReg() != ARM::PC;84case ARM::tADDhirr:85return Instr->getOperand(0).getReg() != ARM::PC &&86Instr->getOperand(2).getReg() != ARM::PC;87case ARM::tCMPhir:88case ARM::tMOVr:89return Instr->getOperand(0).getReg() != ARM::PC &&90Instr->getOperand(1).getReg() != ARM::PC;91}92}9394}9596#endif979899