Skip to content

Commit

Permalink
Change default output of [@]code_native to intel syntax (#48103)
Browse files Browse the repository at this point in the history
* Change `[@]code_{native,llvm}` default output to intel syntax

* Add code_native change to NEWS.md

Co-authored-by: Sukera <Seelengrab@users.noreply.github.com>
  • Loading branch information
Seelengrab and Seelengrab authored Jan 16, 2023
1 parent a9ce60a commit 8c48fe9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Standard library changes
#### DelimitedFiles


#### InteractiveUtils

* `code_native` and `@code_native` now default to intel syntax instead of AT&T.

Deprecated or removed
---------------------

Expand Down
10 changes: 5 additions & 5 deletions stdlib/InteractiveUtils/src/codeview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Keyword argument `debuginfo` may be one of source (default) or none, to specify
"""
function code_llvm(io::IO, @nospecialize(f), @nospecialize(types), raw::Bool,
dump_module::Bool=false, optimize::Bool=true, debuginfo::Symbol=:default)
d = _dump_function(f, types, false, false, !raw, dump_module, :att, optimize, debuginfo, false)
d = _dump_function(f, types, false, false, !raw, dump_module, :intel, optimize, debuginfo, false)
if highlighting[:llvm] && get(io, :color, false)::Bool
print_llvm(io, d)
else
Expand All @@ -281,28 +281,28 @@ code_llvm(@nospecialize(f), @nospecialize(types=Base.default_tt(f)); raw=false,
code_llvm(stdout, f, types; raw, dump_module, optimize, debuginfo)

"""
code_native([io=stdout,], f, types; syntax=:att, debuginfo=:default, binary=false, dump_module=true)
code_native([io=stdout,], f, types; syntax=:intel, debuginfo=:default, binary=false, dump_module=true)
Prints the native assembly instructions generated for running the method matching the given
generic function and type signature to `io`.
* Set assembly syntax by setting `syntax` to `:att` (default) for AT&T syntax or `:intel` for Intel syntax.
* Set assembly syntax by setting `syntax` to `:intel` (default) for intel syntax or `:att` for AT&T syntax.
* Specify verbosity of code comments by setting `debuginfo` to `:source` (default) or `:none`.
* If `binary` is `true`, also print the binary machine code for each instruction precedented by an abbreviated address.
* If `dump_module` is `false`, do not print metadata such as rodata or directives.
See also: [`@code_native`](@ref), [`code_llvm`](@ref), [`code_typed`](@ref) and [`code_lowered`](@ref)
"""
function code_native(io::IO, @nospecialize(f), @nospecialize(types=Base.default_tt(f));
dump_module::Bool=true, syntax::Symbol=:att, debuginfo::Symbol=:default, binary::Bool=false)
dump_module::Bool=true, syntax::Symbol=:intel, debuginfo::Symbol=:default, binary::Bool=false)
d = _dump_function(f, types, true, false, false, dump_module, syntax, true, debuginfo, binary)
if highlighting[:native] && get(io, :color, false)::Bool
print_native(io, d)
else
print(io, d)
end
end
code_native(@nospecialize(f), @nospecialize(types=Base.default_tt(f)); dump_module::Bool=true, syntax::Symbol=:att, debuginfo::Symbol=:default, binary::Bool=false) =
code_native(@nospecialize(f), @nospecialize(types=Base.default_tt(f)); dump_module::Bool=true, syntax::Symbol=:intel, debuginfo::Symbol=:default, binary::Bool=false) =
code_native(stdout, f, types; dump_module, syntax, debuginfo, binary)
code_native(::IO, ::Any, ::Symbol) = error("invalid code_native call") # resolve ambiguous call

Expand Down
2 changes: 1 addition & 1 deletion stdlib/InteractiveUtils/src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ by putting it before the function call, like this:
@code_native syntax=:intel debuginfo=:default binary=true dump_module=false f(x)
* Set assembly syntax by setting `syntax` to `:att` (default) for AT&T syntax or `:intel` for Intel syntax.
* Set assembly syntax by setting `syntax` to `:intel` (default) for Intel syntax or `:att` for AT&T syntax.
* Specify verbosity of code comments by setting `debuginfo` to `:source` (default) or `:none`.
* If `binary` is `true`, also print the binary machine code for each instruction precedented by an abbreviated address.
* If `dump_module` is `false`, do not print metadata such as rodata or directives.
Expand Down

0 comments on commit 8c48fe9

Please sign in to comment.