summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-08-14 15:48:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-08-14 15:48:41 +0000
commitdbaf0498a9009f38ce7d4ff66df50451b65e50aa (patch)
tree7237392ad2c82b0360236e79f1bbd68402961d19 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
parentbd481b8f899f9a5eba806ac7b3ca339ca1f94366 (diff)
downloadbcm5719-llvm-dbaf0498a9009f38ce7d4ff66df50451b65e50aa.tar.gz
bcm5719-llvm-dbaf0498a9009f38ce7d4ff66df50451b65e50aa.zip
Revert "Centralize the information about which object format we are using."
This reverts commit r245047. It was failing on the darwin bots. The problem was that when running ./bin/llc -march=msp430 llc gets to if (TheTriple.getTriple().empty()) TheTriple.setTriple(sys::getDefaultTargetTriple()); Which means that we go with an arch of msp430 but a triple of x86_64-apple-darwin14.4.0 which fails badly. That code has to be updated to select a triple based on the value of march, but that is not a trivial fix. llvm-svn: 245062
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 21414b085ff..2d291bf8652 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5173,11 +5173,18 @@ 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}, {"upper16", ARMMCExpr::VK_ARM_HI16},
+ { "lower16", ARMMCExpr::VK_ARM_LO16, COFF | ELF | MACHO },
+ { "upper16", ARMMCExpr::VK_ARM_HI16, COFF | ELF | MACHO },
};
StringRef IDVal = Parser.getTok().getIdentifier();
@@ -5192,6 +5199,25 @@ 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();
@@ -8665,10 +8691,10 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
/// parseDirective parses the arm specific directives
bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) {
- Triple::ObjectFormatType Format =
- getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
- bool IsMachO = Format == Triple::MachO;
- bool IsCOFF = Format == Triple::COFF;
+ const MCObjectFileInfo::Environment Format =
+ getContext().getObjectFileInfo()->getObjectFileType();
+ bool IsMachO = Format == MCObjectFileInfo::IsMachO;
+ bool IsCOFF = Format == MCObjectFileInfo::IsCOFF;
StringRef IDVal = DirectiveID.getIdentifier();
if (IDVal == ".word")
@@ -8833,9 +8859,8 @@ void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
/// ::= .thumbfunc symbol_name
bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
MCAsmParser &Parser = getParser();
- Triple::ObjectFormatType Format =
- getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
- bool IsMachO = Format == Triple::MachO;
+ const auto Format = getContext().getObjectFileInfo()->getObjectFileType();
+ bool IsMachO = Format == MCObjectFileInfo::IsMachO;
// Darwin asm has (optionally) function name after .thumb_func direction
// ELF doesn't
OpenPOWER on IntegriCloud