aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-10-25 20:41:34 +0000
committerChad Rosier <mcrosier@apple.com>2012-10-25 20:41:34 +0000
commit6a020a71173a3ea7738a9df69982e85ddbfe0303 (patch)
treefb7b62a0e688224d0cc04d755bc382f190956b56 /lib/MC
parent61131ab15fd593a2e295d79fe2714e7bc21f2ec8 (diff)
downloadexternal_llvm-6a020a71173a3ea7738a9df69982e85ddbfe0303.zip
external_llvm-6a020a71173a3ea7738a9df69982e85ddbfe0303.tar.gz
external_llvm-6a020a71173a3ea7738a9df69982e85ddbfe0303.tar.bz2
[ms-inline asm] Add support for creating AsmRewrites in the target specific
AsmParser logic. To be used/tested in a subsequent commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCDisassembler/EDDisassembler.cpp3
-rw-r--r--lib/MC/MCParser/AsmParser.cpp33
2 files changed, 10 insertions, 26 deletions
diff --git a/lib/MC/MCDisassembler/EDDisassembler.cpp b/lib/MC/MCDisassembler/EDDisassembler.cpp
index 1226f1a..eed7a77 100644
--- a/lib/MC/MCDisassembler/EDDisassembler.cpp
+++ b/lib/MC/MCDisassembler/EDDisassembler.cpp
@@ -366,8 +366,9 @@ int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
instName = OpcodeToken.getString();
instLoc = OpcodeToken.getLoc();
+ ParseInstructionInfo Info;
if (NextToken.isNot(AsmToken::Eof) &&
- TargetParser->ParseInstruction(instName, instLoc, operands))
+ TargetParser->ParseInstruction(Info, instName, instLoc, operands))
ret = -1;
} else {
ret = -1;
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 5e4447a..b47a6bd 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -86,7 +86,7 @@ public:
MemoryBuffer *I);
};
-struct AsmRewrite;
+//struct AsmRewrite;
struct ParseStatementInfo {
/// ParsedOperands - The parsed operands from the last parsed statement.
SmallVector<MCParsedAsmOperand*, 8> ParsedOperands;
@@ -1365,8 +1365,9 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
for (unsigned i = 0, e = IDVal.size(); i != e; ++i)
OpcodeStr.push_back(tolower(IDVal[i]));
- bool HadError = getTargetParser().ParseInstruction(OpcodeStr.str(), IDLoc,
- Info.ParsedOperands);
+ ParseInstructionInfo IInfo(Info.AsmRewrites);
+ bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr.str(),
+ IDLoc,Info.ParsedOperands);
// Dump the parsed representation, if requested.
if (getShowParsedOperands()) {
@@ -3583,27 +3584,6 @@ bool AsmParser::ParseDirectiveEndr(SMLoc DirectiveLoc) {
return false;
}
-namespace {
-enum AsmRewriteKind {
- AOK_Imm,
- AOK_Input,
- AOK_Output,
- AOK_SizeDirective,
- AOK_Emit,
- AOK_Skip
-};
-
-struct AsmRewrite {
- AsmRewriteKind Kind;
- SMLoc Loc;
- unsigned Len;
- unsigned Size;
-public:
- AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, unsigned size = 0)
- : Kind(kind), Loc(loc), Len(len), Size(size) { }
-};
-}
-
bool AsmParser::ParseDirectiveEmit(SMLoc IDLoc, ParseStatementInfo &Info) {
const MCExpr *Value;
SMLoc ExprLoc = getLexer().getLoc();
@@ -3780,7 +3760,7 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
OS << OutputIdx++;
break;
case AOK_SizeDirective:
- switch((*I).Size) {
+ switch((*I).Val) {
default: break;
case 8: OS << "byte ptr "; break;
case 16: OS << "word ptr "; break;
@@ -3794,6 +3774,9 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
case AOK_Emit:
OS << ".byte";
break;
+ case AOK_DotOperator:
+ OS << (*I).Val;
+ break;
}
// Skip the original expression.