Commit ff42bb9f authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: bpf: add helper for emitting nops

The need to emitting a few nops will become more common soon
as we add stack and map support.  Add a helper.  This allows
for code to be shorter but also may be handy for marking the
nops with a "reason" to ease applying optimizations.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5dd4982
...@@ -494,6 +494,12 @@ static swreg re_load_imm_any(struct nfp_prog *nfp_prog, u32 imm, swreg tmp_reg) ...@@ -494,6 +494,12 @@ static swreg re_load_imm_any(struct nfp_prog *nfp_prog, u32 imm, swreg tmp_reg)
return tmp_reg; return tmp_reg;
} }
static void wrp_nops(struct nfp_prog *nfp_prog, unsigned int count)
{
while (count--)
emit_nop(nfp_prog);
}
static void static void
wrp_br_special(struct nfp_prog *nfp_prog, enum br_mask mask, wrp_br_special(struct nfp_prog *nfp_prog, enum br_mask mask,
enum br_special special) enum br_special special)
...@@ -1799,7 +1805,7 @@ static void nfp_outro(struct nfp_prog *nfp_prog) ...@@ -1799,7 +1805,7 @@ static void nfp_outro(struct nfp_prog *nfp_prog)
static int nfp_translate(struct nfp_prog *nfp_prog) static int nfp_translate(struct nfp_prog *nfp_prog)
{ {
struct nfp_insn_meta *meta; struct nfp_insn_meta *meta;
int i, err; int err;
nfp_intro(nfp_prog); nfp_intro(nfp_prog);
if (nfp_prog->error) if (nfp_prog->error)
...@@ -1831,8 +1837,7 @@ static int nfp_translate(struct nfp_prog *nfp_prog) ...@@ -1831,8 +1837,7 @@ static int nfp_translate(struct nfp_prog *nfp_prog)
if (nfp_prog->error) if (nfp_prog->error)
return nfp_prog->error; return nfp_prog->error;
for (i = 0; i < NFP_USTORE_PREFETCH_WINDOW; i++) wrp_nops(nfp_prog, NFP_USTORE_PREFETCH_WINDOW);
emit_nop(nfp_prog);
if (nfp_prog->error) if (nfp_prog->error)
return nfp_prog->error; return nfp_prog->error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment