diff options
author | Philipp Krones <philipp.krones@embecosm.com> | 2021-05-05 10:03:02 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-05-05 10:03:02 -0700 |
commit | 632ebc4ab4374e53fce1ec870465c587e0a33668 (patch) | |
tree | f3bbf72dacf56163a62c0f6e18c52f2fd102d8ff /llvm/tools/llvm-exegesis/lib/Analysis.cpp | |
parent | 80e8025083982f4eca8ca8200eafecf4a5c3ae6e (diff) | |
download | llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.zip llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.gz llvm-632ebc4ab4374e53fce1ec870465c587e0a33668.tar.bz2 |
[MC] Untangle MCContext and MCObjectFileInfo
This untangles the MCContext and the MCObjectFileInfo. There is a circular
dependency between MCContext and MCObjectFileInfo. Currently this dependency
also exists during construction: You can't contruct a MOFI without a MCContext
without constructing the MCContext with a dummy version of that MOFI first.
This removes this dependency during construction. In a perfect world,
MCObjectFileInfo wouldn't depend on MCContext at all, but only be stored in the
MCContext, like other MC information. This is future work.
This also shifts/adds more information to the MCContext making it more
available to the different targets. Namely:
- TargetTriple
- ObjectFileType
- SubtargetInfo
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101462
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Analysis.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Analysis.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index 087100d..079fcd8 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -176,8 +176,9 @@ Analysis::Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo, Triple(FirstPoint.LLVMTriple), 0 /*default variant*/, *AsmInfo_, *InstrInfo_, *RegInfo_)); - Context_ = std::make_unique<MCContext>(AsmInfo_.get(), RegInfo_.get(), - &ObjectFileInfo_); + Context_ = std::make_unique<MCContext>( + Triple(FirstPoint.LLVMTriple), AsmInfo_.get(), RegInfo_.get(), + &ObjectFileInfo_, SubtargetInfo_.get()); Disasm_.reset(Target.createMCDisassembler(*SubtargetInfo_, *Context_)); assert(Disasm_ && "cannot create MCDisassembler. missing call to " "InitializeXXXTargetDisassembler ?"); |