static void check_tree (ipa_reference_local_vars_info_t local, tree t, bool checking_write) { if ((TREE_CODE (t) == EXC_PTR_EXPR) || (TREE_CODE (t) == FILTER_EXPR)) return; while (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR || handled_component_p (t)) { if (TREE_CODE (t) == ARRAY_REF) check_operand (local, TREE_OPERAND (t, 1), false); t = TREE_OPERAND (t, 0); } /* The bottom of an indirect reference can only be read, not written. So just recurse and whatever we find, check it against the read bitmaps. */ /* if (INDIRECT_REF_P (t) || TREE_CODE (t) == MEM_REF) */ /* FIXME when we have array_ref's of pointers. */ if (INDIRECT_REF_P (t)) check_tree (local, TREE_OPERAND (t, 0), false); if (SSA_VAR_P (t)) check_operand (local, t, checking_write); }
/*INFIX TO POSTFIX CONVERSION ALGO*/ void conversion(stack *s, char *ch,char *postfix) { int i=0,k=0; while(ch[i]!='\0') { if(check_operand(ch[i])) { postfix[k]=ch[i]; k++; } else { while(!empty_stack(s)&&precedence(s->item[s->top],ch[i])) { char c=pop(s); postfix[k]=c; k++; } push(s,ch[i]); } i++; } while(!empty_stack(s)) { char c=pop(s); postfix[k]=c; k++; } postfix[k]='\0'; }
void organize_toklist(t_node **tree, t_token **toklist, int pos, int prio) { t_ope operand; t_token *tmp; tmp = *toklist; operand = init_operand(-1, NULL); while (tmp) { if (!tmp->type || ((operand = check_operand(tmp->type)).name && operand.prio == prio)) break ; tmp = tmp->next; } if (operand.name && operand.prio == prio) { add_node(tree, new_node(tmp->type, tmp->word, pos)); ft_strdel(&tmp->type); organize_toklist(tree, toklist, pos * 2, operand.prio); if (tmp->next) organize_toklist(tree, &tmp->next, pos * 2 + 1, operand.prio); } else if (prio < 4) organize_toklist(tree, toklist, pos, prio + 1); else if (*toklist && (*toklist)->type && !ft_strcmp((*toklist)->type, "com")) add_node(tree, new_node("com", (*toklist)->word, pos)); }
static void check_tree (funct_state local, tree t, bool checking_write) { if ((TREE_CODE (t) == EXC_PTR_EXPR) || (TREE_CODE (t) == FILTER_EXPR)) return; /* Any tree which is volatile disqualifies thie function from being const or pure. */ if (TREE_THIS_VOLATILE (t)) { local->pure_const_state = IPA_NEITHER; return; } while (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR || handled_component_p (t)) { if (TREE_CODE (t) == ARRAY_REF) check_operand (local, TREE_OPERAND (t, 1), false); t = TREE_OPERAND (t, 0); } /* The bottom of an indirect reference can only be read, not written. */ if (INDIRECT_REF_P (t)) { check_tree (local, TREE_OPERAND (t, 0), false); /* Any indirect reference that occurs on the lhs disqualifies the function from being pure or const. Any indirect reference that occurs on the rhs disqualifies the function from being const. */ if (checking_write) { local->pure_const_state = IPA_NEITHER; return; } else if (local->pure_const_state == IPA_CONST) local->pure_const_state = IPA_PURE; } if (SSA_VAR_P (t)) check_operand (local, t, checking_write); }
int main(int argc, char **argv) { bool interactive = false; parse_option(argc,argv,&interactive); argc -= optind; argv += optind; check_operand(argc,argv); do_copy(argc,argv,interactive,data_copy); return EXIT_SUCCESS; }
void create_toklist(t_token **toklist, char *line) { char *new_line; int i; t_ope operand; i = 0; operand = init_operand(-1, NULL); while (line[i] && !(operand = check_operand(line + i)).name) i++; if (operand.name && (!ft_strcmp(operand.name, ">") || !ft_strcmp(operand.name, "<") || !ft_strcmp(operand.name, ">>"))) new_line = tokenize_redir(toklist, line); else if (line) new_line = tokenize_other(toklist, line); if (new_line && *new_line) create_toklist(toklist, new_line); else ft_strdel(&new_line); }