diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-04 20:44:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-04 20:44:17 +0000 |
commit | 8e9a9774eb12b5242f74b8ac5b20e0a938ec9c53 (patch) | |
tree | 51b6211a3248d440a2d78f491a4ae9d68d80783d /utils/TableGen/Record.h | |
parent | 7c1af88b8e5cf381635eeeddbcbd30e28e17e41c (diff) | |
download | llvm-8e9a9774eb12b5242f74b8ac5b20e0a938ec9c53.tar.gz llvm-8e9a9774eb12b5242f74b8ac5b20e0a938ec9c53.tar.bz2 llvm-8e9a9774eb12b5242f74b8ac5b20e0a938ec9c53.tar.xz |
add support for DagInit initializers, which represent DAG patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.h')
-rw-r--r-- | utils/TableGen/Record.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h index cb42f03532..8b37dba44b 100644 --- a/utils/TableGen/Record.h +++ b/utils/TableGen/Record.h @@ -34,6 +34,7 @@ class StringInit; class CodeInit; class ListInit; class DefInit; +class DagInit; class TypedInit; class VarInit; class FieldInit; @@ -66,6 +67,7 @@ public: // These methods should only be called from subclasses of Init virtual Init *convertValue( CodeInit *CI) { return 0; } virtual Init *convertValue(VarBitInit *VB) { return 0; } virtual Init *convertValue( DefInit *DI) { return 0; } + virtual Init *convertValue( DagInit *DI) { return 0; } virtual Init *convertValue( TypedInit *TI) { return 0; } virtual Init *convertValue( VarInit *VI) { return convertValue((TypedInit*)VI); @@ -221,7 +223,7 @@ struct CodeRecTy : public RecTy { /// struct DagRecTy : public RecTy { Init *convertValue(UnsetInit *UI) { return (Init*)UI; } - //Init *convertValue( DagInit *CI) { return (Init*)CI; } + Init *convertValue( DagInit *CI) { return (Init*)CI; } Init *convertValue(TypedInit *TI); void print(std::ostream &OS) const { OS << "dag"; } @@ -582,6 +584,26 @@ public: } }; +/// DagInit - (def a, b) - Represent a DAG tree value. DAG inits are required +/// to have Records for their first value, after that, any legal Init is +/// possible. +/// +class DagInit : public Init { + Record *NodeTypeDef; + std::vector<Init*> Args; +public: + DagInit(Record *D, std::vector<Init*> &a) : NodeTypeDef(D) { + Args.swap(a); // DESTRUCTIVELY take the arguments + } + + virtual Init *convertInitializerTo(RecTy *Ty) { + return Ty->convertValue(this); + } + + Record *getNodeType() const { return NodeTypeDef; } + + virtual void print(std::ostream &OS) const; +}; //===----------------------------------------------------------------------===// // High-Level Classes |