1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.ast: rename aarch64 to arm64 and aarch32 to arm32

This commit is contained in:
pancake 2021-04-26 18:01:42 +02:00 committed by Delyan Angelov
parent 6750ed254f
commit 9a3869c521
11 changed files with 42 additions and 39 deletions

View File

@ -60,7 +60,7 @@ else
ifneq ($(filter x86%,$(TCCARCH)),)
TCCARCH := i386
else
ifeq ($(TCCARCH),aarch64)
ifeq ($(TCCARCH),arm64)
TCCARCH := arm64
else
ifneq ($(filter arm%,$(TCCARCH)),)

View File

@ -3781,7 +3781,7 @@ If you're using a custom ifdef, then you do need `$if option ? {}` and compile w
Full list of builtin options:
| OS | Compilers | Platforms | Other |
| --- | --- | --- | --- |
| `windows`, `linux`, `macos` | `gcc`, `tinyc` | `amd64`, `aarch64` | `debug`, `prod`, `test` |
| `windows`, `linux`, `macos` | `gcc`, `tinyc` | `amd64`, `arm64` | `debug`, `prod`, `test` |
| `mac`, `darwin`, `ios`, | `clang`, `mingw` | `x64`, `x32` | `js`, `glibc`, `prealloc` |
| `android`,`mach`, `dragonfly` | `msvc` | `little_endian` | `no_bounds_checking`, `freestanding` |
| `gnu`, `hpux`, `haiku`, `qnx` | `cplusplus` | `big_endian` |

View File

@ -1875,17 +1875,17 @@ pub fn all_registers(mut t Table, arch pref.Arch) map[string]ScopeObject {
}
}
}
.aarch32 {
aarch32 := gen_all_registers(mut t, ast.arm_no_number_register_list, ast.arm_with_number_register_list,
.arm32 {
arm32 := gen_all_registers(mut t, ast.arm_no_number_register_list, ast.arm_with_number_register_list,
32)
for k, v in aarch32 {
for k, v in arm32 {
res[k] = v
}
}
.aarch64 {
aarch64 := gen_all_registers(mut t, ast.arm_no_number_register_list, ast.arm_with_number_register_list,
.arm64 {
arm64 := gen_all_registers(mut t, ast.arm_no_number_register_list, ast.arm_with_number_register_list,
64)
for k, v in aarch64 {
for k, v in arm64 {
res[k] = v
}
}

View File

@ -25,8 +25,8 @@ pub enum Language {
js
amd64 // aka x86_64
i386
aarch64 // 64-bit arm
aarch32 // 32-bit arm
arm64 // 64-bit arm
arm32 // 32-bit arm
rv64 // 64-bit risc-v
rv32 // 32-bit risc-v
}
@ -36,11 +36,11 @@ pub fn pref_arch_to_table_language(pref_arch pref.Arch) Language {
.amd64 {
Language.amd64
}
.aarch64 {
Language.aarch64
.arm64 {
Language.arm64
}
.aarch32 {
Language.aarch32
.arm32 {
Language.arm32
}
.rv64 {
Language.rv64

View File

@ -22,7 +22,9 @@ const (
'qnx', 'linux', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'dragonfly', 'android', 'solaris',
'haiku', 'linux_or_macos']
valid_comp_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus']
valid_comp_if_platforms = ['amd64', 'aarch64', 'x64', 'x32', 'little_endian', 'big_endian']
valid_comp_if_platforms = ['amd64', 'aarch64', 'arm64', 'x64', 'x32', 'little_endian',
'big_endian',
]
valid_comp_if_other = ['js', 'debug', 'prod', 'test', 'glibc', 'prealloc',
'no_bounds_checking', 'freestanding']
array_builtin_methods = ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort',

View File

@ -191,7 +191,7 @@ string _STR_TMP(const char *fmt, ...) {
#define __V_amd64 1
#endif
#if defined(__aarch64__) || defined(__arm64__)
#define __V_aarch64 1
#define __V_arm64 1
#endif
// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:

View File

@ -598,8 +598,8 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) ?string
'amd64' {
return '__V_amd64'
}
'aarch64' {
return '__V_aarch64'
'aarch64', 'arm64' {
return '__V_arm64'
}
// bitness:
'x64' {

View File

@ -18,14 +18,14 @@ const (
// ELF file types
const (
elf_osabi = 0
et_rel = 1
et_exec = 2
et_dyn = 3
e_machine_amd64 = 0x3e
e_machine_aarch64 = 183
shn_xindex = 0xffff
sht_null = 0
elf_osabi = 0
et_rel = 1
et_exec = 2
et_dyn = 3
e_machine_amd64 = 0x3e
e_machine_arm64 = 0xb7
shn_xindex = 0xffff
sht_null = 0
)
const (
@ -42,8 +42,8 @@ pub fn (mut g Gen) generate_elf_header() {
g.buf << 1 // elf_osabi
g.write64(0) // et_rel) // et_rel for .o
g.write16(2) // e_type
if g.pref.arch == .aarch64 {
g.write16(native.e_machine_aarch64)
if g.pref.arch == .arm64 {
g.write16(native.e_machine_arm64)
} else {
g.write16(native.e_machine_amd64)
}

View File

@ -48,7 +48,7 @@ enum Size {
}
fn (g Gen) get_backend(pref &pref.Preferences) CodeGen {
if pref.arch == .aarch64 {
if pref.arch == .arm64 {
return Aarch64{}
}
return Amd64{}

View File

@ -37,7 +37,7 @@ struct Reloc {
}
pub fn (mut g Gen) generate_macho_header() {
if g.pref.arch == .aarch64 {
if g.pref.arch == .arm64 {
g.write32(0xfeedfacf) // MH_MAGIC_64
g.write32(0x0100000c) // CPU_TYPE_ARM64
g.write32(0x00000000) // CPU_SUBTYPE_ARM64_ALL

View File

@ -62,8 +62,8 @@ pub enum CompilerType {
pub enum Arch {
_auto
amd64 // aka x86_64
aarch64 // 64-bit arm
aarch32 // 32-bit arm
arm64 // 64-bit arm
arm32 // 32-bit arm
rv64 // 64-bit risc-v
rv32 // 32-bit risc-v
i386
@ -655,13 +655,13 @@ pub fn arch_from_string(arch_str string) ?Arch {
return Arch.amd64
}
'aarch64', 'arm64' { // aarch64 recommended
'aarch64', 'arm64' { // arm64 recommended
return Arch.aarch64
return Arch.arm64
}
'arm32', 'aarch32', 'arm' { // aarch32 recommended
'aarch32', 'arm32', 'arm' { // arm32 recommended
return Arch.aarch32
return Arch.arm32
}
'rv64', 'riscv64', 'risc-v64', 'riscv', 'risc-v' { // rv64 recommended
@ -740,11 +740,12 @@ pub fn get_host_arch() Arch {
// $if i386 {
// return .amd64
// }
// $if arm64 { // requires new vc
$if aarch64 {
return .aarch64
return .arm64
}
// $if aarch32 {
// return .aarch32
// $if arm32 {
// return .arm32
// }
panic('unknown host OS')
}