[PATCH] D123964: CodeGen: Replace some uses of LLVMTargetMachine with TargetMachine
    Matt Arsenault via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 27 10:14:12 PDT 2022
    
    
  
arsenm added a comment.
In D123964#3476294 <https://reviews.llvm.org/D123964#3476294>, @MatzeB wrote:
>> All target knowledge should be in the TargetMachine base class. LLVMTargetMachine extends with pass machinery, which most code should not have access to.
>
> My understanding was that `TargetMachine` is the public/outside interface (for frontends etc.). And that `LLVMTargetMachine` is a concrete subclass for all targets implemented using `lib/CodeGen`
This sounds backwards to me. LLVMTargetMachine extends with pieces frontends need to use the target (e.g. createMCStreamer). TargetMachine is the base target info class codegen does use. What you're saying would make more sense if the relationship was inverted?
The current situation is that I'm not sure any code makes a practical distinction here. For example to construct a MachineModuleInfo, the existing users downcast from TargetMachine to LLVMTargetMachine
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123964/new/
https://reviews.llvm.org/D123964
    
    
More information about the llvm-commits
mailing list