From d4c677d9c0b6df439864b96d234e105f21f7c7da Mon Sep 17 00:00:00 2001
From: Chris Lattner
Date: Fri, 9 Apr 2004 19:24:20 +0000
Subject: [PATCH] Expand on adding an intrinsic. Move section to before adding
an instruction
llvm-svn: 12796
---
docs/ExtendingLLVM.html | 66 +++++++++++++++++++++++++----------------
1 file changed, 40 insertions(+), 26 deletions(-)
diff --git a/docs/ExtendingLLVM.html b/docs/ExtendingLLVM.html
index 7dc8d15dfea..b4519cc7bc6 100644
--- a/docs/ExtendingLLVM.html
+++ b/docs/ExtendingLLVM.html
@@ -14,8 +14,8 @@
- Introduction and Warning
- - Adding a new instruction
- Adding a new intrinsic function
+ - Adding a new instruction
- Adding a new type
- Adding a new fundamental type
@@ -69,6 +69,45 @@ href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM-dev.
+
+
+
+
Adding a new intrinsic function to LLVM is much easier than adding a new
+instruction. Almost all extensions to LLVM should start as an intrinsic
+function and then be turned into an instruction if warranted.
+
+
+- llvm/docs/LangRef.html:
+ Document the intrinsic. Decide whether it is code generator specific and
+ what the restrictions are. Talk to other people about it so that you are
+ sure it's a good idea.
+
+- llvm/include/llvm/Intrinsics.h:
+ add an enum in the llvm::Intrinsic namespace
+
+- llvm/lib/VMCore/IntrinsicLowering.cpp:
+ implement the lowering for this intrinsic
+
+- llvm/lib/VMCore/Verifier.cpp:
+ Add code to check the invariants of the intrinsic are respected.
+
+- llvm/lib/VMCore/Function.cpp (Function::getIntrinsicID()):
+ Identify the new intrinsic function, returning the enum for the intrinsic
+ that you added.
+- Test your intrinsic
+- llvm/test/Regression/*: add your test cases to the test suite.
+
+
+
If this intrinsic requires code generator support (ie, it cannot be lowered).
+You should also add support to the code generator in question.
+
+
+