Skip to content

Commit 2dcf0f2

Browse files
committed
Feature(runtime-test): Initial, small programm for sandboxing
1 parent 5a2e4f3 commit 2dcf0f2

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

runtime-test/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
project(runtime_test)
3+
4+
set(CMAKE_CXX_STANDARD 14)
5+
6+
#link_directories("/Users/ovr/projects/ovr/hlvm/runtime")
7+
find_library(hlvm-runtime "/Users/ovr/projects/ovr/hlvm/runtime")
8+
9+
10+
11+
link_directories("/Users/ovr/projects/ovr/hlvm/runtime")
12+
find_library(hlvm-runtime "/Users/ovr/projects/ovr/hlvm/runtime")
13+
14+
add_executable(main.cpp)
15+
16+
#
17+
#link_libraries("/Users/ovr/projects/ovr/hlvm/runtime")
18+
19+
20+
target_link_libraries(runtime_test hlvm-runtime)

runtime-test/main.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <iostream>
2+
#include "../runtime/helpers.h"
3+
4+
int main() {
5+
const char* str = number2string(5);
6+
puts("Hello");
7+
puts(str);
8+
9+
return 0;
10+
}

runtime-test/main.ll

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; ModuleID = 'main.cpp'
2+
source_filename = "main.cpp"
3+
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4+
target triple = "x86_64-apple-macosx10.14.0"
5+
6+
; Function Attrs: noinline norecurse optnone ssp uwtable
7+
define i32 @main() #0 {
8+
%1 = alloca i32, align 4
9+
%2 = alloca i8*, align 8
10+
store i32 0, i32* %1, align 4
11+
%3 = call i8* @_Z13number2stringd(double 5.000000e+00)
12+
store i8* %3, i8** %2, align 8
13+
%4 = load i8*, i8** %2, align 8
14+
%5 = call i32 @puts(i8* %4)
15+
ret i32 0
16+
}
17+
18+
declare i8* @_Z13number2stringd(double) #1
19+
20+
declare i32 @puts(i8*) #1
21+
22+
attributes #0 = { noinline norecurse optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
23+
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
24+
25+
!llvm.module.flags = !{!0, !1}
26+
!llvm.ident = !{!2}
27+
28+
!0 = !{i32 1, !"wchar_size", i32 4}
29+
!1 = !{i32 7, !"PIC Level", i32 2}
30+
!2 = !{!"clang version 7.0.0 (tags/RELEASE_700/final)"}

0 commit comments

Comments
 (0)