MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / configure_llvm

Function configure_llvm

crates/rustc_codegen_nvvm/src/init.rs:38–133  ·  view source on GitHub ↗
(sess: &Session)

Source from the content-addressed store, hash-verified

36}
37
38unsafe fn configure_llvm(sess: &Session) {
39 // TODO(RDambrosio016): We override the meaning of llvm-args to pass our own nvvm args,
40 // but we should probably retain a way to pass args to LLVM.
41 let n_args = sess.opts.cg.llvm_args.len() + sess.target.llvm_args.len();
42 let mut llvm_c_strs = Vec::with_capacity(n_args + 1);
43 let mut llvm_args = Vec::with_capacity(n_args + 1);
44
45 // fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
46 // full_arg
47 // .trim()
48 // .split(|c: char| c == '=' || c.is_whitespace())
49 // .next()
50 // .unwrap_or("")
51 // }
52
53 // let cg_opts = sess.opts.cg.llvm_args.iter();
54 // let tg_opts = sess.target.llvm_args.iter();
55 // let sess_args = cg_opts.chain(tg_opts);
56
57 // dont print anything in here or it will interfere with cargo trying to print stuff which will
58 // cause the compilation to fail in mysterious ways.
59
60 // let user_specified_args: FxHashSet<_> = sess_args
61 // .clone()
62 // .map(|s| llvm_arg_to_arg_name(s))
63 // .filter(|s| !s.is_empty())
64 // .collect();
65
66 {
67 // This adds the given argument to LLVM. Unless `force` is true
68 // user specified arguments are *not* overridden.
69 let mut add = |arg: &str, _force: bool| {
70 // if force || !user_specified_args.contains(llvm_arg_to_arg_name(arg)) {
71 let s = CString::new(arg).unwrap();
72 llvm_args.push(s.as_ptr());
73 llvm_c_strs.push(s);
74 // }
75 };
76 // Set the llvm "program name" to make usage and invalid argument messages more clear.
77 // add("rustc -Cllvm-args=\"...\" with", true);
78 if sess.time_llvm_passes() {
79 add("-time-passes", false);
80 }
81 if sess.print_llvm_passes() {
82 add("-debug-pass=Structure", false);
83 }
84 if !sess.opts.debugging_opts.no_generate_arange_section {
85 add("-generate-arange-section", false);
86 }
87
88 match sess
89 .opts
90 .debugging_opts
91 .merge_functions
92 .unwrap_or(sess.target.merge_functions)
93 {
94 MergeFunctions::Disabled | MergeFunctions::Trampolines => {}
95 MergeFunctions::Aliases => {

Callers 1

initFunction · 0.85

Calls 7

newFunction · 0.85
addFunction · 0.85
LLVMInitializePassesFunction · 0.85
LLVMRustSetLLVMOptionsFunction · 0.85
as_ptrMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected