/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/Hexagon/HexagonBitTracker.h
Line | Count | Source |
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 | | class MachineFrameInfo; |
22 | | class MachineFunction; |
23 | | class MachineInstr; |
24 | | class MachineRegisterInfo; |
25 | | |
26 | | struct HexagonEvaluator : public BitTracker::MachineEvaluator { |
27 | | using CellMapType = BitTracker::CellMapType; |
28 | | using RegisterRef = BitTracker::RegisterRef; |
29 | | using RegisterCell = BitTracker::RegisterCell; |
30 | | using BranchTargetList = BitTracker::BranchTargetList; |
31 | | |
32 | | HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri, |
33 | | const HexagonInstrInfo &tii, MachineFunction &mf); |
34 | | |
35 | | bool evaluate(const MachineInstr &MI, const CellMapType &Inputs, |
36 | | CellMapType &Outputs) const override; |
37 | | bool evaluate(const MachineInstr &BI, const CellMapType &Inputs, |
38 | | BranchTargetList &Targets, bool &FallsThru) const override; |
39 | | |
40 | | BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override; |
41 | | |
42 | | uint16_t getPhysRegBitWidth(unsigned Reg) const override; |
43 | | |
44 | | const TargetRegisterClass &composeWithSubRegIndex( |
45 | | const TargetRegisterClass &RC, unsigned Idx) const override; |
46 | | |
47 | | MachineFunction &MF; |
48 | | MachineFrameInfo &MFI; |
49 | | const HexagonInstrInfo &TII; |
50 | | |
51 | | private: |
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; |
56 | | |
57 | | unsigned getNextPhysReg(unsigned PReg, unsigned Width) const; |
58 | | unsigned getVirtRegFor(unsigned PReg) const; |
59 | | |
60 | | // Type of formal parameter extension. |
61 | | struct ExtType { |
62 | | enum { SExt, ZExt }; |
63 | | |
64 | | ExtType() = default; |
65 | 475 | ExtType(char t, uint16_t w) : Type(t), Width(w) {} |
66 | | |
67 | | char Type = 0; |
68 | | uint16_t Width = 0; |
69 | | }; |
70 | | // Map VR -> extension type. |
71 | | using RegExtMap = DenseMap<unsigned, ExtType>; |
72 | | RegExtMap VRX; |
73 | | }; |
74 | | |
75 | | } // end namespace llvm |
76 | | |
77 | | #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H |