| /arkcompiler/runtime_core/compiler/optimizer/optimizations/ |
| D | cleanup.h | 62 void MarkLiveRec(Marker live_mrk, Inst *inst); 65 void SetLiveRec(Inst *inst, Marker mrk, Marker live_mrk); 66 void LiveUserSearchRec(Inst *inst, Marker mrk, Marker live_mrk, Marker dead_mrk); 87 ArenaUnorderedMap<Inst *, uint32_t> map_; 89 Inst *fake_root_ {nullptr}; 91 // number of the inst according to the order it is reached during the DFS 94 inline uint32_t GetInstId(Inst *inst) const in GetInstId() argument 96 ASSERT(map_.count(inst) > 0); in GetInstId() 97 return map_.at(inst); in GetInstId() 101 * The immediate dominator of 'inst' [all …]
|
| D | vn.cpp | 24 static void AddSpecialTraits(Inst *inst, VnObject *obj) in AddSpecialTraits() argument 26 switch (inst->GetOpcode()) { in AddSpecialTraits() 28 if (inst->GetFlagsMask() == 0) { in AddSpecialTraits() 30 obj->Add(static_cast<uint32_t>(inst->CastToIntrinsic()->GetIntrinsicId())); in AddSpecialTraits() 34 obj->Add(static_cast<uint32_t>(inst->CastToCompareAnyType()->GetAnyType())); in AddSpecialTraits() 37 obj->Add(static_cast<uint32_t>(inst->CastToCastAnyTypeValue()->GetAnyType())); in AddSpecialTraits() 44 void VnObject::Add(Inst *inst) in Add() argument 46 Add(static_cast<uint32_t>(inst->GetOpcode())); in Add() 47 Add(static_cast<uint32_t>(inst->GetType())); in Add() 49 AddSpecialTraits(inst, this); in Add() [all …]
|
| D | cleanup.cpp | 246 void Cleanup::MarkLiveRec(Marker live_mrk, Inst *inst) in MarkLiveRec() argument 250 while (inst->GetInputsCount() == 1) { in MarkLiveRec() 251 marked = inst->SetMarker(live_mrk); in MarkLiveRec() 255 inst = inst->GetInput(0).GetInst(); in MarkLiveRec() 257 if (!marked && !inst->SetMarker(live_mrk)) { in MarkLiveRec() 258 for (auto input : inst->GetInputs()) { in MarkLiveRec() 272 for (auto inst : bb->AllInsts()) { in Dce() local 273 if (inst->IsNotRemovable() && !inst->IsMarked(dead_mrk)) { in Dce() 274 MarkLiveRec(live_mrk, inst); in Dce() 280 for (auto inst : bb->AllInstsSafe()) { in Dce() local [all …]
|
| D | lowering.cpp | 21 void Lowering::VisitIfImm([[maybe_unused]] GraphVisitor *v, Inst *inst) in VisitIfImm() argument 23 ASSERT(inst->GetOpcode() == Opcode::IfImm); in VisitIfImm() 24 LowerIf(inst->CastToIfImm()); in VisitIfImm() 28 bool Lowering::ConstantFitsCompareImm(Inst *cst, uint32_t size, ConditionCode cc) in ConstantFitsCompareImm() 39 bool Lowering::BetterToSwapCompareInputs(Inst *cmp) in BetterToSwapCompareInputs() 61 void Lowering::OptimizeIfInput(compiler::Inst *if_inst) in OptimizeIfInput() 64 compiler::Inst *input_0 = if_inst->GetInput(0).GetInst(); in OptimizeIfInput() 65 compiler::Inst *input_1 = if_inst->GetInput(1).GetInst(); in OptimizeIfInput() 77 void Lowering::LowerIf(IfImmInst *inst) in LowerIf() argument 79 auto graph = inst->GetBasicBlock()->GetGraph(); in LowerIf() [all …]
|
| /arkcompiler/runtime_core/libpandafile/tests/ |
| D | bytecode_instruction_tests.cpp | 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() 43 EXPECT_EQ((inst.GetImm<BytecodeInstruction::Format::V4_IMM4, 0>()), 0x2); in TEST() 49 BytecodeInstruction inst(bytecode); in TEST() local 50 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/ir_builder/ |
| D | inst_templates.yaml | 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); 24 % opc = inst.stripped_mnemonic =~ /div/ ? 'Div' : 'Mod' 26 …auto inst_check = graph_->CreateInstZeroCheck(<%= get_type(inst.dtype) %>, GetPc(instruction->GetA… 27 % if inst.acc_and_operands.last.imm? 29 …inst_check->SetInput(0, FindOrCreate32BitConstant(instruction->GetImm<<%= inst.get_format %>, 0>()… 31 inst_check->SetInput(0, <%= inst.get_input_string(1) %>); 34 inst_check->SetInput(0, <%= inst.get_input_string(1) %>); [all …]
|
| /arkcompiler/runtime_core/compiler/tests/ |
| D | iterators_test.cpp | 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() 53 for (auto inst : block->PhiInstsSafe()) { in Check() local 54 result.push_back(inst); in Check() [all …]
|
| D | vn_test.cpp | 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() 56 INST(13, Opcode::Add).u64().Inputs(0, 1); in TEST_F() 57 INST(20, Opcode::SaveState).NoVregs(); in TEST_F() 58 INST(14, Opcode::CallStatic).b().InputsAutoType(6, 7, 8, 9, 10, 11, 12, 13, 20); in TEST_F() [all …]
|
| D | move_constants_test.cpp | 33 INST(2, Opcode::IfImm).CC(CC_GE).Imm(5).Inputs(0); 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() 48 INST(6, Opcode::Return).ref().Inputs(1); in TEST_F() 53 INST(8, Opcode::Return).ref().Inputs(1); in TEST_F() 63 INST(2, Opcode::IfImm).CC(CC_GE).Imm(5).Inputs(0); in TEST_F() 68 INST(3, Opcode::ReturnI).u64().Imm(0); in TEST_F() 74 INST(4, Opcode::IfImm).CC(CC_LE).Imm(10).Inputs(0); in TEST_F() 79 INST(6, Opcode::Return).ref().Inputs(1); in TEST_F() 84 INST(8, Opcode::Return).ref().Inputs(1); in TEST_F() [all …]
|
| D | graph_cloner_test.cpp | 42 INST(44, Opcode::LoadAndInitClass).ref().Inputs().TypeId(68); in TEST_F() 43 INST(3, Opcode::NewArray).ref().Inputs(44, 2); in TEST_F() 44 INST(14, Opcode::Compare).CC(ConditionCode::CC_LT).b().Inputs(0, 13); // i < X in TEST_F() 45 INST(15, Opcode::IfImm).SrcType(DataType::BOOL).CC(CC_NE).Imm(0).Inputs(14); in TEST_F() 49 INST(4, Opcode::Phi).s32().Inputs(0, 10); in TEST_F() 50 INST(7, Opcode::SaveState).Inputs(0, 1, 2, 3).SrcVregs({0, 1, 2, 3}); in TEST_F() 51 INST(8, Opcode::BoundsCheck).s32().Inputs(2, 4, 7); in TEST_F() 52 INST(9, Opcode::StoreArray).s32().Inputs(3, 8, 0); // a[i] = 0 in TEST_F() 53 INST(10, Opcode::Add).s32().Inputs(4, 1); // i++ in TEST_F() 54 INST(5, Opcode::Compare).CC(ConditionCode::CC_LT).b().Inputs(10, 13); // i < X in TEST_F() [all …]
|
| D | cleanup_test.cpp | 31 INST(0, Opcode::ReturnVoid); in TEST_F() 42 INST(0, Opcode::ReturnVoid); in TEST_F() 56 INST(2, Opcode::If).SrcType(DataType::Type::INT64).CC(CC_LE).Inputs(0, 1); in TEST_F() 60 INST(3, Opcode::If).SrcType(DataType::Type::INT64).CC(CC_EQ).Inputs(0, 1); in TEST_F() 64 INST(4, Opcode::Add).s64().Inputs(0, 1); in TEST_F() 68 INST(5, Opcode::Phi).s64().Inputs({{3, 1}, {4, 4}}); in TEST_F() 72 INST(6, Opcode::Phi).s64().Inputs({{2, 0}, {5, 5}}); in TEST_F() 73 INST(7, Opcode::Return).s64().Inputs(6); in TEST_F() 86 INST(2, Opcode::If).SrcType(DataType::Type::INT64).CC(CC_LE).Inputs(0, 1); in TEST_F() 90 INST(3, Opcode::If).SrcType(DataType::Type::INT64).CC(CC_EQ).Inputs(0, 1); in TEST_F() [all …]
|
| D | reg_alloc_common_test.cpp | 54 INST(30, Opcode::SaveState).Inputs(0).SrcVregs({0}); in TestParametersLocations() 55 INST(11, Opcode::NullCheck).ref().Inputs(0, 30); in TestParametersLocations() 56 INST(12, Opcode::StoreObject).u64().Inputs(11, 1); in TestParametersLocations() 57 INST(13, Opcode::StoreObject).u64().Inputs(11, 2); in TestParametersLocations() 58 INST(14, Opcode::StoreObject).u64().Inputs(11, 3); in TestParametersLocations() 59 INST(15, Opcode::StoreObject).u64().Inputs(11, 4); in TestParametersLocations() 60 INST(16, Opcode::StoreObject).u64().Inputs(11, 5); in TestParametersLocations() 61 INST(17, Opcode::StoreObject).u64().Inputs(11, 6); in TestParametersLocations() 62 INST(18, Opcode::StoreObject).u64().Inputs(11, 7); in TestParametersLocations() 63 INST(19, Opcode::StoreObject).u64().Inputs(11, 8); in TestParametersLocations() [all …]
|
| D | ir_builder_test.cpp | 75 INST(1, Opcode::Return).Inputs(0); in CheckSimple() 116 INST(1, Opcode::Return).Inputs(0); in CheckSimpleWithImm() 152 INST(2, Opcode::Cmp).s32().Inputs(0, 1); in CheckCmp() 153 INST(3, Opcode::Return).s32().Inputs(2); in CheckCmp() 184 INST(2, Opcode::Cmp).s32().SrcType(data_type).Fcmpg(fcmpg).Inputs(0, 1); in CheckFloatCmp() 185 INST(3, Opcode::Return).s32().Inputs(2); in CheckFloatCmp() 246 INST(2, Opcode::Compare).b().CC(CC).Inputs(0, 1); in CheckCondJump() 247 INST(3, Opcode::IfImm).SrcType(DataType::BOOL).CC(CC_NE).Imm(0).Inputs(2); in CheckCondJump() 252 INST(4, Opcode::ReturnVoid).v0id(); in CheckCondJump() 312 INST(1, Opcode::Compare).b().CC(CC).Inputs(0, 2); in CheckCondJumpWithZero() [all …]
|
| /arkcompiler/runtime_core/bytecode_optimizer/ |
| D | reg_acc_alloc.cpp | 19 #include "compiler/optimizer/ir/inst.h" 26 bool IsAccWriteBetween(compiler::Inst *src_inst, compiler::Inst *dst_inst) 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() 53 inst = *(block->AllInsts()); in IsAccWriteBetween() 55 if (inst->IsAccWrite()) { in IsAccWriteBetween() 59 if (inst->IsAccRead()) { in IsAccWriteBetween() 60 compiler::Inst *input = inst->GetInput(AccReadIndex(inst)).GetInst(); in IsAccWriteBetween() 67 inst = inst->GetNext(); in IsAccWriteBetween() [all …]
|
| D | reg_encoder.cpp | 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() 65 for (const auto &inst : bb->AllInsts()) { in CalculateNumNeededRangeTemps() local 66 if (!CanHoldRange(inst)) { in CalculateNumNeededRangeTemps() 69 auto nargs = inst->GetInputsCount() - (inst->RequireState() ? 1 : 0); in CalculateNumNeededRangeTemps() 71 if (nargs > MAX_NUM_NON_RANGE_ARGS || IsIntrinsicRange(inst)) { in CalculateNumNeededRangeTemps() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/ir/ |
| D | ir_constructor.h | 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); 43 * INST(4, Opcode::Phi).Inputs(2, 3); 44 * INST(5, Opcode::Not).Inputs(4); 57 * INST creates new instruction and append it to the current basic block. 120 auto inst = graph_->CreateInst(std::forward<Args>(args)...); in NewInst() local [all …]
|
| D | basicblock.cpp | 18 #include "inst.h" 23 class Inst; 52 BasicBlock *BasicBlock::SplitBlockAfterInstruction(Inst *inst, bool make_edge) in SplitBlockAfterInstruction() argument 54 ASSERT(inst != nullptr); in SplitBlockAfterInstruction() 55 ASSERT(inst->GetBasicBlock() == this); in SplitBlockAfterInstruction() 58 auto next_inst = inst->GetNext(); in SplitBlockAfterInstruction() 66 inst->SetNext(nullptr); in SplitBlockAfterInstruction() 67 last_inst_ = inst; in SplitBlockAfterInstruction() 68 if (inst->IsPhi()) { in SplitBlockAfterInstruction() 142 auto inst = phi->GetInput(index).GetInst(); in RemovePhiProcessing() local [all …]
|
| D | graph_checker.h | 62 void CheckPhiInputs(Inst *phi_inst); 69 bool CheckInstHasInput(Inst *inst, Inst *input); 70 bool CheckInstHasUser(Inst *inst, Inst *user); 72 void CheckSpillFillHolder(Inst *inst); 73 bool CheckInstRegUsageSaved(const Inst *inst, Register reg) const; 86 …void CheckObjectRec(const Inst *object, const Inst *user, const BasicBlock *block, Inst *start_fro… 88 void FindObjectInSaveState(const Inst *object, Inst *ss) const; 90 … void CheckSaveStateOsrRec(const Inst *inst, const Inst *user, BasicBlock *block, Marker visited); 115 static void VisitReturn([[maybe_unused]] GraphVisitor *v, Inst *inst); 116 static void VisitIf([[maybe_unused]] GraphVisitor *v, Inst *inst); [all …]
|
| D | graph_checker.cpp | 48 for (auto inst : block->AllInsts()) { in UserInputCheck() local 49 auto u = inst->GetFirstUser(); in UserInputCheck() 55 for (auto &user : inst->GetUsers()) { in UserInputCheck() 58 …ASSERT_DO(CheckInstHasInput(user_inst, inst), std::cerr << "Instruction is not an input to its use… in UserInputCheck() 59 … << "input: " << *inst << std::endl in UserInputCheck() 62 for (auto &input : inst->GetInputs()) { in UserInputCheck() 65 …ASSERT_DO(CheckInstHasUser(input_inst, inst), std::cerr << "Instruction is not a user to its input… in UserInputCheck() 66 … << "user: " << *inst << std::endl in UserInputCheck() 70 auto it = std::find_if(inst->GetInputs().begin(), inst->GetInputs().end(), in UserInputCheck() 72 [[maybe_unused]] bool has_save_state = (it != inst->GetInputs().end()); in UserInputCheck() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/optimizations/regalloc/ |
| D | reg_alloc_resolver.cpp | 18 #include "compiler/optimizer/ir/inst.h" 34 for (auto inst : block->AllInstsSafe()) { in Resolve() local 35 if (inst->IsSaveState()) { in Resolve() 38 ResolveInputs(inst); in Resolve() 39 ResolveOutput(inst); in Resolve() 40 if (GetGraph()->IsInstThrowable(inst)) { in Resolve() 41 AddCatchPhiMoves(inst); in Resolve() 47 void RegAllocResolver::AddCatchPhiMoves(Inst *inst) in AddCatchPhiMoves() argument 51 auto handlers = GetGraph()->GetThrowableInstHandlers(inst); in AddCatchPhiMoves() 60 auto it = std::find(throwable_insts->begin(), throwable_insts->end(), inst); in AddCatchPhiMoves() [all …]
|
| /arkcompiler/runtime_core/bytecode_optimizer/tests/ |
| D | const_array_resolver_test.cpp | 31 INST(20, Opcode::SaveState).NoVregs(); in TEST_F() 32 INST(4, Opcode::LoadAndInitClass).ref().Inputs(20).TypeId(68); in TEST_F() 33 INST(3, Opcode::NewArray).ref().Inputs(4, 1, 20); in TEST_F() 34 INST(11, Opcode::StoreArray).u64().Inputs(3, 2, 2); in TEST_F() 35 INST(13, Opcode::StoreArray).u64().Inputs(3, 2, 2); in TEST_F() 36 INST(10, Opcode::Return).ref().Inputs(3); in TEST_F() 54 INST(20, Opcode::SaveState).NoVregs(); in TEST_F() 55 INST(4, Opcode::LoadAndInitClass).ref().Inputs(20).TypeId(68); in TEST_F() 56 INST(22, Opcode::SaveState).NoVregs(); in TEST_F() 57 INST(21, Opcode::LoadConstArray).ref().Inputs(22); in TEST_F() [all …]
|
| /arkcompiler/runtime_core/libark_defect_scan_aux/ |
| D | graph.cpp | 28 bool Inst::operator==(const Inst &inst) const in operator ==() 30 return inst_ == inst.inst_; in operator ==() 33 bool Inst::operator!=(const Inst &inst) const in operator !=() 35 return inst_ != inst.inst_; in operator !=() 38 InstType Inst::GetType() const in GetType() 43 bool Inst::IsInstStLexVar() const in IsInstStLexVar() 49 bool Inst::IsInstLdLexVar() const in IsInstLdLexVar() 55 bool Inst::IsInstStGlobal() const in IsInstStGlobal() 62 bool Inst::IsInstLdGlobal() const in IsInstLdGlobal() 68 uint16_t Inst::GetArgIndex() const in GetArgIndex() [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/templates/ |
| D | inst_checker_gen.h.erb | 35 static DataType::Type GetInputType(Inst* inst, size_t input) 37 return inst->GetInput(input).GetInst()->GetType(); 45 % IR::instructions.each do |inst| 46 … static void Visit<%= inst.opcode %>([[maybe_unused]] GraphVisitor *v, [[maybe_unused]] Inst *inst) 48 % if !inst.has_dst? 49 ASSERT(!inst->HasUsers()); 50 % elsif !inst.dst.pseudo? 51 …ASSERT_DO(CheckType(inst->GetType(), <%= inst.dst.types.map { |x| Operand::cpp_type(x) }.join(', '… 52 …std::cerr << "Wrong dst type '" << DataType::ToString(inst->GetType()) << "' for inst:\n" << *inst… 54 % if inst.inputs.any? { |x| x.is_dyn? } [all …]
|
| D | inst_builder_gen.cpp.erb | 89 def get_template_by_inst(inst) 90 if (inst.namespace == "ecmascript") 93 return get_template(inst.stripped_mnemonic) 137 def template(name, inst, indent, context = {}) 143 def get_cc(inst) 144 return 'ConditionCode::CC_EQ' if inst.opcode.start_with? 'jeq' 145 return 'ConditionCode::CC_NE' if inst.opcode.start_with? 'jne' 146 return 'ConditionCode::CC_LT' if inst.opcode.start_with? 'jlt' 147 return 'ConditionCode::CC_GT' if inst.opcode.start_with? 'jgt' 148 return 'ConditionCode::CC_LE' if inst.opcode.start_with? 'jle' [all …]
|
| D | generate_ecma.inl.erb | 19 void panda::bytecodeopt::BytecodeGen::VisitEcma(panda::compiler::GraphVisitor *visitor, Inst *inst_… 22 auto inst = inst_base->CastToIntrinsic(); 25 switch (inst->GetIntrinsicId()) { 33 % inst = group.first 34 % next if inst.properties.include?("jump") 35 % opcode = inst.opcode.upcase 36 % params_arr = inst.operands 42 % if inst.acc.include?("in") 43 auto acc_src = inst->GetSrcReg(inst->GetInputsCount() - 2); 55 auto v<%= vreg_index %> = inst->GetSrcReg(<%= input_index %>); [all …]
|