This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Note issues using function calls in length computations



David Malcolm's valgrind testing uncovered a problem where the x86 port was using a function call to compute the length of a variable length insn. This causes a certain amount of heartburn for genattrtab's attempts to compute worst case estimates of instruction lengths with the resulting valgrind symptom being uninitialized memory reads.

There's known workarounds for this issue where a dummy length clause can be used to tell genattrtab the worst case instruction length. The SH and PA port are known to use those workarounds.

This minor doc patch mentions the issue and refers readers to the PA port's call pattern where the workaround is used.

Testing via "make doc" and installed onto the trunk.

commit 650ccd2a9782687056678276034f44371892ae9a
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Dec 5 22:19:26 2014 +0000

            * doc/md.texi: Note problems using function calls to determine
            insn lengths and point readers to a potential workaround.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218439 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9538737..0dcf649 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-05  Jeff Law  <law@redhat.com>
+
+	* doc/md.texi: Note problems using function calls to determine
+	insn lengths and point readers to a potential workaround.
+
 2014-12-05  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* combine.c (is_parallel_of_n_reg_sets)
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index b8e5ac5..1c70a77 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -8345,6 +8345,12 @@ the number of vectors multiplied by the size of each vector.
 
 Lengths are measured in addressable storage units (bytes).
 
+Note that it is possible to call functions via the @code{symbol_ref}
+mechanism to compute the length of an insn.  However, if you use this
+mechanism you must provide dummy clauses to express the maximum length
+without using the function call.  You can an example of this in the
+@code{pa} machine description for the @code{call_symref} pattern.
+
 The following macros can be used to refine the length computation:
 
 @table @code

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]