llvm-clang

what optimization passes are done for -O4 in clang?

老子叫甜甜 提交于 2019-12-21 16:58:44
问题 We are trying to implement a jit compiler whose performance is supposed to be same as doing it with clang -o4. Is there a place where I could easily get the list of optimization passes invoked by clang with -o4 is specified? 回答1: As far as I know -O4 means same thing as -O3 + enabled LTO (Link Time Optimization). See the folloing code fragments: Tools.cpp // Manually translate -O to -O2 and -O4 to -O3; Driver.cpp // Check for -O4. Also see here: You can produce bitcode files from clang using

Linking against clang-llvm

强颜欢笑 提交于 2019-12-21 16:56:12
问题 I've been working on a small tool with clang/llvm but I haven't been able to successfully get g++ and gnu's linker to properly link my code against clang. my linker is generating the following errors: undefined reference to `clang::FileManager::~FileManager()' undefined reference to `clang::FileManager::FileManager()' undefined reference to `llvm::sys::getHostTriple()' undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)' undefined reference to `llvm::outs()'

What's required to implement root class of Objective-C?

这一生的挚爱 提交于 2019-12-21 05:13:10
问题 I tried this code: // main.m #import <stdio.h> @interface Test + (void)test; @end @implementation Test + (void)test { printf("test"); } @end int main() { [Test test]; return 0; } with LLVM/Clang without any framework, it doesn't compiled with this error: Undefined symbols: "_objc_msgSend", referenced from: _main in main.o ld: symbol(s) not found clang: error: linker command failed with exit code 1 (use -v to see invocation) So I added libobjc.dylib . Code compiled, but threw this runtime

Private module map for a framework

爷,独闯天下 提交于 2019-12-20 09:39:08
问题 I'm using this answer to create a module map to create a module for CommonCrypto so I can use it in a framework. Doing this however means that any projects that I use this framework in have access to CommonCrypto with import CommonCrypto - and even worse, declaring CommonCrypto in another framework and importing this into the project results in Redefinition of module 'CommonCrypto' errors. I.e. the following setup: MainProject |--> import FrameworkA - module map for CommonCrypto |--> import

openmp runs single threaded on my mac

限于喜欢 提交于 2019-12-19 09:39:35
问题 I am trying to parallelize a program using openmp on a Mac, but I can not manage to make it multi-threaded. I've tried building llvm/clang/openmp 3.7.1 from source (after a svn co) as documented, I have also tried using the prebuild versions of clang and OpenMP 3.7.0 given by the llvm project. In each case, the resulting compiler works fine with the -fopenmp flag and produce an executable that links to the openmp runtime. I use the following openmp 'hello world' program: #include <omp.h>

openmp runs single threaded on my mac

对着背影说爱祢 提交于 2019-12-19 09:39:09
问题 I am trying to parallelize a program using openmp on a Mac, but I can not manage to make it multi-threaded. I've tried building llvm/clang/openmp 3.7.1 from source (after a svn co) as documented, I have also tried using the prebuild versions of clang and OpenMP 3.7.0 given by the llvm project. In each case, the resulting compiler works fine with the -fopenmp flag and produce an executable that links to the openmp runtime. I use the following openmp 'hello world' program: #include <omp.h>

lld undefined symbol: mainCRTStartup

老子叫甜甜 提交于 2019-12-19 08:31:49
问题 My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: mainCRTStartup Link failed Did I miss something? 回答1: mainCRTStartup is a function defined by the CRT (which clang is probably implicitly using in the first step, and generates an IR file with mainCRTStartup as the

lld undefined symbol: mainCRTStartup

爱⌒轻易说出口 提交于 2019-12-19 08:31:46
问题 My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: mainCRTStartup Link failed Did I miss something? 回答1: mainCRTStartup is a function defined by the CRT (which clang is probably implicitly using in the first step, and generates an IR file with mainCRTStartup as the

What is the LLVM version bundled with Xcode?

一个人想着一个人 提交于 2019-12-18 15:06:54
问题 Up to Xcode 6 when typing clang --version we got the information on what LLVM version it was built: Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) But now with Xcode 7 we only get the following: Apple LLVM version 7.0.0 (clang-700.0.72) 回答1: See https://gist.github.com/yamaya/2924292 in which an interesting comment says: Looking at the sources (src/CMakeLists.txt), it appears AppleClang is based on (approximately) the following LLVM branches: clang-700.0.72 => LLVM 3.7.0

Whats is proper version of llvm/clang/xcode?

旧巷老猫 提交于 2019-12-18 13:54:10
问题 This gist mentions that xcode 9 published with 'Apple LLVM version 9.0.0 (clang-900.0.38)', but the last version of llvm in llvm.org is LLVM 5.0.0. What is the relation between them? 回答1: Apple's Xcode ship with LLVM, but it is not the open source version. For example, some clang extra tool won't be installed to you Mac. So at least, Apple has modify CMakeLists.txt . You can read the CMakeLists.txt or Makefile in apple open source. This is only a suggestion, maybe is not helpful. Another: