Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 1 | //===--- HexagonBitTracker.h ----------------------------------------------===// |
| 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 HEXAGONBITTRACKER_H |
| 11 | #define HEXAGONBITTRACKER_H |
| 12 | |
| 13 | #include "BitTracker.h" |
| 14 | #include "llvm/ADT/DenseMap.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | class HexagonInstrInfo; |
| 18 | class HexagonRegisterInfo; |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 19 | |
| 20 | struct HexagonEvaluator : public BitTracker::MachineEvaluator { |
| 21 | typedef BitTracker::CellMapType CellMapType; |
| 22 | typedef BitTracker::RegisterRef RegisterRef; |
| 23 | typedef BitTracker::RegisterCell RegisterCell; |
| 24 | typedef BitTracker::BranchTargetList BranchTargetList; |
| 25 | |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 26 | HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri, |
| 27 | const HexagonInstrInfo &tii, MachineFunction &mf); |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 28 | |
Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 29 | bool evaluate(const MachineInstr &MI, const CellMapType &Inputs, |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 30 | CellMapType &Outputs) const override; |
Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 31 | bool evaluate(const MachineInstr &BI, const CellMapType &Inputs, |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 32 | BranchTargetList &Targets, bool &FallsThru) const override; |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 33 | |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 34 | BitTracker::BitMask mask(unsigned Reg, unsigned Sub) 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 | MachineFunction &MF; |
| 37 | MachineFrameInfo &MFI; |
| 38 | const HexagonInstrInfo &TII; |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 39 | |
| 40 | private: |
Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 41 | bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs, |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 42 | CellMapType &Outputs) const; |
Duncan P. N. Exon Smith | 98226e3 | 2016-07-12 01:55:32 +0000 | [diff] [blame] | 43 | bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs, |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 44 | CellMapType &Outputs) const; |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 45 | |
| 46 | unsigned getNextPhysReg(unsigned PReg, unsigned Width) const; |
| 47 | unsigned getVirtRegFor(unsigned PReg) const; |
| 48 | |
| 49 | // Type of formal parameter extension. |
| 50 | struct ExtType { |
| 51 | enum { SExt, ZExt }; |
| 52 | char Type; |
| 53 | uint16_t Width; |
| 54 | ExtType() : Type(0), Width(0) {} |
| 55 | ExtType(char t, uint16_t w) : Type(t), Width(w) {} |
| 56 | }; |
| 57 | // Map VR -> extension type. |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 58 | typedef DenseMap<unsigned, ExtType> RegExtMap; |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 59 | RegExtMap VRX; |
| 60 | }; |
| 61 | |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 62 | } // end namespace llvm |
Krzysztof Parzyszek | e53b31a | 2015-07-07 15:16:42 +0000 | [diff] [blame] | 63 | |
Benjamin Kramer | d886151 | 2015-07-13 20:38:16 +0000 | [diff] [blame] | 64 | #endif |