<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 4, 2012, at 8:05 PM, Chandler Carruth wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 4, 2012 at 10:11 PM, Matt Beaumont-Gay <span dir="ltr"><<a href="mailto:matthewbg@google.com" target="_blank" class="cremed">matthewbg@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="HOEnZb"><div class="h5">On Tue, Sep 4, 2012 at 3:46 PM, Chad Rosier <<a href="mailto:mcrosier@apple.com" class="cremed">mcrosier@apple.com</a>> wrote:<br>

> Author: mcrosier<br>
> Date: Tue Sep  4 17:46:24 2012<br>
> New Revision: 163175<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=163175&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=163175&view=rev</a><br>
> Log:<br>
> [ms-inline asm] Add the inline assembly dialect, AsmDialect, to the InlineAsm<br>
> class.<br>
><br>
> Modified:<br>
>     llvm/trunk/include/llvm/InlineAsm.h<br>
>     llvm/trunk/lib/VMCore/ConstantsContext.h<br>
>     llvm/trunk/lib/VMCore/Core.cpp<br>
>     llvm/trunk/lib/VMCore/InlineAsm.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm/InlineAsm.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=163175&r1=163174&r2=163175&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=163175&r1=163174&r2=163175&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/InlineAsm.h (original)<br>
> +++ llvm/trunk/include/llvm/InlineAsm.h Tue Sep  4 17:46:24 2012<br>
> @@ -43,10 +43,12 @@<br>
>    std::string AsmString, Constraints;<br>
>    bool HasSideEffects;<br>
>    bool IsAlignStack;<br>
> -<br>
> +  /// AsmDialect - 0 is AT&T (default) and 1 is the Intel dialect.<br>
> +  unsigned AsmDialect;<br>
<br>
</div></div>Comment from the peanut gallery: Either we're not going to grow any<br>
more dialects, in which case maybe this should be a bool, or we are,<br>
in which case this should be an enum.</blockquote></div></div></blockquote><div><br></div><div>I'll take care of the enum in the morning.</div><br><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote"><div>I think an enum makes the most sense either way -- it's self documenting and matches the plan for the IR dialect support: focus on the two we care about today, but leave open the possibility of more later.</div></div></div></blockquote><div><br></div><div>I was thinking about this after I left work today.  I think I'm going to rename the nsdialect to inteldialect.  Originally, we were using a function attribute, which were running low on bits.  When the time arrived that we wanted to add another dialect we were going to add a side structure.  However, now that this isn't being implemented as a function attribute, I don't think we need to worry so much about saving bits (we have 30 bits and I don't suspect we're going to be adding much beyond the sideeffect, alignstack, and [a-zA-Z]*dialect) .  I also think the inteldialect keyword gives some indication as to what it means; nsdialect isn't very intuitive.</div><div><br></div><div>I'll change this tomorrow assuming no one objects.</div><div><br></div><div> Chad</div><br><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> +<br>
>    InlineAsm(PointerType *Ty, const std::string &AsmString,<br>
>              const std::string &Constraints, bool hasSideEffects,<br>
> -            bool isAlignStack);<br>
> +            bool isAlignStack, unsigned asmDialect);<br>
>    virtual ~InlineAsm();<br>
><br>
>    /// When the ConstantUniqueMap merges two types and makes two InlineAsms<br>
> @@ -58,11 +60,12 @@<br>
>    ///<br>
>    static InlineAsm *get(FunctionType *Ty, StringRef AsmString,<br>
>                          StringRef Constraints, bool hasSideEffects,<br>
> -                        bool isAlignStack = false);<br>
> +                        bool isAlignStack = false, unsigned asmDialect = 0);<br>
><br>
>    bool hasSideEffects() const { return HasSideEffects; }<br>
>    bool isAlignStack() const { return IsAlignStack; }<br>
> -<br>
> +  unsigned getDialect() const { return AsmDialect; }<br>
> +<br>
>    /// getType - InlineAsm's are always pointers.<br>
>    ///<br>
>    PointerType *getType() const {<br>
><br>
> Modified: llvm/trunk/lib/VMCore/ConstantsContext.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=163175&r1=163174&r2=163175&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=163175&r1=163174&r2=163175&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/VMCore/ConstantsContext.h (original)<br>
> +++ llvm/trunk/lib/VMCore/ConstantsContext.h Tue Sep  4 17:46:24 2012<br>
> @@ -352,18 +352,21 @@<br>
>  struct InlineAsmKeyType {<br>
>    InlineAsmKeyType(StringRef AsmString,<br>
>                     StringRef Constraints, bool hasSideEffects,<br>
> -                   bool isAlignStack)<br>
> +                   bool isAlignStack, unsigned asmDialect)<br>
>      : asm_string(AsmString), constraints(Constraints),<br>
> -      has_side_effects(hasSideEffects), is_align_stack(isAlignStack) {}<br>
> +      has_side_effects(hasSideEffects), is_align_stack(isAlignStack),<br>
> +      asm_dialect(asmDialect) {}<br>
>    std::string asm_string;<br>
>    std::string constraints;<br>
>    bool has_side_effects;<br>
>    bool is_align_stack;<br>
> +  unsigned asm_dialect;<br>
>    bool operator==(const InlineAsmKeyType& that) const {<br>
>      return this->asm_string == that.asm_string &&<br>
>             this->constraints == that.constraints &&<br>
>             this->has_side_effects == that.has_side_effects &&<br>
> -           this->is_align_stack == <a href="http://that.is">that.is</a>_align_stack;<br>
> +           this->is_align_stack == <a href="http://that.is">that.is</a>_align_stack &&<br>
> +           this->asm_dialect == that.asm_dialect;<br>
>    }<br>
>    bool operator<(const InlineAsmKeyType& that) const {<br>
>      if (this->asm_string != that.asm_string)<br>
> @@ -374,6 +377,8 @@<br>
>        return this->has_side_effects < that.has_side_effects;<br>
>      if (this->is_align_stack != <a href="http://that.is">that.is</a>_align_stack)<br>
>        return this->is_align_stack < <a href="http://that.is">that.is</a>_align_stack;<br>
> +    if (this->asm_dialect != that.asm_dialect)<br>
> +      return this->asm_dialect < that.asm_dialect;<br>
>      return false;<br>
>    }<br>
><br>
> @@ -490,7 +495,8 @@<br>
>  struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType> {<br>
>    static InlineAsm *create(PointerType *Ty, const InlineAsmKeyType &Key) {<br>
>      return new InlineAsm(Ty, Key.asm_string, Key.constraints,<br>
> -                         Key.has_side_effects, <a href="http://Key.is">Key.is</a>_align_stack);<br>
> +                         Key.has_side_effects, <a href="http://Key.is">Key.is</a>_align_stack,<br>
> +                         Key.asm_dialect);<br>
>    }<br>
>  };<br>
><br>
> @@ -499,7 +505,8 @@<br>
>    typedef InlineAsmKeyType ValType;<br>
>    static ValType getValType(InlineAsm *Asm) {<br>
>      return InlineAsmKeyType(Asm->getAsmString(), Asm->getConstraintString(),<br>
> -                            Asm->hasSideEffects(), Asm->isAlignStack());<br>
> +                            Asm->hasSideEffects(), Asm->isAlignStack(),<br>
> +                            Asm->getDialect());<br>
>    }<br>
>  };<br>
><br>
><br>
> Modified: llvm/trunk/lib/VMCore/Core.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=163175&r1=163174&r2=163175&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=163175&r1=163174&r2=163175&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/VMCore/Core.cpp (original)<br>
> +++ llvm/trunk/lib/VMCore/Core.cpp Tue Sep  4 17:46:24 2012<br>
> @@ -1055,9 +1055,11 @@<br>
>  LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,<br>
>                                  const char *Constraints,<br>
>                                  LLVMBool HasSideEffects,<br>
> -                                LLVMBool IsAlignStack) {<br>
> +                                LLVMBool IsAlignStack,<br>
> +                                unsigned AsmDialect) {<br>
>    return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,<br>
> -                             Constraints, HasSideEffects, IsAlignStack));<br>
> +                             Constraints, HasSideEffects, IsAlignStack,<br>
> +                             AsmDialect));<br>
>  }<br>
><br>
>  LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB) {<br>
><br>
> Modified: llvm/trunk/lib/VMCore/InlineAsm.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=163175&r1=163174&r2=163175&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=163175&r1=163174&r2=163175&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/VMCore/InlineAsm.cpp (original)<br>
> +++ llvm/trunk/lib/VMCore/InlineAsm.cpp Tue Sep  4 17:46:24 2012<br>
> @@ -27,19 +27,20 @@<br>
><br>
>  InlineAsm *InlineAsm::get(FunctionType *Ty, StringRef AsmString,<br>
>                            StringRef Constraints, bool hasSideEffects,<br>
> -                          bool isAlignStack) {<br>
> -  InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack);<br>
> +                          bool isAlignStack, unsigned asmDialect) {<br>
> +  InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack,<br>
> +                       asmDialect);<br>
>    LLVMContextImpl *pImpl = Ty->getContext().pImpl;<br>
>    return pImpl->InlineAsms.getOrCreate(PointerType::getUnqual(Ty), Key);<br>
>  }<br>
><br>
>  InlineAsm::InlineAsm(PointerType *Ty, const std::string &asmString,<br>
>                       const std::string &constraints, bool hasSideEffects,<br>
> -                     bool isAlignStack)<br>
> +                     bool isAlignStack, unsigned asmDialect)<br>
>    : Value(Ty, Value::InlineAsmVal),<br>
> -    AsmString(asmString),<br>
> -    Constraints(constraints), HasSideEffects(hasSideEffects),<br>
> -    IsAlignStack(isAlignStack) {<br>
> +    AsmString(asmString), Constraints(constraints),<br>
> +    HasSideEffects(hasSideEffects), IsAlignStack(isAlignStack),<br>
> +    AsmDialect(asmDialect) {<br>
><br>
>    // Do various checks on the constraint string and type.<br>
>    assert(Verify(getFunctionType(), constraints) &&<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>