From 7f4ec3b2e3157e6a0798f3e95a3961bfa6ef66b6 Mon Sep 17 00:00:00 2001 From: Andrew Lenharth Date: Mon, 28 Mar 2005 20:05:49 +0000 Subject: [PATCH] First step in adding pcmarker intrinsic. Second step (soon) is adding backend support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20900 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 41 +++++++++++++++++++++++++++++++ include/llvm/Intrinsics.h | 1 + lib/CodeGen/IntrinsicLowering.cpp | 3 +++ lib/VMCore/Function.cpp | 1 + lib/VMCore/Verifier.cpp | 5 ++++ 5 files changed, 51 insertions(+) diff --git a/docs/LangRef.html b/docs/LangRef.html index 807c7515b49..b7bbac34c9e 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -126,6 +126,7 @@
  • 'llvm.returnaddress' Intrinsic
  • 'llvm.frameaddress' Intrinsic
  • 'llvm.prefetch' Intrinsic
  • +
  • 'llvm.pcmarker' Intrinsic
  • Operating System Intrinsics @@ -2548,6 +2549,46 @@ performance. + + + +
    + +
    Syntax:
    +
    +  call void (uint)* %llvm.pcmarker( uint <id> )
    +
    + +
    Overview:
    + + +

    +The 'llvm.pcmarker' 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. +

    + +
    Arguments:
    + +

    +id is a numerical id identifying the marker. +

    + +
    Semantics:
    + +

    +This intrinsic does not modify the behavior of the program. Backends that do not +support this intrinisic may ignore it. +

    + +
    +
    diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h index fe3c7867ad4..e0a8dd7954e 100644 --- a/include/llvm/Intrinsics.h +++ b/include/llvm/Intrinsics.h @@ -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 diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 3633f966f90..b665557d2bb 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -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: diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index df8d1f904f3..b883e07ddf6 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -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; diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 89fd98081fa..3964817f820 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -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(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; -- 2.34.1