summaryrefslogtreecommitdiff
path: root/support/tools/Burg/operator.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-17 23:03:30 +0000
committerChris Lattner <sabre@nondot.org>2002-09-17 23:03:30 +0000
commit633a5b1aacb135957b20e5f11e779ea23ccb9619 (patch)
tree3ddd35119d12cadf13e31f3cae9f67b057332440 /support/tools/Burg/operator.c
parent24b70926d5750dacadc3252f8fbcc964b369e2af (diff)
downloadllvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.tar.gz
llvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.tar.bz2
llvm-633a5b1aacb135957b20e5f11e779ea23ccb9619.tar.xz
Initial checkin of burg files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'support/tools/Burg/operator.c')
-rw-r--r--support/tools/Burg/operator.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/support/tools/Burg/operator.c b/support/tools/Burg/operator.c
new file mode 100644
index 0000000000..a6df9e304d
--- /dev/null
+++ b/support/tools/Burg/operator.c
@@ -0,0 +1,48 @@
+char rcsid_operator[] = "$Id$";
+
+#include "b.h"
+#include <stdio.h>
+
+int max_arity = -1;
+
+List operators;
+List leaves;
+
+Operator
+newOperator(name, num, arity) char *name; OperatorNum num; ArityNum arity;
+{
+ Operator op;
+
+ assert(arity <= MAX_ARITY);
+ op = (Operator) zalloc(sizeof(struct operator));
+ assert(op);
+ op->name = name;
+ op->num = num;
+ op->arity = arity;
+
+ operators = newList(op, operators);
+
+ return op;
+}
+
+void
+dumpOperator_s(op) Operator op;
+{
+ printf("Op: %s(%d)=%d\n", op->name, op->arity, op->num);
+}
+
+void
+dumpOperator(op, full) Operator op; int full;
+{
+ dumpOperator_s(op);
+ if (full) {
+ dumpTable(op->table, 0);
+ }
+}
+
+void
+dumpOperator_l(op) Operator op;
+{
+ dumpOperator(op, 1);
+}
+