[llvm-dev] The doubt to LLVM.org-How to add the new type?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 5 20:31:17 PDT 2017


Hi,

On 5 July 2017 at 19:51, To be a better me via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> So far, I still have two questions. The first is: I am not clear the LLVM /
> CLANG operating mechanism .can you send me some relevant information?

I don't think this is a coherent question. If you're asking how LLVM
and Clang work you're going to have to be a lot more directed. We
could write a hundred articles and we'd miss important details.

In the very broadest outline Clang parses C, C++ and related languages
and produces LLVM IR (look for files ending in .ll in the LLVM
sources). The bulk of LLVM itself is dedicated to optimizing this IR
and converting it into CPU-specific assembly and object files.

> The
> official description of the CLANG is equivalent to the front, like lexical
> analysis and parsing. LLVM is equivalent to the back-end, mainly
> intermediate code generation and optimization. I now want to add a
> recognition to new type , should be in the LLVM or the CLANG to add the
> relevant code?

If the new type is for C or C++ the chances are you only need to
modify Clang. You can usually decide on a roughly equivalent LLVM type
(maybe a struct or something) and emit all the necessary IR to handle
it from Clang.

Certain really odd ideas might need LLVM changes too: the most recent
one I know of is ARM's proposal for vectors that have a size that's
only known at runtime.

Cheers.

Tim.


More information about the llvm-dev mailing list