LLVM 24.0.0git
PISARegManager.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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/// \file
10/// This file declares management of PISA virtual registers.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_PISA_PISAREGMANAGER_H
15#define LLVM_LIB_TARGET_PISA_PISAREGMANAGER_H
16
18#include "llvm/ADT/MapVector.h"
21
22namespace llvm {
23namespace PISA {
24
25class RegManager : public RegEncoder {
26public:
27 enum Usage { None = 0, NoEmissionDef = (1 << 0) };
28 struct RegInfo {
30 unsigned Idx;
32 };
34
35public:
36 RegManager(const MachineFunction &MF);
37 unsigned getRegIdx(Register Reg) const;
38 void setRegIdx(Register Reg, unsigned Idx) { Mapping[Reg].Idx = Idx; }
39 unsigned encodeVirtualRegister(RegBank Bank, Register Reg) const;
41 return make_range(Mapping.begin(), Mapping.end());
42 }
43 bool exists(Register Reg) const { return Mapping.count(Reg) > 0; }
44
45private:
46 MappingTy Mapping;
47 const MachineFunction &MF;
49 void computeMapping();
50};
51
52} // namespace PISA
53} // namespace llvm
54
55#endif // LLVM_LIB_TARGET_PISA_PISAREGMANAGER_H
Register Reg
This file implements a map that provides insertion order iteration.
This file declares encoding of PISA virtual registers.
MachineRegisterInfo & MRI
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:39
unsigned getRegIdx(Register Reg) const
bool exists(Register Reg) const
MapVector< Register, RegInfo > MappingTy
RegManager(const MachineFunction &MF)
void setRegIdx(Register Reg, unsigned Idx)
iterator_range< MappingTy::const_iterator > mapping() const
unsigned encodeVirtualRegister(RegBank Bank, Register Reg) const
Wrapper class representing virtual and physical registers.
Definition Register.h:20
A range adaptor for a pair of iterators.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.