[X86][SSE] Vectorized v4i32 non-uniform shifts.
[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
21 struct HexagonEvaluator : public BitTracker::MachineEvaluator {
22   typedef BitTracker::CellMapType CellMapType;
23   typedef BitTracker::RegisterRef RegisterRef;
24   typedef BitTracker::RegisterCell RegisterCell;
25   typedef BitTracker::BranchTargetList BranchTargetList;
26
27   HexagonEvaluator(const llvm::HexagonRegisterInfo &tri,
28         llvm::MachineRegisterInfo &mri, const llvm::HexagonInstrInfo &tii,
29         llvm::MachineFunction &mf);
30
31   virtual bool evaluate(const llvm::MachineInstr *MI,
32         const CellMapType &Inputs, CellMapType &Outputs) const;
33   virtual bool evaluate(const llvm::MachineInstr *BI,
34         const CellMapType &Inputs, BranchTargetList &Targets,
35         bool &FallsThru) const;
36
37   virtual BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const;
38
39   llvm::MachineFunction &MF;
40   llvm::MachineFrameInfo &MFI;
41   const llvm::HexagonInstrInfo &TII;
42
43 private:
44   bool evaluateLoad(const llvm::MachineInstr *MI, const CellMapType &Inputs,
45         CellMapType &Outputs) const;
46   bool evaluateFormalCopy(const llvm::MachineInstr *MI,
47         const CellMapType &Inputs, CellMapType &Outputs) const;
48
49   unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
50   unsigned getVirtRegFor(unsigned PReg) const;
51
52   // Type of formal parameter extension.
53   struct ExtType {
54     enum { SExt, ZExt };
55     char Type;
56     uint16_t Width;
57     ExtType() : Type(0), Width(0) {}
58     ExtType(char t, uint16_t w) : Type(t), Width(w) {}
59   };
60   // Map VR -> extension type.
61   typedef llvm::DenseMap<unsigned,ExtType> RegExtMap;
62   RegExtMap VRX;
63 };
64
65 #endif
66