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;
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;
27 HexagonEvaluator(const llvm::HexagonRegisterInfo &tri,
28 llvm::MachineRegisterInfo &mri, const llvm::HexagonInstrInfo &tii,
29 llvm::MachineFunction &mf);
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;
37 virtual BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const;
39 llvm::MachineFunction &MF;
40 llvm::MachineFrameInfo &MFI;
41 const llvm::HexagonInstrInfo &TII;
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;
49 unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
50 unsigned getVirtRegFor(unsigned PReg) const;
52 // Type of formal parameter extension.
57 ExtType() : Type(0), Width(0) {}
58 ExtType(char t, uint16_t w) : Type(t), Width(w) {}
60 // Map VR -> extension type.
61 typedef llvm::DenseMap<unsigned,ExtType> RegExtMap;