rust/compiler/rustc_builtin_macros/src
bors 080d5452e1 Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisa
Implement sym operands for global_asm!

Tracking issue: #93333

This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are:
- At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`.
- At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails).
  - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`.
  - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to.
- The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression.
- At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details.
  - On Mach-O, all symbols have a leading underscore.
  - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall.
  - No mangling is needed on other platforms.

r? `@nagisa`
cc `@eddyb`
2022-04-16 04:46:01 +00:00
..
deriving Stabilize derive_default_enum 2022-04-07 20:03:19 -04:00
format_foreign update tests 2021-12-31 12:51:27 -05:00
asm.rs Reimplement lowering of sym operands for asm! so that it also works with global_asm! 2022-04-14 15:32:03 +01:00
assert.rs rustc_errors: let DiagnosticBuilder::emit return a "guarantee of emission". 2022-02-23 06:38:52 +00:00
cfg_accessible.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
cfg_eval.rs Spellchecking some comments 2022-03-30 01:39:38 -04:00
cfg.rs Improve allowness of the unexpected_cfgs lint 2022-03-01 14:29:12 +01:00
cmdline_attrs.rs Unconditionally capture tokens for attributes. 2020-10-21 18:57:29 -04:00
compile_error.rs check_doc_keyword: don't alloc string for emptiness check 2022-04-08 11:45:57 +03:00
concat_bytes.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
concat_idents.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
concat.rs Adopt let else in more places 2022-02-19 17:27:43 +01:00
derive.rs Improve allowness of the unexpected_cfgs lint 2022-03-01 14:29:12 +01:00
edition_panic.rs Spellchecking some comments 2022-03-30 01:39:38 -04:00
env.rs check_doc_keyword: don't alloc string for emptiness check 2022-04-08 11:45:57 +03:00
format_foreign.rs [rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape 2021-12-31 12:42:15 -05:00
format.rs span: move MultiSpan 2022-04-05 07:01:00 +01:00
global_allocator.rs Point at type when a static #[global_allocator] doesn't impl GlobalAlloc 2021-12-15 01:40:08 +00:00
lib.rs Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
log_syntax.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
proc_macro_harness.rs Rollup merge of #94146 - est31:let_else, r=cjgillot 2022-02-20 00:37:34 +01:00
source_util.rs Auto merge of #95697 - klensy:no-strings, r=petrochenkov 2022-04-09 13:15:26 +00:00
standard_library_imports.rs Create 2024 edition 2022-04-02 02:45:49 -04:00
test_harness.rs Adjusted diagnostic output so that if there is no use in a item sequence, 2022-03-03 18:58:37 -05:00
test.rs Downgrade #[test] on macro call to warning 2022-03-04 20:34:10 +00:00
trace_macros.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
util.rs Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01:00