[PATCH] D99313: [lld-macho] Fix parsing of --time-trace-{granularity,file}
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 26 15:14:35 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG94e369400e53: [lld-macho] Fix parsing of --time-trace-{granularity,file} (authored by int3).
Changed prior to commit:
https://reviews.llvm.org/D99313?vs=333214&id=333642#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99313/new/
https://reviews.llvm.org/D99313
Files:
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/test/MachO/time-trace.s
Index: lld/test/MachO/time-trace.s
===================================================================
--- lld/test/MachO/time-trace.s
+++ lld/test/MachO/time-trace.s
@@ -1,20 +1,20 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
# Test implicit trace file name
-# RUN: ld.lld --time-trace --time-trace-granularity=0 -o %t1.macho %t.o
+# RUN: %lld --time-trace --time-trace-granularity=0 -o %t1.macho %t.o
# RUN: cat %t1.macho.time-trace \
# RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
# RUN: | FileCheck %s
# Test specified trace file name
-# RUN: ld.lld --time-trace --time-trace-file=%t2.json --time-trace-granularity=0 -o %t2.macho %t.o
+# RUN: %lld --time-trace --time-trace-file=%t2.json --time-trace-granularity=0 -o %t2.macho %t.o
# RUN: cat %t2.json \
# RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
# RUN: | FileCheck %s
# Test trace requested to stdout
-# RUN: ld.lld --time-trace --time-trace-file=- --time-trace-granularity=0 -o %t3.macho %t.o \
+# RUN: %lld --time-trace --time-trace-file=- --time-trace-granularity=0 -o %t3.macho %t.o \
# RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
# RUN: | FileCheck %s
@@ -33,10 +33,10 @@
# CHECK: "name": "ExecuteLinker"
# Check process_name entry field
-# CHECK: "name": "ld.lld{{(.exe)?}}"
+# CHECK: "name": "ld64.lld{{(.exe)?}}"
# CHECK: "name": "process_name"
# CHECK: "name": "thread_name"
-.globl _start
-_start:
+.globl _main
+_main:
ret
Index: lld/MachO/Options.td
===================================================================
--- lld/MachO/Options.td
+++ lld/MachO/Options.td
@@ -39,9 +39,9 @@
HelpText<"Use the new pass manager in LLVM">,
Group<grp_lld>;
def time_trace: Flag<["--"], "time-trace">, HelpText<"Record time trace">;
-def time_trace_granularity: Flag<["--"], "time-trace-granularity">,
+def time_trace_granularity_eq: Joined<["--"], "time-trace-granularity=">,
HelpText<"Minimum time granularity (in microseconds) traced by time profiler">;
-def time_trace_file_eq: Flag<["--"], "time-trace-file=">, HelpText<"Specify time trace output file">;
+def time_trace_file_eq: Joined<["--"], "time-trace-file=">, HelpText<"Specify time trace output file">;
// This is a complete Options.td compiled from Apple's ld(1) manpage
// dated 2018-03-07 and cross checked with ld64 source code in repo
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -998,13 +998,15 @@
config->progName = argsArr[0];
config->timeTraceEnabled = args.hasArg(OPT_time_trace);
+ config->timeTraceGranularity =
+ args::getInteger(args, OPT_time_trace_granularity_eq, 500);
// Initialize time trace profiler.
if (config->timeTraceEnabled)
timeTraceProfilerInitialize(config->timeTraceGranularity, config->progName);
{
- TimeTraceScope timeScope("Link", StringRef("ExecuteLinker"));
+ TimeTraceScope timeScope("ExecuteLinker");
initLLVM(); // must be run before any call to addFile()
createFiles(args);
Index: lld/MachO/Config.h
===================================================================
--- lld/MachO/Config.h
+++ lld/MachO/Config.h
@@ -86,7 +86,7 @@
uint32_t headerPad;
uint32_t dylibCompatibilityVersion = 0;
uint32_t dylibCurrentVersion = 0;
- uint32_t timeTraceGranularity = 0;
+ uint32_t timeTraceGranularity = 500;
std::string progName;
llvm::StringRef installName;
llvm::StringRef mapFile;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99313.333642.patch
Type: text/x-patch
Size: 3798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210326/0d02f654/attachment.bin>
More information about the llvm-commits
mailing list