-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from instr = ... + dt_irlist_append(...) to emit*(...)
BPF instructions were being generated using a pair of statements, first creating the instruction code, and then appending it to the IR list. The append operation would specify an optional label. For some instructions an external identifier might be associated with the last appended instruction. So, a code fragment may look like this: instr = BPF_CALL_FUNC(idp->di_id); dt_irlist_append(dlp, dt_cg_node_alloc(lbl_call, instr)); dlp->dl_last->di_extern = idp; instr = BPF_RETURN(); dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr)); We introduce four macros to rewrite this (and more complex) code: emit(dlp, instr) Emit a BPF instruction (instr) in the given IR list (dlp). emite(dlp, instr, idp) Emit a BPF instruction (instr) in the given IR list (dlp) and associate an external identifier (idp) with it. emitl(dlp, lbl, instr) Emit a labelled BPF instruction (instr) in the given IR list (dlp). emitle(dlp, lbl, instr, idp) Emit a labelled BPF instruction (instr) in the given IR list (dlp) and associate an external identifier (idp) with it. With these new macros, the code shown above becomes: emitle(dlp, lbl_call, BPF_CALL_FUNC(idp->di_id), idp); emit(dlp, BPF_RETURN()); Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
8 changed files
with
365 additions
and
717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.