ARMWinEH.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===-- ARMWinEH.cpp - Windows on ARM EH Support Functions ------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #include "llvm/Support/ARMWinEH.h"
  10. #include "llvm/Support/raw_ostream.h"
  11. namespace llvm {
  12. namespace ARM {
  13. namespace WinEH {
  14. std::pair<uint16_t, uint32_t> SavedRegisterMask(const RuntimeFunction &RF) {
  15. uint8_t NumRegisters = RF.Reg();
  16. uint8_t RegistersVFP = RF.R();
  17. uint8_t LinkRegister = RF.L();
  18. uint8_t ChainedFrame = RF.C();
  19. uint16_t GPRMask = (ChainedFrame << 11) | (LinkRegister << 14);
  20. uint32_t VFPMask = 0;
  21. if (RegistersVFP)
  22. VFPMask |= (((1 << ((NumRegisters + 1) % 8)) - 1) << 8);
  23. else
  24. GPRMask |= (((1 << (NumRegisters + 1)) - 1) << 4);
  25. if (PrologueFolding(RF))
  26. GPRMask |= (((1 << (NumRegisters + 1)) - 1) << (~RF.StackAdjust() & 0x3));
  27. return std::make_pair(GPRMask, VFPMask);
  28. }
  29. }
  30. }
  31. }