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
15#ifndef LLVM_LIB_TARGET_ARM_THUMB1REGISTERINFO_H
16#define LLVM_LIB_TARGET_ARM_THUMB1REGISTERINFO_H
17
18#include "ARMBaseRegisterInfo.h"
19#include "llvm/CodeGen/TargetRegisterInfo.h"
20
21namespace llvm {
22 class ARMSubtarget;
23 class ARMBaseInstrInfo;
24
25struct ThumbRegisterInfo : public ARMBaseRegisterInfo {
26private:
27 const bool IsThumb1Only;
28
29public:
30 explicit ThumbRegisterInfo(const ARMSubtarget &STI);
31
32 const TargetRegisterClass *
33 getLargestLegalSuperClass(const TargetRegisterClass *RC,
34 const MachineFunction &MF) const override;
35
36 /// emitLoadConstPool - Emits a load from constpool to materialize the
37 /// specified immediate.
38 void
39 emitLoadConstPool(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
40 const DebugLoc &dl, Register DestReg, unsigned SubIdx,
41 int Val, ARMCC::CondCodes Pred = ARMCC::AL,
42 Register PredReg = Register(),
43 unsigned MIFlags = MachineInstr::NoFlags) const override;
44
45 // rewrite MI to access 'Offset' bytes from the FP. Update Offset to be
46 // however much remains to be handled. Return 'true' if no further
47 // work is required.
48 bool rewriteFrameIndex(MachineBasicBlock::iterator II, unsigned FrameRegIdx,
49 Register FrameReg, int &Offset,
50 const ARMBaseInstrInfo &TII) const;
51 void resolveFrameIndex(MachineInstr &MI, Register BaseReg,
52 int64_t Offset) const override;
53 bool eliminateFrameIndex(MachineBasicBlock::iterator II,
54 int SPAdj, unsigned FIOperandNum,
55 RegScavenger *RS = nullptr) const override;
56 bool useFPForScavengingIndex(const MachineFunction &MF) const override;
57};
58}
59
60#endif
61