LLVM 19.0.0git
HexagonBitTracker.h
Go to the documentation of this file.
1//===- HexagonBitTracker.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
10#define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
11
12#include "BitTracker.h"
13#include "llvm/ADT/DenseMap.h"
14#include <cstdint>
15
16namespace llvm {
17
18class HexagonInstrInfo;
19class HexagonRegisterInfo;
20class MachineFrameInfo;
21class MachineFunction;
22class MachineInstr;
23class MachineRegisterInfo;
24
30
32 const HexagonInstrInfo &tii, MachineFunction &mf);
33
34 bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,
35 CellMapType &Outputs) const override;
36 bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,
37 BranchTargetList &Targets, bool &FallsThru) const override;
38
39 BitTracker::BitMask mask(Register Reg, unsigned Sub) const override;
40
42
44 const TargetRegisterClass &RC, unsigned Idx) const override;
45
49
50private:
51 unsigned getUniqueDefVReg(const MachineInstr &MI) const;
52 bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,
53 CellMapType &Outputs) const;
54 bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,
55 CellMapType &Outputs) const;
56
57 unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;
58 unsigned getVirtRegFor(unsigned PReg) const;
59
60 // Type of formal parameter extension.
61 struct ExtType {
62 enum { SExt, ZExt };
63
64 ExtType() = default;
65 ExtType(char t, uint16_t w) : Type(t), Width(w) {}
66
67 char Type = 0;
68 uint16_t Width = 0;
69 };
70 // Map VR -> extension type.
71 using RegExtMap = DenseMap<unsigned, ExtType>;
72 RegExtMap VRX;
73};
74
75} // end namespace llvm
76
77#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
IRTranslator LLVM IR MI
unsigned Reg
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
Definition: MachineInstr.h:69
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
A vector that has set insertion semantics.
Definition: SetVector.h:57
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
SetVector< const MachineBasicBlock * > BranchTargetList
Definition: BitTracker.h:43
std::map< unsigned, RegisterCell > CellMapType
Definition: BitTracker.h:44
BitTracker::BitMask mask(Register Reg, unsigned Sub) const override
uint16_t getPhysRegBitWidth(MCRegister Reg) const override
bool evaluate(const MachineInstr &MI, const CellMapType &Inputs, CellMapType &Outputs) const override
MachineFrameInfo & MFI
const HexagonInstrInfo & TII
MachineFunction & MF
const TargetRegisterClass & composeWithSubRegIndex(const TargetRegisterClass &RC, unsigned Idx) const override
BitTracker::CellMapType CellMapType