Is clang supporting llvm 2.6? - llvm

all. I am trying to use llvm-2.6 with clang-3.4 since I could not find clang for llvm-2.6.
Is clang-3.4 supporting llvm-2.6? Are there any issues known so far?
Any comments would be appreciated. Thanks.

The short answer is No.
The longer answer is: LLVM and Clang are being developed in-sync, and it's almost never possible to fully connect Clang version X to LLVM version Y with X != Y. The farther apart X and Y are, the harder it is. For 2.6/3.4 it's impossible - the LLVM IR has underwent many major changes since 2.6, and Clang 3.4 will generate IR that's unintelligible to LLVM 2.6
Why do you need to use LLVM 2.6 is the real question.

Related

Is there a difference between Apple Clang and OpenMP-enabled Clang from Homebrew?

I want to know if there are any advantages in Apple's provided Clang compiler compared to the Clang compiler that comes with OpenMP available from Homebrew?
Will there be any performance loss if switching to OpenMP Clang (regardless of the multi-threading ability)?
I also found this old question that has no good answer
Update
I compiled the OOFEM using Apple's Clang and mainstream Clang and ran the same problem,
Apple's Clang: Real time consumed: 000h:01m:26s
Mainstream Clang: Real time consumed: 000h:01m:24s
With multi-threading enabled also the performance is similar.
One difference that I also noticed, is that Apple's Clang seems to ignore some CMake options e.g. -DOpenMP_CXX_FLAGS="-I/usr/local/opt/libomp/include" has no effect with Apple's Clang while works fine with the mainstream Clang.
Is there a difference?
As stated that answers itself. They're two different compilers and we don't know what Apple have done inside theirs. We do know that they don't provide OpenMP support, so that is at least one difference.
Will there be any performance loss if switching to OpenMP Clang
(regardless of the multi-threading ability)?
I doubt it, but since you're clearly measuring performance and playing with both compilers, you seem in a good position to tell us :-)

Clang built on GCC

I was searching online to see if clang supported reproducible builds. I read that GCC guaranteed reproducible builds using the -frandom-seed flag. I wanted to know if clang supports that flag and I could not find anything regarding that.I then came here which had a statement such as:
...two consecutive builds of (GCC-built) Clang
My question is what is GCC built clang ? I am currently aware of only 2 compilers (Microsoft , GCC (Coudl be Cygwin/Mingw flavor) ) and the third one was suppose to be clang. My question is what does clang (GCC built) mean ? Built from source ? I would like to think that clang is a totally different compiler from GCC and Windows. Also this documentation here states
Clang has experimental support for targeting “Cygming” (Cygwin /
MinGW) platforms.
What does that mean ? Does clang mean that it uses Mingw GCC as a compiler ? What does targeting mean here ?
To my mind, this phrase means clang was built from source using GCC as a compiler. Then, clang is a compiler, so it can't use GCC as a compiler.
Compilers are written in programming languages to be able to compile code written in a programming language. This means, a compiler can compile a compiler or even itself.
If you don't know is feature X supported in product Y, please, read the docs on product Y. If this feature isn't mentioned, it's not supported and vice versa.

Is the LLVM 5.0 compiler equivalent to the GCC compiler?

I have to write my projects for class in ISO C++ or C++/CLI and while the professor explains how to accomplish this in Windows, it is very difficult to know how to setup the equivalent on my Mac. I am currently running xCode 5.0.2 and it seems to compile the sample applications with no problem using the LLVM 5.0 compiler. I've read that Apple no longer supports GCC compiler, so my question is are the two compilers equivalent? Will code that runs in GCC compiler also work in the LLVM 5.0 compiler?
There is no LLVM 5.0. The LLVM project is currently at version 3.4. The Apple LLVM/Clang variant shipped with XCode 5 may carry a version number that corresponds to the XCode version, but that is mildly misleading.
That said, yes, most stuff that works with GCC 4.2 (the last one that Apple shipped) will work just fine with LLVM/Clang.
C++/CLI, on the other hand, is a Microsoft-proprietary thing and you will not be able to use it on a Mac no matter what, and neither GCC nor Clang support it.
Will code that runs in GCC compiler also work in the LLVM 5.0
compiler?
If by "runs" you mean "compiles," then yes, assuming your code is Standard-compliant.
Weather or not your code is Standard-complliant depends, in part, on how well your professor is doing his job.
Mostly. Being compatible with GCC is one of Clang's primary goals (see http://clang.llvm.org/features.html#gcccompat ). That said, you can install gcc via MacPorts, http://www.macports.org/ if you really need it.

LLVM vs clang on OS X

I have a question concerning llvm, clang, and gcc on OS X.
What is the difference between the llvm-gcc 4.2, llvm 2.0 and clang? I know that they all build on llvm but how are they different?
Besides faster compiling, what is the advantage of llvm over gcc?
LLVM originally stood for "low-level virtual machine", though it now just stands for itself as it has grown to be something other than a traditional virtual machine. It is a set of libraries and tools, as well as a standardized intermediate representation, that can be used to help build compilers and just-in-time compilers. It cannot compile anything other than its own intermediate representation on its own; it needs a language-specific frontend in order to do so. If people just refer to LLVM, they probably mean just the low-level library and tools. Some people might refer to Clang or llvm-gcc incorrectly as "LLVM", which may cause some confusion.
llvm-gcc is a modified version of GCC, which uses LLVM as its backend instead of GCC's own. It is now deprecated, in favor of DragonEgg, which uses GCC's new plugin system to do the same thing without forking GCC.
Clang is a whole new C/C++/Objective-C compiler, which uses its own frontend, and LLVM as the backend. The advantages it provides are better error messages, faster compile time, and an easier way for other tools to hook into the compilation process (like the LLDB debugger and Clang static analyzer). It's also reasonably modular, and so can be used as a library for other software that needs to analyze C, C++, or Objective-C code.
Each of these approaches (plain GCC, GCC + LLVM, and Clang) have their advantages and disadvantages. The last few sets of benchmarks I've seen showed GCC to produce slightly faster code in most test cases (though LLVM had a slight edge in a few), while LLVM and Clang gave significantly better compile times. GCC and the GCC/LLVM combos have the advantage that a lot more code has been tested and works on the GCC flavor of C; there are some compiler specific extensions that only GCC has, and some places where the standard allows the implementation to vary but code depends on one particular implementation. It is a lot more likely if you get a large amount of legacy C code that it will work in GCC than that it will work in Clang, though this is improving over time.
There are 2 different things here.
LLVM is a backend compiler meant to build compilers on top of it. It deals with optimizations and production of code adapted to the target architecture.
CLang is a front end which parses C, C++ and Objective C code and translates it into a representation suitable for LLVM.
llvm gcc was an initial version of a llvm based C++ compiler based on gcc 4.2, which is now deprecated since CLang can parse everything it could parse, and more.
Finally, the main difference between CLang and gcc does not lie in the produced code but in the approach. While gcc is monolithic, CLang has been built as a suite of libraries. This modular design allow great reuse opportunities for IDE or completion tools for example.
At the moment, the code produced by gcc 4.6 is generally a bit faster, but CLang is closing the gap.
llvm-gcc-4.2 uses the GCC front-end to parse your code, then generates the compiled output using LLVM.
The "llvm compiler 2.0" uses the clang front-end to parse your code, and generates the compiled output using LLVM. "clang" is actually just the name for this front-end, but it is often used casually as a name for the compiler as a whole.

LLVM compiler for production code?

I have a question concerning the LLVM compiler:
I would like to use it to compile my Objective-C source code for Mac and iOS and from their release notes it seems that LLVM is stable enough for using this.
Having made good experiences with the LLVM I would also like to use it to compile C++ or Objective-C++. However it is not clear to me if I should still use the hybrid LLVM-GCC compiler (the GCC parser and the LLVM code generator) or the pure LLVM compiler.
I am also unsure about the new C++ standard library and if I should use it and how I would make the transition from GNU's libstdc++.
The Questions
Which compiler would one use today to generate fast production quality code from C++: the LLVM-GCC hybrid compiler or pure LLVM?
Should one migrate the C++ standard library from GNU's libstdc++ to the new libc++ library created by the LLVM project?
Any comments and hints are appreciated.
Several questions asked here, I'll try to answer all of them.
There is no "pure LLVM compiler". LLVM is a set of libraries which do code optimization and code generation . There are several C/C++ frontends which can be hooked to LLVM. Among them are clang and llvm-gcc. See http://llvm.org/ for more information about various components of LLVM Compiler Infrastructure. As written at http://llvm.org/docs/ReleaseNotes.html, llvm-gcc is EOL since LLVM 2.9 release, so you'd better use clang, because it will certainly be developed and maintained in the future.
libc++ is still in development, so for production you should use vendor-provided C++ (libstdc++ in your case).
Remember, all this stuff is changing, so benchmarks gets easily outdated.
I've found following report interesting, not only as a kind of benchmark, but it seems showing some LLVM vs GCC compiler differences :
Clang/LLVM Maturity Evaluation Report by Dominic Fandrey