Re: [PATCH 3/5] add ptr_list_multiple()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 24/07/18 21:34, Luc Van Oostenryck wrote:
> When doing IR simplification, it's often needed to check if the
> result of a instructions is used by a single instruction in which

s/a instructions/an instruction/ ?

> case it can be destructively modified together with its user.
> 
> Currently this is done using ptr_list_size() which needs to walk
> the whole list which is relatively costly when the list is long
> while knowing if the list contains more than 1 element can often
> be answered cheaply by inspecting only the first block.
> 
> Add the helpers ptr_list_multiple() and multi_users().

s/multi_users()/multiple_users()/ ?

> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  linearize.h |  5 +++++
>  ptrlist.c   | 21 +++++++++++++++++++++
>  ptrlist.h   |  1 +
>  simplify.c  |  2 +-
>  4 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/linearize.h b/linearize.h
> index de42e718d..b067b3e84 100644
> --- a/linearize.h
> +++ b/linearize.h
> @@ -343,6 +343,11 @@ static inline int has_users(pseudo_t p)
>  	return !pseudo_user_list_empty(p->users);
>  }
>  
> +static inline bool multi_users(pseudo_t p)
> +{
> +	return ptr_list_multiple((struct ptr_list *)(p->users));
> +}
> +
>  static inline struct pseudo_user *alloc_pseudo_user(struct instruction *insn, pseudo_t *pp)
>  {
>  	struct pseudo_user *user = __alloc_pseudo_user(0);
> diff --git a/ptrlist.c b/ptrlist.c
> index 40a671000..4cd3baca9 100644
> --- a/ptrlist.c
> +++ b/ptrlist.c
> @@ -55,6 +55,27 @@ bool ptr_list_empty(const struct ptr_list *head)
>  	return true;
>  }
>  
> +///
> +// test is a list contains more than one element
> +// @head: the head of the list
> +// @return: ``true`` if the list has more than 1 element, '``false``otherwise.

Hmm, so the ' is maybe deliberate - or cut-n-paste?

ATB,
Ramsay Jones
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux