Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use LLVM-assembly directly?

I have read some webpages and articles about llvm and I am quite interested in this project. (Maybe to learn something about compiler writing without the need to struggle with the complicated points of x86).

There are pages that describe how to write llvm assembly and how to assemble it, but I did not find anything on what kind of environment is needed to actually execute these. I know that I could run llvm-gcc on my files to get an object file that is executable in a C-context. But in the case that I don't want to use the C runtime environmen (libc.so and friends), what is needed to run llvm code? Is there any documentation on that?

like image 801
fuz Avatar asked Oct 14 '11 20:10

fuz


People also ask

Does LLVM have an assembler?

DESCRIPTION. llvm-as is the LLVM assembler. It reads a file containing human-readable LLVM assembly language, translates it to LLVM bitcode, and writes the result into a file or to standard output.

Does LLVM compile to assembly?

The llc command compiles LLVM source inputs into assembly language for a specified architecture. The assembly language output can then be passed through a native assembler and linker to generate a native executable.

What is LLVM assembly code?

The LLVM code representation is designed to be used in three different forms: as an in-memory compiler IR, as an on-disk bitcode representation (suitable for fast loading by a Just-In-Time compiler), and as a human readable assembly language representation.

Is LLVM platform independent?

You can think of LLVM IR as a platform-independent assembly language with an infinite number of function local registers. When developing compilers there are huge benefits with compiling your source language to an intermediate representation (IR) 1 instead of compiling directly to a target architecture (e.g. x86).


1 Answers

There appears to be an LLVM assembler.

llvm-as is the LLVM assembler. It reads a file containing human-readable LLVM assembly language, translates it to LLVM bitcode, and writes the result into a file or to standard output.

like image 177
Kurt Stutsman Avatar answered Oct 14 '22 18:10

Kurt Stutsman