@@ -168,22 +168,22 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
168168 os .path .dirname (os .path .abspath (__file__ )),
169169 "../src/intrinsic/archs.rs" ,
170170 )
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.
172172 # 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.
174174 print ("Updating content of `{}`..." .format (output_file ))
175175 with open (output_file , "w" , encoding = "utf8" ) as out :
176176 out .write ("// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`\n " )
177177 out .write ("// DO NOT EDIT IT!\n " )
178178 out .write ("/// Translate a given LLVM intrinsic name to an equivalent GCC one.\n " )
179179 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 ' )
182182 out .write ("match arch {\n " )
183183 for arch in archs :
184184 if len (intrinsics [arch ]) == 0 :
185185 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 ))
187187 intrinsics [arch ].sort (key = lambda x : (x [0 ], x [2 ]))
188188 out .write (' // {}\n ' .format (arch ))
189189 for entry in intrinsics [arch ]:
@@ -198,7 +198,7 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
198198 out .write (' "{}" => "{}",\n ' .format (llvm_name , entry [1 ]))
199199 out .write (' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n ' )
200200 out .write ("}} }} {}(name) }}\n ," .format (arch ))
201- out .write (' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n ' )
201+ out .write (' _ => unimplemented!("***** unsupported LLVM architecture {}", name),\n ' )
202202 out .write ("}\n }" )
203203 subprocess .call (["rustfmt" , output_file ])
204204 print ("Done!" )
0 commit comments