Marcus Frenkel
2012-Jul-16 15:29 UTC
[LLVMdev] Preventing pure function declarations from being removed
Hi all, is there any way to mark a non-referenced function declaration as "used" in any way (by using the C++ code generator) so that it will be ignored by the stripDeadPrototypes and globalDCE pass (and any other pass that possibly might remove seemingly unused functions)? Basically, my modules have a set of function declarations (without an actual body, just a global mapping on the C++ side) that shall not be removed during code optimization, because I need to find them again after optimization. Greetings Marcus
Duncan Sands
2012-Jul-16 15:49 UTC
[LLVMdev] Preventing pure function declarations from being removed
Hi Marcus,> is there any way to mark a non-referenced function declaration as "used" > in any way (by using the C++ code generator) so that it will be ignored by > the stripDeadPrototypes and globalDCE pass (and any other pass that > possibly might remove seemingly unused functions)?try adding it to the llvm.used array. To see what that is, I suggest you compile some C code in which you have marked some function with attribute "used", and observe the use that clang makes of this array. Ciao, Duncan.
Possibly Parallel Threads
- [LLVMdev] Preventing pure function declarations from being removed
- [LLVMdev] Marking a function prototype as being "persistent"
- [LLVMdev] llvm::Type as llvm::Value in metadata
- [LLVMdev] llvm::Type as llvm::Value in metadata
- [LLVMdev] llvm::Type as llvm::Value in metadata