-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr
Add support for emitting functions with `coldcc` to LLVM The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
- Loading branch information
Showing
14 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// compile-flags: -C no-prepopulate-passes | ||
|
||
#![crate_type = "lib"] | ||
#![feature(rust_cold_cc)] | ||
|
||
// wasm marks the definition as `dso_local`, so allow that as optional. | ||
|
||
// CHECK: define{{( dso_local)?}} coldcc void @this_should_never_happen(i16 | ||
// CHECK: call coldcc void @this_should_never_happen(i16 | ||
|
||
#[no_mangle] | ||
pub extern "rust-cold" fn this_should_never_happen(x: u16) {} | ||
|
||
pub fn do_things(x: u16) { | ||
if x == 12345 { | ||
this_should_never_happen(54321); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![crate_type = "lib"] | ||
|
||
extern "rust-cold" fn fu() {} //~ ERROR rust-cold is experimental | ||
|
||
trait T { | ||
extern "rust-cold" fn mu(); //~ ERROR rust-cold is experimental | ||
extern "rust-cold" fn dmu() {} //~ ERROR rust-cold is experimental | ||
} | ||
|
||
struct S; | ||
impl T for S { | ||
extern "rust-cold" fn mu() {} //~ ERROR rust-cold is experimental | ||
} | ||
|
||
impl S { | ||
extern "rust-cold" fn imu() {} //~ ERROR rust-cold is experimental | ||
} | ||
|
||
type TAU = extern "rust-cold" fn(); //~ ERROR rust-cold is experimental | ||
|
||
extern "rust-cold" {} //~ ERROR rust-cold is experimental |
66 changes: 66 additions & 0 deletions
66
src/test/ui/feature-gates/feature-gate-rust_cold_cc.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:3:8 | ||
| | ||
LL | extern "rust-cold" fn fu() {} | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:6:12 | ||
| | ||
LL | extern "rust-cold" fn mu(); | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:7:12 | ||
| | ||
LL | extern "rust-cold" fn dmu() {} | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:12:12 | ||
| | ||
LL | extern "rust-cold" fn mu() {} | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:16:12 | ||
| | ||
LL | extern "rust-cold" fn imu() {} | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:19:19 | ||
| | ||
LL | type TAU = extern "rust-cold" fn(); | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error[E0658]: rust-cold is experimental and subject to change | ||
--> $DIR/feature-gate-rust_cold_cc.rs:21:8 | ||
| | ||
LL | extern "rust-cold" {} | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #97544 <https://github.com/rust-lang/rust/issues/97544> for more information | ||
= help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable | ||
|
||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters