- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
function main()
{
const ac = [1, 2, 3];
let a = ac;
print(ac[0]);
print(ac[1]);
print(ac[2]);
print(a[0]);
print(a[1]);
print(a[2]);
const ac2 = [1.0, 2.0, 3.0];
let a2 = ac2;
print(ac2[0]);
print(ac2[1]);
print(ac2[2]);
print(a2[0]);
print(a2[1]);
print(a2[2]);
const ac3 = ["item 1", "item 2", "item 3"];
let a3 = ac3;
print(ac3[0]);
print(ac3[1]);
print(ac3[2]);
print(a3[0]);
print(a3[1]);
print(a3[2]);
}
// LLVM output
; ModuleID = 'LLVMDialectModule'
source_filename = "LLVMDialectModule"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
@frmt_11120820245497078329 = internal constant [4 x i8] c"%s\0A\00"
@s_13298922352840505641 = internal constant [8 x i8] c"item 3\00\00"
@s_13297965777724151296 = internal constant [8 x i8] c"item 2\00\00"
@s_13300835503073214331 = internal constant [8 x i8] c"item 1\00\00"
@a_14124738666956595718 = internal constant [3 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13300835503073214331, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13297965777724151296, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @s_13298922352840505641, i64 0, i64 0)]
@frmt_11108397963124010376 = internal constant [4 x i8] c"%f\0A\00"
@a_17125214420326958200 = internal constant [3 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00]
@frmt_11106471618751763154 = internal constant [4 x i8] c"%d\0A\00"
@a_2366260266165782651 = internal constant [3 x i32] [i32 1, i32 2, i32 3]
declare i8* @malloc(i64)
declare void @free(i8*)
declare i32 @printf(i8*, ...)
define void @main() !dbg !3 {
%1 = alloca i32*, align 8, !dbg !7
store i32* getelementptr inbounds ([3 x i32], [3 x i32]* @a_2366260266165782651, i64 0, i64 0), i32** %1, align 8, !dbg !7
%2 = load i32*, i32** %1, align 8, !dbg !7
%3 = alloca i32*, align 8, !dbg !9
store i32* %2, i32** %3, align 8, !dbg !9
%4 = load i32*, i32** %1, align 8, !dbg !7
%5 = getelementptr i32, i32* %4, i32 0, !dbg !10
%6 = load i32, i32* %5, align 4, !dbg !10
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %6), !dbg !11
%8 = load i32*, i32** %1, align 8, !dbg !7
%9 = getelementptr i32, i32* %8, i32 1, !dbg !12
%10 = load i32, i32* %9, align 4, !dbg !12
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %10), !dbg !13
%12 = load i32*, i32** %1, align 8, !dbg !7
%13 = getelementptr i32, i32* %12, i32 2, !dbg !14
%14 = load i32, i32* %13, align 4, !dbg !14
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %14), !dbg !15
%16 = load i32*, i32** %3, align 8, !dbg !9
%17 = getelementptr i32, i32* %16, i32 0, !dbg !16
%18 = load i32, i32* %17, align 4, !dbg !16
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %18), !dbg !17
%20 = load i32*, i32** %3, align 8, !dbg !9
%21 = getelementptr i32, i32* %20, i32 1, !dbg !18
%22 = load i32, i32* %21, align 4, !dbg !18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %22), !dbg !19
%24 = load i32*, i32** %3, align 8, !dbg !9
%25 = getelementptr i32, i32* %24, i32 2, !dbg !20
%26 = load i32, i32* %25, align 4, !dbg !20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11106471618751763154, i64 0, i64 0), i32 %26), !dbg !21
%28 = alloca float*, align 8, !dbg !22
store float* getelementptr inbounds ([3 x float], [3 x float]* @a_17125214420326958200, i64 0, i64 0), float** %28, align 8, !dbg !22
%29 = load float*, float** %28, align 8, !dbg !22
%30 = alloca float*, align 8, !dbg !23
store float* %29, float** %30, align 8, !dbg !23
%31 = load float*, float** %28, align 8, !dbg !22
%32 = getelementptr float, float* %31, i32 0, !dbg !24
%33 = load float, float* %32, align 4, !dbg !24
%34 = fpext float %33 to double, !dbg !25
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11108397963124010376, i64 0, i64 0), double %34), !dbg !25
%36 = load float*, float** %28, align 8, !dbg !22
%37 = getelementptr float, float* %36, i32 1, !dbg !26
%38 = load float, float* %37, align 4, !dbg !26
%39 = fpext float %38 to double, !dbg !27
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @frmt_11108397963124010376, i64 0, i64 0), double %39), !dbg !27
продолжаем нашу е..блю с компилятором а ля "C" но только используя синтакс TypeScript
дальше это гвно при запуска tsc.exe --emit=llvm c:\1.ts
получаем равернутую раскладку го-в-на которе можно перевести в Obj файл
а если запустим EXE получим такую Х типа "1 2 3 1 2 3 1.0 2.0 3.0 1.0 2.0 3.0 item 1 item 2 item 3 item 1 item 2 item 3"
и никакой е..бли в указателями все сука компилятор делает сам