[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td

Andrew Lenharth alenhar2 at cs.uiuc.edu
Mon Jun 6 12:04:14 PDT 2005



Changes in directory llvm/lib/Target/Alpha:

AlphaISelPattern.cpp updated: 1.119 -> 1.120
AlphaInstrInfo.td updated: 1.42 -> 1.43
---
Log message:

allow marking of loads and stores in the instruction stream with enough information to reconstruct the Value* if it existed

---
Diffs of the changes:  (+31 -0)

 AlphaISelPattern.cpp |   30 ++++++++++++++++++++++++++++++
 AlphaInstrInfo.td    |    1 +
 2 files changed, 31 insertions(+)


Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.119 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.120
--- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.119	Mon Jun  6 12:39:46 2005
+++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp	Mon Jun  6 14:03:55 2005
@@ -45,6 +45,9 @@
   cl::opt<bool> EnableAlphaCount("enable-alpha-count",
                              cl::desc("Print estimates on live ins and outs"),
                              cl::Hidden);
+  cl::opt<bool> EnableAlphaLSMark("enable-alpha-lsmark",
+                             cl::desc("Emit symbols to corrolate Mem ops to LLVM Values"),
+                             cl::Hidden);
 }
 
 namespace {
@@ -514,6 +517,27 @@
   }
 }
 
+//Find the offset of the arg in it's parent's function
+static int getValueOffset(const Value* v)
+{
+  if (v == NULL)
+    return 0;
+
+  const Instruction* itarget = dyn_cast<Instruction>(v);
+  const BasicBlock* btarget = itarget->getParent();
+  const Function* ftarget = btarget->getParent();
+
+  //offset due to earlier BBs
+  int i = 0;
+  for(Function::const_iterator ii = ftarget->begin(); &*ii != btarget; ++ii)
+    i += ii->size();
+
+  for(BasicBlock::const_iterator ii = btarget->begin(); &*ii != itarget; ++ii)
+    ++i;
+
+  return i;
+}
+
 //Factorize a number using the list of constants
 static bool factorize(int v[], int res[], int size, uint64_t c)
 {
@@ -1119,6 +1143,12 @@
       Select(Chain);
       Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS;
 
+      if (EnableAlphaLSMark)
+      {
+        int i = getValueOffset(dyn_cast<SrcValueSDNode>(N.getOperand(2))->getValue());
+        BuildMI(BB, Alpha::MEMLABEL, 2).addImm(i);
+      }
+      
       if (Address.getOpcode() == ISD::GlobalAddress) {
         AlphaLowering.restoreGP(BB);
         Opc = GetSymVersion(Opc);


Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td
diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.42 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.43
--- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.42	Tue May  3 12:19:29 2005
+++ llvm/lib/Target/Alpha/AlphaInstrInfo.td	Mon Jun  6 14:03:55 2005
@@ -31,6 +31,7 @@
 def ADJUSTSTACKDOWN : PseudoInstAlpha<(ops ), "ADJDOWN">;
 def ALTENT : PseudoInstAlpha<(ops s64imm:$TARGET), "$TARGET:\n">;
 def PCLABEL : PseudoInstAlpha<(ops s64imm:$num), "PCMARKER_$num:\n">;
+def MEMLABEL : PseudoInstAlpha<(ops s64imm:$i), "LSMARKER_$i:\n">;
 
 //*****************
 //These are shortcuts, the assembler expands them






More information about the llvm-commits mailing list