[LLVMdev] c-like language implementation using llvm

Sean Silva silvas at purdue.edu
Sun Feb 3 16:58:39 PST 2013


> Can I just utilize the i1 type? Is the
> i1 type already used for something, and thus might create a conflict?

I think you are very confused. LLVM's types are meant to be used to
represent *your* program :) They can't be "already used".

> 2) Can I use LLVM's intrinsic functions for my gates, something like
> @llvm.NOT(i1 %val)? Would the fact that the implementation of these external
> functions is not defined, create a problem in translation down to IR? I have
> used Clang's "built-ins" in the front-end and that seems to do the job at
> the parser level.

Again, I think you are confused. Just use the operations that are
built into LLVM, such as
<http://llvm.org/docs/LangRef.html#bitwise-binary-operations>. One
slight point of confusion is that LLVM tries to be minimal so there is
no NOT instruction; `NOT X` is represented as `XOR X, -1`. You
probably won't need to add an intrinsic unless you are doing something
_very_ exotic.

-- Sean Silva



More information about the llvm-dev mailing list