Skip to content

Commit 88db589

Browse files
committed
Changed intrinsic generation to include full intrinsic names in panic messages
1 parent b7091ec commit 88db589

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools/generate_intrinsics.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
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")
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')
179+
out.write("fn map_arch_intrinsic(full_name:&str)->&'static str{\n")
180+
out.write('let Some(name) = full_name.strip_prefix("llvm.") else { unimplemented!("***** unsupported LLVM intrinsic {}", full_name) };\n')
181181
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,full_name:&str) -> &'static 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]:
@@ -196,9 +196,9 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
196196
out.write(' // [INVALID CONVERSION]: "{}" => "{}",\n'.format(llvm_name, entry[1]))
197197
else:
198198
out.write(' "{}" => "{}",\n'.format(llvm_name, entry[1]))
199-
out.write(' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n')
200-
out.write("}} }} {}(name) }}\n,".format(arch))
201-
out.write(' _ => unimplemented!("***** unsupported LLVM architecture {}", name),\n')
199+
out.write(' _ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),\n')
200+
out.write("}} }} {}(name,full_name) }}\n,".format(arch))
201+
out.write(' _ => unimplemented!("***** unsupported LLVM architecture {arch}, intrinsic:{full_name}"),\n')
202202
out.write("}\n}")
203203
subprocess.call(["rustfmt", output_file])
204204
print("Done!")

0 commit comments

Comments
 (0)