LLVM  6.0.0svn
Public Member Functions | Public Attributes | List of all members
ValueMapping Struct Reference

Helper struct that represents how a value is mapped through different register banks. More...

#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"

Collaboration diagram for ValueMapping:
Collaboration graph
[legend]

Public Member Functions

 ValueMapping ()
 The default constructor creates an invalid (isValid() == false) instance. More...
 
 ValueMapping (const PartialMapping *BreakDown, unsigned NumBreakDowns)
 Initialize a ValueMapping with the given parameter. More...
 
const PartialMappingbegin () const
 Iterators through the PartialMappings. More...
 
const PartialMappingend () const
 
bool isValid () const
 Check if this ValueMapping is valid. More...
 
bool verify (unsigned MeaningfulBitWidth) const
 Verify that this mapping makes sense for a value of MeaningfulBitWidth. More...
 
void dump () const
 Print this on dbgs() stream. More...
 
void print (raw_ostream &OS) const
 Print this on OS;. More...
 

Public Attributes

const PartialMappingBreakDown
 How the value is broken down between the different register banks. More...
 
unsigned NumBreakDowns
 Number of partial mapping to break down this value. More...
 

Detailed Description

Helper struct that represents how a value is mapped through different register banks.

Note
: So far we do not have any users of the complex mappings (mappings with more than one partial mapping), but when we do, we would have needed to duplicate partial mappings. The alternative could be to use an array of pointers of partial mapping (i.e., PartialMapping **BreakDown) and duplicate the pointers instead.

E.g., Let say we have a 32-bit add and a <2 x 32-bit> vadd. We can expand the <2 x 32-bit> add into 2 x 32-bit add.

Currently the TableGen-like file would look like:

/*32-bit add*/ {0, 32, GPR},
/*2x32-bit add*/ {0, 32, GPR}, {0, 32, GPR}, // <-- Same entry 3x
/*<2x32-bit> vadd {0, 64, VPR}
* }; // PartialMapping duplicated.
* ValueMapping[] {
* /*plain 32-bit add*/ {&PartialMapping[0], 1},
/*expanded vadd on 2xadd*/ {&PartialMapping[1], 2},
/*plain <2x32-bit> vadd*/ {&PartialMapping[3], 1}
};

With the array of pointer, we would have:

/*32-bit add*/ {0, 32, GPR},
/*<2x32-bit> vadd {0, 64, VPR}
* }; // No more duplication.
* BreakDowns[] = {
* /*AddBreakDown*/ &PartialMapping[0],
/*2xAddBreakDown*/ &PartialMapping[0], &PartialMapping[0],
/*VAddBreakDown*/ &PartialMapping[1]
}; // Addresses of PartialMapping duplicated (smaller).
/*plain 32-bit add*/ {&BreakDowns[0], 1},
/*expanded vadd on 2xadd*/ {&BreakDowns[1], 2},
/*plain <2x32-bit> vadd*/ {&BreakDowns[3], 1}
};

Given that a PartialMapping is actually small, the code size impact is actually a degradation. Moreover the compile time will be hit by the additional indirection. If PartialMapping gets bigger we may reconsider.

Definition at line 855 of file RegisterBankInfo.h.

Constructor & Destructor Documentation

◆ ValueMapping() [1/2]

ValueMapping::ValueMapping ( )
inline

The default constructor creates an invalid (isValid() == false) instance.

Definition at line 864 of file RegisterBankInfo.h.

◆ ValueMapping() [2/2]

ValueMapping::ValueMapping ( const PartialMapping BreakDown,
unsigned  NumBreakDowns 
)
inline

Initialize a ValueMapping with the given parameter.

BreakDown needs to have a life time at least as long as this instance.

Definition at line 869 of file RegisterBankInfo.h.

Member Function Documentation

◆ begin()

const PartialMapping* ValueMapping::begin ( ) const
inline

Iterators through the PartialMappings.

Definition at line 873 of file RegisterBankInfo.h.

◆ dump()

void ValueMapping::dump ( ) const

Print this on dbgs() stream.

◆ end()

const PartialMapping* ValueMapping::end ( ) const
inline

Definition at line 874 of file RegisterBankInfo.h.

◆ isValid()

bool ValueMapping::isValid ( ) const
inline

Check if this ValueMapping is valid.

Definition at line 877 of file RegisterBankInfo.h.

◆ print()

void ValueMapping::print ( raw_ostream &  OS) const

Print this on OS;.

◆ verify()

bool ValueMapping::verify ( unsigned  MeaningfulBitWidth) const

Verify that this mapping makes sense for a value of MeaningfulBitWidth.

Note
This method does not check anything when assertions are disabled.
Returns
True is the check was successful.

Member Data Documentation

◆ BreakDown

const PartialMapping* ValueMapping::BreakDown

How the value is broken down between the different register banks.

Definition at line 857 of file RegisterBankInfo.h.

◆ NumBreakDowns

unsigned ValueMapping::NumBreakDowns

Number of partial mapping to break down this value.

Definition at line 860 of file RegisterBankInfo.h.


The documentation for this struct was generated from the following file: