-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Support using const pointers in asm const
operand
#138618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
r? codegen |
This comment has been minimized.
This comment has been minimized.
r? compiler-errors |
Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_codegen_gcc |
@@ -25,9 +26,12 @@ pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> { | |||
in_value: OperandRef<'tcx, B::Value>, | |||
out_place: Option<PlaceRef<'tcx, B::Value>>, | |||
}, | |||
Const { | |||
Interpolate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more doc comment explaining the significance of the difference between Interpolate
and Const
for backends. It begs the question for why we ever turn const operands into strings, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some explaination. Technically we should be able to use Const
for integers, although I am a bit conservative here and don't want to change how existing things work.
This might also be useful to have in the future if we decided to add interpolate "some CTFE string to be interpolated"
new type of operand.
☔ The latest upstream changes (presumably #140415) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
☔ The latest upstream changes (presumably #141668) made this pull request unmergeable. Please resolve the merge conflicts. |
// and on x86 PIC symbol can't be constant. | ||
// x86_64-LABEL: const_ptr: | ||
// x86_64: #APP | ||
// x86_64: mov al, byte ptr [{{.*}}anon{{.*}}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// x86_64: mov al, byte ptr [{{.*}}anon{{.*}}]
What was the expansion you observed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mov al, byte ptr [.Lanon.2e8c0013b01edcd3779e8174c2338a00.0]
LGTM @bors r+ |
…-errors Support using const pointers in asm `const` operand Implements rust-lang#128464 This adds support of const pointers for asm `const` in addition to plain integers. The inline `asm!` support is implemented using `i` constraint, and the `global_asm!` and `naked_asm!` support is implemented by inserting `symbol + offset` and make `symbol` compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm. The feature is also implemented for GCC backend but it's untested.
@bors r- 486ffda changed the signature for |
☔ The latest upstream changes (presumably #143746) made this pull request unmergeable. Please resolve the merge conflicts. |
This is used for string interpolation currently, so rename it as so. The name `Const` will be used to denote a general CTFE constant that can either be integer or pointer.
This is intended for supporting passing arbitrary CTFE const into inline assembly.
`global_asm!` themselves don't need symbol names; they currently only have a symbol name during mono collecion to identify them to partitioning algorithm. However it will have shims generated under it which will need unique symbol names. The name themselves ultimately doesn't matter, so they're generated like other shim instances.
This is currently a no-op, but will be useful when const in `global_asm!` can be pointers.
@bors r+ rollup |
@bors rollup- |
Support using const pointers in asm `const` operand Implements #128464 This adds support of const pointers for asm `const` in addition to plain integers. The inline `asm!` support is implemented using `i` constraint, and the `global_asm!` and `naked_asm!` support is implemented by inserting `symbol + offset` and make `symbol` compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm. The feature is also implemented for GCC backend but it's untested.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
Looks like the
|
Implements #128464
This adds support of const pointers for asm
const
in addition to plain integers.The inline
asm!
support is implemented usingi
constraint, and theglobal_asm!
andnaked_asm!
support is implemented by insertingsymbol + offset
and makesymbol
compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm.The feature is also implemented for GCC backend but it's untested.