aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--support/tools/TableGen/FileLexer.l1
-rw-r--r--support/tools/TableGen/FileParser.y4
-rw-r--r--support/tools/TableGen/Record.h9
-rw-r--r--utils/TableGen/FileLexer.l1
-rw-r--r--utils/TableGen/FileParser.y4
-rw-r--r--utils/TableGen/Record.h9
6 files changed, 26 insertions, 2 deletions
diff --git a/support/tools/TableGen/FileLexer.l b/support/tools/TableGen/FileLexer.l
index d3264da91a..34a2818b2f 100644
--- a/support/tools/TableGen/FileLexer.l
+++ b/support/tools/TableGen/FileLexer.l
@@ -151,6 +151,7 @@ bit { return BIT; }
bits { return BITS; }
string { return STRING; }
list { return LIST; }
+code { return CODE; }
class { return CLASS; }
def { return DEF; }
diff --git a/support/tools/TableGen/FileParser.y b/support/tools/TableGen/FileParser.y
index 431fcfcc62..e906a5e4e3 100644
--- a/support/tools/TableGen/FileParser.y
+++ b/support/tools/TableGen/FileParser.y
@@ -153,7 +153,7 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
std::vector<SubClassRefTy> *SubClassList;
};
-%token INT BIT STRING BITS LIST CLASS DEF FIELD SET IN
+%token INT BIT STRING BITS LIST CODE CLASS DEF FIELD SET IN
%token <IntVal> INTVAL
%token <StrVal> ID STRVAL
@@ -202,6 +202,8 @@ Type : STRING { // string type
$$ = new IntRecTy();
} | LIST '<' ClassID '>' { // list<x> type
$$ = new ListRecTy($3);
+ } | CODE { // code type
+ $$ = new CodeRecTy();
} | ClassID { // Record Type
$$ = new RecordRecTy($1);
};
diff --git a/support/tools/TableGen/Record.h b/support/tools/TableGen/Record.h
index 0ac5648c86..308047a2b4 100644
--- a/support/tools/TableGen/Record.h
+++ b/support/tools/TableGen/Record.h
@@ -131,6 +131,15 @@ public:
void print(std::ostream &OS) const;
};
+/// CodeRecTy - 'code' - Represent an code fragment, function or method.
+///
+struct CodeRecTy : public RecTy {
+ Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
+
+ void print(std::ostream &OS) const { OS << "code"; }
+};
+
+
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
/// (R32 X = EAX).
///
diff --git a/utils/TableGen/FileLexer.l b/utils/TableGen/FileLexer.l
index d3264da91a..34a2818b2f 100644
--- a/utils/TableGen/FileLexer.l
+++ b/utils/TableGen/FileLexer.l
@@ -151,6 +151,7 @@ bit { return BIT; }
bits { return BITS; }
string { return STRING; }
list { return LIST; }
+code { return CODE; }
class { return CLASS; }
def { return DEF; }
diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y
index 431fcfcc62..e906a5e4e3 100644
--- a/utils/TableGen/FileParser.y
+++ b/utils/TableGen/FileParser.y
@@ -153,7 +153,7 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
std::vector<SubClassRefTy> *SubClassList;
};
-%token INT BIT STRING BITS LIST CLASS DEF FIELD SET IN
+%token INT BIT STRING BITS LIST CODE CLASS DEF FIELD SET IN
%token <IntVal> INTVAL
%token <StrVal> ID STRVAL
@@ -202,6 +202,8 @@ Type : STRING { // string type
$$ = new IntRecTy();
} | LIST '<' ClassID '>' { // list<x> type
$$ = new ListRecTy($3);
+ } | CODE { // code type
+ $$ = new CodeRecTy();
} | ClassID { // Record Type
$$ = new RecordRecTy($1);
};
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 0ac5648c86..308047a2b4 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -131,6 +131,15 @@ public:
void print(std::ostream &OS) const;
};
+/// CodeRecTy - 'code' - Represent an code fragment, function or method.
+///
+struct CodeRecTy : public RecTy {
+ Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
+
+ void print(std::ostream &OS) const { OS << "code"; }
+};
+
+
/// RecordRecTy - '<classname>' - Represent an instance of a class, such as:
/// (R32 X = EAX).
///