1 //===--- HexagonBitTracker.h ----------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef HEXAGONBITTRACKER_H
11 #define HEXAGONBITTRACKER_H
13 #include "BitTracker.h"
14 #include "llvm/ADT/DenseMap.h"
17 class HexagonInstrInfo;
18 class HexagonRegisterInfo;
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;
26 HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
27 const HexagonInstrInfo &tii, MachineFunction &mf);
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;
34 BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
37 MachineFrameInfo &MFI;
38 const HexagonInstrInfo &TII;
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;
46 unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
47 unsigned getVirtRegFor(unsigned PReg) const;
49 // Type of formal parameter extension.
54 ExtType() : Type(0), Width(0) {}
55 ExtType(char t, uint16_t w) : Type(t), Width(w) {}
57 // Map VR -> extension type.
58 typedef DenseMap<unsigned, ExtType> RegExtMap;
62 } // end namespace llvm