[PATCH] Emit comment for gc.relocate's showing base and derived pointers in human readable form

Igor Laevsky igor at azulsystems.com
Tue Apr 28 09:30:13 PDT 2015


Hi reames,

In AsmWriter emit comment for gc.relocate showing base and derived pointer in human readable form. This is a lot more convenient than looking just at the indexes in this call.

Example: %67 = call float addrspace(1)* @llvm.experimental.gc.relocate.p1f32(i32 %sp, i32 40, i32 31) ; (%base, %derived)

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9326

Files:
  lib/IR/AsmWriter.cpp

Index: lib/IR/AsmWriter.cpp
===================================================================
--- lib/IR/AsmWriter.cpp
+++ lib/IR/AsmWriter.cpp
@@ -31,6 +31,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/Statepoint.h"
 #include "llvm/IR/TypeFinder.h"
 #include "llvm/IR/UseListOrder.h"
 #include "llvm/IR/ValueSymbolTable.h"
@@ -2970,6 +2971,18 @@
   I.getAllMetadata(InstMD);
   printMetadataAttachments(InstMD, ", ");
 
+  // Print additional comment for gc.statepoint relocates in a form of
+  // "; (<base pointer>, <derived pointer>)"
+  if (isGCRelocate(&I)) {
+    GCRelocateOperands GCOps(&I);
+
+    Out << " ; (";
+    writeOperand(GCOps.basePtr(), false);
+    Out << ", ";
+    writeOperand(GCOps.derivedPtr(), false);
+    Out << ")";
+  }
+
   // Print a nice comment.
   printInfoComment(I);
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9326.24558.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150428/3720bd7f/attachment.bin>


More information about the llvm-commits mailing list