mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3785 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			39 lines
		
	
	
		
			529 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			529 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);
 | 
						|
	}
 | 
						|
}
 |