blob: 2cbf65e66ca6e090136d02285852d8f1ccd1960c [file] [log] [blame]
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +00001//===--- HexagonBitTracker.h ------------------------------------*- C++ -*-===//
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +00002//
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
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000010#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
11#define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000012
13#include "BitTracker.h"
14#include "llvm/ADT/DenseMap.h"
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000015#include <cstdint>
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000016
17namespace llvm {
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000018
19class HexagonInstrInfo;
20class HexagonRegisterInfo;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000021
22struct HexagonEvaluator : public BitTracker::MachineEvaluator {
23 typedef BitTracker::CellMapType CellMapType;
24 typedef BitTracker::RegisterRef RegisterRef;
25 typedef BitTracker::RegisterCell RegisterCell;
26 typedef BitTracker::BranchTargetList BranchTargetList;
27
Benjamin Kramerd8861512015-07-13 20:38:16 +000028 HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
29 const HexagonInstrInfo &tii, MachineFunction &mf);
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000030
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000031 bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000032 CellMapType &Outputs) const override;
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000033 bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000034 BranchTargetList &Targets, bool &FallsThru) const override;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000035
Benjamin Kramerd8861512015-07-13 20:38:16 +000036 BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000037
Benjamin Kramerd8861512015-07-13 20:38:16 +000038 MachineFunction &MF;
39 MachineFrameInfo &MFI;
40 const HexagonInstrInfo &TII;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000041
42private:
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000043 bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000044 CellMapType &Outputs) const;
Duncan P. N. Exon Smith98226e32016-07-12 01:55:32 +000045 bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,
Benjamin Kramerd8861512015-07-13 20:38:16 +000046 CellMapType &Outputs) const;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000047
48 unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
49 unsigned getVirtRegFor(unsigned PReg) const;
50
51 // Type of formal parameter extension.
52 struct ExtType {
53 enum { SExt, ZExt };
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000054
55 ExtType() = default;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000056 ExtType(char t, uint16_t w) : Type(t), Width(w) {}
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000057
58 char Type = 0;
59 uint16_t Width = 0;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000060 };
61 // Map VR -> extension type.
Benjamin Kramerd8861512015-07-13 20:38:16 +000062 typedef DenseMap<unsigned, ExtType> RegExtMap;
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000063 RegExtMap VRX;
64};
65
Benjamin Kramerd8861512015-07-13 20:38:16 +000066} // end namespace llvm
Krzysztof Parzyszeke53b31a2015-07-07 15:16:42 +000067
Eugene Zelenkob2ca1b32017-01-04 02:02:05 +000068#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H