rust/compiler/rustc_middle/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
..
dep_graph Adopt let_else in even more places 2022-02-16 22:43:39 +01:00
hir Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r=pnkfelix 2022-04-15 20:50:45 +02:00
infer remove unused incorrect EqUnifyValue impl 2022-04-01 12:57:24 +02:00
middle Update issue-92893.stderr 2022-04-14 23:42:15 +03:00
mir Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011 2022-04-13 11:27:17 +00:00
query Store LocalDefId in is_late_bound_map. 2022-04-10 13:36:06 +02:00
thir Reimplement lowering of sym operands for asm! so that it also works with global_asm! 2022-04-14 15:32:03 +01:00
traits Auto merge of #95031 - compiler-errors:param-env-cache, r=Aaron1011 2022-04-04 04:48:36 +00:00
ty couple of clippy::complexity fixes 2022-04-13 22:51:34 +02:00
util span: move MultiSpan 2022-04-05 07:01:00 +01:00
arena.rs Document and rename the new wrapper type 2022-04-07 13:01:48 +00:00
lib.rs Rollup merge of #94457 - jhpratt:stabilize-derive_default_enum, r=davidtwco 2022-04-15 20:50:43 +02:00
lint.rs span: move MultiSpan 2022-04-05 07:01:00 +01:00
macros.rs Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
metadata.rs resolve/metadata: Stop encoding macros as reexports 2022-02-24 22:55:40 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Reimplement lowering of sym operands for asm! so that it also works with global_asm! 2022-04-14 15:32:03 +01:00