mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-03 17:32:59 +00:00
[WebAssembly] Assembler: support .int16/32/64 directives.
Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63959 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364689 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8f0f64884c
commit
760081b314
@ -665,13 +665,18 @@ public:
|
||||
return expect(AsmToken::EndOfStatement, "EOL");
|
||||
}
|
||||
|
||||
if (DirectiveID.getString() == ".int8") {
|
||||
if (DirectiveID.getString() == ".int8" ||
|
||||
DirectiveID.getString() == ".int16" ||
|
||||
DirectiveID.getString() == ".int32" ||
|
||||
DirectiveID.getString() == ".int64") {
|
||||
if (CheckDataSection()) return true;
|
||||
int64_t V;
|
||||
if (Parser.parseAbsoluteExpression(V))
|
||||
return error("Cannot parse int8 constant: ", Lexer.getTok());
|
||||
// TODO: error if value doesn't fit?
|
||||
Out.EmitIntValue(static_cast<uint64_t>(V), 1);
|
||||
const MCExpr *Val;
|
||||
SMLoc End;
|
||||
if (Parser.parseExpression(Val, End))
|
||||
return error("Cannot parse .int expression: ", Lexer.getTok());
|
||||
size_t NumBits = 0;
|
||||
DirectiveID.getString().drop_front(4).getAsInteger(10, NumBits);
|
||||
Out.EmitValue(Val, NumBits / 8, End);
|
||||
return expect(AsmToken::EndOfStatement, "EOL");
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,10 @@ test0:
|
||||
.L.str:
|
||||
.int8 'H'
|
||||
.asciz "ello, World!"
|
||||
.size .L.str, 14
|
||||
.int16 1234
|
||||
.int64 5000000000
|
||||
.int32 2000000000
|
||||
.size .L.str, 28
|
||||
|
||||
.ident "clang version 9.0.0 (trunk 364502) (llvm/trunk 364571)"
|
||||
.globaltype __stack_pointer, i32
|
||||
@ -185,5 +188,8 @@ test0:
|
||||
# CHECK-NEXT: .L.str:
|
||||
# CHECK-NEXT: .int8 72
|
||||
# CHECK-NEXT: .asciz "ello, World!"
|
||||
# CHECK-NEXT: .int16 1234
|
||||
# CHECK-NEXT: .int64 5000000000
|
||||
# CHECK-NEXT: .int32 2000000000
|
||||
|
||||
# CHECK: .globaltype __stack_pointer, i32
|
||||
|
Loading…
Reference in New Issue
Block a user