| /arkcompiler/runtime_core/static_core/compiler/optimizer/code_generator/ |
| D | encode_visitor.h | 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 31 explicit EncodeVisitor(Codegen *cg) : cg_(cg), arch_(cg->GetArch()) {} in EncodeVisitor() 37 return cg_->GetGraph()->GetBlocksRPO(); in GetBlocksToVisit() 45 return cg_->GetEncoder(); in GetEncoder() 53 return cg_->GetCallingConvention(); in GetCallingConvention() 58 return cg_->GetRegfile(); in GetRegfile() 63 return success_ && cg_->GetEncoder()->GetResult(); in GetResult() 69 …// Checks if two spill-fill operations could be coalesced into single operation over pair of argum… 75 static void VisitMov(GraphVisitor *visitor, Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/optimizations/ |
| D | peepholes.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 29 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 30 #define PEEPHOLE_IS_APPLIED(visitor, inst) (visitor)->SetIsApplied((inst), true, __FILE__, __LINE__) argument 32 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 64 return GetGraph()->GetBlocksRPO(); in GetBlocksToVisit() 68 static void VisitSafePoint([[maybe_unused]] GraphVisitor *v, Inst *inst); 69 static void VisitNeg([[maybe_unused]] GraphVisitor *v, Inst *inst); 70 static void VisitAbs([[maybe_unused]] GraphVisitor *v, Inst *inst); 71 static void VisitNot([[maybe_unused]] GraphVisitor *v, Inst *inst); [all …]
|
| D | string_builder_utils.h | 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 23 #include "optimizer/ir/inst.h" 28 bool IsStringBuilderInstance(Inst *inst); 29 bool IsMethodStringConcat(const Inst *inst); 30 bool IsMethodStringBuilderConstructorWithStringArg(const Inst *inst); 31 bool IsMethodStringBuilderConstructorWithCharArrayArg(const Inst *inst); 32 bool IsStringBuilderToString(const Inst *inst); 33 bool IsMethodStringBuilderDefaultConstructor(const Inst *inst); 35 bool IsStringBuilderCtorCall(const Inst *inst, const Inst *self = nullptr); [all …]
|
| D | memory_barriers.cpp | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 30 for (auto inst : barriersInsts_) { in MergeBarriers() local 31 inst->ClearFlag(inst_flags::MEM_BARRIER); in MergeBarriers() 33 lastBarrierInst->SetFlag(inst_flags::MEM_BARRIER); in MergeBarriers() 37 bool OptimizeMemoryBarriers::CheckInst(Inst *inst) in CheckInst() argument 39 return (std::find(barriersInsts_.begin(), barriersInsts_.end(), inst) != barriersInsts_.end()); in CheckInst() 42 void OptimizeMemoryBarriers::CheckAllInputs(Inst *inst) in CheckAllInputs() argument 44 for (auto input : inst->GetInputs()) { in CheckAllInputs() 52 void OptimizeMemoryBarriers::CheckInput(Inst *input) in CheckInput() [all …]
|
| D | checks_elimination.h | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 33 using GroupedBoundsChecks = ArenaVector<std::tuple<Inst *, InstVector, int64_t, int64_t>>; 34 // loop->len_array->GroupedBoundsChecks 35 using LoopNotFullyRedundantBoundsCheck = ArenaVector<std::pair<Inst *, GroupedBoundsChecks>>; 38 using InstPair = std::pair<Inst *, Inst *>; 39 using InstTriple = std::tuple<Inst *, Inst *, Inst *>; 41 …o; savestate; lower value; upper value; cond code for Deoptimize; head is loop exit; has pre-header 43 using LoopInfo = std::tuple<CountableLoopInfo, Inst *, Inst *, Inst *, ConditionCode, bool, bool>; 45 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) [all …]
|
| D | cleanup.h | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 27 empty1_(graph->GetLocalAllocator()->Adapter()), in Optimization() 28 empty2_(graph->GetLocalAllocator()->Adapter()), in Optimization() 29 savedPreds_(graph->GetLocalAllocator()->Adapter()), in Optimization() 30 dead_(graph->GetLocalAllocator()->Adapter()), in Optimization() 31 temp_(graph->GetLocalAllocator()->Adapter()), in Optimization() 32 ancestors_(graph->GetLocalAllocator()->Adapter()), in Optimization() 33 buckets_(graph->GetLocalAllocator()->Adapter()), in Optimization() 34 idoms_(graph->GetLocalAllocator()->Adapter()), in Optimization() [all …]
|
| D | memory_barriers.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 30 : Optimization(graph), barriersInsts_(graph->GetLocalAllocator()->Adapter()) in OptimizeMemoryBarriers() 51 return GetGraph()->GetBlocksRPO(); in GetBlocksToVisit() 62 void VisitDefault([[maybe_unused]] Inst *inst) override in VisitDefault() argument 64 ASSERT_DO(!inst->IsCall() && !inst->IsStore(), in VisitDefault() 65 … (std::cerr << "need to make a visitor for the instruction: " << *inst << std::endl)); in VisitDefault() 68 void CheckAllInputs(Inst *inst); 69 void CheckInput(Inst *input); [all …]
|
| D | const_folding.h | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 21 bool ConstFoldingCast(Inst *inst); 22 bool ConstFoldingNeg(Inst *inst); 23 bool ConstFoldingAbs(Inst *inst); 24 bool ConstFoldingNot(Inst *inst); 25 bool ConstFoldingAdd(Inst *inst); 26 bool ConstFoldingSub(Inst *inst); 27 bool ConstFoldingMul(Inst *inst); 28 bool ConstFoldingBinaryMathWithNan(Inst *inst); [all …]
|
| D | lowering.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 52 * Utility template classes aimed to simplify pattern matching over IR-graph. 54 * Then IR-subtree could be tested for matching by calling static Capture method. 58 …* For example, suppose that we want to test if IR-subtree rooted by some Inst matches add or sub i… 61 * Inst* inst = ...; 65 * bool is_add_or_sub = Predicate::Capture(inst, capture); 67 * If inst is a binary instruction with opcode Add or Sub then Capture will return `true`, 68 … * capture.Get(0) will return left inst's input and capture.Get(1) will return right inst's input. [all …]
|
| D | string_builder_utils.cpp | 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 20 bool IsStringBuilderInstance(Inst *inst) in IsStringBuilderInstance() argument 22 if (inst->GetOpcode() != Opcode::NewObject) { in IsStringBuilderInstance() 26 auto klass = GetObjectClass(inst->CastToNewObject()); in IsStringBuilderInstance() 31 auto runtime = inst->GetBasicBlock()->GetGraph()->GetRuntime(); in IsStringBuilderInstance() 32 return runtime->IsClassStringBuilder(klass); in IsStringBuilderInstance() 35 bool IsMethodStringConcat(const Inst *inst) in IsMethodStringConcat() argument 37 if (inst->GetOpcode() != Opcode::CallStatic && inst->GetOpcode() != Opcode::CallVirtual) { in IsMethodStringConcat() 41 auto call = static_cast<const CallInst *>(inst); in IsMethodStringConcat() [all …]
|
| D | escape.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 49 using StateOwner = std::variant<Inst *, PhiState *, const ZeroInst *>; 50 using MaterializationSite = std::variant<Inst *, BasicBlock *>; 54 ClassPtr klass; // NOLINT(misc-non-private-member-variables-in-classes) 55 uint64_t index; // NOLINT(misc-non-private-member-variables-in-classes) 81 // NOLINTNEXTLINE(readability-magic-numbers) in GetUniqVal() 86 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 95 blockStates_(graph->GetLocalAllocator()->Adapter()), in EscapeAnalysis() 96 aliases_(graph->GetLocalAllocator()->Adapter()), in EscapeAnalysis() [all …]
|
| D | locations_builder.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 25 template <Arch ARCH> // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 52 static Location GetLocationForReturn(Inst *inst); 54 static void VisitResolveStatic(GraphVisitor *visitor, Inst *inst); 55 static void VisitCallResolvedStatic(GraphVisitor *visitor, Inst *inst); 56 static void VisitCallStatic(GraphVisitor *visitor, Inst *inst); 57 static void VisitCallVirtual(GraphVisitor *visitor, Inst *inst); 58 static void VisitResolveVirtual(GraphVisitor *visitor, Inst *inst); 59 static void VisitCallResolvedVirtual(GraphVisitor *visitor, Inst *inst); [all …]
|
| D | vn.cpp | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 inline bool IsNotCommutativeInst(Inst *inst) in IsNotCommutativeInst() argument 28 return !inst->IsCommutative() || DataType::IsFloatType(inst->GetType()); in IsNotCommutativeInst() 31 inline bool IsAddressArithmeticInst(Inst *inst) in IsAddressArithmeticInst() argument 33 return inst->GetType() == DataType::POINTER && in IsAddressArithmeticInst() 34 (inst->GetOpcode() == Opcode::AddI || inst->GetOpcode() == Opcode::SubI); in IsAddressArithmeticInst() 37 static bool AddClassInst(Inst *inst, VnObject *obj) in AddClassInst() argument 39 if (inst->GetOpcode() != Opcode::LoadAndInitClass && inst->GetOpcode() != Opcode::InitClass && in AddClassInst() 40 inst->GetOpcode() != Opcode::LoadClass) { in AddClassInst() [all …]
|
| D | lower_boxed_boolean.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 25 #include "optimizer/ir/inst.h" 34 visitedMarker_ = GetGraph()->NewMarker(); in RunImpl() 37 GetGraph()->EraseMarker(visitedMarker_); in RunImpl() 43 void LowerBoxedBoolean::VisitCompare(GraphVisitor *v, Inst *inst) in VisitCompare() argument 45 COMPILER_LOG(DEBUG, LOWER_BOXED_BOOLEAN) << "Start visit Compare with id = " << inst->GetId(); in VisitCompare() 47 auto input = inst->GetInput(0).GetInst(); in VisitCompare() 49 if (!IsCompareWithNullPtr(inst)) { in VisitCompare() 55 if (!visitor->HasReplacement(input)) { in VisitCompare() 60 << "Applied LowerBoxedBoolean optimization to Compare with id = " << inst->GetId(); in VisitCompare() [all …]
|
| D | lower_boxed_boolean.h | 7 * http://www.apache.org/licenses/LICENSE-2.0 23 #include "optimizer/ir/inst.h" 35 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 39 : Optimization(graph), instReplacements_(graph->GetLocalAllocator()->Adapter()) in LowerBoxedBoolean() 56 return GetGraph()->GetBlocksRPO(); in GetBlocksToVisit() 64 static void VisitCompare(GraphVisitor *v, Inst *inst); 65 static void VisitLoadObject(GraphVisitor *v, Inst *inst); 70 static void ProcessInput(GraphVisitor *v, Inst *inst); 71 static void ProcessLoadStatic(GraphVisitor *v, Inst *inst); 72 static void ProcessPhi(GraphVisitor *v, Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/libllvmbackend/ |
| D | ets_llvm_ir_constructor_h_gen.inl | 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 16 bool EmitArrayCopyTo(Inst *inst); 17 bool EmitStdStringSubstring(Inst *inst); 18 bool EmitStringBuilderAppendBool(Inst *inst); 19 bool EmitStringBuilderAppendChar(Inst *inst); 20 bool EmitStringBuilderAppendByte(Inst *inst); 21 bool EmitStringBuilderAppendShort(Inst *inst); 22 bool EmitStringBuilderAppendInt(Inst *inst); 23 bool EmitStringBuilderAppendLong(Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/libllvmbackend/lowering/ |
| D | llvm_ir_constructor.h | 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 21 #include "optimizer/ir/inst.h" 32 bool IsSafeCast(Inst *inst, unsigned int index); 33 bool TryEmitIntrinsic(Inst *inst, RuntimeInterface::IntrinsicId arkId); 37 bool EmitFastPath(Inst *inst, RuntimeInterface::EntrypointId eid, uint32_t numArgs); 38 bool EmitStringEquals(Inst *inst); 39 bool EmitStringBuilderBool(Inst *inst); 40 bool EmitStringBuilderChar(Inst *inst); 41 bool EmitStringBuilderString(Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/ir/ |
| D | graph_checker.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 31 // CC-OFFNXT(G.PRE.02) should be with define 32 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 54 GetGraph()->GetPassManager()->SetCheckMode(false); in ~GraphChecker() 82 void CheckUserOfInt32(BasicBlock *block, Inst *inst, User &user); 83 void CheckInstUsers(Inst *inst, [[maybe_unused]] BasicBlock *block); 84 void CheckPhiInputs(Inst *phiInst); 91 bool CheckInstHasInput(Inst *inst, Inst *input); 92 bool CheckInstHasUser(Inst *inst, Inst *user); [all …]
|
| D | analysis.h | 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 class Inst; variable 29 Inst *InstStoredValue(Inst *inst, Inst **secondValue); 30 Inst *InstStoredValue(Inst *inst); 32 template <typename T = Inst> 34 bool HasTryBlockBetween(Inst *dominateInst, Inst *inst); 35 bool IsSuitableForImplicitNullCheck(const Inst *inst); 36 bool IsInstNotNull(const Inst *inst); 37 bool CheckFcmpInputs(Inst *input0, Inst *input1); [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/optimizations/ |
| D | cleanup.h | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 27 empty1_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 28 empty2_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 29 saved_preds_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 30 dead_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 31 temp_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 32 ancestors_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 33 buckets_(graph->GetLocalAllocator()->Adapter()), in Cleanup() 34 idoms_(graph->GetLocalAllocator()->Adapter()), in Cleanup() [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/analysis/ |
| D | alias_visitor.h | 7 * http://www.apache.org/licenses/LICENSE-2.0 60 // Used for fields with offset not known in compile-time 125 Pointer(PointerType type, const Inst *base, const Inst *idx, uint64_t imm, const void *typePtr) in Pointer() 129 Pointer(const Inst *base, const PointerOffset &offset) : PointerOffset(offset), base_(base) {} in Pointer() 136 static Pointer CreateObject(const Inst *base) in CreateObject() 139 …ASSERT(base->IsReferenceOrAny() || base->GetBasicBlock()->GetGraph()->IsDynamicMethod() || base->I… in CreateObject() 140 base->GetType() == DataType::POINTER); in CreateObject() 154 … static Pointer CreateObjectField(const Inst *base, uint32_t typeId, const void *typePtr = nullptr) 160 static Pointer CreateArrayElement(const Inst *array, const Inst *idx, uint64_t imm = 0) 166 static Pointer CreateRawOffset(const Inst *obj, const Inst *idx, uint64_t imm = 0) [all …]
|
| D | alias_visitor.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 67 (*out) << "v" << base_->GetId(); in Dump() 76 (*out) << "v" << base_->GetId() << " #" << GetImm(); in Dump() 80 (*out) << "v" << base_->GetId() << "["; in Dump() 82 (*out) << "v" << idx_->GetId(); in Dump() 93 (*out) << "v" << base_->GetId() << "["; in Dump() 94 (*out) << "v" << idx_->GetId(); in Dump() 103 (*out) << "v" << base_->GetId() << " #?"; in Dump() 117 if (base_ == nullptr || base_->GetType() == DataType::POINTER) { in IsLocalCreatedAlias() 120 if (!base_->IsReferenceOrAny()) { in IsLocalCreatedAlias() [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/ir_builder/ |
| D | inst_templates.yaml | 1 # Copyright (c) 2021-2024 Huawei Device Co., Ltd. 6 # http://www.apache.org/licenses/LICENSE-2.0 15 binop: |- 17 % opc = inst.stripped_mnemonic.match regex_arithm 20 …auto inst = graph_->CreateInst<%= opc %>(<%= get_type(inst.dtype) %>, GetPc(instruction->GetAddres… 21 <%=template('operands', inst, '')-%> 22 AddInstruction(inst); 23 binop_z: |- 24 % opc = inst.stripped_mnemonic =~ /^div/ ? 'Div' : 'Mod' 25 auto inst_save_state = CreateSaveState(Opcode::SaveState, GetPc(instruction->GetAddress())); [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/ir_builder/ |
| D | inst_templates.yaml | 1 # Copyright (c) 2021-2022 Huawei Device Co., Ltd. 6 # http://www.apache.org/licenses/LICENSE-2.0 15 binop: |- 17 % opc = inst.stripped_mnemonic.match regex_arithm 20 …auto inst = graph_->CreateInst<%= opc %>(<%= get_type(inst.dtype) %>, GetPc(instruction->GetAddres… 21 <%=template('operands', inst, '')-%> 22 AddInstruction(inst); 23 binop_z: |- 24 % opc = inst.stripped_mnemonic =~ /div/ ? 'Div' : 'Mod' 25 auto inst_save_state = CreateSaveState(Opcode::SaveState, GetPc(instruction->GetAddress())); [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/tests/ |
| D | iterators_test.cpp | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 void CheckInstForwardIterator(BasicBlock *block, std::vector<Inst *> &result) in CheckInstForwardIterator() 29 for (auto inst : block->PhiInsts()) { in CheckInstForwardIterator() local 30 result.push_back(inst); in CheckInstForwardIterator() 35 for (auto inst : block->Insts()) { in CheckInstForwardIterator() local 36 result.push_back(inst); in CheckInstForwardIterator() 41 for (auto inst : block->AllInsts()) { in CheckInstForwardIterator() local 42 result.push_back(inst); in CheckInstForwardIterator() 47 void CheckInstForwardValidIterator(BasicBlock *block, std::vector<Inst *> &result) in CheckInstForwardValidIterator() [all …]
|