/mnt/d/repos/tan/bin/tanc -I. --shared -lunwind -o libruntime.so debug.tan stdlib.tan math.tan --print-ir
; ModuleID = 'debug.tan'
source_filename = "debug.tan"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: nounwind readnone willreturn
declare void @llvm.donothing() #0
declare extern_weak void @abort()
declare extern_weak void @stack_trace()
define void @assert(i1 %_b) !dbg !4 {
func_entry:
%b = alloca i1
call void @llvm.dbg.declare(metadata i1* %b, metadata !10, metadata !DIExpression()), !dbg !11
store i1 %_b, i1* %b, !dbg !12
call void @llvm.dbg.declare(metadata i1* %b, metadata !13, metadata !DIExpression()), !dbg !14
%0 = load i1, i1* %b, !dbg !15
%1 = icmp eq i1 %0, false, !dbg !15
br i1 %1, label %then, label %fi, !dbg !15
then: ; preds = %func_entry
call void @abort(), !dbg !16
br label %fi, !dbg !16
fi: ; preds = %then, %func_entry
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
attributes #0 = { nounwind readnone willreturn }
attributes #1 = { nounwind readnone speculatable willreturn }
!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "tan compiler", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
!3 = !DIFile(filename: "debug.tan", directory: ".")
!4 = distinct !DISubprogram(name: "assert", linkageName: "assert", scope: !3, file: !3, line: 3, type: !5, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !9)
!5 = !DISubroutineType(types: !6)
!6 = !{!7, !8}
!7 = !DIBasicType(name: "void", encoding: DW_ATE_signed)
!8 = !DIBasicType(name: "bool", size: 1, encoding: DW_ATE_boolean)
!9 = <temporary!> !{}
!10 = !DILocalVariable(name: "b", scope: !4, file: !3, line: 3, type: !8)
!11 = !DILocation(line: 3, column: 15, scope: !4)
!12 = !DILocation(line: 4, column: 16, scope: !4)
!13 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !3, line: 3, type: !8)
!14 = !DILocation(line: 3, column: 1, scope: !4)
!15 = !DILocation(line: 5, column: 6, scope: !4)
!16 = !DILocation(line: 6, column: 2, scope: !4)
Compiling TAN file: debug.tan.o
Basic Block in function 'assert' does not have terminator!
label %fi
in function assert
LLVM ERROR: Broken function found, compilation aborted!
pub fn assert(b: bool) : void {
if(!b) {
@stack_trace();
abort();
}
}