@@ -11,7 +11,6 @@ use crate::spec::{
1111#[ cfg( test) ]
1212mod tests;
1313
14- use Arch :: * ;
1514#[ allow( non_camel_case_types) ]
1615#[ derive( Copy , Clone , PartialEq ) ]
1716pub ( crate ) enum Arch {
@@ -29,54 +28,60 @@ pub(crate) enum Arch {
2928impl Arch {
3029 fn target_name ( self ) -> & ' static str {
3130 match self {
32- Armv7k => "armv7k" ,
33- Armv7s => "armv7s" ,
34- Arm64 => "arm64" ,
35- Arm64e => "arm64e" ,
36- Arm64_32 => "arm64_32" ,
37- I386 => "i386" ,
38- I686 => "i686" ,
39- X86_64 => "x86_64" ,
40- X86_64h => "x86_64h" ,
31+ Self :: Armv7k => "armv7k" ,
32+ Self :: Armv7s => "armv7s" ,
33+ Self :: Arm64 => "arm64" ,
34+ Self :: Arm64e => "arm64e" ,
35+ Self :: Arm64_32 => "arm64_32" ,
36+ Self :: I386 => "i386" ,
37+ Self :: I686 => "i686" ,
38+ Self :: X86_64 => "x86_64" ,
39+ Self :: X86_64h => "x86_64h" ,
4140 }
4241 }
4342
4443 pub ( crate ) fn target_arch ( self ) -> Cow < ' static , str > {
4544 Cow :: Borrowed ( match self {
46- Armv7k | Armv7s => "arm" ,
47- Arm64 | Arm64e | Arm64_32 => "aarch64" ,
48- I386 | I686 => "x86" ,
49- X86_64 | X86_64h => "x86_64" ,
45+ Self :: Armv7k | Self :: Armv7s => "arm" ,
46+ Self :: Arm64 | Self :: Arm64e | Self :: Arm64_32 => "aarch64" ,
47+ Self :: I386 | Self :: I686 => "x86" ,
48+ Self :: X86_64 | Self :: X86_64h => "x86_64" ,
5049 } )
5150 }
5251
5352 fn target_cpu ( self , env : TargetEnv ) -> & ' static str {
5453 match self {
55- Armv7k => "cortex-a8" ,
56- Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
57- Arm64 => match env {
54+ Self :: Armv7k => "cortex-a8" ,
55+ Self :: Armv7s => "swift" , // iOS 10 is only supported on iPhone 5 or higher.
56+ Self :: Arm64 => match env {
5857 TargetEnv :: Normal => "apple-a7" ,
5958 TargetEnv :: Simulator => "apple-a12" ,
6059 TargetEnv :: MacCatalyst => "apple-a12" ,
6160 } ,
62- Arm64e => "apple-a12" ,
63- Arm64_32 => "apple-s4" ,
61+ Self :: Arm64e => "apple-a12" ,
62+ Self :: Arm64_32 => "apple-s4" ,
6463 // Only macOS 10.12+ is supported, which means
6564 // all x86_64/x86 CPUs must be running at least penryn
6665 // https://github.com/llvm/llvm-project/blob/01f924d0e37a5deae51df0d77e10a15b63aa0c0f/clang/lib/Driver/ToolChains/Arch/X86.cpp#L79-L82
67- I386 | I686 => "penryn" ,
68- X86_64 => "penryn" ,
66+ Self :: I386 | Self :: I686 => "penryn" ,
67+ Self :: X86_64 => "penryn" ,
6968 // Note: `core-avx2` is slightly more advanced than `x86_64h`, see
7069 // comments (and disabled features) in `x86_64h_apple_darwin` for
7170 // details. It is a higher baseline then `penryn` however.
72- X86_64h => "core-avx2" ,
71+ Self :: X86_64h => "core-avx2" ,
7372 }
7473 }
7574
7675 fn stack_probes ( self ) -> StackProbeType {
7776 match self {
78- Armv7k | Armv7s => StackProbeType :: None ,
79- Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64h => StackProbeType :: Inline ,
77+ Self :: Armv7k | Self :: Armv7s => StackProbeType :: None ,
78+ Self :: Arm64
79+ | Self :: Arm64e
80+ | Self :: Arm64_32
81+ | Self :: I386
82+ | Self :: I686
83+ | Self :: X86_64
84+ | Self :: X86_64h => StackProbeType :: Inline ,
8085 }
8186 }
8287}
@@ -132,10 +137,10 @@ pub(crate) fn base(
132137 default_dwarf_version : 4 ,
133138 frame_pointer : match arch {
134139 // clang ignores `-fomit-frame-pointer` for Armv7, it only accepts `-momit-leaf-frame-pointer`
135- Armv7k | Armv7s => FramePointer :: Always ,
140+ Arch :: Armv7k | Arch :: Armv7s => FramePointer :: Always ,
136141 // clang supports omitting frame pointers for the rest, but... don't?
137- Arm64 | Arm64e | Arm64_32 => FramePointer :: NonLeaf ,
138- I386 | I686 | X86_64 | X86_64h => FramePointer :: Always ,
142+ Arch :: Arm64 | Arch :: Arm64e | Arch :: Arm64_32 => FramePointer :: NonLeaf ,
143+ Arch :: I386 | Arch :: I686 | Arch :: X86_64 | Arch :: X86_64h => FramePointer :: Always ,
139144 } ,
140145 has_rpath : true ,
141146 dll_suffix : ".dylib" . into ( ) ,
0 commit comments