[llvm-commits] [llvm] r163181 - in /llvm/trunk: docs/LangRef.html lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/VMCore/AsmWriter.cpp
Chad Rosier
mcrosier at apple.com
Tue Sep 4 17:08:17 PDT 2012
Author: mcrosier
Date: Tue Sep 4 19:08:17 2012
New Revision: 163181
URL: http://llvm.org/viewvc/llvm-project?rev=163181&view=rev
Log:
[ms-inline asm] Emit the (new) inline asm Non-Standard Dialect attribute.
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLToken.h
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=163181&r1=163180&r2=163181&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Sep 4 19:08:17 2012
@@ -2894,8 +2894,19 @@
call void asm alignstack "eieio", ""()
</pre>
-<p>If both keywords appear the '<tt>sideeffect</tt>' keyword must come
- first.</p>
+<p>Inline asms also support using non-standard assembly dialects. The standard
+ dialect is ATT, which is assumed when the '<tt>nsdialect</tt>' keyword is not
+ present. When the '<tt>nsdialect</tt>' keyword is present, the dialect is
+ assumed to be Intel. Currently, ATT and Intel are the only supported
+ dialects. An example is:</p>
+
+<pre class="doc_code">
+call void asm nsdialect "eieio", ""()
+</pre>
+
+<p>If multiple keywords appear the '<tt>sideeffect</tt>' keyword must come
+ first, the '<tt>alignstack</tt>' keyword second and the
+ '<tt>nsdialect</tt>' keyword last.</p>
<!--
<p>TODO: The format of the asm and constraints string still need to be
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=163181&r1=163180&r2=163181&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Sep 4 19:08:17 2012
@@ -2069,16 +2069,18 @@
case lltok::kw_asm: {
// ValID ::= 'asm' SideEffect? AlignStack? STRINGCONSTANT ',' STRINGCONSTANT
- bool HasSideEffect, AlignStack;
+ bool HasSideEffect, AlignStack, NSDialect;
Lex.Lex();
if (ParseOptionalToken(lltok::kw_sideeffect, HasSideEffect) ||
ParseOptionalToken(lltok::kw_alignstack, AlignStack) ||
+ ParseOptionalToken(lltok::kw_nsdialect, NSDialect) ||
ParseStringConstant(ID.StrVal) ||
ParseToken(lltok::comma, "expected comma in inline asm expression") ||
ParseToken(lltok::StringConstant, "expected constraint string"))
return true;
ID.StrVal2 = Lex.getStrVal();
- ID.UIntVal = unsigned(HasSideEffect) | (unsigned(AlignStack)<<1);
+ ID.UIntVal = unsigned(HasSideEffect) | (unsigned(AlignStack)<<1) |
+ (unsigned(NSDialect)<<2);
ID.Kind = ValID::t_InlineAsm;
return false;
}
@@ -2495,7 +2497,8 @@
PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
if (!FTy || !InlineAsm::Verify(FTy, ID.StrVal2))
return Error(ID.Loc, "invalid type for inline asm constraint string");
- V = InlineAsm::get(FTy, ID.StrVal, ID.StrVal2, ID.UIntVal&1, ID.UIntVal>>1);
+ V = InlineAsm::get(FTy, ID.StrVal, ID.StrVal2, ID.UIntVal&1,
+ (ID.UIntVal>>1)&1, (ID.UIntVal>>2)&1);
return false;
}
case ValID::t_MDNode:
Modified: llvm/trunk/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=163181&r1=163180&r2=163181&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Tue Sep 4 19:08:17 2012
@@ -72,6 +72,7 @@
kw_asm,
kw_sideeffect,
kw_alignstack,
+ kw_nsdialect,
kw_gc,
kw_c,
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=163181&r1=163180&r2=163181&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Sep 4 19:08:17 2012
@@ -1029,6 +1029,8 @@
Out << "sideeffect ";
if (IA->isAlignStack())
Out << "alignstack ";
+ if (IA->getDialect() != 0)
+ Out << "nsdialect ";
Out << '"';
PrintEscapedString(IA->getAsmString(), Out);
Out << "\", \"";
More information about the llvm-commits
mailing list