| /arkcompiler/runtime_core/compiler/optimizer/ir/ |
| D | graph_checker.h | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 46 GetGraph()->GetPassManager()->SetCheckMode(false); in ~GraphChecker() 64 void CheckPhiInputs(Inst *phi_inst); 71 bool CheckInstHasInput(Inst *inst, Inst *input); 72 bool CheckInstHasUser(Inst *inst, Inst *user); 75 void CheckSpillFillHolder(Inst *inst); 76 bool CheckInstRegUsageSaved(const Inst *inst, Register reg) const; 90 …void CheckObjectRec(const Inst *object, const Inst *user, const BasicBlock *block, Inst *start_fro… 92 void FindObjectInSaveState(const Inst *object, Inst *ss) const; [all …]
|
| D | graph_checker.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 34 GetGraph()->GetPassManager()->SetCheckMode(true); in GraphChecker() 44 for (auto block : graph->GetVectorBlocks()) { in UserInputCheck() 48 for (auto inst : block->AllInsts()) { in UserInputCheck() local 49 auto u = inst->GetFirstUser(); in UserInputCheck() 50 ASSERT(u == nullptr || u->GetPrev() == nullptr); in UserInputCheck() 52 ASSERT(u->GetNext() == nullptr || u->GetNext()->GetPrev() == u); in UserInputCheck() 53 u = u->GetNext(); in UserInputCheck() 55 for (auto &user : inst->GetUsers()) { in UserInputCheck() [all …]
|
| D | ir_constructor.h | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 33 * INST(0, Opcode::IntConstant).Constant(12); 34 * INST(1, Opcode::IntConstant).Constant(12); 35 * INST(2, Opcode::Add).Inputs(0, 1); 36 * INST(6, Opcode::Compare).Inputs(2).CC(ConditionCode::CC_AE); 37 * INST(7, Opcode::If).Inputs(6); 40 * INST(3, Opcode::Not).Inputs(0); 42 * BASIC_BLOCK(2, -1) { 43 * INST(4, Opcode::Phi).Inputs(2, 3); [all …]
|
| D | analysis.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 27 if (current_bb->SetMarker(mrk)) { in FindOsrEntryRec() 30 if (current_bb->IsOsrEntry()) { in FindOsrEntryRec() 34 for (auto pred : current_bb->GetPredsBlocks()) { in FindOsrEntryRec() 42 bool HasOsrEntryBetween(Inst *dominate_inst, Inst *inst) in HasOsrEntryBetween() argument 44 auto bb = inst->GetBasicBlock(); in HasOsrEntryBetween() 45 auto graph = bb->GetGraph(); in HasOsrEntryBetween() 46 if (!graph->IsOsrMode()) { in HasOsrEntryBetween() 49 auto dominate_bb = dominate_inst->GetBasicBlock(); in HasOsrEntryBetween() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/optimizations/ |
| D | memory_barriers.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 30 for (auto inst : barriers_insts_) { in MergeBarriers() local 31 inst->ClearFlag(inst_flags::MEM_BARRIER); in MergeBarriers() 33 last_barrier_inst->SetFlag(inst_flags::MEM_BARRIER); in MergeBarriers() 37 bool OptimizeMemoryBarriers::CheckInst(Inst *inst) in CheckInst() argument 39 … return (std::find(barriers_insts_.begin(), barriers_insts_.end(), inst) != barriers_insts_.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 | 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 …]
|
| D | memory_barriers.h | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 // NOLINTNEXTLINE(fuchsia-multiple-inheritance) 30 : Optimization(graph), barriers_insts_(graph->GetLocalAllocator()->Adapter()) in OptimizeMemoryBarriers() 46 return GetGraph()->GetBlocksRPO(); in GetBlocksToVisit() 57 void VisitDefault([[maybe_unused]] Inst *inst) override in VisitDefault() argument 59 ASSERT_DO(!inst->IsCall() && !inst->IsStore(), in VisitDefault() 60 … (std::cerr << "need to make a visitor for the instruction: " << *inst << std::endl)); in VisitDefault() 63 void CheckAllInputs(Inst *inst); 64 void CheckInput(Inst *input); [all …]
|
| D | vn.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 static void AddSpecialTraits(Inst *inst, VnObject *obj) in AddSpecialTraits() argument 28 switch (inst->GetOpcode()) { in AddSpecialTraits() 30 if (inst->GetFlagsMask() == 0) { in AddSpecialTraits() 32 obj->Add(static_cast<uint32_t>(inst->CastToIntrinsic()->GetIntrinsicId())); in AddSpecialTraits() 36 obj->Add(static_cast<uint32_t>(inst->CastToCompareAnyType()->GetAnyType())); in AddSpecialTraits() 39 obj->Add(static_cast<uint32_t>(inst->CastToCastAnyTypeValue()->GetAnyType())); in AddSpecialTraits() 46 void VnObject::Add(Inst *inst) in Add() argument 48 Add(static_cast<uint32_t>(inst->GetOpcode())); in Add() [all …]
|
| D | scheduler.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 30 * 5. Forward list scheduling algorithm with standart critical-path-based priority. 36 for (auto bb : GetGraph()->GetBlocksRPO()) { in RunImpl() 37 if (!bb->IsEmpty() && !bb->IsStartBlock()) { in RunImpl() 43 GetGraph()->SetSchedulerComplete(); in RunImpl() 49 void Scheduler::AddDep(uint32_t *prio, Inst *from, Inst *to, uint32_t latency, Inst *barrier) in AddDep() 54 …COMPILER_LOG(DEBUG, SCHEDULER) << "Found dependency " << from->GetId() << " -> " << to->GetId() <<… in AddDep() 59 // Update instruction priority - "how high instruction is in dependency tree" in AddDep() 62 // Do not add cross-barrier depenedencies into deps_ in AddDep() [all …]
|
| D | deoptimize_elimination.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 38 for (auto &inst : deoptimize_must_throw_) { in ReplaceDeoptimizeIfByUnconditionalDeoptimize() local 39 auto block = inst->GetBasicBlock(); in ReplaceDeoptimizeIfByUnconditionalDeoptimize() 41 block->ReplaceInstByDeoptimize(inst); in ReplaceDeoptimizeIfByUnconditionalDeoptimize() 49 auto block = GetGraph()->GetStartBlock(); in RemoveSafePoints() 50 ASSERT(block != nullptr && block->IsStartBlock()); in RemoveSafePoints() 51 for (auto sp : block->Insts()) { in RemoveSafePoints() 52 if (sp->GetOpcode() == Opcode::SafePoint) { in RemoveSafePoints() 53 sp->ClearFlag(inst_flags::NO_DCE); in RemoveSafePoints() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/code_generator/ |
| D | codegen.h | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 171 void CreateStackMap(Inst *inst, Inst *user = nullptr); 173 void CreateStackMapRec(SaveStateInst *save_state, bool require_vreg_map, Inst *target_site); 174 void CreateVRegMap(SaveStateInst *save_state, size_t vregs_count, Inst *target_site); 175 void CreateVreg(const Location &location, Inst *inst, const VirtualRegister &vreg); 180 void CreateVRegForRegister(const Location &location, Inst *inst, const VirtualRegister &vreg); 183 * 'live_inputs' shows that inst's source registers should be added the the mask 186 std::pair<RegMask, VRegMask> GetLiveRegisters(Inst *inst) in GetLiveRegisters() argument 190 if (!options.IsCompilerSaveOnlyLiveRegisters() || inst == nullptr) { in GetLiveRegisters() [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/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 …]
|
| D | deoptimize_elimination_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 45 INST(2, Opcode::SaveStateDeoptimize).Inputs(1).SrcVregs({1}); in TEST_F() 47 INST(10, Opcode::SaveState).Inputs(1).SrcVregs({1}); in TEST_F() 49 INST(3, Opcode::SaveStateDeoptimize).Inputs(1).SrcVregs({1}); in TEST_F() 50 INST(4, Opcode::Compare).b().Inputs(0, 1).CC(CC_GT); in TEST_F() 51 INST(5, Opcode::DeoptimizeIf).Inputs(4, 3); in TEST_F() 53 INST(6, Opcode::SaveStateDeoptimize).Inputs(1).SrcVregs({1}); in TEST_F() 54 INST(7, Opcode::DeoptimizeIf).Inputs(4, 6); in TEST_F() 57 INST(8, Opcode::DeoptimizeIf).Inputs(1, 6); in TEST_F() [all …]
|
| D | vn_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 47 BASIC_BLOCK(2, -1) in TEST_F() 49 INST(6, Opcode::Add).u64().Inputs(0, 1); in TEST_F() 50 INST(7, Opcode::Sub).u32().Inputs(1, 0); in TEST_F() 51 INST(8, Opcode::Mul).f32().Inputs(4, 5); in TEST_F() 52 INST(9, Opcode::Div).f64().Inputs(3, 2); in TEST_F() 53 INST(10, Opcode::Sub).u32().Inputs(1, 0); in TEST_F() 54 INST(11, Opcode::Div).f64().Inputs(3, 2); in TEST_F() 55 INST(12, Opcode::Mul).f32().Inputs(4, 5); in TEST_F() [all …]
|
| D | move_constants_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 33 INST(2, Opcode::IfImm).CC(CC_GE).Imm(5).Inputs(0); in TEST_F() 36 BASIC_BLOCK(3, -1) in TEST_F() 38 INST(3, Opcode::ReturnI).u64().Imm(0); in TEST_F() 43 INST(4, Opcode::IfImm).CC(CC_LE).Imm(10).Inputs(0); in TEST_F() 46 BASIC_BLOCK(5, -1) in TEST_F() 48 INST(6, Opcode::Return).ref().Inputs(1); in TEST_F() 51 BASIC_BLOCK(6, -1) in TEST_F() 53 INST(8, Opcode::Return).ref().Inputs(1); in TEST_F() [all …]
|
| D | memory_coalescing_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 29 GetGraph()->SetLowLevelInstructionsEnabled(); in MemoryCoalescingTest() 37 if (GetGraph()->GetArch() != Arch::AARCH64) { in TEST_F() 43 BASIC_BLOCK(2, -1) in TEST_F() 45 INST(44, Opcode::LoadAndInitClass).ref().Inputs().TypeId(68); in TEST_F() 46 INST(3, Opcode::NewArray).ref().Inputs(44, 0).TypeId(77); in TEST_F() 47 INST(41, Opcode::SaveState).Inputs(3).SrcVregs({7}); in TEST_F() 48 INST(42, Opcode::NullCheck).ref().Inputs(3, 41); in TEST_F() 49 INST(225, Opcode::LoadArrayI).s64().Inputs(42).Imm(0x0); in TEST_F() [all …]
|
| D | if_conversion_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 26 GetGraph()->SetLowLevelInstructionsEnabled(); in IfConversionTest() 35 * /---[2]---\ 39 * \---[4]---/ 52 INST(3, Opcode::Compare).b().CC(CC_B).Inputs(0, 1); in TEST_F() 53 INST(4, Opcode::IfImm).SrcType(DataType::BOOL).CC(CC_NE).Imm(0).Inputs(3); in TEST_F() 57 INST(5, Opcode::Mul).u64().Inputs(0, 2); in TEST_F() 59 BASIC_BLOCK(4, -1) in TEST_F() 61 INST(6, Opcode::Phi).u64().Inputs({{2, 0}, {3, 5}}); in TEST_F() [all …]
|
| D | loop_peeling_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 32 INST(2, Opcode::Phi).Inputs(1, 4, 6).u64(); in BuildGraphTwoBackEdges() 33 INST(3, Opcode::IfImm).SrcType(DataType::BOOL).CC(CC_NE).Imm(0).Inputs(0); in BuildGraphTwoBackEdges() 37 INST(4, Opcode::Add).Inputs(1, 1).u64(); in BuildGraphTwoBackEdges() 38 INST(5, Opcode::IfImm).SrcType(DataType::BOOL).CC(CC_NE).Imm(0).Inputs(0); in BuildGraphTwoBackEdges() 42 INST(6, Opcode::Add).Inputs(4, 4).u64(); in BuildGraphTwoBackEdges() 44 BASIC_BLOCK(4, -1) in BuildGraphTwoBackEdges() 46 INST(7, Opcode::Return).u64().Inputs(2); in BuildGraphTwoBackEdges() 58 INST(2, Opcode::Phi).Inputs(1, 6).u64(); in BuildGraphNotHeaderExit() [all …]
|
| D | adjust_arefs_test.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 30 graph->SetLowLevelInstructionsEnabled(); in TEST_F() 41 INST(10, Opcode::Phi).s32().Inputs(1, 40); in TEST_F() 42 INST(11, Opcode::LoadArray).u64().Inputs(0, 1); in TEST_F() 43 INST(12, Opcode::LoadArray).u64().Inputs(0, 1); in TEST_F() 44 INST(13, Opcode::StoreArray).u64().Inputs(0, 1, 2); in TEST_F() 45 INST(14, Opcode::StoreArray).u64().Inputs(0, 1, 2); in TEST_F() 46 INST(15, Opcode::Compare).b().Inputs(10, 1); in TEST_F() 47 INST(19, Opcode::IfImm).CC(CC_NE).Inputs(15).Imm(0); in TEST_F() [all …]
|
| /arkcompiler/runtime_core/bytecode_optimizer/ |
| D | reg_acc_alloc.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 19 #include "compiler/optimizer/ir/inst.h" 26 bool IsAccWriteBetween(compiler::Inst *src_inst, compiler::Inst *dst_inst) in IsAccWriteBetween() 30 compiler::BasicBlock *block = src_inst->GetBasicBlock(); in IsAccWriteBetween() 31 compiler::Inst *inst = src_inst->GetNext(); in IsAccWriteBetween() local 33 while (inst != dst_inst) { in IsAccWriteBetween() 34 if (UNLIKELY(inst == nullptr)) { in IsAccWriteBetween() 38 if (block->GetSuccsBlocks().size() > 1) { in IsAccWriteBetween() 42 ASSERT(block->GetSuccsBlocks().size() == 1); in IsAccWriteBetween() [all …]
|
| D | reg_encoder.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 22 static bool IsIntrinsicRange(Inst *inst) in IsIntrinsicRange() argument 24 if (inst->GetOpcode() != compiler::Opcode::Intrinsic) { in IsIntrinsicRange() 28 switch (inst->CastToIntrinsic()->GetIntrinsicId()) { in IsIntrinsicRange() 50 static bool CanHoldRange(Inst *inst) in CanHoldRange() argument 52 switch (inst->GetOpcode()) { in CanHoldRange() 54 return IsIntrinsicRange(inst); in CanHoldRange() 64 for (auto bb : graph->GetBlocksRPO()) { in CalculateNumNeededRangeTemps() 65 for (const auto &inst : bb->AllInsts()) { in CalculateNumNeededRangeTemps() local [all …]
|
| /arkcompiler/runtime_core/libpandafile/tests/ |
| D | bytecode_instruction_tests.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 23 #include "bytecode_instruction-inl.h" 32 BytecodeInstruction inst(bytecode); in TEST() local 33 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() 34 EXPECT_EQ((inst.GetVReg<BytecodeInstruction::Format::V4_IMM4, 0>()), 1); in TEST() 35 EXPECT_EQ((inst.GetImm<BytecodeInstruction::Format::V4_IMM4, 0>()), -6); in TEST() 40 BytecodeInstruction inst(bytecode); in TEST() local 41 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() 42 EXPECT_EQ((inst.GetVReg<BytecodeInstruction::Format::V4_IMM4, 0>()), 0xf); in TEST() [all …]
|
| /arkcompiler/runtime_core/irtoc/lang/ |
| D | ir_generator.rb | 3 # Copyright (c) 2021-2022 Huawei Device Co., Ltd. 8 # http://www.apache.org/licenses/LICENSE-2.0 28 Output.scoped_puts "inline bool #{func.name}(Inst* source_inst) {" do 29 Output << "Graph* graph = source_inst->GetBasicBlock()->GetGraph();" 30 Output << "[[maybe_unused]] auto pc = source_inst->GetPc();" 31 Output << "[[maybe_unused]] auto save_state = source_inst->GetSaveState();" 34 Output << "Inst* p_#{index} = source_inst->GetInput(#{index}).GetInst();" 36 Output << "[[maybe_unused]] auto *runtime = graph->GetRuntime();" 37 func.constants.each { |_, inst| generate_instruction(inst) } 45 Output << "source_inst->GetBasicBlock()->RemoveInst(source_inst);" [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/optimizations/regalloc/ |
| D | reg_alloc_resolver.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 19 #include "compiler/optimizer/ir/inst.h" 34 for (auto block : GetGraph()->GetBlocksRPO()) { in Resolve() 35 for (auto inst : block->AllInstsSafe()) { in Resolve() local 36 if (inst->IsSaveState()) { in Resolve() 37 ResolveSaveState(inst); in Resolve() 40 ResolveInputs(inst); in Resolve() 41 ResolveOutput(inst); in Resolve() 42 if (GetGraph()->IsInstThrowable(inst)) { in Resolve() [all …]
|