[llvm-commits] CVS: llvm-tv/tools/llvm-tv/CodeViewer.cpp
Misha Brukman
brukman at cs.uiuc.edu
Wed Apr 20 12:01:39 PDT 2005
Changes in directory llvm-tv/tools/llvm-tv:
CodeViewer.cpp updated: 1.10 -> 1.11
---
Log message:
Per Chris' request, highlight definitions of operands in green.
---
Diffs of the changes: (+17 -2)
CodeViewer.cpp | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
Index: llvm-tv/tools/llvm-tv/CodeViewer.cpp
diff -u llvm-tv/tools/llvm-tv/CodeViewer.cpp:1.10 llvm-tv/tools/llvm-tv/CodeViewer.cpp:1.11
--- llvm-tv/tools/llvm-tv/CodeViewer.cpp:1.10 Tue Oct 5 13:44:44 2004
+++ llvm-tv/tools/llvm-tv/CodeViewer.cpp Wed Apr 20 14:01:26 2005
@@ -69,7 +69,9 @@
// Populate it with BasicBlocks and Instructions from F.
for (Function::iterator BB = F->begin(), BBe = F->end(); BB != BBe; ++BB) {
- itemList.push_back(new TVCodeItem(BB));
+ TVCodeItem *TCBB = new TVCodeItem(BB);
+ itemList.push_back(TCBB);
+ ValueToItem[BB] = TCBB;
for (BasicBlock::iterator I = BB->begin(), Ie = BB->end(); I != Ie; ++I) {
TVCodeItem *TCI = new TVCodeItem(I);
itemList.push_back(TCI);
@@ -107,9 +109,15 @@
Value *V = itemList[event.GetIndex ()]->getValue();
if (!V) return;
- // Highlight uses
+ // Highlight uses in red
for (User::use_iterator u = V->use_begin(), e = V->use_end(); u != e; ++u)
changeItemTextAttrs (ValueToItem[*u], wxRED, wxBOLD);
+
+ // Highlight definitions of operands in green
+ if (User *U = dyn_cast<User>(V))
+ for (User::op_iterator op = U->op_begin(), e = U->op_end(); op != e; ++op)
+ if (TVCodeItem *TCI = ValueToItem[*op])
+ changeItemTextAttrs (TCI, wxGREEN, wxBOLD);
}
void TVCodeListCtrl::OnItemDeselected(wxListEvent &event) {
@@ -119,6 +127,13 @@
// Set uses back to normal
for (User::use_iterator u = V->use_begin(), e = V->use_end(); u != e; ++u)
changeItemTextAttrs (ValueToItem[*u], wxBLACK, wxNORMAL);
+
+ // Set definitions of operands back to normal
+ if (User *U = dyn_cast<User>(V))
+ for (User::op_iterator op = U->op_begin(), e = U->op_end(); op != e; ++op)
+ if (TVCodeItem *TCI = ValueToItem[*op])
+ changeItemTextAttrs (ValueToItem[*op], wxBLACK, wxNORMAL);
+
}
BEGIN_EVENT_TABLE (TVCodeListCtrl, wxListCtrl)
More information about the llvm-commits
mailing list