Commit graph

88 commits

Author SHA1 Message Date
Tyler Mandry 0327b5dac5
Rollup merge of #79917 - sivadeilra:asm_symbols, r=petrochenkov
Use Symbol for inline asm register class names

This takes care of one "FIXME":
// FIXME: use direct symbol comparison for register class names

Instead of using string literals, this uses Symbol for register
class names.

This is part of work I am doing to improve how Symbol interning works.
2020-12-10 21:33:19 -08:00
Arlie Davis 40ed0f6857 Use Symbol for inline asm register class names
This takes care of one "FIXME":
// FIXME: use direct symbol comparison for register class names

Instead of using string literals, this uses Symbol for register
class names.
2020-12-10 13:51:56 -08:00
Eric Arellano 12db2225b6 Dogfood 'str_split_once() with compiler/ 2020-12-07 12:48:44 -07:00
bors 6645da366e Auto merge of #78684 - devsnek:inline-asm-wasm, r=Amanieu
Add wasm32 support to inline asm

There is some contention around inline asm and wasm, and I really only made this to figure out the process of hacking on rustc, but I figured as long as the code existed, it was worth uploading.

cc `@Amanieu`
2020-12-01 20:23:06 +00:00
Gus Caplan d9f237caa6
Add wasm32 support to inline asm 2020-12-01 12:18:21 -06:00
Ondrej Perutka b2ad73e8a4 Add built-in support for the armv5te-unknown-linux-uclibceabi target 2020-11-30 09:47:09 +01:00
Benedikt Terhechte 96779647c4 Add support for Arm64 Catalyst on ARM Macs 2020-11-26 11:31:59 +01:00
Lzu Tao 6bfe27a3e0 Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
bjorn3 43968aa8b8 Replace sext() and zext() with single ext() method 2020-11-21 19:22:31 +01:00
bjorn3 6a5f537fb9 Rename prefix_chunk to prefix_chunk_size 2020-11-21 19:22:31 +01:00
bjorn3 39b8b2b623 Remove StructRet arg attr
It is applied exactly when the return value has an indirect pass mode.
Except for InReg on x86 fastcall, arg attrs are now only used for
optimization purposes and thus are fine to ignore.
2020-11-21 19:22:31 +01:00
bjorn3 42b0b8080d Replace ByVal attribute with on_stack field for Indirect
This makes it clearer that only PassMode::Indirect allows ByVal
2020-11-21 19:22:30 +01:00
bjorn3 967a228208 Replace ZExt and SExt flags with ArgExtension enum
Both flags are mutually exclusive
2020-11-21 19:07:38 +01:00
Dylan DPC 96fc0f4c2f
Rollup merge of #78993 - petrochenkov:specdash, r=oli-obk
rustc_target: Fix dash vs underscore mismatches in option names

Fixes https://github.com/rust-lang/rust/issues/78981 (regression from https://github.com/rust-lang/rust/pull/78875, the old option names used dashes)
2020-11-15 03:02:59 +01:00
bors 66c1309446 Auto merge of #78959 - petrochenkov:likeuefi, r=nagisa
rustc_target: Mark UEFI targets as `is_like_windows`/`is_like_msvc`

And document what `is_like_windows` and `is_like_msvc` actually mean in more detail.

Addresses FIXMEs left from https://github.com/rust-lang/rust/pull/71030.
r? `@nagisa`
2020-11-14 09:11:25 +00:00
bors 1a25580c6c Auto merge of #78951 - petrochenkov:unknown, r=ehuss
rustc_target: Change os and vendor values to "none" and "unknown" for some targets

Closes https://github.com/rust-lang/rust/issues/77730
r? `@ehuss`
2020-11-14 06:44:18 +00:00
Mara Bos 76fa5f25ab
Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu
Add asm register information for SPIR-V

As discussed in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Defining.20asm!.20for.20new.20architecture), we at [rust-gpu](https://github.com/EmbarkStudios/rust-gpu) would like to support `asm!` for our SPIR-V backend. However, we cannot do so purely without frontend support: [this match](d4ea0b3e46/compiler/rustc_target/src/asm/mod.rs (L185)) fails and so `asm!` is not supported ([error reported here](d4ea0b3e46/compiler/rustc_ast_lowering/src/expr.rs (L1095))). To resolve this, we need to stub out register information for SPIR-V to support getting the `asm!` content all the way to [`AsmBuilderMethods::codegen_inline_asm`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/trait.AsmBuilderMethods.html#tymethod.codegen_inline_asm), at which point the rust-gpu backend can do all the parsing and codegen that is needed.

This is a pretty weird PR - adding support for a backend that isn't in-tree feels pretty gross to me, but I don't see an easy way around this. ``@Amanieu`` said I should submit it anyway, so, here we are! Let me know if this needs to go through a more formal process (MCP?) and what I should do to help this along.

I based this off the [wasm asm PR](https://github.com/rust-lang/rust/pull/78684), which unfortunately this PR conflicts with that one quite a bit, sorry for any merge conflict pain :(

---

Some open questions:

- What do we call the register class? Some context, SPIR-V is an SSA-based IR, there are "instructions" that create IDs (referred to as `<id>` in the spec), which can be referenced by other instructions. So, `reg` isn't exactly accurate, they're SSA IDs, not re-assignable registers.
- What happens when a SPIR-V register gets to the LLVM backend? Right now it's a `bug!`, but should that be a `sess.fatal()`? I'm not sure if it's even possible to reach that point, maybe there's a check that prevents the `spirv` target from even reaching that codepath.
2020-11-12 19:46:14 +01:00
Vadim Petrochenkov 04d41e1f40 rustc_target: Mark UEFI targets as is_like_windows/is_like_msvc
Document what `is_like_windows` and `is_like_msvc` mean in more detail.
2020-11-12 19:40:41 +03:00
Vadim Petrochenkov dd682cb48c rustc_target: Fix dash vs underscore mismatches in option names 2020-11-12 19:33:07 +03:00
Jonas Schievink 904b658303
Rollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-Simulacrum
rustc_taret: Remove `TargetOptions::is_like_android`

This option was replaced by more specific options and is no longer used by the compiler.
2020-11-11 20:59:10 +01:00
khyperia 0e34b73996 Change capitalization of Spirv to SpirV
This matches the capitalization of RiscV
2020-11-11 19:18:06 +01:00
Vadim Petrochenkov e0a8f22053 rustc_target: Make sure that in-tree targets follow conventions for os and vendor values 2020-11-11 20:59:37 +03:00
Vadim Petrochenkov 1def24c5f4 rustc_target: Normalize vendor from "" to "unknown" for all targets
Majority of targets use "unknown" vendor and changing it from "unknown" to omitted doesn't make sense.
From the LLVM docs (https://clang.llvm.org/docs/CrossCompilation.html#target-triple):

>Most of the time it can be omitted (and Unknown) will be assumed, which sets the defaults for the specified architecture.
>When a parameter is not important, it can be omitted, or you can choose unknown and the defaults will be used. If you choose a parameter that Clang doesn’t know, like blerg, it’ll ignore and assume unknown
2020-11-11 20:40:51 +03:00
Vadim Petrochenkov 443b45fa9f rustc_target: Change os from "unknown" to "none" for bare metal targets
x86_64-fortanix-unknown-sgx and wasm32-unknown-unknown still have os == "unknown" because both have libstd
2020-11-11 20:24:14 +03:00
khyperia f3441348e0 Add asm register information for SPIR-V 2020-11-11 17:38:02 +01:00
Vadim Petrochenkov ca17a91fb7 rustc_target: Move target env "gnu" from linux_base to linux_gnu_base 2020-11-11 11:38:40 +03:00
Vadim Petrochenkov ce91c68943 rustc_taret: Remove TargetOptions::is_like_android 2020-11-10 23:51:34 +03:00
Jonas Schievink 105f4b8792
Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum
rustc_target: Further cleanup use of target options

Follow up to https://github.com/rust-lang/rust/pull/77729.

Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243.

The first commit collapses uses of `target.options.foo` into `target.foo`.

The second commit renames some target options to avoid tautology:
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`

r? `@Mark-Simulacrum`
2020-11-10 14:45:21 +01:00
David Hewitt 8d43b3cbb9 Add #[cfg(panic = "...")] 2020-11-09 15:30:49 +00:00
Vadim Petrochenkov 7f9117540f Address review comments 2020-11-08 17:31:47 +03:00
Vadim Petrochenkov dc004d4809 rustc_target: Rename some target options to avoid tautology
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`
2020-11-08 17:29:13 +03:00
Vadim Petrochenkov bf66988aa1 Collapse all uses of target.options.foo into target.foo
with an eye on merging `TargetOptions` into `Target`.

`TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-08 17:29:13 +03:00
Vadim Petrochenkov c0c0597e09 Update recently added targets 2020-11-07 14:34:44 +03:00
Vadim Petrochenkov d41fe05d1a rustc_target: Move linker_flavor from Target to TargetOptions 2020-11-07 14:27:48 +03:00
Vadim Petrochenkov b294cc71a2 rustc_target: Move target_vendor from Target to TargetOptions 2020-11-07 14:27:47 +03:00
Vadim Petrochenkov d5fd31197f rustc_target: Move target_env from Target to TargetOptions 2020-11-07 14:27:47 +03:00
Vadim Petrochenkov 74ffb9b4a2 rustc_target: Move target_os from Target to TargetOptions 2020-11-07 14:27:47 +03:00
Vadim Petrochenkov 91533cf10e rustc_target: Move target_endian from Target to TargetOptions 2020-11-07 14:27:46 +03:00
Vadim Petrochenkov ffe65f825b rustc_target: Move target_c_int_width from Target to TargetOptions 2020-11-07 14:27:46 +03:00
Guillaume Gomez 55b4d21e25 Fix automatic_links warnings 2020-11-05 10:22:08 +01:00
Oli Scherer 332750f9eb
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:13:06 +01:00
Oli Scherer 5f087f089f
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:12:44 +01:00
oli abacaf2aef u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
Stephan 1a232cb976 indicate calling convention 2020-11-02 23:29:00 +01:00
Stephan 96db99a145
improve comments
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-02 23:18:32 +01:00
Stephan 7d2441134b add blacklist for unsupported calling conventions 2020-11-02 22:52:47 +01:00
Stephan 6e58b1c3c9 add mipsel_unknown_none target 2020-11-02 19:11:24 +01:00
Joshua Nelson 57c6ed0c07 Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
Jonas Schievink fb92b70f95
Rollup merge of #77716 - francesca64:revert-ios-dynamic-linking, r=jonas-schievink
Revert "Allow dynamic linking for iOS/tvOS targets."

This reverts PR #73516.

On macOS I compile static libs for iOS, automated using [cargo-mobile](https://github.com/BrainiumLLC/cargo-mobile), which has worked smoothly for the past 2 years. However, upon updating to Rust 1.46.0, I was no longer able to use Rust on iOS. I've bisected this to the PR referenced above.

For most projects tested, apps now immediately crash with a message like this:
```
dyld: Library not loaded: /Users/francesca/Projects/example/target/aarch64-apple-ios/debug/deps/libexample.dylib
  Referenced from: /private/var/containers/Bundle/Application/745912AF-A928-465C-B340-872BD1C9F368/example.app/example
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib
```

This can be reproduced by using cargo-mobile to generate a winit example project, and then attempting to run it on an iOS device (`cargo mobile init && cargo apple open`).

In our projects that depend on DisplayLink, the build instead fails with a linker error:
```
= note: Undefined symbols for architecture arm64:
            "_CACurrentMediaTime", referenced from:
                display_link::ios::run_callback_ios10::hda81197ff46aedbd in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
                display_link::ios::run_callback_pre_ios10::h91f085da19374320 in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
          ld: symbol(s) not found for architecture arm64
```

After reverting the change to enable dynamic linking on iOS, everything works the same as it did on Rust 1.45.2 for me.

In the future, would it be possible for me to be pinged when iOS-related PRs are made? I work for a company that intends on using Rust on iOS in production, so I'd gladly provide testing.

cc @aspenluxxxy
2020-10-24 14:11:59 +02:00
est31 4fa5578774 Replace target.target with target and target.ptr_width with target.pointer_width
Preparation for a subsequent change that replaces
rustc_target::config::Config with its wrapped Target.

On its own, this commit breaks the build. I don't like making
build-breaking commits, but in this instance I believe that it
makes review easier, as the "real" changes of this PR can be
seen much more easily.

Result of running:

find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \;
find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \;
find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \;
./x.py fmt
2020-10-15 12:02:24 +02:00