aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-02 16:43:43 +0000
committerChris Lattner <sabre@nondot.org>2002-12-02 16:43:43 +0000
commit34a7769b0b53179c85854203e075b3c10267b154 (patch)
tree40b1527a3c0e5faa2069ac5cfaf2f85b8ebac1ed
parent28520c4b61ed71d6c47ce3f9bfc9e2ed659d51a5 (diff)
downloadexternal_llvm-34a7769b0b53179c85854203e075b3c10267b154.zip
external_llvm-34a7769b0b53179c85854203e075b3c10267b154.tar.gz
external_llvm-34a7769b0b53179c85854203e075b3c10267b154.tar.bz2
Add support for field exprs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4850 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--support/tools/TableGen/FileParser.y7
-rw-r--r--utils/TableGen/FileParser.y7
2 files changed, 14 insertions, 0 deletions
diff --git a/support/tools/TableGen/FileParser.y b/support/tools/TableGen/FileParser.y
index 624a797..38efb83 100644
--- a/support/tools/TableGen/FileParser.y
+++ b/support/tools/TableGen/FileParser.y
@@ -258,6 +258,13 @@ Value : INTVAL {
} | '[' DefList ']' {
$$ = new ListInit(*$2);
delete $2;
+ } | Value '.' ID {
+ if (!$1->getFieldType(*$3)) {
+ err() << "Cannot access field '" << *$3 << "' of value '" << *$1 << "!\n";
+ abort();
+ }
+ $$ = new FieldInit($1, *$3);
+ delete $3;
};
DefList : /*empty */ {
diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y
index 624a797..38efb83 100644
--- a/utils/TableGen/FileParser.y
+++ b/utils/TableGen/FileParser.y
@@ -258,6 +258,13 @@ Value : INTVAL {
} | '[' DefList ']' {
$$ = new ListInit(*$2);
delete $2;
+ } | Value '.' ID {
+ if (!$1->getFieldType(*$3)) {
+ err() << "Cannot access field '" << *$3 << "' of value '" << *$1 << "!\n";
+ abort();
+ }
+ $$ = new FieldInit($1, *$3);
+ delete $3;
};
DefList : /*empty */ {