Open sdh21 opened 3 years ago
test-async-1.ll里面createString是这样用的:
%msg1_str_ptr = getelementptr inbounds [14 x i8], [14 x i8]* @.str.msg.1, i64 0, i64 0
%arg5_inner_str = call i8* @CreateString(i8* %msg1_str_ptr)
下面这样可以接受吗
%arg5_inner_str = call i8* @CreateString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.msg.1, i64 0, i64 0))
test-async-1.ll里面createString是这样用的:
%msg1_str_ptr = getelementptr inbounds [14 x i8], [14 x i8]* @.str.msg.1, i64 0, i64 0 %arg5_inner_str = call i8* @CreateString(i8* %msg1_str_ptr)
下面这样可以接受吗
%arg5_inner_str = call i8* @CreateString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.msg.1, i64 0, i64 0))
可以,两者应该是等价的 一般来说能通过llvm编译,就没问题
Updated 2021/4/11
Async library 的导出函数:
String 相关
(2) declare dso_local i8 @CreateEmptyString() ; Returns an empty Digo String object (3) declare dso_local i8 @AddString(i8, i8) ; concat(Digo String A + Digo String B) declare dso_local i8 @AddCString(i8, i8) ; the second parameter is a C-style string (4) declare dso_local i8 @CloneString(i8) ; Get a copy of Digo String (5) declare dso_local i8 @CompareString(i8 %strA, i8 %strB) ; Returns strcmp(strA, strB) (6) declare dso_local i64 @GetStringSize(i8) ; Returns strlen (7) declare dso_local i8 @GetCStr(i8*) ; Get C-style string
(1) declare dso_local i8* @CreateSlice(i64 %type) Returns an empty Digo Slice object with element type=%type
(2) declare dso_local i8 @SliceSlice(i8 %obj, i64 %begin, i64 %end) Returns a new Digo Slice object = obj[begin:end]
(3) declare dso_local i8 @SliceAppend(i8 %obj, ...)
Usage:
call i8 (i8, ...) @SliceAppend(obj, i8 %DigoString) 返回一个新的 Digo Slice Object,参数%DigoString必须是由CreateString或CreateEmptyString创建的Wrapped String i8 call i8 (i8, ...) @SliceAppend(obj, i64 %number) call i8 (i8, ...) @SliceAppend(obj, double %number) call i8 (i8, ...) @SliceAppend(obj, i8* %FutureObject)
(4) declare dso_local i8 @CloneSlice(i8)
(5) declare dso_local i64 @GetSliceSize(i8*)
%d => int, %s => string(obj), %x => future(obj), %f => double, %l => slice(obj)
declare dso_local i8 @CreateString(i8) declare dso_local i8 @CreateEmptyString() declare dso_local i8 @AddString(i8, i8) declare dso_local i8 @AddCString(i8, i8) declare dso_local i8 @CloneString(i8) declare dso_local i64 @CompareString(i8, i8) declare dso_local i64 @GetStringSize(i8) declare dso_local i8 @GetCStr(i8)
declare dso_local void @print(i8, ...) declare dso_local void @println(i8, ...)
declare dso_local i8 @CreateSlice(i64) declare dso_local i8 @SliceSlice(i8, i64, i64) declare dso_local i8 @SliceAppend(i8, ...) declare dso_local i8 @CloneSlice(i8) declare dso_local i64 @GetSliceSize(i8)
define double @SetSliceIndexDouble(i8 nocapture readonly, i64, double returned) define i8 @SetSliceIndexFuture(i8 nocapture readonly, i64, i8 returned) define i8 @SetSliceIndexString(i8 nocapture readonly, i64, i8 returned) define i64 @SetSliceIndexInt(i8 nocapture readonly, i64, i64 returned) define i64 @GetSliceSize(i8 nocapture readonly) define i8 @GetSliceIndexString(i8 nocapture readonly, i64) define i64 @GetSliceIndexInt(i8 nocapture readonly, i64) define double @GetSliceIndexDouble(i8* nocapture readonly, i64)
declare dso_local void @AwaitJob(i8*, i8*, i32) declare dso_local void @JobDecRef(i8) declare dso_local i8 @CreateAsyncJob(i32, i8, i32) declare dso_local i8 @CreateRemoteJob(i32, i8*, i32)
declare dso_local i8 @SW_CreateWrapper() declare dso_local void @SW_AddString(i8, i8) declare dso_local void @SW_AddInt32(i8, i32) declare dso_local void @SW_AddInt64(i8, i64) declare dso_local void @SW_AddDouble(i8, double) declare dso_local void @SW_AddSlice(i8, i8) declare dso_local void @SW_GetAndDestroy(i8*, i8*, i32)
declare dso_local i8 @SW_CreateExtractor(i8, i32) declare dso_local i32 @SW_ExtractInt32(i8) declare dso_local i64 @SW_ExtractInt64(i8) declare dso_local double @SW_ExtractDouble(i8) declare dso_local i8 @SW_ExtractString(i8) declare dso_local i8 @SW_ExtractSlice(i8) declare dso_local void @SW_DestroyExtractor(i8)
declare dso_local void @NoMatchExceptionHandler(i32 %func_id) declare dso_local void @ASYNC_AddFunction(i32, i8*)
declare dso_local i32 @entry(i32, i8**)
declare dso_local void @Debug_Real_LinkerCallFunction(i32, i32)