本文整理汇总了C++中Triple::isOSDarwin方法的典型用法代码示例。如果您正苦于以下问题:C++ Triple::isOSDarwin方法的具体用法?C++ Triple::isOSDarwin怎么用?C++ Triple::isOSDarwin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triple
的用法示例。
在下文中一共展示了Triple::isOSDarwin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEffectiveRelocModel
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
if (!RM.hasValue())
// Default relocation model on Darwin is PIC.
return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
assert(TT.isOSBinFormatELF() &&
"ROPI/RWPI currently only supported for ELF");
// DynamicNoPIC is only used on darwin.
if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
return Reloc::Static;
return *RM;
}
示例2: getEffectiveRelocModel
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
if (RM.hasValue())
return *RM;
// Darwin defaults to dynamic-no-pic.
if (TT.isOSDarwin())
return Reloc::DynamicNoPIC;
// Non-darwin 64-bit platforms are PIC by default.
if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le)
return Reloc::PIC_;
// 32-bit is static by default.
return Reloc::Static;
}
示例3: getEffectiveRelocModel
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
if (RM.hasValue())
return *RM;
// Darwin defaults to dynamic-no-pic.
if (TT.isOSDarwin())
return Reloc::DynamicNoPIC;
// Big Endian PPC is PIC by default.
if (TT.getArch() == Triple::ppc64)
return Reloc::PIC_;
// Rest are static by default.
return Reloc::Static;
}
示例4: hasSinCosPiStret
static bool hasSinCosPiStret(const Triple &T) {
// Only Darwin variants have _stret versions of combined trig functions.
if (!T.isOSDarwin())
return false;
// The ABI is rather complicated on x86, so don't do anything special there.
if (T.getArch() == Triple::x86)
return false;
if (T.isMacOSX() && T.isMacOSXVersionLT(10, 9))
return false;
if (T.isiOS() && T.isOSVersionLT(7, 0))
return false;
return true;
}
示例5: if
static std::string computeDataLayout(const Triple &TT) {
// X86 is little endian
std::string Ret = "e";
Ret += DataLayout::getManglingComponent(TT);
// X86 and x32 have 32 bit pointers.
if ((TT.isArch64Bit() &&
(TT.getEnvironment() == Triple::GNUX32 || TT.isOSNaCl())) ||
!TT.isArch64Bit())
Ret += "-p:32:32";
// Some ABIs align 64 bit integers and doubles to 64 bits, others to 32.
if (TT.isArch64Bit() || TT.isOSWindows() || TT.isOSNaCl())
Ret += "-i64:64";
else if (TT.isOSIAMCU())
Ret += "-i64:32-f64:32";
else
Ret += "-f64:32:64";
// Some ABIs align long double to 128 bits, others to 32.
if (TT.isOSNaCl() || TT.isOSIAMCU())
; // No f80
else if (TT.isArch64Bit() || TT.isOSDarwin())
Ret += "-f80:128";
else
Ret += "-f80:32";
if (TT.isOSIAMCU())
Ret += "-f128:32";
// The registers can hold 8, 16, 32 or, in x86-64, 64 bits.
if (TT.isArch64Bit())
Ret += "-n8:16:32:64";
else
Ret += "-n8:16:32";
// The stack is aligned to 32 bits on some ABIs and 128 bits on others.
if ((!TT.isArch64Bit() && TT.isOSWindows()) || TT.isOSIAMCU())
Ret += "-a:0:32-S32";
else
Ret += "-S128";
return Ret;
}
示例6:
ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
if ((TheTriple.getArch() == Triple::armeb) ||
(TheTriple.getArch() == Triple::thumbeb))
IsLittleEndian = false;
Data64bitsDirective = nullptr;
CommentString = "@";
Code16Directive = ".code\t16";
Code32Directive = ".code\t32";
UseDataRegionDirectives = true;
SupportsDebugInformation = true;
// Exceptions handling
ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
? ExceptionHandling::SjLj
: ExceptionHandling::DwarfCFI;
UseIntegratedAssembler = true;
}
示例7: useCompactUnwind
static bool useCompactUnwind(const Triple &T) {
// Only on darwin.
if (!T.isOSDarwin())
return false;
// aarch64 always has it.
if (T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64)
return true;
// Use it on newer version of OS X.
if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
return true;
// And the iOS simulator.
if (T.isiOS() &&
(T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86))
return true;
return false;
}
示例8: initMachOMCObjectFileInfo
void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
// MachO
SupportsWeakOmittedEHFrame = false;
EHFrameSection = Ctx->getMachOSection(
"__TEXT", "__eh_frame",
MachO::S_COALESCED | MachO::S_ATTR_NO_TOC |
MachO::S_ATTR_STRIP_STATIC_SYMS | MachO::S_ATTR_LIVE_SUPPORT,
SectionKind::getReadOnly());
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
SupportsCompactUnwindWithoutEHFrame = true;
if (T.isWatchOS())
OmitDwarfIfHaveCompactUnwind = true;
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel
| dwarf::DW_EH_PE_sdata4;
LSDAEncoding = FDECFIEncoding = dwarf::DW_EH_PE_pcrel;
TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
dwarf::DW_EH_PE_sdata4;
// .comm doesn't support alignment before Leopard.
if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
CommDirectiveSupportsAlignment = false;
TextSection // .text
= Ctx->getMachOSection("__TEXT", "__text",
MachO::S_ATTR_PURE_INSTRUCTIONS,
SectionKind::getText());
DataSection // .data
= Ctx->getMachOSection("__DATA", "__data", 0,
SectionKind::getDataRel());
// BSSSection might not be expected initialized on msvc.
BSSSection = nullptr;
TLSDataSection // .tdata
= Ctx->getMachOSection("__DATA", "__thread_data",
MachO::S_THREAD_LOCAL_REGULAR,
SectionKind::getDataRel());
TLSBSSSection // .tbss
= Ctx->getMachOSection("__DATA", "__thread_bss",
MachO::S_THREAD_LOCAL_ZEROFILL,
SectionKind::getThreadBSS());
// TODO: Verify datarel below.
TLSTLVSection // .tlv
= Ctx->getMachOSection("__DATA", "__thread_vars",
MachO::S_THREAD_LOCAL_VARIABLES,
SectionKind::getDataRel());
TLSThreadInitSection
= Ctx->getMachOSection("__DATA", "__thread_init",
MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
SectionKind::getDataRel());
CStringSection // .cstring
= Ctx->getMachOSection("__TEXT", "__cstring",
MachO::S_CSTRING_LITERALS,
SectionKind::getMergeable1ByteCString());
UStringSection
= Ctx->getMachOSection("__TEXT","__ustring", 0,
SectionKind::getMergeable2ByteCString());
FourByteConstantSection // .literal4
= Ctx->getMachOSection("__TEXT", "__literal4",
MachO::S_4BYTE_LITERALS,
SectionKind::getMergeableConst4());
EightByteConstantSection // .literal8
= Ctx->getMachOSection("__TEXT", "__literal8",
MachO::S_8BYTE_LITERALS,
SectionKind::getMergeableConst8());
SixteenByteConstantSection // .literal16
= Ctx->getMachOSection("__TEXT", "__literal16",
MachO::S_16BYTE_LITERALS,
SectionKind::getMergeableConst16());
ReadOnlySection // .const
= Ctx->getMachOSection("__TEXT", "__const", 0,
SectionKind::getReadOnly());
// If the target is not powerpc, map the coal sections to the non-coal
// sections.
//
// "__TEXT/__textcoal_nt" => section "__TEXT/__text"
// "__TEXT/__const_coal" => section "__TEXT/__const"
// "__DATA/__datacoal_nt" => section "__DATA/__data"
Triple::ArchType ArchTy = T.getArch();
if (ArchTy == Triple::ppc || ArchTy == Triple::ppc64) {
TextCoalSection
= Ctx->getMachOSection("__TEXT", "__textcoal_nt",
MachO::S_COALESCED |
MachO::S_ATTR_PURE_INSTRUCTIONS,
SectionKind::getText());
ConstTextCoalSection
= Ctx->getMachOSection("__TEXT", "__const_coal",
MachO::S_COALESCED,
SectionKind::getReadOnly());
//.........这里部分代码省略.........
示例9: InitMachOMCObjectFileInfo
void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
// MachO
IsFunctionEHFrameSymbolPrivate = false;
SupportsWeakOmittedEHFrame = false;
if (T.isOSDarwin() && T.getArch() == Triple::arm64)
SupportsCompactUnwindWithoutEHFrame = true;
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel
| dwarf::DW_EH_PE_sdata4;
LSDAEncoding = FDEEncoding = FDECFIEncoding = dwarf::DW_EH_PE_pcrel;
TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
dwarf::DW_EH_PE_sdata4;
// .comm doesn't support alignment before Leopard.
if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
CommDirectiveSupportsAlignment = false;
TextSection // .text
= Ctx->getMachOSection("__TEXT", "__text",
MachO::S_ATTR_PURE_INSTRUCTIONS,
SectionKind::getText());
DataSection // .data
= Ctx->getMachOSection("__DATA", "__data", 0,
SectionKind::getDataRel());
// BSSSection might not be expected initialized on msvc.
BSSSection = 0;
TLSDataSection // .tdata
= Ctx->getMachOSection("__DATA", "__thread_data",
MachO::S_THREAD_LOCAL_REGULAR,
SectionKind::getDataRel());
TLSBSSSection // .tbss
= Ctx->getMachOSection("__DATA", "__thread_bss",
MachO::S_THREAD_LOCAL_ZEROFILL,
SectionKind::getThreadBSS());
// TODO: Verify datarel below.
TLSTLVSection // .tlv
= Ctx->getMachOSection("__DATA", "__thread_vars",
MachO::S_THREAD_LOCAL_VARIABLES,
SectionKind::getDataRel());
TLSThreadInitSection
= Ctx->getMachOSection("__DATA", "__thread_init",
MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
SectionKind::getDataRel());
CStringSection // .cstring
= Ctx->getMachOSection("__TEXT", "__cstring",
MachO::S_CSTRING_LITERALS,
SectionKind::getMergeable1ByteCString());
UStringSection
= Ctx->getMachOSection("__TEXT","__ustring", 0,
SectionKind::getMergeable2ByteCString());
FourByteConstantSection // .literal4
= Ctx->getMachOSection("__TEXT", "__literal4",
MachO::S_4BYTE_LITERALS,
SectionKind::getMergeableConst4());
EightByteConstantSection // .literal8
= Ctx->getMachOSection("__TEXT", "__literal8",
MachO::S_8BYTE_LITERALS,
SectionKind::getMergeableConst8());
SixteenByteConstantSection // .literal16
= Ctx->getMachOSection("__TEXT", "__literal16",
MachO::S_16BYTE_LITERALS,
SectionKind::getMergeableConst16());
ReadOnlySection // .const
= Ctx->getMachOSection("__TEXT", "__const", 0,
SectionKind::getReadOnly());
TextCoalSection
= Ctx->getMachOSection("__TEXT", "__textcoal_nt",
MachO::S_COALESCED |
MachO::S_ATTR_PURE_INSTRUCTIONS,
SectionKind::getText());
ConstTextCoalSection
= Ctx->getMachOSection("__TEXT", "__const_coal",
MachO::S_COALESCED,
SectionKind::getReadOnly());
ConstDataSection // .const_data
= Ctx->getMachOSection("__DATA", "__const", 0,
SectionKind::getReadOnlyWithRel());
DataCoalSection
= Ctx->getMachOSection("__DATA","__datacoal_nt",
MachO::S_COALESCED,
SectionKind::getDataRel());
DataCommonSection
= Ctx->getMachOSection("__DATA","__common",
MachO::S_ZEROFILL,
SectionKind::getBSS());
DataBSSSection
= Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
SectionKind::getBSS());
LazySymbolPointerSection
//.........这里部分代码省略.........
示例10: if
static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
switch (T.getArch()) {
case Triple::UnknownArch:
case Triple::aarch64:
case Triple::arm:
case Triple::thumb:
case Triple::x86:
case Triple::x86_64:
if (T.isOSDarwin())
return Triple::MachO;
else if (T.isOSWindows())
return Triple::COFF;
return Triple::ELF;
case Triple::aarch64_be:
case Triple::amdgcn:
case Triple::amdil:
case Triple::amdil64:
case Triple::armeb:
case Triple::avr:
case Triple::bpfeb:
case Triple::bpfel:
case Triple::hexagon:
case Triple::lanai:
case Triple::hsail:
case Triple::hsail64:
case Triple::kalimba:
case Triple::le32:
case Triple::le64:
case Triple::mips:
case Triple::mips64:
case Triple::mips64el:
case Triple::mipsel:
case Triple::msp430:
case Triple::nvptx:
case Triple::nvptx64:
case Triple::ppc64le:
case Triple::r600:
case Triple::renderscript32:
case Triple::renderscript64:
case Triple::shave:
case Triple::sparc:
case Triple::sparcel:
case Triple::sparcv9:
case Triple::spir:
case Triple::spir64:
case Triple::systemz:
case Triple::tce:
case Triple::thumbeb:
case Triple::wasm32:
case Triple::wasm64:
case Triple::xcore:
return Triple::ELF;
case Triple::ppc:
case Triple::ppc64:
if (T.isOSDarwin())
return Triple::MachO;
return Triple::ELF;
}
llvm_unreachable("unknown architecture");
}
示例11:
bool llvm::AArch64::isX18ReservedByDefault(const Triple &TT) {
return TT.isAndroid() || TT.isOSDarwin() || TT.isOSFuchsia() ||
TT.isOSWindows();
}