| /arkcompiler/runtime_core/static_core/compiler/optimizer/code_generator/ |
| D | encode_visitor.h | 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); 76 static void VisitNeg(GraphVisitor *visitor, Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/optimizations/ |
| D | peepholes.h | 2 * Copyright (c) 2021-2024 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 | memory_barriers.cpp | 2 * Copyright (c) 2021-2024 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 | string_builder_utils.h | 7 * http://www.apache.org/licenses/LICENSE-2.0 23 #include "optimizer/ir/inst.h" 28 bool IsStringBuilderInstance(Inst *inst); 29 bool IsMethodStringConcat(Inst *inst); 30 bool IsMethodStringBuilderConstructorWithStringArg(Inst *inst); 31 bool IsMethodStringBuilderConstructorWithCharArrayArg(Inst *inst); 32 bool IsStringBuilderToString(Inst *inst); 33 bool IsMethodStringBuilderDefaultConstructor(Inst *inst); 34 void InsertBeforeWithSaveState(Inst *inst, Inst *before); 35 void InsertAfterWithSaveState(Inst *inst, Inst *after); [all …]
|
| D | memory_barriers.h | 2 * Copyright (c) 2021-2024 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 | 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 | 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 | lowering.h | 2 * Copyright (c) 2021-2024 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 | 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 | escape.h | 2 * Copyright (c) 2021-2024 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) 93 blockStates_(graph->GetLocalAllocator()->Adapter()), in EscapeAnalysis() 94 aliases_(graph->GetLocalAllocator()->Adapter()), in EscapeAnalysis() [all …]
|
| D | vn.cpp | 2 * Copyright (c) 2021-2024 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 | string_builder_utils.cpp | 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(Inst *inst) in IsMethodStringConcat() argument 37 if (inst->GetOpcode() != Opcode::CallStatic && inst->GetOpcode() != Opcode::CallVirtual) { in IsMethodStringConcat() 41 auto call = static_cast<CallInst *>(inst); in IsMethodStringConcat() 42 if (call->IsInlined()) { in IsMethodStringConcat() [all …]
|
| D | lowering.cpp | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 void Lowering::VisitAdd([[maybe_unused]] GraphVisitor *v, Inst *inst) in VisitAdd() argument 28 auto newInst = LowerBinaryOperationWithShiftedOperand<Opcode::Add>(inst); in VisitAdd() 29 if (newInst == nullptr && LowerAddSub(inst) != nullptr) { in VisitAdd() 32 LowerMultiplyAddSub(newInst == nullptr ? inst : newInst); in VisitAdd() 35 void Lowering::VisitSub([[maybe_unused]] GraphVisitor *v, Inst *inst) in VisitSub() argument 37 auto newInst = LowerBinaryOperationWithShiftedOperand<Opcode::Sub, false>(inst); in VisitSub() 38 if (newInst == nullptr && LowerAddSub(inst) != nullptr) { in VisitSub() 41 LowerMultiplyAddSub(inst); in VisitSub() [all …]
|
| D | locations_builder.h | 2 * Copyright (c) 2021-2024 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 VisitCallLaunchStatic(GraphVisitor *visitor, Inst *inst); 59 static void VisitCallLaunchVirtual(GraphVisitor *visitor, Inst *inst); [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/ir/ |
| D | graph_checker.h | 2 * Copyright (c) 2021-2024 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-2024 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/libllvmbackend/lowering/ |
| D | llvm_ir_constructor.h | 2 * Copyright (c) 2023-2024 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/plugins/ets/libllvmbackend/ |
| D | ets_llvm_ir_constructor_h_gen.inl | 2 * Copyright (c) 2023-2024 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/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/static_core/compiler/optimizer/analysis/ |
| D | alias_analysis.h | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 65 Pointer(PointerType type, const Inst *base, const Inst *idx, uint64_t imm, const void *typePtr) in Pointer() 71 static Pointer CreateObject(const Inst *base) in CreateObject() 86 … static Pointer CreateObjectField(const Inst *base, uint32_t typeId, const void *typePtr = nullptr) 91 static Pointer CreateArrayElement(const Inst *array, const Inst *idx, uint64_t imm = 0) 96 static Pointer CreateDictionaryElement(const Inst *array, const Inst *idx, uint64_t imm = 0) 106 const Inst *GetBase() const in GetBase() 111 const Inst *GetIdx() const in GetIdx() 162 static bool IsLocalAlias(const Inst *inst) in IsLocalAlias() argument [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 …]
|
| /arkcompiler/runtime_core/compiler/tests/ |
| D | iterators_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 void Check(std::vector<Inst *> &tested_instructions) in Check() 33 std::vector<Inst *> result; in Check() 34 for (auto inst : block->PhiInsts()) { in Check() local 35 result.push_back(inst); in Check() 40 for (auto inst : block->Insts()) { in Check() local 41 result.push_back(inst); in Check() 46 for (auto inst : block->AllInsts()) { in Check() local 47 result.push_back(inst); in Check() [all …]
|
| /arkcompiler/runtime_core/libabckit/src/irbuilder_dynamic/templates/ |
| D | inst_templates.yaml | 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 instSaveState = CreateSaveState(compiler::Opcode::SaveState, GetPc(instruction->GetAddress())… 26 …auto instCheck = graph_->CreateInstZeroCheck(<%= get_type(inst.dtype) %>, GetPc(instruction->GetAd… [all …]
|