Created
July 5, 2022 07:35
-
-
Save austin362667/3d51997ddf561edd4bf387d9cc3dd086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; source file: prog/hello.s1 | |
| ; External declaration of the puts function | |
| declare void @puts(i8* nocapture) nounwind | |
| ; Declare the string constant as a global constant. | |
| @name = internal constant [8 x i8] c"script1\00" | |
| ; Definition of main function | |
| define void @main(i32 %argc, i8** %argv) { | |
| ; Convert [13 x i8]* to i8 *... in local | |
| ; [FYR:getelementptr](https://llvm.org/docs/GetElementPtr.html) | |
| %name_cast = getelementptr [8 x i8], [8 x i8]* @name, i64 0, i64 0 | |
| ; Call puts function to write out the string to stdout. | |
| call void @puts(i8* %name_cast); | |
| ret void | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment