mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
make ptr_rc derive from a new PointerLikeRegClass tblgen class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2cfd52c507
commit
a938ac6223
@ -258,11 +258,21 @@ def ins;
|
||||
/// of operands.
|
||||
def variable_ops;
|
||||
|
||||
|
||||
/// PointerLikeRegClass - Values that are designed to have pointer width are
|
||||
/// derived from this. TableGen treats the register class as having a symbolic
|
||||
/// type that it doesn't know, and resolves the actual regclass to use by using
|
||||
/// the TargetRegisterInfo::getPointerRegClass() hook at codegen time.
|
||||
class PointerLikeRegClass {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// ptr_rc definition - Mark this operand as being a pointer value whose
|
||||
/// register class is resolved dynamically via a callback to TargetInstrInfo.
|
||||
/// FIXME: We should probably change this to a class which contain a list of
|
||||
/// flags. But currently we have but one flag.
|
||||
def ptr_rc;
|
||||
def ptr_rc : PointerLikeRegClass;
|
||||
|
||||
/// unknown definition - Mark this operand as being of unknown type, causing
|
||||
/// it to be resolved by inference in the context it is used.
|
||||
|
@ -753,7 +753,7 @@ static std::vector<unsigned char> getImplicitType(Record *R, bool NotRegisters,
|
||||
std::vector<unsigned char>
|
||||
ComplexPat(1, TP.getDAGPatterns().getComplexPattern(R).getValueType());
|
||||
return ComplexPat;
|
||||
} else if (R->getName() == "ptr_rc") {
|
||||
} else if (R->isSubClassOf("PointerLikeRegClass")) {
|
||||
Other[0] = MVT::iPTR;
|
||||
return Other;
|
||||
} else if (R->getName() == "node" || R->getName() == "srcvalue" ||
|
||||
@ -924,7 +924,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
||||
} else {
|
||||
Record *ResultNode = Inst.getResult(0);
|
||||
|
||||
if (ResultNode->getName() == "ptr_rc") {
|
||||
if (ResultNode->isSubClassOf("PointerLikeRegClass")) {
|
||||
std::vector<unsigned char> VT;
|
||||
VT.push_back(MVT::iPTR);
|
||||
MadeChange = UpdateNodeType(VT, TP);
|
||||
@ -968,7 +968,7 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
||||
} else if (OperandNode->isSubClassOf("Operand")) {
|
||||
VT = getValueType(OperandNode->getValueAsDef("Type"));
|
||||
MadeChange |= Child->UpdateNodeType(VT, TP);
|
||||
} else if (OperandNode->getName() == "ptr_rc") {
|
||||
} else if (OperandNode->isSubClassOf("PointerLikeRegClass")) {
|
||||
MadeChange |= Child->UpdateNodeType(MVT::iPTR, TP);
|
||||
} else if (OperandNode->getName() == "unknown") {
|
||||
MadeChange |= Child->UpdateNodeType(EMVT::isUnknown, TP);
|
||||
@ -1602,7 +1602,7 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
|
||||
I->error("set destination should be a register!");
|
||||
|
||||
if (Val->getDef()->isSubClassOf("RegisterClass") ||
|
||||
Val->getDef()->getName() == "ptr_rc") {
|
||||
Val->getDef()->isSubClassOf("PointerLikeRegClass")) {
|
||||
if (Dest->getName().empty())
|
||||
I->error("set destination must have a name!");
|
||||
if (InstResults.count(Dest->getName()))
|
||||
|
@ -698,7 +698,7 @@ public:
|
||||
if (DefInit *DI = dynamic_cast<DefInit*>(Child->getLeafValue())) {
|
||||
Record *LeafRec = DI->getDef();
|
||||
if (LeafRec->isSubClassOf("RegisterClass") ||
|
||||
LeafRec->getName() == "ptr_rc") {
|
||||
LeafRec->isSubClassOf("PointerLikeRegClass")) {
|
||||
// Handle register references. Nothing to do here.
|
||||
} else if (LeafRec->isSubClassOf("Register")) {
|
||||
// Handle register references.
|
||||
|
@ -100,7 +100,7 @@ InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) {
|
||||
Res += "0";
|
||||
|
||||
// Ptr value whose register class is resolved via callback.
|
||||
if (OpR->getName() == "ptr_rc")
|
||||
if (OpR->isSubClassOf("PointerLikeRegClass"))
|
||||
Res += "|(1<<TOI::LookupPtrRegClass)";
|
||||
|
||||
// Predicate operands. Check to see if the original unexpanded operand
|
||||
|
Loading…
Reference in New Issue
Block a user