aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules2
-rw-r--r--test/LLVMC/MultipleOutputLanguages.td2
-rw-r--r--test/LLVMC/OptionPreprocessor.td2
-rw-r--r--test/TableGen/Dag.td36
-rw-r--r--utils/TableGen/TGParser.cpp23
5 files changed, 57 insertions, 8 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 261578f..62718b7 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1779,7 +1779,7 @@ $(INCTMPFiles) : $(TBLGEN) $(TDFiles)
$(ObjDir)/%.inc.tmp: %.td $(ObjDir)/.dir
$(Echo) "Building LLVMC compilation graph description with tblgen"
- $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
+ $(Verb) $(TableGen) -gen-llvmc -llvmc-temp-hack -o $(call SYSPATH, $@) $<
clean-local::
-$(Verb) $(RM) -f $(INCFiles)
diff --git a/test/LLVMC/MultipleOutputLanguages.td b/test/LLVMC/MultipleOutputLanguages.td
index 02512c2..16ce6be 100644
--- a/test/LLVMC/MultipleOutputLanguages.td
+++ b/test/LLVMC/MultipleOutputLanguages.td
@@ -1,5 +1,5 @@
// Check that multiple output languages work.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
+// RUN: tblgen -I %p/../../include -llvmc-temp-hack --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx %t
// XFAIL: vg_leak
diff --git a/test/LLVMC/OptionPreprocessor.td b/test/LLVMC/OptionPreprocessor.td
index 8019c42..44670ce 100644
--- a/test/LLVMC/OptionPreprocessor.td
+++ b/test/LLVMC/OptionPreprocessor.td
@@ -1,5 +1,5 @@
// Test for the OptionPreprocessor and related functionality.
-// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
+// RUN: tblgen -I %p/../../include -llvmc-temp-hack --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx %t
// XFAIL: vg_leak
diff --git a/test/TableGen/Dag.td b/test/TableGen/Dag.td
index 8b406a5..d3481a5 100644
--- a/test/TableGen/Dag.td
+++ b/test/TableGen/Dag.td
@@ -33,3 +33,39 @@ def VAL2 : C2<Y2>;
// CHECK-NEXT: dag d = (X2 Y2)
// CHECK-NEXT: dag e = (Y2 X2)
+
+//===----------------------------------------------------------------------===//
+// Complex dag operator (F.TheOp).
+
+class operator;
+def somedef1 : operator;
+def somedef2 : operator;
+
+class foo<operator a> {
+ operator TheOp = a;
+}
+
+class bar<foo F, operator a> {
+ dag Dag1 = (somedef1 1);
+ dag Dag2 = (a 2);
+ dag Dag3 = (F.TheOp 2);
+}
+
+def foo1 : foo<somedef1>;
+def foo2 : foo<somedef2>;
+
+def VAL3 : bar<foo1, somedef1>;
+
+// CHECK: def VAL3 { // bar
+// CHECK-NEXT: dag Dag1 = (somedef1 1);
+// CHECK-NEXT: dag Dag2 = (somedef1 2);
+// CHECK-NEXT: dag Dag3 = (somedef1 2);
+// CHECK-NEXT: }
+
+
+def VAL4 : bar<foo2, somedef2>;
+// CHECK: def VAL4 {
+// CHECK-NEXT: dag Dag1 = (somedef1 1);
+// CHECK-NEXT: dag Dag2 = (somedef2 2);
+// CHECK-NEXT: dag Dag3 = (somedef2 2);
+// CHECK-NEXT: }
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp
index b0389dd..188ba4d 100644
--- a/utils/TableGen/TGParser.cpp
+++ b/utils/TableGen/TGParser.cpp
@@ -17,8 +17,14 @@
#include <algorithm>
#include <sstream>
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/CommandLine.h"
using namespace llvm;
+/// LLVMCHack - This is a temporary hack that changes how "(foo [1, 2, 3])"
+/// parses.
+/// FIXME: REMOVE THIS.
+static cl::opt<bool> LLVMCHack("llvmc-temp-hack", cl::ReallyHidden);
+
//===----------------------------------------------------------------------===//
// Support Code for the Semantic Actions.
//===----------------------------------------------------------------------===//
@@ -1213,11 +1219,18 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) {
return 0;
}
- Init *Operator = 0;
- if (Lex.getCode() == tgtok::Id)
- Operator = ParseIDValue(CurRec);
- else
- Operator = ParseOperation(CurRec);
+ Init *Operator;
+ /// LLVMC Requires an old grammar and I don't know how to update it, placate
+ /// it in the short term by changing the grammar specifically for llvmc.
+ /// FIXME: REMOVE THIS.
+ if (!LLVMCHack)
+ Operator = ParseValue(CurRec);
+ else {
+ if (Lex.getCode() == tgtok::Id)
+ Operator = ParseIDValue(CurRec);
+ else
+ Operator = ParseOperation(CurRec);
+ }
if (Operator == 0) return 0;
// If the operator name is present, parse it.