comparison lib/Target/Hexagon/HexagonBitTracker.h @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents 1172e4bd9c6f
children c2174574ed3a
comparison
equal deleted inserted replaced
120:1172e4bd9c6f 121:803732b1fca8
1 //===--- HexagonBitTracker.h ----------------------------------------------===// 1 //===- HexagonBitTracker.h --------------------------------------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 9
10 #ifndef HEXAGONBITTRACKER_H 10 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
11 #define HEXAGONBITTRACKER_H 11 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
12 12
13 #include "BitTracker.h" 13 #include "BitTracker.h"
14 #include "llvm/ADT/DenseMap.h" 14 #include "llvm/ADT/DenseMap.h"
15 #include <cstdint>
15 16
16 namespace llvm { 17 namespace llvm {
17 class HexagonInstrInfo; 18
18 class HexagonRegisterInfo; 19 class HexagonInstrInfo;
20 class HexagonRegisterInfo;
21 class MachineFrameInfo;
22 class MachineFunction;
23 class MachineInstr;
24 class MachineRegisterInfo;
19 25
20 struct HexagonEvaluator : public BitTracker::MachineEvaluator { 26 struct HexagonEvaluator : public BitTracker::MachineEvaluator {
21 typedef BitTracker::CellMapType CellMapType; 27 using CellMapType = BitTracker::CellMapType;
22 typedef BitTracker::RegisterRef RegisterRef; 28 using RegisterRef = BitTracker::RegisterRef;
23 typedef BitTracker::RegisterCell RegisterCell; 29 using RegisterCell = BitTracker::RegisterCell;
24 typedef BitTracker::BranchTargetList BranchTargetList; 30 using BranchTargetList = BitTracker::BranchTargetList;
25 31
26 HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri, 32 HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,
27 const HexagonInstrInfo &tii, MachineFunction &mf); 33 const HexagonInstrInfo &tii, MachineFunction &mf);
28 34
29 bool evaluate(const MachineInstr &MI, const CellMapType &Inputs, 35 bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
30 CellMapType &Outputs) const override; 36 CellMapType &Outputs) const override;
31 bool evaluate(const MachineInstr &BI, const CellMapType &Inputs, 37 bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
32 BranchTargetList &Targets, bool &FallsThru) const override; 38 BranchTargetList &Targets, bool &FallsThru) const override;
33 39
34 BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override; 40 BitTracker::BitMask mask(unsigned Reg, unsigned Sub) const override;
41
42 uint16_t getPhysRegBitWidth(unsigned Reg) const override;
43
44 const TargetRegisterClass &composeWithSubRegIndex(
45 const TargetRegisterClass &RC, unsigned Idx) const override;
35 46
36 MachineFunction &MF; 47 MachineFunction &MF;
37 MachineFrameInfo &MFI; 48 MachineFrameInfo &MFI;
38 const HexagonInstrInfo &TII; 49 const HexagonInstrInfo &TII;
39 50
47 unsigned getVirtRegFor(unsigned PReg) const; 58 unsigned getVirtRegFor(unsigned PReg) const;
48 59
49 // Type of formal parameter extension. 60 // Type of formal parameter extension.
50 struct ExtType { 61 struct ExtType {
51 enum { SExt, ZExt }; 62 enum { SExt, ZExt };
52 char Type; 63
53 uint16_t Width; 64 ExtType() = default;
54 ExtType() : Type(0), Width(0) {}
55 ExtType(char t, uint16_t w) : Type(t), Width(w) {} 65 ExtType(char t, uint16_t w) : Type(t), Width(w) {}
66
67 char Type = 0;
68 uint16_t Width = 0;
56 }; 69 };
57 // Map VR -> extension type. 70 // Map VR -> extension type.
58 typedef DenseMap<unsigned, ExtType> RegExtMap; 71 using RegExtMap = DenseMap<unsigned, ExtType>;
59 RegExtMap VRX; 72 RegExtMap VRX;
60 }; 73 };
61 74
62 } // end namespace llvm 75 } // end namespace llvm
63 76
64 #endif 77 #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H