summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-04-13 08:34:56 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-04-13 08:34:56 +0000
commitaaf3df3a00e81805687699673813c76f7b590395 (patch)
tree2c43b4cc59c2571587073a64a84aadf6cc8a9ea1 /lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
parent4bc35460df997733dd3a482350446fb885691106 (diff)
downloadbcm5719-llvm-aaf3df3a00e81805687699673813c76f7b590395.tar.gz
bcm5719-llvm-aaf3df3a00e81805687699673813c76f7b590395.zip
[Mips] Create MipsTargetHandler class object using factory functions
Right now MIPS instantiates MipsTargetHandler using Mips32ELType and Mips64ELType. And in the future we can add a couple more types. That leads to the large object file size because compiler has to create copies of MipsTargetHandler and all realted classes for each types used for instantiation. The patch introduces two factory functions and puts each of them into the separate cpp file. That allows to reduce size of single object file. llvm-svn: 234728
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp')
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
index 32e0484943f..72c5d935b6a 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
@@ -24,15 +24,13 @@ elf::createMipsLinkingContext(llvm::Triple triple) {
return nullptr;
}
-typedef std::unique_ptr<TargetHandler> TargetHandlerPtr;
-
-static TargetHandlerPtr createTarget(llvm::Triple triple,
- MipsLinkingContext &ctx) {
+static std::unique_ptr<TargetHandler> createTarget(llvm::Triple triple,
+ MipsLinkingContext &ctx) {
switch (triple.getArch()) {
case llvm::Triple::mipsel:
- return TargetHandlerPtr(new MipsTargetHandler<Mips32ELType>(ctx));
+ return createMips32ELTargetHandler(ctx);
case llvm::Triple::mips64el:
- return TargetHandlerPtr(new MipsTargetHandler<Mips64ELType>(ctx));
+ return createMips64ELTargetHandler(ctx);
default:
llvm_unreachable("Unhandled arch");
}
OpenPOWER on IntegriCloud