prakhar1989 / Study-Group

Learning CS and SE
1 stars 1 forks source link

LLVM #1

Open prakhar1989 opened 10 years ago

prakhar1989 commented 10 years ago

@pratikmallya: What is LLVM?

pratikmallya commented 10 years ago

At the very first glance, LLVM: L ow L evel V irtual M achine appears to be an infrastructure for writing compilers. You write a front-end compiler (I'm not sure that's the technically correct term) for a language, it compiles it down to an assembly like code, and then another compiler (back-end compiler?) translates that into machine-specific binary. Kinda reminds me of VM's and .NET, if this is how it really works. Why is it better than JVM or .NET? Is it because it allows one to hook up any language? What are the benefits/drawbacks of using LLVM? Can we use LLVM for Java or .NET languages? How easy is it to learn? All these questions pop up in my mind almost immediately :) This is what I know before reading a single word of the article. Will update as I read more.

pratikmallya commented 10 years ago

@prakhar1989 what is the difference between a 'static' compiler and a 'dynamic' one?

prakhar1989 commented 10 years ago

@pratikmallya Not sure what you mean by static and dynamic compiler. Are you referring to static vs dynamic compilation (like JIT)?

@liquidmetal Wanna chime in?

liquidmetal commented 10 years ago

It seems like the goal of LLVM is to provide a unified 'assembly language' for people to 'compile' to. Something that doesn't need to know about the hardware. This assembly (LLVM IR) can then be optimized and targeted to any platform.

Looking at some forums, the main advantage seems like LLVM lets you design languages without thinking about machine code. That leads to different type systems, inheritance strategies, threading optimizations, etc.

tl;dr: machine code generation / optimization: LLVM's problem. Language design: your problem.