-
Book Overview & Buying
-
Table Of Contents
LLVM Cookbook
By :
As we know, by inlining we mean expanding the function body of the function called at the call site, as it may prove useful through faster execution of code. The compiler takes the decision whether to inline a function or not. In this recipe, you will learn to how to write a simple function-inlining pass that makes use of the implementation in LLVM for inlining. We will write a pass that will handle the functions marked with the alwaysinline attribute.
Let's write a test code that we will run our pass on. Make the necessary changes in the lib/Transforms/IPO/IPO.cpp and include/llvm/InitializePasses.h files, the include/llvm/Transforms/IPO.h file, and the /include/llvm-c/Transforms/IPO.h file to include the following pass. Also make the necessary makefile changes to include his pass:
$ cat testcode.c define i32 @inner1() alwaysinline { ret i32 1 } define i32 @outer1() { %r = call i32 @inner1() ret i32 %r }
We will now...
Change the font size
Change margin width
Change background colour