[PATCH] [LayoutPass] Add a method to check the followon graph structure.

Rui Ueyama ruiu at google.com
Thu Jun 6 21:33:17 PDT 2013


  I don't think we can make this a pass, because followon chain is constructed and consumed by LayoutPass. If there's a cycle in the graph, buildOrdinalOverrideMap will get into an infinite loop, so there's no chance for later passes to detect such error.


================
Comment at: lib/Passes/LayoutPass.cpp:409-413
@@ +408,7 @@
+  llvm::raw_string_ostream s(str);
+  if (definedAtom->name().empty()) {
+    s << "<anonymous " << definedAtom << ">";
+  } else {
+    s << definedAtom->name();
+  }
+  s << " in ";
----------------
Shankar Kalpathi Easwaran wrote:
> no need of empty braces.
done

================
Comment at: lib/Passes/LayoutPass.cpp:415-419
@@ +414,7 @@
+  s << " in ";
+  if (definedAtom->customSectionName().empty()) {
+    s << "<anonymous>";
+  } else {
+    s << definedAtom->customSectionName();
+  }
+  s.flush();
----------------
Shankar Kalpathi Easwaran wrote:
> same here.
done

================
Comment at: lib/Passes/LayoutPass.cpp:405-408
@@ +404,6 @@
+
+std::string atomToDebugString(const Atom *atom) {
+  const DefinedAtom *definedAtom = llvm::dyn_cast<DefinedAtom>(atom);
+  std::string str;
+  llvm::raw_string_ostream s(str);
+  if (definedAtom->name().empty()) {
----------------
Shankar Kalpathi Easwaran wrote:
> should these be changed to StringRef ?
Is there any easy way to stringize a pointer? I wanted to print out an anonymous atom with its location in memory so one can easily identify. With iostream, it's as easy as just "<< ptr".

================
Comment at: lib/Passes/LayoutPass.cpp:461
@@ +460,3 @@
+  if (i == followOnRoots.end()) {
+    std::string msg = "Atom <" + atomToDebugString(atom)
+        + "> has no follow-on root!";
----------------
Shankar Kalpathi Easwaran wrote:
> Same here, you could StringRef and twine.
Like this? Looks like Twine is a rope-like data structure but for this short string is this efficient than std::string::append()?


http://llvm-reviews.chandlerc.com/D922



More information about the llvm-commits mailing list