diff options
| author | winstonallo <arthurbiedchar@gmail.com> | 2025-08-13 08:51:58 +0200 |
|---|---|---|
| committer | winstonallo <arthurbiedchar@gmail.com> | 2025-08-13 17:37:30 +0200 |
| commit | 04ff1444bb89379d7489bda9edc65ebaae4db037 (patch) | |
| tree | 292828e647ce5f789bd533e88c327c6e60f3808b /compiler/rustc_codegen_llvm/src | |
| parent | a1531335fe2807715fff569904d99602022643a7 (diff) | |
| download | rust-04ff1444bb89379d7489bda9edc65ebaae4db037.tar.gz rust-04ff1444bb89379d7489bda9edc65ebaae4db037.zip | |
Set NumRegisterParameters LLVM module flag to `N` when `-Zregparm=N` is
set * Enforce the `-Zregparm=N` flag by setting the NumRegisterParameters LLVM module flag * Add assembly tests verifying that the parameters are passed in registers for reparm values 1, 2, and 3, for both LLVM intrinsics and non-builtin functions * Add c_void type to minicore
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index ee77774c688..215508f8095 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -372,6 +372,15 @@ pub(crate) unsafe fn create_module<'ll>( } } + if let Some(regparm_count) = sess.opts.unstable_opts.regparm { + llvm::add_module_flag_u32( + llmod, + llvm::ModuleFlagMergeBehavior::Error, + "NumRegisterParameters", + regparm_count, + ); + } + if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection { if sess.target.arch == "aarch64" { llvm::add_module_flag_u32( |
