summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt-viewer/optrecord.py
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-12-06 16:50:50 +0000
committerAdam Nemet <anemet@apple.com>2017-12-06 16:50:50 +0000
commit9e5e51aeed06226552f2d89624a2570bdc4e80ad (patch)
tree2faa3e76090f6fef0ec87685cf2c80eff8a11f6a /llvm/tools/opt-viewer/optrecord.py
parent7d37dd8902e8ef8583cdbbe906eda8435426c996 (diff)
downloadbcm5719-llvm-9e5e51aeed06226552f2d89624a2570bdc4e80ad.tar.gz
bcm5719-llvm-9e5e51aeed06226552f2d89624a2570bdc4e80ad.zip
[opt-viewer] Suppress noisy Swift remarks
Most likely, this is not how we want to handle this in the long term. This code should probably be in the Swift repo and somehow plugged into the opt-viewer. This is still however very experimental at this point so I don't want to over-engineer it at this point. llvm-svn: 319902
Diffstat (limited to 'llvm/tools/opt-viewer/optrecord.py')
-rw-r--r--llvm/tools/opt-viewer/optrecord.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py
index ce665299e17..2256b4dd243 100644
--- a/llvm/tools/opt-viewer/optrecord.py
+++ b/llvm/tools/opt-viewer/optrecord.py
@@ -161,6 +161,32 @@ class Remark(yaml.YAMLObject):
else:
return value
+ # Return a cached dictionary for the arguments. The key for each entry is
+ # the argument key (e.g. 'Callee' for inlining remarks. The value is a
+ # list containing the value (e.g. for 'Callee' the function) and
+ # optionally a DebugLoc.
+ def getArgDict(self):
+ if hasattr(self, 'ArgDict'):
+ return self.ArgDict
+ self.ArgDict = {}
+ for arg in self.Args:
+ if len(arg) == 2:
+ if arg[0][0] == 'DebugLoc':
+ dbgidx = 0
+ else:
+ assert(arg[1][0] == 'DebugLoc')
+ dbgidx = 1
+
+ key = arg[1 - dbgidx][0]
+ entry = (arg[1 - dbgidx][1], arg[dbgidx][1])
+ else:
+ arg = arg[0]
+ key = arg[0]
+ entry = (arg[1], )
+
+ self.ArgDict[key] = entry
+ return self.ArgDict
+
def getDiffPrefix(self):
if hasattr(self, 'Added'):
if self.Added:
OpenPOWER on IntegriCloud