本文整理汇总了C++中Triple::getArchName方法的典型用法代码示例。如果您正苦于以下问题:C++ Triple::getArchName方法的具体用法?C++ Triple::getArchName怎么用?C++ Triple::getArchName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triple
的用法示例。
在下文中一共展示了Triple::getArchName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: useCompactUnwind
static bool useCompactUnwind(const Triple &T) {
// Only on darwin.
if (!T.isOSDarwin())
return false;
// aarch64 always has it.
if (T.getArch() == Triple::aarch64)
return true;
// armv7k always has it.
if (T.getArchName().equals("thumbv7k") ||
T.getArchName().equals("armv7k"))
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;
}
示例2: checkMachOAndArchFlags
// checkMachOAndArchFlags() checks to see if the SymbolicFile is a Mach-O file
// and if it is and there is a list of architecture flags is specified then
// check to make sure this Mach-O file is one of those architectures or all
// architectures was specificed. If not then an error is generated and this
// routine returns false. Else it returns true.
static bool checkMachOAndArchFlags(SymbolicFile *O, std::string &Filename) {
if (isa<MachOObjectFile>(O) && !ArchAll && ArchFlags.size() != 0) {
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(O);
bool ArchFound = false;
MachO::mach_header H;
MachO::mach_header_64 H_64;
Triple T;
if (MachO->is64Bit()) {
H_64 = MachO->MachOObjectFile::getHeader64();
T = MachOObjectFile::getArch(H_64.cputype, H_64.cpusubtype);
} else {
H = MachO->MachOObjectFile::getHeader();
T = MachOObjectFile::getArch(H.cputype, H.cpusubtype);
}
unsigned i;
for (i = 0; i < ArchFlags.size(); ++i) {
if (ArchFlags[i] == T.getArchName())
ArchFound = true;
break;
}
if (!ArchFound) {
error(ArchFlags[i],
"file: " + Filename + " does not contain architecture");
return false;
}
}
return true;
}
示例3: checkMachOAndArchFlags
/// @brief Checks to see if the @p o ObjectFile is a Mach-O file and if it is
/// and there is a list of architecture flags specified then check to
/// make sure this Mach-O file is one of those architectures or all
/// architectures was specificed. If not then an error is generated and
/// this routine returns false. Else it returns true.
static bool checkMachOAndArchFlags(ObjectFile *o, StringRef file) {
if (isa<MachOObjectFile>(o) && !ArchAll && ArchFlags.size() != 0) {
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
bool ArchFound = false;
MachO::mach_header H;
MachO::mach_header_64 H_64;
Triple T;
if (MachO->is64Bit()) {
H_64 = MachO->MachOObjectFile::getHeader64();
T = MachOObjectFile::getArch(H_64.cputype, H_64.cpusubtype);
} else {
H = MachO->MachOObjectFile::getHeader();
T = MachOObjectFile::getArch(H.cputype, H.cpusubtype);
}
unsigned i;
for (i = 0; i < ArchFlags.size(); ++i) {
if (ArchFlags[i] == T.getArchName())
ArchFound = true;
break;
}
if (!ArchFound) {
errs() << ToolName << ": file: " << file
<< " does not contain architecture: " << ArchFlags[i] << ".\n";
return false;
}
}
return true;
}
示例4: computeDefaultTargetABI
StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) {
StringRef ArchName =
CPU.empty() ? TT.getArchName() : getArchName(parseCPUArch(CPU));
if (TT.isOSBinFormatMachO()) {
if (TT.getEnvironment() == Triple::EABI ||
TT.getOS() == Triple::UnknownOS ||
parseArchProfile(ArchName) == ProfileKind::M)
return "aapcs";
if (TT.isWatchABI())
return "aapcs16";
return "apcs-gnu";
} else if (TT.isOSWindows())
// FIXME: this is invalid for WindowsCE.
return "aapcs";
// Select the default based on the platform.
switch (TT.getEnvironment()) {
case Triple::Android:
case Triple::GNUEABI:
case Triple::GNUEABIHF:
case Triple::MuslEABI:
case Triple::MuslEABIHF:
return "aapcs-linux";
case Triple::EABIHF:
case Triple::EABI:
return "aapcs";
default:
if (TT.isOSNetBSD())
return "apcs-gnu";
if (TT.isOSOpenBSD())
return "aapcs-linux";
return "aapcs";
}
}
示例5: ParseARMTriple
std::string ARM_MC::ParseARMTriple(const Triple &TT, StringRef CPU) {
bool isThumb =
TT.getArch() == Triple::thumb || TT.getArch() == Triple::thumbeb;
std::string ARMArchFeature;
unsigned ArchID = ARM::parseArch(TT.getArchName());
if (ArchID != ARM::AK_INVALID && (CPU.empty() || CPU == "generic"))
ARMArchFeature = (ARMArchFeature + "+" + ARM::getArchName(ArchID)).str();
if (isThumb) {
if (ARMArchFeature.empty())
ARMArchFeature = "+thumb-mode";
else
ARMArchFeature += ",+thumb-mode";
}
if (TT.isOSNaCl()) {
if (ARMArchFeature.empty())
ARMArchFeature = "+nacl-trap";
else
ARMArchFeature += ",+nacl-trap";
}
return ARMArchFeature;
}
示例6: checkMachOAndArchFlags
// checkMachOAndArchFlags() checks to see if the SymbolicFile is a Mach-O file
// and if it is and there is a list of architecture flags is specified then
// check to make sure this Mach-O file is one of those architectures or all
// architectures was specificed. If not then an error is generated and this
// routine returns false. Else it returns true.
static bool checkMachOAndArchFlags(SymbolicFile *O, std::string &Filename) {
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(O);
if (!MachO || ArchAll || ArchFlags.size() == 0)
return true;
MachO::mach_header H;
MachO::mach_header_64 H_64;
Triple T;
if (MachO->is64Bit()) {
H_64 = MachO->MachOObjectFile::getHeader64();
T = MachOObjectFile::getArch(H_64.cputype, H_64.cpusubtype);
} else {
H = MachO->MachOObjectFile::getHeader();
T = MachOObjectFile::getArch(H.cputype, H.cpusubtype);
}
if (std::none_of(
ArchFlags.begin(), ArchFlags.end(),
[&](const std::string &Name) { return Name == T.getArchName(); })) {
error("No architecture specified", Filename);
return false;
}
return true;
}
示例7: getArchName
static std::string getArchName(const object::MachOObjectFile &Obj) {
Triple ThumbTriple;
Triple T = Obj.getArch(nullptr, &ThumbTriple);
return T.getArchName();
}
示例8: getArchName
static std::string getArchName(const object::MachOObjectFile &Obj) {
Triple T = Obj.getArchTriple();
return T.getArchName();
}
示例9: get_arm_sub_arch_version
static int get_arm_sub_arch_version(const Triple &triple) {
return ARMTargetParser::parseArchVersion(triple.getArchName());
}
示例10: InitMachOMCObjectFileInfo
void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
// MachO
SupportsWeakOmittedEHFrame = false;
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
SupportsCompactUnwindWithoutEHFrame = true;
if (T.isOSDarwin() && T.getArchName().equals("thumbv7k"))
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());
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());
//.........这里部分代码省略.........