diff options
| author | Mingye Wang <arthur200126@gmail.com> | 2020-09-17 17:39:26 +0800 |
|---|---|---|
| committer | Mingye Wang <arthur2e5@aosc.io> | 2020-10-05 07:50:44 +0800 |
| commit | a35a93f09cc111a53d00efc567ad678583dd5ac7 (patch) | |
| tree | 943360a4a63ea2f050f5e53e691afb5c8a11d2bc /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | 285fc7d704fcdd7b2a37d475d04d5d955490e000 (diff) | |
| download | rust-a35a93f09cc111a53d00efc567ad678583dd5ac7.tar.gz rust-a35a93f09cc111a53d00efc567ad678583dd5ac7.zip | |
Pass tune-cpu to LLVM
I think this is how it should work...
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index f0b50459837..7fe30fc8ac0 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -351,11 +351,7 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) { } } -pub fn target_cpu(sess: &Session) -> &str { - let name = match sess.opts.cg.target_cpu { - Some(ref s) => &**s, - None => &*sess.target.target.options.cpu, - }; +fn handle_native(name: &str) -> &str { if name != "native" { return name; } @@ -366,3 +362,19 @@ pub fn target_cpu(sess: &Session) -> &str { str::from_utf8(slice::from_raw_parts(ptr as *const u8, len)).unwrap() } } + +pub fn target_cpu(sess: &Session) -> &str { + let name = match sess.opts.cg.target_cpu { + Some(ref s) => &**s, + None => &*sess.target.target.options.cpu, + }; + + handle_native(name) +} + +pub fn tune_cpu(sess: &Session) -> Option<&str> { + match sess.opts.debugging_opts.tune_cpu { + Some(ref s) => Some(handle_native(&**s)), + None => None, + } +} |
