llvm

clang: warning: no such sysroot directory: '-mmacosx-version-min=10.5' on compiling LLVM (3.9.0)

你。 提交于 2020-07-19 18:54:30
问题 I am compiling LLVM (3.9.0) using CMake (3.6.2) on my Mac (OsX) using GCC, but somehow I am getting the following error with following GCC configuration Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin [50%] Building C object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt

LLVM retrieve name of AllocaInst

徘徊边缘 提交于 2020-07-18 07:35:08
问题 I am trying to retrieve the name of the pointer passed to a cudaMalloc call. CallInst *CUMallocCI = ... ; // CI of cudaMalloc call Value *Ptr = CUMallocCI->getOperand(0); if (AllocaInst *AI = dyn_cast<AllocaInst>(Ptr) != nullptr) { errs() << AI->getName() << "\n"; } The above however just prints an empty line. Is is possible to get the pointer name out of this alloca? This is the relevant IR: %28 = alloca i8*, align 8 ... ... call void @llvm.dbg.declare(metadata i8** %28, metadata !926,

LLVM retrieve name of AllocaInst

a 夏天 提交于 2020-07-18 07:35:08
问题 I am trying to retrieve the name of the pointer passed to a cudaMalloc call. CallInst *CUMallocCI = ... ; // CI of cudaMalloc call Value *Ptr = CUMallocCI->getOperand(0); if (AllocaInst *AI = dyn_cast<AllocaInst>(Ptr) != nullptr) { errs() << AI->getName() << "\n"; } The above however just prints an empty line. Is is possible to get the pointer name out of this alloca? This is the relevant IR: %28 = alloca i8*, align 8 ... ... call void @llvm.dbg.declare(metadata i8** %28, metadata !926,

Clang vs G++ lvalue to rvalue conversion

旧城冷巷雨未停 提交于 2020-07-09 11:55:56
问题 The question related to this one. By tracing slt_pair. h and move. h , it's seems that the difference between Clang and G++ is internally. I have tried to simulate the assignment of the object (pair.first) as same as the implementation of std_pair.h , the output is same as Clang output it's reasonable output, but why when using pairs it's changes. #include <iostream> struct Foo { Foo() { std::cout << "default" << std::endl; } Foo(Foo& f2) { std::cout << "non-const" << std::endl; } Foo(const

llvm: How to get the label of Basic Blocks

拈花ヽ惹草 提交于 2020-07-05 01:16:48
问题 I have written a pass to detect and print the label of basicblocks in a function, for I want to use splitBasicBlock() further. I wrote that like this: virtual bool runOnModule(Module &M) { for(Module::iterator F = M.begin(), E = M.end(); F!= E; ++F) { errs()<<"Function:"<<F->getName()<<"\n"; //for(Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (iplist<BasicBlock>::iterator iter = F->getBasicBlockList().begin(); iter != F->getBasicBlockList().end(); iter++) { BasicBlock*

llvm: How to get the label of Basic Blocks

烈酒焚心 提交于 2020-07-05 01:13:29
问题 I have written a pass to detect and print the label of basicblocks in a function, for I want to use splitBasicBlock() further. I wrote that like this: virtual bool runOnModule(Module &M) { for(Module::iterator F = M.begin(), E = M.end(); F!= E; ++F) { errs()<<"Function:"<<F->getName()<<"\n"; //for(Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (iplist<BasicBlock>::iterator iter = F->getBasicBlockList().begin(); iter != F->getBasicBlockList().end(); iter++) { BasicBlock*

What does the CodeModel in Clang / LLVM refer to?

喜夏-厌秋 提交于 2020-07-03 03:16:08
问题 I have been looking through the Clang / LLVM source-code and I came across the CodeModel property of CodeGenOptions. Based on this method, the valid values appear to be: "small" , "kernel" , "medium" and "large" . What do this property control? How do I go about choosing the correct value for my application? 回答1: Code model is a term from AMD64 ABI (see 3.5.1 from https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf for more information). In short - the majority

What exactly is the LLVM C++ API

ぃ、小莉子 提交于 2020-06-24 22:10:19
问题 I found it hard to understand the LLVM C++ API. Is there any relationship between LLVM C++ API and LLVM IR? Also, how could one use the LLVM C++ API? 回答1: To (greatly) simplify, LLVM is a C++ library for writing compilers. Its C++ API is the external interface users of the library employ to implement their compiler. There's a degree of symmetry between LLVM IR and part of the LLVM C++ API - the part used to build IR. A very good resource for getting a feel for this symmetry is http://llvm.org

What exactly is the LLVM C++ API

大城市里の小女人 提交于 2020-06-24 22:07:34
问题 I found it hard to understand the LLVM C++ API. Is there any relationship between LLVM C++ API and LLVM IR? Also, how could one use the LLVM C++ API? 回答1: To (greatly) simplify, LLVM is a C++ library for writing compilers. Its C++ API is the external interface users of the library employ to implement their compiler. There's a degree of symmetry between LLVM IR and part of the LLVM C++ API - the part used to build IR. A very good resource for getting a feel for this symmetry is http://llvm.org

What exactly is the LLVM C++ API

不问归期 提交于 2020-06-24 22:06:08
问题 I found it hard to understand the LLVM C++ API. Is there any relationship between LLVM C++ API and LLVM IR? Also, how could one use the LLVM C++ API? 回答1: To (greatly) simplify, LLVM is a C++ library for writing compilers. Its C++ API is the external interface users of the library employ to implement their compiler. There's a degree of symmetry between LLVM IR and part of the LLVM C++ API - the part used to build IR. A very good resource for getting a feel for this symmetry is http://llvm.org