ThumbRegisterInfo.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //===- ThumbRegisterInfo.h - Thumb Register Information Impl -*- 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. //
  9. // This file contains the Thumb implementation of the TargetRegisterInfo
  10. // class. With the exception of emitLoadConstPool Thumb2 tracks
  11. // ARMBaseRegisterInfo, Thumb1 overloads the functions below.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_LIB_TARGET_ARM_THUMB1REGISTERINFO_H
  15. #define LLVM_LIB_TARGET_ARM_THUMB1REGISTERINFO_H
  16. #include "ARMBaseRegisterInfo.h"
  17. #include "llvm/CodeGen/TargetRegisterInfo.h"
  18. namespace llvm {
  19. class ARMSubtarget;
  20. class ARMBaseInstrInfo;
  21. struct ThumbRegisterInfo : public ARMBaseRegisterInfo {
  22. public:
  23. ThumbRegisterInfo();
  24. const TargetRegisterClass *
  25. getLargestLegalSuperClass(const TargetRegisterClass *RC,
  26. const MachineFunction &MF) const override;
  27. const TargetRegisterClass *
  28. getPointerRegClass(const MachineFunction &MF,
  29. unsigned Kind = 0) const override;
  30. /// emitLoadConstPool - Emits a load from constpool to materialize the
  31. /// specified immediate.
  32. void
  33. emitLoadConstPool(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
  34. const DebugLoc &dl, Register DestReg, unsigned SubIdx,
  35. int Val, ARMCC::CondCodes Pred = ARMCC::AL,
  36. Register PredReg = Register(),
  37. unsigned MIFlags = MachineInstr::NoFlags) const override;
  38. // rewrite MI to access 'Offset' bytes from the FP. Update Offset to be
  39. // however much remains to be handled. Return 'true' if no further
  40. // work is required.
  41. bool rewriteFrameIndex(MachineBasicBlock::iterator II, unsigned FrameRegIdx,
  42. Register FrameReg, int &Offset,
  43. const ARMBaseInstrInfo &TII) const;
  44. void resolveFrameIndex(MachineInstr &MI, Register BaseReg,
  45. int64_t Offset) const override;
  46. bool eliminateFrameIndex(MachineBasicBlock::iterator II,
  47. int SPAdj, unsigned FIOperandNum,
  48. RegScavenger *RS = nullptr) const override;
  49. bool useFPForScavengingIndex(const MachineFunction &MF) const override;
  50. };
  51. }
  52. #endif