public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [GSoC][match-and-simplify] simple doc-fix
@ 2014-08-17 20:41 Prathamesh Kulkarni
  2014-08-17 21:01 ` Prathamesh Kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Prathamesh Kulkarni @ 2014-08-17 20:41 UTC (permalink / raw)
  To: Richard Biener, Diego Novillo, Maxim Kuvyrkov, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 86 bytes --]

[gcc/doc]
  * match-and-simplify.texi: Replace addres by address.

Thanks,
Prathamesh

[-- Attachment #2: doc.patch --]
[-- Type: text/x-patch, Size: 615 bytes --]

Index: match-and-simplify.texi
===================================================================
--- match-and-simplify.texi	(revision 214020)
+++ match-and-simplify.texi	(working copy)
@@ -22,7 +22,7 @@ tries to address several issues.
 To address these the project introduces a simple domain specific language
 to write expression simplifications from which code targeting GIMPLE
 and GENERIC is auto-generated.  The GENERIC variant follows the
-fold_buildN API while for the GIMPLE variant and to addres 2) new
+fold_buildN API while for the GIMPLE variant and to address 2) new
 APIs are introduced.
 
 @menu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GSoC][match-and-simplify] simple doc-fix
  2014-08-17 20:41 [GSoC][match-and-simplify] simple doc-fix Prathamesh Kulkarni
@ 2014-08-17 21:01 ` Prathamesh Kulkarni
  2014-08-18 11:16   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Prathamesh Kulkarni @ 2014-08-17 21:01 UTC (permalink / raw)
  To: Richard Biener, Diego Novillo, Maxim Kuvyrkov, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Mon, Aug 18, 2014 at 2:11 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> [gcc/doc]
>   * match-and-simplify.texi: Replace addres by address.
>
This version adds a small note for capturing expressions.

[gcc/doc]
  * match-and-simplify.texi: Add documentation for capturing expressions.
                                        Replace addres by address.


Thanks,
Prathamesh

> Thanks,
> Prathamesh

[-- Attachment #2: doc.patch --]
[-- Type: text/x-patch, Size: 1759 bytes --]

Index: match-and-simplify.texi
===================================================================
--- match-and-simplify.texi	(revision 214020)
+++ match-and-simplify.texi	(working copy)
@@ -22,7 +22,7 @@ tries to address several issues.
 To address these the project introduces a simple domain specific language
 to write expression simplifications from which code targeting GIMPLE
 and GENERIC is auto-generated.  The GENERIC variant follows the
-fold_buildN API while for the GIMPLE variant and to addres 2) new
+fold_buildN API while for the GIMPLE variant and to address 2) new
 APIs are introduced.
 
 @menu
@@ -152,6 +152,32 @@ to enable the replacement expression.  T
 of the @code{if} is a standard C expression which may contain references
 to captures.
 
+Capturing Expressions:
+Captures can also be used for capturing results of sub-expressions.
+
+@smallexample
+#if GIMPLE
+(simplify
+  (pointer_plus (addr@@2 @@0) INTEGER_CST_P@@1)
+  (if (is_gimple_min_invariant (@@2)))
+  @{
+    HOST_WIDE_INT off;
+    tree base = get_addr_base_and_unit_offset (@@0, &off);
+    off += tree_to_uhwi (@@1);
+    /* Now with that we should be able to simply write
+       (addr (mem_ref (addr @@base) (plus @@off @@1)))  */
+    build1 (ADDR_EXPR, type,
+            build2 (MEM_REF, TREE_TYPE (TREE_TYPE (@@2)),
+                    build_fold_addr_expr (base),
+                    build_int_cst (ptr_type_node, off)));
+  @})
+#endif
+@end smallexample
+
+In the above example, @code{@@2} captures the result of the expression (addr @code{@@0}).
+For outermost expression only it's type can be captured, and the keyword
+@code{type} is reserved for this purpose.
+
 @smallexample
 (simplify
   (bit_and:c integral_op_p@@0 (bit_ior:c (bit_not @@0) @@1))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GSoC][match-and-simplify] simple doc-fix
  2014-08-17 21:01 ` Prathamesh Kulkarni
@ 2014-08-18 11:16   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2014-08-18 11:16 UTC (permalink / raw)
  To: Prathamesh Kulkarni; +Cc: Diego Novillo, Maxim Kuvyrkov, gcc-patches

On Sun, Aug 17, 2014 at 11:01 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> On Mon, Aug 18, 2014 at 2:11 AM, Prathamesh Kulkarni
> <bilbotheelffriend@gmail.com> wrote:
>> [gcc/doc]
>>   * match-and-simplify.texi: Replace addres by address.
>>
> This version adds a small note for capturing expressions.
>
> [gcc/doc]
>   * match-and-simplify.texi: Add documentation for capturing expressions.
>                                         Replace addres by address.

Edited slightly and committed.

Richard.

>
> Thanks,
> Prathamesh
>
>> Thanks,
>> Prathamesh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-18 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-17 20:41 [GSoC][match-and-simplify] simple doc-fix Prathamesh Kulkarni
2014-08-17 21:01 ` Prathamesh Kulkarni
2014-08-18 11:16   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).