Pass tune-cpu to LLVM

I think this is how it should work...
This commit is contained in:
Mingye Wang 2020-09-17 17:39:26 +08:00 committed by Mingye Wang
parent 285fc7d704
commit a35a93f09c
9 changed files with 80 additions and 8 deletions

View file

@ -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,
}
}