1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef MAPLEBE_INCLUDE_TARGET_MACHINE_H 16 #define MAPLEBE_INCLUDE_TARGET_MACHINE_H 17 #include "types_def.h" 18 19 namespace maplebe { 20 using namespace maple; 21 enum TargetKind : uint8 { 22 kAArch64, 23 kX8664, 24 kRiscV, 25 kArm32, 26 kArk 27 }; 28 29 class TargetMachine { 30 public: TargetMachine(TargetKind kind)31 TargetMachine(TargetKind kind) : kind(kind) {} isAArch64()32 bool isAArch64() 33 { 34 return kind == kAArch64; 35 } 36 isX8664()37 bool isX8664() 38 { 39 return kind == kX8664; 40 } 41 isRiscV()42 bool isRiscV() 43 { 44 return kind == kRiscV; 45 } 46 isArm32()47 bool isArm32() 48 { 49 return kind == kArm32; 50 } 51 isArk()52 bool isArk() 53 { 54 return kind == kArk; 55 } 56 57 private: 58 TargetKind kind; 59 }; 60 } /* namespace maplebe */ 61 62 #endif /* MAPLEBE_INCLUDE_TARGET_MACHINE_H */ 63