Questions tagged [llvm-3.0]

54 questions
18
votes
1 answer

Attempting to write an LLVM backend. No good tutorial available

I am trying to write an LLVM backend for my custom processor that I have designed recently. I tried to follow the official tutorial at http://llvm.org/docs/WritingAnLLVMBackend.html But it is so vague, so incomplete and blurry that I failed to…
Dr. Ehsan Ali
  • 4,735
  • 4
  • 23
  • 37
17
votes
1 answer

Does an @autoreleasepool {} drain when returning / exiting early?

Consider this example: - (void)doSomething { @autoreleasepool { if (someCondition) { /* ... allocate some autoreleased objects here ... */ return; } } } Previously, with manual NSAutoreleasePools, if we…
Martijn Thé
  • 4,674
  • 3
  • 29
  • 42
15
votes
2 answers

Add LLVM to project using cmake

I'm trying to add LLVM to a cmake project, using cygwin as a compiler. I downloaded LLVM from cygwin's installer (just installed all of the llvm related packages). The files are there, however I cannot include LLVM in my project. I tried using the…
anonra
  • 301
  • 1
  • 3
  • 6
10
votes
1 answer

string representation of llvm::Type structure

llvm::Type 2.9 and earlier used to have getDescription method to retrieve a string representation of the type. This method does not exist anymore in llvm 3.0. I'm not sure if this is deprecated in favor of Type::print(raw_ostream&), but in any case…
lurscher
  • 25,930
  • 29
  • 122
  • 185
10
votes
2 answers

LLVM String Value objects: How can I retrieve the String from a Value?

When building the IR from an existing AST, my AST has some string values (at compile-time they are built from std::string) and I want to set them safely as llvm::Value to use as a part of an expression. In this case, I don't need to bind the string…
lurscher
  • 25,930
  • 29
  • 122
  • 185
10
votes
1 answer

Why is the -ObjC linker flag needed to link categories in static libraries? (LLVM)

Regarding this technical Q&A from Apple: http://developer.apple.com/library/mac/#qa/qa1490/_index.html I think the compiler could mark calls to methods defined in categories at compile-time (it knows that they were defined in a category and not the…
jhabbott
  • 18,461
  • 9
  • 58
  • 95
8
votes
5 answers

What are primitive types default-initialized to in C?

I just had Apple's C/C++ compiler initialize a float to a non-zero value (approx "-0.1"). That was a big surprise - and only happened occasionally (but 100% repeatably, if you ran through the same function calls / args beforehand). It took a long…
Adam
  • 32,900
  • 16
  • 126
  • 153
8
votes
5 answers

xcode - "attempt to use a deleted function" - what does that mean?

I am writing a C++ library in Xcode 4.2. One of my classes won't compile with this error: attempt to use a deleted function There is no specific indication what function it's talking about. I don't want to post the class code here, but does…
Roey Lehman
  • 356
  • 1
  • 3
  • 16
5
votes
1 answer

CreateGlobalStringPtr crashes when I don't create method + basic block for main

The following crashes in CreateGlobalStringPtr: #include "llvm/Support/DataTypes.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" #include…
Fanatic23
  • 3,378
  • 2
  • 28
  • 51
4
votes
1 answer

Typedef redefinition error when trying to build XCode project for release

I can build my project in Xcode(4.2) for debugging without issues, but when I want to build it for release (build for archiving) I get error:"Typedef redefinition with different types (unsigned int vs unsigned long)". Problematic code is: #ifdef…
ivan glisic
  • 53
  • 1
  • 1
  • 4
4
votes
1 answer

llvm - get the first instruction of the basic block referred to in the label field of instruction of type br

I'm trying to write a pass that will check the control flow of a code. Given a br instruction, I need to access the basic blocks referred to in the label fields. For example, for the code: for(i = 0; i < count; i++){ sum = add(sum, array[i]); …
mikasa
  • 783
  • 1
  • 11
  • 29
4
votes
1 answer

Specify dependency of my LLVM pass on the mem2reg pass

I am writing a ModulePass and invoke it using opt -load. I would require that alloca has been promoted to registers when my pass runs, using the -mem2reg switch for opt. There is a link which indicates that the PromoteMemoryToRegsiter pass is a…
Jens
  • 8,423
  • 9
  • 58
  • 78
4
votes
6 answers

Apple LLVM compiler 3.1 error - iOS 5; Xcode 4.3

I have been receiving this error for a long time and I don't know what to do. In order to keep the question short, I have written the error into a .rtf file and put it into CloudApp. Here's the link: http://cl.ly/0T3n1Q123u352T372t0m I think it has…
Jesse Conroy
  • 39
  • 1
  • 1
  • 2
4
votes
1 answer

Is there a struct type isomorphism check in LLVM 3.0?

In LLVM-3.0, named structs are always unique and pointer equality with other structurally same structs does not work. From their blog entry on LLVM-3.0 types, the highlights are mine: Identified structures are the kind we are talking about: they…
Chetan
  • 448
  • 2
  • 10
3
votes
2 answers

use and meaning of DW_AT_location

I wanted to know the use of the attribute DW_AT_location for debugging. It is one of the attributes specified by dwarf for debugging, but could not really understand what exactly it represents. And also when should this attribute be emitted when we…
Maximus
  • 285
  • 5
  • 19
1
2 3 4