Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -628,12 +628,15 @@ /// EmitFunctionHeader - This method emits the header for the current /// function. void AsmPrinter::EmitFunctionHeader() { - // Print out constants referenced by the function - EmitConstantPool(); - // Print the 'header' of function. const Function *F = MF->getFunction(); + if (isVerbose()) + OutStreamer->GetCommentOS() << "-- Begin " << F->getName() << '\n'; + + // Print out constants referenced by the function + EmitConstantPool(); + OutStreamer->SwitchSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitVisibility(CurrentFnSym, F->getVisibility()); @@ -1107,6 +1110,9 @@ HI.Handler->endFunction(MF); } + if (isVerbose()) + OutStreamer->GetCommentOS() << "-- End " << F->getName() << '\n'; + OutStreamer->AddBlankLine(); } Index: test/CodeGen/AArch64/arm64-misched-multimmo.ll =================================================================== --- test/CodeGen/AArch64/arm64-misched-multimmo.ll +++ test/CodeGen/AArch64/arm64-misched-multimmo.ll @@ -1,5 +1,5 @@ ; REQUIRES: asserts -; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -enable-misched=0 -debug-only=misched -o - 2>&1 > /dev/null | FileCheck %s +; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -enable-misched=0 -debug-only=misched -asm-verbose=false -o - 2>&1 > /dev/null | FileCheck %s @G1 = common global [100 x i32] zeroinitializer, align 4 Index: test/CodeGen/AArch64/asm-print-comments.ll =================================================================== --- /dev/null +++ test/CodeGen/AArch64/asm-print-comments.ll @@ -0,0 +1,15 @@ +; RUN: llc %s -mtriple=arm64-apple-darwin -o - | FileCheck %s + +; CHECK: ; -- Begin foo +define hidden i32 @foo() { + entry: + ret i32 30 +} +; CHECK: ; -- End foo + +; CHECK: ; -- Begin bar +define i32 @bar() { + entry: + ret i32 30 +} +; CHECK: ; -- End bar Index: test/CodeGen/ARM/fastisel-thumb-litpool.ll =================================================================== --- test/CodeGen/ARM/fastisel-thumb-litpool.ll +++ test/CodeGen/ARM/fastisel-thumb-litpool.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=thumbv7-apple-ios -O0 -o - %s | FileCheck %s +; RUN: llc -mtriple=thumbv7-apple-ios -O0 -asm-verbose=false -o - %s | FileCheck %s ; We used to accidentally create both an ARM and a Thumb ldr here. It led to an ; assertion failure at the time, but could go all the way through to emission, Index: test/CodeGen/ARM/ldrd.ll =================================================================== --- test/CodeGen/ARM/ldrd.ll +++ test/CodeGen/ARM/ldrd.ll @@ -1,11 +1,11 @@ -; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=fast -optimize-regalloc=0 -verify-machineinstrs | FileCheck %s -check-prefix=A8 -check-prefix=CHECK -check-prefix=NORMAL -; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-m3 -regalloc=fast -optimize-regalloc=0 | FileCheck %s -check-prefix=M3 -check-prefix=CHECK -check-prefix=NORMAL +; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=fast -optimize-regalloc=0 -verify-machineinstrs -asm-verbose=false | FileCheck %s -check-prefix=A8 -check-prefix=CHECK -check-prefix=NORMAL +; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-m3 -regalloc=fast -optimize-regalloc=0 -asm-verbose=false | FileCheck %s -check-prefix=M3 -check-prefix=CHECK -check-prefix=NORMAL ; rdar://6949835 -; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=basic | FileCheck %s -check-prefix=BASIC -check-prefix=CHECK -check-prefix=NORMAL -; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=greedy | FileCheck %s -check-prefix=GREEDY -check-prefix=CHECK -check-prefix=NORMAL -; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=swift | FileCheck %s -check-prefix=SWIFT -check-prefix=CHECK -check-prefix=NORMAL +; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=basic -asm-verbose=false | FileCheck %s -check-prefix=BASIC -check-prefix=CHECK -check-prefix=NORMAL +; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -regalloc=greedy -asm-verbose=false | FileCheck %s -check-prefix=GREEDY -check-prefix=CHECK -check-prefix=NORMAL +; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=swift -asm-verbose=false | FileCheck %s -check-prefix=SWIFT -check-prefix=CHECK -check-prefix=NORMAL -; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-assume-misaligned-load-store | FileCheck %s -check-prefix=CHECK -check-prefix=CONSERVATIVE +; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-assume-misaligned-load-store -asm-verbose=false | FileCheck %s -check-prefix=CHECK -check-prefix=CONSERVATIVE ; Magic ARM pair hints works best with linearscan / fast. Index: test/CodeGen/X86/fast-isel-select-cmp.ll =================================================================== --- test/CodeGen/X86/fast-isel-select-cmp.ll +++ test/CodeGen/X86/fast-isel-select-cmp.ll @@ -3,8 +3,8 @@ ; Test if we do not fold the cmp into select if the instructions are in ; different basic blocks. -define i32 @select_cmp_cmov_i32(i32 %a, i32 %b) { -; CHECK-LABEL: select_cmp_cmov_i32 +define i32 @select_CMP_cmov_i32(i32 %a, i32 %b) { +; CHECK-LABEL: select_CMP_cmov_i32 ; CHECK-LABEL: continue ; CHECK-NOT: cmp %1 = icmp ult i32 %a, %b @@ -18,8 +18,8 @@ ret i32 -1 } -define float @select_fcmp_oeq_f32(float %a, float %b, float %c, float %d) { -; CHECK-LABEL: select_fcmp_oeq_f32 +define float @select_FCMP_oeq_f32(float %a, float %b, float %c, float %d) { +; CHECK-LABEL: select_FCMP_oeq_f32 ; CHECK-LABEL: continue ; CHECK-NOT: cmp %1 = fcmp oeq float %a, %b @@ -33,8 +33,8 @@ ret float -1.0 } -define float @select_fcmp_one_f32(float %a, float %b, float %c, float %d) { -; CHECK-LABEL: select_fcmp_one_f32 +define float @select_FCMP_one_f32(float %a, float %b, float %c, float %d) { +; CHECK-LABEL: select_FCMP_one_f32 ; CHECK-LABEL: continue ; CHECK-NOT: ucomi %1 = fcmp one float %a, %b Index: test/CodeGen/XCore/epilogue_prologue.ll =================================================================== --- test/CodeGen/XCore/epilogue_prologue.ll +++ test/CodeGen/XCore/epilogue_prologue.ll @@ -1,5 +1,5 @@ -; RUN: llc < %s -march=xcore | FileCheck %s -; RUN: llc < %s -march=xcore -disable-fp-elim | FileCheck %s -check-prefix=CHECKFP +; RUN: llc < %s -march=xcore -asm-verbose=false | FileCheck %s +; RUN: llc < %s -march=xcore -disable-fp-elim -asm-verbose=false | FileCheck %s -check-prefix=CHECKFP ; When using SP for small frames, we don't need any scratch registers (SR). ; When using SP for large frames, we may need two scratch registers. Index: utils/abtest/abtest.py =================================================================== --- utils/abtest/abtest.py +++ utils/abtest/abtest.py @@ -11,8 +11,8 @@ # in each step replacing one of them with a file from the "bad" directory. # # Additionally you can perform the same steps with a single .s file. In this -# mode functions are identified by "# -- Begin FunctionName" and -# "# -- End FunctionName" markers. The abtest.py then takes all functions from +# mode functions are identified by "; -- Begin FunctionName" and +# "; -- End FunctionName" markers. The abtest.py then takes all functions from # the file in the "before" directory and replaces one function with the # corresponding function from the "bad" file in each step. # @@ -70,21 +70,27 @@ functions = [] in_function = None for line in open(file): - if line.startswith("# -- Begin "): + marker = line.find("; -- Begin ") + if marker != -1: if in_function != None: warn("Missing end of function %s" % (in_function,)) - funcname = line[12:-1] + funcname = line[marker + 11:-1] in_function = funcname text = line - elif line.startswith("# -- End "): - function_name = line[10:-1] + continue + + marker = line.find("; -- End ") + if marker != -1: + function_name = line[marker + 9:-1] if in_function != function_name: warn("End %s does not match begin %s" % (function_name, in_function)) else: text += line functions.append( (in_function, text) ) in_function = None - elif in_function != None: + continue + + if in_function != None: text += line return functions @@ -94,22 +100,26 @@ found = False in_function = None for line in open(file): - if line.startswith("# -- Begin "): + marker = line.find("; -- Begin ") + if marker != -1: if in_function != None: warn("Missing end of function %s" % (in_function,)) - funcname = line[12:-1] + funcname = line[marker + 11:-1] in_function = funcname if in_function == function: out.write(replacement) skip = True - elif line.startswith("# -- End "): - function_name = line[10:-1] - if in_function != function_name: - warn("End %s does not match begin %s" % (function_name, in_function)) - in_function = None - if skip: - skip = False - continue + else: + marker = line.find("; -- End ") + if marker != -1: + function_name = line[marker + 9:-1] + if in_function != function_name: + warn("End %s does not match begin %s" % (function_name, in_function)) + in_function = None + if skip: + skip = False + continue + if not skip: out.write(line) Index: utils/abtest/mark_aarch64fns.py =================================================================== --- utils/abtest/mark_aarch64fns.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -# Mark functions in an arm assembly file. This is done by surrounding the -# function with "# -- Begin Name" and "# -- End Name" -# (This script is designed for aarch64 ios assembly syntax) -import sys -import re - -inp = open(sys.argv[1], "r").readlines() - -# First pass -linenum = 0 -INVALID=-100 -last_align = INVALID -last_code = INVALID -last_globl = INVALID -last_globl_name = None -begin = INVALID -in_text_section = False -begins = dict() -for line in inp: - linenum += 1 - if re.search(r'.section\s+__TEXT,__text,regular,pure_instructions', line): - in_text_section = True - continue - elif ".section" in line: - in_text_section = False - continue - - if not in_text_section: - continue - - if ".align" in line: - last_align = linenum - 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) - if m and begin == INVALID: - labelname = m.group(1) - if last_globl+2 == linenum and last_globl_name == labelname: - begin = last_globl - funcname = labelname - if line == "\n" and begin != INVALID: - end = linenum - triple = (funcname, begin, end) - begins[begin] = triple - begin = INVALID - -# Second pass: Mark -out = open(sys.argv[1], "w") -in_func = None -linenum = 0 -for line in inp: - linenum += 1 - if in_func is not None and linenum == end: - out.write("# -- End %s\n" % in_func) - in_func = None - - triple = begins.get(linenum) - if triple is not None: - in_func, begin, end = triple - out.write("# -- Begin %s\n" % in_func) - out.write(line) Index: utils/abtest/mark_armfns.py =================================================================== --- utils/abtest/mark_armfns.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# -# Mark functions in an arm assembly file. This is done by surrounding the -# function with "# -- Begin Name" and "# -- End Name" -# (This script is designed for arm ios assembly syntax) -import sys -import re - -inp = open(sys.argv[1], "r").readlines() - -# First pass -linenum = 0 -INVALID=-100 -last_align = INVALID -last_code = INVALID -last_globl = INVALID -begin = INVALID -begins = dict() -for line in inp: - linenum += 1 - if ".align" in line: - last_align = linenum - if ".code" in line: - last_code = linenum - if ".globl" in line: - last_globl = linenum - m = re.search(r'.thumb_func\s+(\w+)', line) - if m: - funcname = m.group(1) - if last_code == last_align+1 and (linenum - last_code) < 4: - begin = last_align - if last_globl+1 == last_align: - begin = last_globl - if line == "\n" and begin != INVALID: - end = linenum - triple = (funcname, begin, end) - begins[begin] = triple - begin = INVALID - -# Second pass: Mark -out = open(sys.argv[1], "w") -in_func = None -linenum = 0 -for line in inp: - linenum += 1 - if in_func is not None and linenum == end: - out.write("# -- End %s\n" % in_func) - in_func = None - - triple = begins.get(linenum) - if triple is not None: - in_func, begin, end = triple - out.write("# -- Begin %s\n" % in_func) - out.write(line)