mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Add XCOFF triple object format type for AIX
This patch adds an XCOFF triple object format type into LLVM. This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform. Differential Revision: https://reviews.llvm.org/D58930 llvm-svn: 355989
This commit is contained in:
parent
14e47fc8be
commit
65a0422be5
@ -219,6 +219,7 @@ public:
|
||||
ELF,
|
||||
MachO,
|
||||
Wasm,
|
||||
XCOFF,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -598,6 +599,11 @@ public:
|
||||
!isAndroid();
|
||||
}
|
||||
|
||||
/// Tests whether the OS is AIX.
|
||||
bool isOSAIX() const {
|
||||
return getOS() == Triple::AIX;
|
||||
}
|
||||
|
||||
/// Tests whether the OS uses the ELF binary format.
|
||||
bool isOSBinFormatELF() const {
|
||||
return getObjectFormat() == Triple::ELF;
|
||||
@ -618,6 +624,11 @@ public:
|
||||
return getObjectFormat() == Triple::Wasm;
|
||||
}
|
||||
|
||||
/// Tests whether the OS uses the XCOFF binary format.
|
||||
bool isOSBinFormatXCOFF() const {
|
||||
return getObjectFormat() == Triple::XCOFF;
|
||||
}
|
||||
|
||||
/// Tests whether the target is the PS4 CPU
|
||||
bool isPS4CPU() const {
|
||||
return getArch() == Triple::x86_64 &&
|
||||
|
@ -380,7 +380,7 @@ public:
|
||||
return EHFrameSection;
|
||||
}
|
||||
|
||||
enum Environment { IsMachO, IsELF, IsCOFF, IsWasm };
|
||||
enum Environment { IsMachO, IsELF, IsCOFF, IsWasm, IsXCOFF };
|
||||
Environment getObjectFileType() const { return Env; }
|
||||
|
||||
bool isPositionIndependent() const { return PositionIndependent; }
|
||||
|
@ -161,6 +161,9 @@ MCSymbol *MCContext::createSymbolImpl(const StringMapEntry<bool> *Name,
|
||||
return new (Name, *this) MCSymbolMachO(Name, IsTemporary);
|
||||
case MCObjectFileInfo::IsWasm:
|
||||
return new (Name, *this) MCSymbolWasm(Name, IsTemporary);
|
||||
case MCObjectFileInfo::IsXCOFF:
|
||||
// TODO: Need to implement class MCSymbolXCOFF.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new (Name, *this) MCSymbol(MCSymbol::SymbolKindUnset, Name,
|
||||
|
@ -801,6 +801,11 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
|
||||
Env = IsWasm;
|
||||
initWasmMCObjectFileInfo(TT);
|
||||
break;
|
||||
case Triple::XCOFF:
|
||||
Env = IsXCOFF;
|
||||
// TODO: Initialize MCObjectFileInfo for XCOFF format when
|
||||
// MCSectionXCOFF is ready.
|
||||
break;
|
||||
case Triple::UnknownObjectFormat:
|
||||
report_fatal_error("Cannot initialize MC for unknown object file format.");
|
||||
break;
|
||||
@ -816,6 +821,7 @@ MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
|
||||
case Triple::MachO:
|
||||
case Triple::COFF:
|
||||
case Triple::Wasm:
|
||||
case Triple::XCOFF:
|
||||
case Triple::UnknownObjectFormat:
|
||||
report_fatal_error("Cannot get DWARF comdat section for this object file "
|
||||
"format: not implemented.");
|
||||
|
@ -710,6 +710,9 @@ AsmParser::AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
|
||||
case MCObjectFileInfo::IsWasm:
|
||||
PlatformParser.reset(createWasmAsmParser());
|
||||
break;
|
||||
case MCObjectFileInfo::IsXCOFF:
|
||||
// TODO: Need to implement createXCOFFAsmParser for XCOFF format.
|
||||
break;
|
||||
}
|
||||
|
||||
PlatformParser->Initialize(*this);
|
||||
|
@ -534,6 +534,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
|
||||
|
||||
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
|
||||
return StringSwitch<Triple::ObjectFormatType>(EnvironmentName)
|
||||
// "xcoff" must come before "coff" because of the order-dependendent
|
||||
// pattern matching.
|
||||
.EndsWith("xcoff", Triple::XCOFF)
|
||||
.EndsWith("coff", Triple::COFF)
|
||||
.EndsWith("elf", Triple::ELF)
|
||||
.EndsWith("macho", Triple::MachO)
|
||||
@ -622,6 +625,7 @@ static StringRef getObjectFormatTypeName(Triple::ObjectFormatType Kind) {
|
||||
case Triple::ELF: return "elf";
|
||||
case Triple::MachO: return "macho";
|
||||
case Triple::Wasm: return "wasm";
|
||||
case Triple::XCOFF: return "xcoff";
|
||||
}
|
||||
llvm_unreachable("unknown object format type");
|
||||
}
|
||||
@ -686,6 +690,8 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
|
||||
case Triple::ppc64:
|
||||
if (T.isOSDarwin())
|
||||
return Triple::MachO;
|
||||
else if (T.isOSAIX())
|
||||
return Triple::XCOFF;
|
||||
return Triple::ELF;
|
||||
|
||||
case Triple::wasm32:
|
||||
|
@ -5594,6 +5594,9 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr::VariantKind &RefKind) {
|
||||
case MCObjectFileInfo::IsWasm:
|
||||
CurrentFormat = WASM;
|
||||
break;
|
||||
case MCObjectFileInfo::IsXCOFF:
|
||||
llvm_unreachable("unexpected object format");
|
||||
break;
|
||||
}
|
||||
|
||||
if (~Prefix->SupportedFormats & CurrentFormat) {
|
||||
|
@ -1258,6 +1258,11 @@ TEST(TripleTest, FileFormat) {
|
||||
EXPECT_EQ(Triple::Wasm,
|
||||
Triple("wasm64-unknown-wasi-musl-wasm").getObjectFormat());
|
||||
|
||||
EXPECT_EQ(Triple::XCOFF, Triple("powerpc-ibm-aix").getObjectFormat());
|
||||
EXPECT_EQ(Triple::XCOFF, Triple("powerpc64-ibm-aix").getObjectFormat());
|
||||
EXPECT_EQ(Triple::XCOFF, Triple("powerpc---xcoff").getObjectFormat());
|
||||
EXPECT_EQ(Triple::XCOFF, Triple("powerpc64---xcoff").getObjectFormat());
|
||||
|
||||
Triple MSVCNormalized(Triple::normalize("i686-pc-windows-msvc-elf"));
|
||||
EXPECT_EQ(Triple::ELF, MSVCNormalized.getObjectFormat());
|
||||
|
||||
@ -1276,6 +1281,9 @@ TEST(TripleTest, FileFormat) {
|
||||
|
||||
T.setObjectFormat(Triple::MachO);
|
||||
EXPECT_EQ(Triple::MachO, T.getObjectFormat());
|
||||
|
||||
T.setObjectFormat(Triple::XCOFF);
|
||||
EXPECT_EQ(Triple::XCOFF, T.getObjectFormat());
|
||||
}
|
||||
|
||||
TEST(TripleTest, NormalizeWindows) {
|
||||
|
Loading…
Reference in New Issue
Block a user