================
@@ -298,6 +299,14 @@ struct LoweringPreparePass
 
   clang::ASTContext *astCtx;
 
+  /// Target/ABI facts sourced from the module's own attributes.
+  std::unique_ptr<cir::LowerModule> lowerModule;
+
+  const clang::TargetInfo &getTargetInfo() const {
+    assert(lowerModule && "LoweringPrepare requires a module with a triple");
----------------
koparasy wrote:

@bcardosolopes Made `cir-lowering-prepare` a module pass (per @andykaylor), so 
the ModuleOp operand is guaranteed.  The remaining  assert is kept at 
getTargetInfo()'s precondition. it can not be hit today, but I kept it in the 
accessor so any future caller is covered. I can also implement a lazy 
initializer:

```
const clang::TargetInfo &getTargetInfo() {
  if (!lowerModule)
    lowerModule = cir::createLowerModule(mlirModule);
  assert(lowerModule && "requires a module with a triple");
  return lowerModule->getTarget();
}
```

But I think this is not necessary now. 

Any comments?

https://github.com/llvm/llvm-project/pull/219078
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to