diff --git a/docs/ExtendingLLVM.html b/docs/ExtendingLLVM.html new file mode 100644 index 00000000000..8c880e5ba7c --- /dev/null +++ b/docs/ExtendingLLVM.html @@ -0,0 +1,213 @@ + + +
+Written by Misha Brukman
+During the course of using LLVM, you may wish to customize it for your +research project or for experimentation. At this point, you may realize that +you need to add something to LLVM, whether it be a new fundamental type, a new +intrinsic function, or a whole new instruction.
+ +When you come to this realization, stop and think. Do you really need to +extend LLVM? Is it a new fundamental capability that LLVM does not support at +its current incarnation or can it be synthesized from already pre-existing LLVM +elements? If you are not sure, ask on the LLVM-dev list. The +reason is that extending LLVM will get involved as you need to update all the +different passes that you intend to use with your extension, and there are +many LLVM analyses and transformations, so it may be quite a bit of +work.
+ +Before you invest a significant amount of effort into a non-trivial +extension, ask on the list if what you are +looking to do can be done with already-existing infrastructure, or if maybe +someone else is already working on it. You will save yourself a lot of time and +effort by doing so.
+ +Finally, these are my notes, and since my extensions are not complete, I may +be missing steps. If you find some omissions, please let me know directly or post on LLVM-dev.
+ +WARNING: adding instructions changes the bytecode +format, and will break compatibility with currently-existing LLVM +installations. Only add an instruction if it is absolutely +necessary.
+ +Also, you need to implement (or modify) any analyses or passes that you want +to understand this new instruction.
+ +Adding an intrinsic function is easier than adding an instruction, and is +transparent to optimization passes which treat it as an unanalyzable function. +If your added functionality can be expressed as a function call, an intrinsic +function is the method of choice for LLVM extension.
+ +WARNING: adding new types changes the bytecode +format, and will break compatibility with currently-existing LLVM +installations. Only add new types if it is absolutely necessary.
+ +TODO
+ +