[Hexagon] Hexagon V60 HVX intrinsic defintions
[oota-llvm.git] / lib / Target / Hexagon / HexagonBitTracker.h
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;
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
26   HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
27                    const HexagonInstrInfo &tii, MachineFunction &mf);
28
29   bool evaluate(const MachineInstr *MI, const CellMapType &Inputs,
30                 CellMapType &Outputs) const override;
31   bool evaluate(const MachineInstr *BI, const CellMapType &Inputs,
32                 BranchTargetList &Targets, bool &FallsThru) const override;
33
34   BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
35
36   MachineFunction &MF;
37   MachineFrameInfo &MFI;
38   const HexagonInstrInfo &TII;
39
40 private:
41   bool evaluateLoad(const MachineInstr *MI, const CellMapType &Inputs,
42                     CellMapType &Outputs) const;
43   bool evaluateFormalCopy(const MachineInstr *MI, const CellMapType &Inputs,
44                           CellMapType &Outputs) const;
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.
58   typedef DenseMap<unsigned, ExtType> RegExtMap;
59   RegExtMap VRX;
60 };
61
62 } // end namespace llvm
63
64 #endif