Rename msasm to alignstack per review.
authorDale Johannesen <dalej@apple.com>
Wed, 21 Oct 2009 23:28:00 +0000 (23:28 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 21 Oct 2009 23:28:00 +0000 (23:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84795 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.html
include/llvm/InlineAsm.h
lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLToken.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Core.cpp
lib/VMCore/InlineAsm.cpp

index 236538d3e48a869c603c6704d493a8941da3185d..f3e5d9f2e11e6801c3d6920d75466b25030b05a0 100644 (file)
@@ -2339,9 +2339,9 @@ has undefined behavior.</p>
    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:</p>
+   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:</p>
 
 <div class="doc_code">
 <pre>
@@ -2369,12 +2369,16 @@ call void asm sideeffect "eieio", ""()
 </pre>
 </div>
 
-<p>Inline asms derived from asm blocks are similarly marked with the
-   '<tt>msasm</tt>' keyword:</p>
+<p>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 '<tt>alignstack</tt>' keyword is present:</p>
 
 <div class="doc_code">
 <pre>
-call void asm msasm "eieio", ""()
+call void asm alignstack "eieio", ""()
 </pre>
 </div>
 
index bc55031b0d42e40cee5ae8ae8adc69f95ec35342..d54870e49f5d544ab926e58ce04a30b2e371275f 100644 (file)
@@ -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.
   ///
index cb7660596a1d7c2010af728722cb3e95a2ae79ab..f6cea8887c9b28b37f3f30215851c1c4b7596a76 100644 (file)
@@ -529,7 +529,7 @@ lltok::Kind LLLexer::LexIdentifier() {
   KEYWORD(module);
   KEYWORD(asm);
   KEYWORD(sideeffect);
-  KEYWORD(msasm);
+  KEYWORD(alignstack);
   KEYWORD(gc);
 
   KEYWORD(ccc);
index d21f98707fe9fad82fc976f7312de2a4fa6f8398..8724470c9bbe4aa994019afa1d066b3663c5235e 100644 (file)
@@ -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;
   }
index 7b12a53f52741aa8907b5998e8f3477f8391470e..f5072fe52f9cfdec544f46c579bfe5231553636f 100644 (file)
@@ -62,7 +62,7 @@ namespace lltok {
     kw_module,
     kw_asm,
     kw_sideeffect,
-    kw_msasm,
+    kw_alignstack,
     kw_gc,
     kw_c,
 
index c9eba24b82343dc530e4342ddb3e378139de0aa3..7f3be2b84a6cfa7a2aae1771906cd707de458af7 100644 (file)
@@ -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<PointerType>(CurTy);
       V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
-                         AsmStr, ConstrStr, HasSideEffects, IsMsAsm);
+                         AsmStr, ConstrStr, HasSideEffects, IsAlignStack);
       break;
     }
     }
index 3e4c8232a64f5bae02875884ac90a56e413c0e41..a8c1ef7c728fc3c91aa5e63cdb2eb0dbb939ffa2 100644 (file)
@@ -678,7 +678,7 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
 
     if (const InlineAsm *IA = dyn_cast<InlineAsm>(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();
index d2a0f9073f922ceff59f2d24ef23b3cfec53f621..6ee2ece0f0da0d3e7334964d1b8fd9fdd1c3c821 100644 (file)
@@ -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 << "\", \"";
index d1bf063446072e7898791228bcf9eb178a58ddb6..a28037d3f28f364934ac7b6b3ec87f90b6d74575 100644 (file)
@@ -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<FunctionType>(unwrap(Ty)), AsmString, 
-                             Constraints, HasSideEffects, IsMsAsm));
+                             Constraints, HasSideEffects, IsAlignStack));
 }
 
 /*--.. Operations on global variables, functions, and aliases (globals) ....--*/
index 0520dfa17cedadf96ab4423b588ea2155501417e..3a36a1b97a5c4d6a14d4643708dd6efea89b70b3 100644 (file)
@@ -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!");