Zig: implement self-hosted CPU model and features detection

Created on 1 Mar 2020  路  2Comments  路  Source: ziglang/zig

Currently we rely on LLVM to do this:

https://github.com/ziglang/zig/blob/48cef8d5be24c40b4c845f6b07c78abd6c3d1b0d/lib/std/zig/system.zig#L790-L793

https://github.com/ziglang/zig/blob/48cef8d5be24c40b4c845f6b07c78abd6c3d1b0d/src-self-hosted/stage2.zig#L1156-L1167

The LLVM functions we are currently calling probably have some helpful code to look at when doing this implementation.

LLVM getHostCPUFeatures

arch-arm32 arch-arm64 arch-mips arch-riscv64 arch-wasm32 contributor friendly enhancement stage2 standard library

Most helpful comment

Does it make sense to have the arch-avr label? While that's a valid target, of course, I can't see a situation where it makes sense for the compiler to run natively on it.

All 2 comments

Thanks to @alichay the x86 and x86-64 parts of this are complete!

Does it make sense to have the arch-avr label? While that's a valid target, of course, I can't see a situation where it makes sense for the compiler to run natively on it.

Was this page helpful?
0 / 5 - 0 ratings