[PATCH] D33297: abtest: aarch64: handle static functions

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 13:54:29 PDT 2017


thegameg created this revision.
Herald added subscribers: javed.absar, rengolin, aemerson.

https://reviews.llvm.org/D33297

Files:
  utils/abtest/mark_aarch64fns.py


Index: utils/abtest/mark_aarch64fns.py
===================================================================
--- utils/abtest/mark_aarch64fns.py
+++ utils/abtest/mark_aarch64fns.py
@@ -30,18 +30,38 @@
     if not in_text_section:
         continue
 
-    if ".align" in line:
-        last_align = linenum
-    gl = re.search(r'.globl\s+(\w+)', line)
+    # We are now looking for something similar to this:
+    # .globl _func_name
+    # .p2align 2
+    # _func_name:                                           ; @func_name
+
+    # Look for .globl. This is optional.
+    gl = re.search(r'.globl\s+(\w+)$', line)
     if gl:
         last_globl_name = gl.group(1)
         last_globl = linenum
-    m = re.search(r'^(\w+):', line)
+
+    # Look for .align or .p2align. This is mandatory.
+    al = re.search(r'.(p2)?align\s+\d+$', line)
+    if al:
+        last_align = linenum
+
+    # Now look for the label. It should be followed by a comment of this form:
+    # _func_name:  ; @func_name
+    # The _ is darwin specific, so we're skipping it.
+    m = re.search(r'^(\w+):\s+; @(\w+)$', line)
     if m and begin == INVALID:
-        labelname = m.group(1)
-        if last_globl+2 == linenum and last_globl_name == labelname:
-            begin = last_globl
+        labelname = m.group(1)[1:] # Skip the _ in front of the label.
+        commentname = m.group(2)
+        if labelname == commentname:
+            if last_globl == linenum - 2:
+                begin = linenum - 2
+            elif last_align == linenum - 1:
+                begin = linenum - 1
+            else:
+                raise Exception('No .(p2)align or .globl directives.')
             funcname = labelname
+
     if line == "\n" and begin != INVALID:
         end = linenum
         triple = (funcname, begin, end)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33297.99345.patch
Type: text/x-patch
Size: 1804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170517/83fd4bde/attachment.bin>


More information about the llvm-commits mailing list