1 //===- HexagonBitTracker.h --------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
10 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
12 #include "BitTracker.h"
13 #include "llvm/ADT/DenseMap.h"
18 class HexagonInstrInfo
;
19 class HexagonRegisterInfo
;
20 class MachineFrameInfo
;
21 class MachineFunction
;
23 class MachineRegisterInfo
;
25 struct HexagonEvaluator
: public BitTracker::MachineEvaluator
{
26 using CellMapType
= BitTracker::CellMapType
;
27 using RegisterRef
= BitTracker::RegisterRef
;
28 using RegisterCell
= BitTracker::RegisterCell
;
29 using BranchTargetList
= BitTracker::BranchTargetList
;
31 HexagonEvaluator(const HexagonRegisterInfo
&tri
, MachineRegisterInfo
&mri
,
32 const HexagonInstrInfo
&tii
, MachineFunction
&mf
);
34 bool evaluate(const MachineInstr
&MI
, const CellMapType
&Inputs
,
35 CellMapType
&Outputs
) const override
;
36 bool evaluate(const MachineInstr
&BI
, const CellMapType
&Inputs
,
37 BranchTargetList
&Targets
, bool &FallsThru
) const override
;
39 BitTracker::BitMask
mask(unsigned Reg
, unsigned Sub
) const override
;
41 uint16_t getPhysRegBitWidth(unsigned Reg
) const override
;
43 const TargetRegisterClass
&composeWithSubRegIndex(
44 const TargetRegisterClass
&RC
, unsigned Idx
) const override
;
47 MachineFrameInfo
&MFI
;
48 const HexagonInstrInfo
&TII
;
51 unsigned getUniqueDefVReg(const MachineInstr
&MI
) const;
52 bool evaluateLoad(const MachineInstr
&MI
, const CellMapType
&Inputs
,
53 CellMapType
&Outputs
) const;
54 bool evaluateFormalCopy(const MachineInstr
&MI
, const CellMapType
&Inputs
,
55 CellMapType
&Outputs
) const;
57 unsigned getNextPhysReg(unsigned PReg
, unsigned Width
) const;
58 unsigned getVirtRegFor(unsigned PReg
) const;
60 // Type of formal parameter extension.
65 ExtType(char t
, uint16_t w
) : Type(t
), Width(w
) {}
70 // Map VR -> extension type.
71 using RegExtMap
= DenseMap
<unsigned, ExtType
>;
75 } // end namespace llvm
77 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H