Add support for the Arg1 argument type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-08-11 20:25:52 +00:00
parent d59414fc85
commit 88118bf787
4 changed files with 30 additions and 6 deletions

View File

@ -17,6 +17,7 @@ NodeType::ArgResultTypes NodeType::Translate(Record *R) {
if (Name == "DNVT_void") return Void;
if (Name == "DNVT_val" ) return Val;
if (Name == "DNVT_arg0") return Arg0;
if (Name == "DNVT_arg1") return Arg1;
if (Name == "DNVT_ptr" ) return Ptr;
throw "Unknown DagNodeValType '" + Name + "'!";
}
@ -277,6 +278,10 @@ bool Pattern::InferTypes(TreePatternNode *N, bool &MadeChange) {
MadeChange |= Child->updateNodeType(N->getChild(0)->getType(),
TheRecord->getName());
break;
case NodeType::Arg1:
MadeChange |= Child->updateNodeType(N->getChild(1)->getType(),
TheRecord->getName());
break;
case NodeType::Val:
if (Child->getType() == MVT::isVoid)
error("Inferred a void node in an illegal place!");
@ -298,7 +303,10 @@ bool Pattern::InferTypes(TreePatternNode *N, bool &MadeChange) {
MadeChange |= N->updateNodeType(N->getChild(0)->getType(),
TheRecord->getName());
break;
case NodeType::Arg1:
MadeChange |= N->updateNodeType(N->getChild(1)->getType(),
TheRecord->getName());
break;
case NodeType::Ptr:
MadeChange |= N->updateNodeType(ISE.getTarget().getPointerType(),
TheRecord->getName());
@ -426,12 +434,15 @@ void InstrSelectorEmitter::ReadNodeTypes() {
if (a == 0 && ArgTypes.back() == NodeType::Arg0)
throw "In node " + Node->getName() + ", arg 0 cannot have type 'arg0'!";
if (a == 1 && ArgTypes.back() == NodeType::Arg1)
throw "In node " + Node->getName() + ", arg 1 cannot have type 'arg1'!";
if (ArgTypes.back() == NodeType::Void)
throw "In node " + Node->getName() + ", args cannot be void type!";
}
if (RetTy == NodeType::Arg0 && Args->getSize() == 0)
if ((RetTy == NodeType::Arg0 && Args->getSize() == 0) ||
(RetTy == NodeType::Arg1 && Args->getSize() < 2))
throw "In node " + Node->getName() +
", invalid return type for nullary node!";
", invalid return type for node with this many operands!";
// Add the node type mapping now...
NodeTypes[Node] = NodeType(RetTy, ArgTypes);

View File

@ -23,6 +23,7 @@ struct NodeType {
// Both argument and return types...
Val, // A non-void type
Arg0, // Value matches the type of Arg0
Arg1, // Value matches the type of Arg1
Ptr, // Tree node is the type of the target pointer
// Return types

View File

@ -17,6 +17,7 @@ NodeType::ArgResultTypes NodeType::Translate(Record *R) {
if (Name == "DNVT_void") return Void;
if (Name == "DNVT_val" ) return Val;
if (Name == "DNVT_arg0") return Arg0;
if (Name == "DNVT_arg1") return Arg1;
if (Name == "DNVT_ptr" ) return Ptr;
throw "Unknown DagNodeValType '" + Name + "'!";
}
@ -277,6 +278,10 @@ bool Pattern::InferTypes(TreePatternNode *N, bool &MadeChange) {
MadeChange |= Child->updateNodeType(N->getChild(0)->getType(),
TheRecord->getName());
break;
case NodeType::Arg1:
MadeChange |= Child->updateNodeType(N->getChild(1)->getType(),
TheRecord->getName());
break;
case NodeType::Val:
if (Child->getType() == MVT::isVoid)
error("Inferred a void node in an illegal place!");
@ -298,7 +303,10 @@ bool Pattern::InferTypes(TreePatternNode *N, bool &MadeChange) {
MadeChange |= N->updateNodeType(N->getChild(0)->getType(),
TheRecord->getName());
break;
case NodeType::Arg1:
MadeChange |= N->updateNodeType(N->getChild(1)->getType(),
TheRecord->getName());
break;
case NodeType::Ptr:
MadeChange |= N->updateNodeType(ISE.getTarget().getPointerType(),
TheRecord->getName());
@ -426,12 +434,15 @@ void InstrSelectorEmitter::ReadNodeTypes() {
if (a == 0 && ArgTypes.back() == NodeType::Arg0)
throw "In node " + Node->getName() + ", arg 0 cannot have type 'arg0'!";
if (a == 1 && ArgTypes.back() == NodeType::Arg1)
throw "In node " + Node->getName() + ", arg 1 cannot have type 'arg1'!";
if (ArgTypes.back() == NodeType::Void)
throw "In node " + Node->getName() + ", args cannot be void type!";
}
if (RetTy == NodeType::Arg0 && Args->getSize() == 0)
if ((RetTy == NodeType::Arg0 && Args->getSize() == 0) ||
(RetTy == NodeType::Arg1 && Args->getSize() < 2))
throw "In node " + Node->getName() +
", invalid return type for nullary node!";
", invalid return type for node with this many operands!";
// Add the node type mapping now...
NodeTypes[Node] = NodeType(RetTy, ArgTypes);

View File

@ -23,6 +23,7 @@ struct NodeType {
// Both argument and return types...
Val, // A non-void type
Arg0, // Value matches the type of Arg0
Arg1, // Value matches the type of Arg1
Ptr, // Tree node is the type of the target pointer
// Return types