LinearScanMD.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 LinearScan;
  7. class OpHelperBlock;
  8. class BailOutRecord;
  9. class BranchBailOutRecord;
  10. class LinearScanMD : public LinearScanMDShared
  11. {
  12. private:
  13. BitVector byteableRegsBv;
  14. StackSym *xmmSymTable128[XMM_REGCOUNT];
  15. StackSym *xmmSymTable64[XMM_REGCOUNT];
  16. StackSym *xmmSymTable32[XMM_REGCOUNT];
  17. Func *func;
  18. public:
  19. LinearScanMD(Func *func);
  20. bool IsAllocatable(RegNum reg, Func *func) const { return true; }
  21. BitVector FilterRegIntSizeConstraints(BitVector regsBv, BitVector sizeUsageBv) const;
  22. bool FitRegIntSizeConstraints(RegNum reg, BitVector sizeUsageBv) const;
  23. bool FitRegIntSizeConstraints(RegNum reg, IRType type) const;
  24. uint UnAllocatableRegCount(Func *func) const { return 2; }
  25. StackSym *EnsureSpillSymForXmmReg(RegNum reg, Func *func, IRType type);
  26. void LegalizeDef(IR::Instr * instr) { /* This is a nop for x86 */ }
  27. void LegalizeUse(IR::Instr * instr, IR::Opnd * opnd) { /* A nop for x86 */ }
  28. void LegalizeConstantUse(IR::Instr * instr, IR::Opnd * opnd) { /* A nop for x86 */ }
  29. void GenerateBailOut(IR::Instr * instr, __in_ecount(registerSaveSymsCount) StackSym ** registerSaveSyms, uint registerSaveSymsCount);
  30. IR::Instr *GenerateBailInForGeneratorYield(IR::Instr * resumeLabelInstr, BailOutInfo * bailOutInfo);
  31. void InsertOpHelperSpillAndRestores(SList<OpHelperBlock> *opHelperBlockList);
  32. void EndOfHelperBlock(uint32 helperSpilledLiveranges) { /* NOP */ }
  33. private:
  34. static void SaveAllRegisters(BailOutRecord *const bailOutRecord);
  35. static void SaveAllRegistersNoSse2(BailOutRecord *const bailOutRecord);
  36. public:
  37. static void SaveAllRegistersAndBailOut(BailOutRecord *const bailOutRecord);
  38. static void SaveAllRegistersNoSse2AndBailOut(BailOutRecord *const bailOutRecord);
  39. static void SaveAllRegistersAndBranchBailOut(BranchBailOutRecord *const bailOutRecord, const BOOL condition);
  40. static void SaveAllRegistersNoSse2AndBranchBailOut(BranchBailOutRecord *const bailOutRecord, const BOOL condition);
  41. public:
  42. static uint GetRegisterSaveSlotCount() {
  43. return RegisterSaveSlotCount;
  44. }
  45. static uint GetRegisterSaveIndex(RegNum reg);
  46. static RegNum GetRegisterFromSaveIndex(uint offset);
  47. // All regs, including XMMs, plus extra slot space for XMMs (1 XMM = 4 Vars)
  48. static const uint RegisterSaveSlotCount = RegNumCount + 3 * XMM_REGCOUNT;
  49. private:
  50. void InsertOpHelperSpillsAndRestores(const OpHelperBlock& opHelperBlock);
  51. };