string { return STRING; }
list { return LIST; }
code { return CODE; }
+dag { return DAG; }
class { return CLASS; }
def { return DEF; }
std::vector<SubClassRefTy> *SubClassList;
};
-%token INT BIT STRING BITS LIST CODE CLASS DEF FIELD SET IN
+%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD SET IN
%token <IntVal> INTVAL
%token <StrVal> ID STRVAL CODEFRAGMENT
$$ = new ListRecTy($3);
} | CODE { // code type
$$ = new CodeRecTy();
+ } | DAG { // dag type
+ $$ = new DagRecTy();
} | ClassID { // Record Type
$$ = new RecordRecTy($1);
};
return 0;
}
+Init *DagRecTy::convertValue(TypedInit *TI) {
+ if (TI->getType()->typeIsConvertibleTo(this))
+ return TI;
+ return 0;
+}
+
+
void RecordRecTy::print(std::ostream &OS) const {
OS << Rec->getName();
}
class StringRecTy;
class ListRecTy;
class CodeRecTy;
+class DagRecTy;
class RecordRecTy;
// Init subclasses...
virtual bool baseClassOf(const StringRecTy *RHS) const { return false; }
virtual bool baseClassOf(const ListRecTy *RHS) const { return false; }
virtual bool baseClassOf(const CodeRecTy *RHS) const { return false; }
+ virtual bool baseClassOf(const DagRecTy *RHS) const { return false; }
virtual bool baseClassOf(const RecordRecTy *RHS) const { return false; }
};
virtual bool baseClassOf(const CodeRecTy *RHS) const { return true; }
};
+/// DagRecTy - 'dag' - Represent a dag fragment
+///
+struct DagRecTy : public RecTy {
+ Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
+ //Init *convertValue( DagInit *CI) { return (Init*)CI; }
+ Init *convertValue(TypedInit *TI);
+
+ void print(std::ostream &OS) const { OS << "dag"; }
+
+ bool typeIsConvertibleTo(const RecTy *RHS) const {
+ return RHS->baseClassOf(this);
+ }
+ virtual bool baseClassOf(const DagRecTy *RHS) const { return true; }
+};
+
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
/// (R32 X = EAX).
string { return STRING; }
list { return LIST; }
code { return CODE; }
+dag { return DAG; }
class { return CLASS; }
def { return DEF; }
std::vector<SubClassRefTy> *SubClassList;
};
-%token INT BIT STRING BITS LIST CODE CLASS DEF FIELD SET IN
+%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD SET IN
%token <IntVal> INTVAL
%token <StrVal> ID STRVAL CODEFRAGMENT
$$ = new ListRecTy($3);
} | CODE { // code type
$$ = new CodeRecTy();
+ } | DAG { // dag type
+ $$ = new DagRecTy();
} | ClassID { // Record Type
$$ = new RecordRecTy($1);
};
return 0;
}
+Init *DagRecTy::convertValue(TypedInit *TI) {
+ if (TI->getType()->typeIsConvertibleTo(this))
+ return TI;
+ return 0;
+}
+
+
void RecordRecTy::print(std::ostream &OS) const {
OS << Rec->getName();
}
class StringRecTy;
class ListRecTy;
class CodeRecTy;
+class DagRecTy;
class RecordRecTy;
// Init subclasses...
virtual bool baseClassOf(const StringRecTy *RHS) const { return false; }
virtual bool baseClassOf(const ListRecTy *RHS) const { return false; }
virtual bool baseClassOf(const CodeRecTy *RHS) const { return false; }
+ virtual bool baseClassOf(const DagRecTy *RHS) const { return false; }
virtual bool baseClassOf(const RecordRecTy *RHS) const { return false; }
};
virtual bool baseClassOf(const CodeRecTy *RHS) const { return true; }
};
+/// DagRecTy - 'dag' - Represent a dag fragment
+///
+struct DagRecTy : public RecTy {
+ Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
+ //Init *convertValue( DagInit *CI) { return (Init*)CI; }
+ Init *convertValue(TypedInit *TI);
+
+ void print(std::ostream &OS) const { OS << "dag"; }
+
+ bool typeIsConvertibleTo(const RecTy *RHS) const {
+ return RHS->baseClassOf(this);
+ }
+ virtual bool baseClassOf(const DagRecTy *RHS) const { return true; }
+};
+
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
/// (R32 X = EAX).