@@ -168,22 +168,22 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
168
168
os .path .dirname (os .path .abspath (__file__ )),
169
169
"../src/intrinsic/archs.rs" ,
170
170
)
171
- # A hashmap of all architectures. This allows us to first match on the architecture, and then on the intrisnics.
171
+ # A hashmap of all architectures. This allows us to first match on the architecture, and then on the intrinsics.
172
172
# This speeds up the comparison, and makes our code considerably smaller.
173
- # Since all intrinsic names start with ". llvm", we skip that prefix.
173
+ # Since all intrinsic names start with "llvm. ", we skip that prefix.
174
174
print ("Updating content of `{}`..." .format (output_file ))
175
175
with open (output_file , "w" , encoding = "utf8" ) as out :
176
176
out .write ("// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`\n " )
177
177
out .write ("// DO NOT EDIT IT!\n " )
178
178
out .write ("/// Translate a given LLVM intrinsic name to an equivalent GCC one.\n " )
179
179
out .write ("fn map_arch_intrinsic(name:&str)->&str{\n " )
180
- out .write ('let Some(name) = name.strip_prefix("llvm.") else {unimplemented!("***** unsupported LLVM intrinsic {}", name)};\n ' )
181
- out .write ('let Some((arch, name)) = name.split_once(\' .\' ) else {unimplemented!("***** unsupported LLVM intrinsic {}", name)};\n ' )
180
+ out .write ('let Some(name) = name.strip_prefix("llvm.") else { unimplemented!("***** unsupported LLVM intrinsic {}", name) };\n ' )
181
+ out .write ('let Some((arch, name)) = name.split_once(\' .\' ) else { unimplemented!("***** unsupported LLVM intrinsic {}", name) };\n ' )
182
182
out .write ("match arch {\n " )
183
183
for arch in archs :
184
184
if len (intrinsics [arch ]) == 0 :
185
185
continue
186
- out .write ("\" {}\" => {{ #[allow(non_snake_case)] fn {}(name:&str)-> &str{{ match name{{" .format (arch ,arch ))
186
+ out .write ("\" {}\" => {{ #[allow(non_snake_case)] fn {}(name: &str) -> &str {{ match name {{" .format (arch ,arch ))
187
187
intrinsics [arch ].sort (key = lambda x : (x [0 ], x [2 ]))
188
188
out .write (' // {}\n ' .format (arch ))
189
189
for entry in intrinsics [arch ]:
@@ -198,7 +198,7 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
198
198
out .write (' "{}" => "{}",\n ' .format (llvm_name , entry [1 ]))
199
199
out .write (' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n ' )
200
200
out .write ("}} }} {}(name) }}\n ," .format (arch ))
201
- out .write (' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n ' )
201
+ out .write (' _ => unimplemented!("***** unsupported LLVM architecture {}", name),\n ' )
202
202
out .write ("}\n }" )
203
203
subprocess .call (["rustfmt" , output_file ])
204
204
print ("Done!" )
0 commit comments