LinearScanMD.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. class OpHelperBlock;
  7. class LinearScan;
  8. class BailOutRecord;
  9. class BranchBailOutRecord;
  10. class LinearScanMD : public LinearScanMDShared
  11. {
  12. private:
  13. StackSym ** helperSpillSlots;
  14. Func * func;
  15. uint32 maxOpHelperSpilledLiveranges;
  16. StackSym *vfpSymTable[VFP_REGCOUNT];
  17. public:
  18. LinearScanMD(Func *func);
  19. void Init(LinearScan *linearScan);
  20. BitVector FilterRegIntSizeConstraints(BitVector regsBv, BitVector sizeUsageBv) const;
  21. bool FitRegIntSizeConstraints(RegNum reg, BitVector sizeUsageBv) const;
  22. bool FitRegIntSizeConstraints(RegNum reg, IRType type) const;
  23. void InsertOpHelperSpillAndRestores(SList<OpHelperBlock> *opHelperBlockList);
  24. void EndOfHelperBlock(uint32 helperSpilledLiveranges);
  25. uint UnAllocatableRegCount(Func *func) const
  26. {
  27. return func->GetLocalsPointer() != RegSP ? 5 : 4; //r11(Frame Pointer),r12,sp,pc
  28. }
  29. StackSym *EnsureSpillSymForVFPReg(RegNum reg, Func *func);
  30. void LegalizeDef(IR::Instr * instr);
  31. void LegalizeUse(IR::Instr * instr, IR::Opnd * opnd);
  32. void LegalizeConstantUse(IR::Instr * instr, IR::Opnd * opnd) { /* no op for arm */ }
  33. void GenerateBailOut(IR::Instr * instr, __in_ecount(registerSaveSymsCount) StackSym ** registerSaveSyms, uint registerSaveSymsCount);
  34. private:
  35. static void SaveAllRegisters(BailOutRecord *const bailOutRecord);
  36. public:
  37. static void SaveAllRegistersAndBailOut(BailOutRecord *const bailOutRecord);
  38. static void SaveAllRegistersAndBranchBailOut(BranchBailOutRecord *const bailOutRecord, const BOOL condition);
  39. static RegNum GetParamReg(IR::SymOpnd *symOpnd, Func *func);
  40. bool IsAllocatable(RegNum reg, Func *func) const;
  41. static uint GetRegisterSaveSlotCount() {
  42. return RegisterSaveSlotCount ;
  43. }
  44. static uint GetRegisterSaveIndex(RegNum reg);
  45. static RegNum GetRegisterFromSaveIndex(uint offset);
  46. static const uint RegisterSaveSlotCount = RegNumCount + VFP_REGCOUNT;
  47. private:
  48. bool LegalizeOffset(IR::Instr * instr, IR::Opnd * opnd);
  49. bool LegalizeLEA(IR::Instr * instr, IR::SymOpnd * opnd);
  50. void InsertOpHelperSpillsAndRestores(const OpHelperBlock& opHelperBlock);
  51. };