Javed Absar | 2cb0c95 | 2017-07-19 12:57:16 +0000 | [diff] [blame^] | 1 | //===-- ARMBaseInfo.h - Top level definitions for ARM ---*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains small standalone helper functions and enum definitions for |
| 11 | // the ARM target useful for the compiler back-end and the MC libraries. |
| 12 | // As such, it deliberately does not include references to LLVM core |
| 13 | // code gen types, passes, etc.. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #ifndef LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H |
| 18 | #define LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H |
| 19 | |
| 20 | #include "llvm/ADT/StringSwitch.h" |
| 21 | #include "llvm/Support/ErrorHandling.h" |
| 22 | #include "llvm/MC/SubtargetFeature.h" |
| 23 | #include "MCTargetDesc/ARMMCTargetDesc.h" |
| 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | namespace ARMSysReg { |
| 28 | struct MClassSysReg { |
| 29 | const char *Name; |
| 30 | uint16_t M1Encoding12; |
| 31 | uint16_t M2M3Encoding8; |
| 32 | uint16_t Encoding; |
| 33 | FeatureBitset FeaturesRequired; |
| 34 | |
| 35 | // return true if FeaturesRequired are all present in ActiveFeatures |
| 36 | bool hasRequiredFeatures(FeatureBitset ActiveFeatures) const { |
| 37 | return (FeaturesRequired & ActiveFeatures) == FeaturesRequired; |
| 38 | } |
| 39 | |
| 40 | // returns true if TestFeatures are all present in FeaturesRequired |
| 41 | bool isInRequiredFeatures(FeatureBitset TestFeatures) const { |
| 42 | return (FeaturesRequired & TestFeatures) == TestFeatures; |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | #define GET_MCLASSSYSREG_DECL |
| 47 | #include "ARMGenSystemRegister.inc" |
| 48 | |
| 49 | // lookup system register using 12-bit SYSm value. |
| 50 | // Note: the search is uniqued using M1 mask |
| 51 | const MClassSysReg *lookupMClassSysRegBy12bitSYSmValue(unsigned SYSm); |
| 52 | |
| 53 | // returns APSR with _<bits> qualifier. |
| 54 | // Note: ARMv7-M deprecates using MSR APSR without a _<bits> qualifier |
| 55 | const MClassSysReg *lookupMClassSysRegAPSRNonDeprecated(unsigned SYSm); |
| 56 | |
| 57 | // lookup system registers using 8-bit SYSm value |
| 58 | const MClassSysReg *lookupMClassSysRegBy8bitSYSmValue(unsigned SYSm); |
| 59 | |
| 60 | } // end namespace ARMSysReg |
| 61 | |
| 62 | } // end namespace llvm |
| 63 | |
| 64 | #endif // LLVM_LIB_TARGET_ARM_UTILS_ARMBASEINFO_H |