Add proper target hooks for __builtin_extract_return_address and
__builtin_frob_return_address.  The implementations for both are
still trivial in the default case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97638 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/TargetInfo.h b/lib/CodeGen/TargetInfo.h
index b8a374c..9e80081 100644
--- a/lib/CodeGen/TargetInfo.h
+++ b/lib/CodeGen/TargetInfo.h
@@ -17,6 +17,7 @@
 
 namespace llvm {
   class GlobalValue;
+  class Value;
 }
 
 namespace clang {
@@ -25,6 +26,7 @@
 
   namespace CodeGen {
     class CodeGenModule;
+    class CodeGenFunction;
   }
 
   /// TargetCodeGenInfo - This class organizes various target-specific
@@ -53,6 +55,26 @@
     ///   - that implicitly ignore/truncate the top bits when addressing
     ///     through such registers.
     virtual bool extendPointerWithSExt() const { return false; }
+
+    /// Performs the code-generation required to convert a return
+    /// address as stored by the system into the actual address of the
+    /// next instruction that will be executed.
+    ///
+    /// Used by __builtin_extract_return_addr().
+    virtual llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+                                             llvm::Value *Address) const {
+      return Address;
+    }
+
+    /// Performs the code-generation required to convert the address
+    /// of an instruction into a return address suitable for storage
+    /// by the system in a return slot.
+    ///
+    /// Used by __builtin_frob_return_addr().
+    virtual llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+                                             llvm::Value *Address) const {
+      return Address;
+    }
   };
 }