return Ret;
}
+// Check to see if the expression is a substring of the asm operand.
+static StringRef getMSInlineAsmExprName(StringRef Name) {
+ // Strip off the size directives.
+ // E.g., DWORD PTR [V] -> V
+ if (Name.startswith("BYTE") || Name.startswith("byte") ||
+ Name.startswith("WORD") || Name.startswith("word") ||
+ Name.startswith("DWORD") || Name.startswith("dword") ||
+ Name.startswith("QWORD") || Name.startswith("qword") ||
+ Name.startswith("XWORD") || Name.startswith("xword") ||
+ Name.startswith("XMMWORD") || Name.startswith("xmmword") ||
+ Name.startswith("YMMWORD") || Name.startswith("ymmword")) {
+ std::pair< StringRef, StringRef > SplitName = Name.split(' ');
+ assert((SplitName.second.startswith("PTR") ||
+ SplitName.second.startswith("ptr")) &&
+ "Expected PTR/ptr!");
+ SplitName = SplitName.second.split('[');
+ SplitName = SplitName.second.split(']');
+ return SplitName.first;
+ }
+ return Name;
+}
+
// getIdentifierInfo - Given a Name and a range of tokens, find the associated
// IdentifierInfo*.
static IdentifierInfo *getIdentifierInfo(StringRef Name,
if (isMSAsmKeyword(Pieces[0]))
return false;
- for (unsigned i = 1, e = Pieces.size(); i != e; ++i)
- if (!TI.isValidGCCRegisterName(Pieces[i]))
+ for (unsigned i = 1, e = Pieces.size(); i != e; ++i) {
+ StringRef Op = getMSInlineAsmExprName(Pieces[i]);
+ if (!TI.isValidGCCRegisterName(Op))
return false;
+ }
return true;
}
return false;
}
-// Check to see if the expression is a substring of the asm operand.
-static StringRef getMSInlineAsmExprName(StringRef Name) {
- // Strip off the size directives.
- // E.g., DWORD PTR [V] -> V
- if (Name.startswith("BYTE") || Name.startswith("byte") ||
- Name.startswith("WORD") || Name.startswith("word") ||
- Name.startswith("DWORD") || Name.startswith("dword") ||
- Name.startswith("QWORD") || Name.startswith("qword") ||
- Name.startswith("XWORD") || Name.startswith("xword") ||
- Name.startswith("XMMWORD") || Name.startswith("xmmword") ||
- Name.startswith("YMMWORD") || Name.startswith("ymmword")) {
- std::pair< StringRef, StringRef > SplitName = Name.split(' ');
- assert((SplitName.second.startswith("PTR") ||
- SplitName.second.startswith("ptr")) &&
- "Expected PTR/ptr!");
- SplitName = SplitName.second.split('[');
- SplitName = SplitName.second.split(']');
- return SplitName.first;
- }
- return Name;
-}
-
#define DEF_SIMPLE_MSASM(STR) \
MSAsmStmt *NS = \
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true, \