translator: make fully auto generated .ll in kotlin native lib
This commit is contained in:
+21
-10
@@ -1,32 +1,37 @@
|
||||
|
||||
BUILD_DIR=$(PWD)/build
|
||||
INCLUDE_DIR=$(PWD)/include
|
||||
LIB_ARM_DIR=$(PWD)/lib/arm
|
||||
LIB_X86_DIR=$(PWD)/lib/x86
|
||||
LIB_DIR=$(PWD)/lib
|
||||
LIB_ARM_DIR=$(LIB_DIR)/arm
|
||||
LIB_X86_DIR=$(LIB_DIR)/x86
|
||||
LIBC=$(PWD)/libc
|
||||
LLVM_ARM_FILES = $(patsubst $(LIBC)/%.c,$(LIB_ARM_DIR)/%.ll,$(wildcard $(LIBC)/*.c))
|
||||
LLVM_X86_FILES = $(patsubst $(LIBC)/%.c,$(LIB_X86_DIR)/%.ll,$(wildcard $(LIBC)/*.c))
|
||||
|
||||
KT=$(PWD)/../translator/build/libs/translator-1.0.jar
|
||||
LLINK=llvm-link-3.6
|
||||
CC=clang-3.6
|
||||
|
||||
CCFLAGS_ARM=-g -S -Wall -m32 -emit-llvm -nostdlib -ffreestanding -march=armv7-m -mthumb -flto -O0 -target arm-none-eabi -DARM
|
||||
CCFLAGS=-g -O0 -S -Wall -emit-llvm -nostdlib -ffreestanding
|
||||
CCFLAGS_ARM=-g -S -Wall -m32 -emit-llvm -nostdlib -ffreestanding -march=armv7-m -mthumb -flto -O0 -target arm-none-eabi -DARM -Wno-int-to-pointer-cast -Wno-gcc-compat
|
||||
CCFLAGS=-g -O0 -S -Wall -emit-llvm -nostdlib -ffreestanding -Wno-int-to-pointer-cast -Wno-gcc-compat
|
||||
CCFLAGS_DEBUG=-g -O0 -S -Wall -emit-llvm -nostdlib -ffreestanding -DDBG
|
||||
LLINK_FLAGS=-S
|
||||
|
||||
KT_ALL_DEPS=java -jar $(KT)
|
||||
LLINK_ALL_DEPS=$(LLINK) $(LLINK_FLAGS) $(filter %.ll,$^) > $@
|
||||
|
||||
all: memory $(BUILD_DIR) $(BUILD_DIR)/stdlib_arm.ll $(BUILD_DIR)/stdlib_x86.ll
|
||||
all: $(BUILD_DIR) $(BUILD_DIR)/stdlib_arm.ll $(BUILD_DIR)/stdlib_x86.ll
|
||||
debug: memory_debug $(BUILD_DIR) $(BUILD_DIR)/stdlib_arm.ll $(BUILD_DIR)/stdlib_x86.ll
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
mkdir -p $(LIB_ARM_DIR)
|
||||
mkdir -p $(LIB_X86_DIR)
|
||||
|
||||
$(BUILD_DIR)/stdlib_x86.ll: $(LIB_X86_DIR)/*.ll
|
||||
$(BUILD_DIR)/stdlib_arm.ll: $(LLVM_ARM_FILES)
|
||||
$(LLINK_ALL_DEPS)
|
||||
|
||||
$(BUILD_DIR)/stdlib_arm.ll: $(LIB_ARM_DIR)/*.ll
|
||||
$(BUILD_DIR)/stdlib_x86.ll: $(LLVM_X86_FILES)
|
||||
$(LLINK_ALL_DEPS)
|
||||
|
||||
$(BUILD_DIR)/classes_x86.ll: $(INCLUDE_DIR)/*.kt
|
||||
@@ -35,15 +40,21 @@ $(BUILD_DIR)/classes_x86.ll: $(INCLUDE_DIR)/*.kt
|
||||
$(BUILD_DIR)/classes_arm.ll: $(INCLUDE_DIR)/*.kt
|
||||
$(KT_ALL_DEPS) --arm -o $@ $(filter %.kt,$^)
|
||||
|
||||
memory:
|
||||
$(CC) $(CCFLAGS) $(LIBC)/memory.c -o $(LIB_X86_DIR)/memory.ll
|
||||
$(CC) $(CCFLAGS_ARM) $(LIBC)/memory.c -o $(LIB_ARM_DIR)/memory.ll
|
||||
$(LIB_X86_DIR)/%.ll: $(LIBC)/%.c
|
||||
$(CC) $(CCFLAGS) -c $< -o $(LIB_X86_DIR)/$(basename $(notdir $<)).ll
|
||||
|
||||
$(LIB_ARM_DIR)/%.ll: $(LIBC)/%.c
|
||||
$(CC) $(CCFLAGS_ARM) -c $< -o $(LIB_ARM_DIR)/$(basename $(notdir $<)).ll
|
||||
|
||||
memory_debug:
|
||||
$(CC) $(CCFLAGS_DEBUG) $(LIBC)/memory.c -o $(LIB_X86_DIR)/memory.ll
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -rf $(LIB_DIR)
|
||||
|
||||
aaa:
|
||||
@echo $(LLVM_ARM_FILES)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
external fun kotlinclib_boolean_array_get_ix(dataRawPtr: Int, index: Int): Byte
|
||||
external fun kotlinclib_boolean_array_set_ix(dataRawPtr: Int, index: Int, value: Byte)
|
||||
external fun kotlinclib_boolean_size(): Int
|
||||
|
||||
class BooleanArray(var size: Int) {
|
||||
@@ -19,7 +21,7 @@ class BooleanArray(var size: Int) {
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
operator fun get(index: Int): Boolean {
|
||||
val res = kotlinclib_get_byte(this.dataRawPtr, index) == 1.toByte()
|
||||
val res = kotlinclib_boolean_array_get_ix(this.dataRawPtr, index) == 1.toByte()
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -27,9 +29,9 @@ class BooleanArray(var size: Int) {
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
operator fun set(index: Int, value: Boolean) {
|
||||
if (value == true) {
|
||||
kotlinclib_set_byte(this.dataRawPtr, index, 1.toByte())
|
||||
kotlinclib_boolean_array_set_ix(this.dataRawPtr, index, 1.toByte())
|
||||
} else {
|
||||
kotlinclib_set_byte(this.dataRawPtr, index, 0.toByte())
|
||||
kotlinclib_boolean_array_set_ix(this.dataRawPtr, index, 0.toByte())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ fun BooleanArray.print() {
|
||||
while (index < size) {
|
||||
print(get(index))
|
||||
index++
|
||||
if (index < size){
|
||||
if (index < size) {
|
||||
print(';')
|
||||
print(' ')
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package kotlin
|
||||
|
||||
external fun malloc_array(size: Int): Int
|
||||
external fun kotlinclib_get_byte(src: Int, index: Int): Byte
|
||||
external fun kotlinclib_set_byte(src: Int, index: Int, value: Byte)
|
||||
external fun kotlinclib_byte_array_get_ix(dataRawPtr: Int, index: Int): Byte
|
||||
external fun kotlinclib_byte_array_set_ix(dataRawPtr: Int, index: Int, value: Byte)
|
||||
external fun kotlinclib_byte_size(): Int
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ class ByteArray(var size: Int) {
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
operator fun get(index: Int): Byte {
|
||||
return kotlinclib_get_byte(this.dataRawPtr, index)
|
||||
return kotlinclib_byte_array_get_ix(this.dataRawPtr, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
operator fun set(index: Int, value: Byte) {
|
||||
kotlinclib_set_byte(this.dataRawPtr, index, value)
|
||||
kotlinclib_byte_array_set_ix(this.dataRawPtr, index, value)
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ fun ByteArray.print() {
|
||||
while (index < size) {
|
||||
print(get(index))
|
||||
index++
|
||||
if (index < size){
|
||||
if (index < size) {
|
||||
print(';')
|
||||
print(' ')
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package kotlin
|
||||
|
||||
external fun kotlinclib_get_int(src: Int, index: Int): Int
|
||||
external fun kotlinclib_set_int(src: Int, index: Int, value: Int)
|
||||
external fun kotlinclib_int_array_get_ix(dataRawPtr: Int, index: Int): Int
|
||||
external fun kotlinclib_int_array_set_ix(dataRawPtr: Int, index: Int, value: Int)
|
||||
external fun kotlinclib_int_size(): Int
|
||||
|
||||
|
||||
class IntArray(var size: Int) {
|
||||
val dataRawPtr: Int
|
||||
|
||||
//[TODO move up]
|
||||
/** Returns the number of elements in the array. */
|
||||
//size: Int
|
||||
|
||||
@@ -22,13 +23,13 @@ class IntArray(var size: Int) {
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
operator fun get(index: Int): Int {
|
||||
return kotlinclib_get_int(this.dataRawPtr, index)
|
||||
return kotlinclib_int_array_get_ix(this.dataRawPtr, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
operator fun set(index: Int, value: Int) {
|
||||
kotlinclib_set_int(this.dataRawPtr, index, value)
|
||||
kotlinclib_int_array_set_ix(this.dataRawPtr, index, value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
external fun kotlinclib_get_long(src: Int, index: Int): Long
|
||||
external fun kotlinclib_set_long(src: Int, index: Int, value: Long)
|
||||
external fun kotlinclib_long_array_get_ix(dataRawPtr: Int, index: Int): Long
|
||||
external fun kotlinclib_long_array_set_ix(dataRawPtr: Int, index: Int, value: Long)
|
||||
external fun kotlinclib_long_size(): Int
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ class LongArray(var size: Int) {
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
operator fun get(index: Int): Long {
|
||||
return kotlinclib_get_long(this.dataRawPtr, index)
|
||||
return kotlinclib_long_array_get_ix(this.dataRawPtr, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
operator fun set(index: Int, value: Long) {
|
||||
kotlinclib_set_long(this.dataRawPtr, index, value)
|
||||
kotlinclib_long_array_set_ix(this.dataRawPtr, index, value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
external fun kotlinclib_get_short(src: Int, index: Int): Short
|
||||
external fun kotlinclib_set_short(src: Int, index: Int, value: Short)
|
||||
external fun kotlinclib_short_array_get_ix(dataRawPtr: Int, index: Int): Short
|
||||
external fun kotlinclib_short_array_set_ix(dataRawPtr: Int, index: Int, value: Short)
|
||||
external fun kotlinclib_short_size(): Int
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ class ShortArray(var size: Int) {
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
operator fun get(index: Int): Short {
|
||||
return kotlinclib_get_short(this.dataRawPtr, index)
|
||||
return kotlinclib_short_array_get_ix(this.dataRawPtr, index)
|
||||
}
|
||||
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
operator fun set(index: Int, value: Short) {
|
||||
kotlinclib_set_short(this.dataRawPtr, index, value)
|
||||
kotlinclib_short_array_set_ix(this.dataRawPtr, index, value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
; ModuleID = 'array.c'
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv7m-none--eabi"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak i32 @kotlin.malloc_array(i32 %x) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %x, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = call i8* @malloc_heap(i32 %2) #2
|
||||
%4 = ptrtoint i8* %3 to i32
|
||||
ret i32 %4
|
||||
}
|
||||
|
||||
declare i8* @malloc_heap(i32) #1
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak zeroext i8 @kotlin.kotlinclib_get_byte(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = inttoptr i32 %3 to i8*
|
||||
%5 = load i32* %2, align 4
|
||||
%6 = getelementptr inbounds i8* %4, i32 %5
|
||||
%7 = load i8* %6, align 1
|
||||
ret i8 %7
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_set_byte(i32 %data, i32 %index, i8 zeroext %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i8, align 1
|
||||
%ptr = alloca i8*, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i8 %value, i8* %3, align 1
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = inttoptr i32 %4 to i8*
|
||||
store i8* %5, i8** %ptr, align 4
|
||||
%6 = load i8* %3, align 1
|
||||
%7 = load i8** %ptr, align 4
|
||||
%8 = load i32* %2, align 4
|
||||
%9 = getelementptr inbounds i8* %7, i32 %8
|
||||
store i8 %6, i8* %9, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak i32 @kotlin.kotlinclib_get_int(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = inttoptr i32 %3 to i32*
|
||||
%5 = load i32* %2, align 4
|
||||
%6 = getelementptr inbounds i32* %4, i32 %5
|
||||
%7 = load i32* %6, align 4
|
||||
ret i32 %7
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_set_int(i32 %data, i32 %index, i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i32, align 4
|
||||
%ptr = alloca i32*, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i32 %value, i32* %3, align 4
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = inttoptr i32 %4 to i32*
|
||||
store i32* %5, i32** %ptr, align 4
|
||||
%6 = load i32* %3, align 4
|
||||
%7 = load i32** %ptr, align 4
|
||||
%8 = load i32* %2, align 4
|
||||
%9 = getelementptr inbounds i32* %7, i32 %8
|
||||
store i32 %6, i32* %9, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak signext i16 @kotlin.kotlinclib_get_short(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = inttoptr i32 %3 to i16*
|
||||
%5 = load i32* %2, align 4
|
||||
%6 = getelementptr inbounds i16* %4, i32 %5
|
||||
%7 = load i16* %6, align 2
|
||||
ret i16 %7
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_set_short(i32 %data, i32 %index, i16 signext %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i16, align 2
|
||||
%ptr = alloca i16*, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i16 %value, i16* %3, align 2
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = inttoptr i32 %4 to i16*
|
||||
store i16* %5, i16** %ptr, align 4
|
||||
%6 = load i16* %3, align 2
|
||||
%7 = load i16** %ptr, align 4
|
||||
%8 = load i32* %2, align 4
|
||||
%9 = getelementptr inbounds i16* %7, i32 %8
|
||||
store i16 %6, i16* %9, align 2
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak i32 @kotlin.kotlinclib_get_long(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = inttoptr i32 %3 to i32*
|
||||
%5 = load i32* %2, align 4
|
||||
%6 = getelementptr inbounds i32* %4, i32 %5
|
||||
%7 = load i32* %6, align 4
|
||||
ret i32 %7
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_set_long(i32 %data, i32 %index, i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i32, align 4
|
||||
%ptr = alloca i32*, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i32 %value, i32* %3, align 4
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = inttoptr i32 %4 to i32*
|
||||
store i32* %5, i32** %ptr, align 4
|
||||
%6 = load i32* %3, align 4
|
||||
%7 = load i32** %ptr, align 4
|
||||
%8 = load i32* %2, align 4
|
||||
%9 = getelementptr inbounds i32* %7, i32 %8
|
||||
store i32 %6, i32* %9, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #2 = { nobuiltin }
|
||||
@@ -1,12 +0,0 @@
|
||||
; ModuleID = 'assert_arm.c'
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv7m-none--eabi"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.assert_c(i1 %value) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %value, i1* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
@@ -1,136 +0,0 @@
|
||||
; ModuleID = 'console_arm.c'
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv7m-none--eabi"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_int(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_long(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_byte(i8 zeroext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_short(i16 signext %message) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %message, i16* %1, align 2
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_char(i8 zeroext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_boolean(i1 %message) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %message, i1* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_float(float %message) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %message, float* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_double(double %message) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %message, double* %1, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_print_string(i8* %message) #0 {
|
||||
%1 = alloca i8*, align 4
|
||||
store i8* %message, i8** %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_int(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_long(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_byte(i8 zeroext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_short(i16 signext %message) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %message, i16* %1, align 2
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_char(i8 zeroext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_boolean(i1 %message) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %message, i1* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_float(float %message) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %message, float* %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_double(double %message) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %message, double* %1, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println_string(i8* %message) #0 {
|
||||
%1 = alloca i8*, align 4
|
||||
store i8* %message, i8** %1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define weak void @kotlin.kotlinclib_println() #0 {
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
@@ -1,419 +0,0 @@
|
||||
; ModuleID = 'primitives.c'
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||
target triple = "thumbv7m-none--eabi"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_intToByte(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_intToChar(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_intToShort(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_intToLong(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
ret i32 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_intToFloat(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_intToDouble(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_byteToChar(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_byteToShort(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_byteToInt(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_byteToLong(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_byteToFloat(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = uitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_byteToDouble(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = uitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_charToByte(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_charToShort(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_charToInt(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_charToLong(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = zext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_charToFloat(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = uitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_charToDouble(i8 zeroext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = uitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_shortToByte(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_shortToChar(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_shortToInt(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_shortToLong(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_shortToFloat(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_shortToDouble(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_longToByte(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_longToChar(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_longToShort(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_longToInt(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
ret i32 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_longToFloat(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_longToDouble(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_floatToByte(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptoui float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_floatToChar(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptoui float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_floatToShort(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_floatToInt(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_floatToLong(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define double @kotlin.kotlinclib_floatToDouble(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fpext float %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_doubleToByte(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptoui double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define zeroext i8 @kotlin.kotlinclib_doubleToChar(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptoui double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define signext i16 @kotlin.kotlinclib_doubleToShort(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_doubleToInt(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_doubleToLong(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define float @kotlin.kotlinclib_doubleToFloat(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptrunc double %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_int_size() #0 {
|
||||
ret i32 4
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_long_size() #0 {
|
||||
ret i32 4
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_boolean_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_short_size() #0 {
|
||||
ret i32 2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_double_size() #0 {
|
||||
ret i32 8
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_float_size() #0 {
|
||||
ret i32 4
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_char_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @kotlin.kotlinclib_byte_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
@@ -1,176 +0,0 @@
|
||||
; ModuleID = 'array.c'
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
declare i8* @malloc_heap(i32) #1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak i32 @kotlin.malloc_array(i32 %x) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %x, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = call i8* @malloc_heap(i32 %2)
|
||||
%4 = ptrtoint i8* %3 to i32
|
||||
ret i32 %4
|
||||
}
|
||||
|
||||
declare i8* @malloc(i32) #1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak signext i8 @kotlin.kotlinclib_get_byte(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = sext i32 %3 to i64
|
||||
%5 = inttoptr i64 %4 to i8*
|
||||
%6 = load i32* %2, align 4
|
||||
%7 = sext i32 %6 to i64
|
||||
%8 = getelementptr inbounds i8* %5, i64 %7
|
||||
%9 = load i8* %8, align 1
|
||||
ret i8 %9
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_set_byte(i32 %data, i32 %index, i8 signext %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i8, align 1
|
||||
%ptr = alloca i8*, align 8
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i8 %value, i8* %3, align 1
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = sext i32 %4 to i64
|
||||
%6 = inttoptr i64 %5 to i8*
|
||||
store i8* %6, i8** %ptr, align 8
|
||||
%7 = load i8* %3, align 1
|
||||
%8 = load i8** %ptr, align 8
|
||||
%9 = load i32* %2, align 4
|
||||
%10 = sext i32 %9 to i64
|
||||
%11 = getelementptr inbounds i8* %8, i64 %10
|
||||
store i8 %7, i8* %11, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak i32 @kotlin.kotlinclib_get_int(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = sext i32 %3 to i64
|
||||
%5 = inttoptr i64 %4 to i32*
|
||||
%6 = load i32* %2, align 4
|
||||
%7 = sext i32 %6 to i64
|
||||
%8 = getelementptr inbounds i32* %5, i64 %7
|
||||
%9 = load i32* %8, align 4
|
||||
ret i32 %9
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_set_int(i32 %data, i32 %index, i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i32, align 4
|
||||
%ptr = alloca i32*, align 8
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i32 %value, i32* %3, align 4
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = sext i32 %4 to i64
|
||||
%6 = inttoptr i64 %5 to i32*
|
||||
store i32* %6, i32** %ptr, align 8
|
||||
%7 = load i32* %3, align 4
|
||||
%8 = load i32** %ptr, align 8
|
||||
%9 = load i32* %2, align 4
|
||||
%10 = sext i32 %9 to i64
|
||||
%11 = getelementptr inbounds i32* %8, i64 %10
|
||||
store i32 %7, i32* %11, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak signext i16 @kotlin.kotlinclib_get_short(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = sext i32 %3 to i64
|
||||
%5 = inttoptr i64 %4 to i16*
|
||||
%6 = load i32* %2, align 4
|
||||
%7 = sext i32 %6 to i64
|
||||
%8 = getelementptr inbounds i16* %5, i64 %7
|
||||
%9 = load i16* %8, align 2
|
||||
ret i16 %9
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_set_short(i32 %data, i32 %index, i16 signext %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i16, align 2
|
||||
%ptr = alloca i16*, align 8
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i16 %value, i16* %3, align 2
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = sext i32 %4 to i64
|
||||
%6 = inttoptr i64 %5 to i16*
|
||||
store i16* %6, i16** %ptr, align 8
|
||||
%7 = load i16* %3, align 2
|
||||
%8 = load i16** %ptr, align 8
|
||||
%9 = load i32* %2, align 4
|
||||
%10 = sext i32 %9 to i64
|
||||
%11 = getelementptr inbounds i16* %8, i64 %10
|
||||
store i16 %7, i16* %11, align 2
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak i64 @kotlin.kotlinclib_get_long(i32 %data, i32 %index) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
%3 = load i32* %1, align 4
|
||||
%4 = sext i32 %3 to i64
|
||||
%5 = inttoptr i64 %4 to i64*
|
||||
%6 = load i32* %2, align 4
|
||||
%7 = sext i32 %6 to i64
|
||||
%8 = getelementptr inbounds i64* %5, i64 %7
|
||||
%9 = load i64* %8, align 8
|
||||
ret i64 %9
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_set_long(i32 %data, i32 %index, i64 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i64, align 8
|
||||
%ptr = alloca i64*, align 8
|
||||
store i32 %data, i32* %1, align 4
|
||||
store i32 %index, i32* %2, align 4
|
||||
store i64 %value, i64* %3, align 8
|
||||
%4 = load i32* %1, align 4
|
||||
%5 = sext i32 %4 to i64
|
||||
%6 = inttoptr i64 %5 to i64*
|
||||
store i64* %6, i64** %ptr, align 8
|
||||
%7 = load i64* %3, align 8
|
||||
%8 = load i64** %ptr, align 8
|
||||
%9 = load i32* %2, align 4
|
||||
%10 = sext i32 %9 to i64
|
||||
%11 = getelementptr inbounds i64* %8, i64 %10
|
||||
store i64 %7, i64* %11, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
!llvm.ident = !{!0}
|
||||
|
||||
!0 = !{!"Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2)"}
|
||||
@@ -1,36 +0,0 @@
|
||||
; ModuleID = 'assert_x86.c'
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
@.str = private unnamed_addr constant [71 x i8] c"Exception in thread \22main\22 java.lang.AssertionError: Assertion failed\0A\00", align 1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.assert_c(i1 %value) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %value, i1* %1, align 4
|
||||
%2 = load i1* %1, align 4
|
||||
%3 = icmp ne i1 %2, 0
|
||||
br i1 %3, label %6, label %4
|
||||
|
||||
; <label>:4 ; preds = %0
|
||||
%5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([71 x i8]* @.str, i32 0, i32 0))
|
||||
call void @abort() #3
|
||||
unreachable
|
||||
|
||||
; <label>:6 ; preds = %0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i32 @printf(i8*, ...) #1
|
||||
|
||||
; Function Attrs: noreturn nounwind
|
||||
declare void @abort() #2
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #2 = { noreturn nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #3 = { noreturn nounwind }
|
||||
|
||||
!llvm.ident = !{!0}
|
||||
|
||||
!0 = !{!"Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2)"}
|
||||
@@ -1,213 +0,0 @@
|
||||
; ModuleID = 'console.c'
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
|
||||
@.str1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
|
||||
@.str2 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
|
||||
@.str3 = private unnamed_addr constant [6 x i8] c"false\00", align 1
|
||||
@.str4 = private unnamed_addr constant [5 x i8] c"true\00", align 1
|
||||
@.str5 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
|
||||
@.str6 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
|
||||
@.str7 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_int(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i32 @printf(i8*, ...) #1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_long(i64 %message) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %message, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), i64 %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_byte(i8 signext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
%4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_short(i16 signext %message) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %message, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i32
|
||||
%4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_char(i8 signext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
%4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0), i32 %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_boolean(i1 %message) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %message, i1* %1, align 4
|
||||
%2 = load i1* %1, align 4
|
||||
%3 = icmp eq i1 %2, 0
|
||||
br i1 %3, label %4, label %6
|
||||
|
||||
; <label>:4 ; preds = %0
|
||||
%5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str3, i32 0, i32 0))
|
||||
br label %8
|
||||
|
||||
; <label>:6 ; preds = %0
|
||||
%7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str4, i32 0, i32 0))
|
||||
br label %8
|
||||
|
||||
; <label>:8 ; preds = %6, %4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_float(float %message) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %message, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fpext float %2 to double
|
||||
%4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str5, i32 0, i32 0), double %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_double(double %message) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %message, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str6, i32 0, i32 0), double %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_print_string(i8* %message) #0 {
|
||||
%1 = alloca i8*, align 8
|
||||
store i8* %message, i8** %1, align 8
|
||||
%2 = load i8** %1, align 8
|
||||
%3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str7, i32 0, i32 0), i8* %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println() #0 {
|
||||
call void @kotlin.kotlinclib_print_char(i8 signext 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_int(i32 %message) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %message, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
call void @kotlin.kotlinclib_print_int(i32 %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_long(i64 %message) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %message, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
call void @kotlin.kotlinclib_print_long(i64 %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_byte(i8 signext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
call void @kotlin.kotlinclib_print_byte(i8 signext %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_short(i16 signext %message) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %message, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
call void @kotlin.kotlinclib_print_short(i16 signext %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_char(i8 signext %message) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %message, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
call void @kotlin.kotlinclib_print_char(i8 signext %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_boolean(i1 %message) #0 {
|
||||
%1 = alloca i1, align 4
|
||||
store i1 %message, i1* %1, align 4
|
||||
%2 = load i1* %1, align 4
|
||||
call void @kotlin.kotlinclib_print_boolean(i1 %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_float(float %message) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %message, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
call void @kotlin.kotlinclib_print_float(float %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_double(double %message) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %message, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
call void @kotlin.kotlinclib_print_double(double %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak void @kotlin.kotlinclib_println_string(i8* %message) #0 {
|
||||
%1 = alloca i8*, align 8
|
||||
store i8* %message, i8** %1, align 8
|
||||
%2 = load i8** %1, align 8
|
||||
call void @kotlin.kotlinclib_print_string(i8* %2)
|
||||
call void @kotlin.kotlinclib_println()
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
!llvm.ident = !{!0}
|
||||
|
||||
!0 = !{!"Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2)"}
|
||||
@@ -1,425 +0,0 @@
|
||||
; ModuleID = 'primitives.c'
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-pc-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_intToByte(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_intToChar(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_intToShort(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = trunc i32 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_intToLong(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sext i32 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_intToFloat(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_intToDouble(i32 %value) #0 {
|
||||
%1 = alloca i32, align 4
|
||||
store i32 %value, i32* %1, align 4
|
||||
%2 = load i32* %1, align 4
|
||||
%3 = sitofp i32 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_byteToChar(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_byteToShort(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_byteToInt(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_byteToLong(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_byteToFloat(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_byteToDouble(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_charToByte(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_charToShort(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_charToInt(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_charToLong(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sext i8 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_charToFloat(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_charToDouble(i8 signext %value) #0 {
|
||||
%1 = alloca i8, align 1
|
||||
store i8 %value, i8* %1, align 1
|
||||
%2 = load i8* %1, align 1
|
||||
%3 = sitofp i8 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_shortToByte(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_shortToChar(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = trunc i16 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_shortToInt(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_shortToLong(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sext i16 %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_shortToFloat(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_shortToDouble(i16 signext %value) #0 {
|
||||
%1 = alloca i16, align 2
|
||||
store i16 %value, i16* %1, align 2
|
||||
%2 = load i16* %1, align 2
|
||||
%3 = sitofp i16 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_longToByte(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_longToChar(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_longToShort(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_longToInt(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = trunc i64 %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_longToFloat(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = sitofp i64 %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_longToDouble(i64 %value) #0 {
|
||||
%1 = alloca i64, align 8
|
||||
store i64 %value, i64* %1, align 8
|
||||
%2 = load i64* %1, align 8
|
||||
%3 = sitofp i64 %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_floatToByte(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_floatToChar(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_floatToShort(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_floatToInt(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_floatToLong(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fptosi float %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define double @kotlin.kotlinclib_floatToDouble(float %value) #0 {
|
||||
%1 = alloca float, align 4
|
||||
store float %value, float* %1, align 4
|
||||
%2 = load float* %1, align 4
|
||||
%3 = fpext float %2 to double
|
||||
ret double %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_doubleToByte(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i8 @kotlin.kotlinclib_doubleToChar(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i8
|
||||
ret i8 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define signext i16 @kotlin.kotlinclib_doubleToShort(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i16
|
||||
ret i16 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_doubleToInt(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i32
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i64 @kotlin.kotlinclib_doubleToLong(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptosi double %2 to i64
|
||||
ret i64 %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define float @kotlin.kotlinclib_doubleToFloat(double %value) #0 {
|
||||
%1 = alloca double, align 8
|
||||
store double %value, double* %1, align 8
|
||||
%2 = load double* %1, align 8
|
||||
%3 = fptrunc double %2 to float
|
||||
ret float %3
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_int_size() #0 {
|
||||
ret i32 4
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_long_size() #0 {
|
||||
ret i32 8
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_boolean_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_short_size() #0 {
|
||||
ret i32 2
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_double_size() #0 {
|
||||
ret i32 8
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_float_size() #0 {
|
||||
ret i32 4
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_char_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @kotlin.kotlinclib_byte_size() #0 {
|
||||
ret i32 1
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
!llvm.ident = !{!0}
|
||||
|
||||
!0 = !{!"Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2)"}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifdef ARM
|
||||
|
||||
|
||||
int printf(const char *__fmt, ...) __attribute__((weak)){
|
||||
/*
|
||||
* We dont have support output on ARM.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
+35
-10
@@ -1,32 +1,57 @@
|
||||
extern char *malloc(int size);
|
||||
extern char* malloc_heap(int size) __attribute__((weak));
|
||||
|
||||
int malloc_array(int x) {
|
||||
return (int) malloc(x);
|
||||
int malloc_array(int x) __attribute__((weak)){
|
||||
return (int) malloc_heap(x);
|
||||
}
|
||||
|
||||
char kotlinclib_get_byte(int data, int index) {
|
||||
char kotlinclib_byte_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return *((char *) data + index);
|
||||
}
|
||||
|
||||
void kotlinclib_set_byte(int data, int index, char value) {
|
||||
void kotlinclib_byte_array_set_ix(int data, int index, char value) __attribute__((weak)){
|
||||
char *ptr = (char *) data;
|
||||
*(ptr + index) = value;
|
||||
}
|
||||
|
||||
int kotlinclib_get_int(int data, int index) {
|
||||
char kotlinclib_boolean_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return kotlinclib_byte_array_get_ix(data, index);
|
||||
}
|
||||
|
||||
void kotlinclib_boolean_array_set_ix(int data, int index, char value) __attribute__((weak)){
|
||||
kotlinclib_byte_array_set_ix(data, index, value);
|
||||
}
|
||||
|
||||
char kotlinclib_char_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return kotlinclib_char_array_get_ix(data, index);
|
||||
}
|
||||
|
||||
void kotlinclib_char_array_set_ix(int data, int index, char value) __attribute__((weak)){
|
||||
kotlinclib_char_array_set_ix(data, index, value);
|
||||
}
|
||||
|
||||
int kotlinclib_int_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return *((int *) data + index);
|
||||
}
|
||||
|
||||
void kotlinclib_set_int(int data, int index, int value) {
|
||||
void kotlinclib_int_array_set_ix(int data, int index, int value) __attribute__((weak)){
|
||||
int *ptr = (int *) data;
|
||||
*(ptr + index) = value;
|
||||
}
|
||||
|
||||
short kotlinclib_get_short(int data, int index) {
|
||||
short kotlinclib_short_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return *((short *) data + index);
|
||||
}
|
||||
|
||||
void kotlinclib_set_short(int data, int index, short value) {
|
||||
void kotlinclib_short_array_set_ix(int data, int index, short value) __attribute__((weak)){
|
||||
short *ptr = (short *) data;
|
||||
*(ptr + index) = value;
|
||||
}
|
||||
}
|
||||
|
||||
long long kotlinclib_long_array_get_ix(int data, int index) __attribute__((weak)){
|
||||
return *((long long *) data + index);
|
||||
}
|
||||
|
||||
void kotlinclib_long_array_set_ix(int data, int index, long long value) __attribute__((weak)){
|
||||
long long *ptr = (long long *) data;
|
||||
*(ptr + index) = value;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void assert_c(int value) {
|
||||
if (!value) {
|
||||
printf("Exception in thread \"main\" java.lang.AssertionError: Assertion failed\n");
|
||||
abort();
|
||||
}
|
||||
void assert_c( value) __attribute__((weak)){
|
||||
#ifndef ARM
|
||||
if (!value) {
|
||||
printf("Exception in thread \"main\" java.lang.AssertionError: Assertion failed\n");
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void kotlinclib_print_int(int message) {
|
||||
printf("%d", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_long(long long message) {
|
||||
printf("%lld", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_byte(char message) {
|
||||
printf("%d", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_short(short message) {
|
||||
printf("%d", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_char(char message) {
|
||||
printf("%c", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_boolean(int message) {
|
||||
if (message == 0) {
|
||||
printf("false");
|
||||
}
|
||||
else {
|
||||
printf("true");
|
||||
}
|
||||
}
|
||||
|
||||
void kotlinclib_print_float(float message) {
|
||||
printf("%f", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_double(double message) {
|
||||
printf("%lf", message);
|
||||
}
|
||||
|
||||
void kotlinclib_print_string(char *message) {
|
||||
printf("%s", message);
|
||||
}
|
||||
|
||||
|
||||
void kotlinclib_println() {
|
||||
kotlinclib_print_char('\n');
|
||||
}
|
||||
|
||||
void kotlinclib_println_int(int message) {
|
||||
kotlinclib_print_int(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_long(long long message) {
|
||||
kotlinclib_print_long(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_byte(char message) {
|
||||
kotlinclib_print_byte(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_short(short message) {
|
||||
kotlinclib_print_short(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_char(char message) {
|
||||
kotlinclib_print_char(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_boolean(int message) {
|
||||
kotlinclib_print_boolean(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_float(float message) {
|
||||
kotlinclib_print_float(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_double(double message) {
|
||||
kotlinclib_print_double(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
|
||||
void kotlinclib_println_string(char *message) {
|
||||
kotlinclib_print_string(message);
|
||||
kotlinclib_println();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#define MAKE_CONVERT(from, from_type, to, to_type) to_type kotlinclib_ ## from ## To ## to ( from_type value ) { return (to_type) value;}
|
||||
#define MAKE_CONVERT(from, from_type, to, to_type) to_type kotlinclib_ ## from ## To ## to ( from_type value ) __attribute__(( weak)) { return (to_type) value;}
|
||||
|
||||
|
||||
MAKE_CONVERT(int, int, Byte, char)
|
||||
@@ -54,4 +54,37 @@ MAKE_CONVERT(double, double, Char, char)
|
||||
MAKE_CONVERT(double, double, Short, short)
|
||||
MAKE_CONVERT(double, double, Int, int)
|
||||
MAKE_CONVERT(double, double, Long, long)
|
||||
MAKE_CONVERT(double, double, Float, float)
|
||||
MAKE_CONVERT(double, double, Float, float)
|
||||
|
||||
|
||||
int kotlinclib_int_size() __attribute__((weak)){
|
||||
return sizeof (int);
|
||||
}
|
||||
|
||||
int kotlinclib_long_size() __attribute__((weak)){
|
||||
return sizeof (long long);
|
||||
}
|
||||
|
||||
int kotlinclib_boolean_size() __attribute__((weak)){
|
||||
return sizeof (char);
|
||||
}
|
||||
|
||||
int kotlinclib_short_size() __attribute__((weak)){
|
||||
return sizeof (short);
|
||||
}
|
||||
|
||||
int kotlinclib_double_size() __attribute__((weak)){
|
||||
return sizeof (double);
|
||||
}
|
||||
|
||||
int kotlinclib_float_size() __attribute__((weak)){
|
||||
return sizeof (float);
|
||||
}
|
||||
|
||||
int kotlinclib_char_size() __attribute__((weak)){
|
||||
return sizeof (char);
|
||||
}
|
||||
|
||||
int kotlinclib_byte_size() __attribute__((weak)){
|
||||
return sizeof (char);
|
||||
}
|
||||
@@ -544,17 +544,18 @@ abstract class BlockCodegen(val state: TranslationState,
|
||||
|
||||
val functionDescriptor = resolvedCall!!.candidateDescriptor
|
||||
val targetFunctionName = functionDescriptor.fqNameSafe.convertToNativeName()
|
||||
val externalFunctionName = functionDescriptor.name.asString()
|
||||
val arguments = resolvedCall.valueArguments.toSortedMap(compareBy { it.index }).values
|
||||
|
||||
val external = state.externalFunctions.containsKey(targetFunctionName)
|
||||
val external = state.externalFunctions.containsKey(externalFunctionName)
|
||||
val functionArguments = functionDescriptor.valueParameters.map { it -> it.type }.map { LLVMMapStandardType(it, state) }
|
||||
val function = "$targetFunctionName${if (!external) LLVMType.mangleFunctionTypes(functionArguments) else ""}"
|
||||
|
||||
if (function in state.functions || function in state.externalFunctions) {
|
||||
val descriptor = state.functions[function] ?: state.externalFunctions[function]!!
|
||||
if (function in state.functions || externalFunctionName in state.externalFunctions) {
|
||||
val descriptor = state.functions[function] ?: state.externalFunctions[externalFunctionName]!!
|
||||
names = parseArgumentsWithDefaultValues(arguments, descriptor.defaultValues, scopeDepth)
|
||||
val args = codeBuilder.loadArgsIfRequired(names, descriptor.args)
|
||||
return evaluateFunctionCallExpression(LLVMVariable(function, descriptor.returnType!!.type, scope = LLVMVariableScope()), args)
|
||||
return evaluateFunctionCallExpression(LLVMVariable(descriptor.name, descriptor.returnType!!.type, scope = LLVMVariableScope()), args)
|
||||
}
|
||||
|
||||
if (targetFunctionName in state.classes || classScope?.structName == targetFunctionName) {
|
||||
|
||||
@@ -44,7 +44,7 @@ class FunctionCodegen(state: TranslationState,
|
||||
returnType!!.pointer = 2
|
||||
}
|
||||
external = descriptor.isExternal
|
||||
name = "${function.fqName}${if (!external) LLVMType.mangleFunctionArguments(args) else ""}"
|
||||
name = if (external) function.name!! else function.fqName!!.convertToNativeName() + LLVMType.mangleFunctionArguments(args)
|
||||
|
||||
if (isExtensionDeclaration) {
|
||||
name = "${function.name}${if (!external) LLVMType.mangleFunctionArguments(args) else ""}"
|
||||
|
||||
Reference in New Issue
Block a user