//===-- ARMBaseInfo.h - Top level definitions for ARM ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains small standalone helper functions and enum definitions for // the ARM target useful for the compiler back-end and the MC libraries. // As such, it deliberately does not include references to LLVM core // code gen types, passes, etc.. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H #define LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/TargetParser/SubtargetFeature.h" #include "MCTargetDesc/ARMMCTargetDesc.h" namespace llvm { // Enums corresponding to ARM condition codes namespace ARMCC { // The CondCodes constants map directly to the 4-bit encoding of the // condition field for predicated instructions. enum CondCodes { … }; inline static CondCodes getOppositeCondition(CondCodes CC) { … } /// getSwappedCondition - assume the flags are set by MI(a,b), return /// the condition code if we modify the instructions such that flags are /// set by MI(b,a). inline static ARMCC::CondCodes getSwappedCondition(ARMCC::CondCodes CC) { … } } // end namespace ARMCC namespace ARMVCC { enum VPTCodes { … }; } // namespace ARMVCC namespace ARM { /// Mask values for IT and VPT Blocks, to be used by MCOperands. /// Note that this is different from the "real" encoding used by the /// instructions. In this encoding, the lowest set bit indicates the end of /// the encoding, and above that, "1" indicates an else, while "0" indicates /// a then. /// Tx = x100 /// Txy = xy10 /// Txyz = xyz1 enum class PredBlockMask { … }; } // namespace ARM // Expands a PredBlockMask by adding an E or a T at the end, depending on Kind. // e.g ExpandPredBlockMask(T, Then) = TT, ExpandPredBlockMask(TT, Else) = TTE, // and so on. ARM::PredBlockMask expandPredBlockMask(ARM::PredBlockMask BlockMask, ARMVCC::VPTCodes Kind); inline static const char *ARMVPTPredToString(ARMVCC::VPTCodes CC) { … } inline static unsigned ARMVectorCondCodeFromString(StringRef CC) { … } inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { … } inline static unsigned ARMCondCodeFromString(StringRef CC) { … } // System Registers namespace ARMSysReg { struct MClassSysReg { … }; #define GET_MCLASSSYSREG_DECL #include "ARMGenSystemRegister.inc" // lookup system register using 12-bit SYSm value. // Note: the search is uniqued using M1 mask const MClassSysReg *lookupMClassSysRegBy12bitSYSmValue(unsigned SYSm); // returns APSR with _<bits> qualifier. // Note: ARMv7-M deprecates using MSR APSR without a _<bits> qualifier const MClassSysReg *lookupMClassSysRegAPSRNonDeprecated(unsigned SYSm); // lookup system registers using 8-bit SYSm value const MClassSysReg *lookupMClassSysRegBy8bitSYSmValue(unsigned SYSm); } // end namespace ARMSysReg // Banked Registers namespace ARMBankedReg { struct BankedReg { … }; #define GET_BANKEDREG_DECL #include "ARMGenSystemRegister.inc" } // end namespace ARMBankedReg } // end namespace llvm #endif // LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H