--- /dev/null
+# RUN: llvm-mc %s > %t
+
+# RUN: grep -A 2 TEST0 %t > %t2
+# RUN: grep ".org 1, 0" %t2 | count 1
+TEST0:
+ .org 1
+
+# RUN: grep -A 2 TEST1 %t > %t2
+# RUN: grep ".org 1, 3" %t2 | count 1
+TEST1:
+ .org 1, 3
return ParseDirectiveValue(8);
if (!strcmp(IDVal, ".fill"))
return ParseDirectiveFill();
+ if (!strcmp(IDVal, ".org"))
+ return ParseDirectiveOrg();
if (!strcmp(IDVal, ".space"))
return ParseDirectiveSpace();
return false;
}
-
MCInst Inst;
if (ParseX86InstOperands(Inst))
return true;
return false;
}
+
+/// ParseDirectiveOrg
+/// ::= .org expression [ , expression ]
+bool AsmParser::ParseDirectiveOrg() {
+ int64_t Offset;
+ if (ParseExpression(Offset))
+ return true;
+
+ // Parse optional fill expression.
+ int64_t FillExpr = 0;
+ if (Lexer.isNot(asmtok::EndOfStatement)) {
+ if (Lexer.isNot(asmtok::Comma))
+ return TokError("unexpected token in '.org' directive");
+ Lexer.Lex();
+
+ if (ParseExpression(FillExpr))
+ return true;
+
+ if (Lexer.isNot(asmtok::EndOfStatement))
+ return TokError("unexpected token in '.org' directive");
+ }
+
+ Lexer.Lex();
+
+ Out.EmitValueToOffset(MCValue::get(Offset), FillExpr);
+
+ return false;
+}
bool ParseDirectiveFill(); // ".fill"
bool ParseDirectiveSpace(); // ".space"
bool ParseDirectiveSet(); // ".set"
+ bool ParseDirectiveOrg(); // ".org"
};