| 1 | //===- lib/MC/MCTargetOptions.cpp - MC Target Options ---------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/MC/MCTargetOptions.h" |
| 10 | #include "llvm/ADT/StringRef.h" |
| 11 | #include <climits> |
| 12 | |
| 13 | using namespace llvm; |
| 14 | |
| 15 | MCTargetOptions::MCTargetOptions() |
| 16 | : MCRelaxAll(false), MCNoExecStack(false), MCFatalWarnings(false), |
| 17 | MCNoWarn(false), MCNoDeprecatedWarn(false), MCNoTypeCheck(false), |
| 18 | MCSaveTempLabels(false), MCIncrementalLinkerCompatible(false), |
| 19 | FDPIC(false), ShowMCEncoding(false), ShowMCInst(false), AsmVerbose(false), |
| 20 | PreserveAsmComments(true), Dwarf64(false), |
| 21 | EmitDwarfUnwind(EmitDwarfUnwindType::Default), |
| 22 | MCUseDwarfDirectory(DefaultDwarfDirectory), |
| 23 | EmitCompactUnwindNonCanonical(false), EmitSFrameUnwind(false), |
| 24 | PPCUseFullRegisterNames(false), LargeEHEncoding(false) {} |
| 25 | |
| 26 | std::pair<int, int> MCTargetOptions::parseBinutilsVersion(StringRef Version) { |
| 27 | if (Version == "none" ) |
| 28 | return {INT_MAX, INT_MAX}; // Make binutilsIsAtLeast() return true. |
| 29 | std::pair<int, int> Ret; |
| 30 | if (!Version.consumeInteger(Radix: 10, Result&: Ret.first) && Version.consume_front(Prefix: "." )) |
| 31 | Version.consumeInteger(Radix: 10, Result&: Ret.second); |
| 32 | return Ret; |
| 33 | } |
| 34 | |
| 35 | StringRef MCTargetOptions::getABIName() const { |
| 36 | return ABIName; |
| 37 | } |
| 38 | |
| 39 | StringRef MCTargetOptions::getAssemblyLanguage() const { |
| 40 | return AssemblyLanguage; |
| 41 | } |
| 42 | |