summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2018-07-02 13:43:45 +0000
committerAlex Bradbury <asb@lowrisc.org>2018-07-02 13:43:45 +0000
commitc000e4dcb5c76a9e44f070a9e1742baab723ba97 (patch)
tree67674b25d43feb7358d96fd25d9e3b2eadbb0ee4 /llvm/lib
parentd5fb50e3bf483ede6ca1cbce5cc4a9d9d81d2671 (diff)
downloadbcm5719-llvm-c000e4dcb5c76a9e44f070a9e1742baab723ba97.tar.gz
bcm5719-llvm-c000e4dcb5c76a9e44f070a9e1742baab723ba97.zip
Revert r336100
This was a bad change. .word == 2byte on x86. llvm-svn: 336103
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 2bb4bad21d5..86d8ae1fc9b 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -846,6 +846,7 @@ private:
const InlineAsmIdentifierInfo &Info);
bool parseDirectiveEven(SMLoc L);
+ bool ParseDirectiveWord(unsigned Size, SMLoc L);
bool ParseDirectiveCode(StringRef IDVal, SMLoc L);
/// CodeView FPO data directives.
@@ -944,8 +945,6 @@ public:
: MCTargetAsmParser(Options, sti, mii), InstInfo(nullptr),
Code16GCC(false) {
- Parser.addAliasForDirective(".word", ".4byte");
-
// Initialize the set of available features.
setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
Instrumentation.reset(
@@ -3265,7 +3264,9 @@ bool X86AsmParser::OmitRegisterFromClobberLists(unsigned RegNo) {
bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
MCAsmParser &Parser = getParser();
StringRef IDVal = DirectiveID.getIdentifier();
- if (IDVal.startswith(".code"))
+ if (IDVal == ".word")
+ return ParseDirectiveWord(2, DirectiveID.getLoc());
+ else if (IDVal.startswith(".code"))
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
else if (IDVal.startswith(".att_syntax")) {
getParser().setParsingInlineAsm(false);
@@ -3326,6 +3327,27 @@ bool X86AsmParser::parseDirectiveEven(SMLoc L) {
getStreamer().EmitValueToAlignment(2, 0, 1, 0);
return false;
}
+/// ParseDirectiveWord
+/// ::= .word [ expression (, expression)* ]
+bool X86AsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
+ auto parseOp = [&]() -> bool {
+ const MCExpr *Value;
+ SMLoc ExprLoc = getLexer().getLoc();
+ if (getParser().parseExpression(Value))
+ return true;
+ if (const auto *MCE = dyn_cast<MCConstantExpr>(Value)) {
+ assert(Size <= 8 && "Invalid size");
+ uint64_t IntValue = MCE->getValue();
+ if (!isUIntN(8 * Size, IntValue) && !isIntN(8 * Size, IntValue))
+ return Error(ExprLoc, "literal value out of range for directive");
+ getStreamer().EmitIntValue(IntValue, Size);
+ } else
+ getStreamer().EmitValue(Value, Size, ExprLoc);
+ return false;
+ };
+ parseMany(parseOp);
+ return false;
+}
/// ParseDirectiveCode
/// ::= .code16 | .code32 | .code64
OpenPOWER on IntegriCloud