From 8ba2d5befc05ca73d3bac8708819bbbe759e2cf9 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Wed, 21 Oct 2009 23:28:00 +0000 Subject: [PATCH] Rename msasm to alignstack per review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84795 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 16 ++++++++++------ include/llvm/InlineAsm.h | 8 ++++---- lib/AsmParser/LLLexer.cpp | 2 +- lib/AsmParser/LLParser.cpp | 8 ++++---- lib/AsmParser/LLToken.h | 2 +- lib/Bitcode/Reader/BitcodeReader.cpp | 4 ++-- lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- lib/VMCore/AsmWriter.cpp | 4 ++-- lib/VMCore/Core.cpp | 4 ++-- lib/VMCore/InlineAsm.cpp | 10 ++++++---- 10 files changed, 33 insertions(+), 27 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 236538d3e48..f3e5d9f2e11 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -2339,9 +2339,9 @@ has undefined behavior.

a special value. This value represents the inline assembler as a string (containing the instructions to emit), a list of operand constraints (stored as a string), a flag that indicates whether or not the inline asm - expression has side effects, and a flag indicating whether the asm came - originally from an asm block. An example inline assembler - expression is:

+ expression has side effects, and a flag indicating whether the function + containing the asm needs to align its stack conservatively. An example + inline assembler expression is:

@@ -2369,12 +2369,16 @@ call void asm sideeffect "eieio", ""()
 
-

Inline asms derived from asm blocks are similarly marked with the - 'msasm' keyword:

+

In some cases inline asms will contain code that will not work unless the + stack is aligned in some way, such as calls or SSE instructions on x86, + yet will not contain code that does that alignment within the asm. + The compiler should make conservative assumptions about what the asm might + contain and should generate its usual stack alignment code in the prologue + if the 'alignstack' keyword is present:

-call void asm msasm "eieio", ""()
+call void asm alignstack "eieio", ""()
 
diff --git a/include/llvm/InlineAsm.h b/include/llvm/InlineAsm.h index bc55031b0d4..d54870e49f5 100644 --- a/include/llvm/InlineAsm.h +++ b/include/llvm/InlineAsm.h @@ -31,11 +31,11 @@ class InlineAsm : public Value { std::string AsmString, Constraints; bool HasSideEffects; - bool IsMsAsm; + bool IsAlignStack; InlineAsm(const FunctionType *Ty, const StringRef &AsmString, const StringRef &Constraints, bool hasSideEffects, - bool isMsAsm = false); + bool isAlignStack = false); virtual ~InlineAsm(); public: @@ -43,10 +43,10 @@ public: /// static InlineAsm *get(const FunctionType *Ty, const StringRef &AsmString, const StringRef &Constraints, bool hasSideEffects, - bool isMsAsm = false); + bool isAlignStack = false); bool hasSideEffects() const { return HasSideEffects; } - bool isMsAsm() const { return IsMsAsm; } + bool isAlignStack() const { return IsAlignStack; } /// getType - InlineAsm's are always pointers. /// diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index cb7660596a1..f6cea8887c9 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -529,7 +529,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(module); KEYWORD(asm); KEYWORD(sideeffect); - KEYWORD(msasm); + KEYWORD(alignstack); KEYWORD(gc); KEYWORD(ccc); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index d21f98707fe..8724470c9bb 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1974,17 +1974,17 @@ bool LLParser::ParseValID(ValID &ID) { return false; case lltok::kw_asm: { - // ValID ::= 'asm' SideEffect? MsAsm? STRINGCONSTANT ',' STRINGCONSTANT - bool HasSideEffect, MsAsm; + // ValID ::= 'asm' SideEffect? AlignStack? STRINGCONSTANT ',' STRINGCONSTANT + bool HasSideEffect, AlignStack; Lex.Lex(); if (ParseOptionalToken(lltok::kw_sideeffect, HasSideEffect) || - ParseOptionalToken(lltok::kw_msasm, MsAsm) || + ParseOptionalToken(lltok::kw_alignstack, AlignStack) || 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 = HasSideEffect | ((unsigned)MsAsm<<1); + ID.UIntVal = HasSideEffect | ((unsigned)AlignStack<<1); ID.Kind = ValID::t_InlineAsm; return false; } diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 7b12a53f527..f5072fe52f9 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -62,7 +62,7 @@ namespace lltok { kw_module, kw_asm, kw_sideeffect, - kw_msasm, + kw_alignstack, kw_gc, kw_c, diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index c9eba24b823..7f3be2b84a6 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1165,7 +1165,7 @@ bool BitcodeReader::ParseConstants() { if (Record.size() < 2) return Error("Invalid INLINEASM record"); std::string AsmStr, ConstrStr; bool HasSideEffects = Record[0] & 1; - bool IsMsAsm = Record[0] >> 1; + bool IsAlignStack = Record[0] >> 1; unsigned AsmStrSize = Record[1]; if (2+AsmStrSize >= Record.size()) return Error("Invalid INLINEASM record"); @@ -1179,7 +1179,7 @@ bool BitcodeReader::ParseConstants() { ConstrStr += (char)Record[3+AsmStrSize+i]; const PointerType *PTy = cast(CurTy); V = InlineAsm::get(cast(PTy->getElementType()), - AsmStr, ConstrStr, HasSideEffects, IsMsAsm); + AsmStr, ConstrStr, HasSideEffects, IsAlignStack); break; } } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 3e4c8232a64..a8c1ef7c728 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -678,7 +678,7 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, if (const InlineAsm *IA = dyn_cast(V)) { Record.push_back(unsigned(IA->hasSideEffects()) | - unsigned(IA->isMsAsm()) << 1); + unsigned(IA->isAlignStack()) << 1); // Add the asm string. const std::string &AsmStr = IA->getAsmString(); diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index d2a0f9073f9..6ee2ece0f0d 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1205,8 +1205,8 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V, Out << "asm "; if (IA->hasSideEffects()) Out << "sideeffect "; - if (IA->isMsAsm()) - Out << "msasm "; + if (IA->isAlignStack()) + Out << "alignstack "; Out << '"'; PrintEscapedString(IA->getAsmString(), Out); Out << "\", \""; diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index d1bf0634460..a28037d3f28 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -885,9 +885,9 @@ LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, int HasSideEffects, - int IsMsAsm) { + int IsAlignStack) { return wrap(InlineAsm::get(dyn_cast(unwrap(Ty)), AsmString, - Constraints, HasSideEffects, IsMsAsm)); + Constraints, HasSideEffects, IsAlignStack)); } /*--.. Operations on global variables, functions, and aliases (globals) ....--*/ diff --git a/lib/VMCore/InlineAsm.cpp b/lib/VMCore/InlineAsm.cpp index 0520dfa17ce..3a36a1b97a5 100644 --- a/lib/VMCore/InlineAsm.cpp +++ b/lib/VMCore/InlineAsm.cpp @@ -28,18 +28,20 @@ InlineAsm::~InlineAsm() { InlineAsm *InlineAsm::get(const FunctionType *Ty, const StringRef &AsmString, const StringRef &Constraints, bool hasSideEffects, - bool isMsAsm) { + bool isAlignStack) { // FIXME: memoize! - return new InlineAsm(Ty, AsmString, Constraints, hasSideEffects, isMsAsm); + return new InlineAsm(Ty, AsmString, Constraints, hasSideEffects, + isAlignStack); } InlineAsm::InlineAsm(const FunctionType *Ty, const StringRef &asmString, const StringRef &constraints, bool hasSideEffects, - bool isMsAsm) + bool isAlignStack) : Value(PointerType::getUnqual(Ty), Value::InlineAsmVal), AsmString(asmString), - Constraints(constraints), HasSideEffects(hasSideEffects), IsMsAsm(isMsAsm) { + Constraints(constraints), HasSideEffects(hasSideEffects), + IsAlignStack(isAlignStack) { // Do various checks on the constraint string and type. assert(Verify(Ty, constraints) && "Function type not legal for constraints!");