+2019-10-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ * function-abi.h (expr_callee_abi): Declare.
+ * function-abi.cc (expr_callee_abi): New function.
+
2019-10-14 Aldy Hernandez <aldyh@redhat.com>
* tree-vrp.c (value_range_base::set): Normalize unsigned ~[0,0]
return default_function_abi;
}
+
+/* Return the ABI of the function called by CALL_EXPR EXP. Return the
+ default ABI for erroneous calls. */
+
+function_abi
+expr_callee_abi (const_tree exp)
+{
+ gcc_assert (TREE_CODE (exp) == CALL_EXPR);
+
+ if (tree fndecl = get_callee_fndecl (exp))
+ return fndecl_abi (fndecl);
+
+ tree callee = CALL_EXPR_FN (exp);
+ if (callee == error_mark_node)
+ return default_function_abi;
+
+ tree type = TREE_TYPE (callee);
+ if (type == error_mark_node)
+ return default_function_abi;
+
+ if (POINTER_TYPE_P (type))
+ {
+ type = TREE_TYPE (type);
+ if (type == error_mark_node)
+ return default_function_abi;
+ }
+
+ return fntype_abi (type);
+}
extern const predefined_function_abi &fntype_abi (const_tree);
extern function_abi fndecl_abi (const_tree);
extern function_abi insn_callee_abi (const rtx_insn *);
+extern function_abi expr_callee_abi (const_tree);
#endif