[flang-commits] [flang] [flang] Updating drivers to create data layout before semantics (PR #73301)

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Tue Nov 28 08:17:28 PST 2023


banach-space wrote:

> > > I think that my suggestion could be implemented by extracting `TargetMachine` logic out of `setUpTargetCharacteristics`?
> > 
> > 
> > I want a single place where the evaluate::TargetCharacteristics is being set-up, and it will need an llvm::DataLayout, which can only be obtained from an llvm::TargetMachine.
> > The other solution is to move the SemanticContext outside of CompilerInvocation, but I am not sure of the implications. Would that be possible?
> 
> @banach-space, alternatively, would it be OK to move the llvm::TargetMachine into the `CompilerInstance` class where the call to set-up the SemanticContext is done?

Interesting that you mention that -  `semanticContext` is currently a member variable of `CompilarInvocation` rather than `CompilerInstance`: https://github.com/llvm/llvm-project/blob/79b03306af5c11d354fa90db8bfd7818cd811ef5/flang/include/flang/Frontend/CompilerInvocation.h#L90-L91

That's not where I was expecting to find it :)

It sounds like things would be more seamless for both of us if I moved `semanticContext` to `CompilerInstance`. I have a prototype patch that does that - would you be OK  rebasing your change on top of that if I send it for review?

https://github.com/llvm/llvm-project/pull/73301


More information about the flang-commits mailing list