[llvm-commits] [llvm] r163231 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/InlineAsm.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/ConstantsContext.h lib/VMCore/Core.cpp lib/VMCore/InlineAsm.cpp
Chad Rosier
mcrosier at apple.com
Wed Sep 5 12:00:49 PDT 2012
Author: mcrosier
Date: Wed Sep 5 14:00:49 2012
New Revision: 163231
URL: http://llvm.org/viewvc/llvm-project?rev=163231&view=rev
Log:
[ms-inline asm] Enumerate the InlineAsm dialects and rename the nsdialect to
inteldialect.
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
llvm/trunk/include/llvm/InlineAsm.h
llvm/trunk/lib/AsmParser/LLLexer.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLToken.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/lib/VMCore/ConstantsContext.h
llvm/trunk/lib/VMCore/Core.cpp
llvm/trunk/lib/VMCore/InlineAsm.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Wed Sep 5 14:00:49 2012
@@ -2894,19 +2894,18 @@
call void asm alignstack "eieio", ""()
</pre>
-<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>
+<p>Inline asms also support using non-standard assembly dialects. The assumed
+ dialect is ATT. When the '<tt>inteldialect</tt>' keyword is present, the
+ inline asm is using the Intel dialect. Currently, ATT and Intel are the
+ only supported dialects. An example is:</p>
<pre class="doc_code">
-call void asm nsdialect "eieio", ""()
+call void asm inteldialect "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>
+ '<tt>inteldialect</tt>' keyword last.</p>
<!--
<p>TODO: The format of the asm and constraints string still need to be
Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Wed Sep 5 14:00:49 2012
@@ -168,7 +168,7 @@
CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
CST_CODE_DATA = 22, // DATA: [n x elements]
CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack|
- // nsdialect,asmstr,conststr]
+ // asmdialect,asmstr,conststr]
};
/// CastOpcodes - These are values used in the bitcode files to encode which
Modified: llvm/trunk/include/llvm/InlineAsm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InlineAsm.h (original)
+++ llvm/trunk/include/llvm/InlineAsm.h Wed Sep 5 14:00:49 2012
@@ -33,6 +33,13 @@
struct ConstantCreator;
class InlineAsm : public Value {
+public:
+ enum AsmDialect {
+ AD_ATT,
+ AD_Intel
+ };
+
+private:
friend struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType>;
friend class ConstantUniqueMap<InlineAsmKeyType, const InlineAsmKeyType&,
PointerType, InlineAsm, false>;
@@ -43,12 +50,11 @@
std::string AsmString, Constraints;
bool HasSideEffects;
bool IsAlignStack;
- /// AsmDialect - 0 is AT&T (default) and 1 is the Intel dialect.
- unsigned AsmDialect;
+ AsmDialect Dialect;
InlineAsm(PointerType *Ty, const std::string &AsmString,
const std::string &Constraints, bool hasSideEffects,
- bool isAlignStack, unsigned asmDialect);
+ bool isAlignStack, AsmDialect asmDialect);
virtual ~InlineAsm();
/// When the ConstantUniqueMap merges two types and makes two InlineAsms
@@ -60,11 +66,12 @@
///
static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
- bool isAlignStack = false, unsigned asmDialect = 0);
+ bool isAlignStack = false,
+ AsmDialect asmDialect = AD_ATT);
bool hasSideEffects() const { return HasSideEffects; }
bool isAlignStack() const { return IsAlignStack; }
- unsigned getDialect() const { return AsmDialect; }
+ AsmDialect getDialect() const { return Dialect; }
/// getType - InlineAsm's are always pointers.
///
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Wed Sep 5 14:00:49 2012
@@ -510,7 +510,7 @@
KEYWORD(asm);
KEYWORD(sideeffect);
KEYWORD(alignstack);
- KEYWORD(nsdialect);
+ KEYWORD(inteldialect);
KEYWORD(gc);
KEYWORD(ccc);
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Sep 5 14:00:49 2012
@@ -2069,18 +2069,18 @@
case lltok::kw_asm: {
// ValID ::= 'asm' SideEffect? AlignStack? STRINGCONSTANT ',' STRINGCONSTANT
- bool HasSideEffect, AlignStack, NSDialect;
+ bool HasSideEffect, AlignStack, AsmDialect;
Lex.Lex();
if (ParseOptionalToken(lltok::kw_sideeffect, HasSideEffect) ||
ParseOptionalToken(lltok::kw_alignstack, AlignStack) ||
- ParseOptionalToken(lltok::kw_nsdialect, NSDialect) ||
+ ParseOptionalToken(lltok::kw_inteldialect, AsmDialect) ||
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) |
- (unsigned(NSDialect)<<2);
+ (unsigned(AsmDialect)<<2);
ID.Kind = ValID::t_InlineAsm;
return false;
}
@@ -2498,7 +2498,7 @@
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)&1, (ID.UIntVal>>2)&1);
+ (ID.UIntVal>>1)&1, (InlineAsm::AsmDialect(ID.UIntVal>>2)));
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=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Wed Sep 5 14:00:49 2012
@@ -72,7 +72,7 @@
kw_asm,
kw_sideeffect,
kw_alignstack,
- kw_nsdialect,
+ kw_inteldialect,
kw_gc,
kw_c,
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Sep 5 14:00:49 2012
@@ -1245,7 +1245,7 @@
V = ConstantExpr::getICmp(Record[3], Op0, Op1);
break;
}
- // This maintains backward compatibility, pre-'nsdialect'.
+ // This maintains backward compatibility, pre-asm dialect keywords.
// FIXME: Remove with the 4.0 release.
case bitc::CST_CODE_INLINEASM_OLD: {
if (Record.size() < 2) return Error("Invalid INLINEASM record");
@@ -1268,7 +1268,8 @@
AsmStr, ConstrStr, HasSideEffects, IsAlignStack);
break;
}
- // This version adds support for the 'nsdialect' keyword.
+ // This version adds support for the asm dialect keywords (e.g.,
+ // inteldialect).
case bitc::CST_CODE_INLINEASM: {
if (Record.size() < 2) return Error("Invalid INLINEASM record");
std::string AsmStr, ConstrStr;
@@ -1289,7 +1290,7 @@
PointerType *PTy = cast<PointerType>(CurTy);
V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
AsmStr, ConstrStr, HasSideEffects, IsAlignStack,
- AsmDialect);
+ InlineAsm::AsmDialect(AsmDialect));
break;
}
case bitc::CST_CODE_BLOCKADDRESS:{
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Sep 5 14:00:49 2012
@@ -1029,8 +1029,9 @@
Out << "sideeffect ";
if (IA->isAlignStack())
Out << "alignstack ";
- if (IA->getDialect() != 0)
- Out << "nsdialect ";
+ // We don't emit the AD_ATT dialect as it's the assumed default.
+ if (IA->getDialect() == InlineAsm::AD_Intel)
+ Out << "inteldialect ";
Out << '"';
PrintEscapedString(IA->getAsmString(), Out);
Out << "\", \"";
Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
+++ llvm/trunk/lib/VMCore/ConstantsContext.h Wed Sep 5 14:00:49 2012
@@ -352,7 +352,7 @@
struct InlineAsmKeyType {
InlineAsmKeyType(StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
- bool isAlignStack, unsigned asmDialect)
+ bool isAlignStack, InlineAsm::AsmDialect asmDialect)
: asm_string(AsmString), constraints(Constraints),
has_side_effects(hasSideEffects), is_align_stack(isAlignStack),
asm_dialect(asmDialect) {}
@@ -360,7 +360,7 @@
std::string constraints;
bool has_side_effects;
bool is_align_stack;
- unsigned asm_dialect;
+ InlineAsm::AsmDialect asm_dialect;
bool operator==(const InlineAsmKeyType& that) const {
return this->asm_string == that.asm_string &&
this->constraints == that.constraints &&
Modified: llvm/trunk/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Core.cpp (original)
+++ llvm/trunk/lib/VMCore/Core.cpp Wed Sep 5 14:00:49 2012
@@ -1056,7 +1056,7 @@
const char *Constraints,
LLVMBool HasSideEffects,
LLVMBool IsAlignStack,
- unsigned AsmDialect) {
+ InlineAsm::AsmDialect AsmDialect) {
return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
Constraints, HasSideEffects, IsAlignStack,
AsmDialect));
Modified: llvm/trunk/lib/VMCore/InlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=163231&r1=163230&r2=163231&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/InlineAsm.cpp (original)
+++ llvm/trunk/lib/VMCore/InlineAsm.cpp Wed Sep 5 14:00:49 2012
@@ -27,7 +27,7 @@
InlineAsm *InlineAsm::get(FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
- bool isAlignStack, unsigned asmDialect) {
+ bool isAlignStack, AsmDialect asmDialect) {
InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack,
asmDialect);
LLVMContextImpl *pImpl = Ty->getContext().pImpl;
@@ -36,11 +36,11 @@
InlineAsm::InlineAsm(PointerType *Ty, const std::string &asmString,
const std::string &constraints, bool hasSideEffects,
- bool isAlignStack, unsigned asmDialect)
+ bool isAlignStack, AsmDialect asmDialect)
: Value(Ty, Value::InlineAsmVal),
AsmString(asmString), Constraints(constraints),
HasSideEffects(hasSideEffects), IsAlignStack(isAlignStack),
- AsmDialect(asmDialect) {
+ Dialect(asmDialect) {
// Do various checks on the constraint string and type.
assert(Verify(getFunctionType(), constraints) &&
More information about the llvm-commits
mailing list