Lab 03
Finding your endianness
Download the endian.c file to your computer.
Compile it with clang -Wall endian.c
.
Now pick a three letter word and look up the hexadecimal values in the ASCII table (along with the newline character).
Create the proper 4-byte int to create that string.
What is the endianness of your computer???
Introduction to LLVM virtual assembly
Now we’re going to generate the virtual assembly instructions from that file.
You can do this with clang -Wall -emit-llvm -S endian.c
.
This will generate a file named endian.ll
.
Repeat part 1 by modifying the endian.ll
file, but this time make it work for 64 bit values (i.e., 8-bytes worth of data).
You can re-build it from the endian.ll
file by issuing the command clang -Wall endian.ll
.
You may also need to modify the file to remove any extraneous “metadata” from the bottom of the file.
Exploring LLVM
Try to add a loop in the endian.ll
file.
If you can’t, you may do it with C although you must generate the resulting .ll
file as above.