[PATCH] D93348: llvm-profgen: Parse command line arguments after initializing targets
    Tom Stellard via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Dec 15 15:14:00 PST 2020
    
    
  
tstellar created this revision.
tstellar added reviewers: wenlei, wmi, wlei.
tstellar requested review of this revision.
Herald added a project: LLVM.
I am experimenting with turning backends into loadable modules and in
that scenario, target specific command line arguments won't be available
until after the targets are initialized.
Also, most other tools initialize targets before parsing arguments.
Repository:
  rG LLVM Github Monorepo
https://reviews.llvm.org/D93348
Files:
  llvm/tools/llvm-profgen/llvm-profgen.cpp
Index: llvm/tools/llvm-profgen/llvm-profgen.cpp
===================================================================
--- llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -35,13 +35,13 @@
 int main(int argc, const char *argv[]) {
   InitLLVM X(argc, argv);
 
-  cl::ParseCommandLineOptions(argc, argv, "llvm SPGO profile generator\n");
-
   // Initialize targets and assembly printers/parsers.
   InitializeAllTargetInfos();
   InitializeAllTargetMCs();
   InitializeAllDisassemblers();
 
+  cl::ParseCommandLineOptions(argc, argv, "llvm SPGO profile generator\n");
+
   // Load binaries and parse perf events and samples
   PerfReader Reader(BinaryFilenames);
   Reader.parsePerfTraces(PerfTraceFilenames);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93348.312050.patch
Type: text/x-patch
Size: 746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201215/90579eac/attachment.bin>
    
    
More information about the llvm-commits
mailing list