1 /* 2 * Copyright (c) 2024-2025 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 16 #ifndef ABCKIT_INST_BUILDER_H 17 #define ABCKIT_INST_BUILDER_H 18 19 namespace ark::compiler { 20 21 class Graph; 22 23 class AbcKitInstBuilder : public InstBuilder { 24 public: AbcKitInstBuilder(Graph * graph,RuntimeInterface::MethodPtr method,CallInst * callerInst,uint32_t inliningDepth)25 AbcKitInstBuilder(Graph *graph, RuntimeInterface::MethodPtr method, CallInst *callerInst, uint32_t inliningDepth) 26 : InstBuilder(graph, method, callerInst, inliningDepth) 27 { 28 } 29 30 NO_COPY_SEMANTIC(AbcKitInstBuilder); 31 NO_MOVE_SEMANTIC(AbcKitInstBuilder); 32 33 template <bool IS_ACC_WRITE> 34 void AbcKitBuildLoadObject(const BytecodeInstruction *bcInst, DataType::Type type); 35 template <bool IS_ACC_READ> 36 void AbcKitBuildStoreObject(const BytecodeInstruction *bcInst, DataType::Type type); 37 template <Opcode OPCODE> 38 void AbcKitBuildLoadFromPool(const BytecodeInstruction *bcInst); 39 void BuildDefaultAbcKitIntrinsic(const BytecodeInstruction *bcInst, RuntimeInterface::IntrinsicId intrinsicId); 40 41 private: 42 void BuildIsNullValue(const BytecodeInstruction *bcInst) override; 43 void BuildLoadStatic(const BytecodeInstruction *bcInst, DataType::Type type) override; 44 void BuildStoreStatic(const BytecodeInstruction *bcInst, DataType::Type type) override; 45 void BuildLoadArray(const BytecodeInstruction *bcInst, DataType::Type type) override; 46 void BuildLoadConstArray(const BytecodeInstruction *bcInst) override; 47 void BuildStoreArray(const BytecodeInstruction *bcInst, DataType::Type type) override; 48 void BuildNewArray(const BytecodeInstruction *bcInst) override; 49 void BuildNewObject(const BytecodeInstruction *bcInst) override; 50 void BuildInitObject(const BytecodeInstruction *bcInst, bool isRange) override; 51 void BuildCheckCast(const BytecodeInstruction *bcInst) override; 52 void BuildIsInstance(const BytecodeInstruction *bcInst) override; 53 void BuildThrow(const BytecodeInstruction *bcInst) override; 54 void BuildAbcKitInitObjectIntrinsic(const BytecodeInstruction *bcInst, bool isRange = false); 55 template <bool IS_ACC_WRITE> 56 void BuildAbcKitLoadObjectIntrinsic(const BytecodeInstruction *bcInst, DataType::Type rawType); 57 template <bool IS_ACC_READ> 58 void BuildAbcKitStoreObjectIntrinsic(const BytecodeInstruction *bcInst, DataType::Type rawType); 59 void BuildAbcKitLoadStaticIntrinsic(const BytecodeInstruction *bcInst, DataType::Type rawType); 60 void BuildAbcKitStoreStaticIntrinsic(const BytecodeInstruction *bcInst, DataType::Type rawType); 61 void BuildAbcKitLoadArrayIntrinsic(const BytecodeInstruction *bcInst, DataType::Type type); 62 void BuildAbcKitStoreArrayIntrinsic(const BytecodeInstruction *bcInst, DataType::Type type); 63 }; 64 65 }; // namespace ark::compiler 66 67 #endif // ABCKIT_INST_BUILDER_H 68