First step in adding pcmarker intrinsic. Second step (soon) is adding backend support.
authorAndrew Lenharth <andrewl@lenharth.org>
Mon, 28 Mar 2005 20:05:49 +0000 (20:05 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Mon, 28 Mar 2005 20:05:49 +0000 (20:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20900 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.html
include/llvm/Intrinsics.h
lib/CodeGen/IntrinsicLowering.cpp
lib/VMCore/Function.cpp
lib/VMCore/Verifier.cpp

index 807c7515b49cff67fbd38597f5492abdb02d4c84..b7bbac34c9e17b795427a2c4ec08a92174683fb0 100644 (file)
           <li><a href="#i_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a></li>
           <li><a href="#i_frameaddress">'<tt>llvm.frameaddress</tt>'   Intrinsic</a></li>
           <li><a href="#i_prefetch">'<tt>llvm.prefetch</tt>' Intrinsic</a></li>
+          <li><a href="#i_pcmarker">'<tt>llvm.pcmarker</tt>' Intrinsic</a></li>
         </ol>
       </li>
       <li><a href="#int_os">Operating System Intrinsics</a>
@@ -2548,6 +2549,46 @@ performance.
 
 </div>
 
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_pcmarker">'<tt>llvm.pcmarker</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  call void (uint)* %llvm.pcmarker( uint &lt;id&gt; )
+</pre>
+
+<h5>Overview:</h5>
+
+
+<p>
+The '<tt>llvm.pcmarker</tt>' intrinsic is a method to export a PC in a region of 
+code to simulators and other tools.  The method is target specific, but it is 
+expected that the marker will use exported symbols to transmit the PC of the marker.
+The marker makes no guaranties that it will remain with any specific instruction 
+after optimizations.  It is possible that the presense of a marker will inhibit 
+optimizations.  The intended use is to be inserted after optmizations to allow
+corrolations of simulation runs.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+<tt>id</tt> is a numerical id identifying the marker.
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+This intrinsic does not modify the behavior of the program.  Backends that do not 
+support this intrinisic may ignore it.
+</p>
+
+</div>
+
 
 <!-- ======================================================================= -->
 <div class="doc_subsection">
index fe3c7867ad4fa2a5a2d805e57f9e6f6ab9f8e5d2..e0a8dd7954ef8599642a30098c1496971a01b9bf 100644 (file)
@@ -35,6 +35,7 @@ namespace Intrinsic {
     returnaddress,  // Yields the return address of a dynamic call frame
     frameaddress,   // Yields the frame address of a dynamic call frame
     prefetch,       // Prefetch a value into the cache
+    pcmarker,       // Export a PC from near the marker
 
     // setjmp/longjmp intrinsics.
     setjmp,         // Used to represent a setjmp call in C
index 3633f966f90f695c35aee2d62dc1c96db75cf3ba..b665557d2bbc6d817f7131d6b79b48be905e89ce 100644 (file)
@@ -172,6 +172,9 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
   case Intrinsic::prefetch:
     break;    // Simply strip out prefetches on unsupported architectures
 
+  case Intrinsic::pcmarker:
+    break;    // Simply strip out pcmarker on unsupported architectures
+
   case Intrinsic::dbg_stoppoint:
   case Intrinsic::dbg_region_start:
   case Intrinsic::dbg_region_end:
index df8d1f904f39be21a9277d5b51fcd7c69f080d69..b883e07ddf6dc0dc6e55c55767456ab6366ed309 100644 (file)
@@ -234,6 +234,7 @@ unsigned Function::getIntrinsicID() const {
     break;
   case 'p':
     if (getName() == "llvm.prefetch")  return Intrinsic::prefetch; 
+    if (getName() == "llvm.pcmarker")  return Intrinsic::pcmarker; 
     break;
   case 'r':
     if (getName() == "llvm.returnaddress")  return Intrinsic::returnaddress;
index 89fd98081fa54387363792ca53fbd0e007de95a1..3964817f820e4b3a98519258bb3af26e8f31d164 100644 (file)
@@ -749,6 +749,11 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
   case Intrinsic::memset:          NumArgs = 4; break;
 
   case Intrinsic::prefetch:        NumArgs = 3; break;
+  case Intrinsic::pcmarker:        
+    NumArgs = 1; 
+    Assert1(isa<Constant>(CI.getOperand(1)),
+            "First argument to llvm.pcmarker must be a constant!", &CI);
+    break;
  
   case Intrinsic::not_intrinsic: 
     assert(0 && "Invalid intrinsic!"); NumArgs = 0; break;