Initial support for the 'code' type.
authorChris Lattner <sabre@nondot.org>
Wed, 30 Jul 2003 21:47:42 +0000 (21:47 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 30 Jul 2003 21:47:42 +0000 (21:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7439 91177308-0d34-0410-b5e6-96231b3b80d8

support/tools/TableGen/FileLexer.l
support/tools/TableGen/FileParser.y
support/tools/TableGen/Record.h
utils/TableGen/FileLexer.l
utils/TableGen/FileParser.y
utils/TableGen/Record.h

index d3264da91a02381a77fc187a2d6ff6ff2a8000fc..34a2818b2f2b347b787c54ea4446f22715e5dd63 100644 (file)
@@ -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; }
index 431fcfcc624edc72ba0cb31a50e9ea88cf645c0b..e906a5e4e38d292e014e66a0afe75f084991a0e7 100644 (file)
@@ -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);
   };
index 0ac5648c86d03004f7075be4f5ac041ce249cc25..308047a2b432e94deb4f531a9e25838309e2ca17 100644 (file)
@@ -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).
 ///
index d3264da91a02381a77fc187a2d6ff6ff2a8000fc..34a2818b2f2b347b787c54ea4446f22715e5dd63 100644 (file)
@@ -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; }
index 431fcfcc624edc72ba0cb31a50e9ea88cf645c0b..e906a5e4e38d292e014e66a0afe75f084991a0e7 100644 (file)
@@ -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);
   };
index 0ac5648c86d03004f7075be4f5ac041ce249cc25..308047a2b432e94deb4f531a9e25838309e2ca17 100644 (file)
@@ -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).
 ///