Skip to content

Commit 842adc2

Browse files
committed
Set NumRegisterParameters LLVM module flag to N when -Zregparm=N is set
1 parent a153133 commit 842adc2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ pub(crate) unsafe fn create_module<'ll>(
372372
}
373373
}
374374

375+
if let Some(regparm_count) = sess.opts.unstable_opts.regparm {
376+
llvm::add_module_flag_u32(
377+
llmod,
378+
llvm::ModuleFlagMergeBehavior::Error,
379+
"NumRegisterParameters",
380+
regparm_count,
381+
);
382+
}
383+
375384
if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection {
376385
if sess.target.arch == "aarch64" {
377386
llvm::add_module_flag_u32(

0 commit comments

Comments
 (0)