How can I take a look at the intermediate files generated by the compiler?

Whenever you compile C/C++ files, so-called preprocessed intermediate files are generated that are normally stored in a temporary directory and deleted after completion of the compiling process. For a source.c file, the intermediate compilation results are source.i (preprocessed source), source.bc (LLVM bitcode), source.s (compiled file), and source.o (assembled file). These files can be preserved if the option -save-temps is set.

-save-temps writes the temporary files to the current directory and does not delete them on exit. This option can also take an argument: the -save-temps=obj switch will write files into the directory specified with the -o option. If the -o option is not used, the -save-temps=obj switch behaves like -save-temps.

Example

clang -march=<arch> -save-temps -c test.c

Generates: test.s, test.i, test.bc, and test.o.

clang -march=<arch> -save-temps=obj -c test.c

Generates: test.s, test.i, test.bc, and test.o.

clang -march=<arch> -save-temps=obj -o <dir>/<name>.o -c test.c

Generates: test.s, test.i, test.bc, <name>.o and puts it into <dir>.

clang -march=tc162 -save-temps=obj -o <dir>/<name> test.c

Generates: test.s, test.i, test.bc, test.o, <name> executable, and puts it into <dir>.

You can use the object dumper to generate disassembly: llvm-objdump -d test.elf. Where -d is Alias for --disassemble. For a list of options, call llvm-objdump.exe.