[PATCH] D120568: [flang][driver] Add support for -S and implement -c/-emit-obj

Eric Schweitz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 09:00:48 PST 2022


schweitz added inline comments.


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:43
 using namespace Fortran::frontend;
+using namespace llvm;
 
----------------
You'll want to keep in mind that some class names are overloaded between llvm and Fortran::xyz namespaces and even between Fortran::uvw and Fortran::xyz namespaces.


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:506
+  std::string error;
+  std::string theTriple = llvmModule->getTargetTriple();
+  const llvm::Target *theTarget =
----------------



================
Comment at: flang/lib/Frontend/FrontendActions.cpp:516
+  llvmModule->setDataLayout(TM->createDataLayout());
+  assert(TM && "Failed to create TargetMachine");
+
----------------
This assert comes after `TM` is dereferenced in the line above.


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:556
+  CodeGenPasses.add(createTargetTransformInfoWrapperPass(TargetIRAnalysis()));
+  Triple triple(llvmModule->getTargetTriple());
+  std::unique_ptr<llvm::TargetLibraryInfoImpl> TLII =
----------------
getTargetTriple() was already saved into `theTriple` variable above.


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:559
+      std::make_unique<llvm::TargetLibraryInfoImpl>(triple);
+  CodeGenPasses.add(new TargetLibraryInfoWrapperPass(*TLII));
+
----------------
Do you want to assert on this RAII of `TLII`?


================
Comment at: flang/lib/Optimizer/Support/FIRContext.cpp:19
 
-static constexpr const char *tripleName = "fir.triple";
+static constexpr const char *tripleName = "llvm.target_triple";
 
----------------
Why is this being changed? This is a FIR specific attribute.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120568/new/

https://reviews.llvm.org/D120568



More information about the cfe-commits mailing list