Questions tagged [llvm]

LLVM is a compiler infrastructure written in C++ that is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages.

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.

16 questions
26
votes
4 answers

GCC vs clang/LLVM -- pros and cons of each

What are the pros and cons of GCC vs clang/LLVM?
yodie
  • 694
  • 1
  • 7
  • 12
22
votes
3 answers

How to run C++ code in browser using asm.js?

An asm.js application is very fast (near native C++ speed): http://kripken.github.io/mloc_emscripten_talk/micro4b.png But how is it possible to write one in C++, convert it to LLVM code, then do some trick with emscripten/asm.js ? I haven't found…
LO kaka
  • 259
  • 1
  • 2
  • 3
18
votes
1 answer

Why does LLVM have an assembly-like IR rather than a tree-like IR? Or: why do projects target LLVM IR instead of clang's AST?

Why is LLVM's intermediate representation (LLVM IR) assembly-like rather than tree-like? Alternatively, why do language implementations target LLVM IR rather than clang's AST? I'm not trying to ask two different questions at once if it seems that…
Praxeolitic
  • 1,604
  • 3
  • 15
  • 24
12
votes
4 answers

In what way(s) is LLVM Low Level?

In what way(s) is LLVM (Low Level Virtual Machine) Low Level? (At the time of writing, I did not find this expansion of the abbreviation "LLVM" on its web site, but on Wikipedia.) Is it called "Low Level" in what is it designed for (a compiler…
Abbafei
  • 821
  • 6
  • 17
10
votes
1 answer

Machine code JITs and the Execution Disable bit

How is runtime-generated machine-code (such as the output of a JIT), actually executed by the CPU if the CPU/OS has an Execution Disable bit? As far as I know, many modern processors and Operating Systems include support for an NX bit, (including…
Siler
  • 421
  • 3
  • 11
9
votes
3 answers

Is Clang/LLVM ready for prime time?

Clang is able to be used instead of gcc? What your experience on that? What disadvantages there are yet? Performance of compilation is very better than gcc but about performance of code generated when executing it? Are there good tools as front-end…
Maniero
  • 10,826
  • 14
  • 80
  • 133
7
votes
4 answers

Reason to use mingw win32 headers and libs with LLVM/Clang

Is there any good reason (except "GCC is better") to use the MinGW win32api/headers/libs with LLVM/Clang. Suppose that in two to three years, Clang has matured enough (in C++0x and performance) that it's a competitor/replacement and has its…
rubenvb
  • 580
  • 5
  • 15
4
votes
1 answer

How do I add link-time optimization capabilities to my LLVM-based compiler?

I am designing and implementing a programming language, and I am using LLVM for native code generation. Among others, performance is a key feature of the language, and as such, I am looking to implementing link-time optimization. On the official…
H2CO3
  • 437
  • 2
  • 10
3
votes
4 answers

GCC or Clang to output bytecode for a VM?

Long story short, I wanted to use C as a scripting language and in a portable manner so I created a register-based, JITless VM to accomplish this. I've formalized the VM's ISA, script file format, calling conventions, and even created an assembler…
Nergal
  • 313
  • 2
  • 12
3
votes
2 answers

Learning YACC nowadays, does it make sense?

I have a huge project that is using YACC and I would need to fix a bug in it. I might ask someone else who wrote that to fix it but I'm interested in how compilers work. Does it make sense to learn YACC nowadays? It was told me that it's old and…
Makane Elhay
  • 209
  • 3
  • 7
1
vote
1 answer

Is it feasible to write an IR-to-assembly compiler as opposed to an LLVM backend?

I've made a virtual processor with a simple instruction set and memory model as a learning exercise (and mostly just for fun). I can write programs in its assembly language, assemble them with my assembler, and successfully run them on a virtual…
Celarix
  • 139
  • 6
1
vote
1 answer

LLVM case: is the success due to the algorithms?

I'm not sure if this is a subjective question, I hope not but I'm not proficient with LLVM so I'm just wondering: how come it's become so popular and so widespread used in the industry? Were the optimization algorithms used in gcc/icc/msvc just…
user122592
  • 19
  • 1
0
votes
1 answer

Implementing heap-allocated closures in LLVM

I'm writing my own F#-esque language and I'm using LLVM for code generation. I want my language to support continuation passing style and I think I've got TCO figured out but I cannot figure out how to make continuations use heap memory instead of…
Gabriel
  • 11
  • 2
0
votes
1 answer

Clang compiler is unstable for me, backtrace msg asks me to open a GitHub issue. How often should I post my issue?

This question is about how to be a good citizen in an open source community, and do my part to effectively participate, to advance the project/not harass people. I am building a medium-sized C++ project at work. My toolchain is the Clang with LLVM…
cs-
  • 111
  • 2
0
votes
2 answers

How does the LLVM compiler treat arithmetic operations in parentheses?

When it sees the parentheses, does it have the machine do the operations in the parentheses first, or does it distribute out the parentheses? Like, if I have the following line of code: int i = 2 * (a + b) does it compile like this code: int c = a…
moonman239
  • 2,023
  • 4
  • 18
  • 23
1
2