mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
4d31aeb9df
llvm-svn: 21441
39 lines
567 B
C
39 lines
567 B
C
char rcsid_pattern[] = "$Id$";
|
|
|
|
#include <stdio.h>
|
|
#include "b.h"
|
|
|
|
Pattern
|
|
newPattern(op) Operator op;
|
|
{
|
|
Pattern p;
|
|
|
|
p = (Pattern) zalloc(sizeof(struct pattern));
|
|
p->op = op;
|
|
return p;
|
|
}
|
|
|
|
void
|
|
dumpPattern(p) Pattern p;
|
|
{
|
|
int i;
|
|
|
|
if (!p) {
|
|
printf("[no-pattern]");
|
|
return;
|
|
}
|
|
|
|
if (p->op) {
|
|
printf("%s", p->op->name);
|
|
if (p->op->arity > 0) {
|
|
printf("(");
|
|
for (i = 0; i < p->op->arity; i++) {
|
|
printf("%s ", p->children[i]->name);
|
|
}
|
|
printf(")");
|
|
}
|
|
} else {
|
|
printf("%s", p->children[0]->name);
|
|
}
|
|
}
|