/arkcompiler/runtime_core/static_core/libpandafile/tests/ |
D | bytecode_instruction_tests.cpp | 34 BytecodeInstruction inst(bytecode); in TEST() local 35 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() 36 EXPECT_EQ((inst.GetVReg<BytecodeInstruction::Format::V4_IMM4, 0>()), 1); in TEST() 37 EXPECT_EQ((inst.GetImm<BytecodeInstruction::Format::V4_IMM4, 0>()), -6); in TEST() 42 BytecodeInstruction inst(bytecode); in TEST() local 43 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() 44 EXPECT_EQ((inst.GetVReg<BytecodeInstruction::Format::V4_IMM4, 0>()), 0xf); in TEST() 45 EXPECT_EQ((inst.GetImm<BytecodeInstruction::Format::V4_IMM4, 0>()), 0x2); in TEST() 51 BytecodeInstruction inst(bytecode); in TEST() local 52 EXPECT_EQ(static_cast<uint8_t>(inst.GetOpcode()), 0x00); in TEST() [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/static_core/compiler/optimizer/optimizations/ |
D | memory_barriers.cpp | 30 for (auto inst : barriersInsts_) { in MergeBarriers() local 31 inst->ClearFlag(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() 66 void OptimizeMemoryBarriers::VisitCallStatic(GraphVisitor *v, Inst *inst) in VisitCallStatic() argument 68 if (inst->CastToCallStatic()->IsInlined()) { in VisitCallStatic() 71 static_cast<OptimizeMemoryBarriers *>(v)->CheckAllInputs(inst); in VisitCallStatic() 74 void OptimizeMemoryBarriers::VisitCallIndirect(GraphVisitor *v, Inst *inst) in VisitCallIndirect() argument [all …]
|
D | vn.cpp | 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() 45 auto classInst = static_cast<ClassInst *>(inst); in AddClassInst() 52 inst->SetVnObject(obj); in AddClassInst() [all …]
|
D | peepholes.cpp | 37 void Peepholes::VisitSafePoint(GraphVisitor *v, Inst *inst) in VisitSafePoint() argument 42 if (inst->CastToSafePoint()->RemoveNumericInputs()) { in VisitSafePoint() 43 PEEPHOLE_IS_APPLIED(static_cast<Peepholes *>(v), inst); in VisitSafePoint() 47 void Peepholes::VisitNeg([[maybe_unused]] GraphVisitor *v, Inst *inst) in VisitNeg() argument 49 if (ConstFoldingNeg(inst)) { in VisitNeg() 50 PEEPHOLE_IS_APPLIED(static_cast<Peepholes *>(v), inst); in VisitNeg() 53 auto input = inst->GetInput(0).GetInst(); in VisitNeg() 55 auto instType = inst->GetType(); in VisitNeg() 69 if (SkipThisPeepholeInOSR(inst, input->GetInput(0).GetInst())) { in VisitNeg() 72 inst->ReplaceUsers(input->GetInput(0).GetInst()); in VisitNeg() [all …]
|
D | peepholes.h | 29 #define PEEPHOLE_IS_APPLIED(visitor, inst) (visitor)->SetIsApplied((inst), true, __FILE__, __LINE__) argument 62 static void VisitSafePoint([[maybe_unused]] GraphVisitor *v, Inst *inst); 63 static void VisitNeg([[maybe_unused]] GraphVisitor *v, Inst *inst); 64 static void VisitAbs([[maybe_unused]] GraphVisitor *v, Inst *inst); 65 static void VisitNot([[maybe_unused]] GraphVisitor *v, Inst *inst); 66 static void VisitAdd([[maybe_unused]] GraphVisitor *v, Inst *inst); 67 …static void VisitAddFinalize([[maybe_unused]] GraphVisitor *v, Inst *inst, Inst *input0, Inst *inp… 68 static void VisitSub([[maybe_unused]] GraphVisitor *v, Inst *inst); 69 …static void VisitSubFinalize([[maybe_unused]] GraphVisitor *v, Inst *inst, Inst *input0, Inst *inp… 70 …static void VisitMulOneConst([[maybe_unused]] GraphVisitor *v, Inst *inst, Inst *input0, Inst *inp… [all …]
|
D | lowering.cpp | 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() 44 void Lowering::VisitCastValueToAnyType([[maybe_unused]] GraphVisitor *v, Inst *inst) in VisitCastValueToAnyType() argument 46 auto graph = inst->GetBasicBlock()->GetGraph(); in VisitCastValueToAnyType() [all …]
|
D | const_folding.cpp | 139 ConstantInst *ConstFoldingCreateIntConst(Inst *inst, uint64_t value, bool isLiteralData) in ConstFoldingCreateIntConst() argument 141 auto graph = inst->GetBasicBlock()->GetGraph(); in ConstFoldingCreateIntConst() 142 if (graph->IsBytecodeOptimizer() && IsInt32Bit(inst->GetType()) && !isLiteralData) { in ConstFoldingCreateIntConst() 149 ConstantInst *ConstFoldingCreateConst(Inst *inst, ConstantInst *cnst, bool isLiteralData = false) in ConstFoldingCreateConst() argument 151 …return ConstFoldingCreateIntConst(inst, ConvertIntToInt(static_cast<T>(cnst->GetIntValue()), inst-… in ConstFoldingCreateConst() 155 ConstantInst *ConstFoldingCastInt2Int(Inst *inst, ConstantInst *cnst) in ConstFoldingCastInt2Int() argument 157 switch (inst->GetInputType(0)) { in ConstFoldingCastInt2Int() 159 return ConstFoldingCreateConst<bool>(inst, cnst); in ConstFoldingCastInt2Int() 161 return ConstFoldingCreateConst<uint8_t>(inst, cnst); in ConstFoldingCastInt2Int() 163 return ConstFoldingCreateConst<int8_t>(inst, cnst); in ConstFoldingCastInt2Int() [all …]
|
D | locations_builder.cpp | 70 LOCATIONS_BUILDER(void)::ProcessManagedCall(Inst *inst, ParameterInfo *pinfo) in LOCATIONS_BUILDER() 73 LocationsInfo *locations = allocator->New<LocationsInfo>(allocator, inst); in LOCATIONS_BUILDER() 77 …if (inst->GetOpcode() != Opcode::CallResolvedVirtual && inst->GetOpcode() != Opcode::CallResolvedS… in LOCATIONS_BUILDER() 82 size_t inputsCount = inst->GetInputsCount() - (inst->RequireState() ? 1 : 0); in LOCATIONS_BUILDER() 85 ASSERT(inst->GetInputType(i) != DataType::NO_TYPE); in LOCATIONS_BUILDER() 86 auto param = pinfo->GetNextLocation(inst->GetInputType(i)); in LOCATIONS_BUILDER() 87 if (i == 0 && inst->IsIntrinsic() && inst->CastToIntrinsic()->HasIdInput()) { in LOCATIONS_BUILDER() 95 if (inst->IsIntrinsic() && stackArgs > 0) { in LOCATIONS_BUILDER() 96 inst->CastToIntrinsic()->SetArgumentsOnStack(); in LOCATIONS_BUILDER() 98 if (!inst->NoDest()) { in LOCATIONS_BUILDER() [all …]
|
D | const_folding.h | 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 ConstFoldingDiv(Inst *inst); 29 bool ConstFoldingMin(Inst *inst); 30 bool ConstFoldingMax(Inst *inst); [all …]
|
D | code_sink.cpp | 103 for (auto inst : block->InstsSafeReverse()) { in ProcessBlock() local 104 if (inst->IsCatchPhi() || !inst->HasUsers()) { in ProcessBlock() 107 if (inst->GetOpcode() == Opcode::Monitor || (inst->IsStore() && IsVolatileMemInst(inst)) || in ProcessBlock() 108 inst->GetFlag(compiler::inst_flags::HEAP_INV)) { in ProcessBlock() 114 BasicBlock *candidate = SinkInstruction(inst, &stores, memBarrier); in ProcessBlock() 116 … COMPILER_LOG(DEBUG, CODE_SINK) << "Sunk v" << inst->GetId() << " to BB " << candidate->GetId(); in ProcessBlock() 117 GetGraph()->GetEventWriter().EventCodeSink(inst->GetId(), inst->GetPc(), block->GetId(), in ProcessBlock() 119 block->EraseInst(inst, true); in ProcessBlock() 122 candidate->PrependInst(inst); in ProcessBlock() 129 static bool InstHasRefInput(Inst *inst) in InstHasRefInput() argument [all …]
|
D | licm.cpp | 101 bool AllInputsDominate(Inst *inst, Inst *dom) in AllInputsDominate() argument 103 for (auto input : inst->GetInputs()) { in AllInputsDominate() 111 void Licm::TryAppendHoistableInst(Inst *inst, BasicBlock *block, Loop *loop) in TryAppendHoistableInst() argument 114 …R_LOG(DEBUG, LICM_OPT) << "Limit is exceeded, Can't hoist instruction with id = " << inst->GetId(); in TryAppendHoistableInst() 117 if (inst->IsResolver()) { in TryAppendHoistableInst() 122 … << "Header is a loop exit, Can't hoist (resolver) instruction with id = " << inst->GetId(); in TryAppendHoistableInst() 127 hoistableInstructions_.push_back(inst); in TryAppendHoistableInst() 128 inst->SetMarker(markerHoistInst_); in TryAppendHoistableInst() 130 COMPILER_LOG(DEBUG, LICM_OPT) << "Hoist instruction with id = " << inst->GetId(); in TryAppendHoistableInst() 131 hoistableInstructions_.push_back(inst); in TryAppendHoistableInst() [all …]
|
D | memory_barriers.h | 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); 67 static void VisitCallStatic(GraphVisitor *v, Inst *inst); 68 static void VisitCallIndirect(GraphVisitor *v, Inst *inst); 69 static void VisitCall(GraphVisitor *v, Inst *inst); 70 static void VisitCallResolvedStatic(GraphVisitor *v, Inst *inst); 71 static void VisitCallVirtual(GraphVisitor *v, Inst *inst); 72 static void VisitCallResolvedVirtual(GraphVisitor *v, Inst *inst); [all …]
|
/arkcompiler/runtime_core/static_core/irtoc/lang/ |
D | ir_generator.rb | 37 func.constants.each { |_, inst| generate_instruction(inst) } 87 bb.instructions.each { |inst| generate_instruction(inst) } 90 def generate_instruction(inst) argument 91 … raise 'No LiveIn/LiveOut are allowed in IR Builder generator' if inst.IsLiveIn? || inst.IsLiveOut? 92 var_name = inst.local_var_name 93 Output << "// Inst #{inst}" 94 if inst.IsReturnVoid? 96 elsif inst.IsReturn? 97 raise "Return has #{inst.inputs.size}" if inst.inputs.size != 1 99 Output << "source_inst->ReplaceUsers(#{inst.inputs.first.local_var_name});" [all …]
|
/arkcompiler/runtime_core/static_core/compiler/optimizer/ir/ |
D | graph_checker.h | 88 void CheckInstUsers(Inst *inst, [[maybe_unused]] BasicBlock *block, Graph *graph); 96 bool CheckInstHasInput(Inst *inst, Inst *input); 97 bool CheckInstHasUser(Inst *inst, Inst *user); 100 void CheckSpillFillHolder(Inst *inst); 101 bool CheckInstRegUsageSaved(const Inst *inst, Register reg) const; 111 void CheckInputType(Inst *inst) const; 114 void PrepareUsers(Inst *inst, ArenaVector<User *> *users); 115 bool IsPhiSafeToSkipObjectCheck(Inst *inst, Marker visited); 116 bool IsPhiUserSafeToSkipObjectCheck(Inst *inst, Marker visited); 120 … void CheckSaveStateOsrRec(const Inst *inst, const Inst *user, BasicBlock *block, Marker visited); [all …]
|
D | graph_checker.cpp | 84 for (auto inst : block->AllInsts()) { in UserInputCheck() local 85 auto u = inst->GetFirstUser(); in UserInputCheck() 91 for (auto &user : inst->GetUsers()) { in UserInputCheck() 94 ASSERT_DO_EXT(CheckInstHasInput(userInst, inst), std::cerr in UserInputCheck() 96 … << "input: " << *inst << std::endl in UserInputCheck() 99 for (auto &input : inst->GetInputs()) { in UserInputCheck() 103 << "user: " << *inst << std::endl); in UserInputCheck() 104 ASSERT_DO_EXT(CheckInstHasUser(inputInst, inst), std::cerr in UserInputCheck() 106 … << "user: " << *inst << std::endl in UserInputCheck() 110 auto it = std::find_if(inst->GetInputs().begin(), inst->GetInputs().end(), in UserInputCheck() [all …]
|
D | ir_constructor.h | 125 auto inst = graph_->CreateInst(std::forward<Args>(args)...); in NewInst() local 126 inst->SetId(id); in NewInst() 127 for (size_t i = 0; i < inst->GetInputsCount(); ++i) { in NewInst() 128 inst->SetSrcReg(i, INVALID_REG); in NewInst() 130 currentInst_ = {id, inst}; in NewInst() 131 instMap_[id] = inst; in NewInst() 137 if (inst->IsPhi()) { in NewInst() 138 block->AppendPhi(inst); in NewInst() 140 block->AppendInst(inst); in NewInst() 143 if (inst->IsLowLevel()) { in NewInst() [all …]
|
/arkcompiler/runtime_core/static_core/bytecode_optimizer/ |
D | reg_acc_alloc.cpp | 29 compiler::Inst *inst = srcInst->GetNext(); in IsAccWriteBetween() local 31 while (inst != dstInst) { in IsAccWriteBetween() 32 if (UNLIKELY(inst == nullptr)) { in IsAccWriteBetween() 50 inst = *(block->AllInsts()); in IsAccWriteBetween() 52 if (inst->IsAccWrite()) { in IsAccWriteBetween() 53 if (!inst->IsConst()) { in IsAccWriteBetween() 56 if (inst->GetDstReg() == compiler::ACC_REG_ID) { in IsAccWriteBetween() 61 if (inst->IsAccRead()) { in IsAccWriteBetween() 62 compiler::Inst *input = inst->GetInput(AccReadIndex(inst)).GetInst(); in IsAccWriteBetween() 69 inst = inst->GetNext(); in IsAccWriteBetween() [all …]
|
D | canonicalization.cpp | 26 for (auto inst : bb->AllInsts()) { in RunImpl() local 27 if (inst->IsCommutative()) { in RunImpl() 28 visitor.VisitCommutative(inst); in RunImpl() 30 visitor.VisitInstruction(inst); in RunImpl() 37 static bool IsDominateReverseInputs(const compiler::Inst *inst) in IsDominateReverseInputs() argument 39 auto input0 = inst->GetInput(0U).GetInst(); in IsDominateReverseInputs() 40 auto input1 = inst->GetInput(1U).GetInst(); in IsDominateReverseInputs() 54 static bool BetterToSwapCompareInputs(const compiler::Inst *inst, const compiler::Inst *input0, in BetterToSwapCompareInputs() argument 64 compiler::DataType::Type type = inst->CastToCompare()->GetOperandsType(); in BetterToSwapCompareInputs() 70 static bool SwapInputsIfNecessary(compiler::Inst *inst, const bool necessary) in SwapInputsIfNecessary() argument [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() 49 static bool CanHoldRange(Inst *inst) in CanHoldRange() argument 51 switch (inst->GetOpcode()) { in CanHoldRange() 59 return IsIntrinsicRange(inst); in CanHoldRange() 70 for (const auto &inst : bb->AllInsts()) { in CalculateNumNeededRangeTemps() local 71 if (!CanHoldRange(inst)) { in CalculateNumNeededRangeTemps() 74 auto nargs = inst->GetInputsCount() - (inst->RequireState() ? 1U : 0U); in CalculateNumNeededRangeTemps() 75 if (inst->GetOpcode() == compiler::Opcode::InitObject) { in CalculateNumNeededRangeTemps() [all …]
|
/arkcompiler/runtime_core/bytecode_optimizer/ |
D | reg_acc_alloc.cpp | 31 compiler::Inst *inst = src_inst->GetNext(); in IsAccWriteBetween() local 33 while (inst != dst_inst) { in IsAccWriteBetween() 34 if (UNLIKELY(inst == nullptr)) { in IsAccWriteBetween() 52 inst = *(block->AllInsts()); in IsAccWriteBetween() 54 if (inst->IsAccWrite()) { in IsAccWriteBetween() 58 if (inst->IsAccRead()) { in IsAccWriteBetween() 59 compiler::Inst *input = inst->GetInput(AccReadIndex(inst)).GetInst(); in IsAccWriteBetween() 66 inst = inst->GetNext(); in IsAccWriteBetween() 85 bool RegAccAlloc::IsAccRead(compiler::Inst *inst) const in IsAccRead() 87 return UNLIKELY(inst->IsPhi()) ? IsPhiOptimizable(inst) : inst->IsAccRead(); in IsAccRead() [all …]
|
/arkcompiler/runtime_core/static_core/compiler/tests/ |
D | iterators_test.cpp | 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() 59 for (auto inst : block->InstsSafe()) { in Check() local 60 result.push_back(inst); in Check() [all …]
|
/arkcompiler/runtime_core/compiler/tests/ |
D | iterators_test.cpp | 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() 59 for (auto inst : block->InstsSafe()) { in Check() local 60 result.push_back(inst); in Check() [all …]
|
/arkcompiler/runtime_core/static_core/compiler/optimizer/ir_builder/ |
D | phi_resolver.h | 46 for (auto inst : bb->AllInstsSafe()) { in Run() local 47 if (!inst->IsPhi() && !inst->IsCatchPhi()) { in Run() 50 MarkPhiWithRealUsers(inst); in Run() 55 for (auto inst : bb->AllInstsSafe()) { in Run() local 56 if (!inst->IsPhi() && !inst->IsCatchPhi()) { in Run() 57 TryRemoveFromSaveStates(inst); in Run() 60 CheckPhiInputs(inst); in Run() 64 …if ((inst->IsPhi() || (inst->GetType() == DataType::ANY && inst->IsCatchPhi())) && inst->HasType()… in Run() 65 !inst->GetUsers().Empty()) { in Run() 66 TryRemoveFromSaveStates(inst); in Run() [all …]
|
/arkcompiler/runtime_core/compiler/optimizer/optimizations/ |
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 …]
|