llvm

CLang libc, libc++ on Windows with debugging symbols compatible with Visual Studio

老子叫甜甜 提交于 2020-01-01 14:20:18
问题 I'm trying to find info and I don't see it on clang web site. I'm thinking to try to use it on windows, but I have no clue if it has it's own libc or it uses broken libc from MS? another question: if i compile code with clang, will I be able to use visual studio as a debugger, e.g. is clang capable of emitting debugging symbols in MS format (this is the reason I don't want to use gcc; and this is something that intel compiler can do, but it uses MS's libc). In short, I'd like to be able to

How can I get Function Name of indirect call from CallInst in LLVM

岁酱吖の 提交于 2020-01-01 12:06:16
问题 Function *fun = call->getCalledFunction(); getCalledFunction(); returns null if it's indirect call. How can I get the name of the function or the name of the pointer? I found all questions in Stack Overflow related to this issue talked about function name of direct call, or type of pointer. I just want to track cases like this one: void foo(){} void goo(){} void main(){ int x = 1; void (*p)(); if(x) p = &foo; else p = &goo; p(); // print the called function name } 回答1: I get the same problem.

How to convert llvm IR to c code?

江枫思渺然 提交于 2020-01-01 10:46:51
问题 Is there any way to convert the llvm IR to c code and keep its semantics? For example, can we compile the c code first to llvm IR and then compile it back to another piece of c code. I don't expect that these two files will be the same. But they need to have the same functionality. Thanks 回答1: You can use the C backend, with llc -march=c 来源: https://stackoverflow.com/questions/8563670/how-to-convert-llvm-ir-to-c-code

What to use instead of mudflap with gcc/llvm (for detecting memory access bugs)?

风格不统一 提交于 2020-01-01 09:16:30
问题 It seems that the -fmudflap feature was removed from GCC. Thus my question: what to use instead of it for dynamically analyzing programs for out-of-bound read/writes, uninitialized reads and such issues? (and perhaps as a side question: why was it removed?) The approach of mudflap (instrumentalizing generated code inside the compiler) looks quite elegant. Background Other tools instrumentalize on a machine-code level (e.g. Purify), on a source-code level (e.g. Insure) or instrumentalize

Linking libc++ to CMake project on Linux

末鹿安然 提交于 2020-01-01 08:44:40
问题 I want to use libc++ together with clang on Arch Linux in CMake project. I installed libc++ and added following lines to CMakeLists.txt as said on LLVM site in Linux section of "Using libc++ in your programs": set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "-lc++abi") I have tried just "++abi" in linker's flags, but it didn't help. I need some help in figuring out what i should write in my CMakeLists.txt. 回答1: Don't forget to set the compiler to

Is it possible to make Node.js use Rhino as the Javascript engine?

两盒软妹~` 提交于 2020-01-01 04:11:11
问题 I use Node.js for several jobs on my web apps and so far everthing's ok. But the Node.js uses Google's V8 as the default Javascript engine (JSE) and V8 runs exlusively on the x86 and ARM Instruction Set Architectures (ISA). Now I have a PPC processor Mac computer on which I want to run the Node.js . To do that, I'm adviced to use the Rhino + OpenJDK Shark Virtual Machine + Low Level Virtual Machine (LLVM) as the JIT compiler. Currently, that looks like the most applicable way of running Node

Proper way to enable SSE4 on a per-function / per-block of code basis?

不打扰是莪最后的温柔 提交于 2020-01-01 03:16:09
问题 For one of my OS X programs, I have a few optimized cases which use SSE4.1 instructions. On SSE3-only machines, the non-optimized branch is ran: // SupportsSSE4_1 returns true on CPUs that support SSE4.1, false otherwise if (SupportsSSE4_1()) { // Code that uses _mm_dp_ps, an SSE4 instruction ... __m128 hDelta = _mm_sub_ps(here128, right128); __m128 vDelta = _mm_sub_ps(here128, down128); hDelta = _mm_sqrt_ss(_mm_dp_ps(hDelta, hDelta, 0x71)); vDelta = _mm_sqrt_ss(_mm_dp_ps(vDelta, vDelta, 0x71

Force a function to be inline in Clang/LLVM

丶灬走出姿态 提交于 2019-12-31 20:17:04
问题 Is there a way to force an inline function in Clang/LLVM? AFAIK, the following is just a hint to the compiler but it can ignore the request. __attribute__((always_inline)) I don’t mind that the compilation will fail if it can’t inline the function. 回答1: There is a good solution if compiling with C99 which is Clang's default. Its simply using inline attribute. inline void foo() {} It is well written in Clang's compatibility page: By default, Clang builds C code according to the C99 standard,

Set value for llvm::ConstantInt

主宰稳场 提交于 2019-12-31 16:50:00
问题 I'm playing around with LLVM. I thought about changing value of a constant in the intermediate code. However, for the class llvm::ConstantInt, I don't see a setvalue function. Any idea how can I modify value of a constant in the IR code? 回答1: ConstantInt is a factory, isn't it? Class has the get method to construct new constant: /* ... return a ConstantInt for the given value. */ 00069 static Constant *get(Type *Ty, uint64_t V, bool isSigned = false); So, I think, you can't modify existing

Set value for llvm::ConstantInt

北慕城南 提交于 2019-12-31 16:49:10
问题 I'm playing around with LLVM. I thought about changing value of a constant in the intermediate code. However, for the class llvm::ConstantInt, I don't see a setvalue function. Any idea how can I modify value of a constant in the IR code? 回答1: ConstantInt is a factory, isn't it? Class has the get method to construct new constant: /* ... return a ConstantInt for the given value. */ 00069 static Constant *get(Type *Ty, uint64_t V, bool isSigned = false); So, I think, you can't modify existing