blob: 9e7b1dbe298f626c9d324da74d63a6dc76ef7cdd [file] [log] [blame]
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +00001//===--- 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
16namespace llvm {
17 class HexagonInstrInfo;
18 class HexagonRegisterInfo;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000019
20struct 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 Kramerd8861512015-07-13 20:38:16 +000026 HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
27 const HexagonInstrInfo &tii, MachineFunction &mf);
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000028
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000029 bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000030 CellMapType &Outputs) const override;
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000031 bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000032 BranchTargetList &Targets, bool &FallsThru) const override;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000033
Benjamin Kramerd8861512015-07-13 20:38:16 +000034 BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000035
Benjamin Kramerd8861512015-07-13 20:38:16 +000036 MachineFunction &MF;
37 MachineFrameInfo &MFI;
38 const HexagonInstrInfo &TII;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000039
40private:
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000041 bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000042 CellMapType &Outputs) const;
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000043 bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000044 CellMapType &Outputs) const;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000045
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 Kramerd8861512015-07-13 20:38:16 +000058 typedef DenseMap<unsigned, ExtType> RegExtMap;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000059 RegExtMap VRX;
60};
61
Benjamin Kramerd8861512015-07-13 20:38:16 +000062} // end namespace llvm
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000063
Benjamin Kramerd8861512015-07-13 20:38:16 +000064#endif