aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-mca/llvm-mca.cpp
diff options
context:
space:
mode:
authorPhilipp Krones <philipp.krones@embecosm.com>2021-05-23 14:15:23 -0700
committerFangrui Song <i@maskray.me>2021-05-23 14:15:23 -0700
commitc2f819af73c54a8cf923e5a25099ca95dbe76312 (patch)
tree97a4ff834d4680ecbbd3f7c1fde1c749d2398f26 /llvm/tools/llvm-mca/llvm-mca.cpp
parentcb1511645170ec23036631790398d8143a832265 (diff)
downloadllvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.zip
llvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.tar.gz
llvm-c2f819af73c54a8cf923e5a25099ca95dbe76312.tar.bz2
[MC] Refactor MCObjectFileInfo initialization and allow targets to create MCObjectFileInfo
This makes it possible for targets to define their own MCObjectFileInfo. This MCObjectFileInfo is then used to determine things like section alignment. This is a follow up to D101462 and prepares for the RISCV backend defining the text section alignment depending on the enabled extensions. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D101921
Diffstat (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp')
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 4a4230c..3bb2f10 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -371,15 +371,15 @@ int main(int argc, char **argv) {
TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions));
assert(MAI && "Unable to create target asm info!");
- MCObjectFileInfo MOFI;
SourceMgr SrcMgr;
// Tell SrcMgr about this buffer, which is what the parser will pick up.
SrcMgr.AddNewSourceBuffer(std::move(*BufferPtr), SMLoc());
- MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), &SrcMgr);
-
- MOFI.initMCObjectFileInfo(Ctx, /*PIC=*/false);
+ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
+ std::unique_ptr<MCObjectFileInfo> MOFI(
+ TheTarget->createMCObjectFileInfo(Ctx, /*PIC=*/false));
+ Ctx.setObjectFileInfo(MOFI.get());
std::unique_ptr<buffer_ostream> BOS;