Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-23 Thread Jose E. Marchesi
> +(define_insn "*branch_on_di" > + [(set (pc) > + (if_then_else (match_operator 3 "ordered_comparison_operator" > + [(match_operand:DI 0 "register_operand" "r") > + (match_operand:DI 1 "reg_or_imm_operand" "rI")]) > + (

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-23 Thread Joseph Myers
On Sat, 17 Aug 2019, Jose E. Marchesi wrote: > +(define_insn "*branch_on_di" > + [(set (pc) > + (if_then_else (match_operator 3 "ordered_comparison_operator" > + [(match_operand:DI 0 "register_operand" "r") > + (match_operand:DI 1 "reg_or_imm_operand

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-23 Thread Richard Sandiford
jose.march...@oracle.com (Jose E. Marchesi) writes: > > +#undef TARGET_PASS_BY_REFERENCE > > +#define TARGET_PASS_BY_REFERENCE bpf_pass_by_reference > > I might have misunderstood, but I thought from an earlier (IRC?) > message, it wasn't possible for the ca

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-22 Thread Segher Boessenkool
Hi! On Thu, Aug 22, 2019 at 04:11:46AM +0200, Jose E. Marchesi wrote: > A colleague (who actually _uses_ eBPF extensively, ahem) tells me that > the kernel verifier allows to pass addresses of the caller's stack > frame, tracking that it is a ptr to a stack location, and it knows which > stack it

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-21 Thread Jose E. Marchesi
> +#undef TARGET_PASS_BY_REFERENCE > +#define TARGET_PASS_BY_REFERENCE bpf_pass_by_reference I might have misunderstood, but I thought from an earlier (IRC?) message, it wasn't possible for the callee to access the caller's frame, which was why you

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-21 Thread Jonathan Corbet
On Tue, 20 Aug 2019 23:14:35 +0200 jose.march...@oracle.com (Jose E. Marchesi) wrote: > The kernel verifier doesn't allow backward jumps. > > This may change at some point. There is much discussion among the > kernel hackers in whether it is possible to allow bounded loops in a > safe way. In t

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-21 Thread Segher Boessenkool
On Tue, Aug 20, 2019 at 03:42:53PM -0600, Jeff Law wrote: > > I have been thinking about Segher's suggestion on providing options to > > lift some of the limitations, for compiler testing. Unfortunately, many > > of the restrictions are deeply rooted in the design of the > > architecture... or the

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-21 Thread Segher Boessenkool
On Tue, Aug 20, 2019 at 11:14:35PM +0200, Jose E. Marchesi wrote: > The kernel verifier doesn't allow backward jumps. > > This may change at some point. There is much discussion among the > kernel hackers in whether it is possible to allow bounded loops in a > safe way. In that case, some of the

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jeff Law
On 8/20/19 3:14 PM, Jose E. Marchesi wrote: > > Hi Jeff. > > > This patch adds a port for the Linux kernel eBPF architecture to GCC. > > > > ChangeLog: > > > > * configure.ac: Support for bpf-*-* targets. > > * configure: Regenerate. > > > > contrib/ChangeLo

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jose E. Marchesi
Hi Jeff. > This patch adds a port for the Linux kernel eBPF architecture to GCC. > > ChangeLog: > > * configure.ac: Support for bpf-*-* targets. > * configure: Regenerate. > > contrib/ChangeLog: > > * config-list.mk (LIST): Disable go in bpf-*-*

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jeff Law
On 8/16/19 6:59 PM, Jose E. Marchesi wrote: > This patch adds a port for the Linux kernel eBPF architecture to GCC. > > ChangeLog: > > * configure.ac: Support for bpf-*-* targets. > * configure: Regenerate. > > contrib/ChangeLog: > > * config-list.mk (LIST): Disable go in bpf-*-* targets.

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Richard Sandiford
jose.march...@oracle.com (Jose E. Marchesi) writes: > Hi Richard! > > Many thanks for the deep review. I'm addressing some of your questions > below. > > > [...] > > +/* Override options and do some other initialization. */ > > + > > +static void > > +bpf_option_override (void

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Segher Boessenkool
On Tue, Aug 20, 2019 at 04:20:03PM +0200, Jose E. Marchesi wrote: > > + (PLUS ADDR_BASE CONST_INT) > > + (PLUS CONST_INT ADDR_BASE) > > The second one isn't canonical rtl, so you shouldn't (need to) handle it. > Please raise a bug if you find a case where it's

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jose E. Marchesi
> > +/*** Order of Allocation of Registers. */ > > + > > +/* We generally want to put call-clobbered registers ahead of > > + call-saved ones. (IRA expects this.) */ > > +#define REG_ALLOC_ORDER\ > > + {0, 1, 2, 3, 4, 5, 6, 7,

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jose E. Marchesi
> [...] > +;; Division > +(define_insn "div3" > + [(set (match_operand:AM 0 "register_operand" "=r,r") > +(div:AM (match_operand:AM 1 "register_operand" " 0,0") > +(match_operand:AM 2 "reg_or_imm_operand" "r,I")))] > + "" > + "div\t%0,

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 08:57:22PM +0100, Richard Sandiford wrote: > > +/*** Order of Allocation of Registers. */ > > + > > +/* We generally want to put call-clobbered registers ahead of > > + call-saved ones. (IRA expects this.) */ > > +#define REG_ALLOC_ORDER

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-20 Thread Jose E. Marchesi
Hi Richard! Many thanks for the deep review. I'm addressing some of your questions below. > [...] > +/* Override options and do some other initialization. */ > + > +static void > +bpf_option_override (void) > +{ > + /* Set the default target kernel if no -mkernel

Re: [PATCH V2 2/8] bpf: new GCC port

2019-08-19 Thread Richard Sandiford
In addition to Segher's comments: jema...@gnu.org (Jose E. Marchesi) writes: > [...] > +/* This file contains the definition of the kernel helpers that are > + available to eBPF programs. > + > + The primary source for information on kernel helpers is the > + linux/include/uapi/linux/bpf.h f

[PATCH V2 2/8] bpf: new GCC port

2019-08-16 Thread Jose E. Marchesi
This patch adds a port for the Linux kernel eBPF architecture to GCC. ChangeLog: * configure.ac: Support for bpf-*-* targets. * configure: Regenerate. contrib/ChangeLog: * config-list.mk (LIST): Disable go in bpf-*-* targets. gcc/ChangeLog: * config.gcc: Support for bpf-*-* targets.