]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Hexagon/HexagonBitTracker.h
Merge llvm, clang, lld and lldb trunk r291012, and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Hexagon / HexagonBitTracker.h
1 //===--- HexagonBitTracker.h ------------------------------------*- 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
10 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
11 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
12
13 #include "BitTracker.h"
14 #include "llvm/ADT/DenseMap.h"
15 #include <cstdint>
16
17 namespace llvm {
18
19 class HexagonInstrInfo;
20 class HexagonRegisterInfo;
21
22 struct HexagonEvaluator : public BitTracker::MachineEvaluator {
23   typedef BitTracker::CellMapType CellMapType;
24   typedef BitTracker::RegisterRef RegisterRef;
25   typedef BitTracker::RegisterCell RegisterCell;
26   typedef BitTracker::BranchTargetList BranchTargetList;
27
28   HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
29                    const HexagonInstrInfo &tii, MachineFunction &mf);
30
31   bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
32                 CellMapType &Outputs) const override;
33   bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
34                 BranchTargetList &Targets, bool &FallsThru) const override;
35
36   BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
37
38   MachineFunction &MF;
39   MachineFrameInfo &MFI;
40   const HexagonInstrInfo &TII;
41
42 private:
43   bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,
44                     CellMapType &Outputs) const;
45   bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,
46                           CellMapType &Outputs) const;
47
48   unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
49   unsigned getVirtRegFor(unsigned PReg) const;
50
51   // Type of formal parameter extension.
52   struct ExtType {
53     enum { SExt, ZExt };
54
55     ExtType() = default;
56     ExtType(char t, uint16_t w) : Type(t), Width(w) {}
57
58     char Type = 0;
59     uint16_t Width = 0;
60   };
61   // Map VR -> extension type.
62   typedef DenseMap<unsigned, ExtType> RegExtMap;
63   RegExtMap VRX;
64 };
65
66 } // end namespace llvm
67
68 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H