llvm

What are the requirements for using `shfl` operations on AMD GPU using HIP C++?

不羁的心 提交于 2019-12-11 07:23:55
问题 There is AMD HIP C++ which is very similar to CUDA C++. Also AMD created Hipify to convert CUDA C++ to HIP C++ (Portable C++ Code) which can be executed on both nVidia GPU and AMD GPU: https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP There are requirements to use shfl operations on nVidia GPU: https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/tree/master/samples/2_Cookbook/4_shfl#requirement-for-nvidia requirement for nvidia please make sure you have a 3.0 or higher compute

“Attributes.inc” file not found

£可爱£侵袭症+ 提交于 2019-12-11 07:21:22
问题 I have been using the headers provided in include\llvm and include\llvm-c to try and make my own compiler. However, whenever I try to compile, I get this error. There is no llvm/IR/Attributes.inc in my files nor any LLVM project I have seen. I get this error: In file included from ./headers/llvm/IR/Function.h:26: In file included from ./headers/llvm/IR/Argument.h:19: ./headers/llvm/IR/Attributes.h(74,14): fatal error: 'llvm/IR/Attributes.inc' file not found #include "llvm/IR/Attributes.inc"

Clang Static Analyzer for Xcode4

跟風遠走 提交于 2019-12-11 06:55:39
问题 Do we still need Clang Static Analyzer for XCode4? or the built in one is already good enough to use? http://clang-analyzer.llvm.org/ If not, anyone know how to integrate the above one with Xcode4? Thanks 回答1: The built-in static analyzer uses Clang to generate its results. You should see nearly identical (or better) output from the “Build” > “Build and Analyze...” command. 回答2: Just to add to Noah's answer... The Static Analyzer is great! You can turn it on to run by default every-time you

How can LLVM use C++'s standard containers without exceptions?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:38:52
问题 According to the LLVM Coding Standards, "LLVM does not use [...] exceptions". However, LLVM does make use of C++'s standard containers, such as std::vector . How is it possible for LLVM to use the standard containers without exceptions? How does it handle a situation in which a container would normally throw ? For example, what happens if std::vector::push_back cannot allocate memory and cannot throw std::bad_alloc ? 回答1: LLVM treats reaching a state which would throw an exception as an

How do I use a freshly compiled LLVM tool directly from LLVM source tree?

寵の児 提交于 2019-12-11 06:18:00
问题 I am writing a MachineFunctionPass targeting the X86 architecture which results in a modified llc binary. In order to test my modified version of llc I have created a bunch of .c programs whose MIR will be handled by my pass. For the sake of cleanliness, I have added the directory including the sources directly into LLVM's source tree, specifically in $llvm_src_dir/lib/Target/X86/$examples_dir : I have then plugged it into LLVM build system by appending the add_subdirectory() directive to

Building llvm examples

纵饮孤独 提交于 2019-12-11 06:17:37
问题 I followed the below from http://llvm.org/docs/GettingStarted.html - which completed successfully: cd where-you-want-llvm-to-live get the code ... make I put these in my home directory, so my structure looks like ~/llvmHome/llvm/<souce code is here> ~/llvmHome/build/Debug+Asserts/bin/<clang++ executables etc are here> I'm attempting to follow the steps on http://llvm.org/docs/tutorial/LangImpl3.html to build the example. I'm performing cd ~/llvmHom/llvm/examples/Kaleidoscope/Chapter3 //so I'm

llvm opt -O3 fail (?)

半腔热情 提交于 2019-12-11 05:44:09
问题 I need to identify integer variables which behave like boolean variables , that is, they can only have the values 0 or 1 . For that purpose, I modified the llvm bitcode to add an equivalent instruction to: int tmp = someVar*(someVar-1); Hoping that agressive O3 optimizations will identify tmp as being the constant value 0 . Here is a C version of the code I used: int should_expand(char *s) { int tmp = 0; int ret = 0; char *p = s; if (p && *p == '&') { ret = 1; } tmp = ret * (ret - 1); return

How to add metadata nodes using the LLVM C Api/llvm-fs bindings

戏子无情 提交于 2019-12-11 05:06:52
问题 I'm trying to add metadata nodes to a program, either onto the instructions or as global metadata. How do I do this with the LLVM C API? It now provides a function LLVMAddNamedMetadataOperand (as found from this question) but I can't seem to see how to use it. This is bound to addNamedMetadataOperand in the llvm-fs bindings. I tried this: addNamedMetadataOperand myModule "foobar" (mDString "cat" 3u) expecting it to make some metadata node called foobar but it doesn't work - complains about

How to get Stmt class object from Expr object in Clang

社会主义新天地 提交于 2019-12-11 04:56:15
问题 I am writing a clang plugin for inserting assertions in a C code. I have implemented a class for visiting each unary operator and check if it is a pointer dereference. If it is, I would like to insert an NULL pointer assertion check for it. But I am stuck as I cannot figure out how to get the Stmt object containing the Expr object in Clang. This is my code which instruments the assertion but at a completely wrong location (ie just after the pointer dereference. I would like to do it just

Getting the memory address of all Objects at runtime in LLVM

大憨熊 提交于 2019-12-11 04:49:27
问题 Is it possible to get Objects' memory address at runtime? For a certain c++ project, is it possible to track all objects' information, including memory address at runtime, lifetime and the counts of load & store? 来源: https://stackoverflow.com/questions/38527218/getting-the-memory-address-of-all-objects-at-runtime-in-llvm