'Look for potential macros for expand and store their expansions.'

def match(self, func_ir, block, typemap, calltypes):

    self.block = block
    self.rewrites = rewrites = {}
    for inst in block.body:
        if isinstance(inst, ir.Assign):
            rhs = inst.value
            if (isinstance(rhs, ir.Expr) and (rhs.op == 'call') and isinstance(rhs.func, ir.Var)):
                try:
                    const = func_ir.infer_constant(rhs.func)
                except errors.ConstantInferenceError:
                    continue
                if isinstance(const, Macro):
                    assert const.callable
                    new_expr = self._expand_callable_macro(func_ir, rhs, const, rhs.loc)
                    rewrites[rhs] = new_expr
            elif (isinstance(rhs, ir.Expr) and (rhs.op == 'getattr')):
                try:
                    const = func_ir.infer_constant(inst.target)
                except errors.ConstantInferenceError:
                    continue
                if (isinstance(const, Macro) and (not const.callable)):
                    new_expr = self._expand_non_callable_macro(const, rhs.loc)
                    rewrites[rhs] = new_expr
    return (len(rewrites) > 0)
