moved default CPU message inline
This commit is contained in:
parent
ea17aa9141
commit
9aa596a014
3 changed files with 11 additions and 15 deletions
|
@ -2249,7 +2249,7 @@ extern "C" {
|
||||||
|
|
||||||
pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
|
pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
|
||||||
|
|
||||||
pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
|
pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine, cpu: *const c_char);
|
||||||
pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
|
pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
|
||||||
pub fn LLVMRustGetTargetFeature(
|
pub fn LLVMRustGetTargetFeature(
|
||||||
T: &TargetMachine,
|
T: &TargetMachine,
|
||||||
|
|
|
@ -330,11 +330,9 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) {
|
||||||
let tm = create_informational_target_machine(sess);
|
let tm = create_informational_target_machine(sess);
|
||||||
match req {
|
match req {
|
||||||
PrintRequest::TargetCPUs => {
|
PrintRequest::TargetCPUs => {
|
||||||
println!(
|
let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref()))
|
||||||
"Default CPU for this target:\n {}",
|
.expect("failed to convert to cstring");
|
||||||
handle_native(sess.target.cpu.as_ref())
|
unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) };
|
||||||
);
|
|
||||||
unsafe { llvm::LLVMRustPrintTargetCPUs(tm, handle_native(sess.target.cpu.as_ref())) };
|
|
||||||
}
|
}
|
||||||
PrintRequest::TargetFeatures => print_target_features(sess, tm),
|
PrintRequest::TargetFeatures => print_target_features(sess, tm),
|
||||||
_ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req),
|
_ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req),
|
||||||
|
|
|
@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef<KV> Table) {
|
||||||
return MaxLen;
|
return MaxLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, &Char[]) {
|
extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* TargetCPU) {
|
||||||
const TargetMachine *Target = unwrap(TM);
|
const TargetMachine *Target = unwrap(TM);
|
||||||
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
||||||
const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
|
const Triple::ArchType HostArch = Triple(sys::getDefaultTargetTriple()).getArch();
|
||||||
|
@ -323,16 +323,14 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, &Char[]) {
|
||||||
printf(" %-*s - Select the CPU of the current host (currently %.*s).\n",
|
printf(" %-*s - Select the CPU of the current host (currently %.*s).\n",
|
||||||
MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data());
|
MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data());
|
||||||
}
|
}
|
||||||
for (auto &CPU : CPUTable)
|
for (auto &CPU : CPUTable) {
|
||||||
|
|
||||||
printf(" %-*s", MaxCPULen, CPU.Key);
|
printf(" %-*s", MaxCPULen, CPU.Key);
|
||||||
if (CPU.Key == Target->getTargetTriple().getArch()) {
|
// Compare cpu against current target to label the default
|
||||||
printf(" default target\n");
|
if (strcmp(CPU.Key, TargetCPU) == 0) {
|
||||||
|
printf(" - this is the default target cpu for the current target");
|
||||||
}
|
}
|
||||||
else {
|
printf("\n");
|
||||||
printf("\n");
|
}
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
|
extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue