Bool matchIRExpr ( MatchInfo* mi, IRExpr* p/*attern*/, IRExpr* e/*xpr*/ ) { Int i; for (i = 0; i < N_IRMATCH_BINDERS; i++) mi->bindee[i] = NULL; return matchWrk(mi, p, e); }
static Bool matchWrk ( MatchInfo* mi, IRExpr* p/*attern*/, IRExpr* e/*xpr*/ ) { switch (p->tag) { case Iex_Binder: /* aha, what we were looking for. */ setBindee(mi, p->Iex.Binder.binder, e); return True; #if 0 case Iex_GetI: if (e->tag != Iex_GetI) return False; if (p->Iex.GetI.ty != e->Iex.GetI.ty) return False; /* we ignore the offset limit hints .. */ if (!matchWrk(mi, p->Iex.GetI.offset, e->Iex.GetI.offset)) return False; return True; #endif case Iex_Unop: if (e->tag != Iex_Unop) return False; if (p->Iex.Unop.op != e->Iex.Unop.op) return False; if (!matchWrk(mi, p->Iex.Unop.arg, e->Iex.Unop.arg)) return False; return True; case Iex_Binop: if (e->tag != Iex_Binop) return False; if (p->Iex.Binop.op != e->Iex.Binop.op) return False; if (!matchWrk(mi, p->Iex.Binop.arg1, e->Iex.Binop.arg1)) return False; if (!matchWrk(mi, p->Iex.Binop.arg2, e->Iex.Binop.arg2)) return False; return True; case Iex_Load: if (e->tag != Iex_Load) return False; if (p->Iex.Load.end != e->Iex.Load.end) return False; if (p->Iex.Load.ty != e->Iex.Load.ty) return False; if (!matchWrk(mi, p->Iex.Load.addr, e->Iex.Load.addr)) return False; return True; case Iex_Const: if (e->tag != Iex_Const) return False; return eqIRConst(p->Iex.Const.con, e->Iex.Const.con); default: ppIRExpr(p); vpanic("match"); } }
static Bool matchWrk ( MatchInfo* mi, IRExpr* p, IRExpr* e ) { switch (p->tag) { case Iex_Binder: setBindee(mi, p->Iex.Binder.binder, e); return True; case Iex_Unop: if (e->tag != Iex_Unop) return False; if (p->Iex.Unop.op != e->Iex.Unop.op) return False; if (!matchWrk(mi, p->Iex.Unop.arg, e->Iex.Unop.arg)) return False; return True; case Iex_Binop: if (e->tag != Iex_Binop) return False; if (p->Iex.Binop.op != e->Iex.Binop.op) return False; if (!matchWrk(mi, p->Iex.Binop.arg1, e->Iex.Binop.arg1)) return False; if (!matchWrk(mi, p->Iex.Binop.arg2, e->Iex.Binop.arg2)) return False; return True; case Iex_Load: if (e->tag != Iex_Load) return False; if (p->Iex.Load.end != e->Iex.Load.end) return False; if (p->Iex.Load.ty != e->Iex.Load.ty) return False; if (!matchWrk(mi, p->Iex.Load.addr, e->Iex.Load.addr)) return False; return True; case Iex_Const: if (e->tag != Iex_Const) return False; return eqIRConst(p->Iex.Const.con, e->Iex.Const.con); default: ppIRExpr(p); vpanic("match"); } }