Questions tagged [llvm-clang]

Clang is the C language family front-end for the LLVM compiler. (The C language family includes C, C++, Objective-C, and Objective-C++.)

Clang refers to the C language family front-end for the LLVM (originally known as "low level virtual machine") compiler. The C language family consists of C, C++, Objective-C, and Objective-C++.

High-level features of clang include better compile-time performance than gcc, helpful error and warning messages, and a static analyzer to automatically detect software bugs.

1101 questions
5
votes
1 answer

Integrating LLVM passes

This maybe a rookie question but is there a way to integrate my LLVM modulepass to be called by default during the transformation phase? Right now I am using this syntax to load my pass and register it ~/llvm/llvm/build/Debug+Asserts/bin/clang…
Abhishek Vasisht
  • 406
  • 6
  • 18
5
votes
1 answer

llvm pass segmentation fault:(Core dumped)

I have written a simple llvm Pass that is counting the opcodes in c++ source file. I have no issues with source file and I have successfully taken .bc file of it. Now when I run it through my Pass then it crashes. The code for pass is below…
Zeeshan Haider
  • 101
  • 1
  • 9
5
votes
1 answer

How to get llvm inline asm operands type?

I am working at a project about inline asm of LLVM, but I meet one problem about asm operands. For example, I have code like this: int a; int b; asm("nop": "=r"(a), "r"(b), "g"(30)); I can get asm string "nop" using…
user4697391
5
votes
3 answers

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

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…
Dalia
  • 135
  • 2
  • 9
5
votes
4 answers

Determine parent function node of a Stmt when visiting Clang AST using RecursiveASTVisitor

I am learning how to build a tool for parsing C using libtooling of clang. I'm using a RecursiveASTVisitor-inherited class, so all its traverse and visitor methods are available. I wonder if I can determine the parent function node of a statement…
5
votes
0 answers

Template code compiles fine with g++ (4.9), but the does not compile with clang++ (3.4) and gives error

Both are almost on the latest versions of g++ and clang++ in Ubuntu 14.04. The below code compiles fine with g++. template struct B { static const int i = T::value; }; struct D : B { static const int value = 0; } d; int main ()…
iammilind
  • 68,093
  • 33
  • 169
  • 336
5
votes
1 answer

LLVM - How AST can be transformed to IR

I know that an AST generated by the parser is used to generate IR in the frontend. I am wondering how AST to be parsed and then transformed to IR (prob assembly or bitcode), AST is a tree, what are the steps involved in the transformation from AST…
Sam
  • 4,521
  • 13
  • 46
  • 81
5
votes
1 answer

Linker error with implicit instantiation of private C++ template with LLVM-Clang

Disclaimer: I know that templates are usually implemented in the header file. Please read through. I have a C++ template-related issue. My code builds with MSVC under Windows but doesn't with LLVM-Clang under Mac OSX, but I'm not sure which one is…
floriang
  • 139
  • 1
  • 7
5
votes
1 answer

Counting the number of LLVM instructions executed dynamically using LLI

I wanted to count the number of LLVM instruction executed dynamically in any program, using lli 3.4. I checked this link, but it's not giving any information related to instruction count.
Abhinash Jain
  • 169
  • 10
5
votes
2 answers

How do I generate LLVM bitcode for use by emscripten?

I am investigating emscripten for a personal project, and I would like to use a language other than C or C++ to do so. However, while I am investigating emscripten, I figured I should use a trivial 'hello world' example written in C. I know that I…
Arafangion
  • 11,517
  • 1
  • 40
  • 72
5
votes
1 answer

clang adding a new pragma

I want to know which all llvm IR statements correspond to the code inside a particular pragma in clang. My pragma is having the following structure. #pragma markme { stmt1; stmt2; } I need to know which all stmts were present between the…
simpleuser
  • 479
  • 5
  • 16
5
votes
0 answers

Symbol not found: _objc_retainAutoreleasedReturnValue in MacOS command line tool

There are a couple questions with the same keywords as the title, however they focus on the iOS side of Objective-C. My problem is with a MacOS command line tool. Basically what's happening is that the Foundation (Cocoa) tool is calling a C…
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
5
votes
4 answers

Compile time check for valid file references in Xcode

Is it possible to force the Xcode complier to verify that files referenced in code are valid? There are multiple points in Cocoa development when you naturally reference a file programmatically via an NSString: [UINib nibWithNibName:@"MyNib"…
bearMountain
  • 3,950
  • 1
  • 36
  • 44
5
votes
2 answers

what optimization passes are done for -O4 in clang?

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?
Amit Prakash
  • 1,171
  • 10
  • 19
5
votes
3 answers

Why does the compiler generate code that writes the same stuff in the same memory location over and over again?

I compiled the following code using clang and gcc and called both with -O3: #include #include static void a(int n) { if (n == 0) return; printf("descending; a=%i\n", n); a(n-1); } int main() { a(5); return…
thejh
  • 44,854
  • 16
  • 96
  • 107