cgen: support for `$if amd64 {}` and `$if aarch64 {}`
parent
6eea13ecc2
commit
8c7bcad6b1
|
@ -4355,12 +4355,21 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) string {
|
|||
'no_bounds_checking' {
|
||||
return 'CUSTOM_DEFINE_no_bounds_checking'
|
||||
}
|
||||
// architectures:
|
||||
'amd64' {
|
||||
return '__V_amd64'
|
||||
}
|
||||
'aarch64' {
|
||||
return '__V_aarch64'
|
||||
}
|
||||
// bitness:
|
||||
'x64' {
|
||||
return 'TARGET_IS_64BIT'
|
||||
}
|
||||
'x32' {
|
||||
return 'TARGET_IS_32BIT'
|
||||
}
|
||||
// endianness:
|
||||
'little_endian' {
|
||||
return 'TARGET_ORDER_IS_LITTLE'
|
||||
}
|
||||
|
|
|
@ -28,6 +28,13 @@ const (
|
|||
#define __NOINLINE __attribute__((noinline))
|
||||
#define __IRQHANDLER __attribute__((interrupt))
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define __V_amd64 1
|
||||
#endif
|
||||
#if defined(__aarch64__) || defined(__arm64__)
|
||||
#define __V_aarch64 1
|
||||
#endif
|
||||
|
||||
// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:
|
||||
#ifdef __GNUC__
|
||||
#define __V_GCC__
|
||||
|
|
Loading…
Reference in New Issue