PeepsMD.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #include "Backend.h"
  6. static const uint8 RegAttribs[RegNumCount] =
  7. {
  8. #define REGDAT(Name, ListName, Encode, Type, Attribs) Attribs,
  9. #include "RegList.h"
  10. #undef REGDAT
  11. };
  12. // PeepsMD::Init
  13. void
  14. PeepsMD::Init(Peeps *peeps)
  15. {
  16. this->peeps = peeps;
  17. }
  18. // PeepsMD::ProcessImplicitRegs
  19. void
  20. PeepsMD::ProcessImplicitRegs(IR::Instr *instr)
  21. {
  22. if (LowererMD::IsCall(instr))
  23. {
  24. FOREACH_REG(reg)
  25. {
  26. // not DONTALLOCATE, not CALLEESAVED
  27. if (RegAttribs[reg] == 0)
  28. {
  29. this->peeps->ClearReg(reg);
  30. }
  31. } NEXT_REG
  32. // The SCRATCH_REG (RegR17) is marked DONTALLOCATE, so it will be missed above.
  33. Assert(RegAttribs[SCRATCH_REG] & RA_DONTALLOCATE);
  34. this->peeps->ClearReg(SCRATCH_REG);
  35. }
  36. else if (instr->m_opcode == Js::OpCode::SMULL ||
  37. instr->m_opcode == Js::OpCode::SMADDL)
  38. {
  39. // As we don't currently have support for 4 operand instrs, we use R17 as 4th operand,
  40. // Notify the peeps that we use r17: SMULL, dst, r12, src1, src2.
  41. this->peeps->ClearReg(SCRATCH_REG);
  42. }
  43. }
  44. void
  45. PeepsMD::PeepAssign(IR::Instr *instr)
  46. {
  47. return;
  48. }