[1/5] Add stringify_ipa_ref_use function.

Message ID d1b21301-d16c-65d7-f73f-7cbbb413bf04@theobroma-systems.com
State New
Headers show
Series
  • ipa-initcall-cp
Related show

Commit Message

Erick Ochoa May 29, 2020, 5:30 p.m.
---
  gcc/ipa-ref.c | 22 ++++++++++++++++++++++
  gcc/ipa-ref.h |  3 +++
  2 files changed, 25 insertions(+)

-- 
2.18.1

Comments

Jan Hubicka May 29, 2020, 9:02 p.m. | #1
Hello,
> 

> 

> ---

>  gcc/ipa-ref.c | 22 ++++++++++++++++++++++

>  gcc/ipa-ref.h |  3 +++

>  2 files changed, 25 insertions(+)

> 

> diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c

> index 241828ee973..76459e9cc3d 100644

> --- a/gcc/ipa-ref.c

> +++ b/gcc/ipa-ref.c

> @@ -103,3 +103,25 @@ ipa_ref::referred_ref_list (void)

>  {

>    return &referred->ref_list;

>  }

> +

> +const char *

> +stringify_ipa_ref_use (const ipa_ref_use use)

> +{

> +  switch (use)

> +    {

> +    case IPA_REF_LOAD:

> +      return "IPA_REF_LOAD";

> +      break;

> +    case IPA_REF_STORE:

> +      return "IPA_REF_STORE";

> +      break;

> +    case IPA_REF_ADDR:

> +      return "IPA_REF_ADDR";

> +      break;

> +    case IPA_REF_ALIAS:

> +      return "IPA_REF_ALIAS";

> +      break;

> +    default:

> +      return "<unknown>";

> +    }

There is ipa_ref_use_name that also turns ipa_ref to string. I guess you
can use the same mechanizm in case this is used for debug output?

Honza

Patch

diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c
index 241828ee973..76459e9cc3d 100644
--- a/gcc/ipa-ref.c
+++ b/gcc/ipa-ref.c
@@ -103,3 +103,25 @@  ipa_ref::referred_ref_list (void)
  {
    return &referred->ref_list;
  }
+
+const char *
+stringify_ipa_ref_use (const ipa_ref_use use)
+{
+  switch (use)
+    {
+    case IPA_REF_LOAD:
+      return "IPA_REF_LOAD";
+      break;
+    case IPA_REF_STORE:
+      return "IPA_REF_STORE";
+      break;
+    case IPA_REF_ADDR:
+      return "IPA_REF_ADDR";
+      break;
+    case IPA_REF_ALIAS:
+      return "IPA_REF_ALIAS";
+      break;
+    default:
+      return "<unknown>";
+    }
+}
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 1de5bd34b82..95e29605548 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -137,4 +137,7 @@  public:
    vec<ipa_ref_ptr>  GTY((skip)) referring;
  };

+const char *
+stringify_ipa_ref_use (const ipa_ref_use use);
+
  #endif /* GCC_IPA_REF_H */