mesa: more debug output
This commit is contained in:
@@ -171,9 +171,15 @@ static void
|
||||
print_binary(const slang_operation *op, const char *oper, int indent)
|
||||
{
|
||||
assert(op->num_children == 2);
|
||||
printf("binary at %p locals=%p outer=%p\n",
|
||||
(void *) op,
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
slang_print_tree(&op->children[0], indent + 3);
|
||||
spaces(indent);
|
||||
printf("%s\n", oper);
|
||||
printf("%s at %p locals=%p outer=%p\n",
|
||||
oper, (void *) op, (void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
slang_print_tree(&op->children[1], indent + 3);
|
||||
}
|
||||
|
||||
@@ -182,14 +188,16 @@ static void
|
||||
print_generic2(const slang_operation *op, const char *oper,
|
||||
const char *s, int indent)
|
||||
{
|
||||
int i;
|
||||
GLuint i;
|
||||
if (oper) {
|
||||
spaces(indent);
|
||||
printf("[%p locals %p] %s %s\n", (void*) op, (void*) op->locals, oper, s);
|
||||
printf("%s %s at %p locals=%p outer=%p\n",
|
||||
oper, s, (void *) op, (void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
}
|
||||
for (i = 0; i < op->num_children; i++) {
|
||||
spaces(indent);
|
||||
printf("//child %d:\n", i);
|
||||
printf("//child %u of %u:\n", i, op->num_children);
|
||||
slang_print_tree(&op->children[i], indent);
|
||||
}
|
||||
}
|
||||
@@ -244,7 +252,7 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_BLOCK_NO_NEW_SCOPE:
|
||||
spaces(indent);
|
||||
printf("{ locals %p outer %p\n", (void*)op->locals, (void*)op->locals->outer_scope);
|
||||
printf("{ locals=%p outer=%p\n", (void*)op->locals, (void*)op->locals->outer_scope);
|
||||
print_generic(op, NULL, indent+3);
|
||||
spaces(indent);
|
||||
printf("}\n");
|
||||
@@ -252,7 +260,14 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_BLOCK_NEW_SCOPE:
|
||||
spaces(indent);
|
||||
printf("{{ // new scope locals %p\n", (void*)op->locals);
|
||||
printf("{{ // new scope locals=%p: ", (void*)op->locals);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < op->locals->num_variables; i++) {
|
||||
printf("%s ", (char *) op->locals->variables[i]->a_name);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
print_generic(op, NULL, indent+3);
|
||||
spaces(indent);
|
||||
printf("}}\n");
|
||||
@@ -264,14 +279,16 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
slang_variable *v;
|
||||
v = _slang_locate_variable(op->locals, op->a_id, GL_TRUE);
|
||||
if (v) {
|
||||
const slang_variable_scope *scope;
|
||||
spaces(indent);
|
||||
printf("DECL (locals=%p outer=%p) ", (void*)op->locals, (void*) op->locals->outer_scope);
|
||||
print_type(&v->type);
|
||||
printf(" %s (%p)", (char *) op->a_id,
|
||||
(void *) find_var(op->locals, op->a_id));
|
||||
|
||||
printf(" (in scope %p) ",
|
||||
(void *) find_scope(op->locals, op->a_id));
|
||||
scope = find_scope(op->locals, op->a_id);
|
||||
printf(" (in scope %p) ", (void *) scope);
|
||||
assert(scope);
|
||||
if (op->num_children == 1) {
|
||||
printf(" :=\n");
|
||||
slang_print_tree(&op->children[0], indent + 3);
|
||||
@@ -300,8 +317,12 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_ASM:
|
||||
spaces(indent);
|
||||
printf("ASM: %s\n", (char*) op->a_id);
|
||||
print_generic(op, NULL, indent+3);
|
||||
printf("ASM: %s at %p locals=%p outer=%p\n",
|
||||
(char *) op->a_id,
|
||||
(void *) op,
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
print_generic(op, "ASM", indent+3);
|
||||
break;
|
||||
|
||||
case SLANG_OPER_BREAK:
|
||||
@@ -333,7 +354,9 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_EXPRESSION:
|
||||
spaces(indent);
|
||||
printf("EXPR: locals %p\n", (void*) op->locals);
|
||||
printf("EXPR: locals=%p outer=%p\n",
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
/*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/
|
||||
slang_print_tree(&op->children[0], indent + 3);
|
||||
break;
|
||||
@@ -422,13 +445,25 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
break;
|
||||
|
||||
case SLANG_OPER_IDENTIFIER:
|
||||
spaces(indent);
|
||||
if (op->var && op->var->a_name)
|
||||
printf("VAR %s (in scope %p)\n", (char *) op->var->a_name,
|
||||
(void *) find_scope(op->locals, op->a_id));
|
||||
else
|
||||
printf("VAR' %s (in scope %p)\n", (char *) op->a_id,
|
||||
(void *) find_scope(op->locals, op->a_id));
|
||||
{
|
||||
const slang_variable_scope *scope;
|
||||
spaces(indent);
|
||||
if (op->var && op->var->a_name) {
|
||||
scope = find_scope(op->locals, op->var->a_name);
|
||||
printf("VAR %s (in scope %p)\n", (char *) op->var->a_name,
|
||||
(void *) scope);
|
||||
assert(scope);
|
||||
}
|
||||
else {
|
||||
scope = find_scope(op->locals, op->a_id);
|
||||
printf("VAR' %s (in scope %p) locals=%p outer=%p\n",
|
||||
(char *) op->a_id,
|
||||
(void *) scope,
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
assert(scope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SLANG_OPER_SEQUENCE:
|
||||
@@ -437,7 +472,9 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_ASSIGN:
|
||||
spaces(indent);
|
||||
printf("ASSIGNMENT locals %p\n", (void*)op->locals);
|
||||
printf("ASSIGNMENT locals=%p outer=%p\n",
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
print_binary(op, ":=", indent);
|
||||
break;
|
||||
|
||||
@@ -573,7 +610,9 @@ slang_print_tree(const slang_operation *op, int indent)
|
||||
|
||||
case SLANG_OPER_SUBSCRIPT:
|
||||
spaces(indent);
|
||||
printf("SLANG_OPER_SUBSCRIPT\n");
|
||||
printf("SLANG_OPER_SUBSCRIPT locals=%p outer=%p\n",
|
||||
(void *) op->locals,
|
||||
(void *) op->locals->outer_scope);
|
||||
print_generic(op, NULL, indent+3);
|
||||
break;
|
||||
|
||||
@@ -640,7 +679,8 @@ slang_print_function(const slang_function *f, GLboolean body)
|
||||
print_variable(f->parameters->variables[i], 3);
|
||||
}
|
||||
|
||||
printf(")\n");
|
||||
printf(") param scope = %p\n", (void *) f->parameters);
|
||||
|
||||
if (body && f->body)
|
||||
slang_print_tree(f->body, 0);
|
||||
}
|
||||
@@ -804,7 +844,7 @@ int
|
||||
slang_checksum_tree(const slang_operation *op)
|
||||
{
|
||||
int s = op->num_children;
|
||||
int i;
|
||||
GLuint i;
|
||||
|
||||
for (i = 0; i < op->num_children; i++) {
|
||||
s += slang_checksum_tree(&op->children[i]);
|
||||
|
Reference in New Issue
Block a user