Path: blob/main/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonBitTracker.h
35269 views
//===- HexagonBitTracker.h --------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H9#define LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H1011#include "BitTracker.h"12#include "llvm/ADT/DenseMap.h"13#include <cstdint>1415namespace llvm {1617class HexagonInstrInfo;18class HexagonRegisterInfo;19class MachineFrameInfo;20class MachineFunction;21class MachineInstr;22class MachineRegisterInfo;2324struct HexagonEvaluator : public BitTracker::MachineEvaluator {25using CellMapType = BitTracker::CellMapType;26using RegisterRef = BitTracker::RegisterRef;27using RegisterCell = BitTracker::RegisterCell;28using BranchTargetList = BitTracker::BranchTargetList;2930HexagonEvaluator(const HexagonRegisterInfo &tri, MachineRegisterInfo &mri,31const HexagonInstrInfo &tii, MachineFunction &mf);3233bool evaluate(const MachineInstr &MI, const CellMapType &Inputs,34CellMapType &Outputs) const override;35bool evaluate(const MachineInstr &BI, const CellMapType &Inputs,36BranchTargetList &Targets, bool &FallsThru) const override;3738BitTracker::BitMask mask(Register Reg, unsigned Sub) const override;3940uint16_t getPhysRegBitWidth(MCRegister Reg) const override;4142const TargetRegisterClass &composeWithSubRegIndex(43const TargetRegisterClass &RC, unsigned Idx) const override;4445MachineFunction &MF;46MachineFrameInfo &MFI;47const HexagonInstrInfo &TII;4849private:50unsigned getUniqueDefVReg(const MachineInstr &MI) const;51bool evaluateLoad(const MachineInstr &MI, const CellMapType &Inputs,52CellMapType &Outputs) const;53bool evaluateFormalCopy(const MachineInstr &MI, const CellMapType &Inputs,54CellMapType &Outputs) const;5556unsigned getNextPhysReg(unsigned PReg, unsigned Width) const;57unsigned getVirtRegFor(unsigned PReg) const;5859// Type of formal parameter extension.60struct ExtType {61enum { SExt, ZExt };6263ExtType() = default;64ExtType(char t, uint16_t w) : Type(t), Width(w) {}6566char Type = 0;67uint16_t Width = 0;68};69// Map VR -> extension type.70using RegExtMap = DenseMap<unsigned, ExtType>;71RegExtMap VRX;72};7374} // end namespace llvm7576#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONBITTRACKER_H777879