Lunderberg commented on code in PR #14568:
URL: https://github.com/apache/tvm/pull/14568#discussion_r1162889291
##########
src/target/llvm/codegen_cpu.cc:
##########
@@ -300,6 +296,36 @@ llvm::DIType* CodeGenCPU::GetDebugType(const Type& ty_tir,
llvm::Type* ty_llvm)
: nullptr;
return dbg_info_->di_builder_->createPointerType(pointee_type,
ty_llvm->getPrimitiveSizeInBits());
+
+ } else if (auto* prim_type = ty_tir.as<PrimTypeNode>()) {
+ DataType dtype = prim_type->dtype;
+ auto [name, dwarf_type] = [&]() -> std::tuple<const char*,
llvm::dwarf::TypeKind> {
+ if (dtype.is_bool()) {
+ return {"bool", llvm::dwarf::DW_ATE_boolean};
+ } else if (dtype.is_float()) {
+ return {"float", llvm::dwarf::DW_ATE_float};
+ } else if (dtype.is_int()) {
+ return {"int", llvm::dwarf::DW_ATE_signed};
+ } else if (dtype.is_uint()) {
+ return {"uint", llvm::dwarf::DW_ATE_unsigned};
+ } else {
+ LOG(FATAL) << "No DWARF representation for TIR type " << dtype;
+ }
+ }();
+
+ std::stringstream ss;
+ ss << name;
+
+ if (!dtype.is_bool()) {
+ ss << dtype.bits();
+ }
+ if (dtype.lanes() > 1) {
+ ss << "x" << dtype.lanes();
+ }
Review Comment:
Thank you, and updated to use `DLDataType2String`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]