mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-26 05:21:15 +00:00
This adds just the debug info metadata for Compilation Units (the top level container of debug info) - but without anything in them, LLVM won't emit them at all, so while this is testable at the IR level, it isn't observable at the object level until more debug info is added. A couple of starting points in this patch: * A flag (`--debug-info`, seems to match the naming/style of other flags in the carbon driver, though this is different from the naming conventions of clang/gcc) that enables debug info when lowering. Open to other names/approaches (on by default? historically debug info's been to large/expensive to do this, so sticking with that precedent for now). * Enabling that flag by default in the lowering tests - I do find the churn on golden tests a bit rough, and adding more features to all the tests means more churn, but it seems consistent with the approach so far - keep an eye on this and perhaps revisit this if the churn gets too annoying --------- Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com> Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
120 lines
4.6 KiB
Plaintext
120 lines
4.6 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/float.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/float.carbon
|
|
|
|
fn Negate(a: f64) -> f64 = "float.negate";
|
|
fn TestNegate(a: f64) -> f64 { return Negate(a); }
|
|
|
|
fn Add(a: f64, b: f64) -> f64 = "float.add";
|
|
fn TestAdd(a: f64, b: f64) -> f64 { return Add(a, b); }
|
|
|
|
fn Sub(a: f64, b: f64) -> f64 = "float.sub";
|
|
fn TestSub(a: f64, b: f64) -> f64 { return Sub(a, b); }
|
|
|
|
fn Mul(a: f64, b: f64) -> f64 = "float.mul";
|
|
fn TestMul(a: f64, b: f64) -> f64 { return Mul(a, b); }
|
|
|
|
fn Div(a: f64, b: f64) -> f64 = "float.div";
|
|
fn TestDiv(a: f64, b: f64) -> f64 { return Div(a, b); }
|
|
|
|
fn Eq(a: f64, b: f64) -> bool = "float.eq";
|
|
fn TestEq(a: f64, b: f64) -> bool { return Eq(a, b); }
|
|
|
|
fn Neq(a: f64, b: f64) -> bool = "float.neq";
|
|
fn TestNeq(a: f64, b: f64) -> bool { return Neq(a, b); }
|
|
|
|
fn Less(a: f64, b: f64) -> bool = "float.less";
|
|
fn TestLess(a: f64, b: f64) -> bool { return Less(a, b); }
|
|
|
|
fn LessEq(a: f64, b: f64) -> bool = "float.less_eq";
|
|
fn TestLessEq(a: f64, b: f64) -> bool { return LessEq(a, b); }
|
|
|
|
fn Greater(a: f64, b: f64) -> bool = "float.greater";
|
|
fn TestGreater(a: f64, b: f64) -> bool { return Greater(a, b); }
|
|
|
|
fn GreaterEq(a: f64, b: f64) -> bool = "float.greater_eq";
|
|
fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); }
|
|
|
|
// CHECK:STDOUT: ; ModuleID = 'float.carbon'
|
|
// CHECK:STDOUT: source_filename = "float.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define double @TestNegate(double %a) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.negate = fneg double %a
|
|
// CHECK:STDOUT: ret double %float.negate
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define double @TestAdd(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.add = fadd double %a, %b
|
|
// CHECK:STDOUT: ret double %float.add
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define double @TestSub(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.sub = fsub double %a, %b
|
|
// CHECK:STDOUT: ret double %float.sub
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define double @TestMul(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.mul = fmul double %a, %b
|
|
// CHECK:STDOUT: ret double %float.mul
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define double @TestDiv(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.div = fdiv double %a, %b
|
|
// CHECK:STDOUT: ret double %float.div
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestEq(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.eq = fcmp oeq double %a, %b
|
|
// CHECK:STDOUT: ret i1 %float.eq
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestNeq(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.neq = fcmp one double %a, %b
|
|
// CHECK:STDOUT: ret i1 %float.neq
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestLess(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.less = fcmp olt double %a, %b
|
|
// CHECK:STDOUT: ret i1 %float.less
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestLessEq(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.less_eq = fcmp ole double %a, %b
|
|
// CHECK:STDOUT: ret i1 %float.less_eq
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestGreater(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %float.greater = fcmp ogt double %a, %b
|
|
// CHECK:STDOUT: ret i1 %float.greater
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define i1 @TestGreaterEq(double %a, double %b) {
|
|
// CHECK:STDOUT: entry:
|
|
// 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: "")
|