ARMWinEH.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //===-- ARMWinEH.cpp - Windows on ARM EH Support Functions ------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "llvm/Support/ARMWinEH.h"
  9. namespace llvm {
  10. namespace ARM {
  11. namespace WinEH {
  12. std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF) {
  13. uint8_t NumRegisters = RF.Reg();
  14. uint8_t RegistersVFP = RF.R();
  15. uint8_t LinkRegister = RF.L();
  16. uint8_t ChainedFrame = RF.C();
  17. uint16_t GPRMask = (ChainedFrame << 11) | (LinkRegister << 14);
  18. uint32_t VFPMask = 0;
  19. if (RegistersVFP)
  20. VFPMask |= (((1 << ((NumRegisters + 1) % 8)) - 1) << 8);
  21. else
  22. GPRMask |= (((1 << (NumRegisters + 1)) - 1) << 4);
  23. if (PrologueFolding(RF))
  24. GPRMask |= (((1 << (NumRegisters + 1)) - 1) << (~RF.StackAdjust() & 0x3));
  25. return std::make_pair(GPRMask, VFPMask);
  26. }
  27. } // namespace WinEH
  28. } // namespace ARM
  29. } // namespace llvm