Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rudimentry debug info metadata emission #4225

Merged
20 changes: 18 additions & 2 deletions toolchain/driver/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ Excludes files with the given prefix from dumps.
)""",
},
[&](auto& arg_b) { arg_b.Set(&exclude_dump_file_prefix); });
b.AddFlag(
{
.name = "debug-info",
.help = R"""(
Emit DWARF debug information.
)""",
},
[&](auto& arg_b) { arg_b.Set(&include_debug_info); });
}

Phase phase;
Expand All @@ -358,6 +366,7 @@ Excludes files with the given prefix from dumps.
bool preorder_parse_tree = false;
bool builtin_sem_ir = false;
bool prelude_import = false;
bool include_debug_info = false;

llvm::StringRef exclude_dump_file_prefix;
};
Expand Down Expand Up @@ -523,6 +532,12 @@ auto Driver::ValidateCompileOptions(const CompileOptions& options) const
<< options.phase << "'.\n";
return false;
}
if (options.include_debug_info) {
error_stream_
<< "ERROR: Requested debug info but compile phase is limited to '"
<< options.phase << "'.\n";
return false;
}
[[fallthrough]];
case Phase::Lower:
case Phase::CodeGen:
Expand Down Expand Up @@ -676,8 +691,9 @@ class Driver::CompilationUnit {
// TODO: Consider disabling instruction naming by default if we're not
// producing textual LLVM IR.
SemIR::InstNamer inst_namer(*tokens_, *parse_tree_, *sem_ir_);
module_ = Lower::LowerToLLVM(*llvm_context_, input_filename_, *sem_ir_,
&inst_namer, vlog_stream_);
module_ = Lower::LowerToLLVM(*llvm_context_, options_.include_debug_info,
input_filename_, *sem_ir_, &inst_namer,
vlog_stream_);
});
if (vlog_stream_) {
CARBON_VLOG() << "*** llvm::Module ***\n";
Expand Down
27 changes: 26 additions & 1 deletion toolchain/lower/file_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@
namespace Carbon::Lower {

FileContext::FileContext(llvm::LLVMContext& llvm_context,
llvm::StringRef module_name, const SemIR::File& sem_ir,
bool include_debug_info, llvm::StringRef module_name,
const SemIR::File& sem_ir,
const SemIR::InstNamer* inst_namer,
llvm::raw_ostream* vlog_stream)
: llvm_context_(&llvm_context),
llvm_module_(std::make_unique<llvm::Module>(module_name, llvm_context)),
di_builder_(*llvm_module_),
di_compile_unit_(
include_debug_info
? BuildDICompileUnit(module_name, *llvm_module_, di_builder_)
: nullptr),
sem_ir_(&sem_ir),
inst_namer_(inst_namer),
vlog_stream_(vlog_stream) {
Expand Down Expand Up @@ -66,6 +72,25 @@ auto FileContext::Run() -> std::unique_ptr<llvm::Module> {
return std::move(llvm_module_);
}

auto FileContext::BuildDICompileUnit(llvm::StringRef module_name,
llvm::Module& llvm_module,
llvm::DIBuilder& di_builder)
-> llvm::DICompileUnit* {
llvm_module.addModuleFlag(llvm::Module::Max, "Dwarf Version", 5);
llvm_module.addModuleFlag(llvm::Module::Warning, "Debug Info Version",
llvm::DEBUG_METADATA_VERSION);
// FIXME: Include directory path in the compile_unit_file.
llvm::DIFile* compile_unit_file = di_builder.createFile(module_name, "");
// FIXME: Introduce a new language code for Carbon. C works well for now since
// it's something debuggers will already know/have support for at least.
// Probably have to bump to C++ at some point for virtual functions,
// templates, etc.
return di_builder.createCompileUnit(llvm::dwarf::DW_LANG_C, compile_unit_file,
"carbon",
/*isOptimized=*/false, /*Flags=*/"",
/*RV=*/0);
}

auto FileContext::GetGlobal(SemIR::InstId inst_id) -> llvm::Value* {
auto inst = sem_ir().insts().Get(inst_id);

Expand Down
14 changes: 13 additions & 1 deletion toolchain/lower/file_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define CARBON_TOOLCHAIN_LOWER_FILE_CONTEXT_H_

#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "toolchain/sem_ir/file.h"
Expand All @@ -16,7 +17,7 @@ namespace Carbon::Lower {
// Context and shared functionality for lowering handlers.
class FileContext {
public:
explicit FileContext(llvm::LLVMContext& llvm_context,
explicit FileContext(llvm::LLVMContext& llvm_context, bool include_debug_info,
llvm::StringRef module_name, const SemIR::File& sem_ir,
const SemIR::InstNamer* inst_namer,
llvm::raw_ostream* vlog_stream);
Expand All @@ -25,6 +26,11 @@ class FileContext {
// the main execution loop.
auto Run() -> std::unique_ptr<llvm::Module>;

// Create the DICompileUnit metadata for this compilation.
auto BuildDICompileUnit(llvm::StringRef module_name,
llvm::Module& llvm_module,
llvm::DIBuilder& di_builder) -> llvm::DICompileUnit*;

// Gets a callable's function. Returns nullptr for a builtin.
auto GetFunction(SemIR::FunctionId function_id) -> llvm::Function* {
return functions_[function_id.index];
Expand Down Expand Up @@ -77,6 +83,12 @@ class FileContext {
llvm::LLVMContext* llvm_context_;
std::unique_ptr<llvm::Module> llvm_module_;

// State for building the LLVM IR debug info metadata.
llvm::DIBuilder di_builder_;

// The DICompileUnit, if any - null implies debug info is not being emitted.
llvm::DICompileUnit* di_compile_unit_;

// The input SemIR.
const SemIR::File* const sem_ir_;

Expand Down
1 change: 1 addition & 0 deletions toolchain/lower/handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
Expand Down
9 changes: 5 additions & 4 deletions toolchain/lower/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

namespace Carbon::Lower {

auto LowerToLLVM(llvm::LLVMContext& llvm_context, llvm::StringRef module_name,
const SemIR::File& sem_ir, const SemIR::InstNamer* inst_namer,
auto LowerToLLVM(llvm::LLVMContext& llvm_context, bool include_debug_info,
llvm::StringRef module_name, const SemIR::File& sem_ir,
const SemIR::InstNamer* inst_namer,
llvm::raw_ostream* vlog_stream)
-> std::unique_ptr<llvm::Module> {
FileContext context(llvm_context, module_name, sem_ir, inst_namer,
vlog_stream);
FileContext context(llvm_context, include_debug_info, module_name, sem_ir,
inst_namer, vlog_stream);
return context.Run();
}

Expand Down
5 changes: 3 additions & 2 deletions toolchain/lower/lower.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
namespace Carbon::Lower {

// Lowers SemIR to LLVM IR.
auto LowerToLLVM(llvm::LLVMContext& llvm_context, llvm::StringRef module_name,
const SemIR::File& sem_ir, const SemIR::InstNamer* inst_namer,
auto LowerToLLVM(llvm::LLVMContext& llvm_context, bool include_debug_info,
llvm::StringRef module_name, const SemIR::File& sem_ir,
const SemIR::InstNamer* inst_namer,
llvm::raw_ostream* vlog_stream)
-> std::unique_ptr<llvm::Module>;

Expand Down
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/alias/local.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ fn F() -> i32 {
// CHECK:STDOUT: %.loc14 = load i32, ptr %a.var, align 4
// CHECK:STDOUT: ret i32 %.loc14
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "local.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/array/array_in_place.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ fn G() {
// CHECK:STDOUT: call void @F(ptr %.loc14_42.5.array.index)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "array_in_place.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/array/assign_return_value.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ fn Run() {
// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
// CHECK:STDOUT:
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "assign_return_value.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/array/base.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ fn Run() {
// CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 3, 2, 1, 0 }
// CHECK:STDOUT:
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "base.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/array/function_param.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ fn G() -> i32 {
// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
// CHECK:STDOUT:
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "function_param.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/empty.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@

// CHECK:STDOUT: ; ModuleID = 'empty.carbon'
// CHECK:STDOUT: source_filename = "empty.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "empty.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/false_true.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ fn T() -> bool {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i1 true
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "false_true.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/int_types.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ fn F_u65536(a: u65536) -> u65536 { return a; }
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i65536 %a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "int_types.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/numeric_literals.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ fn F() {
// CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 }
// CHECK:STDOUT:
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "numeric_literals.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/type_values.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ fn F64() -> type {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret %type zeroinitializer
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "type_values.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/basics/zero.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ fn Main() -> i32 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "zero.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/float.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@ fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); }
// CHECK:STDOUT: %float.greater_eq = fcmp oge double %a, %b
// CHECK:STDOUT: ret i1 %float.greater_eq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "float.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/int.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,11 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); }
// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b
// CHECK:STDOUT: ret i1 %int.greater_eq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "int.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ fn TestAddMethod(a: i32, b: i32) -> i32 { return a.(AddMethod)(b); }
// CHECK:STDOUT: %int.sadd = add i32 %a, %b
// CHECK:STDOUT: ret i32 %int.sadd
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "method_vs_nonmethod.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/overloaded_operator.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 {
// CHECK:STDOUT: %int.sadd.loc18_16 = add i32 %.loc18_12.4, %c
// CHECK:STDOUT: ret i32 %int.sadd.loc18_16
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "overloaded_operator.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/print.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ fn Main() {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: declare i32 @printf(ptr, ...)
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "print.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/types.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ fn F() {
// CHECK:STDOUT: store i1 false, ptr %b.var, align 1
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "types.carbon", directory: "")
8 changes: 8 additions & 0 deletions toolchain/lower/testdata/builtins/uint.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,11 @@ fn TestGreaterEq(a: u64, b: u64) -> bool { return GreaterEq(a, b); }
// CHECK:STDOUT: %int.greater_eq = icmp uge i64 %a, %b
// CHECK:STDOUT: ret i1 %int.greater_eq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
// CHECK:STDOUT:
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "uint.carbon", directory: "")
Loading