I'm trying LLVM and hitting some walls, like this one. When I compile and run the piece of code below, instead of getting the current year, I'm getting the day of the week:
target datalayout = "e"
declare dllimport x86_stdcallcc void @GetLocalTime(%SYSTEMTIME*)
%SYSTEMTIME = type {
i16, ; wYear
i16, ; wMonth
i16, ; wDayOfWeek
i16, ; wDay
i16, ; wHour
i16, ; wMinute
i16, ; wSecond
i16 ; wMilliseconds
}
define i32 @main() {
%now = alloca %SYSTEMTIME
call void @GetLocalTime(%SYSTEMTIME* %now)
%ptr = getelementptr %SYSTEMTIME* %now, %i32 0, %i32 0
%day = load i16* %ptr
%int = zext i16 %day to i32
ret i32 %int
}
Please note that I'm not writing C or C++ code, I'm writing the code above as it is. Can someone point me out what I'm doing wrong? All members of SYSTEMTIME seems to be off by 2 positions...