@@ -2520,54 +2520,6 @@ Instr::HoistSrc2(Js::OpCode assignOpcode, RegNum regNum, StackSym *newSym)
25202520 return newInstr;
25212521}
25222522
2523- // /----------------------------------------------------------------------------
2524- // /
2525- // / Instr::HoistIndirOffset
2526- // /
2527- // / Replace the offset of the given indir with a new symbol, which becomes the indir index.
2528- // / Assign the new symbol by creating an assignment from the constant offset.
2529- // /
2530- // /----------------------------------------------------------------------------
2531-
2532- Instr *
2533- Instr::HoistIndirOffset (IR::IndirOpnd *indirOpnd, RegNum regNum)
2534- {
2535- int32 offset = indirOpnd->GetOffset ();
2536- if (indirOpnd->GetIndexOpnd ())
2537- {
2538- Assert (indirOpnd->GetBaseOpnd ());
2539- return HoistIndirOffsetAsAdd (indirOpnd, indirOpnd->GetBaseOpnd (), offset, regNum);
2540- }
2541- IntConstOpnd *offsetOpnd = IntConstOpnd::New (offset, TyInt32, this ->m_func );
2542- RegOpnd *indexOpnd = RegOpnd::New (StackSym::New (TyMachReg, this ->m_func ), regNum, TyMachReg, this ->m_func );
2543-
2544- #if defined(DBG) && defined(_M_ARM)
2545- if (regNum == SCRATCH_REG)
2546- {
2547- AssertMsg (indirOpnd->GetBaseOpnd ()->GetReg ()!= SCRATCH_REG, " Why both are SCRATCH_REG" );
2548- if (this ->GetSrc1 () && this ->GetSrc1 ()->IsRegOpnd ())
2549- {
2550- Assert (this ->GetSrc1 ()->AsRegOpnd ()->GetReg () != SCRATCH_REG);
2551- }
2552- if (this ->GetSrc2 () && this ->GetSrc2 ()->IsRegOpnd ())
2553- {
2554- Assert (this ->GetSrc2 ()->AsRegOpnd ()->GetReg () != SCRATCH_REG);
2555- }
2556- if (this ->GetDst () && this ->GetDst ()->IsRegOpnd ())
2557- {
2558- Assert (this ->GetDst ()->AsRegOpnd ()->GetReg () != SCRATCH_REG);
2559- }
2560- }
2561- #endif
2562- // Clear the offset and add a new reg as the index.
2563- indirOpnd->SetOffset (0 );
2564- indirOpnd->SetIndexOpnd (indexOpnd);
2565-
2566- Instr *instrAssign = Lowerer::InsertMove (indexOpnd, offsetOpnd, this );
2567- indexOpnd->m_sym ->SetIsIntConst (offset);
2568- return instrAssign;
2569- }
2570-
25712523IndirOpnd *
25722524Instr::HoistMemRefAddress (MemRefOpnd *const memRefOpnd, const Js::OpCode loadOpCode)
25732525{
@@ -2640,71 +2592,6 @@ Opnd *Instr::DeepReplace(Opnd *const oldOpnd, Opnd *const newOpnd)
26402592 return Replace (oldOpnd, newOpnd);
26412593}
26422594
2643- Instr *
2644- Instr::HoistIndirOffsetAsAdd (IR::IndirOpnd *orgOpnd, IR::Opnd *baseOpnd, int offset, RegNum regNum)
2645- {
2646- IR::RegOpnd *newBaseOpnd = IR::RegOpnd::New (StackSym::New (TyMachPtr, this ->m_func ), regNum, TyMachPtr, this ->m_func );
2647-
2648- IR::IntConstOpnd *src2 = IR::IntConstOpnd::New (offset, TyInt32, this ->m_func );
2649- IR::Instr * instrAdd = IR::Instr::New (Js::OpCode::ADD, newBaseOpnd, baseOpnd, src2, this ->m_func );
2650-
2651- this ->InsertBefore (instrAdd);
2652-
2653- orgOpnd->ReplaceBaseOpnd (newBaseOpnd);
2654- orgOpnd->SetOffset (0 );
2655-
2656- return instrAdd;
2657- }
2658-
2659- Instr *
2660- Instr::HoistIndirIndexOpndAsAdd (IR::IndirOpnd *orgOpnd, IR::Opnd *baseOpnd, IR::Opnd *indexOpnd, RegNum regNum)
2661- {
2662- IR::RegOpnd *newBaseOpnd = IR::RegOpnd::New (StackSym::New (TyMachPtr, this ->m_func ), regNum, TyMachPtr, this ->m_func );
2663-
2664- IR::Instr * instrAdd = IR::Instr::New (Js::OpCode::ADD, newBaseOpnd, baseOpnd, indexOpnd->UseWithNewType (TyMachPtr, this ->m_func ), this ->m_func );
2665-
2666- this ->InsertBefore (instrAdd);
2667-
2668- orgOpnd->ReplaceBaseOpnd (newBaseOpnd);
2669- orgOpnd->SetIndexOpnd (nullptr );
2670-
2671- return instrAdd;
2672- }
2673-
2674- Instr *
2675- Instr::HoistSymOffsetAsAdd (IR::SymOpnd *orgOpnd, IR::Opnd *baseOpnd, int offset, RegNum regNum)
2676- {
2677- IR::IndirOpnd *newIndirOpnd = IR::IndirOpnd::New (baseOpnd->AsRegOpnd (), 0 , TyMachPtr, this ->m_func );
2678- this ->Replace (orgOpnd, newIndirOpnd); // Replace SymOpnd with IndirOpnd
2679- return this ->HoistIndirOffsetAsAdd (newIndirOpnd, baseOpnd, offset, regNum);
2680- }
2681-
2682- // /----------------------------------------------------------------------------
2683- // /
2684- // / Instr::HoistSymOffset
2685- // /
2686- // / Replace the given sym with an indir using the given base and offset.
2687- // / (This is used, for instance, to hoist a sym offset that is too large to encode.)
2688- // /
2689- // /----------------------------------------------------------------------------
2690-
2691- Instr *
2692- Instr::HoistSymOffset (SymOpnd *symOpnd, RegNum baseReg, uint32 offset, RegNum regNum)
2693- {
2694- IR::RegOpnd *baseOpnd = IR::RegOpnd::New (nullptr , baseReg, TyMachPtr, this ->m_func );
2695- IR::IndirOpnd *indirOpnd = IR::IndirOpnd::New (baseOpnd, offset, symOpnd->GetType (), this ->m_func );
2696- if (symOpnd == this ->GetDst ())
2697- {
2698- this ->ReplaceDst (indirOpnd);
2699- }
2700- else
2701- {
2702- this ->ReplaceSrc (symOpnd, indirOpnd);
2703- }
2704-
2705- return this ->HoistIndirOffset (indirOpnd, regNum);
2706- }
2707-
27082595Opnd *
27092596Instr::UnlinkSrc (Opnd *src)
27102597{
0 commit comments