mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-22 03:48:57 +00:00
[WebAssembly] Assembler: Allow offsets and p2align in symbol load.
Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63951 llvm-svn: 364682
This commit is contained in:
parent
34f2e2f14b
commit
d3dc642675
@ -344,9 +344,7 @@ public:
|
||||
Parser.Lex();
|
||||
}
|
||||
|
||||
bool parseOperandStartingWithInteger(bool IsNegative, OperandVector &Operands,
|
||||
StringRef InstName) {
|
||||
parseSingleInteger(IsNegative, Operands);
|
||||
bool checkForP2AlignIfLoadStore(OperandVector &Operands, StringRef InstName) {
|
||||
// FIXME: there is probably a cleaner way to do this.
|
||||
auto IsLoadStore = InstName.find(".load") != StringRef::npos ||
|
||||
InstName.find(".store") != StringRef::npos;
|
||||
@ -471,11 +469,13 @@ public:
|
||||
// Assume this identifier is a label.
|
||||
const MCExpr *Val;
|
||||
SMLoc End;
|
||||
if (Parser.parsePrimaryExpr(Val, End))
|
||||
if (Parser.parseExpression(Val, End))
|
||||
return error("Cannot parse symbol: ", Lexer.getTok());
|
||||
Operands.push_back(make_unique<WebAssemblyOperand>(
|
||||
WebAssemblyOperand::Symbol, Id.getLoc(), Id.getEndLoc(),
|
||||
WebAssemblyOperand::SymOp{Val}));
|
||||
if (checkForP2AlignIfLoadStore(Operands, Name))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -483,11 +483,13 @@ public:
|
||||
Parser.Lex();
|
||||
if (Lexer.isNot(AsmToken::Integer))
|
||||
return error("Expected integer instead got: ", Lexer.getTok());
|
||||
if (parseOperandStartingWithInteger(true, Operands, Name))
|
||||
parseSingleInteger(true, Operands);
|
||||
if (checkForP2AlignIfLoadStore(Operands, Name))
|
||||
return true;
|
||||
break;
|
||||
case AsmToken::Integer:
|
||||
if (parseOperandStartingWithInteger(false, Operands, Name))
|
||||
parseSingleInteger(false, Operands);
|
||||
if (checkForP2AlignIfLoadStore(Operands, Name))
|
||||
return true;
|
||||
break;
|
||||
case AsmToken::Real: {
|
||||
|
@ -81,6 +81,8 @@ test0:
|
||||
end_block
|
||||
end_try
|
||||
i32.const .L.str
|
||||
i32.load8_u .L.str+2
|
||||
i32.load16_u .L.str:p2align=0
|
||||
throw 0
|
||||
.LBB0_5:
|
||||
#i32.trunc_sat_f32_s
|
||||
@ -170,6 +172,8 @@ test0:
|
||||
# CHECK-NEXT: end_block
|
||||
# CHECK-NEXT: end_try
|
||||
# CHECK-NEXT: i32.const .L.str
|
||||
# CHECK-NEXT: i32.load8_u .L.str+2
|
||||
# CHECK-NEXT: i32.load16_u .L.str:p2align=0
|
||||
# CHECK-NEXT: throw 0
|
||||
# CHECK-NEXT: .LBB0_5:
|
||||
# CHECK-NEXT: global.get __stack_pointer
|
||||
|
Loading…
x
Reference in New Issue
Block a user