This is the mail archive of the 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]

Re: [PATCH, MPX, 2/X] Pointers Checker [1/25] Hooks

On 10/24/13 02:24, Ilya Enkovich wrote:
2013/10/24 Jeff Law <>:
On 10/21/13 08:20, Ilya Enkovich wrote:

diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 8d220f3..79bd0f9 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
+@deftypefn {Target Hook} rtx TARGET_LOAD_BOUNDS_FOR_ARG (rtx @var{slot},
rtx @var{arg}, rtx @var{slot_no})
+This hook is used to emit insn to load bounds of @var{arg} passed
+in @var{slot}.  In case @var{slot} is not a memory, @var{slot_no} is RTX
+constant holding number of the special slot we should get bounds from.
+Return loaded bounds.
+@end deftypefn
+@deftypefn {Target Hook} void TARGET_STORE_BOUNDS_FOR_ARG (rtx @var{arg},
rtx @var{slot}, rtx @var{bounds}, rtx @var{slot_no})
+This hook is used to emit insn to store bounds of @var{arg} passed
+in @var{slot}.  In case @var{slot} is not a memory, @var{slot_no} is RTX
+constant holding number of the special slot we should store bounds to.
+@end deftypefn

Almost there. What I think is missing is more information about the case
where SLOT is not a memory (presumably it's a reg) and how that relates to

Isn't this just providing a mapping from the input argument registers to
some set of bounds pointer registers?  Presumably you aren't really exposing
the bound registers as argument registers hence this hack?

Not asking you to change anything, just trying to understand the rationale.

These two hooks are used by expand pass to pass/receive bounds for
args. When bounds are passed in a register, expand does not need this
hook and uses regular move insn. If we are out of bound register or
platform does not have them at all, this hook is called. If bounded
arg is passed in memory, regular way to store associated bounds is
supposed to be used in hook. That is why no slot_no value is required,
only arg and it's place (slot) are used. If bounded arg is passed in
register (e.g. it happens on i386 with MPX when more that 4 pointers
are passed in registers), then some special slot has to be used for
bounds. slot_no here holds identifier of this special slot. E.g. if we
call function with 6 pointer on i386, we call this hook passing R8 and
R9 as slot with const1_rtx and const2_rtx as slot_no.
So can we find a concise way to describe this and include that in the docs for the hooks. Otherwise I can't see how a developer is going to know how to use this stuff.

So how am I (as a GCC developer) suppsoed to know what BNDMK, BNDLDX, BNDCU,
etc mean?  The names aren't particularly descriptive.  Are these documented
elsewhere in a follow-up patch?  If not, it seems to me we need to document
them here.

Actually the next patch introduces them and is a good place for
documentation. But currently this patch has documentation for user
visible built-ins only. For now built-ins used for instrumentation are
described on Wiki only
Where should I move it? Does it also go to extend.texi?
If they're strictly for developers, then there's not a real good place for them. They're not really extensions we would expect the user to use, so extend.texi seems inappropriate.

Perhaps a section in tm.texi?


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