summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-12-14 03:59:24 +0000
committerMatthias Braun <matze@braunis.de>2017-12-14 03:59:24 +0000
commit5dd72adbecb3c52e1bba6b823fbc4db3f592c8f7 (patch)
treedce9ca2510f0ca71488ab953bbbf651f413a5f4c /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parent123adb507380a9061f66f75420ce7943166ce83f (diff)
downloadbcm5719-llvm-5dd72adbecb3c52e1bba6b823fbc4db3f592c8f7.tar.gz
bcm5719-llvm-5dd72adbecb3c52e1bba6b823fbc4db3f592c8f7.zip
MC/AsmPrinter: Reduce code duplication.
Factor out duplicated code emitting mach-o version-min specifiers. This should be NFC but happens to fix a bug where the code in MCMachoStreamer didn't take the version skew between darwin and macos versions into account. llvm-svn: 320666
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index f1459d9d0a1..20381e4c83f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -254,28 +254,8 @@ bool AsmPrinter::doInitialization(Module &M) {
// alternative is duplicated code in each of the target asm printers that
// use the directive, where it would need the same conditionalization
// anyway.
- const Triple &TT = TM.getTargetTriple();
- // If there is a version specified, Major will be non-zero.
- if (TT.isOSDarwin() && TT.getOSMajorVersion() != 0) {
- unsigned Major, Minor, Update;
- MCVersionMinType VersionType;
- if (TT.isWatchOS()) {
- VersionType = MCVM_WatchOSVersionMin;
- TT.getWatchOSVersion(Major, Minor, Update);
- } else if (TT.isTvOS()) {
- VersionType = MCVM_TvOSVersionMin;
- TT.getiOSVersion(Major, Minor, Update);
- } else if (TT.isMacOSX()) {
- VersionType = MCVM_OSXVersionMin;
- if (!TT.getMacOSXVersion(Major, Minor, Update))
- Major = 0;
- } else {
- VersionType = MCVM_IOSVersionMin;
- TT.getiOSVersion(Major, Minor, Update);
- }
- if (Major != 0)
- OutStreamer->EmitVersionMin(VersionType, Major, Minor, Update);
- }
+ const Triple &Target = TM.getTargetTriple();
+ OutStreamer->EmitVersionForTarget(Target);
// Allow the target to emit any magic that it wants at the start of the file.
EmitStartOfAsmFile(M);
OpenPOWER on IntegriCloud