[llvm-commits] [llvm] r163175 - in /llvm/trunk: include/llvm/InlineAsm.h lib/VMCore/ConstantsContext.h lib/VMCore/Core.cpp lib/VMCore/InlineAsm.cpp
Matt Beaumont-Gay
matthewbg at google.com
Tue Sep 4 19:11:42 PDT 2012
On Tue, Sep 4, 2012 at 3:46 PM, Chad Rosier <mcrosier at apple.com> wrote:
> Author: mcrosier
> Date: Tue Sep 4 17:46:24 2012
> New Revision: 163175
>
> URL: http://llvm.org/viewvc/llvm-project?rev=163175&view=rev
> Log:
> [ms-inline asm] Add the inline assembly dialect, AsmDialect, to the InlineAsm
> class.
>
> Modified:
> llvm/trunk/include/llvm/InlineAsm.h
> llvm/trunk/lib/VMCore/ConstantsContext.h
> llvm/trunk/lib/VMCore/Core.cpp
> llvm/trunk/lib/VMCore/InlineAsm.cpp
>
> Modified: llvm/trunk/include/llvm/InlineAsm.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=163175&r1=163174&r2=163175&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/InlineAsm.h (original)
> +++ llvm/trunk/include/llvm/InlineAsm.h Tue Sep 4 17:46:24 2012
> @@ -43,10 +43,12 @@
> std::string AsmString, Constraints;
> bool HasSideEffects;
> bool IsAlignStack;
> -
> + /// AsmDialect - 0 is AT&T (default) and 1 is the Intel dialect.
> + unsigned AsmDialect;
Comment from the peanut gallery: Either we're not going to grow any
more dialects, in which case maybe this should be a bool, or we are,
in which case this should be an enum.
> +
> InlineAsm(PointerType *Ty, const std::string &AsmString,
> const std::string &Constraints, bool hasSideEffects,
> - bool isAlignStack);
> + bool isAlignStack, unsigned asmDialect);
> virtual ~InlineAsm();
>
> /// When the ConstantUniqueMap merges two types and makes two InlineAsms
> @@ -58,11 +60,12 @@
> ///
> static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
> StringRef Constraints, bool hasSideEffects,
> - bool isAlignStack = false);
> + bool isAlignStack = false, unsigned asmDialect = 0);
>
> bool hasSideEffects() const { return HasSideEffects; }
> bool isAlignStack() const { return IsAlignStack; }
> -
> + unsigned getDialect() const { return AsmDialect; }
> +
> /// getType - InlineAsm's are always pointers.
> ///
> PointerType *getType() const {
>
> Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=163175&r1=163174&r2=163175&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
> +++ llvm/trunk/lib/VMCore/ConstantsContext.h Tue Sep 4 17:46:24 2012
> @@ -352,18 +352,21 @@
> struct InlineAsmKeyType {
> InlineAsmKeyType(StringRef AsmString,
> StringRef Constraints, bool hasSideEffects,
> - bool isAlignStack)
> + bool isAlignStack, unsigned asmDialect)
> : asm_string(AsmString), constraints(Constraints),
> - has_side_effects(hasSideEffects), is_align_stack(isAlignStack) {}
> + has_side_effects(hasSideEffects), is_align_stack(isAlignStack),
> + asm_dialect(asmDialect) {}
> std::string asm_string;
> std::string constraints;
> bool has_side_effects;
> bool is_align_stack;
> + unsigned asm_dialect;
> bool operator==(const InlineAsmKeyType& that) const {
> return this->asm_string == that.asm_string &&
> this->constraints == that.constraints &&
> this->has_side_effects == that.has_side_effects &&
> - this->is_align_stack == that.is_align_stack;
> + this->is_align_stack == that.is_align_stack &&
> + this->asm_dialect == that.asm_dialect;
> }
> bool operator<(const InlineAsmKeyType& that) const {
> if (this->asm_string != that.asm_string)
> @@ -374,6 +377,8 @@
> return this->has_side_effects < that.has_side_effects;
> if (this->is_align_stack != that.is_align_stack)
> return this->is_align_stack < that.is_align_stack;
> + if (this->asm_dialect != that.asm_dialect)
> + return this->asm_dialect < that.asm_dialect;
> return false;
> }
>
> @@ -490,7 +495,8 @@
> struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType> {
> static InlineAsm *create(PointerType *Ty, const InlineAsmKeyType &Key) {
> return new InlineAsm(Ty, Key.asm_string, Key.constraints,
> - Key.has_side_effects, Key.is_align_stack);
> + Key.has_side_effects, Key.is_align_stack,
> + Key.asm_dialect);
> }
> };
>
> @@ -499,7 +505,8 @@
> typedef InlineAsmKeyType ValType;
> static ValType getValType(InlineAsm *Asm) {
> return InlineAsmKeyType(Asm->getAsmString(), Asm->getConstraintString(),
> - Asm->hasSideEffects(), Asm->isAlignStack());
> + Asm->hasSideEffects(), Asm->isAlignStack(),
> + Asm->getDialect());
> }
> };
>
>
> Modified: llvm/trunk/lib/VMCore/Core.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=163175&r1=163174&r2=163175&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Core.cpp (original)
> +++ llvm/trunk/lib/VMCore/Core.cpp Tue Sep 4 17:46:24 2012
> @@ -1055,9 +1055,11 @@
> LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
> const char *Constraints,
> LLVMBool HasSideEffects,
> - LLVMBool IsAlignStack) {
> + LLVMBool IsAlignStack,
> + unsigned AsmDialect) {
> return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
> - Constraints, HasSideEffects, IsAlignStack));
> + Constraints, HasSideEffects, IsAlignStack,
> + AsmDialect));
> }
>
> LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB) {
>
> Modified: llvm/trunk/lib/VMCore/InlineAsm.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=163175&r1=163174&r2=163175&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/InlineAsm.cpp (original)
> +++ llvm/trunk/lib/VMCore/InlineAsm.cpp Tue Sep 4 17:46:24 2012
> @@ -27,19 +27,20 @@
>
> InlineAsm *InlineAsm::get(FunctionType *Ty, StringRef AsmString,
> StringRef Constraints, bool hasSideEffects,
> - bool isAlignStack) {
> - InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack);
> + bool isAlignStack, unsigned asmDialect) {
> + InlineAsmKeyType Key(AsmString, Constraints, hasSideEffects, isAlignStack,
> + asmDialect);
> LLVMContextImpl *pImpl = Ty->getContext().pImpl;
> return pImpl->InlineAsms.getOrCreate(PointerType::getUnqual(Ty), Key);
> }
>
> InlineAsm::InlineAsm(PointerType *Ty, const std::string &asmString,
> const std::string &constraints, bool hasSideEffects,
> - bool isAlignStack)
> + bool isAlignStack, unsigned asmDialect)
> : Value(Ty, Value::InlineAsmVal),
> - AsmString(asmString),
> - Constraints(constraints), HasSideEffects(hasSideEffects),
> - IsAlignStack(isAlignStack) {
> + AsmString(asmString), Constraints(constraints),
> + HasSideEffects(hasSideEffects), IsAlignStack(isAlignStack),
> + AsmDialect(asmDialect) {
>
> // Do various checks on the constraint string and type.
> assert(Verify(getFunctionType(), constraints) &&
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list