PCMarker support for DAG and Alpha
authorAndrew Lenharth <andrewl@lenharth.org>
Thu, 31 Mar 2005 21:24:06 +0000 (21:24 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Thu, 31 Mar 2005 21:24:06 +0000 (21:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20965 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Target/Alpha/AlphaISelPattern.cpp
lib/Target/Alpha/AlphaInstrInfo.td

index 455d91a36a8729e35c12b5781e9af20100cc99da..80c9428f0d37ce74742f1379ea29072fb6906324 100644 (file)
@@ -225,6 +225,8 @@ namespace ISD {
     ADJCALLSTACKDOWN,  // Beginning of a call sequence
     ADJCALLSTACKUP,    // End of a call sequence
 
+    // PCMARKER - This corrosponds to the pcmarker intrinsic.
+    PCMARKER,
 
     // BUILTIN_OP_END - This must be the last enum value in this list.
     BUILTIN_OP_END,
index 576232540e983e6b817cf73828402ec8666157e1..5f8a21aca0f73d58378dbb61143789f0316261ff 100644 (file)
@@ -552,6 +552,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       break;
     }
     break;
+  case ISD::PCMARKER:
+    Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
+    Result = DAG.getNode(ISD::PCMARKER, MVT::Other, Tmp1, Node->getOperand(1));
+    break;
   case ISD::TRUNCSTORE:
     Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
     Tmp3 = LegalizeOp(Node->getOperand(2));  // Legalize the pointer.
index d4804d98227285d4a38939f4920ea361d2241e04..edc5b8c6f5eb8ac66d158ad25bd9f9c46e2977c7 100644 (file)
@@ -1099,6 +1099,7 @@ bool SDNode::hasNUsesOfValue(unsigned NUses, unsigned Value) {
 const char *SDNode::getOperationName() const {
   switch (getOpcode()) {
   default: return "<<Unknown>>";
+  case ISD::PCMARKER:      return "PCMarker";
   case ISD::EntryToken:    return "EntryToken";
   case ISD::TokenFactor:   return "TokenFactor";
   case ISD::Constant:      return "Constant";
index 9871cb32c165466c9c84cb995ee8a79d4de6bb18..75352982034de2779d078dbd98046c5332ab2e12 100644 (file)
@@ -662,6 +662,12 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
       setValue(&I, DAG.getSetCC(ISD::SETUO, MVT::i1, getValue(I.getOperand(1)),
                                 getValue(I.getOperand(2))));
       return;
+    case Intrinsic::pcmarker: {
+      SDOperand Num = getValue(I.getOperand(1));
+      DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Num));
+      return;
+    }
+
     }
   
   SDOperand Callee;
index 3a86a39f77f45acd199a4bfdfc25f3d9f294f099..d7df75bde1195563e6df2ba9ff084b257e811a9e 100644 (file)
 #include "llvm/Support/MathExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/CommandLine.h"
 #include <set>
 #include <algorithm>
 using namespace llvm;
 
+namespace llvm {
+  cl::opt<bool> EnableAlphaIDIV("enable-alpha-intfpdiv", 
+                             cl::desc("Use the FP div instruction for integer div when possible"), 
+                             cl::Hidden);
+  cl::opt<bool> EnableAlpha("enable-alpha-ftoi", 
+                             cl::desc("Enablue use of ftoi* and itof* instructions (ev6 and higher)"), 
+                             cl::Hidden);
+}
+
 //===----------------------------------------------------------------------===//
 //  AlphaTargetLowering - Alpha Implementation of the TargetLowering interface
 namespace {
@@ -1697,6 +1707,11 @@ void ISel::Select(SDOperand N) {
       Alpha::ADJUSTSTACKUP;
     BuildMI(BB, Opc, 1).addImm(Tmp1);
     return;
+
+  case ISD::PCMARKER:
+    Select(N.getOperand(0)); //Chain
+    BuildMI(BB, Alpha::PCLABEL, 2).addImm( cast<ConstantSDNode>(N.getOperand(1))->getValue());
+    return;
   }
   assert(0 && "Should not be reached!");
 }
index 7789a10f3a46e89fad5f1607d0ab0a8b90e50b6e..0cd20dd8f9447bbbaab6b7c515bfc9f9faa0913e 100644 (file)
@@ -30,6 +30,8 @@ def WTF : PseudoInstAlpha<(ops ), "#wtf">;
 def ADJUSTSTACKUP : PseudoInstAlpha<(ops ), "ADJUP">;
 def ADJUSTSTACKDOWN : PseudoInstAlpha<(ops ), "ADJDOWN">;
 
+def PCLABEL : PseudoInstAlpha<(ops s64imm:$num), "PCMARKER_$num:\n">;
+
 //*****************
 //These are shortcuts, the assembler expands them
 //*****************