| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 1 | //===--- HexagonBitTracker.h ------------------------------------*- C++ -*-===// |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 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 | |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H |
| 11 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 12 | |
| 13 | #include "BitTracker.h" |
| 14 | #include "llvm/ADT/DenseMap.h" |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 15 | #include <cstdint> |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 16 | |
| 17 | namespace llvm { |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 18 | |
| 19 | class HexagonInstrInfo; |
| 20 | class HexagonRegisterInfo; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 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 | |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 28 | HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri, |
| 29 | const HexagonInstrInfo &tii, MachineFunction &mf); |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 30 | |
| Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 31 | bool evaluate(const MachineInstr &MI, const CellMapType &Inputs, |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 32 | CellMapType &Outputs) const override; |
| Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 33 | bool evaluate(const MachineInstr &BI, const CellMapType &Inputs, |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 34 | BranchTargetList &Targets, bool &FallsThru) const override; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 35 | |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 36 | BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 37 | |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 38 | MachineFunction &MF; |
| 39 | MachineFrameInfo &MFI; |
| 40 | const HexagonInstrInfo &TII; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 41 | |
| 42 | private: |
| Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 43 | bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs, |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 44 | CellMapType &Outputs) const; |
| Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 45 | bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs, |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 46 | CellMapType &Outputs) const; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 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 }; |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 54 | |
| 55 | ExtType() = default; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 56 | ExtType(char t, uint16_t w) : Type(t), Width(w) {} |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 57 | |
| 58 | char Type = 0; |
| 59 | uint16_t Width = 0; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 60 | }; |
| 61 | // Map VR -> extension type. |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 62 | typedef DenseMap<unsigned, ExtType> RegExtMap; |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 63 | RegExtMap VRX; |
| 64 | }; |
| 65 | |
| Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 66 | } // end namespace llvm |
| Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 67 | |
| Eugene Zelenko | b2ca1b3 | 2017-01-04 02:02:05 +0000 | [diff] [blame] | 68 | #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H |