|
LLVM
4.0.0
|
#include "llvm/ADT/APInt.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/Hashing.h"#include "llvm/ADT/SmallVector.h"#include "llvm/CodeGen/GlobalISel/RegisterBank.h"#include "llvm/CodeGen/MachineValueType.h"#include "llvm/Support/ErrorHandling.h"#include <cassert>#include <memory>Go to the source code of this file.
Classes | |
| class | llvm::RegisterBankInfo |
| Holds all the information related to register banks. More... | |
| struct | llvm::RegisterBankInfo::PartialMapping |
| Helper struct that represents how a value is partially mapped into a register. More... | |
| struct | llvm::RegisterBankInfo::ValueMapping |
| Helper struct that represents how a value is mapped through different register banks. More... | |
| class | llvm::RegisterBankInfo::InstructionMapping |
| Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping. More... | |
| class | llvm::RegisterBankInfo::OperandsMapper |
| Helper class used to get/create the virtual registers that will be used to replace the MachineOperand when applying a mapping. More... | |
| struct | PartialMapping |
| Helper struct that represents how a value is partially mapped into a register. More... | |
| struct | ValueMapping |
| Helper struct that represents how a value is mapped through different register banks. More... | |
| class | InstructionMapping |
| Helper class that represents how the value of an instruction may be mapped and what is the related cost of such mapping. More... | |
| class | OperandsMapper |
| Helper class used to get/create the virtual registers that will be used to replace the MachineOperand when applying a mapping. More... | |
Namespaces | |
| llvm | |
| Compute iterated dominance frontiers using a linear time algorithm. | |
Typedefs | |
| typedef SmallVector < InstructionMapping, 4 > | InstructionMappings |
| Convenient type to represent the alternatives for mapping an instruction. More... | |
Functions | |
| class llvm::RegisterBankInfo | llvm::ScalarAddx2 (0x00FF, GPR) |
| RegisterBankInfo (RegisterBank **RegBanks, unsigned NumRegBanks) | |
Create a RegisterBankInfo that can accomodate up to NumRegBanks RegisterBank instances. More... | |
| RegisterBankInfo () | |
| This constructor is meaningless. More... | |
| RegisterBank & | getRegBank (unsigned ID) |
Get the register bank identified by ID. More... | |
| InstructionMapping | getInstrMappingImpl (const MachineInstr &MI) const |
Try to get the mapping of MI. More... | |
| const PartialMapping & | getPartialMapping (unsigned StartIdx, unsigned Length, const RegisterBank &RegBank) const |
| Get the uniquely generated PartialMapping for the given arguments. More... | |
| const RegisterBank * | getRegBankFromConstraints (const MachineInstr &MI, unsigned OpIdx, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI) const |
Get the register bank for the OpIdx-th operand of MI form the encoding constraints, if any. More... | |
| static void | applyDefaultMapping (const OperandsMapper &OpdMapper) |
| Helper method to apply something that is like the default mapping. More... | |
| virtual void | applyMappingImpl (const OperandsMapper &OpdMapper) const |
| See ::applyMapping. More... | |
| virtual | ~RegisterBankInfo () |
| const RegisterBank * | getRegBank (unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const |
Get the register bank of Reg. More... | |
| unsigned | getNumRegBanks () const |
| Get the total number of register banks. More... | |
| virtual const RegisterBank & | getRegBankFromRegClass (const TargetRegisterClass &RC) const |
Get a register bank that covers RC. More... | |
| virtual unsigned | copyCost (const RegisterBank &A, const RegisterBank &B, unsigned Size) const |
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B. More... | |
| static const TargetRegisterClass * | constrainGenericRegister (unsigned Reg, const TargetRegisterClass &RC, MachineRegisterInfo &MRI) |
Constrain the (possibly generic) virtual register Reg to RC. More... | |
| virtual InstructionMapping | getInstrMapping (const MachineInstr &MI) const |
Get the mapping of the different operands of MI on the register bank. More... | |
| virtual InstructionMappings | getInstrAlternativeMappings (const MachineInstr &MI) const |
Get the alternative mappings for MI. More... | |
| class llvm::RegisterBankInfo *void | llvm::applyMapping (const OperandsMapper &OpdMapper) const |
Apply OpdMapper.getInstrMapping() to OpdMapper.getMI(). More... | |
| static unsigned | llvm::getSizeInBits (unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) |
Get the size in bits of Reg. More... | |
| bool | llvm::verify (const TargetRegisterInfo &TRI) const |
Check that information hold by this instance make sense for the given TRI. More... | |
| raw_ostream & | operator<< (raw_ostream &OS, const RegisterBankInfo::PartialMapping &PartMapping) |
| raw_ostream & | operator<< (raw_ostream &OS, const RegisterBankInfo::ValueMapping &ValMapping) |
| raw_ostream & | operator<< (raw_ostream &OS, const RegisterBankInfo::InstructionMapping &InstrMapping) |
| raw_ostream & | operator<< (raw_ostream &OS, const RegisterBankInfo::OperandsMapper &OpdMapper) |
| hash_code | hash_value (const RegisterBankInfo::PartialMapping &PartMapping) |
| Hashing function for PartialMapping. More... | |
| const ValueMapping & | getValueMapping (unsigned StartIdx, unsigned Length, const RegisterBank &RegBank) const |
| Methods to get a uniquely generated ValueMapping. More... | |
| const ValueMapping & | getValueMapping (const PartialMapping *BreakDown, unsigned NumBreakDowns) const |
| Get the ValueMapping for the given arguments. More... | |
| template<typename Iterator > | |
| const ValueMapping * | getOperandsMapping (Iterator Begin, Iterator End) const |
| Methods to get a uniquely generated array of ValueMapping. More... | |
| const ValueMapping * | getOperandsMapping (const SmallVectorImpl< const ValueMapping * > &OpdsMapping) const |
Get the uniquely generated array of ValueMapping for the elements of OpdsMapping. More... | |
| const ValueMapping * | getOperandsMapping (std::initializer_list< const ValueMapping * > OpdsMapping) const |
| Get the uniquely generated array of ValueMapping for the given arguments. More... | |
Variables | |
| class llvm::RegisterBankInfo | llvm::ScalarAddx2 |
| RegisterBank ** | RegBanks |
| Hold the set of supported register banks. More... | |
| unsigned | NumRegBanks |
| Total number of register banks. More... | |
| DenseMap< unsigned, const PartialMapping * > | MapOfPartialMappings |
| Keep dynamically allocated PartialMapping in a separate map. More... | |
| DenseMap< unsigned, const ValueMapping * > | MapOfValueMappings |
| Keep dynamically allocated ValueMapping in a separate map. More... | |
| DenseMap< unsigned, ValueMapping * > | MapOfOperandsMappings |
| Keep dynamically allocated array of ValueMapping in a separate map. More... | |
| static const unsigned | DefaultMappingID |
| Identifier used when the related instruction mapping instance is generated by target independent code. More... | |
| static const unsigned | InvalidMappingID |
| Identifier used when the related instruction mapping instance is generated by the default constructor. More... | |
| VectorAdd | |
Get the possible mapping for MI. More... | |
| class llvm::RegisterBankInfo | llvm::GPR |
| typedef SmallVector<InstructionMapping, 4> InstructionMappings |
Convenient type to represent the alternatives for mapping an instruction.
Definition at line 913 of file RegisterBankInfo.h.
|
staticprotected |
Helper method to apply something that is like the default mapping.
Basically, that means that OpdMapper.getMI() is left untouched aside from the reassignment of the register operand that have been remapped. If the mapping of one of the operand spans several registers, this method will abort as this is not like a default mapping anymore.
OpdMapper.getMI().getNumOperands()) the range OpdMapper.getVRegs(OpIdx) is empty or of size 1.
|
protectedvirtual |
See ::applyMapping.
Definition at line 1144 of file RegisterBankInfo.h.
|
static |
Constrain the (possibly generic) virtual register Reg to RC.
Reg is a virtual register that either has a bank or a class.
|
virtual |
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B.
Since register banks may cover different size, Size specifies what will be the size in bits that will be copied around.
Definition at line 1190 of file RegisterBankInfo.h.
|
virtual |
Get the alternative mappings for MI.
Alternative in the sense different from getInstrMapping.
|
virtual |
Get the mapping of the different operands of MI on the register bank.
This mapping should be the direct translation of MI. In other words, when MI is mapped with the returned mapping, only the register banks of the operands of MI need to be updated. In particular, neither the opcode nor the type of MI needs to be updated for this direct mapping.
The target independent implementation gives a mapping based on the register classes for the target specific opcode. It uses the ID RegisterBankInfo::DefaultMappingID for that mapping. Make sure you do not use that ID for the alternative mapping for MI. See getInstrAlternativeMappings for the alternative mappings.
For instance, if MI is a vector add, the mapping should not be a scalarization of the add.
|
protected |
Try to get the mapping of MI.
See getInstrMapping for more details on what a mapping represents.
Unlike getInstrMapping the returned InstructionMapping may be invalid (isValid() == false). This means that the target independent code is not smart enough to get the mapping of MI and thus, the target has to provide the information for MI.
This implementation is able to get the mapping of:
| unsigned ScalarAddx2::getNumRegBanks | ( | ) | const |
Get the total number of register banks.
Definition at line 1165 of file RegisterBankInfo.h.
|
protected |
Methods to get a uniquely generated array of ValueMapping.
Get the uniquely generated array of ValueMapping for the elements of between Begin and End.
Elements that are nullptr will be replaced by invalid ValueMapping (ValueMapping::isValid == false).
Begin and End must uniquely identify a ValueMapping. Otherwise, there is no guarantee that the return instance will be unique, i.e., another OperandsMapping could have the same content.
|
protected |
Get the uniquely generated array of ValueMapping for the elements of OpdsMapping.
Elements of OpdsMapping that are nullptr will be replaced by invalid ValueMapping (ValueMapping::isValid == false).
|
protected |
Get the uniquely generated array of ValueMapping for the given arguments.
Arguments that are nullptr will be replaced by invalid ValueMapping (ValueMapping::isValid == false).
|
protected |
Get the uniquely generated PartialMapping for the given arguments.
Get the register bank identified by ID.
Definition at line 1046 of file RegisterBankInfo.h.
| const RegisterBank* ScalarAddx2::getRegBank | ( | unsigned | Reg, |
| const MachineRegisterInfo & | MRI, | ||
| const TargetRegisterInfo & | TRI | ||
| ) | const |
Get the register bank of Reg.
If Reg has not been assigned a register, a register class, or a register bank, then this returns nullptr.
|
protected |
Get the register bank for the OpIdx-th operand of MI form the encoding constraints, if any.
MI did not provide enough information to deduce it.
|
virtual |
Get a register bank that covers RC.
RC is a user-defined register class (as opposed as one generated by TableGen).Definition at line 1180 of file RegisterBankInfo.h.
|
protected |
Methods to get a uniquely generated ValueMapping.
The most common ValueMapping consists of a single PartialMapping. Feature a method for that.
Referenced by llvm::AArch64RegisterBankInfo::getInstrAlternativeMappings(), and llvm::AArch64RegisterBankInfo::getInstrMapping().
|
protected |
Get the ValueMapping for the given arguments.
| hash_code hash_value | ( | const RegisterBankInfo::PartialMapping & | PartMapping | ) |
Hashing function for PartialMapping.
It is required for the hashing of ValueMapping.
Referenced by llvm::hashing::detail::get_hashable_data().
|
inline |
Definition at line 656 of file RegisterBankInfo.h.
|
inline |
Definition at line 663 of file RegisterBankInfo.h.
|
inline |
Definition at line 669 of file RegisterBankInfo.h.
|
inline |
Definition at line 676 of file RegisterBankInfo.h.
|
protected |
Create a RegisterBankInfo that can accomodate up to NumRegBanks RegisterBank instances.
|
protected |
This constructor is meaningless.
It just provides a default constructor that can be used at link time when GlobalISel is not built. That way, targets can still inherit from this class without doing crazy gymnastic to avoid link time failures.
Definition at line 1041 of file RegisterBankInfo.h.
|
virtual |
Identifier used when the related instruction mapping instance is generated by target independent code.
Make sure not to use that identifier to avoid possible collision.
Definition at line 1211 of file RegisterBankInfo.h.
Identifier used when the related instruction mapping instance is generated by the default constructor.
Make sure not to use that identifier.
Definition at line 1216 of file RegisterBankInfo.h.
|
mutable |
Keep dynamically allocated array of ValueMapping in a separate map.
This shouldn't be needed when everything gets TableGen'ed.
Definition at line 1029 of file RegisterBankInfo.h.
|
mutable |
Keep dynamically allocated PartialMapping in a separate map.
This shouldn't be needed when everything gets TableGen'ed.
Definition at line 1021 of file RegisterBankInfo.h.
|
mutable |
Keep dynamically allocated ValueMapping in a separate map.
This shouldn't be needed when everything gets TableGen'ed.
Definition at line 1025 of file RegisterBankInfo.h.
| unsigned NumRegBanks |
Total number of register banks.
Definition at line 1017 of file RegisterBankInfo.h.
| RegisterBank** RegBanks |
Hold the set of supported register banks.
Definition at line 1015 of file RegisterBankInfo.h.
| VectorAdd |
Get the possible mapping for MI.
A mapping defines where the different operands may live and at what cost. For instance, let us consider: v0(16) = G_ADD <2 x i8> v1, v2 The possible mapping could be:
{/*ID
Definition at line 1253 of file RegisterBankInfo.h.
1.8.6