diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-08-14 13:31:17 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-08-14 13:31:17 +0000 |
commit | 90eb70c8a76db399d9128a4f70af8cd393374694 (patch) | |
tree | 4e14ff48776f0434aaf21deed18abe88d4f70103 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 078ab134ea73c01059acaa45f1d52d964727b612 (diff) | |
download | bcm5719-llvm-90eb70c8a76db399d9128a4f70af8cd393374694.tar.gz bcm5719-llvm-90eb70c8a76db399d9128a4f70af8cd393374694.zip |
Centralize the information about which object format we are using.
Other than some places that were handling unknown as ELF, this should
have no change. The test updates are because we were detecting
arm-coff or x86_64-win64-coff as ELF targets before.
It is not clear if the enum should live on the Triple. At least now it lives
in a single location and should be easier to move somewhere else.
llvm-svn: 245047
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 2d291bf8652..21414b085ff 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5173,18 +5173,11 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr::VariantKind &RefKind) { return true; } - enum { - COFF = (1 << MCObjectFileInfo::IsCOFF), - ELF = (1 << MCObjectFileInfo::IsELF), - MACHO = (1 << MCObjectFileInfo::IsMachO) - }; static const struct PrefixEntry { const char *Spelling; ARMMCExpr::VariantKind VariantKind; - uint8_t SupportedFormats; } PrefixEntries[] = { - { "lower16", ARMMCExpr::VK_ARM_LO16, COFF | ELF | MACHO }, - { "upper16", ARMMCExpr::VK_ARM_HI16, COFF | ELF | MACHO }, + {"lower16", ARMMCExpr::VK_ARM_LO16}, {"upper16", ARMMCExpr::VK_ARM_HI16}, }; StringRef IDVal = Parser.getTok().getIdentifier(); @@ -5199,25 +5192,6 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr::VariantKind &RefKind) { return true; } - uint8_t CurrentFormat; - switch (getContext().getObjectFileInfo()->getObjectFileType()) { - case MCObjectFileInfo::IsMachO: - CurrentFormat = MACHO; - break; - case MCObjectFileInfo::IsELF: - CurrentFormat = ELF; - break; - case MCObjectFileInfo::IsCOFF: - CurrentFormat = COFF; - break; - } - - if (~Prefix->SupportedFormats & CurrentFormat) { - Error(Parser.getTok().getLoc(), - "cannot represent relocation in the current file format"); - return true; - } - RefKind = Prefix->VariantKind; Parser.Lex(); @@ -8691,10 +8665,10 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, /// parseDirective parses the arm specific directives bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) { - const MCObjectFileInfo::Environment Format = - getContext().getObjectFileInfo()->getObjectFileType(); - bool IsMachO = Format == MCObjectFileInfo::IsMachO; - bool IsCOFF = Format == MCObjectFileInfo::IsCOFF; + Triple::ObjectFormatType Format = + getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat(); + bool IsMachO = Format == Triple::MachO; + bool IsCOFF = Format == Triple::COFF; StringRef IDVal = DirectiveID.getIdentifier(); if (IDVal == ".word") @@ -8859,8 +8833,9 @@ void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) { /// ::= .thumbfunc symbol_name bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) { MCAsmParser &Parser = getParser(); - const auto Format = getContext().getObjectFileInfo()->getObjectFileType(); - bool IsMachO = Format == MCObjectFileInfo::IsMachO; + Triple::ObjectFormatType Format = + getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat(); + bool IsMachO = Format == Triple::MachO; // Darwin asm has (optionally) function name after .thumb_func direction // ELF doesn't |