From sanjiv.gupta at microchip.com Mon Feb 8 00:08:32 2010 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Mon, 08 Feb 2010 06:08:32 -0000 Subject: [llvm-commits] [llvm] r95532 - /llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp Message-ID: <201002080608.o1868WGU012054@zion.cs.uiuc.edu> Author: sgupta Date: Mon Feb 8 00:08:32 2010 New Revision: 95532 URL: http://llvm.org/viewvc/llvm-project?rev=95532&view=rev Log: Fixed build error for redefinition. Modified: llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp Modified: llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp?rev=95532&r1=95531&r2=95532&view=diff ============================================================================== --- llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp (original) +++ llvm/trunk/tools/llvmc/example/mcc16/driver/Main.cpp Mon Feb 8 00:08:32 2010 @@ -46,8 +46,6 @@ // We are creating a temp dir in current dir, with the cached name. // But before that remove if one already exists with that name.. - - llvm::sys::Path tempDir; tempDir = TempDirname; tempDir.eraseFromDisk(true); From edwintorok at gmail.com Mon Feb 8 02:37:29 2010 From: edwintorok at gmail.com (Torok Edwin) Date: Mon, 08 Feb 2010 08:37:29 -0000 Subject: [llvm-commits] [llvm] r95537 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <201002080837.o188bThc018649@zion.cs.uiuc.edu> Author: edwin Date: Mon Feb 8 02:37:27 2010 New Revision: 95537 URL: http://llvm.org/viewvc/llvm-project?rev=95537&view=rev Log: Fix x86 JIT stub on MSVC. Thanks to Kristaps Straupe for noticing the bug. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=95537&r1=95536&r2=95537&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Feb 8 02:37:27 2010 @@ -297,6 +297,7 @@ push edx push ecx and esp, -16 + sub esp, 16 mov eax, dword ptr [ebp+4] mov dword ptr [esp+4], eax mov dword ptr [esp], ebp From baldrick at free.fr Mon Feb 8 02:42:10 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 08:42:10 -0000 Subject: [llvm-commits] [dragonegg] r95538 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002080842.o188gAwI021390@zion.cs.uiuc.edu> Author: baldrick Date: Mon Feb 8 02:42:10 2010 New Revision: 95538 URL: http://llvm.org/viewvc/llvm-project?rev=95538&view=rev Log: Remove unused methods. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95538&r1=95537&r2=95538&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Mon Feb 8 02:42:10 2010 @@ -1374,35 +1374,6 @@ return DECL_LLVM(decl); // Decl could have changed if it changed type. } -/// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be -/// weak, but it already had an llvm object created for it. This marks the LLVM -/// object weak as well. -void llvm_mark_decl_weak(tree decl) { - assert(DECL_LLVM_SET_P(decl) && DECL_WEAK(decl) && - isa(DECL_LLVM(decl)) && "Decl isn't marked weak!"); - GlobalValue *GV = cast(DECL_LLVM(decl)); - - // Do not mark something that is already known to be linkonce or internal. - // The user may have explicitly asked for weak linkage - ignore flag_odr. - if (GV->hasExternalLinkage()) { - GlobalValue::LinkageTypes Linkage; - if (GV->isDeclaration()) { - Linkage = GlobalValue::ExternalWeakLinkage; - } else { - Linkage = GlobalValue::WeakAnyLinkage; - // Allow loads from constants to be folded even if the constant has weak - // linkage. Do this by giving the constant weak_odr linkage rather than - // weak linkage. It is not clear whether this optimization is valid (see - // gcc bug 36685), but mainline gcc chooses to do it, and fold may already - // have done it, so we might as well join in with gusto. - if (GlobalVariable *GVar = dyn_cast(GV)) - if (GVar->isConstant()) - Linkage = GlobalValue::WeakODRLinkage; - } - GV->setLinkage(Linkage); - } -} - /// register_ctor_dtor - Called to register static ctors/dtors with LLVM. /// Fn is a 'void()' ctor/dtor function to be run, initprio is the init /// priority, and isCtor indicates whether this is a ctor or dtor. @@ -1410,16 +1381,6 @@ (isCtor ? &StaticCtors:&StaticDtors)->push_back(std::make_pair(Fn, InitPrio)); } -/// llvm_emit_file_scope_asm - Emit the specified string as a file-scope inline -/// asm block. -void llvm_emit_file_scope_asm(const char *string) { - if (TheModule->getModuleInlineAsm().empty()) - TheModule->setModuleInlineAsm(string); - else - TheModule->setModuleInlineAsm(TheModule->getModuleInlineAsm() + "\n" + - string); -} - //FIXME/// print_llvm - Print the specified LLVM chunk like an operand, called by //FIXME/// print-tree.c for tree dumps. //FIXMEvoid print_llvm(FILE *file, void *LLVM) { From baldrick at free.fr Mon Feb 8 05:03:33 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 11:03:33 -0000 Subject: [llvm-commits] [llvm] r95542 - /llvm/trunk/docs/CommandGuide/lit.pod Message-ID: <201002081103.o18B3XaL009357@zion.cs.uiuc.edu> Author: baldrick Date: Mon Feb 8 05:03:31 2010 New Revision: 95542 URL: http://llvm.org/viewvc/llvm-project?rev=95542&view=rev Log: Fix some typos. Modified: llvm/trunk/docs/CommandGuide/lit.pod Modified: llvm/trunk/docs/CommandGuide/lit.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/lit.pod?rev=95542&r1=95541&r2=95542&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/lit.pod (original) +++ llvm/trunk/docs/CommandGuide/lit.pod Mon Feb 8 05:03:31 2010 @@ -49,13 +49,13 @@ =item B<-j> I, B<--threads>=I -Run I tests in parallel. By default, this is automatically chose to match the -number of detected available CPUs. +Run I tests in parallel. By default, this is automatically chosen to match +the number of detected available CPUs. =item B<--config-prefix>=I Search for I and I when searching for test suites, -instead I and I. +instead of I and I. =item B<--param> I, B<--param> I=I @@ -237,7 +237,7 @@ B proper is primarily an infrastructure for discovering and running arbitrary tests, and to expose a single convenient interface to these -tests. B itself doesn't contain know how to run tests, rather this logic is +tests. B itself doesn't know how to run tests, rather this logic is defined by I. =head2 TEST SUITES From gvenn.cfe.dev at gmail.com Mon Feb 8 05:04:44 2010 From: gvenn.cfe.dev at gmail.com (Garrison Venn) Date: Mon, 8 Feb 2010 06:04:44 -0500 Subject: [llvm-commits] [patch] ExceptionDemo patch for review In-Reply-To: <0ADCDC2B-5C3D-43CE-839C-17195BAA7E05@gmail.com> References: <293820A4-96A4-4FF6-8333-A66FAAB0743E@gmail.com> <00C79483-D11D-4F19-88B8-D28E859CCDF2@apple.com> <0ADCDC2B-5C3D-43CE-839C-17195BAA7E05@gmail.com> Message-ID: Should I check in? Garrison On Feb 5, 2010, at 10:40, Garrison Venn wrote: > Hi Eric, > > Thanks for your time. As much as I can tell, the attached patch has your recommended changes implemented. > Do you have further changes you want me to make before check in? > > Thanks in advance > > Garrison > > On Feb 4, 2010, at 21:44, Eric Christopher wrote: > >> >> [snip] >> >> -eric > > -------------- next part -------------- A non-text attachment was scrubbed... Name: ExceptionDemo.patch Type: application/octet-stream Size: 77997 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100208/345a153e/attachment.obj -------------- next part -------------- From johnny.chen at apple.com Mon Feb 8 11:26:09 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 08 Feb 2010 17:26:09 -0000 Subject: [llvm-commits] [llvm] r95548 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002081726.o18HQ9ki029106@zion.cs.uiuc.edu> Author: johnny Date: Mon Feb 8 11:26:09 2010 New Revision: 95548 URL: http://llvm.org/viewvc/llvm-project?rev=95548&view=rev Log: Added VMOVRRS/VMOVSRR to ARMInstrVFP.td for disassembly purpose. A8.6.331 VMOV (between two ARM core registers and two single-precision registers) Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95548&r1=95547&r2=95548&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Feb 8 11:26:09 2010 @@ -252,6 +252,13 @@ let Inst{7-6} = 0b00; } +def VMOVRRS : AVConv3I<0b11000101, 0b1010, + (outs GPR:$wb, GPR:$dst2), (ins SPR:$src1, SPR:$src2), + IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src1, $src2", + [/* For disassembly only; pattern left blank */]> { + let Inst{7-6} = 0b00; +} + // FMDHR: GPR -> SPR // FMDLR: GPR -> SPR @@ -262,6 +269,13 @@ let Inst{7-6} = 0b00; } +def VMOVSRR : AVConv5I<0b11000100, 0b1010, + (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2), + IIC_VMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2", + [/* For disassembly only; pattern left blank */]> { + let Inst{7-6} = 0b00; +} + // FMRDH: SPR -> GPR // FMRDL: SPR -> GPR // FMRRS: SPR -> GPR From daniel at zuster.org Mon Feb 8 12:08:47 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 08 Feb 2010 18:08:47 -0000 Subject: [llvm-commits] [llvm] r95551 - /llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h Message-ID: <201002081808.o18I8lCE031489@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Feb 8 12:08:46 2010 New Revision: 95551 URL: http://llvm.org/viewvc/llvm-project?rev=95551&view=rev Log: ImmutableIntervalMap: Fix for unqualified lookup into dependent base class, done by clang's -fixit! :) Modified: llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h?rev=95551&r1=95550&r2=95551&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableIntervalMap.h Mon Feb 8 12:08:46 2010 @@ -95,7 +95,7 @@ TreeTy *Add(TreeTy *T, value_type_ref V) { T = Add_internal(V,T); - MarkImmutable(T); + this->MarkImmutable(T); return T; } @@ -103,31 +103,31 @@ if (!T) return NULL; - key_type_ref CurrentKey = ImutInfo::KeyOfValue(Value(T)); + key_type_ref CurrentKey = ImutInfo::KeyOfValue(this->Value(T)); if (ImutInfo::isContainedIn(K, CurrentKey)) return T; else if (ImutInfo::isLess(K, CurrentKey)) - return Find(Left(T), K); + return Find(this->Left(T), K); else - return Find(Right(T), K); + return Find(this->Right(T), K); } private: TreeTy *Add_internal(value_type_ref V, TreeTy *T) { key_type_ref K = ImutInfo::KeyOfValue(V); T = RemoveAllOverlaps(T, K); - if (isEmpty(T)) - return CreateNode(NULL, V, NULL); + if (this->isEmpty(T)) + return this->CreateNode(NULL, V, NULL); assert(!T->isMutable()); - key_type_ref KCurrent = ImutInfo::KeyOfValue(Value(T)); + key_type_ref KCurrent = ImutInfo::KeyOfValue(this->Value(T)); if (ImutInfo::isLess(K, KCurrent)) - return Balance(Add_internal(V, Left(T)), Value(T), Right(T)); + return this->Balance(Add_internal(V, this->Left(T)), this->Value(T), this->Right(T)); else - return Balance(Left(T), Value(T), Add_internal(V, Right(T))); + return this->Balance(this->Left(T), this->Value(T), Add_internal(V, this->Right(T))); } // Remove all overlaps from T. @@ -136,7 +136,7 @@ do { Changed = false; T = RemoveOverlap(T, K, Changed); - MarkImmutable(T); + this->MarkImmutable(T); } while (Changed); return T; @@ -146,19 +146,19 @@ TreeTy *RemoveOverlap(TreeTy *T, key_type_ref K, bool &Changed) { if (!T) return NULL; - Interval CurrentK = ImutInfo::KeyOfValue(Value(T)); + Interval CurrentK = ImutInfo::KeyOfValue(this->Value(T)); // If current key does not overlap the inserted key. if (CurrentK.getStart() > K.getEnd()) - return Balance(RemoveOverlap(Left(T), K, Changed), Value(T), Right(T)); + return this->Balance(RemoveOverlap(this->Left(T), K, Changed), this->Value(T), this->Right(T)); else if (CurrentK.getEnd() < K.getStart()) - return Balance(Left(T), Value(T), RemoveOverlap(Right(T), K, Changed)); + return this->Balance(this->Left(T), this->Value(T), RemoveOverlap(this->Right(T), K, Changed)); // Current key overlaps with the inserted key. // Remove the current key. Changed = true; - data_type_ref OldData = ImutInfo::DataOfValue(Value(T)); - T = Remove_internal(CurrentK, T); + data_type_ref OldData = ImutInfo::DataOfValue(this->Value(T)); + T = this->Remove_internal(CurrentK, T); // Add back the unoverlapped part of the current key. if (CurrentK.getStart() < K.getStart()) { if (CurrentK.getEnd() <= K.getEnd()) { From dalej at apple.com Mon Feb 8 13:35:27 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 08 Feb 2010 19:35:27 -0000 Subject: [llvm-commits] [test-suite] r95556 - /test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile Message-ID: <201002081935.o18JZRlQ003054@zion.cs.uiuc.edu> Author: johannes Date: Mon Feb 8 13:35:27 2010 New Revision: 95556 URL: http://llvm.org/viewvc/llvm-project?rev=95556&view=rev Log: Make 147.vortex compile on x86-64. Don't know yet if this is enough to make it actually work. Modified: test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile Modified: test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile?rev=95556&r1=95555&r2=95556&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile (original) +++ test-suite/trunk/External/SPEC/CINT95/147.vortex/Makefile Mon Feb 8 13:35:27 2010 @@ -20,6 +20,10 @@ ## SPEC portability note for vortex says to use this flag on 64-bit machines CPPFLAGS += -D__RISC_64__ endif +ifeq ($(ARCH),x86_64) + ## SPEC portability note for vortex says to use this flag on 64-bit machines + CPPFLAGS += -D__RISC_64__ +endif ifeq ($(ENDIAN), big) RUN_OPTIONS = vortex.in.big From baldrick at free.fr Mon Feb 8 13:36:51 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 19:36:51 -0000 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h Message-ID: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> Author: baldrick Date: Mon Feb 8 13:36:51 2010 New Revision: 95557 URL: http://llvm.org/viewvc/llvm-project?rev=95557&view=rev Log: Flesh out the list of predicates, for those who like this style. I was looking for isPointer, and added the rest for uniformity. Modified: llvm/trunk/include/llvm/Type.h Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=95557&r1=95556&r2=95557&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Mon Feb 8 13:36:51 2010 @@ -233,7 +233,27 @@ /// isFPOrFPVector - Return true if this is a FP type or a vector of FP types. /// bool isFPOrFPVector() const; - + + /// isFunction - True if this is an instance of FunctionType. + /// + bool isFunction() const { return ID == FunctionTyID; } + + /// isStruct - True if this is an instance of StructType. + /// + bool isStruct() const { return ID == StructTyID; } + + /// isArray - True if this is an instance of ArrayType. + /// + bool isArray() const { return ID == ArrayTyID; } + + /// isPointer - True if this is an instance of PointerType. + /// + bool isPointer() const { return ID == PointerTyID; } + + /// isVector - True if this is an instance of VectorType. + /// + bool isVector() const { return ID == VectorTyID; } + /// isAbstract - True if the type is either an Opaque type, or is a derived /// type that includes an opaque type somewhere in it. /// From dalej at apple.com Mon Feb 8 13:36:55 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 08 Feb 2010 19:36:55 -0000 Subject: [llvm-commits] [test-suite] r95558 - /test-suite/trunk/External/Nurbs/Makefile Message-ID: <201002081936.o18Jatrg003170@zion.cs.uiuc.edu> Author: johannes Date: Mon Feb 8 13:36:55 2010 New Revision: 95558 URL: http://llvm.org/viewvc/llvm-project?rev=95558&view=rev Log: Make nurbs compile on x86-64. Modified: test-suite/trunk/External/Nurbs/Makefile Modified: test-suite/trunk/External/Nurbs/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/Nurbs/Makefile?rev=95558&r1=95557&r2=95558&view=diff ============================================================================== --- test-suite/trunk/External/Nurbs/Makefile (original) +++ test-suite/trunk/External/Nurbs/Makefile Mon Feb 8 13:36:55 2010 @@ -9,6 +9,10 @@ LDFLAGS = -lstdc++ LIBS += -lstdc++ +ifeq ($(ARCH),x86_64) + CPPFLAGS += '-DDWORD=unsigned long long' +endif + RUN_OPTIONS = /k all timed /t 500 /vsteps 192 /usteps 192 /vcp 20 /ucp 20 include $(LEVEL)/MultiSource/Makefile.multisrc From sabre at nondot.org Mon Feb 8 13:41:08 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 19:41:08 -0000 Subject: [llvm-commits] [llvm] r95559 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp lib/MC/MCMachOStreamer.cpp Message-ID: <201002081941.o18Jf8ku003405@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 13:41:07 2010 New Revision: 95559 URL: http://llvm.org/viewvc/llvm-project?rev=95559&view=rev Log: add scaffolding for target-specific MCExprs. Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95559&r1=95558&r2=95559&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Feb 8 13:41:07 2010 @@ -29,7 +29,8 @@ Binary, ///< Binary expressions. Constant, ///< Constant expressions. SymbolRef, ///< References to labels and assigned expressions. - Unary ///< Unary expressions. + Unary, ///< Unary expressions. + Target ///< Target specific expression. }; private: @@ -326,6 +327,28 @@ static bool classof(const MCBinaryExpr *) { return true; } }; +/// MCTargetExpr - This is an extension point for target-specific MCExpr +/// subclasses to implement. +/// +/// NOTE: All subclasses are required to have trivial destructors because +/// MCExprs are bump pointer allocated and not destructed. +class MCTargetExpr : public MCExpr { + virtual ~MCTargetExpr(); // Not accessible. +protected: + MCTargetExpr() : MCExpr(Target) {} + +public: + + virtual void PrintImpl(raw_ostream &OS) const = 0; + virtual bool EvaluateAsRelocatableImpl(MCValue &Res) const = 0; + + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Target; + } + static bool classof(const MCTargetExpr *) { return true; } +}; + } // end namespace llvm #endif Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=95559&r1=95558&r2=95559&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Feb 8 13:41:07 2010 @@ -17,6 +17,8 @@ void MCExpr::print(raw_ostream &OS) const { switch (getKind()) { + case MCExpr::Target: + return cast(this)->PrintImpl(OS); case MCExpr::Constant: OS << cast(*this).getValue(); return; @@ -131,6 +133,7 @@ return Create(Ctx.GetOrCreateSymbol(Name), Ctx); } +MCTargetExpr::~MCTargetExpr() {} /* *** */ @@ -168,6 +171,9 @@ bool MCExpr::EvaluateAsRelocatable(MCValue &Res) const { switch (getKind()) { + case Target: + return cast(this)->EvaluateAsRelocatableImpl(Res); + case Constant: Res = MCValue::get(cast(this)->getValue()); return true; Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=95559&r1=95558&r2=95559&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Mon Feb 8 13:41:07 2010 @@ -87,6 +87,7 @@ const MCExpr *AddValueSymbols(const MCExpr *Value) { switch (Value->getKind()) { + case MCExpr::Target: assert(0 && "Can't handle target exprs yet!"); case MCExpr::Constant: break; From johnny.chen at apple.com Mon Feb 8 13:41:48 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 08 Feb 2010 19:41:48 -0000 Subject: [llvm-commits] [llvm] r95560 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002081941.o18JfmHA003445@zion.cs.uiuc.edu> Author: johnny Date: Mon Feb 8 13:41:48 2010 New Revision: 95560 URL: http://llvm.org/viewvc/llvm-project?rev=95560&view=rev Log: Add VCMP (VFP floating-point compare without 'E' bit set) for disassembly purpose. Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95560&r1=95559&r2=95560&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Feb 8 13:41:48 2010 @@ -128,9 +128,17 @@ IIC_fpCMP64, "vcmpe", ".f64\t$a, $b", [(arm_cmpfp DPR:$a, DPR:$b)]>; +def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins DPR:$a, DPR:$b), + IIC_fpCMP64, "vcmp", ".f64\t$a, $b", + [/* For disassembly only; pattern left blank */]>; + def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins SPR:$a, SPR:$b), IIC_fpCMP32, "vcmpe", ".f32\t$a, $b", [(arm_cmpfp SPR:$a, SPR:$b)]>; + +def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins SPR:$a, SPR:$b), + IIC_fpCMP32, "vcmp", ".f32\t$a, $b", + [/* For disassembly only; pattern left blank */]>; } def VDIVD : ADbI<0b11101, 0b00, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), @@ -189,9 +197,17 @@ IIC_fpCMP64, "vcmpe", ".f64\t$a, #0", [(arm_cmpfp0 DPR:$a)]>; +def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins DPR:$a), + IIC_fpCMP64, "vcmp", ".f64\t$a, #0", + [/* For disassembly only; pattern left blank */]>; + def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins SPR:$a), IIC_fpCMP32, "vcmpe", ".f32\t$a, #0", [(arm_cmpfp0 SPR:$a)]>; + +def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins SPR:$a), + IIC_fpCMP32, "vcmp", ".f32\t$a, #0", + [/* For disassembly only; pattern left blank */]>; } def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0, (outs DPR:$dst), (ins SPR:$a), From gohman at apple.com Mon Feb 8 13:43:34 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 8 Feb 2010 11:43:34 -0800 Subject: [llvm-commits] [llvm] r95466 - in /llvm/trunk: bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli docs/LangRef.html include/llvm-c/Core.h include/llvm/Attributes.h include/llvm/Transforms/IPO/InlinerPass.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/CppBackend/CPPBackend.cpp lib/Transforms/IPO/Inliner.cpp lib/VMCore/Attributes.cpp utils/llvm.grm utils/vim/llvm.vim In-Reply-To: <4180BC77-D123-467F-B060-4995D47EA7FB@2pi.dk> References: <201002060116.o161GTZq030499@zion.cs.uiuc.edu> <4B6D0FEC.4030608@mxc.ca> <4180BC77-D123-467F-B060-4995D47EA7FB@2pi.dk> Message-ID: On Feb 7, 2010, at 10:16 AM, Jakob Stoklund Olesen wrote: > > On Feb 5, 2010, at 10:45 PM, Nick Lewycky wrote: > >> Jakob, it sounds like this is actually experimental. Assuming you don't make any progress between now and the time the branch is created, should this patch be backed out of the 2.7 release? Realize that if we don't, we're stuck with a bit allocated to the InlineHint function attr in the bitcode until 3.x. > > There are two separate issues here: > > 1. Should the C99 and C++ inline keyword affect the optimizer? > 2. If so, how? > > The consensus is that the first answer is yes, the inline keyword should affect the optimizer. Without profiling data it is very difficult to make the right size/performance tradeoff, and the inline keyword can help. The rest the story here is that GCC uses the inline keyword to adjust its heuristics, and there are influential codebases which have come to expect GCC's inlining heuristics. Dan From gohman at apple.com Mon Feb 8 14:09:41 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 8 Feb 2010 12:09:41 -0800 Subject: [llvm-commits] [llvm] r95493 - in /llvm/trunk: lib/CodeGen/ lib/Target/X86/ test/CodeGen/ARM/ test/CodeGen/X86/ In-Reply-To: <201002060907.o1697ERw029934@zion.cs.uiuc.edu> References: <201002060907.o1697ERw029934@zion.cs.uiuc.edu> Message-ID: Hi Evan, The testcase included here, codegen-dce.ll, contains code which in the real world would be deleted by instcombine (the PHI has no users). Do you have a testcase where the MachineInstr-level DCE pass deletes code which would actually show up in a real testcase, such as the formal parameter lowering case that you mentioned in the commit message? Thanks, Dan On Feb 6, 2010, at 1:07 AM, Evan Cheng wrote: > Author: evancheng > Date: Sat Feb 6 03:07:11 2010 > New Revision: 95493 > > URL: http://llvm.org/viewvc/llvm-project?rev=95493&view=rev > Log: > Run codegen dce pass for all targets at all optimization levels. Previously it's > only run for x86 with fastisel. I've found it being very effective in > eliminating some obvious dead code as result of formal parameter lowering > especially when tail call optimization eliminated the need for some of the loads > from fixed frame objects. It also shrinks a number of the tests. A couple of > tests no longer make sense and are now eliminated. > > Added: > llvm/trunk/test/CodeGen/X86/codegen-dce.ll > - copied, changed from r95474, llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll > Removed: > llvm/trunk/test/CodeGen/ARM/remat-2.ll > llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll > llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll > Modified: > llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp > llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > llvm/trunk/test/CodeGen/ARM/2009-10-30.ll > llvm/trunk/test/CodeGen/ARM/long_shift.ll > llvm/trunk/test/CodeGen/ARM/remat.ll > llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll > llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll > llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll > llvm/trunk/test/CodeGen/X86/sext-i1.ll > llvm/trunk/test/CodeGen/X86/sse3.ll > llvm/trunk/test/CodeGen/X86/tailcall2.ll > > Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) > +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Sat Feb 6 03:07:11 2010 > @@ -11,6 +11,7 @@ > // > //===----------------------------------------------------------------------===// > > +#define DEBUG_TYPE "codegen-dce" > #include "llvm/CodeGen/Passes.h" > #include "llvm/Pass.h" > #include "llvm/CodeGen/MachineFunctionPass.h" > @@ -19,8 +20,11 @@ > #include "llvm/Support/raw_ostream.h" > #include "llvm/Target/TargetInstrInfo.h" > #include "llvm/Target/TargetMachine.h" > +#include "llvm/ADT/Statistic.h" > using namespace llvm; > > +STATISTIC(NumDeletes, "Number of dead instructions deleted"); > + > namespace { > class DeadMachineInstructionElim : public MachineFunctionPass { > virtual bool runOnMachineFunction(MachineFunction &MF); > @@ -126,6 +130,7 @@ > DEBUG(dbgs() << "DeadMachineInstructionElim: DELETING: " << *MI); > AnyChanges = true; > MI->eraseFromParent(); > + ++NumDeletes; > MIE = MBB->rend(); > // MII is now pointing to the next instruction to process, > // so don't increment it. > > Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) > +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Sat Feb 6 03:07:11 2010 > @@ -291,6 +291,12 @@ > printAndVerify(PM, "After Instruction Selection", > /* allowDoubleDefs= */ true); > > + > + // Delete dead machine instructions regardless of optimization level. > + PM.add(createDeadMachineInstructionElimPass()); > + printAndVerify(PM, "After codegen DCE pass", > + /* allowDoubleDefs= */ true); > + > if (OptLevel != CodeGenOpt::None) { > PM.add(createOptimizeExtsPass()); > if (!DisableMachineLICM) > > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Feb 6 03:07:11 2010 > @@ -671,6 +671,9 @@ > for (MachineFunction::iterator MBBI = mf_->begin(), E = mf_->end(); > MBBI != E; ++MBBI) { > MachineBasicBlock *MBB = MBBI; > + if (MBB->empty()) > + continue; > + > // Track the index of the current machine instr. > SlotIndex MIIndex = getMBBStartIdx(MBB); > DEBUG(dbgs() << MBB->getName() << ":\n"); > > Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Sat Feb 6 03:07:11 2010 > @@ -148,10 +148,6 @@ > // Install an instruction selector. > PM.add(createX86ISelDag(*this, OptLevel)); > > - // If we're using Fast-ISel, clean up the mess. > - if (EnableFastISel) > - PM.add(createDeadMachineInstructionElimPass()); > - > // Install a pass to insert x87 FP_REG_KILL instructions, as needed. > PM.add(createX87FPRegKillInserterPass()); > > > Modified: llvm/trunk/test/CodeGen/ARM/2009-10-30.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-10-30.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-10-30.ll (original) > +++ llvm/trunk/test/CodeGen/ARM/2009-10-30.ll Sat Feb 6 03:07:11 2010 > @@ -5,8 +5,8 @@ > define void @f(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, ...) { > entry: > ;CHECK: sub sp, sp, #4 > -;CHECK: add r0, sp, #8 > -;CHECK: str r0, [sp], #+4 > +;CHECK: add r{{[0-9]+}}, sp, #8 > +;CHECK: str r{{[0-9]+}}, [sp], #+4 > ;CHECK: bx lr > %ap = alloca i8*, align 4 > %ap1 = bitcast i8** %ap to i8* > > Modified: llvm/trunk/test/CodeGen/ARM/long_shift.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/long_shift.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/ARM/long_shift.ll (original) > +++ llvm/trunk/test/CodeGen/ARM/long_shift.ll Sat Feb 6 03:07:11 2010 > @@ -23,10 +23,10 @@ > define i32 @f2(i64 %x, i64 %y) { > ; CHECK: f2 > ; CHECK: mov r0, r0, lsr r2 > -; CHECK-NEXT: rsb r3, r2, #32 > +; CHECK-NEXT: rsb r12, r2, #32 > ; CHECK-NEXT: sub r2, r2, #32 > ; CHECK-NEXT: cmp r2, #0 > -; CHECK-NEXT: orr r0, r0, r1, lsl r3 > +; CHECK-NEXT: orr r0, r0, r1, lsl r12 > ; CHECK-NEXT: movge r0, r1, asr r2 > %a = ashr i64 %x, %y > %b = trunc i64 %a to i32 > @@ -36,10 +36,10 @@ > define i32 @f3(i64 %x, i64 %y) { > ; CHECK: f3 > ; CHECK: mov r0, r0, lsr r2 > -; CHECK-NEXT: rsb r3, r2, #32 > +; CHECK-NEXT: rsb r12, r2, #32 > ; CHECK-NEXT: sub r2, r2, #32 > ; CHECK-NEXT: cmp r2, #0 > -; CHECK-NEXT: orr r0, r0, r1, lsl r3 > +; CHECK-NEXT: orr r0, r0, r1, lsl r12 > ; CHECK-NEXT: movge r0, r1, lsr r2 > %a = lshr i64 %x, %y > %b = trunc i64 %a to i32 > > Removed: llvm/trunk/test/CodeGen/ARM/remat-2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat-2.ll?rev=95492&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/ARM/remat-2.ll (original) > +++ llvm/trunk/test/CodeGen/ARM/remat-2.ll (removed) > @@ -1,65 +0,0 @@ > -; RUN: llc < %s -march=arm -mattr=+v6,+vfp2 -stats -info-output-file - | grep "Number of re-materialization" > - > -define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv) nounwind { > -entry: > - br i1 undef, label %smvp.exit, label %bb.i3 > - > -bb.i3: ; preds = %bb.i3, %bb134 > - br i1 undef, label %smvp.exit, label %bb.i3 > - > -smvp.exit: ; preds = %bb.i3 > - %0 = fmul double undef, 2.400000e-03 ; [#uses=2] > - br i1 undef, label %bb138.preheader, label %bb159 > - > -bb138.preheader: ; preds = %smvp.exit > - br label %bb138 > - > -bb138: ; preds = %bb138, %bb138.preheader > - br i1 undef, label %bb138, label %bb145.loopexit > - > -bb142: ; preds = %bb.nph218.bb.nph218.split_crit_edge, %phi0.exit > - %1 = fmul double undef, -1.200000e-03 ; [#uses=1] > - %2 = fadd double undef, %1 ; [#uses=1] > - %3 = fmul double %2, undef ; [#uses=1] > - %4 = fsub double 0.000000e+00, %3 ; [#uses=1] > - br i1 %14, label %phi1.exit, label %bb.i35 > - > -bb.i35: ; preds = %bb142 > - %5 = call arm_apcscc double @sin(double %15) nounwind readonly ; [#uses=1] > - %6 = fmul double %5, 0x4031740AFA84AD8A ; [#uses=1] > - %7 = fsub double 1.000000e+00, undef ; [#uses=1] > - %8 = fdiv double %7, 6.000000e-01 ; [#uses=1] > - br label %phi1.exit > - > -phi1.exit: ; preds = %bb.i35, %bb142 > - %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=0] > - %9 = phi double [ %8, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] > - %10 = fmul double undef, %9 ; [#uses=0] > - br i1 %14, label %phi0.exit, label %bb.i > - > -bb.i: ; preds = %phi1.exit > - unreachable > - > -phi0.exit: ; preds = %phi1.exit > - %11 = fsub double %4, undef ; [#uses=1] > - %12 = fadd double 0.000000e+00, %11 ; [#uses=1] > - store double %12, double* undef, align 4 > - br label %bb142 > - > -bb145.loopexit: ; preds = %bb138 > - br i1 undef, label %bb.nph218.bb.nph218.split_crit_edge, label %bb159 > - > -bb.nph218.bb.nph218.split_crit_edge: ; preds = %bb145.loopexit > - %13 = fmul double %0, 0x401921FB54442D18 ; [#uses=1] > - %14 = fcmp ugt double %0, 6.000000e-01 ; [#uses=2] > - %15 = fdiv double %13, 6.000000e-01 ; [#uses=1] > - br label %bb142 > - > -bb159: ; preds = %bb145.loopexit, %smvp.exit, %bb134 > - unreachable > - > -bb166: ; preds = %bb127 > - unreachable > -} > - > -declare arm_apcscc double @sin(double) nounwind readonly > > Modified: llvm/trunk/test/CodeGen/ARM/remat.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/ARM/remat.ll (original) > +++ llvm/trunk/test/CodeGen/ARM/remat.ll Sat Feb 6 03:07:11 2010 > @@ -1,119 +1,65 @@ > -; RUN: llc < %s -mtriple=arm-apple-darwin > -; RUN: llc < %s -mtriple=arm-apple-darwin -stats -info-output-file - | grep "Number of re-materialization" | grep 3 > +; RUN: llc < %s -march=arm -mattr=+v6,+vfp2 -stats -info-output-file - | grep "Number of re-materialization" > > - %struct.CONTENTBOX = type { i32, i32, i32, i32, i32 } > - %struct.LOCBOX = type { i32, i32, i32, i32 } > - %struct.SIDEBOX = type { i32, i32 } > - %struct.UNCOMBOX = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } > - %struct.cellbox = type { i8*, i32, i32, i32, [9 x i32], i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, i32, i32, %struct.CONTENTBOX*, %struct.UNCOMBOX*, [8 x %struct.tilebox*], %struct.SIDEBOX* } > - %struct.termbox = type { %struct.termbox*, i32, i32, i32, i32, i32 } > - %struct.tilebox = type { %struct.tilebox*, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.termbox*, %struct.LOCBOX* } > - at numcells = external global i32 ; [#uses=1] > - at cellarray = external global %struct.cellbox** ; <%struct.cellbox***> [#uses=1] > - at numBinsY = external global i32 ; [#uses=1] > - > -define fastcc void @fixpenal() { > +define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv, double %d1, double %d2) nounwind { > entry: > - %tmp491 = load i32* @numcells, align 4 ; [#uses=1] > - %tmp9 = load %struct.cellbox*** @cellarray, align 4 ; <%struct.cellbox**> [#uses=1] > - %tmp77.i = load i32* @numBinsY, align 4 ; [#uses=2] > - br label %bb490 > - > -bb8: ; preds = %bb490, %cond_false428 > - %foo3 = phi i1 [ 0, %bb490 ], [ 1, %cond_false428 ] > - br i1 %foo3, label %cond_false58.i, label %cond_false.i > - > -cond_false.i: ; preds = %bb8 > - ret void > - > -cond_false58.i: ; preds = %bb8 > - %highBinX.0.i = select i1 false, i32 1, i32 0 ; [#uses=2] > - br i1 %foo3, label %cond_next85.i, label %cond_false76.i > - > -cond_false76.i: ; preds = %cond_false58.i > - ret void > - > -cond_next85.i: ; preds = %cond_false58.i > - br i1 %foo3, label %cond_next105.i, label %cond_false98.i > - > -cond_false98.i: ; preds = %cond_next85.i > - ret void > - > -cond_next105.i: ; preds = %cond_next85.i > - %tmp108.i = icmp eq i32 1, %highBinX.0.i ; [#uses=1] > - %tmp115.i = icmp eq i32 1, %tmp77.i ; [#uses=1] > - %bothcond.i = and i1 %tmp115.i, %tmp108.i ; [#uses=1] > - %storemerge.i = select i1 %bothcond.i, i32 1, i32 0 ; [#uses=2] > - br i1 %bothcond.i, label %whoOverlaps.exit, label %bb503.preheader.i > - > -bb503.preheader.i: ; preds = %bb513.i, %cond_next105.i > - %i.022.0.i = phi i32 [ %tmp512.i, %bb513.i ], [ 0, %cond_next105.i ] ; [#uses=2] > - %tmp165.i = getelementptr i32*** null, i32 %i.022.0.i ; [#uses=0] > - br label %bb503.i > - > -bb137.i: ; preds = %bb503.i > - br i1 %tmp506.i, label %bb162.i, label %bb148.i > - > -bb148.i: ; preds = %bb137.i > - ret void > - > -bb162.i: ; preds = %bb137.i > - %tmp49435.i = load i32* null ; [#uses=1] > - br label %bb170.i > - > -bb170.i: ; preds = %bb491.i, %bb162.i > - %indvar.i = phi i32 [ %k.032.0.i, %bb491.i ], [ 0, %bb162.i ] ; [#uses=2] > - %k.032.0.i = add i32 %indvar.i, 1 ; [#uses=2] > - %tmp173.i = getelementptr i32* null, i32 %k.032.0.i ; [#uses=1] > - %tmp174.i = load i32* %tmp173.i ; [#uses=4] > - %tmp177.i = icmp eq i32 %tmp174.i, %cell.1 ; [#uses=1] > - %tmp184.i = icmp sgt i32 %tmp174.i, %tmp491 ; [#uses=1] > - %bothcond = or i1 %tmp177.i, %tmp184.i ; [#uses=1] > - br i1 %bothcond, label %bb491.i, label %cond_next188.i > - > -cond_next188.i: ; preds = %bb170.i > - %tmp191.i = getelementptr %struct.cellbox** %tmp9, i32 %tmp174.i ; <%struct.cellbox**> [#uses=1] > - %tmp192.i = load %struct.cellbox** %tmp191.i ; <%struct.cellbox*> [#uses=1] > - %tmp195.i = icmp eq i32 %tmp174.i, 0 ; [#uses=1] > - br i1 %tmp195.i, label %bb491.i, label %cond_true198.i > - > -cond_true198.i: ; preds = %cond_next188.i > - %tmp210.i = getelementptr %struct.cellbox* %tmp192.i, i32 0, i32 3 ; [#uses=0] > - ret void > - > -bb491.i: ; preds = %cond_next188.i, %bb170.i > - %tmp490.i = add i32 %indvar.i, 2 ; [#uses=1] > - %tmp496.i = icmp slt i32 %tmp49435.i, %tmp490.i ; [#uses=1] > - br i1 %tmp496.i, label %bb500.i, label %bb170.i > - > -bb500.i: ; preds = %bb491.i > - %indvar.next82.i = add i32 %j.0.i, 1 ; [#uses=1] > - br label %bb503.i > - > -bb503.i: ; preds = %bb500.i, %bb503.preheader.i > - %j.0.i = phi i32 [ 0, %bb503.preheader.i ], [ %indvar.next82.i, %bb500.i ] ; [#uses=2] > - %tmp506.i = icmp sgt i32 %j.0.i, %tmp77.i ; [#uses=1] > - br i1 %tmp506.i, label %bb513.i, label %bb137.i > - > -bb513.i: ; preds = %bb503.i > - %tmp512.i = add i32 %i.022.0.i, 1 ; [#uses=2] > - %tmp516.i = icmp sgt i32 %tmp512.i, %highBinX.0.i ; [#uses=1] > - br i1 %tmp516.i, label %whoOverlaps.exit, label %bb503.preheader.i > - > -whoOverlaps.exit: ; preds = %bb513.i, %cond_next105.i > - %foo = phi i1 [ 1, %bb513.i], [0, %cond_next105.i] > - br i1 %foo, label %cond_false428, label %bb490 > - > -cond_false428: ; preds = %whoOverlaps.exit > - br i1 %foo, label %bb497, label %bb8 > - > -bb490: ; preds = %whoOverlaps.exit, %entry > - %binY.tmp.2 = phi i32 [ 0, %entry ], [ %storemerge.i, %whoOverlaps.exit ] ; [#uses=1] > - %cell.1 = phi i32 [ 1, %entry ], [ 0, %whoOverlaps.exit ] ; [#uses=1] > - %foo2 = phi i1 [ 1, %entry], [0, %whoOverlaps.exit] > - br i1 %foo2, label %bb497, label %bb8 > - > -bb497: ; preds = %bb490, %cond_false428 > - %binY.tmp.3 = phi i32 [ %binY.tmp.2, %bb490 ], [ %storemerge.i, %cond_false428 ] ; [#uses=0] > - ret void > + br i1 undef, label %smvp.exit, label %bb.i3 > + > +bb.i3: ; preds = %bb.i3, %bb134 > + br i1 undef, label %smvp.exit, label %bb.i3 > + > +smvp.exit: ; preds = %bb.i3 > + %0 = fmul double %d1, 2.400000e-03 ; [#uses=2] > + br i1 undef, label %bb138.preheader, label %bb159 > + > +bb138.preheader: ; preds = %smvp.exit > + br label %bb138 > + > +bb138: ; preds = %bb138, %bb138.preheader > + br i1 undef, label %bb138, label %bb145.loopexit > + > +bb142: ; preds = %bb.nph218.bb.nph218.split_crit_edge, %phi0.exit > + %1 = fmul double %d1, -1.200000e-03 ; [#uses=1] > + %2 = fadd double %d2, %1 ; [#uses=1] > + %3 = fmul double %2, %d2 ; [#uses=1] > + %4 = fsub double 0.000000e+00, %3 ; [#uses=1] > + br i1 %14, label %phi1.exit, label %bb.i35 > + > +bb.i35: ; preds = %bb142 > + %5 = call arm_apcscc double @sin(double %15) nounwind readonly ; [#uses=1] > + %6 = fmul double %5, 0x4031740AFA84AD8A ; [#uses=1] > + %7 = fsub double 1.000000e+00, undef ; [#uses=1] > + %8 = fdiv double %7, 6.000000e-01 ; [#uses=1] > + br label %phi1.exit > + > +phi1.exit: ; preds = %bb.i35, %bb142 > + %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=0] > + %9 = phi double [ %8, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] > + %10 = fmul double undef, %9 ; [#uses=0] > + br i1 %14, label %phi0.exit, label %bb.i > + > +bb.i: ; preds = %phi1.exit > + unreachable > + > +phi0.exit: ; preds = %phi1.exit > + %11 = fsub double %4, undef ; [#uses=1] > + %12 = fadd double 0.000000e+00, %11 ; [#uses=1] > + store double %12, double* undef, align 4 > + br label %bb142 > + > +bb145.loopexit: ; preds = %bb138 > + br i1 undef, label %bb.nph218.bb.nph218.split_crit_edge, label %bb159 > + > +bb.nph218.bb.nph218.split_crit_edge: ; preds = %bb145.loopexit > + %13 = fmul double %0, 0x401921FB54442D18 ; [#uses=1] > + %14 = fcmp ugt double %0, 6.000000e-01 ; [#uses=2] > + %15 = fdiv double %13, 6.000000e-01 ; [#uses=1] > + br label %bb142 > + > +bb159: ; preds = %bb145.loopexit, %smvp.exit, %bb134 > + unreachable > + > +bb166: ; preds = %bb127 > + unreachable > } > + > +declare arm_apcscc double @sin(double) nounwind readonly > > Removed: llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll?rev=95492&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll (original) > +++ llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll (removed) > @@ -1,58 +0,0 @@ > -; RUN: llc < %s -march=x86 -stats |& \ > -; RUN: grep {1 .*folded into instructions} > -; RUN: llc < %s -march=x86 | grep cmp | count 4 > - > - %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* } > - > -define fastcc i32 @perimeter(%struct.quad_struct* %tree, i32 %size) { > -entry: > - %tree.idx7.val = load %struct.quad_struct** null ; <%struct.quad_struct*> [#uses=1] > - %tmp8.i51 = icmp eq %struct.quad_struct* %tree.idx7.val, null ; [#uses=2] > - br i1 %tmp8.i51, label %cond_next, label %cond_next.i52 > - > -cond_next.i52: ; preds = %entry > - ret i32 0 > - > -cond_next: ; preds = %entry > - %tmp59 = load i32* null, align 4 ; [#uses=1] > - %tmp70 = icmp eq i32 %tmp59, 2 ; [#uses=1] > - br i1 %tmp70, label %cond_true.i35, label %bb80 > - > -cond_true.i35: ; preds = %cond_next > - %tmp14.i.i37 = load %struct.quad_struct** null, align 4 ; <%struct.quad_struct*> [#uses=1] > - %tmp3.i160 = load i32* null, align 4 ; [#uses=1] > - %tmp4.i161 = icmp eq i32 %tmp3.i160, 2 ; [#uses=1] > - br i1 %tmp4.i161, label %cond_true.i163, label %cond_false.i178 > - > -cond_true.i163: ; preds = %cond_true.i35 > - %tmp7.i162 = sdiv i32 %size, 4 ; [#uses=2] > - %tmp13.i168 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i162 ) ; [#uses=1] > - %tmp18.i11.i170 = getelementptr %struct.quad_struct* %tmp14.i.i37, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1] > - %tmp19.i12.i171 = load %struct.quad_struct** %tmp18.i11.i170, align 4 ; <%struct.quad_struct*> [#uses=1] > - %tmp21.i173 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* %tmp19.i12.i171, i32 3, i32 2, i32 %tmp7.i162 ) ; [#uses=1] > - %tmp22.i174 = add i32 %tmp21.i173, %tmp13.i168 ; [#uses=1] > - br i1 %tmp4.i161, label %cond_true.i141, label %cond_false.i156 > - > -cond_false.i178: ; preds = %cond_true.i35 > - ret i32 0 > - > -cond_true.i141: ; preds = %cond_true.i163 > - %tmp7.i140 = sdiv i32 %size, 4 ; [#uses=1] > - %tmp21.i151 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i140 ) ; [#uses=0] > - ret i32 0 > - > -cond_false.i156: ; preds = %cond_true.i163 > - %tmp22.i44 = add i32 0, %tmp22.i174 ; [#uses=0] > - br i1 %tmp8.i51, label %bb22.i, label %cond_next.i > - > -bb80: ; preds = %cond_next > - ret i32 0 > - > -cond_next.i: ; preds = %cond_false.i156 > - ret i32 0 > - > -bb22.i: ; preds = %cond_false.i156 > - ret i32 0 > -} > - > -declare fastcc i32 @sum_adjacent(%struct.quad_struct*, i32, i32, i32) > > Modified: llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll (original) > +++ llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll Sat Feb 6 03:07:11 2010 > @@ -13,7 +13,6 @@ > entry: > ; CHECK: _t: > ; CHECK: movl 16(%rbp), > -; CHECK: movl 16(%rbp), %edx > %0 = zext i32 %argumentsLength to i64 ; [#uses=1] > %1 = zext i32 %clientPort to i64 ; [#uses=1] > %2 = inttoptr i64 %1 to %struct.ComplexType* ; <%struct.ComplexType*> [#uses=1] > > Copied: llvm/trunk/test/CodeGen/X86/codegen-dce.ll (from r95474, llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/codegen-dce.ll?p2=llvm/trunk/test/CodeGen/X86/codegen-dce.ll&p1=llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll&r1=95474&r2=95493&rev=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (original) > +++ llvm/trunk/test/CodeGen/X86/codegen-dce.ll Sat Feb 6 03:07:11 2010 > @@ -1,4 +1,4 @@ > -; RUN: llc < %s -march=x86 -stats |& grep {twoaddrinstr} | grep {Number of dead instructions deleted} > +; RUN: llc < %s -march=x86 -stats |& grep {codegen-dce} | grep {Number of dead instructions deleted} > > %struct.anon = type { [3 x double], double, %struct.node*, [64 x %struct.bnode*], [64 x %struct.bnode*] } > %struct.bnode = type { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x double], double, %struct.bnode*, %struct.bnode* } > > Modified: llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll (original) > +++ llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll Sat Feb 6 03:07:11 2010 > @@ -1,19 +1,20 @@ > ; RUN: llc < %s -march=x86-64 -o %t -stats -info-output-file - | \ > -; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 5 > +; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 10 > ; RUN: grep {leal 1(\%rsi),} %t > > -define fastcc zeroext i8 @fullGtU(i32 %i1, i32 %i2) nounwind optsize { > +define fastcc zeroext i8 @fullGtU(i32 %i1, i32 %i2, i8* %ptr) nounwind optsize { > entry: > %0 = add i32 %i2, 1 ; [#uses=1] > %1 = sext i32 %0 to i64 ; [#uses=1] > - %2 = getelementptr i8* null, i64 %1 ; [#uses=1] > + %2 = getelementptr i8* %ptr, i64 %1 ; [#uses=1] > %3 = load i8* %2, align 1 ; [#uses=1] > %4 = icmp eq i8 0, %3 ; [#uses=1] > br i1 %4, label %bb3, label %bb34 > > bb3: ; preds = %entry > %5 = add i32 %i2, 4 ; [#uses=0] > - ret i8 0 > + %6 = trunc i32 %5 to i8 > + ret i8 %6 > > bb34: ; preds = %entry > ret i8 0 > > Modified: llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll (original) > +++ llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll Sat Feb 6 03:07:11 2010 > @@ -1,4 +1,4 @@ > -; RUN: llc < %s -march=x86-64 | grep mov | count 11 > +; RUN: llc < %s -march=x86-64 | grep mov | count 5 > > %struct.COMPOSITE = type { i8, i16, i16 } > %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } > > Modified: llvm/trunk/test/CodeGen/X86/sext-i1.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sext-i1.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/sext-i1.ll (original) > +++ llvm/trunk/test/CodeGen/X86/sext-i1.ll Sat Feb 6 03:07:11 2010 > @@ -44,9 +44,9 @@ > > ; 64: t3: > ; 64: cmpl $1 > -; 64: sbbl > -; 64: cmpl > ; 64: sbbq > +; 64: cmpq > +; 64: xorl > %not.tobool = icmp eq i32 undef, 0 ; [#uses=2] > %cond = sext i1 %not.tobool to i32 ; [#uses=1] > %conv = sext i1 %not.tobool to i64 ; [#uses=1] > > Modified: llvm/trunk/test/CodeGen/X86/sse3.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse3.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/sse3.ll (original) > +++ llvm/trunk/test/CodeGen/X86/sse3.ll Sat Feb 6 03:07:11 2010 > @@ -63,10 +63,10 @@ > ret <8 x i16> %tmp > ; X64: t4: > ; X64: pextrw $7, %xmm0, %eax > -; X64: pshufhw $100, %xmm0, %xmm1 > -; X64: pinsrw $1, %eax, %xmm1 > +; X64: pshufhw $100, %xmm0, %xmm2 > +; X64: pinsrw $1, %eax, %xmm2 > ; X64: pextrw $1, %xmm0, %eax > -; X64: movaps %xmm1, %xmm0 > +; X64: movaps %xmm2, %xmm0 > ; X64: pinsrw $4, %eax, %xmm0 > ; X64: ret > } > > Modified: llvm/trunk/test/CodeGen/X86/tailcall2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall2.ll?rev=95493&r1=95492&r2=95493&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/tailcall2.ll (original) > +++ llvm/trunk/test/CodeGen/X86/tailcall2.ll Sat Feb 6 03:07:11 2010 > @@ -147,6 +147,8 @@ > > ; 32: t11: > ; 32-NOT: subl ${{[0-9]+}}, %esp > +; 32: jne > +; 32-NOT: movl > ; 32-NOT: addl ${{[0-9]+}}, %esp > ; 32: jmp {{_?}}foo5 > > > Removed: llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll?rev=95492&view=auto > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (original) > +++ llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (removed) > @@ -1,43 +0,0 @@ > -; RUN: llc < %s -march=x86 -stats |& grep {twoaddrinstr} | grep {Number of dead instructions deleted} > - > - %struct.anon = type { [3 x double], double, %struct.node*, [64 x %struct.bnode*], [64 x %struct.bnode*] } > - %struct.bnode = type { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x double], double, %struct.bnode*, %struct.bnode* } > - %struct.node = type { i16, double, [3 x double], i32, i32 } > - > -define i32 @main(i32 %argc, i8** nocapture %argv) nounwind { > -entry: > - %0 = malloc %struct.anon ; <%struct.anon*> [#uses=2] > - %1 = getelementptr %struct.anon* %0, i32 0, i32 2 ; <%struct.node**> [#uses=1] > - br label %bb14.i > - > -bb14.i: ; preds = %bb14.i, %entry > - %i8.0.reg2mem.0.i = phi i32 [ 0, %entry ], [ %2, %bb14.i ] ; [#uses=1] > - %2 = add i32 %i8.0.reg2mem.0.i, 1 ; [#uses=2] > - %exitcond74.i = icmp eq i32 %2, 32 ; [#uses=1] > - br i1 %exitcond74.i, label %bb32.i, label %bb14.i > - > -bb32.i: ; preds = %bb32.i, %bb14.i > - %tmp.0.reg2mem.0.i = phi i32 [ %indvar.next63.i, %bb32.i ], [ 0, %bb14.i ] ; [#uses=1] > - %indvar.next63.i = add i32 %tmp.0.reg2mem.0.i, 1 ; [#uses=2] > - %exitcond64.i = icmp eq i32 %indvar.next63.i, 64 ; [#uses=1] > - br i1 %exitcond64.i, label %bb47.loopexit.i, label %bb32.i > - > -bb.i.i: ; preds = %bb47.loopexit.i > - unreachable > - > -stepsystem.exit.i: ; preds = %bb47.loopexit.i > - store %struct.node* null, %struct.node** %1, align 4 > - br label %bb.i6.i > - > -bb.i6.i: ; preds = %bb.i6.i, %stepsystem.exit.i > - br i1 false, label %bb107.i.i, label %bb.i6.i > - > -bb107.i.i: ; preds = %bb107.i.i, %bb.i6.i > - %q_addr.0.i.i.in = phi %struct.bnode** [ null, %bb107.i.i ], [ %3, %bb.i6.i ] ; <%struct.bnode**> [#uses=0] > - br label %bb107.i.i > - > -bb47.loopexit.i: ; preds = %bb32.i > - %3 = getelementptr %struct.anon* %0, i32 0, i32 4, i32 0 ; <%struct.bnode**> [#uses=1] > - %4 = icmp eq %struct.node* null, null ; [#uses=1] > - br i1 %4, label %stepsystem.exit.i, label %bb.i.i > -} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Mon Feb 8 14:27:50 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 20:27:50 -0000 Subject: [llvm-commits] [llvm] r95564 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86ISelLowering.cpp Message-ID: <201002082027.o18KRpRC005515@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 14:27:50 2010 New Revision: 95564 URL: http://llvm.org/viewvc/llvm-project?rev=95564&view=rev Log: Rename the PerformTailCallOpt variable to GuaranteedTailCallOpt to reflect its current purpose. Modified: llvm/trunk/include/llvm/Target/TargetOptions.h llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/TargetMachine.cpp llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/Target/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Feb 8 14:27:50 2010 @@ -116,10 +116,13 @@ /// be emitted for all functions. extern bool UnwindTablesMandatory; - /// PerformTailCallOpt - This flag is enabled when -tailcallopt is specified - /// on the commandline. When the flag is on, the target will perform tail call - /// optimization (pop the caller's stack) providing it supports it. - extern bool PerformTailCallOpt; + /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is + /// specified on the commandline. When the flag is on, participating targets + /// will perform tail call optimization on all calls which use the fastcc + /// calling convention and which satisfy certain target-independent + /// criteria (being at the end of a function, having the same return type + /// as their parent function, etc.), using an alternate ABI if necessary. + extern bool GuaranteedTailCallOpt; /// StackAlignment - Override default stack alignment for target. extern unsigned StackAlignment; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Feb 8 14:27:50 2010 @@ -1572,7 +1572,7 @@ EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); // Potential tail calls could cause overwriting of argument stack slots. - bool isImmutable = !(PerformTailCallOpt && (CallConv==CallingConv::Fast)); + bool isImmutable = !(GuaranteedTailCallOpt && (CallConv==CallingConv::Fast)); unsigned PtrByteSize = 4; // Assign locations to all of the incoming arguments. @@ -1773,7 +1773,7 @@ EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); bool isPPC64 = PtrVT == MVT::i64; // Potential tail calls could cause overwriting of argument stack slots. - bool isImmutable = !(PerformTailCallOpt && (CallConv==CallingConv::Fast)); + bool isImmutable = !(GuaranteedTailCallOpt && (CallConv==CallingConv::Fast)); unsigned PtrByteSize = isPPC64 ? 8 : 4; unsigned ArgOffset = PPCFrameInfo::getLinkageSize(isPPC64, true); @@ -2164,7 +2164,7 @@ PPCFrameInfo::getMinCallFrameSize(isPPC64, true)); // Tail call needs the stack to be aligned. - if (CC==CallingConv::Fast && PerformTailCallOpt) { + if (CC==CallingConv::Fast && GuaranteedTailCallOpt) { unsigned TargetAlign = DAG.getMachineFunction().getTarget().getFrameInfo()-> getStackAlignment(); unsigned AlignMask = TargetAlign-1; @@ -2200,7 +2200,7 @@ bool isVarArg, const SmallVectorImpl &Ins, SelectionDAG& DAG) const { - if (!PerformTailCallOpt) + if (!GuaranteedTailCallOpt) return false; // Variable argument functions are not supported. @@ -2604,7 +2604,7 @@ // the stack. Account for this here so these bytes can be pushed back on in // PPCRegisterInfo::eliminateCallFramePseudoInstr. int BytesCalleePops = - (CallConv==CallingConv::Fast && PerformTailCallOpt) ? NumBytes : 0; + (CallConv==CallingConv::Fast && GuaranteedTailCallOpt) ? NumBytes : 0; if (InFlag.getNode()) Ops.push_back(InFlag); @@ -2720,7 +2720,7 @@ // and restoring the callers stack pointer in this functions epilog. This is // done because by tail calling the called function might overwrite the value // in this function's (MF) stack pointer stack slot 0(SP). - if (PerformTailCallOpt && CallConv==CallingConv::Fast) + if (GuaranteedTailCallOpt && CallConv==CallingConv::Fast) MF.getInfo()->setHasFastCall(); // Count how many bytes are to be pushed on the stack, including the linkage @@ -2923,7 +2923,7 @@ // and restoring the callers stack pointer in this functions epilog. This is // done because by tail calling the called function might overwrite the value // in this function's (MF) stack pointer stack slot 0(SP). - if (PerformTailCallOpt && CallConv==CallingConv::Fast) + if (GuaranteedTailCallOpt && CallConv==CallingConv::Fast) MF.getInfo()->setHasFastCall(); unsigned nAltivecParamsAtEnd = 0; Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Feb 8 14:27:50 2010 @@ -406,7 +406,7 @@ static bool needsFP(const MachineFunction &MF) { const MachineFrameInfo *MFI = MF.getFrameInfo(); return NoFramePointerElim || MFI->hasVarSizedObjects() || - (PerformTailCallOpt && MF.getInfo()->hasFastCall()); + (GuaranteedTailCallOpt && MF.getInfo()->hasFastCall()); } static bool spillsCR(const MachineFunction &MF) { @@ -486,7 +486,7 @@ void PPCRegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { - if (PerformTailCallOpt && I->getOpcode() == PPC::ADJCALLSTACKUP) { + if (GuaranteedTailCallOpt && I->getOpcode() == PPC::ADJCALLSTACKUP) { // Add (actually subtract) back the amount the callee popped on return. if (int CalleeAmt = I->getOperand(1).getImm()) { bool is64Bit = Subtarget.isPPC64(); @@ -1050,7 +1050,7 @@ // Reserve stack space to move the linkage area to in case of a tail call. int TCSPDelta = 0; - if (PerformTailCallOpt && (TCSPDelta = FI->getTailCallSPDelta()) < 0) { + if (GuaranteedTailCallOpt && (TCSPDelta = FI->getTailCallSPDelta()) < 0) { MF.getFrameInfo()->CreateFixedObject(-1 * TCSPDelta, TCSPDelta, true, false); } @@ -1160,7 +1160,7 @@ // Take into account stack space reserved for tail calls. int TCSPDelta = 0; - if (PerformTailCallOpt && (TCSPDelta = PFI->getTailCallSPDelta()) < 0) { + if (GuaranteedTailCallOpt && (TCSPDelta = PFI->getTailCallSPDelta()) < 0) { LowerBound = TCSPDelta; } @@ -1575,7 +1575,7 @@ // The loaded (or persistent) stack pointer value is offset by the 'stwu' // on entry to the function. Add this offset back now. if (!isPPC64) { - // If this function contained a fastcc call and PerformTailCallOpt is + // If this function contained a fastcc call and GuaranteedTailCallOpt is // enabled (=> hasFastCall()==true) the fastcc call might contain a tail // call which invalidates the stack pointer value in SP(0). So we use the // value of R31 in this case. @@ -1654,7 +1654,7 @@ // Callee pop calling convention. Pop parameter/linkage area. Used for tail // call optimization - if (PerformTailCallOpt && RetOpcode == PPC::BLR && + if (GuaranteedTailCallOpt && RetOpcode == PPC::BLR && MF.getFunction()->getCallingConv() == CallingConv::Fast) { PPCFunctionInfo *FI = MF.getInfo(); unsigned CallerAllocatedAmt = FI->getMinReservedArea(); Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Feb 8 14:27:50 2010 @@ -40,7 +40,7 @@ bool UnwindTablesMandatory; Reloc::Model RelocationModel; CodeModel::Model CMModel; - bool PerformTailCallOpt; + bool GuaranteedTailCallOpt; unsigned StackAlignment; bool RealignStack; bool DisableJumpTables; @@ -173,9 +173,9 @@ "Large code model"), clEnumValEnd)); static cl::opt -EnablePerformTailCallOpt("tailcallopt", +EnableGuaranteedTailCallOpt("tailcallopt", cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."), - cl::location(PerformTailCallOpt), + cl::location(GuaranteedTailCallOpt), cl::init(false)); static cl::opt OverrideStackAlignment("stack-alignment", Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Mon Feb 8 14:27:50 2010 @@ -1247,7 +1247,7 @@ // fastcc with -tailcallopt is intended to provide a guaranteed // tail call optimization. Fastisel doesn't know how to do that. - if (CC == CallingConv::Fast && PerformTailCallOpt) + if (CC == CallingConv::Fast && GuaranteedTailCallOpt) return false; // Let SDISel handle vararg functions. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95564&r1=95563&r2=95564&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 8 14:27:50 2010 @@ -1391,7 +1391,7 @@ case CallingConv::X86_FastCall: return !Subtarget->is64Bit(); case CallingConv::Fast: - return PerformTailCallOpt; + return GuaranteedTailCallOpt; } } @@ -1441,7 +1441,7 @@ /// FuncIsMadeTailCallSafe - Return true if the function is being made into /// a tailcall target by changing its ABI. static bool FuncIsMadeTailCallSafe(CallingConv::ID CC) { - return PerformTailCallOpt && CC == CallingConv::Fast; + return GuaranteedTailCallOpt && CC == CallingConv::Fast; } SDValue @@ -1797,7 +1797,7 @@ // Sibcalls are automatically detected tailcalls which do not require // ABI changes. - if (!PerformTailCallOpt && isTailCall) + if (!GuaranteedTailCallOpt && isTailCall) IsSibcall = true; if (isTailCall) @@ -1819,7 +1819,7 @@ // This is a sibcall. The memory operands are available in caller's // own caller's stack. NumBytes = 0; - else if (PerformTailCallOpt && CallConv == CallingConv::Fast) + else if (GuaranteedTailCallOpt && CallConv == CallingConv::Fast) NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG); int FPDiff = 0; @@ -1986,7 +1986,7 @@ int FI = 0; // Do not flag preceeding copytoreg stuff together with the following stuff. InFlag = SDValue(); - if (PerformTailCallOpt) { + if (GuaranteedTailCallOpt) { for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) { CCValAssign &VA = ArgLocs[i]; if (VA.isRegLoc()) @@ -2311,7 +2311,7 @@ // If -tailcallopt is specified, make fastcc functions tail-callable. const Function *CallerF = DAG.getMachineFunction().getFunction(); - if (PerformTailCallOpt) { + if (GuaranteedTailCallOpt) { if (CalleeCC == CallingConv::Fast && CallerF->getCallingConv() == CalleeCC) return true; From evan.cheng at apple.com Mon Feb 8 14:28:30 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 8 Feb 2010 12:28:30 -0800 Subject: [llvm-commits] [llvm] r95493 - in /llvm/trunk: lib/CodeGen/ lib/Target/X86/ test/CodeGen/ARM/ test/CodeGen/X86/ In-Reply-To: References: <201002060907.o1697ERw029934@zion.cs.uiuc.edu> Message-ID: Yes: See tailcall2.ll t11. Evan On Feb 8, 2010, at 12:09 PM, Dan Gohman wrote: > Hi Evan, > > The testcase included here, codegen-dce.ll, contains code which in the > real world would be deleted by instcombine (the PHI has no users). > > Do you have a testcase where the MachineInstr-level DCE pass deletes > code which would actually show up in a real testcase, such as the > formal parameter lowering case that you mentioned in the commit > message? > > Thanks, > > Dan > > On Feb 6, 2010, at 1:07 AM, Evan Cheng wrote: > >> Author: evancheng >> Date: Sat Feb 6 03:07:11 2010 >> New Revision: 95493 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95493&view=rev >> Log: >> Run codegen dce pass for all targets at all optimization levels. Previously it's >> only run for x86 with fastisel. I've found it being very effective in >> eliminating some obvious dead code as result of formal parameter lowering >> especially when tail call optimization eliminated the need for some of the loads >> from fixed frame objects. It also shrinks a number of the tests. A couple of >> tests no longer make sense and are now eliminated. >> >> Added: >> llvm/trunk/test/CodeGen/X86/codegen-dce.ll >> - copied, changed from r95474, llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll >> Removed: >> llvm/trunk/test/CodeGen/ARM/remat-2.ll >> llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll >> llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll >> Modified: >> llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp >> llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp >> llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp >> llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> llvm/trunk/test/CodeGen/ARM/2009-10-30.ll >> llvm/trunk/test/CodeGen/ARM/long_shift.ll >> llvm/trunk/test/CodeGen/ARM/remat.ll >> llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll >> llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll >> llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll >> llvm/trunk/test/CodeGen/X86/sext-i1.ll >> llvm/trunk/test/CodeGen/X86/sse3.ll >> llvm/trunk/test/CodeGen/X86/tailcall2.ll >> >> Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) >> +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Sat Feb 6 03:07:11 2010 >> @@ -11,6 +11,7 @@ >> // >> //===----------------------------------------------------------------------===// >> >> +#define DEBUG_TYPE "codegen-dce" >> #include "llvm/CodeGen/Passes.h" >> #include "llvm/Pass.h" >> #include "llvm/CodeGen/MachineFunctionPass.h" >> @@ -19,8 +20,11 @@ >> #include "llvm/Support/raw_ostream.h" >> #include "llvm/Target/TargetInstrInfo.h" >> #include "llvm/Target/TargetMachine.h" >> +#include "llvm/ADT/Statistic.h" >> using namespace llvm; >> >> +STATISTIC(NumDeletes, "Number of dead instructions deleted"); >> + >> namespace { >> class DeadMachineInstructionElim : public MachineFunctionPass { >> virtual bool runOnMachineFunction(MachineFunction &MF); >> @@ -126,6 +130,7 @@ >> DEBUG(dbgs() << "DeadMachineInstructionElim: DELETING: " << *MI); >> AnyChanges = true; >> MI->eraseFromParent(); >> + ++NumDeletes; >> MIE = MBB->rend(); >> // MII is now pointing to the next instruction to process, >> // so don't increment it. >> >> Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) >> +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Sat Feb 6 03:07:11 2010 >> @@ -291,6 +291,12 @@ >> printAndVerify(PM, "After Instruction Selection", >> /* allowDoubleDefs= */ true); >> >> + >> + // Delete dead machine instructions regardless of optimization level. >> + PM.add(createDeadMachineInstructionElimPass()); >> + printAndVerify(PM, "After codegen DCE pass", >> + /* allowDoubleDefs= */ true); >> + >> if (OptLevel != CodeGenOpt::None) { >> PM.add(createOptimizeExtsPass()); >> if (!DisableMachineLICM) >> >> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) >> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Feb 6 03:07:11 2010 >> @@ -671,6 +671,9 @@ >> for (MachineFunction::iterator MBBI = mf_->begin(), E = mf_->end(); >> MBBI != E; ++MBBI) { >> MachineBasicBlock *MBB = MBBI; >> + if (MBB->empty()) >> + continue; >> + >> // Track the index of the current machine instr. >> SlotIndex MIIndex = getMBBStartIdx(MBB); >> DEBUG(dbgs() << MBB->getName() << ":\n"); >> >> Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Sat Feb 6 03:07:11 2010 >> @@ -148,10 +148,6 @@ >> // Install an instruction selector. >> PM.add(createX86ISelDag(*this, OptLevel)); >> >> - // If we're using Fast-ISel, clean up the mess. >> - if (EnableFastISel) >> - PM.add(createDeadMachineInstructionElimPass()); >> - >> // Install a pass to insert x87 FP_REG_KILL instructions, as needed. >> PM.add(createX87FPRegKillInserterPass()); >> >> >> Modified: llvm/trunk/test/CodeGen/ARM/2009-10-30.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-10-30.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/ARM/2009-10-30.ll (original) >> +++ llvm/trunk/test/CodeGen/ARM/2009-10-30.ll Sat Feb 6 03:07:11 2010 >> @@ -5,8 +5,8 @@ >> define void @f(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, ...) { >> entry: >> ;CHECK: sub sp, sp, #4 >> -;CHECK: add r0, sp, #8 >> -;CHECK: str r0, [sp], #+4 >> +;CHECK: add r{{[0-9]+}}, sp, #8 >> +;CHECK: str r{{[0-9]+}}, [sp], #+4 >> ;CHECK: bx lr >> %ap = alloca i8*, align 4 >> %ap1 = bitcast i8** %ap to i8* >> >> Modified: llvm/trunk/test/CodeGen/ARM/long_shift.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/long_shift.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/ARM/long_shift.ll (original) >> +++ llvm/trunk/test/CodeGen/ARM/long_shift.ll Sat Feb 6 03:07:11 2010 >> @@ -23,10 +23,10 @@ >> define i32 @f2(i64 %x, i64 %y) { >> ; CHECK: f2 >> ; CHECK: mov r0, r0, lsr r2 >> -; CHECK-NEXT: rsb r3, r2, #32 >> +; CHECK-NEXT: rsb r12, r2, #32 >> ; CHECK-NEXT: sub r2, r2, #32 >> ; CHECK-NEXT: cmp r2, #0 >> -; CHECK-NEXT: orr r0, r0, r1, lsl r3 >> +; CHECK-NEXT: orr r0, r0, r1, lsl r12 >> ; CHECK-NEXT: movge r0, r1, asr r2 >> %a = ashr i64 %x, %y >> %b = trunc i64 %a to i32 >> @@ -36,10 +36,10 @@ >> define i32 @f3(i64 %x, i64 %y) { >> ; CHECK: f3 >> ; CHECK: mov r0, r0, lsr r2 >> -; CHECK-NEXT: rsb r3, r2, #32 >> +; CHECK-NEXT: rsb r12, r2, #32 >> ; CHECK-NEXT: sub r2, r2, #32 >> ; CHECK-NEXT: cmp r2, #0 >> -; CHECK-NEXT: orr r0, r0, r1, lsl r3 >> +; CHECK-NEXT: orr r0, r0, r1, lsl r12 >> ; CHECK-NEXT: movge r0, r1, lsr r2 >> %a = lshr i64 %x, %y >> %b = trunc i64 %a to i32 >> >> Removed: llvm/trunk/test/CodeGen/ARM/remat-2.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat-2.ll?rev=95492&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/ARM/remat-2.ll (original) >> +++ llvm/trunk/test/CodeGen/ARM/remat-2.ll (removed) >> @@ -1,65 +0,0 @@ >> -; RUN: llc < %s -march=arm -mattr=+v6,+vfp2 -stats -info-output-file - | grep "Number of re-materialization" >> - >> -define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv) nounwind { >> -entry: >> - br i1 undef, label %smvp.exit, label %bb.i3 >> - >> -bb.i3: ; preds = %bb.i3, %bb134 >> - br i1 undef, label %smvp.exit, label %bb.i3 >> - >> -smvp.exit: ; preds = %bb.i3 >> - %0 = fmul double undef, 2.400000e-03 ; [#uses=2] >> - br i1 undef, label %bb138.preheader, label %bb159 >> - >> -bb138.preheader: ; preds = %smvp.exit >> - br label %bb138 >> - >> -bb138: ; preds = %bb138, %bb138.preheader >> - br i1 undef, label %bb138, label %bb145.loopexit >> - >> -bb142: ; preds = %bb.nph218.bb.nph218.split_crit_edge, %phi0.exit >> - %1 = fmul double undef, -1.200000e-03 ; [#uses=1] >> - %2 = fadd double undef, %1 ; [#uses=1] >> - %3 = fmul double %2, undef ; [#uses=1] >> - %4 = fsub double 0.000000e+00, %3 ; [#uses=1] >> - br i1 %14, label %phi1.exit, label %bb.i35 >> - >> -bb.i35: ; preds = %bb142 >> - %5 = call arm_apcscc double @sin(double %15) nounwind readonly ; [#uses=1] >> - %6 = fmul double %5, 0x4031740AFA84AD8A ; [#uses=1] >> - %7 = fsub double 1.000000e+00, undef ; [#uses=1] >> - %8 = fdiv double %7, 6.000000e-01 ; [#uses=1] >> - br label %phi1.exit >> - >> -phi1.exit: ; preds = %bb.i35, %bb142 >> - %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=0] >> - %9 = phi double [ %8, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] >> - %10 = fmul double undef, %9 ; [#uses=0] >> - br i1 %14, label %phi0.exit, label %bb.i >> - >> -bb.i: ; preds = %phi1.exit >> - unreachable >> - >> -phi0.exit: ; preds = %phi1.exit >> - %11 = fsub double %4, undef ; [#uses=1] >> - %12 = fadd double 0.000000e+00, %11 ; [#uses=1] >> - store double %12, double* undef, align 4 >> - br label %bb142 >> - >> -bb145.loopexit: ; preds = %bb138 >> - br i1 undef, label %bb.nph218.bb.nph218.split_crit_edge, label %bb159 >> - >> -bb.nph218.bb.nph218.split_crit_edge: ; preds = %bb145.loopexit >> - %13 = fmul double %0, 0x401921FB54442D18 ; [#uses=1] >> - %14 = fcmp ugt double %0, 6.000000e-01 ; [#uses=2] >> - %15 = fdiv double %13, 6.000000e-01 ; [#uses=1] >> - br label %bb142 >> - >> -bb159: ; preds = %bb145.loopexit, %smvp.exit, %bb134 >> - unreachable >> - >> -bb166: ; preds = %bb127 >> - unreachable >> -} >> - >> -declare arm_apcscc double @sin(double) nounwind readonly >> >> Modified: llvm/trunk/test/CodeGen/ARM/remat.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/ARM/remat.ll (original) >> +++ llvm/trunk/test/CodeGen/ARM/remat.ll Sat Feb 6 03:07:11 2010 >> @@ -1,119 +1,65 @@ >> -; RUN: llc < %s -mtriple=arm-apple-darwin >> -; RUN: llc < %s -mtriple=arm-apple-darwin -stats -info-output-file - | grep "Number of re-materialization" | grep 3 >> +; RUN: llc < %s -march=arm -mattr=+v6,+vfp2 -stats -info-output-file - | grep "Number of re-materialization" >> >> - %struct.CONTENTBOX = type { i32, i32, i32, i32, i32 } >> - %struct.LOCBOX = type { i32, i32, i32, i32 } >> - %struct.SIDEBOX = type { i32, i32 } >> - %struct.UNCOMBOX = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } >> - %struct.cellbox = type { i8*, i32, i32, i32, [9 x i32], i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, i32, i32, %struct.CONTENTBOX*, %struct.UNCOMBOX*, [8 x %struct.tilebox*], %struct.SIDEBOX* } >> - %struct.termbox = type { %struct.termbox*, i32, i32, i32, i32, i32 } >> - %struct.tilebox = type { %struct.tilebox*, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.termbox*, %struct.LOCBOX* } >> - at numcells = external global i32 ; [#uses=1] >> - at cellarray = external global %struct.cellbox** ; <%struct.cellbox***> [#uses=1] >> - at numBinsY = external global i32 ; [#uses=1] >> - >> -define fastcc void @fixpenal() { >> +define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv, double %d1, double %d2) nounwind { >> entry: >> - %tmp491 = load i32* @numcells, align 4 ; [#uses=1] >> - %tmp9 = load %struct.cellbox*** @cellarray, align 4 ; <%struct.cellbox**> [#uses=1] >> - %tmp77.i = load i32* @numBinsY, align 4 ; [#uses=2] >> - br label %bb490 >> - >> -bb8: ; preds = %bb490, %cond_false428 >> - %foo3 = phi i1 [ 0, %bb490 ], [ 1, %cond_false428 ] >> - br i1 %foo3, label %cond_false58.i, label %cond_false.i >> - >> -cond_false.i: ; preds = %bb8 >> - ret void >> - >> -cond_false58.i: ; preds = %bb8 >> - %highBinX.0.i = select i1 false, i32 1, i32 0 ; [#uses=2] >> - br i1 %foo3, label %cond_next85.i, label %cond_false76.i >> - >> -cond_false76.i: ; preds = %cond_false58.i >> - ret void >> - >> -cond_next85.i: ; preds = %cond_false58.i >> - br i1 %foo3, label %cond_next105.i, label %cond_false98.i >> - >> -cond_false98.i: ; preds = %cond_next85.i >> - ret void >> - >> -cond_next105.i: ; preds = %cond_next85.i >> - %tmp108.i = icmp eq i32 1, %highBinX.0.i ; [#uses=1] >> - %tmp115.i = icmp eq i32 1, %tmp77.i ; [#uses=1] >> - %bothcond.i = and i1 %tmp115.i, %tmp108.i ; [#uses=1] >> - %storemerge.i = select i1 %bothcond.i, i32 1, i32 0 ; [#uses=2] >> - br i1 %bothcond.i, label %whoOverlaps.exit, label %bb503.preheader.i >> - >> -bb503.preheader.i: ; preds = %bb513.i, %cond_next105.i >> - %i.022.0.i = phi i32 [ %tmp512.i, %bb513.i ], [ 0, %cond_next105.i ] ; [#uses=2] >> - %tmp165.i = getelementptr i32*** null, i32 %i.022.0.i ; [#uses=0] >> - br label %bb503.i >> - >> -bb137.i: ; preds = %bb503.i >> - br i1 %tmp506.i, label %bb162.i, label %bb148.i >> - >> -bb148.i: ; preds = %bb137.i >> - ret void >> - >> -bb162.i: ; preds = %bb137.i >> - %tmp49435.i = load i32* null ; [#uses=1] >> - br label %bb170.i >> - >> -bb170.i: ; preds = %bb491.i, %bb162.i >> - %indvar.i = phi i32 [ %k.032.0.i, %bb491.i ], [ 0, %bb162.i ] ; [#uses=2] >> - %k.032.0.i = add i32 %indvar.i, 1 ; [#uses=2] >> - %tmp173.i = getelementptr i32* null, i32 %k.032.0.i ; [#uses=1] >> - %tmp174.i = load i32* %tmp173.i ; [#uses=4] >> - %tmp177.i = icmp eq i32 %tmp174.i, %cell.1 ; [#uses=1] >> - %tmp184.i = icmp sgt i32 %tmp174.i, %tmp491 ; [#uses=1] >> - %bothcond = or i1 %tmp177.i, %tmp184.i ; [#uses=1] >> - br i1 %bothcond, label %bb491.i, label %cond_next188.i >> - >> -cond_next188.i: ; preds = %bb170.i >> - %tmp191.i = getelementptr %struct.cellbox** %tmp9, i32 %tmp174.i ; <%struct.cellbox**> [#uses=1] >> - %tmp192.i = load %struct.cellbox** %tmp191.i ; <%struct.cellbox*> [#uses=1] >> - %tmp195.i = icmp eq i32 %tmp174.i, 0 ; [#uses=1] >> - br i1 %tmp195.i, label %bb491.i, label %cond_true198.i >> - >> -cond_true198.i: ; preds = %cond_next188.i >> - %tmp210.i = getelementptr %struct.cellbox* %tmp192.i, i32 0, i32 3 ; [#uses=0] >> - ret void >> - >> -bb491.i: ; preds = %cond_next188.i, %bb170.i >> - %tmp490.i = add i32 %indvar.i, 2 ; [#uses=1] >> - %tmp496.i = icmp slt i32 %tmp49435.i, %tmp490.i ; [#uses=1] >> - br i1 %tmp496.i, label %bb500.i, label %bb170.i >> - >> -bb500.i: ; preds = %bb491.i >> - %indvar.next82.i = add i32 %j.0.i, 1 ; [#uses=1] >> - br label %bb503.i >> - >> -bb503.i: ; preds = %bb500.i, %bb503.preheader.i >> - %j.0.i = phi i32 [ 0, %bb503.preheader.i ], [ %indvar.next82.i, %bb500.i ] ; [#uses=2] >> - %tmp506.i = icmp sgt i32 %j.0.i, %tmp77.i ; [#uses=1] >> - br i1 %tmp506.i, label %bb513.i, label %bb137.i >> - >> -bb513.i: ; preds = %bb503.i >> - %tmp512.i = add i32 %i.022.0.i, 1 ; [#uses=2] >> - %tmp516.i = icmp sgt i32 %tmp512.i, %highBinX.0.i ; [#uses=1] >> - br i1 %tmp516.i, label %whoOverlaps.exit, label %bb503.preheader.i >> - >> -whoOverlaps.exit: ; preds = %bb513.i, %cond_next105.i >> - %foo = phi i1 [ 1, %bb513.i], [0, %cond_next105.i] >> - br i1 %foo, label %cond_false428, label %bb490 >> - >> -cond_false428: ; preds = %whoOverlaps.exit >> - br i1 %foo, label %bb497, label %bb8 >> - >> -bb490: ; preds = %whoOverlaps.exit, %entry >> - %binY.tmp.2 = phi i32 [ 0, %entry ], [ %storemerge.i, %whoOverlaps.exit ] ; [#uses=1] >> - %cell.1 = phi i32 [ 1, %entry ], [ 0, %whoOverlaps.exit ] ; [#uses=1] >> - %foo2 = phi i1 [ 1, %entry], [0, %whoOverlaps.exit] >> - br i1 %foo2, label %bb497, label %bb8 >> - >> -bb497: ; preds = %bb490, %cond_false428 >> - %binY.tmp.3 = phi i32 [ %binY.tmp.2, %bb490 ], [ %storemerge.i, %cond_false428 ] ; [#uses=0] >> - ret void >> + br i1 undef, label %smvp.exit, label %bb.i3 >> + >> +bb.i3: ; preds = %bb.i3, %bb134 >> + br i1 undef, label %smvp.exit, label %bb.i3 >> + >> +smvp.exit: ; preds = %bb.i3 >> + %0 = fmul double %d1, 2.400000e-03 ; [#uses=2] >> + br i1 undef, label %bb138.preheader, label %bb159 >> + >> +bb138.preheader: ; preds = %smvp.exit >> + br label %bb138 >> + >> +bb138: ; preds = %bb138, %bb138.preheader >> + br i1 undef, label %bb138, label %bb145.loopexit >> + >> +bb142: ; preds = %bb.nph218.bb.nph218.split_crit_edge, %phi0.exit >> + %1 = fmul double %d1, -1.200000e-03 ; [#uses=1] >> + %2 = fadd double %d2, %1 ; [#uses=1] >> + %3 = fmul double %2, %d2 ; [#uses=1] >> + %4 = fsub double 0.000000e+00, %3 ; [#uses=1] >> + br i1 %14, label %phi1.exit, label %bb.i35 >> + >> +bb.i35: ; preds = %bb142 >> + %5 = call arm_apcscc double @sin(double %15) nounwind readonly ; [#uses=1] >> + %6 = fmul double %5, 0x4031740AFA84AD8A ; [#uses=1] >> + %7 = fsub double 1.000000e+00, undef ; [#uses=1] >> + %8 = fdiv double %7, 6.000000e-01 ; [#uses=1] >> + br label %phi1.exit >> + >> +phi1.exit: ; preds = %bb.i35, %bb142 >> + %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=0] >> + %9 = phi double [ %8, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] >> + %10 = fmul double undef, %9 ; [#uses=0] >> + br i1 %14, label %phi0.exit, label %bb.i >> + >> +bb.i: ; preds = %phi1.exit >> + unreachable >> + >> +phi0.exit: ; preds = %phi1.exit >> + %11 = fsub double %4, undef ; [#uses=1] >> + %12 = fadd double 0.000000e+00, %11 ; [#uses=1] >> + store double %12, double* undef, align 4 >> + br label %bb142 >> + >> +bb145.loopexit: ; preds = %bb138 >> + br i1 undef, label %bb.nph218.bb.nph218.split_crit_edge, label %bb159 >> + >> +bb.nph218.bb.nph218.split_crit_edge: ; preds = %bb145.loopexit >> + %13 = fmul double %0, 0x401921FB54442D18 ; [#uses=1] >> + %14 = fcmp ugt double %0, 6.000000e-01 ; [#uses=2] >> + %15 = fdiv double %13, 6.000000e-01 ; [#uses=1] >> + br label %bb142 >> + >> +bb159: ; preds = %bb145.loopexit, %smvp.exit, %bb134 >> + unreachable >> + >> +bb166: ; preds = %bb127 >> + unreachable >> } >> + >> +declare arm_apcscc double @sin(double) nounwind readonly >> >> Removed: llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll?rev=95492&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll (removed) >> @@ -1,58 +0,0 @@ >> -; RUN: llc < %s -march=x86 -stats |& \ >> -; RUN: grep {1 .*folded into instructions} >> -; RUN: llc < %s -march=x86 | grep cmp | count 4 >> - >> - %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* } >> - >> -define fastcc i32 @perimeter(%struct.quad_struct* %tree, i32 %size) { >> -entry: >> - %tree.idx7.val = load %struct.quad_struct** null ; <%struct.quad_struct*> [#uses=1] >> - %tmp8.i51 = icmp eq %struct.quad_struct* %tree.idx7.val, null ; [#uses=2] >> - br i1 %tmp8.i51, label %cond_next, label %cond_next.i52 >> - >> -cond_next.i52: ; preds = %entry >> - ret i32 0 >> - >> -cond_next: ; preds = %entry >> - %tmp59 = load i32* null, align 4 ; [#uses=1] >> - %tmp70 = icmp eq i32 %tmp59, 2 ; [#uses=1] >> - br i1 %tmp70, label %cond_true.i35, label %bb80 >> - >> -cond_true.i35: ; preds = %cond_next >> - %tmp14.i.i37 = load %struct.quad_struct** null, align 4 ; <%struct.quad_struct*> [#uses=1] >> - %tmp3.i160 = load i32* null, align 4 ; [#uses=1] >> - %tmp4.i161 = icmp eq i32 %tmp3.i160, 2 ; [#uses=1] >> - br i1 %tmp4.i161, label %cond_true.i163, label %cond_false.i178 >> - >> -cond_true.i163: ; preds = %cond_true.i35 >> - %tmp7.i162 = sdiv i32 %size, 4 ; [#uses=2] >> - %tmp13.i168 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i162 ) ; [#uses=1] >> - %tmp18.i11.i170 = getelementptr %struct.quad_struct* %tmp14.i.i37, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1] >> - %tmp19.i12.i171 = load %struct.quad_struct** %tmp18.i11.i170, align 4 ; <%struct.quad_struct*> [#uses=1] >> - %tmp21.i173 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* %tmp19.i12.i171, i32 3, i32 2, i32 %tmp7.i162 ) ; [#uses=1] >> - %tmp22.i174 = add i32 %tmp21.i173, %tmp13.i168 ; [#uses=1] >> - br i1 %tmp4.i161, label %cond_true.i141, label %cond_false.i156 >> - >> -cond_false.i178: ; preds = %cond_true.i35 >> - ret i32 0 >> - >> -cond_true.i141: ; preds = %cond_true.i163 >> - %tmp7.i140 = sdiv i32 %size, 4 ; [#uses=1] >> - %tmp21.i151 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i140 ) ; [#uses=0] >> - ret i32 0 >> - >> -cond_false.i156: ; preds = %cond_true.i163 >> - %tmp22.i44 = add i32 0, %tmp22.i174 ; [#uses=0] >> - br i1 %tmp8.i51, label %bb22.i, label %cond_next.i >> - >> -bb80: ; preds = %cond_next >> - ret i32 0 >> - >> -cond_next.i: ; preds = %cond_false.i156 >> - ret i32 0 >> - >> -bb22.i: ; preds = %cond_false.i156 >> - ret i32 0 >> -} >> - >> -declare fastcc i32 @sum_adjacent(%struct.quad_struct*, i32, i32, i32) >> >> Modified: llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/2009-09-10-LoadFoldingBug.ll Sat Feb 6 03:07:11 2010 >> @@ -13,7 +13,6 @@ >> entry: >> ; CHECK: _t: >> ; CHECK: movl 16(%rbp), >> -; CHECK: movl 16(%rbp), %edx >> %0 = zext i32 %argumentsLength to i64 ; [#uses=1] >> %1 = zext i32 %clientPort to i64 ; [#uses=1] >> %2 = inttoptr i64 %1 to %struct.ComplexType* ; <%struct.ComplexType*> [#uses=1] >> >> Copied: llvm/trunk/test/CodeGen/X86/codegen-dce.ll (from r95474, llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll) >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/codegen-dce.ll?p2=llvm/trunk/test/CodeGen/X86/codegen-dce.ll&p1=llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll&r1=95474&r2=95493&rev=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/codegen-dce.ll Sat Feb 6 03:07:11 2010 >> @@ -1,4 +1,4 @@ >> -; RUN: llc < %s -march=x86 -stats |& grep {twoaddrinstr} | grep {Number of dead instructions deleted} >> +; RUN: llc < %s -march=x86 -stats |& grep {codegen-dce} | grep {Number of dead instructions deleted} >> >> %struct.anon = type { [3 x double], double, %struct.node*, [64 x %struct.bnode*], [64 x %struct.bnode*] } >> %struct.bnode = type { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x double], double, %struct.bnode*, %struct.bnode* } >> >> Modified: llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll Sat Feb 6 03:07:11 2010 >> @@ -1,19 +1,20 @@ >> ; RUN: llc < %s -march=x86-64 -o %t -stats -info-output-file - | \ >> -; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 5 >> +; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 10 >> ; RUN: grep {leal 1(\%rsi),} %t >> >> -define fastcc zeroext i8 @fullGtU(i32 %i1, i32 %i2) nounwind optsize { >> +define fastcc zeroext i8 @fullGtU(i32 %i1, i32 %i2, i8* %ptr) nounwind optsize { >> entry: >> %0 = add i32 %i2, 1 ; [#uses=1] >> %1 = sext i32 %0 to i64 ; [#uses=1] >> - %2 = getelementptr i8* null, i64 %1 ; [#uses=1] >> + %2 = getelementptr i8* %ptr, i64 %1 ; [#uses=1] >> %3 = load i8* %2, align 1 ; [#uses=1] >> %4 = icmp eq i8 0, %3 ; [#uses=1] >> br i1 %4, label %bb3, label %bb34 >> >> bb3: ; preds = %entry >> %5 = add i32 %i2, 4 ; [#uses=0] >> - ret i8 0 >> + %6 = trunc i32 %5 to i8 >> + ret i8 %6 >> >> bb34: ; preds = %entry >> ret i8 0 >> >> Modified: llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-3.ll Sat Feb 6 03:07:11 2010 >> @@ -1,4 +1,4 @@ >> -; RUN: llc < %s -march=x86-64 | grep mov | count 11 >> +; RUN: llc < %s -march=x86-64 | grep mov | count 5 >> >> %struct.COMPOSITE = type { i8, i16, i16 } >> %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } >> >> Modified: llvm/trunk/test/CodeGen/X86/sext-i1.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sext-i1.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/sext-i1.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/sext-i1.ll Sat Feb 6 03:07:11 2010 >> @@ -44,9 +44,9 @@ >> >> ; 64: t3: >> ; 64: cmpl $1 >> -; 64: sbbl >> -; 64: cmpl >> ; 64: sbbq >> +; 64: cmpq >> +; 64: xorl >> %not.tobool = icmp eq i32 undef, 0 ; [#uses=2] >> %cond = sext i1 %not.tobool to i32 ; [#uses=1] >> %conv = sext i1 %not.tobool to i64 ; [#uses=1] >> >> Modified: llvm/trunk/test/CodeGen/X86/sse3.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse3.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/sse3.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/sse3.ll Sat Feb 6 03:07:11 2010 >> @@ -63,10 +63,10 @@ >> ret <8 x i16> %tmp >> ; X64: t4: >> ; X64: pextrw $7, %xmm0, %eax >> -; X64: pshufhw $100, %xmm0, %xmm1 >> -; X64: pinsrw $1, %eax, %xmm1 >> +; X64: pshufhw $100, %xmm0, %xmm2 >> +; X64: pinsrw $1, %eax, %xmm2 >> ; X64: pextrw $1, %xmm0, %eax >> -; X64: movaps %xmm1, %xmm0 >> +; X64: movaps %xmm2, %xmm0 >> ; X64: pinsrw $4, %eax, %xmm0 >> ; X64: ret >> } >> >> Modified: llvm/trunk/test/CodeGen/X86/tailcall2.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall2.ll?rev=95493&r1=95492&r2=95493&view=diff >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/tailcall2.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/tailcall2.ll Sat Feb 6 03:07:11 2010 >> @@ -147,6 +147,8 @@ >> >> ; 32: t11: >> ; 32-NOT: subl ${{[0-9]+}}, %esp >> +; 32: jne >> +; 32-NOT: movl >> ; 32-NOT: addl ${{[0-9]+}}, %esp >> ; 32: jmp {{_?}}foo5 >> >> >> Removed: llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll?rev=95492&view=auto >> >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/twoaddr-delete.ll (removed) >> @@ -1,43 +0,0 @@ >> -; RUN: llc < %s -march=x86 -stats |& grep {twoaddrinstr} | grep {Number of dead instructions deleted} >> - >> - %struct.anon = type { [3 x double], double, %struct.node*, [64 x %struct.bnode*], [64 x %struct.bnode*] } >> - %struct.bnode = type { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x double], double, %struct.bnode*, %struct.bnode* } >> - %struct.node = type { i16, double, [3 x double], i32, i32 } >> - >> -define i32 @main(i32 %argc, i8** nocapture %argv) nounwind { >> -entry: >> - %0 = malloc %struct.anon ; <%struct.anon*> [#uses=2] >> - %1 = getelementptr %struct.anon* %0, i32 0, i32 2 ; <%struct.node**> [#uses=1] >> - br label %bb14.i >> - >> -bb14.i: ; preds = %bb14.i, %entry >> - %i8.0.reg2mem.0.i = phi i32 [ 0, %entry ], [ %2, %bb14.i ] ; [#uses=1] >> - %2 = add i32 %i8.0.reg2mem.0.i, 1 ; [#uses=2] >> - %exitcond74.i = icmp eq i32 %2, 32 ; [#uses=1] >> - br i1 %exitcond74.i, label %bb32.i, label %bb14.i >> - >> -bb32.i: ; preds = %bb32.i, %bb14.i >> - %tmp.0.reg2mem.0.i = phi i32 [ %indvar.next63.i, %bb32.i ], [ 0, %bb14.i ] ; [#uses=1] >> - %indvar.next63.i = add i32 %tmp.0.reg2mem.0.i, 1 ; [#uses=2] >> - %exitcond64.i = icmp eq i32 %indvar.next63.i, 64 ; [#uses=1] >> - br i1 %exitcond64.i, label %bb47.loopexit.i, label %bb32.i >> - >> -bb.i.i: ; preds = %bb47.loopexit.i >> - unreachable >> - >> -stepsystem.exit.i: ; preds = %bb47.loopexit.i >> - store %struct.node* null, %struct.node** %1, align 4 >> - br label %bb.i6.i >> - >> -bb.i6.i: ; preds = %bb.i6.i, %stepsystem.exit.i >> - br i1 false, label %bb107.i.i, label %bb.i6.i >> - >> -bb107.i.i: ; preds = %bb107.i.i, %bb.i6.i >> - %q_addr.0.i.i.in = phi %struct.bnode** [ null, %bb107.i.i ], [ %3, %bb.i6.i ] ; <%struct.bnode**> [#uses=0] >> - br label %bb107.i.i >> - >> -bb47.loopexit.i: ; preds = %bb32.i >> - %3 = getelementptr %struct.anon* %0, i32 0, i32 4, i32 0 ; <%struct.bnode**> [#uses=1] >> - %4 = icmp eq %struct.node* null, null ; [#uses=1] >> - br i1 %4, label %stepsystem.exit.i, label %bb.i.i >> -} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Mon Feb 8 14:34:14 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 20:34:14 -0000 Subject: [llvm-commits] [llvm] r95565 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/tailcall1.ll Message-ID: <201002082034.o18KYE8m005881@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 14:34:14 2010 New Revision: 95565 URL: http://llvm.org/viewvc/llvm-project?rev=95565&view=rev Log: In guaranteed tailcall mode, don't decline the tailcall optimization for blocks ending in "unreachable". Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/test/CodeGen/X86/tailcall1.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95565&r1=95564&r2=95565&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 8 14:34:14 2010 @@ -4205,13 +4205,16 @@ const ReturnInst *Ret = dyn_cast(Term); const Function *F = ExitBB->getParent(); - // The block must end in a return statement. - // FIXME: Disallow tailcall if the block ends in an unreachable for now. - // The way tailcall optimization is currently implemented means it will - // add an epilogue followed by a jump. That is not profitable. Also, if - // the callee is a special function (e.g. longjmp on x86), it can end up - // causing miscompilation that has not been fully understood. - if (!Ret) return false; + // The block must end in a return statement or unreachable. + // + // FIXME: Decline tailcall if it's not guaranteed and if the block ends in + // an unreachable, for now. The way tailcall optimization is currently + // implemented means it will add an epilogue followed by a jump. That is + // not profitable. Also, if the callee is a special function (e.g. + // longjmp on x86), it can end up causing miscompilation that has not + // been fully understood. + if (!Ret && + (!GuaranteedTailCallOpt || !isa(Term))) return false; // If I will have a chain, make sure no other instruction that will have a // chain interposes between I and the return. Modified: llvm/trunk/test/CodeGen/X86/tailcall1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall1.ll?rev=95565&r1=95564&r2=95565&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/tailcall1.ll (original) +++ llvm/trunk/test/CodeGen/X86/tailcall1.ll Mon Feb 8 14:34:14 2010 @@ -1,4 +1,7 @@ -; RUN: llc < %s -march=x86 -tailcallopt | grep TAILCALL | count 4 +; RUN: llc < %s -march=x86 -tailcallopt | grep TAILCALL | count 5 + +; With -tailcallopt, CodeGen guarantees a tail call optimization +; for all of these. declare fastcc i32 @tailcallee(i32 %a1, i32 %a2, i32 %a3, i32 %a4) From baldrick at free.fr Mon Feb 8 14:48:55 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 20:48:55 -0000 Subject: [llvm-commits] [dragonegg] r95566 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002082048.o18Kmtfi006689@zion.cs.uiuc.edu> Author: baldrick Date: Mon Feb 8 14:48:55 2010 New Revision: 95566 URL: http://llvm.org/viewvc/llvm-project?rev=95566&view=rev Log: Add support for covariant return thunks. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95566&r1=95565&r2=95566&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Mon Feb 8 14:48:55 2010 @@ -1548,8 +1548,37 @@ pop_cfun (); } +/// ApplyVirtualOffset - Adjust 'this' by a virtual offset. +static Value *ApplyVirtualOffset(Value *This, HOST_WIDE_INT virtual_value, + LLVMBuilder &Builder) { + LLVMContext &Context = getGlobalContext(); + const Type *IntPtrTy = TheTarget->getTargetData()->getIntPtrType(Context); + + // The vptr is always at offset zero in the object. + const Type *HandleTy = Type::getInt8PtrTy(Context)->getPointerTo(); + Value *VPtr = Builder.CreateBitCast(This, HandleTy->getPointerTo()); + + // Form the vtable address. + Value *VTableAddr = Builder.CreateLoad(VPtr); + + // Find the entry with the vcall offset. + VTableAddr = Builder.CreatePtrToInt(VTableAddr, IntPtrTy); + Value *VOffset = ConstantInt::get(IntPtrTy, virtual_value); + VTableAddr = Builder.CreateNSWAdd(VTableAddr, VOffset); + VTableAddr = Builder.CreateIntToPtr(VTableAddr, HandleTy); + + // Get the offset itself. + Value *VCallOffset = Builder.CreateLoad(VTableAddr); + VCallOffset = Builder.CreatePtrToInt(VCallOffset, IntPtrTy); + + // Adjust the 'this' pointer. + Value *Adjusted = Builder.CreatePtrToInt(This, IntPtrTy); + Adjusted = Builder.CreateNSWAdd(Adjusted, VCallOffset); + return Builder.CreateIntToPtr(Adjusted, This->getType()); +} + /// emit_thunk - Turn a thunk into LLVM IR. -void emit_thunk(struct cgraph_node *node) { +static void emit_thunk(struct cgraph_node *node) { if (errorcount || sorrycount) return; // Do not process broken code. @@ -1559,13 +1588,22 @@ return; } - assert(node->thunk.this_adjusting && "covariant return thunks not done yet!"); + // Mark the thunk as written so gcc doesn't waste time outputting it. + TREE_ASM_WRITTEN(node->decl) = 1; + + // Whether the thunk adjusts 'this' before calling the thunk alias (otherwise + // it is the value returned by the alias that is adjusted). + bool ThisAdjusting = node->thunk.this_adjusting; LLVMContext &Context = getGlobalContext(); + const Type *IntPtrTy = TheTarget->getTargetData()->getIntPtrType(Context); LLVMBuilder Builder(Context, *TheFolder); Builder.SetInsertPoint(BasicBlock::Create(Context, "entry", Thunk)); - bool FoundThis = false; // Did we find 'this' yet? + // Whether we found 'this' yet. When not 'this adjusting', setting this to + // 'true' means all parameters (including 'this') are passed through as is. + bool FoundThis = !ThisAdjusting; + SmallVector Arguments; for (Function::arg_iterator AI = Thunk->arg_begin(), AE = Thunk->arg_end(); AI != AE; ++AI) { @@ -1582,34 +1620,16 @@ assert(isa(AI->getType()) && "Wrong type for 'this'!"); // Adjust 'this' according to the thunk offsets. First, the fixed offset. - const Type *IntPtrTy = TheTarget->getTargetData()->getIntPtrType(Context); Value *This = Builder.CreatePtrToInt(AI, IntPtrTy); Value *Offset = ConstantInt::get(IntPtrTy, node->thunk.fixed_offset); This = Builder.CreateNSWAdd(This, Offset); + This = Builder.CreateIntToPtr(This, AI->getType()); - if (node->thunk.virtual_offset_p) { - // The vptr is always at offset zero in the object. - const Type *HandleTy = Type::getInt8PtrTy(Context)->getPointerTo(); - Value *VPtr = Builder.CreateIntToPtr(This, HandleTy->getPointerTo()); - - // Form the vtable address. - Value *VTableAddr = Builder.CreateLoad(VPtr); - - // Find the entry with the vcall offset. - VTableAddr = Builder.CreatePtrToInt(VTableAddr, IntPtrTy); - Value *VOffset = ConstantInt::get(IntPtrTy, node->thunk.virtual_value); - VTableAddr = Builder.CreateNSWAdd(VTableAddr, VOffset); - VTableAddr = Builder.CreateIntToPtr(VTableAddr, HandleTy); - - // Get the offset itself. - Value *VCallOffset = Builder.CreateLoad(VTableAddr); - VCallOffset = Builder.CreatePtrToInt(VCallOffset, IntPtrTy); + // Then by the virtual offset, if any. + if (node->thunk.virtual_offset_p) + This = ApplyVirtualOffset(This, node->thunk.virtual_value, Builder); - // Adjust the 'this' pointer. - This = Builder.CreateNSWAdd(This, VCallOffset); - } - - Arguments.push_back(Builder.CreateIntToPtr(This, AI->getType())); + Arguments.push_back(This); } CallInst *Call = Builder.CreateCall(DECL_LLVM(node->thunk.alias), @@ -1619,13 +1639,44 @@ // All parameters except 'this' are passed on unchanged - this is a tail call. Call->setTailCall(); - if (Thunk->getReturnType()->isVoidTy()) - Builder.CreateRetVoid(); - else - Builder.CreateRet(Call); + if (ThisAdjusting) { + // Return the value unchanged. + if (Thunk->getReturnType()->isVoidTy()) + Builder.CreateRetVoid(); + else + Builder.CreateRet(Call); + return; + } + + // Covariant return thunk - adjust the returned value by the thunk offsets. + assert(Call->getType()->isPointer() && "Only know how to adjust pointers!"); + Value *RetVal = Call; + + // First check if the returned value is NULL. + Value *Zero = Constant::getNullValue(RetVal->getType()); + Value *isNull = Builder.CreateICmpEQ(RetVal, Zero); + + BasicBlock *isNullBB = BasicBlock::Create(Context, "isNull", Thunk); + BasicBlock *isNotNullBB = BasicBlock::Create(Context, "isNotNull", Thunk); + Builder.CreateCondBr(isNull, isNullBB, isNotNullBB); + + // If it is NULL, return it without any adjustment. + Builder.SetInsertPoint(isNullBB); + Builder.CreateRet(Zero); + + // Otherwise, first adjust by the virtual offset, if any. + Builder.SetInsertPoint(isNotNullBB); + if (node->thunk.virtual_offset_p) + RetVal = ApplyVirtualOffset(RetVal, node->thunk.virtual_value, Builder); + + // Then move 'this' by the fixed offset. + RetVal = Builder.CreatePtrToInt(RetVal, IntPtrTy); + Value *Offset = ConstantInt::get(IntPtrTy, node->thunk.fixed_offset); + RetVal = Builder.CreateNSWAdd(RetVal, Offset); + RetVal = Builder.CreateIntToPtr(RetVal, Thunk->getType()); - // Mark the thunk as written so gcc doesn't waste time outputting it. - TREE_ASM_WRITTEN(node->decl) = 1; + // Return the adjusted value. + Builder.CreateRet(RetVal); } /// emit_alias - Given decl and target emit alias to target. From dpatel at apple.com Mon Feb 8 14:51:18 2010 From: dpatel at apple.com (Devang Patel) Date: Mon, 08 Feb 2010 20:51:18 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95567 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <201002082051.o18KpIrT006858@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 8 14:51:18 2010 New Revision: 95567 URL: http://llvm.org/viewvc/llvm-project?rev=95567&view=rev Log: Do not emit linkage name for function local statics. Emit linkage name otherwise. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=95567&r1=95566&r2=95567&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Mon Feb 8 14:51:18 2010 @@ -542,9 +542,13 @@ if (IDENTIFIER_POINTER(DECL_NAME(decl))) DispName = IDENTIFIER_POINTER(DECL_NAME(decl)); } - + StringRef LinkageName; + // The gdb does not expect linkage names for function local statics. + if (DECL_CONTEXT (decl)) + if (TREE_CODE (DECL_CONTEXT (decl)) != FUNCTION_DECL) + LinkageName = GV->getName(); DebugFactory.CreateGlobalVariable(findRegion(DECL_CONTEXT(decl)), - DispName, DispName, StringRef(), + DispName, DispName, LinkageName, getOrCreateCompileUnit(Loc.file), Loc.line, TyD, GV->hasInternalLinkage(), true/*definition*/, GV); From clattner at apple.com Mon Feb 8 14:51:59 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 8 Feb 2010 12:51:59 -0800 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h In-Reply-To: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> References: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> Message-ID: On Feb 8, 2010, at 11:36 AM, Duncan Sands wrote: > Author: baldrick > Date: Mon Feb 8 13:36:51 2010 > New Revision: 95557 > > URL: http://llvm.org/viewvc/llvm-project?rev=95557&view=rev > Log: > Flesh out the list of predicates, for those who like this style. I > was > looking for isPointer, and added the rest for uniformity. Why not just use isa? This encourages code to diverge in style. -Chris > > Modified: > llvm/trunk/include/llvm/Type.h > > Modified: llvm/trunk/include/llvm/Type.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=95557&r1=95556&r2=95557&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Type.h (original) > +++ llvm/trunk/include/llvm/Type.h Mon Feb 8 13:36:51 2010 > @@ -233,7 +233,27 @@ > /// isFPOrFPVector - Return true if this is a FP type or a vector > of FP types. > /// > bool isFPOrFPVector() const; > - > + > + /// isFunction - True if this is an instance of FunctionType. > + /// > + bool isFunction() const { return ID == FunctionTyID; } > + > + /// isStruct - True if this is an instance of StructType. > + /// > + bool isStruct() const { return ID == StructTyID; } > + > + /// isArray - True if this is an instance of ArrayType. > + /// > + bool isArray() const { return ID == ArrayTyID; } > + > + /// isPointer - True if this is an instance of PointerType. > + /// > + bool isPointer() const { return ID == PointerTyID; } > + > + /// isVector - True if this is an instance of VectorType. > + /// > + bool isVector() const { return ID == VectorTyID; } > + > /// isAbstract - True if the type is either an Opaque type, or is > a derived > /// type that includes an opaque type somewhere in it. > /// > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Mon Feb 8 14:53:35 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 21:53:35 +0100 Subject: [llvm-commits] [llvm] r95351 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/tailcall2.ll In-Reply-To: <72D6E032-C643-4875-B1F3-A0BF8916D3E9@apple.com> References: <201002050221.o152LDaP021459@zion.cs.uiuc.edu> <4B6BD574.6040104@free.fr> <4B6C84E7.7050504@free.fr> <72D6E032-C643-4875-B1F3-A0BF8916D3E9@apple.com> Message-ID: <4B7079CF.2030901@free.fr> Hi Evan, >> this is great - all of this tailcall work is doing nice things to thunks, >> for example the thunk in 2003-11-27-MultipleInheritanceThunk.cpp now compiles >> (using dragonegg) to this: >> >> _ZThn16_N20AliasAnalysisCounter13getModRefInfoE8CallSite: >> .Leh_func_begin2: >> subq $8, %rsp >> .Llabel1: >> addq $-16, %rdi >> addq $8, %rsp >> jmp _ZN20AliasAnalysisCounter13getModRefInfoE8CallSite # TAILCALL >> >> Pity about the stack pointer adjustments, but compared to what it was before, >> it's like Christmas came round all over again! > > I am getting rid of the unnecessary stack ptr adjustments next. thanks - it is very nice now. I also tried some covariant return thunks, and for them LLVM is now producing better code than gcc-4.5. Ciao, Duncan. From baldrick at free.fr Mon Feb 8 14:58:22 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 08 Feb 2010 21:58:22 +0100 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h In-Reply-To: References: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> Message-ID: <4B707AEE.9010508@free.fr> Hi Chris, > Why not just use isa? > > This encourages code to diverge in style. since there already is isFloat, isInteger and variations, it seems odd not to have these too. Of course, I could just delete all the guys with an "isa" version. What do you think? Ciao, Duncan. From clattner at apple.com Mon Feb 8 15:34:06 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 8 Feb 2010 13:34:06 -0800 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h In-Reply-To: <4B707AEE.9010508@free.fr> References: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> <4B707AEE.9010508@free.fr> Message-ID: <61F6705E-E1B0-4575-BA0B-A365D0960DDB@apple.com> On Feb 8, 2010, at 12:58 PM, Duncan Sands wrote: > Hi Chris, > >> Why not just use isa? >> This encourages code to diverge in style. > > since there already is isFloat, isInteger and variations, it seems > odd not > to have these too. Of course, I could just delete all the guys with > an "isa" > version. What do you think? isInteger is required because we need an argument. I don't really care one way or another though, so long as the code is consistent. Are you willing to change all isa(x) to X->isPointer() ? -Chris From dalej at apple.com Mon Feb 8 15:53:28 2010 From: dalej at apple.com (Dale Johannesen) Date: Mon, 08 Feb 2010 21:53:28 -0000 Subject: [llvm-commits] [llvm] r95579 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <201002082153.o18LrS1S009876@zion.cs.uiuc.edu> Author: johannes Date: Mon Feb 8 15:53:27 2010 New Revision: 95579 URL: http://llvm.org/viewvc/llvm-project?rev=95579&view=rev Log: Apply the 95471 fix to SelectionDAGBuilder as well; we can get in here if FastISel gives up in a block. (Actually the two copies of this need to be unified. Later.) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95579&r1=95578&r2=95579&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 8 15:53:27 2010 @@ -3760,6 +3760,8 @@ MDNode *Variable = DI.getVariable(); Value *Address = DI.getAddress(); + if (!Address) + return 0; if (BitCastInst *BCI = dyn_cast(Address)) Address = BCI->getOperand(0); AllocaInst *AI = dyn_cast(Address); From gohman at apple.com Mon Feb 8 16:00:06 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 22:00:06 -0000 Subject: [llvm-commits] [llvm] r95582 - in /llvm/trunk: include/llvm/Analysis/ConstantFolding.h lib/Analysis/ConstantFolding.cpp Message-ID: <201002082200.o18M06nv010248@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 16:00:06 2010 New Revision: 95582 URL: http://llvm.org/viewvc/llvm-project?rev=95582&view=rev Log: Add const qualifiers. Modified: llvm/trunk/include/llvm/Analysis/ConstantFolding.h llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/include/llvm/Analysis/ConstantFolding.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ConstantFolding.h?rev=95582&r1=95581&r2=95582&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ConstantFolding.h (original) +++ llvm/trunk/include/llvm/Analysis/ConstantFolding.h Mon Feb 8 16:00:06 2010 @@ -37,7 +37,7 @@ /// ConstantFoldConstantExpression - Attempt to fold the constant expression /// using the specified TargetData. If successful, the constant result is /// result is returned, if not, null is returned. -Constant *ConstantFoldConstantExpression(ConstantExpr *CE, +Constant *ConstantFoldConstantExpression(const ConstantExpr *CE, const TargetData *TD = 0); /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=95582&r1=95581&r2=95582&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Feb 8 16:00:06 2010 @@ -712,10 +712,10 @@ /// ConstantFoldConstantExpression - Attempt to fold the constant expression /// using the specified TargetData. If successful, the constant result is /// result is returned, if not, null is returned. -Constant *llvm::ConstantFoldConstantExpression(ConstantExpr *CE, +Constant *llvm::ConstantFoldConstantExpression(const ConstantExpr *CE, const TargetData *TD) { SmallVector Ops; - for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i) { + for (User::const_op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i) { Constant *NewC = cast(*i); // Recursively fold the ConstantExpr's operands. if (ConstantExpr *NewCE = dyn_cast(NewC)) From gohman at apple.com Mon Feb 8 16:02:38 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 22:02:38 -0000 Subject: [llvm-commits] [llvm] r95583 - in /llvm/trunk: lib/CodeGen/AsmPrinter/AsmPrinter.cpp test/CodeGen/X86/ptrtoint-constexpr.ll Message-ID: <201002082202.o18M2djX010345@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 16:02:38 2010 New Revision: 95583 URL: http://llvm.org/viewvc/llvm-project?rev=95583&view=rev Log: When CodeGen'ing unoptimized code, there may be unfolded constant expressions in global initializers. Instead of aborting, attempt to fold them on the spot. If folding succeeds, emit the folded expression instead. This fixes PR6255. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/test/CodeGen/X86/ptrtoint-constexpr.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95583&r1=95582&r2=95583&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Feb 8 16:02:38 2010 @@ -25,6 +25,7 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/DebugInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" @@ -887,15 +888,16 @@ } switch (CE->getOpcode()) { - case Instruction::ZExt: - case Instruction::SExt: - case Instruction::FPTrunc: - case Instruction::FPExt: - case Instruction::UIToFP: - case Instruction::SIToFP: - case Instruction::FPToUI: - case Instruction::FPToSI: - default: llvm_unreachable("FIXME: Don't support this constant cast expr"); + default: + // If the code isn't optimized, there may be outstanding folding + // opportunities. Attempt to fold the expression using TargetData as a + // last resort before giving up. + if (Constant *C = ConstantFoldConstantExpression(CE, AP.TM.getTargetData())) + return LowerConstant(C, AP); +#ifndef NDEBUG + CE->dump(); +#endif + llvm_unreachable("FIXME: Don't support this constant expr"); case Instruction::GetElementPtr: { const TargetData &TD = *AP.TM.getTargetData(); // Generate a symbolic expression for the byte address Modified: llvm/trunk/test/CodeGen/X86/ptrtoint-constexpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ptrtoint-constexpr.ll?rev=95583&r1=95582&r2=95583&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/ptrtoint-constexpr.ll (original) +++ llvm/trunk/test/CodeGen/X86/ptrtoint-constexpr.ll Mon Feb 8 16:02:38 2010 @@ -6,3 +6,9 @@ ; CHECK: .quad r&4294967295 @r = global %union.x { i64 ptrtoint (%union.x* @r to i64) }, align 4 + +; CHECK: .globl x +; CHECK: x: +; CHECK: .quad 3 + + at x = global i64 mul (i64 3, i64 ptrtoint (i2* getelementptr (i2* null, i64 1) to i64)) From johnny.chen at apple.com Mon Feb 8 16:02:41 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 08 Feb 2010 22:02:41 -0000 Subject: [llvm-commits] [llvm] r95584 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002082202.o18M2f7q010357@zion.cs.uiuc.edu> Author: johnny Date: Mon Feb 8 16:02:41 2010 New Revision: 95584 URL: http://llvm.org/viewvc/llvm-project?rev=95584&view=rev Log: Add VCVTR (between floating-point and integer, VFP) for disassembly purpose. The 'R' suffix means the to-integer operations use the rounding mode specified by the FPSCR, encoded as Inst{7} = 0. A8.6.295 Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95584&r1=95583&r2=95584&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Feb 8 16:02:41 2010 @@ -363,6 +363,37 @@ let Inst{7} = 1; // Z bit } +// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR. +// For disassembly only. + +def VTOSIRD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011, + (outs SPR:$dst), (ins DPR:$a), + IIC_fpCVTDI, "vcvtr", ".s32.f64\t$dst, $a", + [/* For disassembly only; pattern left blank */]> { + let Inst{7} = 0; // Z bit +} + +def VTOSIRS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010, + (outs SPR:$dst), (ins SPR:$a), + IIC_fpCVTSI, "vcvtr", ".s32.f32\t$dst, $a", + [/* For disassembly only; pattern left blank */]> { + let Inst{7} = 0; // Z bit +} + +def VTOUIRD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011, + (outs SPR:$dst), (ins DPR:$a), + IIC_fpCVTDI, "vcvtr", ".u32.f64\t$dst, $a", + [/* For disassembly only; pattern left blank */]> { + let Inst{7} = 0; // Z bit +} + +def VTOUIRS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010, + (outs SPR:$dst), (ins SPR:$a), + IIC_fpCVTSI, "vcvtr", ".u32.f32\t$dst, $a", + [/* For disassembly only; pattern left blank */]> { + let Inst{7} = 0; // Z bit +} + //===----------------------------------------------------------------------===// // FP FMA Operations. // From sabre at nondot.org Mon Feb 8 16:05:38 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 22:05:38 -0000 Subject: [llvm-commits] [llvm] r95585 - /llvm/trunk/include/llvm/Support/Casting.h Message-ID: <201002082205.o18M5cLw010528@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 16:05:38 2010 New Revision: 95585 URL: http://llvm.org/viewvc/llvm-project?rev=95585&view=rev Log: use a c-style cast instead of reinterpret-cast, as sometimes the cast needs to adjust for a vtable pointer when going from base to derived type (when the base doesn't have a vtable but the derived type does). Modified: llvm/trunk/include/llvm/Support/Casting.h Modified: llvm/trunk/include/llvm/Support/Casting.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?rev=95585&r1=95584&r2=95585&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Casting.h (original) +++ llvm/trunk/include/llvm/Support/Casting.h Mon Feb 8 16:05:38 2010 @@ -180,8 +180,9 @@ template struct cast_convert_val { // This _is_ a simple type, just cast it. static typename cast_retty::ret_type doit(const FromTy &Val) { - return reinterpret_cast::ret_type>( - const_cast(Val)); + typename cast_retty::ret_type Res2 + = (typename cast_retty::ret_type)const_cast(Val); + return Res2; } }; From sabre at nondot.org Mon Feb 8 16:07:36 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 22:07:36 -0000 Subject: [llvm-commits] [llvm] r95587 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp Message-ID: <201002082207.o18M7aJF010636@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 16:07:36 2010 New Revision: 95587 URL: http://llvm.org/viewvc/llvm-project?rev=95587&view=rev Log: don't make hte dtor private or we can't construct the class. Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95587&r1=95586&r2=95587&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Feb 8 16:07:36 2010 @@ -333,7 +333,7 @@ /// NOTE: All subclasses are required to have trivial destructors because /// MCExprs are bump pointer allocated and not destructed. class MCTargetExpr : public MCExpr { - virtual ~MCTargetExpr(); // Not accessible. + virtual void Anchor(); protected: MCTargetExpr() : MCExpr(Target) {} Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=95587&r1=95586&r2=95587&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Feb 8 16:07:36 2010 @@ -133,7 +133,7 @@ return Create(Ctx.GetOrCreateSymbol(Name), Ctx); } -MCTargetExpr::~MCTargetExpr() {} +void MCTargetExpr::Anchor() {} /* *** */ From sabre at nondot.org Mon Feb 8 16:09:08 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 22:09:08 -0000 Subject: [llvm-commits] [llvm] r95588 - in /llvm/trunk: lib/Target/X86/CMakeLists.txt lib/Target/X86/X86MCTargetExpr.cpp lib/Target/X86/X86MCTargetExpr.h lib/Target/X86/X86TargetObjectFile.cpp test/CodeGen/X86/personality.ll Message-ID: <201002082209.o18M98dD010715@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 16:09:08 2010 New Revision: 95588 URL: http://llvm.org/viewvc/llvm-project?rev=95588&view=rev Log: add an x86 implementation of MCTargetExpr for representing @GOT and friends. Use it for personality references as a first use. Added: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp llvm/trunk/test/CodeGen/X86/personality.ll Modified: llvm/trunk/lib/Target/X86/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/CMakeLists.txt?rev=95588&r1=95587&r2=95588&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/X86/CMakeLists.txt Mon Feb 8 16:09:08 2010 @@ -26,6 +26,7 @@ X86JITInfo.cpp X86MCAsmInfo.cpp X86MCCodeEmitter.cpp + X86MCTargetExpr.cpp X86RegisterInfo.cpp X86Subtarget.cpp X86TargetMachine.cpp Added: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp?rev=95588&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp (added) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp Mon Feb 8 16:09:08 2010 @@ -0,0 +1,43 @@ +//===- X86MCTargetExpr.cpp - X86 Target Specific MCExpr Implementation ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "X86MCTargetExpr.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCValue.h" +#include "llvm/Support/raw_ostream.h" +using namespace llvm; + +X86MCTargetExpr *X86MCTargetExpr::Create(const MCSymbol *Sym, VariantKind K, + MCContext &Ctx) { + return new (Ctx) X86MCTargetExpr(Sym, K); +} + +void X86MCTargetExpr::PrintImpl(raw_ostream &OS) const { + OS << *Sym; + + switch (Kind) { + case GOT: OS << "@GOT"; break; + case PLT: OS << "@PLT"; break; + case GOTPCREL: OS << "@GOTPCREL"; break; + } +} + +bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res) const { + // FIXME: I don't know if this is right, it followed MCSymbolRefExpr. + + // Evaluate recursively if this is a variable. + if (Sym->isVariable()) + return Sym->getValue()->EvaluateAsRelocatable(Res); + + Res = MCValue::get(Sym, 0, 0); + return true; +} + +X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; } \ No newline at end of file Added: llvm/trunk/lib/Target/X86/X86MCTargetExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.h?rev=95588&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.h (added) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Mon Feb 8 16:09:08 2010 @@ -0,0 +1,42 @@ +//===- X86MCTargetExpr.h - X86 Target Specific MCExpr -----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef X86_MCTARGETEXPR_H +#define X86_MCTARGETEXPR_H + +#include "llvm/MC/MCExpr.h" + +namespace llvm { + +/// X86MCTargetExpr - This class represents symbol variants, like foo at GOT. +class X86MCTargetExpr : public MCTargetExpr { +public: + enum VariantKind { + GOT, + PLT, + GOTPCREL + }; +private: + /// Sym - The symbol being referenced. + const MCSymbol * const Sym; + /// Kind - The modifier. + const VariantKind Kind; + + X86MCTargetExpr(const MCSymbol *S, VariantKind K) : Sym(S), Kind(K) {} +public: + static X86MCTargetExpr *Create(const MCSymbol *Sym, VariantKind K, + MCContext &Ctx); + + void PrintImpl(raw_ostream &OS) const; + bool EvaluateAsRelocatableImpl(MCValue &Res) const; +}; + +} // end namespace llvm + +#endif Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=95588&r1=95587&r2=95588&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Mon Feb 8 16:09:08 2010 @@ -8,9 +8,9 @@ //===----------------------------------------------------------------------===// #include "X86TargetObjectFile.h" +#include "X86MCTargetExpr.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/MC/MCContext.h" -#include "llvm/MC/MCExpr.h" #include "llvm/Target/Mangler.h" #include "llvm/ADT/SmallString.h" using namespace llvm; @@ -57,9 +57,9 @@ SmallString<128> Name; Mang->getNameWithPrefix(Name, GV, false); - Name += "@GOTPCREL"; + const MCSymbol *Sym = getContext().CreateSymbol(Name); const MCExpr *Res = - MCSymbolRefExpr::Create(Name.str(), getContext()); + X86MCTargetExpr::Create(Sym, X86MCTargetExpr::GOTPCREL, getContext()); const MCExpr *Four = MCConstantExpr::Create(4, getContext()); return MCBinaryExpr::CreateAdd(Res, Four, getContext()); } Modified: llvm/trunk/test/CodeGen/X86/personality.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/personality.ll?rev=95588&r1=95587&r2=95588&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/personality.ll (original) +++ llvm/trunk/test/CodeGen/X86/personality.ll Mon Feb 8 16:09:08 2010 @@ -39,7 +39,7 @@ declare void @__cxa_end_catch() ; X64: Leh_frame_common_begin: -; X64: .long ___gxx_personality_v0 at GOTPCREL+4 +; X64: .long (___gxx_personality_v0 at GOTPCREL)+4 ; X32: Leh_frame_common_begin: ; X32: .long L___gxx_personality_v0$non_lazy_ptr- From gohman at apple.com Mon Feb 8 16:19:11 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 22:19:11 -0000 Subject: [llvm-commits] [llvm] r95591 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <201002082219.o18MJBTT011336@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 16:19:11 2010 New Revision: 95591 URL: http://llvm.org/viewvc/llvm-project?rev=95591&view=rev Log: ConstantFoldConstantExpression can theoretically return the original expression; don't go into an infinite loop if it does. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95591&r1=95590&r2=95591&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Feb 8 16:19:11 2010 @@ -892,8 +892,10 @@ // If the code isn't optimized, there may be outstanding folding // opportunities. Attempt to fold the expression using TargetData as a // last resort before giving up. - if (Constant *C = ConstantFoldConstantExpression(CE, AP.TM.getTargetData())) - return LowerConstant(C, AP); + if (Constant *C = + ConstantFoldConstantExpression(CE, AP.TM.getTargetData())) + if (C != CE) + return LowerConstant(C, AP); #ifndef NDEBUG CE->dump(); #endif From sabre at nondot.org Mon Feb 8 16:33:56 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 22:33:56 -0000 Subject: [llvm-commits] [llvm] r95593 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86MCInstLower.cpp X86ISelLowering.cpp X86MCTargetExpr.cpp X86MCTargetExpr.h X86TargetObjectFile.cpp Message-ID: <201002082233.o18MXvmI012240@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 16:33:55 2010 New Revision: 95593 URL: http://llvm.org/viewvc/llvm-project?rev=95593&view=rev Log: switch ELF @GOTOFF references to use X86MCTargetExpr. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp llvm/trunk/lib/Target/X86/X86MCTargetExpr.h llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95593&r1=95592&r2=95593&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Feb 8 16:33:55 2010 @@ -14,8 +14,9 @@ #include "X86MCInstLower.h" #include "X86AsmPrinter.h" -#include "X86MCAsmInfo.h" #include "X86COFFMachineModuleInfo.h" +#include "X86MCAsmInfo.h" +#include "X86MCTargetExpr.h" #include "llvm/Analysis/DebugInfo.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/MC/MCContext.h" @@ -67,6 +68,8 @@ COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData()); } + //X86MCTargetExpr::VariantKind Kind = X86MCTargetExpr::Invalid; + switch (MO.getTargetFlags()) { default: llvm_unreachable("Unknown target flag on GV operand"); case X86II::MO_NO_FLAG: // No flag. @@ -115,7 +118,7 @@ case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; case X86II::MO_PLT: Name += "@PLT"; break; } - + return Ctx.GetOrCreateSymbol(Name.str()); } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95593&r1=95592&r2=95593&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 8 16:33:55 2010 @@ -16,6 +16,7 @@ #include "X86.h" #include "X86InstrBuilder.h" #include "X86ISelLowering.h" +#include "X86MCTargetExpr.h" #include "X86TargetMachine.h" #include "X86TargetObjectFile.h" #include "llvm/CallingConv.h" @@ -36,7 +37,6 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" -#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSymbol.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallSet.h" @@ -1130,10 +1130,8 @@ Subtarget->isPICStyleGOT()); // In 32-bit ELF systems, our jump table entries are formed with @GOTOFF // entries. - - // FIXME: @GOTOFF should be a property of MCSymbolRefExpr not in the MCSymbol. - std::string Name = MBB->getSymbol(Ctx)->getName() + "@GOTOFF"; - return MCSymbolRefExpr::Create(Ctx.GetOrCreateSymbol(StringRef(Name)), Ctx); + return X86MCTargetExpr::Create(MBB->getSymbol(Ctx), + X86MCTargetExpr::GOTOFF, Ctx); } /// getPICJumpTableRelocaBase - Returns relocation base for the given PIC Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp?rev=95593&r1=95592&r2=95593&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp Mon Feb 8 16:33:55 2010 @@ -23,9 +23,11 @@ OS << *Sym; switch (Kind) { - case GOT: OS << "@GOT"; break; - case PLT: OS << "@PLT"; break; + case Invalid: OS << "@"; break; + case GOT: OS << "@GOT"; break; + case PLT: OS << "@PLT"; break; case GOTPCREL: OS << "@GOTPCREL"; break; + case GOTOFF: OS << "@GOTOFF"; break; } } @@ -39,5 +41,3 @@ Res = MCValue::get(Sym, 0, 0); return true; } - -X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; } \ No newline at end of file Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.h?rev=95593&r1=95592&r2=95593&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.h (original) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Mon Feb 8 16:33:55 2010 @@ -18,9 +18,11 @@ class X86MCTargetExpr : public MCTargetExpr { public: enum VariantKind { + Invalid, GOT, PLT, - GOTPCREL + GOTPCREL, + GOTOFF }; private: /// Sym - The symbol being referenced. Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=95593&r1=95592&r2=95593&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Mon Feb 8 16:33:55 2010 @@ -55,6 +55,7 @@ IsIndirect = true; IsPCRel = true; + // FIXME: Use GetSymbolWithGlobalValueBase. SmallString<128> Name; Mang->getNameWithPrefix(Name, GV, false); const MCSymbol *Sym = getContext().CreateSymbol(Name); From scallanan at apple.com Mon Feb 8 16:50:23 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 08 Feb 2010 22:50:23 -0000 Subject: [llvm-commits] [llvm] r95594 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Message-ID: <201002082250.o18MoNOT012992@zion.cs.uiuc.edu> Author: spyffe Date: Mon Feb 8 16:50:23 2010 New Revision: 95594 URL: http://llvm.org/viewvc/llvm-project?rev=95594&view=rev Log: Fixed the AT&T AsmLexer to report the proper strings for register tokens. Before, if it encountered '%al,' it would report 'al,' as the token. Now it correctly reports '%al'. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=95594&r1=95593&r2=95594&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Mon Feb 8 16:50:23 2010 @@ -72,7 +72,7 @@ static unsigned MatchRegisterName(const StringRef &Name); AsmToken X86AsmLexer::LexTokenATT() { - const AsmToken &lexedToken = lexDefinite(); + const AsmToken lexedToken = lexDefinite(); switch (lexedToken.getKind()) { default: From sabre at nondot.org Mon Feb 8 16:52:48 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 22:52:48 -0000 Subject: [llvm-commits] [llvm] r95595 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86MCInstLower.cpp AsmPrinter/X86MCInstLower.h X86MCTargetExpr.cpp X86MCTargetExpr.h Message-ID: <201002082252.o18MqmfP013090@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 16:52:47 2010 New Revision: 95595 URL: http://llvm.org/viewvc/llvm-project?rev=95595&view=rev Log: switch the rest of the "@ concatentation" logic in the X86 backend to use X86MCTargetExpr, simplifying a bunch of code. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95595&r1=95594&r2=95595&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Feb 8 16:52:47 2010 @@ -68,12 +68,19 @@ COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData()); } - //X86MCTargetExpr::VariantKind Kind = X86MCTargetExpr::Invalid; - switch (MO.getTargetFlags()) { default: llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // No flag. - case X86II::MO_PIC_BASE_OFFSET: // Doesn't modify symbol name. + case X86II::MO_NO_FLAG: // These don't modify the symbol name. + case X86II::MO_PIC_BASE_OFFSET: + case X86II::MO_TLSGD: + case X86II::MO_GOTTPOFF: + case X86II::MO_INDNTPOFF: + case X86II::MO_TPOFF: + case X86II::MO_NTPOFF: + case X86II::MO_GOTPCREL: + case X86II::MO_GOT: + case X86II::MO_GOTOFF: + case X86II::MO_PLT: break; case X86II::MO_DLLIMPORT: { // Handle dllimport linkage. @@ -107,16 +114,6 @@ StubSym = AsmPrinter.GetGlobalValueSymbol(GV); return Sym; } - // FIXME: These probably should be a modifier on the symbol or something?? - case X86II::MO_TLSGD: Name += "@TLSGD"; break; - case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break; - case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break; - case X86II::MO_TPOFF: Name += "@TPOFF"; break; - case X86II::MO_NTPOFF: Name += "@NTPOFF"; break; - case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break; - case X86II::MO_GOT: Name += "@GOT"; break; - case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; - case X86II::MO_PLT: Name += "@PLT"; break; } return Ctx.GetOrCreateSymbol(Name.str()); @@ -130,9 +127,18 @@ switch (MO.getTargetFlags()) { default: llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // No flag. + case X86II::MO_NO_FLAG: // These don't modify the symbol name. case X86II::MO_GOT_ABSOLUTE_ADDRESS: // Doesn't modify symbol name. - case X86II::MO_PIC_BASE_OFFSET: // Doesn't modify symbol name. + case X86II::MO_PIC_BASE_OFFSET: + case X86II::MO_TLSGD: + case X86II::MO_GOTTPOFF: + case X86II::MO_INDNTPOFF: + case X86II::MO_TPOFF: + case X86II::MO_NTPOFF: + case X86II::MO_GOTPCREL: + case X86II::MO_GOT: + case X86II::MO_GOTOFF: + case X86II::MO_PLT: break; case X86II::MO_DLLIMPORT: { // Handle dllimport linkage. @@ -151,125 +157,40 @@ } return Sym; } - // FIXME: These probably should be a modifier on the symbol or something?? - case X86II::MO_TLSGD: Name += "@TLSGD"; break; - case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break; - case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break; - case X86II::MO_TPOFF: Name += "@TPOFF"; break; - case X86II::MO_NTPOFF: Name += "@NTPOFF"; break; - case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break; - case X86II::MO_GOT: Name += "@GOT"; break; - case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; - case X86II::MO_PLT: Name += "@PLT"; break; - } - - return Ctx.GetOrCreateSymbol(Name.str()); -} - -MCSymbol *X86MCInstLower::GetJumpTableSymbol(const MachineOperand &MO) const { - SmallString<256> Name; - // FIXME: Use AsmPrinter.GetJTISymbol. @TLSGD shouldn't be part of the symbol - // name! - raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "JTI" - << AsmPrinter.getFunctionNumber() << '_' << MO.getIndex(); - - switch (MO.getTargetFlags()) { - default: - llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // No flag. - case X86II::MO_PIC_BASE_OFFSET: - case X86II::MO_DARWIN_NONLAZY_PIC_BASE: - case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: - break; - // FIXME: These probably should be a modifier on the symbol or something?? - case X86II::MO_TLSGD: Name += "@TLSGD"; break; - case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break; - case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break; - case X86II::MO_TPOFF: Name += "@TPOFF"; break; - case X86II::MO_NTPOFF: Name += "@NTPOFF"; break; - case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break; - case X86II::MO_GOT: Name += "@GOT"; break; - case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; - case X86II::MO_PLT: Name += "@PLT"; break; - } - - // Create a symbol for the name. - return Ctx.GetOrCreateSymbol(Name.str()); -} - - -MCSymbol *X86MCInstLower:: -GetConstantPoolIndexSymbol(const MachineOperand &MO) const { - SmallString<256> Name; - // FIXME: USe AsmPrinter.GetCPISymbol. @TLSGD shouldn't be part of the symbol - // name! - raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "CPI" - << AsmPrinter.getFunctionNumber() << '_' << MO.getIndex(); - - switch (MO.getTargetFlags()) { - default: - llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // No flag. - case X86II::MO_PIC_BASE_OFFSET: - case X86II::MO_DARWIN_NONLAZY_PIC_BASE: - case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: - break; - // FIXME: These probably should be a modifier on the symbol or something?? - case X86II::MO_TLSGD: Name += "@TLSGD"; break; - case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break; - case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break; - case X86II::MO_TPOFF: Name += "@TPOFF"; break; - case X86II::MO_NTPOFF: Name += "@NTPOFF"; break; - case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break; - case X86II::MO_GOT: Name += "@GOT"; break; - case X86II::MO_GOTOFF: Name += "@GOTOFF"; break; - case X86II::MO_PLT: Name += "@PLT"; break; } - // Create a symbol for the name. return Ctx.GetOrCreateSymbol(Name.str()); } -MCSymbol *X86MCInstLower:: -GetBlockAddressSymbol(const MachineOperand &MO) const { - const char *Suffix = ""; - switch (MO.getTargetFlags()) { - default: llvm_unreachable("Unknown target flag on BA operand"); - case X86II::MO_NO_FLAG: break; // No flag. - case X86II::MO_PIC_BASE_OFFSET: break; // Doesn't modify symbol name. - case X86II::MO_GOTOFF: Suffix = "@GOTOFF"; break; - } - - return AsmPrinter.GetBlockAddressSymbol(MO.getBlockAddress(), Suffix); -} - MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const { // FIXME: We would like an efficient form for this, so we don't have to do a // lot of extra uniquing. - const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, Ctx); + const MCExpr *Expr = 0; + X86MCTargetExpr::VariantKind RefKind = X86MCTargetExpr::Invalid; switch (MO.getTargetFlags()) { default: llvm_unreachable("Unknown target flag on GV operand"); case X86II::MO_NO_FLAG: // No flag. - // These affect the name of the symbol, not any suffix. case X86II::MO_DARWIN_NONLAZY: case X86II::MO_DLLIMPORT: case X86II::MO_DARWIN_STUB: - case X86II::MO_TLSGD: - case X86II::MO_GOTTPOFF: - case X86II::MO_INDNTPOFF: - case X86II::MO_TPOFF: - case X86II::MO_NTPOFF: - case X86II::MO_GOTPCREL: - case X86II::MO_GOT: - case X86II::MO_GOTOFF: - case X86II::MO_PLT: break; + + case X86II::MO_TLSGD: RefKind = X86MCTargetExpr::TLSGD; break; + case X86II::MO_GOTTPOFF: RefKind = X86MCTargetExpr::GOTTPOFF; break; + case X86II::MO_INDNTPOFF: RefKind = X86MCTargetExpr::INDNTPOFF; break; + case X86II::MO_TPOFF: RefKind = X86MCTargetExpr::TPOFF; break; + case X86II::MO_NTPOFF: RefKind = X86MCTargetExpr::NTPOFF; break; + case X86II::MO_GOTPCREL: RefKind = X86MCTargetExpr::GOTPCREL; break; + case X86II::MO_GOT: RefKind = X86MCTargetExpr::GOT; break; + case X86II::MO_GOTOFF: RefKind = X86MCTargetExpr::GOTOFF; break; + case X86II::MO_PLT: RefKind = X86MCTargetExpr::PLT; break; case X86II::MO_PIC_BASE_OFFSET: case X86II::MO_DARWIN_NONLAZY_PIC_BASE: case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: + Expr = MCSymbolRefExpr::Create(Sym, Ctx); // Subtract the pic base. Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(GetPICBaseSymbol(), Ctx), @@ -277,6 +198,13 @@ break; } + if (Expr == 0) { + if (RefKind == X86MCTargetExpr::Invalid) + Expr = MCSymbolRefExpr::Create(Sym, Ctx); + else + Expr = X86MCTargetExpr::Create(Sym, RefKind, Ctx); + } + if (!MO.isJTI() && MO.getOffset()) Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(), Ctx), @@ -348,13 +276,14 @@ MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO)); break; case MachineOperand::MO_JumpTableIndex: - MCOp = LowerSymbolOperand(MO, GetJumpTableSymbol(MO)); + MCOp = LowerSymbolOperand(MO, AsmPrinter.GetJTISymbol(MO.getIndex())); break; case MachineOperand::MO_ConstantPoolIndex: - MCOp = LowerSymbolOperand(MO, GetConstantPoolIndexSymbol(MO)); + MCOp = LowerSymbolOperand(MO, AsmPrinter.GetCPISymbol(MO.getIndex())); break; case MachineOperand::MO_BlockAddress: - MCOp = LowerSymbolOperand(MO, GetBlockAddressSymbol(MO)); + MCOp = LowerSymbolOperand(MO, + AsmPrinter.GetBlockAddressSymbol(MO.getBlockAddress())); break; } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h?rev=95595&r1=95594&r2=95595&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h Mon Feb 8 16:52:47 2010 @@ -41,9 +41,6 @@ MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; - MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const; - MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const; - MCSymbol *GetBlockAddressSymbol(const MachineOperand &MO) const; MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const; private: Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp?rev=95595&r1=95594&r2=95595&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp Mon Feb 8 16:52:47 2010 @@ -23,11 +23,16 @@ OS << *Sym; switch (Kind) { - case Invalid: OS << "@"; break; - case GOT: OS << "@GOT"; break; - case PLT: OS << "@PLT"; break; - case GOTPCREL: OS << "@GOTPCREL"; break; - case GOTOFF: OS << "@GOTOFF"; break; + case Invalid: OS << "@"; break; + case GOT: OS << "@GOT"; break; + case GOTOFF: OS << "@GOTOFF"; break; + case GOTPCREL: OS << "@GOTPCREL"; break; + case GOTTPOFF: OS << "@GOTTPOFF"; break; + case INDNTPOFF: OS << "@INDNTPOFF"; break; + case NTPOFF: OS << "@NTPOFF"; break; + case PLT: OS << "@PLT"; break; + case TLSGD: OS << "@TLSGD"; break; + case TPOFF: OS << "@TPOFF"; break; } } Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.h?rev=95595&r1=95594&r2=95595&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCTargetExpr.h (original) +++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Mon Feb 8 16:52:47 2010 @@ -20,9 +20,14 @@ enum VariantKind { Invalid, GOT, - PLT, + GOTOFF, GOTPCREL, - GOTOFF + GOTTPOFF, + INDNTPOFF, + NTPOFF, + PLT, + TLSGD, + TPOFF }; private: /// Sym - The symbol being referenced. From sabre at nondot.org Mon Feb 8 17:03:41 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 23:03:41 -0000 Subject: [llvm-commits] [llvm] r95599 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86MCInstLower.cpp X86MCInstLower.h Message-ID: <201002082303.o18N3gWm013516@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 17:03:41 2010 New Revision: 95599 URL: http://llvm.org/viewvc/llvm-project?rev=95599&view=rev Log: unify the paths for external symbols and global variables: 2 files changed, 48 insertions(+), 83 deletions(-) Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95599&r1=95598&r2=95599&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Feb 8 17:03:41 2010 @@ -46,42 +46,40 @@ getPICBaseSymbol(AsmPrinter.MF, Ctx); } -/// LowerGlobalAddressOperand - Lower an MO_GlobalAddress operand to an -/// MCOperand. +/// GetSymbolFromOperand - Lower an MO_GlobalAddress or MO_ExternalSymbol +/// operand to an MCSymbol. MCSymbol *X86MCInstLower:: -GetGlobalAddressSymbol(const MachineOperand &MO) const { - const GlobalValue *GV = MO.getGlobal(); - - bool isImplicitlyPrivate = false; - if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB || - MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY || - MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE || - MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE) - isImplicitlyPrivate = true; - +GetSymbolFromOperand(const MachineOperand &MO) const { + assert((MO.isGlobal() || MO.isSymbol()) && "Isn't a symbol reference"); + SmallString<128> Name; - Mang->getNameWithPrefix(Name, GV, isImplicitlyPrivate); - if (getSubtarget().isTargetCygMing()) { - X86COFFMachineModuleInfo &COFFMMI = - AsmPrinter.MMI->getObjFileInfo(); - COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData()); + if (MO.isGlobal()) { + bool isImplicitlyPrivate = false; + if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB || + MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY || + MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE || + MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE) + isImplicitlyPrivate = true; + + const GlobalValue *GV = MO.getGlobal(); + Mang->getNameWithPrefix(Name, GV, isImplicitlyPrivate); + + if (getSubtarget().isTargetCygMing()) { + X86COFFMachineModuleInfo &COFFMMI = + AsmPrinter.MMI->getObjFileInfo(); + COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData()); + } + } else { + assert(MO.isSymbol()); + Name += AsmPrinter.MAI->getGlobalPrefix(); + Name += MO.getSymbolName(); } - + + // If the target flags on the operand changes the name of the symbol, do that + // before we return the symbol. switch (MO.getTargetFlags()) { - default: llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // These don't modify the symbol name. - case X86II::MO_PIC_BASE_OFFSET: - case X86II::MO_TLSGD: - case X86II::MO_GOTTPOFF: - case X86II::MO_INDNTPOFF: - case X86II::MO_TPOFF: - case X86II::MO_NTPOFF: - case X86II::MO_GOTPCREL: - case X86II::MO_GOT: - case X86II::MO_GOTOFF: - case X86II::MO_PLT: - break; + default: break; case X86II::MO_DLLIMPORT: { // Handle dllimport linkage. const char *Prefix = "__imp_"; @@ -94,71 +92,39 @@ MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); MCSymbol *&StubSym = getMachOMMI().getGVStubEntry(Sym); - if (StubSym == 0) - StubSym = AsmPrinter.GetGlobalValueSymbol(GV); + if (StubSym == 0) { + assert(MO.isGlobal() && "Extern symbol not handled yet"); + StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()); + } return Sym; } case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: { Name += "$non_lazy_ptr"; MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); MCSymbol *&StubSym = getMachOMMI().getHiddenGVStubEntry(Sym); - if (StubSym == 0) - StubSym = AsmPrinter.GetGlobalValueSymbol(GV); + if (StubSym == 0) { + assert(MO.isGlobal() && "Extern symbol not handled yet"); + StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()); + } return Sym; } case X86II::MO_DARWIN_STUB: { Name += "$stub"; MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); MCSymbol *&StubSym = getMachOMMI().getFnStubEntry(Sym); - if (StubSym == 0) - StubSym = AsmPrinter.GetGlobalValueSymbol(GV); - return Sym; - } - } - - return Ctx.GetOrCreateSymbol(Name.str()); -} - -MCSymbol *X86MCInstLower:: -GetExternalSymbolSymbol(const MachineOperand &MO) const { - SmallString<128> Name; - Name += AsmPrinter.MAI->getGlobalPrefix(); - Name += MO.getSymbolName(); - - switch (MO.getTargetFlags()) { - default: llvm_unreachable("Unknown target flag on GV operand"); - case X86II::MO_NO_FLAG: // These don't modify the symbol name. - case X86II::MO_GOT_ABSOLUTE_ADDRESS: // Doesn't modify symbol name. - case X86II::MO_PIC_BASE_OFFSET: - case X86II::MO_TLSGD: - case X86II::MO_GOTTPOFF: - case X86II::MO_INDNTPOFF: - case X86II::MO_TPOFF: - case X86II::MO_NTPOFF: - case X86II::MO_GOTPCREL: - case X86II::MO_GOT: - case X86II::MO_GOTOFF: - case X86II::MO_PLT: - break; - case X86II::MO_DLLIMPORT: { - // Handle dllimport linkage. - const char *Prefix = "__imp_"; - Name.insert(Name.begin(), Prefix, Prefix+strlen(Prefix)); - break; - } - case X86II::MO_DARWIN_STUB: { - Name += "$stub"; - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); - MCSymbol *&StubSym = getMachOMMI().getFnStubEntry(Sym); - - if (StubSym == 0) { + if (StubSym) + return Sym; + + if (MO.isGlobal()) { + StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()); + } else { Name.erase(Name.end()-5, Name.end()); StubSym = Ctx.GetOrCreateSymbol(Name.str()); } return Sym; } } - + return Ctx.GetOrCreateSymbol(Name.str()); } @@ -270,10 +236,10 @@ MO.getMBB()->getSymbol(Ctx), Ctx)); break; case MachineOperand::MO_GlobalAddress: - MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO)); + MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO)); break; case MachineOperand::MO_ExternalSymbol: - MCOp = LowerSymbolOperand(MO, GetExternalSymbolSymbol(MO)); + MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO)); break; case MachineOperand::MO_JumpTableIndex: MCOp = LowerSymbolOperand(MO, AsmPrinter.GetJTISymbol(MO.getIndex())); @@ -432,7 +398,7 @@ OutStreamer.EmitLabel(DotSym); // Now that we have emitted the label, lower the complex operand expression. - MCSymbol *OpSym = MCInstLowering.GetExternalSymbolSymbol(MI->getOperand(2)); + MCSymbol *OpSym = MCInstLowering.GetSymbolFromOperand(MI->getOperand(2)); const MCExpr *DotExpr = MCSymbolRefExpr::Create(DotSym, OutContext); const MCExpr *PICBase = Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h?rev=95599&r1=95598&r2=95599&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h Mon Feb 8 17:03:41 2010 @@ -39,8 +39,7 @@ MCSymbol *GetPICBaseSymbol() const; - MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; - MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; + MCSymbol *GetSymbolFromOperand(const MachineOperand &MO) const; MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const; private: From sabre at nondot.org Mon Feb 8 17:10:08 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 23:10:08 -0000 Subject: [llvm-commits] [llvm] r95601 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <201002082310.o18NA8LA013858@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 17:10:08 2010 New Revision: 95601 URL: http://llvm.org/viewvc/llvm-project?rev=95601&view=rev Log: now that @GOTOFF is no longer represented as a suffix on a MCSymbol, we can remove the 'suffix' argument of GetBlockAddressSymbol. Do so. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=95601&r1=95600&r2=95601&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Feb 8 17:10:08 2010 @@ -343,11 +343,9 @@ /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress /// uses of the specified basic block. - MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA, - const char *Suffix = "") const; + MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const; MCSymbol *GetBlockAddressSymbol(const Function *F, - const BasicBlock *BB, - const char *Suffix = "") const; + const BasicBlock *BB) const; /// EmitBasicBlockStart - This method prints the label for the specified /// MachineBasicBlock, an alignment (if present) and a comment describing Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95601&r1=95600&r2=95601&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Feb 8 17:10:08 2010 @@ -1483,14 +1483,12 @@ return true; } -MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA, - const char *Suffix) const { - return GetBlockAddressSymbol(BA->getFunction(), BA->getBasicBlock(), Suffix); +MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const { + return GetBlockAddressSymbol(BA->getFunction(), BA->getBasicBlock()); } MCSymbol *AsmPrinter::GetBlockAddressSymbol(const Function *F, - const BasicBlock *BB, - const char *Suffix) const { + const BasicBlock *BB) const { assert(BB->hasName() && "Address of anonymous basic block not supported yet!"); @@ -1504,7 +1502,7 @@ SmallString<60> NameResult; Mang->getNameWithPrefix(NameResult, StringRef("BA") + Twine((unsigned)FnName.size()) + - "_" + FnName.str() + "_" + BB->getName() + Suffix, + "_" + FnName.str() + "_" + BB->getName(), Mangler::Private); return OutContext.GetOrCreateSymbol(NameResult.str()); From echristo at apple.com Mon Feb 8 17:14:50 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 8 Feb 2010 15:14:50 -0800 Subject: [llvm-commits] [patch] ExceptionDemo patch for review In-Reply-To: References: <293820A4-96A4-4FF6-8333-A66FAAB0743E@gmail.com> <00C79483-D11D-4F19-88B8-D28E859CCDF2@apple.com> <0ADCDC2B-5C3D-43CE-839C-17195BAA7E05@gmail.com> Message-ID: On Feb 8, 2010, at 3:04 AM, Garrison Venn wrote: > Should I check in? Sure. Thanks! -eric From grosbach at apple.com Mon Feb 8 17:22:01 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 08 Feb 2010 23:22:01 -0000 Subject: [llvm-commits] [llvm] r95603 - in /llvm/trunk/lib/Target/ARM: ARMBaseInstrInfo.cpp ARMISelLowering.cpp ARMISelLowering.h ARMInstrInfo.td ARMInstrThumb.td ARMInstrThumb2.td Message-ID: <201002082322.o18NM1YK014352@zion.cs.uiuc.edu> Author: grosbach Date: Mon Feb 8 17:22:00 2010 New Revision: 95603 URL: http://llvm.org/viewvc/llvm-project?rev=95603&view=rev Log: tighten up eh.setjmp sequence a bit. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Mon Feb 8 17:22:00 2010 @@ -470,9 +470,9 @@ case ARM::Int_eh_sjlj_setjmp: return 24; case ARM::tInt_eh_sjlj_setjmp: - return 20; + return 14; case ARM::t2Int_eh_sjlj_setjmp: - return 22; + return 14; case ARM::BR_JTr: case ARM::BR_JTm: case ARM::BR_JTadd: Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Feb 8 17:22:00 2010 @@ -1440,7 +1440,8 @@ } SDValue -ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) { +ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG, + const ARMSubtarget *Subtarget) { unsigned IntNo = cast(Op.getOperand(0))->getZExtValue(); DebugLoc dl = Op.getDebugLoc(); switch (IntNo) { @@ -1476,7 +1477,11 @@ return Result; } case Intrinsic::eh_sjlj_setjmp: - return DAG.getNode(ARMISD::EH_SJLJ_SETJMP, dl, MVT::i32, Op.getOperand(1)); + SDValue Val = Subtarget->isThumb() ? + DAG.getCopyFromReg(DAG.getEntryNode(), dl, ARM::SP, MVT::i32) : + DAG.getConstant(0, MVT::i32); + return DAG.getNode(ARMISD::EH_SJLJ_SETJMP, dl, MVT::i32, Op.getOperand(1), + Val); } } @@ -3025,7 +3030,8 @@ case ISD::RETURNADDR: break; case ISD::FRAMEADDR: return LowerFRAMEADDR(Op, DAG); case ISD::GLOBAL_OFFSET_TABLE: return LowerGLOBAL_OFFSET_TABLE(Op, DAG); - case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG); + case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG, + Subtarget); case ISD::BIT_CONVERT: return ExpandBIT_CONVERT(Op.getNode(), DAG); case ISD::SHL: case ISD::SRL: Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Mon Feb 8 17:22:00 2010 @@ -278,7 +278,8 @@ const CCValAssign &VA, ISD::ArgFlagsTy Flags); SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG); - SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG); + SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG, + const ARMSubtarget *Subtarget); SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG); SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG); SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Feb 8 17:22:00 2010 @@ -44,7 +44,8 @@ SDTCisPtrTy<1>, SDTCisVT<2, i32>]>; def SDT_ARMThreadPointer : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; -def SDT_ARMEH_SJLJ_Setjmp : SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisPtrTy<1>]>; +def SDT_ARMEH_SJLJ_Setjmp : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisPtrTy<1>, + SDTCisInt<2>]>; def SDT_ARMMEMBARRIERV7 : SDTypeProfile<0, 0, []>; def SDT_ARMSYNCBARRIERV7 : SDTypeProfile<0, 0, []>; @@ -1800,21 +1801,22 @@ // except for our own input by listing the relevant registers in Defs. By // doing so, we also cause the prologue/epilogue code to actively preserve // all of the callee-saved resgisters, which is exactly what we want. -let Defs = +// A constant value is passed in $val, and we use the location as a scratch. +let Defs = [ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30, D31 ] in { - def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src), + def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src, GPR:$val), AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, NoItinerary, "str\tsp, [$src, #+8] @ eh_setjmp begin\n\t" - "add\tr12, pc, #8\n\t" - "str\tr12, [$src, #+4]\n\t" + "add\t$val, pc, #8\n\t" + "str\t$val, [$src, #+4]\n\t" "mov\tr0, #0\n\t" "add\tpc, pc, #0\n\t" "mov\tr0, #1 @ eh_setjmp end", "", - [(set R0, (ARMeh_sjlj_setjmp GPR:$src))]>; + [(set R0, (ARMeh_sjlj_setjmp GPR:$src, GPR:$val))]>; } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Feb 8 17:22:00 2010 @@ -813,22 +813,20 @@ // except for our own input by listing the relevant registers in Defs. By // doing so, we also cause the prologue/epilogue code to actively preserve // all of the callee-saved resgisters, which is exactly what we want. +// The current SP is passed in $val, and we reuse the reg as a scratch. let Defs = [ R0, R1, R2, R3, R4, R5, R6, R7, R12 ] in { - def tInt_eh_sjlj_setjmp : ThumbXI<(outs), (ins GPR:$src), + def tInt_eh_sjlj_setjmp : ThumbXI<(outs),(ins tGPR:$src, tGPR:$val), AddrModeNone, SizeSpecial, NoItinerary, - "mov\tr12, r1\t@ begin eh.setjmp\n" - "\tmov\tr1, sp\n" - "\tstr\tr1, [$src, #8]\n" - "\tmov\tr1, pc\n" - "\tadds\tr1, #9\n" - "\tstr\tr1, [$src, #4]\n" - "\tmov\tr1, r12\n" + "str\t$val, [$src, #8]\t@ begin eh.setjmp\n" + "\tmov\t$val, pc\n" + "\tadds\t$val, #9\n" + "\tstr\t$val, [$src, #4]\n" "\tmovs\tr0, #0\n" "\tb\t1f\n" "\tmovs\tr0, #1\t@ end eh.setjmp\n" "1:", "", - [(set R0, (ARMeh_sjlj_setjmp GPR:$src))]>; + [(set R0, (ARMeh_sjlj_setjmp tGPR:$src, tGPR:$val))]>; } //===----------------------------------------------------------------------===// // Non-Instruction Patterns Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=95603&r1=95602&r2=95603&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Feb 8 17:22:00 2010 @@ -1817,22 +1817,23 @@ // except for our own input by listing the relevant registers in Defs. By // doing so, we also cause the prologue/epilogue code to actively preserve // all of the callee-saved resgisters, which is exactly what we want. -let Defs = +// The current SP is passed in $val, and we reuse the reg as a scratch. +let Defs = [ R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, LR, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30, D31 ] in { - def t2Int_eh_sjlj_setjmp : Thumb2XI<(outs), (ins GPR:$src), + def t2Int_eh_sjlj_setjmp : Thumb2XI<(outs), (ins GPR:$src, tGPR:$val), AddrModeNone, SizeSpecial, NoItinerary, - "str.w\tsp, [$src, #+8] @ eh_setjmp begin\n" - "\tadr\tr12, 0f\n" - "\torr.w\tr12, r12, #1\n" - "\tstr.w\tr12, [$src, #+4]\n" + "str\t$val, [$src, #8]\t@ begin eh.setjmp\n" + "\tmov\t$val, pc\n" + "\tadds\t$val, #9\n" + "\tstr\t$val, [$src, #4]\n" "\tmovs\tr0, #0\n" "\tb\t1f\n" - "0:\tmovs\tr0, #1 @ eh_setjmp end\n" + "\tmovs\tr0, #1\t@ end eh.setjmp\n" "1:", "", - [(set R0, (ARMeh_sjlj_setjmp GPR:$src))]>; + [(set R0, (ARMeh_sjlj_setjmp GPR:$src, tGPR:$val))]>; } From dpatel at apple.com Mon Feb 8 17:26:53 2010 From: dpatel at apple.com (Devang Patel) Date: Mon, 08 Feb 2010 23:26:53 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95604 - /llvm-gcc-4.2/trunk/gcc/varasm.c Message-ID: <201002082326.o18NQr8H014515@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 8 17:26:53 2010 New Revision: 95604 URL: http://llvm.org/viewvc/llvm-project?rev=95604&view=rev Log: Emit debug info for unused name space global variable. This will be easily optimized by the optimizer in -O1+ mode. This is done by forcing DECL_LLVM() check earlier, which in turn creates llvm symbol for the decl. Modified: llvm-gcc-4.2/trunk/gcc/varasm.c Modified: llvm-gcc-4.2/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/varasm.c?rev=95604&r1=95603&r2=95604&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.2/trunk/gcc/varasm.c Mon Feb 8 17:26:53 2010 @@ -1361,7 +1361,15 @@ { const char **type = &first_global_object_name; - if (first_global_object_name + /* LLVM LOCAL begin */ + if ( +#ifndef ENABLE_LLVM + !MEM_P (DECL_RTL (decl)) +#else + (DECL_LLVM (decl), 0) +#endif + || first_global_object_name + /* LLVM LOCAL end */ || !TREE_PUBLIC (decl) || DECL_EXTERNAL (decl) || !DECL_NAME (decl) @@ -1369,15 +1377,7 @@ && (TREE_CODE (decl) != VAR_DECL || (DECL_COMMON (decl) && (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node)))) - /* LLVM LOCAL begin */ -#ifndef ENABLE_LLVM - || !MEM_P (DECL_RTL (decl)) -#else - || (DECL_LLVM (decl), 0) -#endif - ) - /* LLVM LOCAL end */ + || DECL_INITIAL (decl) == error_mark_node))))) return; /* We win when global object is found, but it is useful to know about weak From dpatel at apple.com Mon Feb 8 17:27:46 2010 From: dpatel at apple.com (Devang Patel) Date: Mon, 08 Feb 2010 23:27:46 -0000 Subject: [llvm-commits] [llvm] r95605 - in /llvm/trunk/test: FrontendC++/2010-02-08-NamespaceVar.cpp FrontendC/2003-12-14-ExternInlineSupport.c Message-ID: <201002082327.o18NRkGa014553@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 8 17:27:46 2010 New Revision: 95605 URL: http://llvm.org/viewvc/llvm-project?rev=95605&view=rev Log: test case for r95604. Added: llvm/trunk/test/FrontendC++/2010-02-08-NamespaceVar.cpp Modified: llvm/trunk/test/FrontendC/2003-12-14-ExternInlineSupport.c Added: llvm/trunk/test/FrontendC++/2010-02-08-NamespaceVar.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2010-02-08-NamespaceVar.cpp?rev=95605&view=auto ============================================================================== --- llvm/trunk/test/FrontendC++/2010-02-08-NamespaceVar.cpp (added) +++ llvm/trunk/test/FrontendC++/2010-02-08-NamespaceVar.cpp Mon Feb 8 17:27:46 2010 @@ -0,0 +1,16 @@ +// RUN: %llvmgxx -S %s -o - | grep cX + +namespace C { + int c = 1; + namespace { + int cX = 6; + void marker2() { + cX; + } + } +} + +int main() { + C::marker2(); + return 0; +} Modified: llvm/trunk/test/FrontendC/2003-12-14-ExternInlineSupport.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2003-12-14-ExternInlineSupport.c?rev=95605&r1=95604&r2=95605&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2003-12-14-ExternInlineSupport.c (original) +++ llvm/trunk/test/FrontendC/2003-12-14-ExternInlineSupport.c Mon Feb 8 17:27:46 2010 @@ -1,3 +1,3 @@ -// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep dead_function +// RUN: %llvmgcc -Os -xc %s -c -o - | llvm-dis | not grep dead_function extern __inline__ void dead_function() {} From scallanan at apple.com Mon Feb 8 17:34:25 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 08 Feb 2010 23:34:25 -0000 Subject: [llvm-commits] [llvm] r95606 - in /llvm/trunk: include/llvm-c/EnhancedDisassembly.h tools/edis/EDMain.cpp tools/edis/EnhancedDisassembly.exports Message-ID: <201002082334.o18NYQN6014849@zion.cs.uiuc.edu> Author: spyffe Date: Mon Feb 8 17:34:25 2010 New Revision: 95606 URL: http://llvm.org/viewvc/llvm-project?rev=95606&view=rev Log: Added header file declarations and .exports entries for the new APIs offered by the enhanced disassembler for inspecting operands. Modified: llvm/trunk/include/llvm-c/EnhancedDisassembly.h llvm/trunk/tools/edis/EDMain.cpp llvm/trunk/tools/edis/EnhancedDisassembly.exports Modified: llvm/trunk/include/llvm-c/EnhancedDisassembly.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/EnhancedDisassembly.h?rev=95606&r1=95605&r2=95606&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/EnhancedDisassembly.h (original) +++ llvm/trunk/include/llvm-c/EnhancedDisassembly.h Mon Feb 8 17:34:25 2010 @@ -368,10 +368,55 @@ int EDGetOperand(EDOperandRef *operand, EDInstRef inst, int index); + +/*! + @function EDOperandIsRegister + @param operand The operand to be queried. + @result 1 if the operand names a register; 0 if not; -1 on error. + */ +int EDOperandIsRegister(EDOperandRef operand); + +/*! + @function EDOperandIsImmediate + @param operand The operand to be queried. + @result 1 if the operand specifies an immediate value; 0 if not; -1 on error. + */ +int EDOperandIsImmediate(EDOperandRef operand); + +/*! + @function EDOperandIsMemory + @param operand The operand to be queried. + @result 1 if the operand specifies a location in memory; 0 if not; -1 on error. + */ +int EDOperandIsMemory(EDOperandRef operand); + +/*! + @function EDRegisterOperandValue + @param value A pointer whose target will be filled in with the LLVM register ID + of the register named by the operand. + @param operand The operand to be queried. + @result 0 on success; -1 otherwise. + */ +int EDRegisterOperandValue(unsigned *value, + EDOperandRef operand); + +/*! + @function EDImmediateOperandValue + @param value A pointer whose target will be filled in with the value of the + immediate. + @param operand The operand to be queried. + @result 0 on success; -1 otherwise. + */ +int EDImmediateOperandValue(uint64_t *value, + EDOperandRef operand); /*! @function EDEvaluateOperand - Evaluates an operand using a client-supplied register state accessor. + Evaluates an operand using a client-supplied register state accessor. Register + operands are evaluated by reading the value of the register; immediate operands + are evaluated by reporting the immediate value; memory operands are evaluated + by computing the target address (with only those relocations applied that were + already applied to the original bytes). @param result A pointer whose target is to be filled with the result of evaluating the operand. @param operand The operand to be evaluated. Modified: llvm/trunk/tools/edis/EDMain.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EDMain.cpp?rev=95606&r1=95605&r2=95606&view=diff ============================================================================== --- llvm/trunk/tools/edis/EDMain.cpp (original) +++ llvm/trunk/tools/edis/EDMain.cpp Mon Feb 8 17:34:25 2010 @@ -221,7 +221,7 @@ return 0; } -int EDImmedateOperandValue(uint64_t *value, +int EDImmediateOperandValue(uint64_t *value, EDOperandRef operand) { if(!operand->isImmediate()) return -1; Modified: llvm/trunk/tools/edis/EnhancedDisassembly.exports URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EnhancedDisassembly.exports?rev=95606&r1=95605&r2=95606&view=diff ============================================================================== --- llvm/trunk/tools/edis/EnhancedDisassembly.exports (original) +++ llvm/trunk/tools/edis/EnhancedDisassembly.exports Mon Feb 8 17:34:25 2010 @@ -25,6 +25,11 @@ _EDRegisterTokenValue _EDNumOperands _EDGetOperand +_EDOperandIsRegister +_EDOperandIsImmediate +_EDOperandIsMemory +_EDRegisterOperandValue +_EDImmediateOperandValue _EDEvaluateOperand _EDBlockCreateInsts _EDBlockEvaluateOperand From sabre at nondot.org Mon Feb 8 17:47:34 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 23:47:34 -0000 Subject: [llvm-commits] [llvm] r95608 - /llvm/trunk/test/CodeGen/ARM/iabs.ll Message-ID: <201002082347.o18NlYYl015404@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 17:47:34 2010 New Revision: 95608 URL: http://llvm.org/viewvc/llvm-project?rev=95608&view=rev Log: convert to filecheck. Modified: llvm/trunk/test/CodeGen/ARM/iabs.ll Modified: llvm/trunk/test/CodeGen/ARM/iabs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/iabs.ll?rev=95608&r1=95607&r2=95608&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/iabs.ll (original) +++ llvm/trunk/test/CodeGen/ARM/iabs.ll Mon Feb 8 17:47:34 2010 @@ -1,5 +1,4 @@ -; RUN: llc < %s -march=arm -stats |& \ -; RUN: grep {3 .*Number of machine instrs printed} +; RUN: llc < %s -march=arm | FileCheck %s ;; Integer absolute value, should produce something as good as: ARM: ;; add r3, r0, r0, asr #31 @@ -11,5 +10,7 @@ %b = icmp sgt i32 %a, -1 %abs = select i1 %b, i32 %a, i32 %tmp1neg ret i32 %abs +; CHECK: add r1, r0, r0, asr #31 +; CHECK: eor r0, r1, r0, asr #31 +; CHECK: bx lr } - From sabre at nondot.org Mon Feb 8 17:48:10 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 23:48:10 -0000 Subject: [llvm-commits] [llvm] r95609 - /llvm/trunk/lib/Target/ARM/README.txt Message-ID: <201002082348.o18NmAEr015439@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 17:48:10 2010 New Revision: 95609 URL: http://llvm.org/viewvc/llvm-project?rev=95609&view=rev Log: this is done, tested by CodeGen/ARM/iabs.ll Modified: llvm/trunk/lib/Target/ARM/README.txt Modified: llvm/trunk/lib/Target/ARM/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README.txt?rev=95609&r1=95608&r2=95609&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/README.txt (original) +++ llvm/trunk/lib/Target/ARM/README.txt Mon Feb 8 17:48:10 2010 @@ -71,26 +71,6 @@ //===---------------------------------------------------------------------===// -We currently compile abs: -int foo(int p) { return p < 0 ? -p : p; } - -into: - -_foo: - rsb r1, r0, #0 - cmn r0, #1 - movgt r1, r0 - mov r0, r1 - bx lr - -This is very, uh, literal. This could be a 3 operation sequence: - t = (p sra 31); - res = (p xor t)-t - -Which would be better. This occurs in png decode. - -//===---------------------------------------------------------------------===// - More load / store optimizations: 1) Better representation for block transfer? This is from Olden/power: From sabre at nondot.org Mon Feb 8 17:56:03 2010 From: sabre at nondot.org (Chris Lattner) Date: Mon, 08 Feb 2010 23:56:03 -0000 Subject: [llvm-commits] [llvm] r95616 - in /llvm/trunk/lib/Transforms/InstCombine: InstCombineSimplifyDemanded.cpp InstCombineVectorOps.cpp Message-ID: <201002082356.o18Nu33x015875@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 17:56:03 2010 New Revision: 95616 URL: http://llvm.org/viewvc/llvm-project?rev=95616&view=rev Log: fix some problems handling large vectors reported in PR6230 Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=95616&r1=95615&r2=95616&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Mon Feb 8 17:56:03 2010 @@ -767,7 +767,7 @@ /// operation, the operation is simplified, then the resultant value is /// returned. This returns null if no change was made. Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, - APInt& UndefElts, + APInt &UndefElts, unsigned Depth) { unsigned VWidth = cast(V->getType())->getNumElements(); APInt EltMask(APInt::getAllOnesValue(VWidth)); @@ -777,13 +777,15 @@ // If the entire vector is undefined, just return this info. UndefElts = EltMask; return 0; - } else if (DemandedElts == 0) { // If nothing is demanded, provide undef. + } + + if (DemandedElts == 0) { // If nothing is demanded, provide undef. UndefElts = EltMask; return UndefValue::get(V->getType()); } UndefElts = 0; - if (ConstantVector *CP = dyn_cast(V)) { + if (ConstantVector *CV = dyn_cast(V)) { const Type *EltTy = cast(V->getType())->getElementType(); Constant *Undef = UndefValue::get(EltTy); @@ -792,23 +794,25 @@ if (!DemandedElts[i]) { // If not demanded, set to undef. Elts.push_back(Undef); UndefElts.set(i); - } else if (isa(CP->getOperand(i))) { // Already undef. + } else if (isa(CV->getOperand(i))) { // Already undef. Elts.push_back(Undef); UndefElts.set(i); } else { // Otherwise, defined. - Elts.push_back(CP->getOperand(i)); + Elts.push_back(CV->getOperand(i)); } // If we changed the constant, return it. Constant *NewCP = ConstantVector::get(Elts); - return NewCP != CP ? NewCP : 0; - } else if (isa(V)) { + return NewCP != CV ? NewCP : 0; + } + + if (isa(V)) { // Simplify the CAZ to a ConstantVector where the non-demanded elements are // set to undef. // Check if this is identity. If so, return 0 since we are not simplifying // anything. - if (DemandedElts == ((1ULL << VWidth) -1)) + if (DemandedElts.isAllOnesValue()) return 0; const Type *EltTy = cast(V->getType())->getElementType(); Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=95616&r1=95615&r2=95616&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Mon Feb 8 17:56:03 2010 @@ -162,7 +162,8 @@ // property. if (EI.getOperand(0)->hasOneUse() && VectorWidth != 1) { APInt UndefElts(VectorWidth, 0); - APInt DemandedMask(VectorWidth, 1 << IndexVal); + APInt DemandedMask(VectorWidth, 0); + DemandedMask.set(IndexVal); if (Value *V = SimplifyDemandedVectorElts(EI.getOperand(0), DemandedMask, UndefElts)) { EI.setOperand(0, V); From gohman at apple.com Mon Feb 8 17:58:47 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 08 Feb 2010 23:58:47 -0000 Subject: [llvm-commits] [llvm] r95619 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp Message-ID: <201002082358.o18Nwloc016075@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 17:58:47 2010 New Revision: 95619 URL: http://llvm.org/viewvc/llvm-project?rev=95619&view=rev Log: Document that MCExpr::Mod is actually remainder. Document that MCExpr::Div, Mod, and the comparison operators are all signed operators. Document that the comparison operators' results are target-dependent. Document that the behavior of shr is target-dependent. Modified: llvm/trunk/include/llvm/MC/MCExpr.h llvm/trunk/lib/MC/MCExpr.cpp Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95619&r1=95618&r2=95619&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Feb 8 17:58:47 2010 @@ -202,20 +202,24 @@ enum Opcode { Add, ///< Addition. And, ///< Bitwise and. - Div, ///< Division. + Div, ///< Signed division. EQ, ///< Equality comparison. - GT, ///< Greater than comparison. - GTE, ///< Greater than or equal comparison. + GT, ///< Signed greater than comparison (result is either 0 or some + ///< target-specific non-zero value) + GTE, ///< Signed greater than or equal comparison (result is either 0 or + ///< some target-specific non-zero value). LAnd, ///< Logical and. LOr, ///< Logical or. - LT, ///< Less than comparison. - LTE, ///< Less than or equal comparison. - Mod, ///< Modulus. + LT, ///< Signed less than comparison (result is either 0 or + ///< some target-specific non-zero value). + LTE, ///< Signed less than or equal comparison (result is either 0 or + ///< some target-specific non-zero value). + Mod, ///< Signed remainder. Mul, ///< Multiplication. NE, ///< Inequality comparison. Or, ///< Bitwise or. - Shl, ///< Bitwise shift left. - Shr, ///< Bitwise shift right. + Shl, ///< Shift left. + Shr, ///< Shift right (arithmetic or logical, depending on target) Sub, ///< Subtraction. Xor ///< Bitwise exclusive or. }; Modified: llvm/trunk/lib/MC/MCExpr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=95619&r1=95618&r2=95619&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCExpr.cpp (original) +++ llvm/trunk/lib/MC/MCExpr.cpp Mon Feb 8 17:58:47 2010 @@ -252,8 +252,8 @@ } // FIXME: We need target hooks for the evaluation. It may be limited in - // width, and gas defines the result of comparisons differently from Apple - // as (the result is sign extended). + // width, and gas defines the result of comparisons and right shifts + // differently from Apple as. int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); int64_t Result = 0; switch (ABE->getOpcode()) { From gohman at apple.com Mon Feb 8 18:02:37 2010 From: gohman at apple.com (Dan Gohman) Date: Tue, 09 Feb 2010 00:02:37 -0000 Subject: [llvm-commits] [llvm] r95620 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <201002090002.o1902bYw016281@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 18:02:37 2010 New Revision: 95620 URL: http://llvm.org/viewvc/llvm-project?rev=95620&view=rev Log: Implement AsmPrinter support for several more operators which have direct MCExpr equivalents. Don't use MCExpr::Shr because it isn't consistent between targets. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95620&r1=95619&r2=95620&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Feb 8 18:02:37 2010 @@ -963,8 +963,14 @@ return MCBinaryExpr::CreateAnd(OpExpr, MaskExpr, Ctx); } + // The MC library also has a right-shift operator, but it isn't consistently + // signed or unsigned between different targets. case Instruction::Add: case Instruction::Sub: + case Instruction::Mul: + case Instruction::SDiv: + case Instruction::SRem: + case Instruction::Shl: case Instruction::And: case Instruction::Or: case Instruction::Xor: { @@ -974,6 +980,10 @@ default: llvm_unreachable("Unknown binary operator constant cast expr"); case Instruction::Add: return MCBinaryExpr::CreateAdd(LHS, RHS, Ctx); case Instruction::Sub: return MCBinaryExpr::CreateSub(LHS, RHS, Ctx); + case Instruction::Mul: return MCBinaryExpr::CreateMul(LHS, RHS, Ctx); + case Instruction::SDiv: return MCBinaryExpr::CreateDiv(LHS, RHS, Ctx); + case Instruction::SRem: return MCBinaryExpr::CreateMod(LHS, RHS, Ctx); + case Instruction::Shl: return MCBinaryExpr::CreateShl(LHS, RHS, Ctx); case Instruction::And: return MCBinaryExpr::CreateAnd(LHS, RHS, Ctx); case Instruction::Or: return MCBinaryExpr::CreateOr (LHS, RHS, Ctx); case Instruction::Xor: return MCBinaryExpr::CreateXor(LHS, RHS, Ctx); From sabre at nondot.org Mon Feb 8 18:05:46 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:05:46 -0000 Subject: [llvm-commits] [llvm] r95622 - /llvm/trunk/include/llvm/Support/CommandLine.h Message-ID: <201002090005.o1905k0k016423@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:05:45 2010 New Revision: 95622 URL: http://llvm.org/viewvc/llvm-project?rev=95622&view=rev Log: enhance bits_storage to work with enums by using a c-style cast instead of reinterpret_cast, fixing PR6243. Apparently reinterpret_cast and I aren't getting along today. Modified: llvm/trunk/include/llvm/Support/CommandLine.h Modified: llvm/trunk/include/llvm/Support/CommandLine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=95622&r1=95621&r2=95622&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h (original) +++ llvm/trunk/include/llvm/Support/CommandLine.h Mon Feb 8 18:05:45 2010 @@ -1168,7 +1168,7 @@ template static unsigned Bit(const T &V) { - unsigned BitPos = reinterpret_cast(V); + unsigned BitPos = (unsigned)V; assert(BitPos < sizeof(unsigned) * CHAR_BIT && "enum exceeds width of bit vector!"); return 1 << BitPos; From sabre at nondot.org Mon Feb 8 18:11:10 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:11:10 -0000 Subject: [llvm-commits] [llvm] r95624 - /llvm/trunk/lib/Target/README.txt Message-ID: <201002090011.o190BAvw016689@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:11:10 2010 New Revision: 95624 URL: http://llvm.org/viewvc/llvm-project?rev=95624&view=rev Log: move PR6212 to this file. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=95624&r1=95623&r2=95624&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Feb 8 18:11:10 2010 @@ -1794,3 +1794,28 @@ The shift should be eliminated. Testcase derived from gcc. //===---------------------------------------------------------------------===// + +These compile into different code, one gets recognized as a switch and the +other doesn't due to phase ordering issues (PR6212): + +int test1(int mainType, int subType) { + if (mainType == 7) + subType = 4; + else if (mainType == 9) + subType = 6; + else if (mainType == 11) + subType = 9; + return subType; +} + +int test2(int mainType, int subType) { + if (mainType == 7) + subType = 4; + if (mainType == 9) + subType = 6; + if (mainType == 11) + subType = 9; + return subType; +} + +//===---------------------------------------------------------------------===// From stoklund at 2pi.dk Mon Feb 8 18:13:29 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 09 Feb 2010 00:13:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95625 - in /llvm-gcc-4.2/trunk/gcc: ada/utils.c c-decl.c cp/decl.c cp/method.c cp/optimize.c cp/pt.c llvm-convert.cpp tree.h Message-ID: <201002090013.o190DTu4016838@zion.cs.uiuc.edu> Author: stoklund Date: Mon Feb 8 18:13:29 2010 New Revision: 95625 URL: http://llvm.org/viewvc/llvm-project?rev=95625&view=rev Log: Pass the inline keyword to the optimizer as an inlinehint attribute. We only want cases where the inline keyword is given explicitly. The existing DECL_DECLARED_INLINE_P flag is not sufficient for this because it is set for certain implicitly defined methods as well as C++ methods defined as part of the class definition. Modified: llvm-gcc-4.2/trunk/gcc/ada/utils.c llvm-gcc-4.2/trunk/gcc/c-decl.c llvm-gcc-4.2/trunk/gcc/cp/decl.c llvm-gcc-4.2/trunk/gcc/cp/method.c llvm-gcc-4.2/trunk/gcc/cp/optimize.c llvm-gcc-4.2/trunk/gcc/cp/pt.c llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/tree.h Modified: llvm-gcc-4.2/trunk/gcc/ada/utils.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/utils.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ada/utils.c (original) +++ llvm-gcc-4.2/trunk/gcc/ada/utils.c Mon Feb 8 18:13:29 2010 @@ -1772,6 +1772,10 @@ if (inline_flag) DECL_DECLARED_INLINE_P (subprog_decl) = 1; + /* LLVM LOCAL begin inlinehint attribute */ + if (inline_flag) + DECL_EXPLICIT_INLINE_P (subprog_decl) = 1; + /* LLVM LOCAL end inlinehint attribute */ if (asm_name) SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name); Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Mon Feb 8 18:13:29 2010 @@ -1919,6 +1919,11 @@ || DECL_DECLARED_INLINE_P (olddecl)) DECL_DECLARED_INLINE_P (newdecl) = 1; + /* LLVM LOCAL begin inlinehint attribute */ + if (DECL_EXPLICIT_INLINE_P (olddecl)) + DECL_EXPLICIT_INLINE_P (newdecl) = 1; + /* LLVM LOCAL end inlinehint attribute */ + DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl) = (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl)); } @@ -5492,6 +5497,9 @@ { /* Record that the function is declared `inline'. */ DECL_DECLARED_INLINE_P (decl) = 1; + /* LLVM LOCAL begin inlinehint attribute */ + DECL_EXPLICIT_INLINE_P (decl) = 1; + /* LLVM LOCAL end inlinehint attribute */ /* Do not mark bare declarations as DECL_INLINE. Doing so in the presence of multiple declarations can result in Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Mon Feb 8 18:13:29 2010 @@ -1904,6 +1904,10 @@ DECL_DECLARED_INLINE_P (newdecl) |= DECL_DECLARED_INLINE_P (olddecl); + /* LLVM LOCAL begin inlinehint attribute */ + DECL_EXPLICIT_INLINE_P (newdecl) |= DECL_EXPLICIT_INLINE_P (olddecl); + /* LLVM LOCAL end inlinehint attribute */ + /* If either decl says `inline', this fn is inline, unless its definition was passed already. */ if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == NULL_TREE) @@ -6813,6 +6817,11 @@ /* If the declaration was declared inline, mark it as such. */ if (inlinep) DECL_DECLARED_INLINE_P (decl) = 1; + /* LLVM LOCAL begin inlinehint attribute */ + if (inlinep) + DECL_EXPLICIT_INLINE_P (decl) = 1; + /* LLVM LOCAL end inlinehint attribute */ + /* We inline functions that are explicitly declared inline, or, when the user explicitly asks us to, all functions. */ if (DECL_DECLARED_INLINE_P (decl) Modified: llvm-gcc-4.2/trunk/gcc/cp/method.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/method.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/method.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/method.c Mon Feb 8 18:13:29 2010 @@ -159,6 +159,9 @@ DECL_PENDING_INLINE_P (thunk) = 0; DECL_INLINE (thunk) = 0; DECL_DECLARED_INLINE_P (thunk) = 0; + /* LLVM LOCAL begin inlinehint attribute */ + DECL_EXPLICIT_INLINE_P (thunk) = 0; + /* LLVM LOCAL end inlinehint attribute */ /* Nor has it been deferred. */ DECL_DEFERRED_FN (thunk) = 0; /* Nor is it a template instantiation. */ @@ -283,6 +286,9 @@ DECL_PENDING_INLINE_P (alias) = 0; DECL_INLINE (alias) = 0; DECL_DECLARED_INLINE_P (alias) = 0; + /* LLVM LOCAL begin inlinehint attribute */ + DECL_EXPLICIT_INLINE_P (alias) = 0; + /* LLVM LOCAL end inlinehint attribute */ DECL_DEFERRED_FN (alias) = 0; DECL_USE_TEMPLATE (alias) = 0; DECL_TEMPLATE_INSTANTIATED (alias) = 0; Modified: llvm-gcc-4.2/trunk/gcc/cp/optimize.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/optimize.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/optimize.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/optimize.c Mon Feb 8 18:13:29 2010 @@ -397,6 +397,9 @@ DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn); DECL_INLINE (clone) = DECL_INLINE (fn); DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn); + /* LLVM LOCAL begin inlinehint attribute */ + DECL_EXPLICIT_INLINE_P (clone) = DECL_EXPLICIT_INLINE_P (fn); + /* LLVM LOCAL end inlinehint attribute */ DECL_COMDAT (clone) = DECL_COMDAT (fn); DECL_WEAK (clone) = DECL_WEAK (fn); DECL_ONE_ONLY (clone) = DECL_ONE_ONLY (fn); Modified: llvm-gcc-4.2/trunk/gcc/cp/pt.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/pt.c?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original) +++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Mon Feb 8 18:13:29 2010 @@ -12047,6 +12047,10 @@ if (DECL_DECLARED_INLINE_P (code_pattern) && !DECL_DECLARED_INLINE_P (decl)) DECL_DECLARED_INLINE_P (decl) = 1; + /* LLVM LOCAL begin inlinehint attribute */ + if (DECL_EXPLICIT_INLINE_P (code_pattern)) + DECL_EXPLICIT_INLINE_P (decl) = 1; + /* LLVM LOCAL end inlinehint attribute */ if (DECL_INLINE (code_pattern) && !DECL_INLINE (decl)) DECL_INLINE (decl) = 1; } Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Feb 8 18:13:29 2010 @@ -578,6 +578,10 @@ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (FnDecl))) Fn->addFnAttr(Attribute::AlwaysInline); + // Pass inline keyword to optimizer. + if (DECL_EXPLICIT_INLINE_P (FnDecl)) + Fn->addFnAttr(Attribute::InlineHint); + if (optimize_size) Fn->addFnAttr(Attribute::OptimizeForSize); Modified: llvm-gcc-4.2/trunk/gcc/tree.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=95625&r1=95624&r2=95625&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.h (original) +++ llvm-gcc-4.2/trunk/gcc/tree.h Mon Feb 8 18:13:29 2010 @@ -3271,6 +3271,15 @@ #define DECL_DECLARED_INLINE_P(NODE) \ (FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag) +/* LLVM LOCAL begin inlinehint attribute */ +/* Nonzero in a FUNCTION_DECL means that this function was explicitly declared + inline via the `inline' keyword. This flag controls the inlinehint attribute + passed to the LLVM optimizer. */ +#define DECL_EXPLICIT_INLINE_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.explicit_inline_flag) +/* LLVM LOCAL end inlinehint attribute */ + + /* For FUNCTION_DECL, this holds a pointer to a structure ("struct function") that describes the status of this function. */ #define DECL_STRUCT_FUNCTION(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.f) @@ -3318,6 +3327,9 @@ unsigned no_instrument_function_entry_exit : 1; unsigned no_limit_stack : 1; ENUM_BITFIELD(built_in_class) built_in_class : 2; + /* LLVM LOCAL begin inlinehint attribute */ + unsigned explicit_inline_flag : 1; + /* LLVM LOCAL end inlinehint attribute */ /* APPLE LOCAL DECL_ESTIMATED_INSNS */ HOST_WIDE_INT estimated_insns; From gohman at apple.com Mon Feb 8 18:29:29 2010 From: gohman at apple.com (Dan Gohman) Date: Tue, 09 Feb 2010 00:29:29 -0000 Subject: [llvm-commits] [llvm] r95626 - /llvm/trunk/include/llvm/MC/MCExpr.h Message-ID: <201002090029.o190TUAR017448@zion.cs.uiuc.edu> Author: djg Date: Mon Feb 8 18:29:29 2010 New Revision: 95626 URL: http://llvm.org/viewvc/llvm-project?rev=95626&view=rev Log: Add explicit keywords. Modified: llvm/trunk/include/llvm/MC/MCExpr.h Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95626&r1=95625&r2=95626&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Mon Feb 8 18:29:29 2010 @@ -40,7 +40,7 @@ void operator=(const MCExpr&); // DO NOT IMPLEMENT protected: - MCExpr(ExprKind _Kind) : Kind(_Kind) {} + explicit MCExpr(ExprKind _Kind) : Kind(_Kind) {} public: /// @name Accessors @@ -86,7 +86,7 @@ class MCConstantExpr : public MCExpr { int64_t Value; - MCConstantExpr(int64_t _Value) + explicit MCConstantExpr(int64_t _Value) : MCExpr(MCExpr::Constant), Value(_Value) {} public: @@ -118,7 +118,7 @@ class MCSymbolRefExpr : public MCExpr { const MCSymbol *Symbol; - MCSymbolRefExpr(const MCSymbol *_Symbol) + explicit MCSymbolRefExpr(const MCSymbol *_Symbol) : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol) {} public: From sabre at nondot.org Mon Feb 8 18:34:28 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:34:28 -0000 Subject: [llvm-commits] [llvm] r95627 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmLexer.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <201002090034.o190YS58017645@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:34:28 2010 New Revision: 95627 URL: http://llvm.org/viewvc/llvm-project?rev=95627&view=rev Log: pass stringref by value instead of by const& Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=95627&r1=95626&r2=95627&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Mon Feb 8 18:34:28 2010 @@ -69,7 +69,7 @@ } -static unsigned MatchRegisterName(const StringRef &Name); +static unsigned MatchRegisterName(StringRef Name); AsmToken X86AsmLexer::LexTokenATT() { const AsmToken lexedToken = lexDefinite(); Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=95627&r1=95626&r2=95627&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Feb 8 18:34:28 2010 @@ -67,7 +67,7 @@ /// @name Auto-generated Match Functions /// { -static unsigned MatchRegisterName(const StringRef &Name); +static unsigned MatchRegisterName(StringRef Name); /// } @@ -291,6 +291,7 @@ // FIXME: Validate register for the current architecture; we have to do // validation later, so maybe there is no need for this here. RegNo = MatchRegisterName(Tok.getString()); + if (RegNo == 0) return Error(Tok.getLoc(), "invalid register name"); Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=95627&r1=95626&r2=95627&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Feb 8 18:34:28 2010 @@ -140,7 +140,7 @@ } /// TokenizeAsmString - Tokenize a simplified assembly string. -static void TokenizeAsmString(const StringRef &AsmString, +static void TokenizeAsmString(StringRef AsmString, SmallVectorImpl &Tokens) { unsigned Prev = 0; bool InTok = true; @@ -207,7 +207,7 @@ Tokens.push_back(AsmString.substr(Prev)); } -static bool IsAssemblerInstruction(const StringRef &Name, +static bool IsAssemblerInstruction(StringRef Name, const CodeGenInstruction &CGI, const SmallVectorImpl &Tokens) { // Ignore "codegen only" instructions. @@ -528,10 +528,10 @@ private: /// getTokenClass - Lookup or create the class for the given token. - ClassInfo *getTokenClass(const StringRef &Token); + ClassInfo *getTokenClass(StringRef Token); /// getOperandClass - Lookup or create the class for the given operand. - ClassInfo *getOperandClass(const StringRef &Token, + ClassInfo *getOperandClass(StringRef Token, const CodeGenInstruction::OperandInfo &OI); /// BuildRegisterClasses - Build the ClassInfo* instances for register @@ -581,7 +581,7 @@ } } -static std::string getEnumNameForToken(const StringRef &Str) { +static std::string getEnumNameForToken(StringRef Str) { std::string Res; for (StringRef::iterator it = Str.begin(), ie = Str.end(); it != ie; ++it) { @@ -603,7 +603,7 @@ } /// getRegisterRecord - Get the register record for \arg name, or 0. -static Record *getRegisterRecord(CodeGenTarget &Target, const StringRef &Name) { +static Record *getRegisterRecord(CodeGenTarget &Target, StringRef Name) { for (unsigned i = 0, e = Target.getRegisters().size(); i != e; ++i) { const CodeGenRegister &Reg = Target.getRegisters()[i]; if (Name == Reg.TheDef->getValueAsString("AsmName")) @@ -613,7 +613,7 @@ return 0; } -ClassInfo *AsmMatcherInfo::getTokenClass(const StringRef &Token) { +ClassInfo *AsmMatcherInfo::getTokenClass(StringRef Token) { ClassInfo *&Entry = TokenClasses[Token]; if (!Entry) { @@ -631,7 +631,7 @@ } ClassInfo * -AsmMatcherInfo::getOperandClass(const StringRef &Token, +AsmMatcherInfo::getOperandClass(StringRef Token, const CodeGenInstruction::OperandInfo &OI) { if (OI.Rec->isSubClassOf("RegisterClass")) { ClassInfo *CI = RegisterClassClasses[OI.Rec]; @@ -1373,7 +1373,7 @@ Matches.push_back(StringPair(CI.ValueName, "return " + CI.Name + ";")); } - OS << "static MatchClassKind MatchTokenString(const StringRef &Name) {\n"; + OS << "static MatchClassKind MatchTokenString(StringRef Name) {\n"; EmitStringMatcher("Name", Matches, OS); @@ -1396,7 +1396,7 @@ "return " + utostr(i + 1) + ";")); } - OS << "static unsigned MatchRegisterName(const StringRef &Name) {\n"; + OS << "static unsigned MatchRegisterName(StringRef Name) {\n"; EmitStringMatcher("Name", Matches, OS); From echristo at apple.com Mon Feb 8 18:35:38 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 09 Feb 2010 00:35:38 -0000 Subject: [llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll Message-ID: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> Author: echristo Date: Mon Feb 8 18:35:38 2010 New Revision: 95628 URL: http://llvm.org/viewvc/llvm-project?rev=95628&view=rev Log: Add a new pass to do llvm.objsize lowering using SCEV. Initial skeleton and SCEVUnknown lowering implemented, the rest should come relatively quickly. Move testcase to new directory. Move pass to right before SimplifyLibCalls - which is moved down a bit so we can take advantage of a few opts. Added: llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp llvm/trunk/test/Transforms/ObjSizeLower/ llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll - copied, changed from r95402, llvm/trunk/test/Transforms/InstCombine/objsize.ll Removed: llvm/trunk/test/Transforms/InstCombine/objsize.ll Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Support/StandardPasses.h llvm/trunk/include/llvm/Transforms/Scalar.h Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=95628&r1=95627&r2=95628&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Mon Feb 8 18:35:38 2010 @@ -138,6 +138,7 @@ (void) llvm::createGEPSplitterPass(); (void) llvm::createSCCVNPass(); (void) llvm::createABCDPass(); + (void) llvm::createObjectSizeLoweringPass(); (void)new llvm::IntervalPartition(); (void)new llvm::FindUsedTypes(); Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=95628&r1=95627&r2=95628&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Mon Feb 8 18:35:38 2010 @@ -118,8 +118,6 @@ // Start of function pass. PM->add(createScalarReplAggregatesPass()); // Break up aggregate allocas - if (SimplifyLibCalls) - PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. PM->add(createJumpThreadingPass()); // Thread jumps. PM->add(createCFGSimplificationPass()); // Merge & remove BBs @@ -128,6 +126,9 @@ PM->add(createTailCallEliminationPass()); // Eliminate tail calls PM->add(createCFGSimplificationPass()); // Merge & remove BBs PM->add(createReassociatePass()); // Reassociate expressions + PM->add(createObjectSizeLoweringPass()); // Lower Intrinsic::objsize + if (SimplifyLibCalls) + PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations PM->add(createLoopRotatePass()); // Rotate Loop PM->add(createLICMPass()); // Hoist loop invariants PM->add(createLoopUnswitchPass(OptimizeSize || OptimizationLevel < 3)); Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=95628&r1=95627&r2=95628&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Mon Feb 8 18:35:38 2010 @@ -336,6 +336,12 @@ // FunctionPass *createABCDPass(); +//===----------------------------------------------------------------------===// +// +// ObjSizeLowering - Lower Intrinsic::objsize +// +FunctionPass *createObjectSizeLoweringPass(); + } // End llvm namespace #endif Added: llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp?rev=95628&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp (added) +++ llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp Mon Feb 8 18:35:38 2010 @@ -0,0 +1,114 @@ +//===-- ObjectSizeLowering.cpp - Loop unroller pass -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass lowers Intrinsic::objectsize using SCEV to determine minimum or +// maximum space left in an allocated object. +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "objsize-lower" +#include "llvm/Constants.h" +#include "llvm/Module.h" +#include "llvm/Value.h" +#include "llvm/Target/TargetData.h" +#include "llvm/IntrinsicInst.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Analysis/ScalarEvolution.h" +#include "llvm/Analysis/ScalarEvolutionExpander.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; + +namespace { + class ObjSizeLower : public FunctionPass { + ScalarEvolution *SE; + TargetData *TD; + public: + static char ID; // Pass identification, replacement for typeid + ObjSizeLower() : FunctionPass(&ID) {} + + bool runOnFunction(Function &F); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + AU.addRequired(); + AU.addPreserved(); + } + private: + bool LowerCall(IntrinsicInst *); + void ReplaceAllUsesWithUnknown(IntrinsicInst *, bool); + }; +} + +char ObjSizeLower::ID = 0; +static RegisterPass X("objsize-lower", + "Object Size Lowering"); + +// Public interface to the Object Size Lowering pass +FunctionPass *llvm::createObjectSizeLoweringPass() { + return new ObjSizeLower(); +} + +/// runOnFunction - Top level algorithm - Loop over each object size intrinsic +/// and use Scalar Evolutions to get the maximum or minimum size left in the +/// allocated object at any point. +bool ObjSizeLower::runOnFunction(Function &F) { + SE = &getAnalysis(); + TD = getAnalysisIfAvailable(); + + // We really need TargetData for size calculations. + if (!TD) return false; + + bool Changed = false; + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { + for (BasicBlock::iterator I = BB->begin(), L = BB->end(); I != L; ) { + CallInst *CI = dyn_cast(I++); + if (!CI) continue; + + // The only thing we care about are Intrinsic::objectsize calls + IntrinsicInst *II = dyn_cast(CI); + if (!II || II->getIntrinsicID() != Intrinsic::objectsize) continue; + + Changed |= LowerCall(II); + } + } + return Changed; +} + +// Unknown for llvm.objsize is -1 for maximum size, and 0 for minimum size. +void ObjSizeLower::ReplaceAllUsesWithUnknown(IntrinsicInst *II, bool min) { + const Type *ReturnTy = II->getCalledFunction()->getReturnType(); + II->replaceAllUsesWith(ConstantInt::get(ReturnTy, min ? 0 : -1ULL)); + II->eraseFromParent(); +} + +bool ObjSizeLower::LowerCall(IntrinsicInst *II) { + ConstantInt *CI = cast(II->getOperand(2)); + bool minimum = (CI->getZExtValue() == 1); + Value *Op = II->getOperand(1); + const Type *ReturnTy = II->getCalledFunction()->getReturnType(); + + // Grab the SCEV for our access. + const SCEV *thisEV = SE->getSCEV(Op); + + if (const SCEVUnknown *SU = dyn_cast(thisEV)) { + if (GlobalVariable *GV = dyn_cast(SU->getValue())) { + if (GV->hasDefinitiveInitializer()) { + Constant *C = GV->getInitializer(); + size_t globalSize = TD->getTypeAllocSize(C->getType()); + II->replaceAllUsesWith(ConstantInt::get(ReturnTy, globalSize)); + II->eraseFromParent(); + return true; + } + } + } + + ReplaceAllUsesWithUnknown(II, minimum); + return true; +} Removed: llvm/trunk/test/Transforms/InstCombine/objsize.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=95627&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll (removed) @@ -1,52 +0,0 @@ -; Test a pile of objectsize bounds checking. -; RUN: opt < %s -instcombine -S | FileCheck %s -; XFAIL: * -; We need target data to get the sizes of the arrays and structures. -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" - - at a = private global [60 x i8] zeroinitializer, align 1 ; <[60 x i8]*> - at .str = private constant [8 x i8] c"abcdefg\00" ; <[8 x i8]*> - -define i32 @foo() nounwind { -; CHECK: @foo -; CHECK-NEXT: ret i32 60 - %1 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false) - ret i32 %1 -} - -define i8* @bar() nounwind { -; CHECK: @bar -entry: - %retval = alloca i8* - %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false) - %cmp = icmp ne i32 %0, -1 -; CHECK: br i1 true - br i1 %cmp, label %cond.true, label %cond.false - -cond.true: - %1 = load i8** %retval; - ret i8* %1; - -cond.false: - %2 = load i8** %retval; - ret i8* %2; -} - -define i32 @f() nounwind { -; CHECK: @f -; CHECK-NEXT: ret i32 0 - %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false) - ret i32 %1 -} - - at window = external global [0 x i8] - -define i1 @baz() nounwind { -; CHECK: @baz -; CHECK-NEXT: llvm.objectsize.i32 - %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false) - %2 = icmp eq i32 %1, -1 - ret i1 %2 -} - -declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly \ No newline at end of file Copied: llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll (from r95402, llvm/trunk/test/Transforms/InstCombine/objsize.ll) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll?p2=llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll&p1=llvm/trunk/test/Transforms/InstCombine/objsize.ll&r1=95402&r2=95628&rev=95628&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) +++ llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll Mon Feb 8 18:35:38 2010 @@ -1,6 +1,5 @@ ; Test a pile of objectsize bounds checking. -; RUN: opt < %s -instcombine -S | FileCheck %s -; XFAIL: * +; RUN: opt < %s -objsize-lower -S | FileCheck %s ; We need target data to get the sizes of the arrays and structures. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" @@ -19,8 +18,8 @@ entry: %retval = alloca i8* %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8]* @a, i32 0, i32 0), i1 false) +; CHECK: %cmp = icmp ne i32 60, -1 %cmp = icmp ne i32 %0, -1 -; CHECK: br i1 true br i1 %cmp, label %cond.true, label %cond.false cond.true: @@ -32,9 +31,10 @@ ret i8* %2; } +; FIXME: This should return 0. define i32 @f() nounwind { ; CHECK: @f -; CHECK-NEXT: ret i32 0 +; CHECK-NEXT: ret i32 -1 %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false) ret i32 %1 } @@ -43,7 +43,7 @@ define i1 @baz() nounwind { ; CHECK: @baz -; CHECK-NEXT: llvm.objectsize.i32 +; CHECK-NEXT: icmp eq i32 -1, -1 %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false) %2 = icmp eq i32 %1, -1 ret i1 %2 From sabre at nondot.org Mon Feb 8 18:40:07 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:40:07 -0000 Subject: [llvm-commits] [llvm] r95630 - /llvm/trunk/include/llvm/MC/MCParser/AsmParser.h Message-ID: <201002090040.o190e7TJ017900@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:40:07 2010 New Revision: 95630 URL: http://llvm.org/viewvc/llvm-project?rev=95630&view=rev Log: stop using reserved identifiers. Modified: llvm/trunk/include/llvm/MC/MCParser/AsmParser.h Modified: llvm/trunk/include/llvm/MC/MCParser/AsmParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/AsmParser.h?rev=95630&r1=95629&r2=95630&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCParser/AsmParser.h (original) +++ llvm/trunk/include/llvm/MC/MCParser/AsmParser.h Mon Feb 8 18:40:07 2010 @@ -61,8 +61,8 @@ /// in the directive name and the location of the directive keyword. StringMap DirectiveMap; public: - AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out, - const MCAsmInfo &_MAI); + AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, + const MCAsmInfo &MAI); ~AsmParser(); bool Run(); From lhames at gmail.com Mon Feb 8 18:41:23 2010 From: lhames at gmail.com (Lang Hames) Date: Tue, 09 Feb 2010 00:41:23 -0000 Subject: [llvm-commits] [llvm] r95631 - /llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Message-ID: <201002090041.o190fN9x017990@zion.cs.uiuc.edu> Author: lhames Date: Mon Feb 8 18:41:23 2010 New Revision: 95631 URL: http://llvm.org/viewvc/llvm-project?rev=95631&view=rev Log: Changed the definition of an "invalid" slot to include the empty & tombstone values, but not zero. Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=95631&r1=95630&r2=95631&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Mon Feb 8 18:41:23 2010 @@ -72,10 +72,13 @@ } } + bool isValid() const { + return (index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX); + } + MachineInstr* getInstr() const { return mi; } void setInstr(MachineInstr *mi) { - assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX && - "Attempt to modify reserved index."); + assert(isValid() && "Attempt to modify reserved index."); this->mi = mi; } @@ -83,25 +86,21 @@ void setIndex(unsigned index) { assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX && "Attempt to set index to invalid value."); - assert(this->index != EMPTY_KEY_INDEX && - this->index != TOMBSTONE_KEY_INDEX && - "Attempt to reset reserved index value."); + assert(isValid() && "Attempt to reset reserved index value."); this->index = index; } IndexListEntry* getNext() { return next; } const IndexListEntry* getNext() const { return next; } void setNext(IndexListEntry *next) { - assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX && - "Attempt to modify reserved index."); + assert(isValid() && "Attempt to modify reserved index."); this->next = next; } IndexListEntry* getPrev() { return prev; } const IndexListEntry* getPrev() const { return prev; } void setPrev(IndexListEntry *prev) { - assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX && - "Attempt to modify reserved index."); + assert(isValid() && "Attempt to modify reserved index."); this->prev = prev; } @@ -192,7 +191,8 @@ /// Returns true if this is a valid index. Invalid indicies do /// not point into an index table, and cannot be compared. bool isValid() const { - return (lie.getPointer() != 0) && (lie.getPointer()->getIndex() != 0); + IndexListEntry *entry = lie.getPointer(); + return ((entry!= 0) && (entry->isValid())); } /// Print this index to the given raw_ostream. From dalej at apple.com Mon Feb 8 18:42:09 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 09 Feb 2010 00:42:09 -0000 Subject: [llvm-commits] [llvm] r95632 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <201002090042.o190g9aN018024@zion.cs.uiuc.edu> Author: johannes Date: Mon Feb 8 18:42:08 2010 New Revision: 95632 URL: http://llvm.org/viewvc/llvm-project?rev=95632&view=rev Log: Debug operands should not be def or kill. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=95632&r1=95631&r2=95632&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Mon Feb 8 18:42:08 2010 @@ -246,11 +246,13 @@ void setIsUse(bool Val = true) { assert(isReg() && "Wrong MachineOperand accessor"); + assert((Val || !isDebug()) && "Marking a debug operation as def"); IsDef = !Val; } void setIsDef(bool Val = true) { assert(isReg() && "Wrong MachineOperand accessor"); + assert((!Val || !isDebug()) && "Marking a debug operation as def"); IsDef = Val; } @@ -261,6 +263,7 @@ void setIsKill(bool Val = true) { assert(isReg() && !IsDef && "Wrong MachineOperand accessor"); + assert((!Val || !isDebug()) && "Marking a debug operation as kill"); IsKill = Val; } From lhames at gmail.com Mon Feb 8 18:45:48 2010 From: lhames at gmail.com (Lang Hames) Date: Tue, 09 Feb 2010 00:45:48 -0000 Subject: [llvm-commits] [llvm] r95633 - in /llvm/trunk/lib/CodeGen/PBQP: Graph.h HeuristicSolver.h Message-ID: <201002090045.o190jmdd018190@zion.cs.uiuc.edu> Author: lhames Date: Mon Feb 8 18:45:48 2010 New Revision: 95633 URL: http://llvm.org/viewvc/llvm-project?rev=95633&view=rev Log: Added copy sensible construction & assignment to PBQP graphs and fixed a memory access bug in the heuristic solver. Modified: llvm/trunk/lib/CodeGen/PBQP/Graph.h llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Modified: llvm/trunk/lib/CodeGen/PBQP/Graph.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/Graph.h?rev=95633&r1=95632&r2=95633&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP/Graph.h (original) +++ llvm/trunk/lib/CodeGen/PBQP/Graph.h Mon Feb 8 18:45:48 2010 @@ -19,6 +19,7 @@ #include #include +#include namespace PBQP { @@ -37,7 +38,10 @@ public: typedef NodeList::iterator NodeItr; + typedef NodeList::const_iterator ConstNodeItr; + typedef EdgeList::iterator EdgeItr; + typedef EdgeList::const_iterator ConstEdgeItr; private: @@ -58,6 +62,7 @@ public: NodeEntry(const Vector &costs) : costs(costs), degree(0) {} Vector& getCosts() { return costs; } + const Vector& getCosts() const { return costs; } unsigned getDegree() const { return degree; } AdjEdgeItr edgesBegin() { return adjEdges.begin(); } AdjEdgeItr edgesEnd() { return adjEdges.end(); } @@ -85,6 +90,7 @@ NodeItr getNode1() const { return node1; } NodeItr getNode2() const { return node2; } Matrix& getCosts() { return costs; } + const Matrix& getCosts() const { return costs; } void setNode1AEItr(AdjEdgeItr ae) { node1AEItr = ae; } AdjEdgeItr getNode1AEItr() { return node1AEItr; } void setNode2AEItr(AdjEdgeItr ae) { node2AEItr = ae; } @@ -104,9 +110,10 @@ // ----- INTERNAL METHODS ----- NodeEntry& getNode(NodeItr nItr) { return *nItr; } - const NodeEntry& getNode(NodeItr nItr) const { return *nItr; } + const NodeEntry& getNode(ConstNodeItr nItr) const { return *nItr; } + EdgeEntry& getEdge(EdgeItr eItr) { return *eItr; } - const EdgeEntry& getEdge(EdgeItr eItr) const { return *eItr; } + const EdgeEntry& getEdge(ConstEdgeItr eItr) const { return *eItr; } NodeItr addConstructedNode(const NodeEntry &n) { ++numNodes; @@ -130,10 +137,32 @@ return edgeItr; } + inline void copyFrom(const Graph &other); public: + /// \brief Construct an empty PBQP graph. Graph() : numNodes(0), numEdges(0) {} + /// \brief Copy construct this graph from "other". Note: Does not copy node + /// and edge data, only graph structure and costs. + /// @param other Source graph to copy from. + Graph(const Graph &other) : numNodes(0), numEdges(0) { + copyFrom(other); + } + + /// \brief Make this graph a copy of "other". Note: Does not copy node and + /// edge data, only graph structure and costs. + /// @param other The graph to copy from. + /// @return A reference to this graph. + /// + /// This will clear the current graph, erasing any nodes and edges added, + /// before copying from other. + Graph& operator=(const Graph &other) { + clear(); + copyFrom(other); + return *this; + } + /// \brief Add a node with the given costs. /// @param costs Cost vector for the new node. /// @return Node iterator for the added node. @@ -166,6 +195,13 @@ /// @return Node cost vector. Vector& getNodeCosts(NodeItr nItr) { return getNode(nItr).getCosts(); } + /// \brief Get a node's cost vector (const version). + /// @param nItr Node iterator. + /// @return Node cost vector. + const Vector& getNodeCosts(ConstNodeItr nItr) const { + return getNode(nItr).getCosts(); + } + /// \brief Set a node's data pointer. /// @param nItr Node iterator. /// @param data Pointer to node data. @@ -183,6 +219,13 @@ /// @return Edge cost matrix. Matrix& getEdgeCosts(EdgeItr eItr) { return getEdge(eItr).getCosts(); } + /// \brief Get an edge's cost matrix (const version). + /// @param eItr Edge iterator. + /// @return Edge cost matrix. + const Matrix& getEdgeCosts(ConstEdgeItr eItr) const { + return getEdge(eItr).getCosts(); + } + /// \brief Set an edge's data pointer. /// @param eItr Edge iterator. /// @param data Pointer to edge data. @@ -205,9 +248,15 @@ /// \brief Begin iterator for node set. NodeItr nodesBegin() { return nodes.begin(); } + /// \brief Begin const iterator for node set. + ConstNodeItr nodesBegin() const { return nodes.begin(); } + /// \brief End iterator for node set. NodeItr nodesEnd() { return nodes.end(); } + /// \brief End const iterator for node set. + ConstNodeItr nodesEnd() const { return nodes.end(); } + /// \brief Begin iterator for edge set. EdgeItr edgesBegin() { return edges.begin(); } @@ -342,6 +391,10 @@ bool operator()(Graph::NodeItr n1, Graph::NodeItr n2) const { return &*n1 < &*n2; } + + bool operator()(Graph::ConstNodeItr n1, Graph::ConstNodeItr n2) const { + return &*n1 < &*n2; + } }; class EdgeItrCompartor { @@ -349,8 +402,23 @@ bool operator()(Graph::EdgeItr e1, Graph::EdgeItr e2) const { return &*e1 < &*e2; } + + bool operator()(Graph::ConstEdgeItr e1, Graph::ConstEdgeItr e2) const { + return &*e1 < &*e2; + } }; + void Graph::copyFrom(const Graph &other) { + std::map nodeMap; + + for (Graph::ConstNodeItr nItr = other.nodesBegin(), + nEnd = other.nodesEnd(); + nItr != nEnd; ++nItr) { + nodeMap[nItr] = addNode(other.getNodeCosts(nItr)); + } + + } } Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=95633&r1=95632&r2=95633&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original) +++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Mon Feb 8 18:45:48 2010 @@ -107,8 +107,11 @@ Solution s; std::vector stack; - std::vector nodeData; - std::vector edgeData; + typedef std::list NodeDataList; + NodeDataList nodeDataList; + + typedef std::list EdgeDataList; + EdgeDataList edgeDataList; public: @@ -364,8 +367,8 @@ } else if (addedEdge) { // If the edge was added, and non-null, finish setting it up, add it to // the solver & notify heuristic. - edgeData.push_back(EdgeData()); - g.setEdgeData(yzeItr, &edgeData.back()); + edgeDataList.push_back(EdgeData()); + g.setEdgeData(yzeItr, &edgeDataList.back()); addSolverEdge(yzeItr); h.handleAddEdge(yzeItr); } @@ -402,22 +405,18 @@ simplify(); } - // Reserve space for the node and edge data. - nodeData.resize(g.getNumNodes()); - edgeData.resize(g.getNumEdges()); - // Create node data objects. - unsigned ndIndex = 0; for (Graph::NodeItr nItr = g.nodesBegin(), nEnd = g.nodesEnd(); - nItr != nEnd; ++nItr, ++ndIndex) { - g.setNodeData(nItr, &nodeData[ndIndex]); + nItr != nEnd; ++nItr) { + nodeDataList.push_back(NodeData()); + g.setNodeData(nItr, &nodeDataList.back()); } // Create edge data objects. - unsigned edIndex = 0; for (Graph::EdgeItr eItr = g.edgesBegin(), eEnd = g.edgesEnd(); - eItr != eEnd; ++eItr, ++edIndex) { - g.setEdgeData(eItr, &edgeData[edIndex]); + eItr != eEnd; ++eItr) { + edgeDataList.push_back(EdgeData()); + g.setEdgeData(eItr, &edgeDataList.back()); addSolverEdge(eItr); } } @@ -563,8 +562,8 @@ void cleanup() { h.cleanup(); - nodeData.clear(); - edgeData.clear(); + nodeDataList.clear(); + edgeDataList.clear(); } }; From sabre at nondot.org Mon Feb 8 18:49:22 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:49:22 -0000 Subject: [llvm-commits] [llvm] r95634 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_instructions.s Message-ID: <201002090049.o190nMXA018355@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:49:22 2010 New Revision: 95634 URL: http://llvm.org/viewvc/llvm-project?rev=95634&view=rev Log: Implement x86 asm parsing support for %st and %st(4) Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=95634&r1=95633&r2=95634&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Feb 8 18:49:22 2010 @@ -292,6 +292,41 @@ // validation later, so maybe there is no need for this here. RegNo = MatchRegisterName(Tok.getString()); + // Parse %st(1) and "%st" as "%st(0)" + if (RegNo == 0 && Tok.getString() == "st") { + RegNo = X86::ST0; + EndLoc = Tok.getLoc(); + Parser.Lex(); // Eat 'st' + + // Check to see if we have '(4)' after %st. + if (getLexer().isNot(AsmToken::LParen)) + return false; + // Lex the paren. + getParser().Lex(); + + const AsmToken &IntTok = Parser.getTok(); + if (IntTok.isNot(AsmToken::Integer)) + return Error(IntTok.getLoc(), "expected stack index"); + switch (IntTok.getIntVal()) { + case 0: RegNo = X86::ST0; break; + case 1: RegNo = X86::ST1; break; + case 2: RegNo = X86::ST2; break; + case 3: RegNo = X86::ST3; break; + case 4: RegNo = X86::ST4; break; + case 5: RegNo = X86::ST5; break; + case 6: RegNo = X86::ST6; break; + case 7: RegNo = X86::ST7; break; + default: return Error(IntTok.getLoc(), "invalid stack index"); + } + + if (getParser().Lex().isNot(AsmToken::RParen)) + return Error(Parser.getTok().getLoc(), "expected ')'"); + + EndLoc = Tok.getLoc(); + Parser.Lex(); // Eat ')' + return false; + } + if (RegNo == 0) return Error(Tok.getLoc(), "invalid register name"); Modified: llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s?rev=95634&r1=95633&r2=95634&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_instructions.s Mon Feb 8 18:49:22 2010 @@ -136,3 +136,10 @@ // CHECK: movb 0(%eax), %al gs;movb 0(%eax), %al +// CHECK: fadd %st(0) +// CHECK: fadd %st(1) +// CHECK: fadd %st(7) + +fadd %st(0) +fadd %st(1) +fadd %st(7) From lhames at gmail.com Mon Feb 8 18:50:28 2010 From: lhames at gmail.com (Lang Hames) Date: Tue, 09 Feb 2010 00:50:28 -0000 Subject: [llvm-commits] [llvm] r95636 - /llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Message-ID: <201002090050.o190oSI6018421@zion.cs.uiuc.edu> Author: lhames Date: Mon Feb 8 18:50:27 2010 New Revision: 95636 URL: http://llvm.org/viewvc/llvm-project?rev=95636&view=rev Log: Fixed a bug in the PBQP allocator's findCoalesces method. Previously spill registers, whose def indexes are not defined, would sometimes be improperly marked as coalescable with conflicting registers. The new findCoalesces routine conservatively assumes that any register with at least one undefined def is not coalescable with any register it interferes with. Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=95636&r1=95635&r2=95636&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Mon Feb 8 18:50:27 2010 @@ -411,16 +411,16 @@ // We also need any physical regs to be allocable, coalescing with // a non-allocable register is invalid. if (srcRegIsPhysical) { - if (std::find(srcRegClass->allocation_order_begin(*mf), - srcRegClass->allocation_order_end(*mf), srcReg) == - srcRegClass->allocation_order_end(*mf)) + if (std::find(dstRegClass->allocation_order_begin(*mf), + dstRegClass->allocation_order_end(*mf), srcReg) == + dstRegClass->allocation_order_end(*mf)) continue; } if (dstRegIsPhysical) { - if (std::find(dstRegClass->allocation_order_begin(*mf), - dstRegClass->allocation_order_end(*mf), dstReg) == - dstRegClass->allocation_order_end(*mf)) + if (std::find(srcRegClass->allocation_order_begin(*mf), + srcRegClass->allocation_order_end(*mf), dstReg) == + srcRegClass->allocation_order_end(*mf)) continue; } @@ -442,6 +442,12 @@ vniItr = srcLI->vni_begin(), vniEnd = srcLI->vni_end(); vniItr != vniEnd; ++vniItr) { + // If we find a poorly defined def we err on the side of caution. + if (!(*vniItr)->def.isValid()) { + badDef = true; + break; + } + // If we find a def that kills the coalescing opportunity then // record it and break from the loop. if (dstLI->liveAt((*vniItr)->def)) { @@ -463,6 +469,11 @@ if ((*vniItr)->getCopy() == instr) continue; + if (!(*vniItr)->def.isValid()) { + badDef = true; + break; + } + if (srcLI->liveAt((*vniItr)->def)) { badDef = true; break; From sabre at nondot.org Mon Feb 8 18:54:51 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 00:54:51 -0000 Subject: [llvm-commits] [llvm] r95637 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp Message-ID: <201002090054.o190spPw018610@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 18:54:51 2010 New Revision: 95637 URL: http://llvm.org/viewvc/llvm-project?rev=95637&view=rev Log: make -show-inst be formatted a bit nicer. Before: movl $3735928559, a ## inst: > after: movl $3735928559, a ## ## ## ## ## ## > Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95637&r1=95636&r2=95637&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Feb 8 18:54:51 2010 @@ -532,14 +532,6 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { assert(CurSection && "Cannot emit contents before setting section!"); - // Show the MCInst if enabled. - if (ShowInst) { - raw_ostream &OS = GetCommentOS(); - OS << "inst: "; - Inst.print(OS, &MAI); - OS << "\n"; - } - // Show the encoding in a comment if we have a code emitter. if (Emitter) { SmallString<256> Code; @@ -557,6 +549,18 @@ OS << "]\n"; } + // Show the MCInst if enabled. + if (ShowInst) { + raw_ostream &OS = GetCommentOS(); + OS << "\n"; + } + // If we have an AsmPrinter, use that to print, otherwise dump the MCInst. if (InstPrinter) InstPrinter->printInst(&Inst); From clattner at apple.com Mon Feb 8 18:58:33 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 8 Feb 2010 16:58:33 -0800 Subject: [llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll In-Reply-To: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> References: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> Message-ID: On Feb 8, 2010, at 4:35 PM, Eric Christopher wrote: > Author: echristo > Date: Mon Feb 8 18:35:38 2010 > New Revision: 95628 > > URL: http://llvm.org/viewvc/llvm-project?rev=95628&view=rev > Log: > Add a new pass to do llvm.objsize lowering using SCEV. > Initial skeleton and SCEVUnknown lowering implemented, > the rest should come relatively quickly. Move testcase > to new directory. > > Move pass to right before SimplifyLibCalls - which is > moved down a bit so we can take advantage of a few opts. Why is this using SCEV? Isn't this massive overkill? How smart does this really need to be? -Chris > > > Added: > llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp > llvm/trunk/test/Transforms/ObjSizeLower/ > llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll > - copied, changed from r95402, llvm/trunk/test/Transforms/ > InstCombine/objsize.ll > Removed: > llvm/trunk/test/Transforms/InstCombine/objsize.ll > Modified: > llvm/trunk/include/llvm/LinkAllPasses.h > llvm/trunk/include/llvm/Support/StandardPasses.h > llvm/trunk/include/llvm/Transforms/Scalar.h > > Modified: llvm/trunk/include/llvm/LinkAllPasses.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=95628&r1=95627&r2=95628&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/LinkAllPasses.h (original) > +++ llvm/trunk/include/llvm/LinkAllPasses.h Mon Feb 8 18:35:38 2010 > @@ -138,6 +138,7 @@ > (void) llvm::createGEPSplitterPass(); > (void) llvm::createSCCVNPass(); > (void) llvm::createABCDPass(); > + (void) llvm::createObjectSizeLoweringPass(); > > (void)new llvm::IntervalPartition(); > (void)new llvm::FindUsedTypes(); > > Modified: llvm/trunk/include/llvm/Support/StandardPasses.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=95628&r1=95627&r2=95628&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) > +++ llvm/trunk/include/llvm/Support/StandardPasses.h Mon Feb 8 > 18:35:38 2010 > @@ -118,8 +118,6 @@ > // Start of function pass. > > PM->add(createScalarReplAggregatesPass()); // Break up > aggregate allocas > - if (SimplifyLibCalls) > - PM->add(createSimplifyLibCallsPass()); // Library Call > Optimizations > PM->add(createInstructionCombiningPass()); // Cleanup for > scalarrepl. > PM->add(createJumpThreadingPass()); // Thread jumps. > PM->add(createCFGSimplificationPass()); // Merge & remove BBs > @@ -128,6 +126,9 @@ > PM->add(createTailCallEliminationPass()); // Eliminate tail > calls > PM->add(createCFGSimplificationPass()); // Merge & remove BBs > PM->add(createReassociatePass()); // Reassociate > expressions > + PM->add(createObjectSizeLoweringPass()); // Lower > Intrinsic::objsize > + if (SimplifyLibCalls) > + PM->add(createSimplifyLibCallsPass()); // Library Call > Optimizations > PM->add(createLoopRotatePass()); // Rotate Loop > PM->add(createLICMPass()); // Hoist loop > invariants > PM->add(createLoopUnswitchPass(OptimizeSize || OptimizationLevel > < 3)); > > Modified: llvm/trunk/include/llvm/Transforms/Scalar.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=95628&r1=95627&r2=95628&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) > +++ llvm/trunk/include/llvm/Transforms/Scalar.h Mon Feb 8 18:35:38 > 2010 > @@ -336,6 +336,12 @@ > // > FunctionPass *createABCDPass(); > > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// ObjSizeLowering - Lower Intrinsic::objsize > +// > +FunctionPass *createObjectSizeLoweringPass(); > + > } // End llvm namespace > > #endif > > Added: llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp?rev=95628&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp (added) > +++ llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp Mon Feb > 8 18:35:38 2010 > @@ -0,0 +1,114 @@ > +//===-- ObjectSizeLowering.cpp - Loop unroller pass > -----------------------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// This pass lowers Intrinsic::objectsize using SCEV to determine > minimum or > +// maximum space left in an allocated object. > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#define DEBUG_TYPE "objsize-lower" > +#include "llvm/Constants.h" > +#include "llvm/Module.h" > +#include "llvm/Value.h" > +#include "llvm/Target/TargetData.h" > +#include "llvm/IntrinsicInst.h" > +#include "llvm/Transforms/Scalar.h" > +#include "llvm/Analysis/ScalarEvolution.h" > +#include "llvm/Analysis/ScalarEvolutionExpander.h" > +#include "llvm/Support/CommandLine.h" > +#include "llvm/Support/Debug.h" > +#include "llvm/Support/raw_ostream.h" > + > +using namespace llvm; > + > +namespace { > + class ObjSizeLower : public FunctionPass { > + ScalarEvolution *SE; > + TargetData *TD; > + public: > + static char ID; // Pass identification, replacement for typeid > + ObjSizeLower() : FunctionPass(&ID) {} > + > + bool runOnFunction(Function &F); > + virtual void getAnalysisUsage(AnalysisUsage &AU) const { > + AU.setPreservesCFG(); > + AU.addRequired(); > + AU.addPreserved(); > + } > + private: > + bool LowerCall(IntrinsicInst *); > + void ReplaceAllUsesWithUnknown(IntrinsicInst *, bool); > + }; > +} > + > +char ObjSizeLower::ID = 0; > +static RegisterPass X("objsize-lower", > + "Object Size Lowering"); > + > +// Public interface to the Object Size Lowering pass > +FunctionPass *llvm::createObjectSizeLoweringPass() { > + return new ObjSizeLower(); > +} > + > +/// runOnFunction - Top level algorithm - Loop over each object > size intrinsic > +/// and use Scalar Evolutions to get the maximum or minimum size > left in the > +/// allocated object at any point. > +bool ObjSizeLower::runOnFunction(Function &F) { > + SE = &getAnalysis(); > + TD = getAnalysisIfAvailable(); > + > + // We really need TargetData for size calculations. > + if (!TD) return false; > + > + bool Changed = false; > + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; + > +BB) { > + for (BasicBlock::iterator I = BB->begin(), L = BB->end(); I != > L; ) { > + CallInst *CI = dyn_cast(I++); > + if (!CI) continue; > + > + // The only thing we care about are Intrinsic::objectsize calls > + IntrinsicInst *II = dyn_cast(CI); > + if (!II || II->getIntrinsicID() != Intrinsic::objectsize) > continue; > + > + Changed |= LowerCall(II); > + } > + } > + return Changed; > +} > + > +// Unknown for llvm.objsize is -1 for maximum size, and 0 for > minimum size. > +void ObjSizeLower::ReplaceAllUsesWithUnknown(IntrinsicInst *II, > bool min) { > + const Type *ReturnTy = II->getCalledFunction()->getReturnType(); > + II->replaceAllUsesWith(ConstantInt::get(ReturnTy, min ? 0 : > -1ULL)); > + II->eraseFromParent(); > +} > + > +bool ObjSizeLower::LowerCall(IntrinsicInst *II) { > + ConstantInt *CI = cast(II->getOperand(2)); > + bool minimum = (CI->getZExtValue() == 1); > + Value *Op = II->getOperand(1); > + const Type *ReturnTy = II->getCalledFunction()->getReturnType(); > + > + // Grab the SCEV for our access. > + const SCEV *thisEV = SE->getSCEV(Op); > + > + if (const SCEVUnknown *SU = dyn_cast(thisEV)) { > + if (GlobalVariable *GV = dyn_cast(SU- > >getValue())) { > + if (GV->hasDefinitiveInitializer()) { > + Constant *C = GV->getInitializer(); > + size_t globalSize = TD->getTypeAllocSize(C->getType()); > + II->replaceAllUsesWith(ConstantInt::get(ReturnTy, > globalSize)); > + II->eraseFromParent(); > + return true; > + } > + } > + } > + > + ReplaceAllUsesWithUnknown(II, minimum); > + return true; > +} > > Removed: llvm/trunk/test/Transforms/InstCombine/objsize.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=95627&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll (removed) > @@ -1,52 +0,0 @@ > -; Test a pile of objectsize bounds checking. > -; RUN: opt < %s -instcombine -S | FileCheck %s > -; XFAIL: * > -; We need target data to get the sizes of the arrays and structures. > -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- > f80:128:128" > - > - at a = private global [60 x i8] zeroinitializer, align 1 ; <[60 x i8]*> > - at .str = private constant [8 x i8] c"abcdefg\00" ; <[8 x i8]*> > - > -define i32 @foo() nounwind { > -; CHECK: @foo > -; CHECK-NEXT: ret i32 60 > - %1 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds > ([60 x i8]* @a, i32 0, i32 0), i1 false) > - ret i32 %1 > -} > - > -define i8* @bar() nounwind { > -; CHECK: @bar > -entry: > - %retval = alloca i8* > - %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds > ([60 x i8]* @a, i32 0, i32 0), i1 false) > - %cmp = icmp ne i32 %0, -1 > -; CHECK: br i1 true > - br i1 %cmp, label %cond.true, label %cond.false > - > -cond.true: > - %1 = load i8** %retval; > - ret i8* %1; > - > -cond.false: > - %2 = load i8** %retval; > - ret i8* %2; > -} > - > -define i32 @f() nounwind { > -; CHECK: @f > -; CHECK-NEXT: ret i32 0 > - %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* > @a, i32 1, i32 0), i1 false) > - ret i32 %1 > -} > - > - at window = external global [0 x i8] > - > -define i1 @baz() nounwind { > -; CHECK: @baz > -; CHECK-NEXT: llvm.objectsize.i32 > - %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr > inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false) > - %2 = icmp eq i32 %1, -1 > - ret i1 %2 > -} > - > -declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly > \ No newline at end of file > > Copied: llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll (from > r95402, llvm/trunk/test/Transforms/InstCombine/objsize.ll) > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll?p2=llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll&p1=llvm/trunk/test/Transforms/InstCombine/objsize.ll&r1=95402&r2=95628&rev=95628&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) > +++ llvm/trunk/test/Transforms/ObjSizeLower/objsize.ll Mon Feb 8 > 18:35:38 2010 > @@ -1,6 +1,5 @@ > ; Test a pile of objectsize bounds checking. > -; RUN: opt < %s -instcombine -S | FileCheck %s > -; XFAIL: * > +; RUN: opt < %s -objsize-lower -S | FileCheck %s > ; We need target data to get the sizes of the arrays and structures. > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- > f80:128:128" > > @@ -19,8 +18,8 @@ > entry: > %retval = alloca i8* > %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 > x i8]* @a, i32 0, i32 0), i1 false) > +; CHECK: %cmp = icmp ne i32 60, -1 > %cmp = icmp ne i32 %0, -1 > -; CHECK: br i1 true > br i1 %cmp, label %cond.true, label %cond.false > > cond.true: > @@ -32,9 +31,10 @@ > ret i8* %2; > } > > +; FIXME: This should return 0. > define i32 @f() nounwind { > ; CHECK: @f > -; CHECK-NEXT: ret i32 0 > +; CHECK-NEXT: ret i32 -1 > %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* > @a, i32 1, i32 0), i1 false) > ret i32 %1 > } > @@ -43,7 +43,7 @@ > > define i1 @baz() nounwind { > ; CHECK: @baz > -; CHECK-NEXT: llvm.objectsize.i32 > +; CHECK-NEXT: icmp eq i32 -1, -1 > %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr inbounds > ([0 x i8]* @window, i32 0, i32 0), i1 false) > %2 = icmp eq i32 %1, -1 > ret i1 %2 > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From scallanan at apple.com Mon Feb 8 19:00:18 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 09 Feb 2010 01:00:18 -0000 Subject: [llvm-commits] [llvm] r95639 - /llvm/trunk/tools/edis/EDToken.cpp Message-ID: <201002090100.o1910IMm018903@zion.cs.uiuc.edu> Author: spyffe Date: Mon Feb 8 19:00:18 2010 New Revision: 95639 URL: http://llvm.org/viewvc/llvm-project?rev=95639&view=rev Log: Fixed a problem where the enhanced disassembly library was reporting inaccurate token IDs. Modified: llvm/trunk/tools/edis/EDToken.cpp Modified: llvm/trunk/tools/edis/EDToken.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EDToken.cpp?rev=95639&r1=95638&r2=95639&view=diff ============================================================================== --- llvm/trunk/tools/edis/EDToken.cpp (original) +++ llvm/trunk/tools/edis/EDToken.cpp Mon Feb 8 19:00:18 2010 @@ -94,7 +94,8 @@ SmallVector parsedOperands; SmallVector asmTokens; - disassembler.parseInst(parsedOperands, asmTokens, str); + if(disassembler.parseInst(parsedOperands, asmTokens, str)) + return -1; SmallVectorImpl::iterator operandIterator; unsigned int operandIndex; @@ -167,7 +168,12 @@ if(operandIterator != parsedOperands.end() && tokenLoc.getPointer() >= (*operandIterator)->getStartLoc().getPointer()) { - token->setOperandID(operandOrder[operandIndex]); + /// operandIndex == 0 means the operand is the instruction (which the + /// AsmParser treats as an operand but edis does not). We therefore skip + /// operandIndex == 0 and subtract 1 from all other operand indices. + + if(operandIndex > 0) + token->setOperandID(operandOrder[operandIndex - 1]); } tokens.push_back(token); From echristo at apple.com Mon Feb 8 19:10:06 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 8 Feb 2010 17:10:06 -0800 Subject: [llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll In-Reply-To: References: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> Message-ID: <5F815507-0C36-4C8D-9E6F-7C6F484A1E5F@apple.com> On Feb 8, 2010, at 4:58 PM, Chris Lattner wrote: > > On Feb 8, 2010, at 4:35 PM, Eric Christopher wrote: > >> Author: echristo >> Date: Mon Feb 8 18:35:38 2010 >> New Revision: 95628 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95628&view=rev >> Log: >> Add a new pass to do llvm.objsize lowering using SCEV. >> Initial skeleton and SCEVUnknown lowering implemented, >> the rest should come relatively quickly. Move testcase >> to new directory. >> >> Move pass to right before SimplifyLibCalls - which is >> moved down a bit so we can take advantage of a few opts. > > Why is this using SCEV? Isn't this massive overkill? How smart does this really need to be? Right now, yes, it's a big hammer. However, for various different permutations of geps etc I found I was duplicating (iteratively) a lot of SCEV's internal code to determine offsets into objects etc. Ideally we'd also like to use that along with loop information to be able to tell something like this: char buffer[128]; for (int i = 0; i < 128; i++) strcpy(buffer[i], "f") or assorted and tell that we're not going to overrun the buffer and lower to an explicit strcpy instead of the checking version. -eric From echristo at apple.com Mon Feb 8 19:11:03 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 09 Feb 2010 01:11:03 -0000 Subject: [llvm-commits] [llvm] r95641 - /llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Message-ID: <201002090111.o191B3Pb019449@zion.cs.uiuc.edu> Author: echristo Date: Mon Feb 8 19:11:03 2010 New Revision: 95641 URL: http://llvm.org/viewvc/llvm-project?rev=95641&view=rev Log: Add file in here too. Modified: llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Modified: llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt?rev=95641&r1=95640&r2=95641&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Mon Feb 8 19:11:03 2010 @@ -18,6 +18,7 @@ LoopUnrollPass.cpp LoopUnswitch.cpp MemCpyOptimizer.cpp + ObjectSizeLowering.cpp Reassociate.cpp Reg2Mem.cpp SCCP.cpp From sabre at nondot.org Mon Feb 8 19:12:41 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 01:12:41 -0000 Subject: [llvm-commits] [llvm] r95642 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp test/Transforms/InstCombine/crash.ll Message-ID: <201002090112.o191CfwD019511@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 19:12:41 2010 New Revision: 95642 URL: http://llvm.org/viewvc/llvm-project?rev=95642&view=rev Log: fix PR6193, only considering sign extensions *from i1* for this xform. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp llvm/trunk/test/Transforms/InstCombine/crash.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95642&r1=95641&r2=95642&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Feb 8 19:12:41 2010 @@ -1142,19 +1142,24 @@ Value *C, Value *D) { // If A is not a select of -1/0, this cannot match. Value *Cond = 0; - if (!match(A, m_SExt(m_Value(Cond)))) + if (!match(A, m_SExt(m_Value(Cond))) || + !Cond->getType()->isInteger(1)) return 0; // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. - if (match(D, m_Not(m_SExt(m_Specific(Cond))))) + if (match(D, m_Not(m_SExt(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, B); - if (match(D, m_SExt(m_Not(m_Specific(Cond))))) + if (match(D, m_SExt(m_Not(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. - if (match(B, m_Not(m_SExt(m_Specific(Cond))))) + if (match(B, m_Not(m_SExt(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, D); - if (match(B, m_SExt(m_Not(m_Specific(Cond))))) + if (match(B, m_SExt(m_Not(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, D); return 0; } Modified: llvm/trunk/test/Transforms/InstCombine/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/crash.ll?rev=95642&r1=95641&r2=95642&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/crash.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/crash.ll Mon Feb 8 19:12:41 2010 @@ -226,3 +226,14 @@ ret void } + +; PR6193 +define i32 @test11(i32 %aMaskWidth, i8 %aStride) nounwind { +entry: + %conv41 = sext i8 %aStride to i32 + %neg = xor i32 %conv41, -1 + %and42 = and i32 %aMaskWidth, %neg + %and47 = and i32 130, %conv41 + %or = or i32 %and42, %and47 + ret i32 %or +} From sabre at nondot.org Mon Feb 8 19:14:07 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 01:14:07 -0000 Subject: [llvm-commits] [llvm] r95643 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Message-ID: <201002090114.o191E7iI019584@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 19:14:06 2010 New Revision: 95643 URL: http://llvm.org/viewvc/llvm-project?rev=95643&view=rev Log: simplify this code, duh. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95643&r1=95642&r2=95643&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Feb 8 19:14:06 2010 @@ -1147,19 +1147,15 @@ return 0; // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. - if (match(D, m_Not(m_SExt(m_Specific(Cond)))) && - Cond->getType()->isInteger(1)) + if (match(D, m_Not(m_SExt(m_Specific(Cond))))) return SelectInst::Create(Cond, C, B); - if (match(D, m_SExt(m_Not(m_Specific(Cond)))) && - Cond->getType()->isInteger(1)) + if (match(D, m_SExt(m_Not(m_Specific(Cond))))) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. - if (match(B, m_Not(m_SExt(m_Specific(Cond)))) && - Cond->getType()->isInteger(1)) + if (match(B, m_Not(m_SExt(m_Specific(Cond))))) return SelectInst::Create(Cond, C, D); - if (match(B, m_SExt(m_Not(m_Specific(Cond)))) && - Cond->getType()->isInteger(1)) + if (match(B, m_SExt(m_Not(m_Specific(Cond))))) return SelectInst::Create(Cond, C, D); return 0; } From sabre at nondot.org Mon Feb 8 19:39:46 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 01:39:46 -0000 Subject: [llvm-commits] [llvm] r95644 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Message-ID: <201002090139.o191dkhD021364@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 19:39:46 2010 New Revision: 95644 URL: http://llvm.org/viewvc/llvm-project?rev=95644&view=rev Log: fix llvm_build_struct_gep for PR6167, patch by Peter Hawkins! Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=95644&r1=95643&r2=95644&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Mon Feb 8 19:39:46 2010 @@ -1263,11 +1263,10 @@ /* llvalue -> int -> string -> llbuilder -> llvalue */ CAMLprim LLVMValueRef llvm_build_struct_gep(LLVMValueRef Pointer, - value Indices, value Name, + value Index, value Name, value B) { - return LLVMBuildInBoundsGEP(Builder_val(B), Pointer, - (LLVMValueRef *) Op_val(Indices), - Wosize_val(Indices), String_val(Name)); + return LLVMBuildStructGEP(Builder_val(B), Pointer, + Int_val(Index), String_val(Name)); } /* string -> string -> llbuilder -> llvalue */ From scallanan at apple.com Mon Feb 8 19:50:54 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 09 Feb 2010 01:50:54 -0000 Subject: [llvm-commits] [llvm] r95645 - /llvm/trunk/tools/edis/EDToken.cpp Message-ID: <201002090150.o191osQn022409@zion.cs.uiuc.edu> Author: spyffe Date: Mon Feb 8 19:50:54 2010 New Revision: 95645 URL: http://llvm.org/viewvc/llvm-project?rev=95645&view=rev Log: Updated the enhanced disassembly library to produce whitespace tokens in the right places. Modified: llvm/trunk/tools/edis/EDToken.cpp Modified: llvm/trunk/tools/edis/EDToken.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EDToken.cpp?rev=95645&r1=95644&r2=95645&view=diff ============================================================================== --- llvm/trunk/tools/edis/EDToken.cpp (original) +++ llvm/trunk/tools/edis/EDToken.cpp Mon Feb 8 19:50:54 2010 @@ -106,11 +106,28 @@ bool readOpcode = false; + const char *wsPointer = asmTokens.begin()->getLoc().getPointer(); + for (tokenIterator = asmTokens.begin(); tokenIterator != asmTokens.end(); ++tokenIterator) { SMLoc tokenLoc = tokenIterator->getLoc(); + const char *tokenPointer = tokenLoc.getPointer(); + + if(tokenPointer > wsPointer) { + unsigned long wsLength = tokenPointer - wsPointer; + + EDToken *whitespaceToken = new EDToken(StringRef(wsPointer, wsLength), + EDToken::kTokenWhitespace, + 0, + disassembler); + + tokens.push_back(whitespaceToken); + } + + wsPointer = tokenPointer + tokenIterator->getString().size(); + while (operandIterator != parsedOperands.end() && tokenLoc.getPointer() > (*operandIterator)->getEndLoc().getPointer()) { From dpatel at apple.com Mon Feb 8 19:58:33 2010 From: dpatel at apple.com (Devang Patel) Date: Tue, 09 Feb 2010 01:58:33 -0000 Subject: [llvm-commits] [llvm] r95646 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <201002090158.o191wXRO023064@zion.cs.uiuc.edu> Author: dpatel Date: Mon Feb 8 19:58:33 2010 New Revision: 95646 URL: http://llvm.org/viewvc/llvm-project?rev=95646&view=rev Log: Add declaration attribute to a variable DIE, if there is a separate DIE for the definition. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=95646&r1=95645&r2=95646&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Feb 8 19:58:33 2010 @@ -1720,6 +1720,7 @@ addObjectLabel(Block, 0, dwarf::DW_FORM_udata, Asm->GetGlobalValueSymbol(DI_GV.getGlobal())); addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block); + addUInt(VariableDie, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag, 1); ModuleCU->addDie(VariableSpecDIE); } else { DIEBlock *Block = new DIEBlock(); From dalej at apple.com Mon Feb 8 20:01:46 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 09 Feb 2010 02:01:46 -0000 Subject: [llvm-commits] [llvm] r95647 - in /llvm/trunk/lib/CodeGen: CalcSpillWeights.cpp LiveVariables.cpp TwoAddressInstructionPass.cpp Message-ID: <201002090201.o1921kNj023388@zion.cs.uiuc.edu> Author: johannes Date: Mon Feb 8 20:01:46 2010 New Revision: 95647 URL: http://llvm.org/viewvc/llvm-project?rev=95647&view=rev Log: Skip DEBUG_VALUE in some places where it was affecting codegen. Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=95647&r1=95646&r2=95647&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Mon Feb 8 20:01:46 2010 @@ -64,6 +64,9 @@ if (mi->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) continue; + if (mi->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + continue; + for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { const MachineOperand &mopi = mi->getOperand(i); if (!mopi.isReg() || mopi.getReg() == 0) Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=95647&r1=95646&r2=95647&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Mon Feb 8 20:01:46 2010 @@ -543,6 +543,8 @@ for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { MachineInstr *MI = I; + if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + continue; DistanceMap.insert(std::make_pair(MI, Dist++)); // Process all of the operands of the instruction... Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=95647&r1=95646&r2=95647&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Feb 8 20:01:46 2010 @@ -318,6 +318,8 @@ MachineInstr *MI = MO.getParent(); if (MI->getParent() != MBB) continue; + if (MI->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + continue; DenseMap::iterator DI = DistanceMap.find(MI); if (DI == DistanceMap.end()) continue; @@ -341,6 +343,8 @@ MachineInstr *MI = MO.getParent(); if (MI->getParent() != MBB) continue; + if (MI->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + continue; DenseMap::iterator DI = DistanceMap.find(MI); if (DI == DistanceMap.end()) continue; From baldrick at free.fr Mon Feb 8 22:38:04 2010 From: baldrick at free.fr (Duncan Sands) Date: Tue, 09 Feb 2010 05:38:04 +0100 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h In-Reply-To: <61F6705E-E1B0-4575-BA0B-A365D0960DDB@apple.com> References: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> <4B707AEE.9010508@free.fr> <61F6705E-E1B0-4575-BA0B-A365D0960DDB@apple.com> Message-ID: <4B70E6AC.2030209@free.fr> Hi Chris, >>> Why not just use isa? >>> This encourages code to diverge in style. >> >> since there already is isFloat, isInteger and variations, it seems odd >> not >> to have these too. Of course, I could just delete all the guys with >> an "isa" >> version. What do you think? > > isInteger is required because we need an argument. actually there are two versions of isInteger, one which takes a bitwidth argument, and one which just checks the ID. I don't really care > one way or another though, so long as the code is consistent. Are you > willing to change all isa(x) to X->isPointer() ? I was actually suggesting getting rid of all the bool isInteger() const { return ID == IntegerTyID; } style methods, and changing them to isa etc (I guess I didn't phrase this clearly). However, I might be persuaded to do it the other way round :) An argument is favour of ...->isInteger() is that it is about 30% shorter than isa(...). On the other hand, "isa" is consistent with all the other classes, isa etc. Personally I'm not fussed by having both styles, but if you feel strongly about it I am prepared to do some work to improve the situation. Ciao, Duncan. From clattner at apple.com Mon Feb 8 23:03:54 2010 From: clattner at apple.com (Chris Lattner) Date: Mon, 8 Feb 2010 21:03:54 -0800 Subject: [llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h In-Reply-To: <4B70E6AC.2030209@free.fr> References: <201002081936.o18JapTB003156@zion.cs.uiuc.edu> <4B707AEE.9010508@free.fr> <61F6705E-E1B0-4575-BA0B-A365D0960DDB@apple.com> <4B70E6AC.2030209@free.fr> Message-ID: On Feb 8, 2010, at 8:38 PM, Duncan Sands wrote: > Hi Chris, > >>>> Why not just use isa? >>>> This encourages code to diverge in style. >>> >>> since there already is isFloat, isInteger and variations, it seems odd not >>> to have these too. Of course, I could just delete all the guys with an "isa" >>> version. What do you think? >> isInteger is required because we need an argument. > > actually there are two versions of isInteger, one which takes a bitwidth > argument, and one which just checks the ID. > > I don't really care >> one way or another though, so long as the code is consistent. Are you willing to change all isa(x) to X->isPointer() ? > > I was actually suggesting getting rid of all the > > bool isInteger() const { return ID == IntegerTyID; } > > style methods, and changing them to isa etc (I guess I didn't > phrase this clearly). Ah, ok! Sure, I'd be fine with that. > However, I might be persuaded to do it the other way > round :) An argument is favour of ...->isInteger() is that it is about 30% > shorter than isa(...). On the other hand, "isa" is consistent > with all the other classes, isa etc. Personally I'm not fussed > by having both styles, but if you feel strongly about it I am prepared to do > some work to improve the situation. Terseness is nice, but I think the most compelling thing about Foo->isInteger() is that it reads better IMO. -Chris From sabre at nondot.org Mon Feb 8 23:45:31 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 05:45:31 -0000 Subject: [llvm-commits] [llvm] r95649 - /llvm/trunk/lib/Target/X86/README-SSE.txt Message-ID: <201002090545.o195jVvO002297@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 23:45:29 2010 New Revision: 95649 URL: http://llvm.org/viewvc/llvm-project?rev=95649&view=rev Log: add a note from PR6194 Modified: llvm/trunk/lib/Target/X86/README-SSE.txt Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=95649&r1=95648&r2=95649&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Mon Feb 8 23:45:29 2010 @@ -954,3 +954,36 @@ //===---------------------------------------------------------------------===// +This IR (from PR6194): + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + +%0 = type { double, double } +%struct.float3 = type { float, float, float } + +define void @test(%0, %struct.float3* nocapture %res) nounwind noinline ssp { +entry: + %tmp18 = extractvalue %0 %0, 0 ; [#uses=1] + %tmp19 = bitcast double %tmp18 to i64 ; [#uses=1] + %tmp20 = zext i64 %tmp19 to i128 ; [#uses=1] + %tmp10 = lshr i128 %tmp20, 32 ; [#uses=1] + %tmp11 = trunc i128 %tmp10 to i32 ; [#uses=1] + %tmp12 = bitcast i32 %tmp11 to float ; [#uses=1] + %tmp5 = getelementptr inbounds %struct.float3* %res, i64 0, i32 1 ; [#uses=1] + store float %tmp12, float* %tmp5 + ret void +} + +Compiles to: + +_test: ## @test + movd %xmm0, %rax + shrq $32, %rax + movl %eax, 4(%rdi) + ret + +This would be better kept in the SSE unit by treating XMM0 as a 4xfloat and +doing a shuffle from v[1] to v[0] then a float store. + +//===---------------------------------------------------------------------===// From sabre at nondot.org Mon Feb 8 23:55:14 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 05:55:14 -0000 Subject: [llvm-commits] [llvm] r95650 - /llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt Message-ID: <201002090555.o195tEAx003028@zion.cs.uiuc.edu> Author: lattner Date: Mon Feb 8 23:55:14 2010 New Revision: 95650 URL: http://llvm.org/viewvc/llvm-project?rev=95650&view=rev Log: move PR3462 to here. Modified: llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt Modified: llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt?rev=95650&r1=95649&r2=95650&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt (original) +++ llvm/trunk/lib/Target/X86/README-UNIMPLEMENTED.txt Mon Feb 8 23:55:14 2010 @@ -11,4 +11,4 @@ 2) vector comparisons 3) vector fp<->int conversions: PR2683, PR2684, PR2685, PR2686, PR2688 4) bitcasts from vectors to scalars: PR2804 - +5) llvm.atomic.cmp.swap.i128.p0i128: PR3462 From sabre at nondot.org Tue Feb 9 00:19:20 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:19:20 -0000 Subject: [llvm-commits] [llvm] r95651 - in /llvm/trunk/test/CodeGen/Generic: switch-lower-feature-2.ll switch-lower-feature.ll Message-ID: <201002090619.o196JKOv004646@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:19:20 2010 New Revision: 95651 URL: http://llvm.org/viewvc/llvm-project?rev=95651&view=rev Log: merge two tests, make target independent. Removed: llvm/trunk/test/CodeGen/Generic/switch-lower-feature-2.ll Modified: llvm/trunk/test/CodeGen/Generic/switch-lower-feature.ll Removed: llvm/trunk/test/CodeGen/Generic/switch-lower-feature-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/switch-lower-feature-2.ll?rev=95650&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/switch-lower-feature-2.ll (original) +++ llvm/trunk/test/CodeGen/Generic/switch-lower-feature-2.ll (removed) @@ -1,50 +0,0 @@ -; RUN: llc < %s -march=x86 -o %t -; RUN: grep jb %t | count 1 -; RUN: grep \\\$6 %t | count 2 -; RUN: grep 1024 %t | count 1 -; RUN: grep 1023 %t | count 1 -; RUN: grep 119 %t | count 1 -; RUN: grep JTI %t | count 2 -; RUN: grep jg %t | count 3 -; RUN: grep ja %t | count 1 -; RUN: grep jns %t | count 1 - -target triple = "i686-pc-linux-gnu" - -define i32 @main(i32 %tmp158) { -entry: - switch i32 %tmp158, label %bb336 [ - i32 -2147483648, label %bb338 - i32 -2147483647, label %bb338 - i32 -2147483646, label %bb338 - i32 120, label %bb338 - i32 121, label %bb339 - i32 122, label %bb340 - i32 123, label %bb341 - i32 124, label %bb342 - i32 125, label %bb343 - i32 126, label %bb336 - i32 1024, label %bb338 - i32 0, label %bb338 - i32 1, label %bb338 - i32 2, label %bb338 - i32 3, label %bb338 - i32 4, label %bb338 - i32 5, label %bb338 - ] -bb336: - ret i32 10 -bb338: - ret i32 11 -bb339: - ret i32 12 -bb340: - ret i32 13 -bb341: - ret i32 14 -bb342: - ret i32 15 -bb343: - ret i32 18 - -} Modified: llvm/trunk/test/CodeGen/Generic/switch-lower-feature.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/switch-lower-feature.ll?rev=95651&r1=95650&r2=95651&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/switch-lower-feature.ll (original) +++ llvm/trunk/test/CodeGen/Generic/switch-lower-feature.ll Tue Feb 9 00:19:20 2010 @@ -1,10 +1,6 @@ -; RUN: llc < %s -march=x86 -o - | grep {\$7} | count 1 -; RUN: llc < %s -march=x86 -o - | grep {\$6} | count 1 -; RUN: llc < %s -march=x86 -o - | grep 1024 | count 1 -; RUN: llc < %s -march=x86 -o - | grep jb | count 2 -; RUN: llc < %s -march=x86 -o - | grep je | count 1 +; RUN: llc < %s -define i32 @main(i32 %tmp158) { +define i32 @test(i32 %tmp158) { entry: switch i32 %tmp158, label %bb336 [ i32 120, label %bb338 @@ -27,3 +23,41 @@ bb338: ret i32 11 } + +define i32 @test2(i32 %tmp158) { +entry: + switch i32 %tmp158, label %bb336 [ + i32 -2147483648, label %bb338 + i32 -2147483647, label %bb338 + i32 -2147483646, label %bb338 + i32 120, label %bb338 + i32 121, label %bb339 + i32 122, label %bb340 + i32 123, label %bb341 + i32 124, label %bb342 + i32 125, label %bb343 + i32 126, label %bb336 + i32 1024, label %bb338 + i32 0, label %bb338 + i32 1, label %bb338 + i32 2, label %bb338 + i32 3, label %bb338 + i32 4, label %bb338 + i32 5, label %bb338 + ] +bb336: + ret i32 10 +bb338: + ret i32 11 +bb339: + ret i32 12 +bb340: + ret i32 13 +bb341: + ret i32 14 +bb342: + ret i32 15 +bb343: + ret i32 18 + +} From sabre at nondot.org Tue Feb 9 00:24:00 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:24:00 -0000 Subject: [llvm-commits] [llvm] r95652 - in /llvm/trunk/test/CodeGen/X86: add-trick32.ll add-trick64.ll add.ll Message-ID: <201002090624.o196O0et004852@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:24:00 2010 New Revision: 95652 URL: http://llvm.org/viewvc/llvm-project?rev=95652&view=rev Log: consolidate and filecheckize two tests. Added: llvm/trunk/test/CodeGen/X86/add.ll Removed: llvm/trunk/test/CodeGen/X86/add-trick32.ll llvm/trunk/test/CodeGen/X86/add-trick64.ll Removed: llvm/trunk/test/CodeGen/X86/add-trick32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add-trick32.ll?rev=95651&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/add-trick32.ll (original) +++ llvm/trunk/test/CodeGen/X86/add-trick32.ll (removed) @@ -1,11 +0,0 @@ -; RUN: llc < %s -march=x86 > %t -; RUN: not grep add %t -; RUN: grep subl %t | count 1 - -; The immediate can be encoded in a smaller way if the -; instruction is a sub instead of an add. - -define i32 @foo(i32 inreg %a) nounwind { - %b = add i32 %a, 128 - ret i32 %b -} Removed: llvm/trunk/test/CodeGen/X86/add-trick64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add-trick64.ll?rev=95651&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/add-trick64.ll (original) +++ llvm/trunk/test/CodeGen/X86/add-trick64.ll (removed) @@ -1,15 +0,0 @@ -; RUN: llc < %s -march=x86-64 > %t -; RUN: not grep add %t -; RUN: grep subq %t | count 2 - -; The immediate can be encoded in a smaller way if the -; instruction is a sub instead of an add. - -define i64 @foo(i64 inreg %a) nounwind { - %b = add i64 %a, 2147483648 - ret i64 %b -} -define i64 @bar(i64 inreg %a) nounwind { - %b = add i64 %a, 128 - ret i64 %b -} Added: llvm/trunk/test/CodeGen/X86/add.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add.ll?rev=95652&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/add.ll (added) +++ llvm/trunk/test/CodeGen/X86/add.ll Tue Feb 9 00:24:00 2010 @@ -0,0 +1,25 @@ +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 + +; The immediate can be encoded in a smaller way if the +; instruction is a sub instead of an add. + +define i32 @test1(i32 inreg %a) nounwind { + %b = add i32 %a, 128 + ret i32 %b +; X32: subl $-128, %eax +; X64: subl $-128, +} +define i64 @test2(i64 inreg %a) nounwind { + %b = add i64 %a, 2147483648 + ret i64 %b +; X32: addl $-2147483648, %eax +; X64: subq $-2147483648, +} +define i64 @test3(i64 inreg %a) nounwind { + %b = add i64 %a, 128 + ret i64 %b + +; X32: addl $128, %eax +; X64: subq $-128, +} From sabre at nondot.org Tue Feb 9 00:33:27 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:33:27 -0000 Subject: [llvm-commits] [llvm] r95653 - in /llvm/trunk/test/CodeGen/X86: add-with-overflow.ll add.ll Message-ID: <201002090633.o196XSWm005338@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:33:27 2010 New Revision: 95653 URL: http://llvm.org/viewvc/llvm-project?rev=95653&view=rev Log: merge another test in, drop the trivially constant folded cases. Removed: llvm/trunk/test/CodeGen/X86/add-with-overflow.ll Modified: llvm/trunk/test/CodeGen/X86/add.ll Removed: llvm/trunk/test/CodeGen/X86/add-with-overflow.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add-with-overflow.ll?rev=95652&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/add-with-overflow.ll (original) +++ llvm/trunk/test/CodeGen/X86/add-with-overflow.ll (removed) @@ -1,75 +0,0 @@ -; RUN: llc < %s -march=x86 | grep {jo} | count 2 -; RUN: llc < %s -march=x86 | grep {jb} | count 2 -; RUN: llc < %s -march=x86 -O0 | grep {jo} | count 2 -; RUN: llc < %s -march=x86 -O0 | grep {jb} | count 2 - - at ok = internal constant [4 x i8] c"%d\0A\00" - at no = internal constant [4 x i8] c"no\0A\00" - -define i1 @func1(i32 %v1, i32 %v2) nounwind { -entry: - %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) - %sum = extractvalue {i32, i1} %t, 0 - %obit = extractvalue {i32, i1} %t, 1 - br i1 %obit, label %overflow, label %normal - -normal: - %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind - ret i1 true - -overflow: - %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind - ret i1 false -} - -define i1 @func2(i32 %v1, i32 %v2) nounwind { -entry: - %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) - %sum = extractvalue {i32, i1} %t, 0 - %obit = extractvalue {i32, i1} %t, 1 - br i1 %obit, label %carry, label %normal - -normal: - %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind - ret i1 true - -carry: - %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind - ret i1 false -} - -define i1 @func3() nounwind { -entry: - %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 0, i32 0) - %sum = extractvalue {i32, i1} %t, 0 - %obit = extractvalue {i32, i1} %t, 1 - br i1 %obit, label %carry, label %normal - -normal: - %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind - ret i1 true - -carry: - %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind - ret i1 false -} - -define i1 @func4() nounwind { -entry: - %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 0, i32 0) - %sum = extractvalue {i32, i1} %t, 0 - %obit = extractvalue {i32, i1} %t, 1 - br i1 %obit, label %carry, label %normal - -normal: - %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind - ret i1 true - -carry: - %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind - ret i1 false -} - -declare i32 @printf(i8*, ...) nounwind -declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) -declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) Modified: llvm/trunk/test/CodeGen/X86/add.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add.ll?rev=95653&r1=95652&r2=95653&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/add.ll (original) +++ llvm/trunk/test/CodeGen/X86/add.ll Tue Feb 9 00:33:27 2010 @@ -23,3 +23,52 @@ ; X32: addl $128, %eax ; X64: subq $-128, } + +define i1 @test4(i32 %v1, i32 %v2, i32* %X) nounwind { +entry: + %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %overflow, label %normal + +normal: + store i32 0, i32* %X + br label %overflow + +overflow: + ret i1 false + +; X32: test4: +; X32: addl +; X32-NEXT: jo + +; X64: test4: +; X64: addl %esi, %edi +; X64-NEXT: jo +} + +define i1 @test5(i32 %v1, i32 %v2, i32* %X) nounwind { +entry: + %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %carry, label %normal + +normal: + store i32 0, i32* %X + br label %carry + +carry: + ret i1 false + +; X32: test5: +; X32: addl +; X32-NEXT: jb + +; X64: test5: +; X64: addl %esi, %edi +; X64-NEXT: jb +} + +declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) +declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) From sabre at nondot.org Tue Feb 9 00:35:50 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:35:50 -0000 Subject: [llvm-commits] [llvm] r95654 - in /llvm/trunk/test/CodeGen: Generic/addc-fold2.ll X86/add.ll Message-ID: <201002090635.o196Zol5005460@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:35:50 2010 New Revision: 95654 URL: http://llvm.org/viewvc/llvm-project?rev=95654&view=rev Log: merge a target-specific add test into x86 directory. Removed: llvm/trunk/test/CodeGen/Generic/addc-fold2.ll Modified: llvm/trunk/test/CodeGen/X86/add.ll Removed: llvm/trunk/test/CodeGen/Generic/addc-fold2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/addc-fold2.ll?rev=95653&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/addc-fold2.ll (original) +++ llvm/trunk/test/CodeGen/Generic/addc-fold2.ll (removed) @@ -1,10 +0,0 @@ -; RUN: llc < %s -march=x86 | grep add -; RUN: llc < %s -march=x86 | not grep adc - -define i64 @test(i64 %A, i32 %B) { - %tmp12 = zext i32 %B to i64 ; [#uses=1] - %tmp3 = shl i64 %tmp12, 32 ; [#uses=1] - %tmp5 = add i64 %tmp3, %A ; [#uses=1] - ret i64 %tmp5 -} - Modified: llvm/trunk/test/CodeGen/X86/add.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add.ll?rev=95654&r1=95653&r2=95654&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/add.ll (original) +++ llvm/trunk/test/CodeGen/X86/add.ll Tue Feb 9 00:35:50 2010 @@ -72,3 +72,23 @@ declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) + + +define i64 @test6(i64 %A, i32 %B) nounwind { + %tmp12 = zext i32 %B to i64 ; [#uses=1] + %tmp3 = shl i64 %tmp12, 32 ; [#uses=1] + %tmp5 = add i64 %tmp3, %A ; [#uses=1] + ret i64 %tmp5 + +; X32: test6: +; X32: movl 12(%esp), %edx +; X32-NEXT: addl 8(%esp), %edx +; X32-NEXT: movl 4(%esp), %eax +; X32-NEXT: ret + +; X64: test6: +; X64: shlq $32, %rsi +; X64: leaq (%rsi,%rdi), %rax +; X64: ret +} + From sabre at nondot.org Tue Feb 9 00:36:30 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:36:30 -0000 Subject: [llvm-commits] [llvm] r95655 - /llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll Message-ID: <201002090636.o196aU9A005506@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:36:30 2010 New Revision: 95655 URL: http://llvm.org/viewvc/llvm-project?rev=95655&view=rev Log: make target independent. Modified: llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll Modified: llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll?rev=95655&r1=95654&r2=95655&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll (original) +++ llvm/trunk/test/CodeGen/Generic/fpowi-promote.ll Tue Feb 9 00:36:30 2010 @@ -1,5 +1,4 @@ ; RUN: llc < %s -; RUN: llc < %s -march=x86 -mcpu=i386 ; PR1239 From sabre at nondot.org Tue Feb 9 00:41:03 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 06:41:03 -0000 Subject: [llvm-commits] [llvm] r95656 - in /llvm/trunk/test/CodeGen: Generic/ X86/ Message-ID: <201002090641.o196f4JO005764@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 00:41:03 2010 New Revision: 95656 URL: http://llvm.org/viewvc/llvm-project?rev=95656&view=rev Log: move tests that depend on the x86 backend out of codegen/generic, and remove a few old and unreduced ones. Fixes PR5624. Added: llvm/trunk/test/CodeGen/X86/2006-12-16-InlineAsmCrash.ll - copied unchanged from r95428, llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll llvm/trunk/test/CodeGen/X86/2007-02-23-DAGCombine-Miscompile.ll - copied unchanged from r95428, llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll llvm/trunk/test/CodeGen/X86/SwitchLowering.ll - copied unchanged from r95428, llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll llvm/trunk/test/CodeGen/X86/phi-immediate-factoring.ll - copied unchanged from r95428, llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll llvm/trunk/test/CodeGen/X86/switch-crit-edge-constant.ll - copied unchanged from r95428, llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll Removed: llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll Modified: llvm/trunk/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll Removed: llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2006-04-11-vecload.ll (removed) @@ -1,12 +0,0 @@ -; RUN: llc < %s -march=x86 -mcpu=yonah - -; The vload was getting memoized to the previous scalar load! - -define void @VertexProgram2() { - %xFloat0.688 = load float* null ; [#uses=0] - %loadVector37.712 = load <4 x float>* null ; <<4 x float>> [#uses=1] - %inFloat3.713 = insertelement <4 x float> %loadVector37.712, float 0.000000e+00, i32 3 ; <<4 x float>> [#uses=1] - store <4 x float> %inFloat3.713, <4 x float>* null - unreachable -} - Removed: llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll (removed) @@ -1,11 +0,0 @@ -; RUN: llc < %s -march=x86 | not grep adc -; PR987 - -declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) - -define void @foo(i64 %a) { - %b = add i64 %a, 1 ; [#uses=1] - call void @llvm.memcpy.i64( i8* null, i8* null, i64 %b, i32 1 ) - ret void -} - Removed: llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll (removed) @@ -1,30 +0,0 @@ -; RUN: llc < %s -march=x86 -; PR1049 -target datalayout = "e-p:32:32" -target triple = "i686-pc-linux-gnu" - %struct.QBasicAtomic = type { i32 } - %struct.QByteArray = type { %"struct.QByteArray::Data"* } - %"struct.QByteArray::Data" = type { %struct.QBasicAtomic, i32, i32, i8*, [1 x i8] } - %struct.QFactoryLoader = type { %struct.QObject } - %struct.QImageIOHandler = type { i32 (...)**, %struct.QImageIOHandlerPrivate* } - %struct.QImageIOHandlerPrivate = type opaque - %struct.QImageWriter = type { %struct.QImageWriterPrivate* } - %struct.QImageWriterPrivate = type { %struct.QByteArray, %struct.QFactoryLoader*, i1, %struct.QImageIOHandler*, i32, float, %struct.QString, %struct.QString, i32, %struct.QString, %struct.QImageWriter* } - %"struct.QList" = type { %"struct.QList::._20" } - %"struct.QList::._20" = type { %struct.QListData } - %struct.QListData = type { %"struct.QListData::Data"* } - %"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x i8*] } - %struct.QObject = type { i32 (...)**, %struct.QObjectData* } - %struct.QObjectData = type { i32 (...)**, %struct.QObject*, %struct.QObject*, %"struct.QList", i8, [3 x i8], i32, i32 } - %struct.QString = type { %"struct.QString::Data"* } - %"struct.QString::Data" = type { %struct.QBasicAtomic, i32, i32, i16*, i8, i8, [1 x i16] } - -define i1 @_ZNK12QImageWriter8canWriteEv() { - %tmp62 = load %struct.QImageWriterPrivate** null ; <%struct.QImageWriterPrivate*> [#uses=1] - %tmp = getelementptr %struct.QImageWriterPrivate* %tmp62, i32 0, i32 9 ; <%struct.QString*> [#uses=1] - %tmp75 = call %struct.QString* @_ZN7QStringaSERKS_( %struct.QString* %tmp, %struct.QString* null ) ; <%struct.QString*> [#uses=0] - call void asm sideeffect "lock\0Adecl $0\0Asetne 1", "=*m"( i32* null ) - ret i1 false -} - -declare %struct.QString* @_ZN7QStringaSERKS_(%struct.QString*, %struct.QString*) Removed: llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll (removed) @@ -1,13 +0,0 @@ -; PR1219 -; RUN: llc < %s -march=x86 | grep {movl \$1, %eax} - -define i32 @test(i1 %X) { -old_entry1: - %hvar2 = zext i1 %X to i32 - %C = icmp sgt i32 %hvar2, -1 - br i1 %C, label %cond_true15, label %cond_true -cond_true15: - ret i32 1 -cond_true: - ret i32 2 -} Removed: llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll (removed) @@ -1,160 +0,0 @@ -; RUN: llc < %s -march=x86 | grep 8388635 -; RUN: llc < %s -march=x86-64 | grep 4294981120 -; PR 1325 - -; ModuleID = 'bugpoint.test.bc' -target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "powerpc-apple-darwin8.8.0" -;target triple = "i686-linux-gnu" - %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } - %struct.__sFILEX = type opaque - %struct.__sbuf = type { i8*, i32 } - at PL_rsfp = external global %struct.FILE* ; <%struct.FILE**> [#uses=1] - at PL_bufend = external global i8* ; [#uses=1] - at PL_in_eval = external global i32 ; [#uses=1] - -declare fastcc void @incline(i8*) - -define i16 @Perl_skipspace_bb60(i8* %s, i8** %s_addr.4.out) { -newFuncRoot: - %tmp138.loc = alloca i8* ; [#uses=2] - %s_addr.4.loc = alloca i8* ; [#uses=2] - %tmp274.loc = alloca i8* ; [#uses=2] - br label %bb60 - -cond_next154.UnifiedReturnBlock_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 0 - -cond_next161.UnifiedReturnBlock_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 1 - -cond_next167.UnifiedReturnBlock_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 2 - -cond_false29.i.cond_true190_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 3 - -cond_next.i.cond_true190_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 4 - -cond_true19.i.cond_true190_crit_edge.exitStub: ; preds = %codeRepl - store i8* %s_addr.4.reload, i8** %s_addr.4.out - ret i16 5 - -bb60: ; preds = %bb60.backedge, %newFuncRoot - %s_addr.2 = phi i8* [ %s, %newFuncRoot ], [ %s_addr.2.be, %bb60.backedge ] ; [#uses=3] - %tmp61 = load i8** @PL_bufend ; [#uses=1] - %tmp63 = icmp ult i8* %s_addr.2, %tmp61 ; [#uses=1] - br i1 %tmp63, label %bb60.cond_next67_crit_edge, label %bb60.bb101_crit_edge - -bb37: ; preds = %cond_next67.bb37_crit_edge5, %cond_next67.bb37_crit_edge4, %cond_next67.bb37_crit_edge3, %cond_next67.bb37_crit_edge2, %cond_next67.bb37_crit_edge - %tmp40 = icmp eq i8 %tmp69, 10 ; [#uses=1] - %tmp43 = getelementptr i8* %s_addr.27.2, i32 1 ; [#uses=5] - br i1 %tmp40, label %cond_true45, label %bb37.bb60_crit_edge - -cond_true45: ; preds = %bb37 - %tmp46 = volatile load i32* @PL_in_eval ; [#uses=1] - %tmp47 = icmp eq i32 %tmp46, 0 ; [#uses=1] - br i1 %tmp47, label %cond_true45.bb60_crit_edge, label %cond_true50 - -cond_true50: ; preds = %cond_true45 - %tmp51 = volatile load %struct.FILE** @PL_rsfp ; <%struct.FILE*> [#uses=1] - %tmp52 = icmp eq %struct.FILE* %tmp51, null ; [#uses=1] - br i1 %tmp52, label %cond_true55, label %cond_true50.bb60_crit_edge - -cond_true55: ; preds = %cond_true50 - tail call fastcc void @incline( i8* %tmp43 ) - br label %bb60.backedge - -cond_next67: ; preds = %Perl_newSV.exit.cond_next67_crit_edge, %cond_true148.cond_next67_crit_edge, %bb60.cond_next67_crit_edge - %s_addr.27.2 = phi i8* [ %s_addr.2, %bb60.cond_next67_crit_edge ], [ %tmp274.reload, %Perl_newSV.exit.cond_next67_crit_edge ], [ %tmp138.reload, %cond_true148.cond_next67_crit_edge ] ; [#uses=3] - %tmp69 = load i8* %s_addr.27.2 ; [#uses=2] - switch i8 %tmp69, label %cond_next67.bb101_crit_edge [ - i8 32, label %cond_next67.bb37_crit_edge - i8 9, label %cond_next67.bb37_crit_edge2 - i8 10, label %cond_next67.bb37_crit_edge3 - i8 13, label %cond_next67.bb37_crit_edge4 - i8 12, label %cond_next67.bb37_crit_edge5 - ] - -codeRepl: ; preds = %bb101.preheader - %targetBlock = call i16 @Perl_skipspace_bb60_bb101( i8* %s_addr.27.3.ph, i8** %tmp274.loc, i8** %s_addr.4.loc, i8** %tmp138.loc ) ; [#uses=1] - %tmp274.reload = load i8** %tmp274.loc ; [#uses=4] - %s_addr.4.reload = load i8** %s_addr.4.loc ; [#uses=6] - %tmp138.reload = load i8** %tmp138.loc ; [#uses=1] - switch i16 %targetBlock, label %cond_true19.i.cond_true190_crit_edge.exitStub [ - i16 0, label %cond_next271.bb60_crit_edge - i16 1, label %cond_true290.bb60_crit_edge - i16 2, label %cond_true295.bb60_crit_edge - i16 3, label %Perl_newSV.exit.cond_next67_crit_edge - i16 4, label %cond_true148.cond_next67_crit_edge - i16 5, label %cond_next154.UnifiedReturnBlock_crit_edge.exitStub - i16 6, label %cond_next161.UnifiedReturnBlock_crit_edge.exitStub - i16 7, label %cond_next167.UnifiedReturnBlock_crit_edge.exitStub - i16 8, label %cond_false29.i.cond_true190_crit_edge.exitStub - i16 9, label %cond_next.i.cond_true190_crit_edge.exitStub - ] - -bb37.bb60_crit_edge: ; preds = %bb37 - br label %bb60.backedge - -cond_true45.bb60_crit_edge: ; preds = %cond_true45 - br label %bb60.backedge - -cond_true50.bb60_crit_edge: ; preds = %cond_true50 - br label %bb60.backedge - -bb60.cond_next67_crit_edge: ; preds = %bb60 - br label %cond_next67 - -bb60.bb101_crit_edge: ; preds = %bb60 - br label %bb101.preheader - -cond_next67.bb101_crit_edge: ; preds = %cond_next67 - br label %bb101.preheader - -cond_next67.bb37_crit_edge: ; preds = %cond_next67 - br label %bb37 - -cond_next67.bb37_crit_edge2: ; preds = %cond_next67 - br label %bb37 - -cond_next67.bb37_crit_edge3: ; preds = %cond_next67 - br label %bb37 - -cond_next67.bb37_crit_edge4: ; preds = %cond_next67 - br label %bb37 - -cond_next67.bb37_crit_edge5: ; preds = %cond_next67 - br label %bb37 - -cond_true148.cond_next67_crit_edge: ; preds = %codeRepl - br label %cond_next67 - -cond_next271.bb60_crit_edge: ; preds = %codeRepl - br label %bb60.backedge - -cond_true290.bb60_crit_edge: ; preds = %codeRepl - br label %bb60.backedge - -cond_true295.bb60_crit_edge: ; preds = %codeRepl - br label %bb60.backedge - -Perl_newSV.exit.cond_next67_crit_edge: ; preds = %codeRepl - br label %cond_next67 - -bb101.preheader: ; preds = %cond_next67.bb101_crit_edge, %bb60.bb101_crit_edge - %s_addr.27.3.ph = phi i8* [ %s_addr.27.2, %cond_next67.bb101_crit_edge ], [ %s_addr.2, %bb60.bb101_crit_edge ] ; [#uses=1] - br label %codeRepl - -bb60.backedge: ; preds = %cond_true295.bb60_crit_edge, %cond_true290.bb60_crit_edge, %cond_next271.bb60_crit_edge, %cond_true50.bb60_crit_edge, %cond_true45.bb60_crit_edge, %bb37.bb60_crit_edge, %cond_true55 - %s_addr.2.be = phi i8* [ %tmp43, %cond_true55 ], [ %tmp43, %bb37.bb60_crit_edge ], [ %tmp43, %cond_true45.bb60_crit_edge ], [ %tmp43, %cond_true50.bb60_crit_edge ], [ %tmp274.reload, %cond_next271.bb60_crit_edge ], [ %tmp274.reload, %cond_true290.bb60_crit_edge ], [ %tmp274.reload, %cond_true295.bb60_crit_edge ] ; [#uses=1] - br label %bb60 -} - -declare i16 @Perl_skipspace_bb60_bb101(i8*, i8**, i8**, i8**) Removed: llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll (removed) @@ -1,18 +0,0 @@ -; RUN: llc < %s -march=x86 | grep je | count 3 -; RUN: llc < %s -march=x86-64 | grep 4297064449 -; PR 1325+ - -define i32 @foo(i8 %bar) { -entry: - switch i8 %bar, label %bb1203 [ - i8 117, label %bb1204 - i8 85, label %bb1204 - i8 106, label %bb1204 - ] - -bb1203: ; preds = %entry - ret i32 1 - -bb1204: ; preds = %entry, %entry, %entry - ret i32 2 -} Modified: llvm/trunk/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll?rev=95656&r1=95655&r2=95656&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll (original) +++ llvm/trunk/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll Tue Feb 9 00:41:03 2010 @@ -1,4 +1,4 @@ -; RUN: llc < %s -enable-eh -march=x86 +; RUN: llc < %s -enable-eh %struct.exception = type { i8, i8, i32, i8*, i8*, i32, i8* } @program_error = external global %struct.exception ; <%struct.exception*> [#uses=1] Removed: llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll (original) +++ llvm/trunk/test/CodeGen/Generic/SwitchLowering.ll (removed) @@ -1,28 +0,0 @@ -; RUN: llc < %s -march=x86 | grep cmp | count 1 -; PR964 - -define i8* @FindChar(i8* %CurPtr) { -entry: - br label %bb - -bb: ; preds = %bb, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=3] - %CurPtr_addr.0.rec = bitcast i32 %indvar to i32 ; [#uses=1] - %gep.upgrd.1 = zext i32 %indvar to i64 ; [#uses=1] - %CurPtr_addr.0 = getelementptr i8* %CurPtr, i64 %gep.upgrd.1 ; [#uses=1] - %tmp = load i8* %CurPtr_addr.0 ; [#uses=3] - %tmp2.rec = add i32 %CurPtr_addr.0.rec, 1 ; [#uses=1] - %tmp2 = getelementptr i8* %CurPtr, i32 %tmp2.rec ; [#uses=1] - %indvar.next = add i32 %indvar, 1 ; [#uses=1] - switch i8 %tmp, label %bb [ - i8 0, label %bb7 - i8 120, label %bb7 - ] - -bb7: ; preds = %bb, %bb - tail call void @foo( i8 %tmp ) - ret i8* %tmp2 -} - -declare void @foo(i8) - Removed: llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll (original) +++ llvm/trunk/test/CodeGen/Generic/phi-immediate-factoring.ll (removed) @@ -1,54 +0,0 @@ -; PR1296 -; RUN: llc < %s -march=x86 | grep {movl \$1} | count 1 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "i686-apple-darwin8" - -define i32 @foo(i32 %A, i32 %B, i32 %C) { -entry: - switch i32 %A, label %out [ - i32 1, label %bb - i32 0, label %bb13 - i32 2, label %bb35 - ] - -bb: ; preds = %cond_next, %entry - %i.144.1 = phi i32 [ 0, %entry ], [ %tmp7, %cond_next ] ; [#uses=2] - %tmp4 = and i32 %i.144.1, %B ; [#uses=1] - icmp eq i32 %tmp4, 0 ; :0 [#uses=1] - br i1 %0, label %cond_next, label %out - -cond_next: ; preds = %bb - %tmp7 = add i32 %i.144.1, 1 ; [#uses=2] - icmp slt i32 %tmp7, 1000 ; :1 [#uses=1] - br i1 %1, label %bb, label %out - -bb13: ; preds = %cond_next18, %entry - %i.248.1 = phi i32 [ 0, %entry ], [ %tmp20, %cond_next18 ] ; [#uses=2] - %tmp16 = and i32 %i.248.1, %C ; [#uses=1] - icmp eq i32 %tmp16, 0 ; :2 [#uses=1] - br i1 %2, label %cond_next18, label %out - -cond_next18: ; preds = %bb13 - %tmp20 = add i32 %i.248.1, 1 ; [#uses=2] - icmp slt i32 %tmp20, 1000 ; :3 [#uses=1] - br i1 %3, label %bb13, label %out - -bb27: ; preds = %bb35 - %tmp30 = and i32 %i.3, %C ; [#uses=1] - icmp eq i32 %tmp30, 0 ; :4 [#uses=1] - br i1 %4, label %cond_next32, label %out - -cond_next32: ; preds = %bb27 - %indvar.next = add i32 %i.3, 1 ; [#uses=1] - br label %bb35 - -bb35: ; preds = %entry, %cond_next32 - %i.3 = phi i32 [ %indvar.next, %cond_next32 ], [ 0, %entry ] ; [#uses=3] - icmp slt i32 %i.3, 1000 ; :5 [#uses=1] - br i1 %5, label %bb27, label %out - -out: ; preds = %bb27, %bb35, %bb13, %cond_next18, %bb, %cond_next, %entry - %result.0 = phi i32 [ 0, %entry ], [ 1, %bb ], [ 0, %cond_next ], [ 1, %bb13 ], [ 0, %cond_next18 ], [ 1, %bb27 ], [ 0, %bb35 ] ; [#uses=1] - ret i32 %result.0 -} Removed: llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll?rev=95655&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll (original) +++ llvm/trunk/test/CodeGen/Generic/switch-crit-edge-constant.ll (removed) @@ -1,52 +0,0 @@ -; PR925 -; RUN: llc < %s -march=x86 | \ -; RUN: grep mov.*str1 | count 1 - -target datalayout = "e-p:32:32" -target triple = "i686-apple-darwin8.7.2" - at str1 = internal constant [5 x i8] c"bonk\00" ; <[5 x i8]*> [#uses=1] - at str2 = internal constant [5 x i8] c"bork\00" ; <[5 x i8]*> [#uses=1] - at str = internal constant [8 x i8] c"perfwap\00" ; <[8 x i8]*> [#uses=1] - -define void @foo(i32 %C) { -entry: - switch i32 %C, label %bb2 [ - i32 1, label %blahaha - i32 2, label %blahaha - i32 3, label %blahaha - i32 4, label %blahaha - i32 5, label %blahaha - i32 6, label %blahaha - i32 7, label %blahaha - i32 8, label %blahaha - i32 9, label %blahaha - i32 10, label %blahaha - ] - -bb2: ; preds = %entry - %tmp5 = and i32 %C, 123 ; [#uses=1] - %tmp = icmp eq i32 %tmp5, 0 ; [#uses=1] - br i1 %tmp, label %blahaha, label %cond_true - -cond_true: ; preds = %bb2 - br label %blahaha - -blahaha: ; preds = %cond_true, %bb2, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry - %s.0 = phi i8* [ getelementptr ([8 x i8]* @str, i32 0, i64 0), %cond_true ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str1, i32 0, i64 0), %entry ], [ getelementptr ([5 x i8]* @str2, i32 0, i64 0), %bb2 ] ; [#uses=13] - %tmp8 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp10 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp12 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp14 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp16 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp18 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp20 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp22 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp24 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp26 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp28 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp30 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - %tmp32 = tail call i32 (i8*, ...)* @printf( i8* %s.0 ) ; [#uses=0] - ret void -} - -declare i32 @printf(i8*, ...) From anton at korobeynikov.info Tue Feb 9 01:46:59 2010 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 9 Feb 2010 10:46:59 +0300 Subject: [llvm-commits] [llvm] r95651 - in /llvm/trunk/test/CodeGen/Generic: switch-lower-feature-2.ll switch-lower-feature.ll In-Reply-To: <201002090619.o196JKOv004646@zion.cs.uiuc.edu> References: <201002090619.o196JKOv004646@zion.cs.uiuc.edu> Message-ID: Hi, Chris > -; RUN: grep jb %t | count 1 > -; RUN: grep \\\$6 %t | count 2 > -; RUN: grep 1024 %t | count 1 > -; RUN: grep 1023 %t | count 1 > -; RUN: grep 119 ?%t | count 1 > -; RUN: grep JTI %t | count 2 > -; RUN: grep jg %t | count 3 > -; RUN: grep ja %t | count 1 > -; RUN: grep jns %t | count 1 These files actually test the behaviour of switch lowering. You just removed that. Surely, it will never crash. Please revert. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From anton at korobeynikov.info Tue Feb 9 01:49:25 2010 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 9 Feb 2010 10:49:25 +0300 Subject: [llvm-commits] [llvm] r95656 - in /llvm/trunk/test/CodeGen: Generic/ X86/ In-Reply-To: <201002090641.o196f4JO005764@zion.cs.uiuc.edu> References: <201002090641.o196f4JO005764@zion.cs.uiuc.edu> Message-ID: Hi, Chris > ? ?llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll > ? ?llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll Why have you removed these two ones? They test actual regressions! -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From baldrick at free.fr Tue Feb 9 09:28:05 2010 From: baldrick at free.fr (Duncan Sands) Date: Tue, 09 Feb 2010 15:28:05 -0000 Subject: [llvm-commits] [dragonegg] r95660 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002091528.o19FS61O012911@zion.cs.uiuc.edu> Author: baldrick Date: Tue Feb 9 09:28:04 2010 New Revision: 95660 URL: http://llvm.org/viewvc/llvm-project?rev=95660&view=rev Log: Disable all of the GCC passes that are only run after we have already converted the gimple to LLVM IR. This includes most optimization passes. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95660&r1=95659&r2=95660&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Tue Feb 9 09:28:04 2010 @@ -2354,13 +2354,6 @@ pass_info.ref_pass_instance_number = 0; pass_info.pos_op = PASS_POS_REPLACE; register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); - - // Turn off pass_all_optimizations. - pass_info.pass = &pass_gimple_null.pass; - pass_info.reference_pass_name = "*all_optimizations"; - pass_info.ref_pass_instance_number = 0; - pass_info.pos_op = PASS_POS_REPLACE; - register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); } // Replace LTO generation with gimple to LLVM conversion. @@ -2376,13 +2369,76 @@ pass_info.pos_op = PASS_POS_REPLACE; register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); - // Turn off all LTO passes. + // Disable any other LTO passes. pass_info.pass = &pass_ipa_null.pass; pass_info.reference_pass_name = "lto_wpa_fixup"; pass_info.ref_pass_instance_number = 0; pass_info.pos_op = PASS_POS_REPLACE; register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + // Disable pass_lower_eh_dispatch, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "ehdisp"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_all_optimizations, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "*all_optimizations"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_lower_complex_O0, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "cplxlower0"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_cleanup_eh, which runs after LLVM conversion. + // NOTE: This pass is scheduled twice, once before LLVM conversion and once + // after. If GCC optimizations are enabled, then we should only disable the + // second instance, but there doesn't seem to be any convenient and reliable + // way of doing this. FIXME: The following code actually only disables the + // first instance due to a GCC bug! + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "ehcleanup"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_lower_resx, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "resx"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_nrv, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "nrv"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_mudflap_2, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "mudflap2"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // Disable pass_cleanup_cfg_post_optimizing, which runs after LLVM conversion. + pass_info.pass = &pass_gimple_null.pass; + pass_info.reference_pass_name = "optimized"; + pass_info.ref_pass_instance_number = 0; + pass_info.pos_op = PASS_POS_REPLACE; + register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); + + // TODO: Disable pass_warn_function_noreturn? + // Replace rtl expansion with a pass that pretends to codegen functions, but // actually only does the hoop jumping that GCC requires at this point. pass_info.pass = &pass_disable_rtl.pass; From baldrick at free.fr Tue Feb 9 09:33:46 2010 From: baldrick at free.fr (Duncan Sands) Date: Tue, 09 Feb 2010 15:33:46 -0000 Subject: [llvm-commits] [dragonegg] r95661 - /dragonegg/trunk/README Message-ID: <201002091533.o19FXlON013227@zion.cs.uiuc.edu> Author: baldrick Date: Tue Feb 9 09:33:46 2010 New Revision: 95661 URL: http://llvm.org/viewvc/llvm-project?rev=95661&view=rev Log: Add a note about only early optimizations being run. Modified: dragonegg/trunk/README Modified: dragonegg/trunk/README URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/README?rev=95661&r1=95660&r2=95661&view=diff ============================================================================== --- dragonegg/trunk/README (original) +++ dragonegg/trunk/README Tue Feb 9 09:33:46 2010 @@ -79,8 +79,8 @@ Do not perform any LLVM IR optimizations even if compiling at -O1, -O2 etc. -fplugin-arg-dragonegg-enable-gcc-optzns - Run the GCC tree optimizers as well as the LLVM IR optimizers. Normally the - GCC optimizers are disabled. + Run the GCC tree optimizers as well as the LLVM IR optimizers. Only early GCC + optimizations are performed. Normally all GCC optimizations are disabled. -fplugin-arg-dragonegg-save-gcc-output GCC assembler output is normally redirected to /dev/null so that it doesn't From daniel at zuster.org Tue Feb 9 10:41:59 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 9 Feb 2010 08:41:59 -0800 Subject: [llvm-commits] [llvm] r95637 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp In-Reply-To: <201002090054.o190spPw018610@zion.cs.uiuc.edu> References: <201002090054.o190spPw018610@zion.cs.uiuc.edu> Message-ID: <6a8523d61002090841t24ae9095hfcc4f028306d6ef4@mail.gmail.com> Hi Chris, On Mon, Feb 8, 2010 at 4:54 PM, Chris Lattner wrote: > Author: lattner > Date: Mon Feb ?8 18:54:51 2010 > New Revision: 95637 > > URL: http://llvm.org/viewvc/llvm-project?rev=95637&view=rev > Log: > make -show-inst be formatted a bit nicer. ?Before: > > ? ? ? ?movl ? ?$3735928559, a ? ? ? ? ?## inst: > > > after: > > ? ? ? ?movl ? ?$3735928559, a ? ? ? ? ?## ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?## ? > Thanks! One comment though: > > > > Modified: > ? ?llvm/trunk/lib/MC/MCAsmStreamer.cpp > > Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95637&r1=95636&r2=95637&view=diff > > ============================================================================== > --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) > +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Feb ?8 18:54:51 2010 > @@ -532,14 +532,6 @@ > ?void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { > ? assert(CurSection && "Cannot emit contents before setting section!"); > > - ?// Show the MCInst if enabled. > - ?if (ShowInst) { > - ? ?raw_ostream &OS = GetCommentOS(); > - ? ?OS << "inst: "; > - ? ?Inst.print(OS, &MAI); > - ? ?OS << "\n"; > - ?} > - > ? // Show the encoding in a comment if we have a code emitter. > ? if (Emitter) { > ? ? SmallString<256> Code; > @@ -557,6 +549,18 @@ > ? ? OS << "]\n"; > ? } > > + ?// Show the MCInst if enabled. > + ?if (ShowInst) { > + ? ?raw_ostream &OS = GetCommentOS(); > + ? ?OS << " + > + ? ?for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) { > + ? ? ?OS << "\n ?"; > + ? ? ?Inst.getOperand(i).print(OS, &MAI); > + ? ?} > + ? ?OS << ">\n"; > + ?} > + This was intentionally before encoding. --show-inst is most likely only useful when debugging matcher and encoder issues, in which case its good to have it come first in case something bad happens (encoder crashes). - Daniel > ? // If we have an AsmPrinter, use that to print, otherwise dump the MCInst. > ? if (InstPrinter) > ? ? InstPrinter->printInst(&Inst); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Tue Feb 9 10:59:15 2010 From: gohman at apple.com (Dan Gohman) Date: Tue, 09 Feb 2010 16:59:15 -0000 Subject: [llvm-commits] [llvm] r95665 - /llvm/trunk/include/llvm/Intrinsics.h Message-ID: <201002091659.o19GxFvF017718@zion.cs.uiuc.edu> Author: djg Date: Tue Feb 9 10:59:14 2010 New Revision: 95665 URL: http://llvm.org/viewvc/llvm-project?rev=95665&view=rev Log: Mention vAny and iPTRAny in a comment. Modified: llvm/trunk/include/llvm/Intrinsics.h Modified: llvm/trunk/include/llvm/Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.h?rev=95665&r1=95664&r2=95665&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.h (original) +++ llvm/trunk/include/llvm/Intrinsics.h Tue Feb 9 10:59:14 2010 @@ -63,9 +63,9 @@ /// declaration for an intrinsic, and return it. /// /// The Tys and numTys parameters are for intrinsics with overloaded types - /// (e.g., those using iAny or fAny). For a declaration for an overloaded - /// intrinsic, Tys should point to an array of numTys pointers to Type, - /// and must provide exactly one type for each overloaded type in the + /// (e.g., those using iAny, fAny, vAny, or iPTRAny). For a declaration for an + /// overloaded intrinsic, Tys should point to an array of numTys pointers to + /// Type, and must provide exactly one type for each overloaded type in the /// intrinsic. Function *getDeclaration(Module *M, ID id, const Type **Tys = 0, unsigned numTys = 0); From gohman at apple.com Tue Feb 9 11:00:40 2010 From: gohman at apple.com (Dan Gohman) Date: Tue, 09 Feb 2010 17:00:40 -0000 Subject: [llvm-commits] [llvm] r95666 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h Message-ID: <201002091700.o19H0e1c017797@zion.cs.uiuc.edu> Author: djg Date: Tue Feb 9 11:00:40 2010 New Revision: 95666 URL: http://llvm.org/viewvc/llvm-project?rev=95666&view=rev Log: Mention IndVarSimplify in the comment by getSmallConstantTripCount, as is done for getTripCount. Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=95666&r1=95665&r2=95666&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Tue Feb 9 11:00:40 2010 @@ -553,6 +553,10 @@ /// normal unsigned value, if possible. Returns 0 if the trip count is unknown /// of not constant. Will also return 0 if the trip count is very large /// (>= 2^32) + /// + /// The IndVarSimplify pass transforms loops to have a form that this + /// function easily understands. + /// unsigned getSmallConstantTripCount() const; /// getSmallConstantTripMultiple - Returns the largest constant divisor of the From echristo at apple.com Tue Feb 9 11:07:23 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 9 Feb 2010 09:07:23 -0800 Subject: [llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll In-Reply-To: <5F815507-0C36-4C8D-9E6F-7C6F484A1E5F@apple.com> References: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> <5F815507-0C36-4C8D-9E6F-7C6F484A1E5F@apple.com> Message-ID: > > Right now, yes, it's a big hammer. However, for various different permutations of geps etc I found I was duplicating (iteratively) a lot of SCEV's internal code to determine offsets into objects etc. > > Ideally we'd also like to use that along with loop information to be able to tell something like this: > > char buffer[128]; > > for (int i = 0; i < 128; i++) > strcpy(buffer[i], "f") > > or assorted and tell that we're not going to overrun the buffer and lower to an explicit strcpy instead of the checking version. After chatting yesterday it doesn't appear that gcc deals with any of this, mostly just merging phis/conditionals so I'll just go ahead and do this in instcombine and attempt to lower the checking calls there, moving that code from simplifylibcalls. If we ever do want to resurrect this, it's obviously pretty easy to write :) How's that sound? -eric From clattner at apple.com Tue Feb 9 11:15:10 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 09 Feb 2010 09:15:10 -0800 Subject: [llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll In-Reply-To: References: <201002090035.o190ZcTm017704@zion.cs.uiuc.edu> <5F815507-0C36-4C8D-9E6F-7C6F484A1E5F@apple.com> Message-ID: <630FAB11-034B-47F5-A1E8-055237F5564C@apple.com> Sounds great, thanks Eric! -Chris On Feb 9, 2010, at 9:07 AM, Eric Christopher wrote: >> >> Right now, yes, it's a big hammer. However, for various different >> permutations of geps etc I found I was duplicating (iteratively) a >> lot of SCEV's internal code to determine offsets into objects etc. >> >> Ideally we'd also like to use that along with loop information to >> be able to tell something like this: >> >> char buffer[128]; >> >> for (int i = 0; i < 128; i++) >> strcpy(buffer[i], "f") >> >> or assorted and tell that we're not going to overrun the buffer and >> lower to an explicit strcpy instead of the checking version. > > After chatting yesterday it doesn't appear that gcc deals with any > of this, mostly just merging phis/conditionals so I'll just go ahead > and do this in instcombine and attempt to lower the checking calls > there, moving that code from simplifylibcalls. > > If we ever do want to resurrect this, it's obviously pretty easy to > write :) > > How's that sound? > > -eric From stoklund at 2pi.dk Tue Feb 9 11:20:03 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 09 Feb 2010 17:20:03 -0000 Subject: [llvm-commits] [llvm] r95667 - in /llvm/trunk: projects/test-suite tools/clang Message-ID: <201002091720.o19HK4I7018671@zion.cs.uiuc.edu> Author: stoklund Date: Tue Feb 9 11:20:03 2010 New Revision: 95667 URL: http://llvm.org/viewvc/llvm-project?rev=95667&view=rev Log: clang test suite Added: llvm/trunk/projects/test-suite (with props) llvm/trunk/tools/clang (with props) Added: llvm/trunk/projects/test-suite URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/test-suite?rev=95667&view=auto ============================================================================== --- llvm/trunk/projects/test-suite (added) +++ llvm/trunk/projects/test-suite Tue Feb 9 11:20:03 2010 @@ -0,0 +1 @@ +link ../../llvm-test-suite \ No newline at end of file Propchange: llvm/trunk/projects/test-suite ------------------------------------------------------------------------------ svn:special = * Added: llvm/trunk/tools/clang URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/clang?rev=95667&view=auto ============================================================================== --- llvm/trunk/tools/clang (added) +++ llvm/trunk/tools/clang Tue Feb 9 11:20:03 2010 @@ -0,0 +1 @@ +link ../../clang \ No newline at end of file Propchange: llvm/trunk/tools/clang ------------------------------------------------------------------------------ svn:special = * From stoklund at 2pi.dk Tue Feb 9 11:20:11 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 09 Feb 2010 17:20:11 -0000 Subject: [llvm-commits] [llvm] r95668 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <201002091720.o19HKBkW018687@zion.cs.uiuc.edu> Author: stoklund Date: Tue Feb 9 11:20:11 2010 New Revision: 95668 URL: http://llvm.org/viewvc/llvm-project?rev=95668&view=rev Log: Remember to update live-in lists when coalescing physregs. Patch by M Wahab! Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95668&r1=95667&r2=95668&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Feb 9 11:20:11 2010 @@ -1755,6 +1755,23 @@ UpdateRegDefsUses(SrcReg, DstReg, SubIdx); + // If we have extended the live range of a physical register, make sure we + // update live-in lists as well. + if (TargetRegisterInfo::isPhysicalRegister(DstReg)) { + const LiveInterval &VRegInterval = li_->getInterval(SrcReg); + SmallVector BlockSeq; + for (LiveInterval::const_iterator I = VRegInterval.begin(), + E = VRegInterval.end(); I != E; ++I ) { + li_->findLiveInMBBs(I->start, I->end, BlockSeq); + for (unsigned idx = 0, size = BlockSeq.size(); idx != size; ++idx) { + MachineBasicBlock &block = *BlockSeq[idx]; + if (!block.isLiveIn(DstReg)) + block.addLiveIn(DstReg); + } + BlockSeq.clear(); + } + } + // SrcReg is guarateed to be the register whose live interval that is // being merged. li_->removeInterval(SrcReg); From johnny.chen at apple.com Tue Feb 9 11:21:57 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 09 Feb 2010 17:21:57 -0000 Subject: [llvm-commits] [llvm] r95669 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002091721.o19HLvZ4018773@zion.cs.uiuc.edu> Author: johnny Date: Tue Feb 9 11:21:56 2010 New Revision: 95669 URL: http://llvm.org/viewvc/llvm-project?rev=95669&view=rev Log: Added vcvtb/vcvtt (between half-precision and single-precision, VFP). For disassembly only. A8.6.300 Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95669&r1=95668&r2=95669&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Tue Feb 9 11:21:56 2010 @@ -225,6 +225,24 @@ let Inst{4} = 0; } +// Between half-precision and single-precision. For disassembly only. + +def VCVTBSH : ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$dst), (ins SPR:$a), + /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f32.f16\t$dst, $a", + [/* For disassembly only; pattern left blank */]>; + +def VCVTBHS : ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$dst), (ins SPR:$a), + /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f16.f32\t$dst, $a", + [/* For disassembly only; pattern left blank */]>; + +def VCVTTSH : ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$dst), (ins SPR:$a), + /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f32.f16\t$dst, $a", + [/* For disassembly only; pattern left blank */]>; + +def VCVTTHS : ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$dst), (ins SPR:$a), + /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f16.f32\t$dst, $a", + [/* For disassembly only; pattern left blank */]>; + let neverHasSideEffects = 1 in { def VMOVD: ADuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs DPR:$dst), (ins DPR:$a), IIC_fpUNA64, "vmov", ".f64\t$dst, $a", []>; From stoklund at 2pi.dk Tue Feb 9 11:24:22 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 09 Feb 2010 17:24:22 -0000 Subject: [llvm-commits] [llvm] r95670 - in /llvm/trunk: projects/test-suite tools/clang Message-ID: <201002091724.o19HOMZY018869@zion.cs.uiuc.edu> Author: stoklund Date: Tue Feb 9 11:24:21 2010 New Revision: 95670 URL: http://llvm.org/viewvc/llvm-project?rev=95670&view=rev Log: Oops. Removed: llvm/trunk/projects/test-suite llvm/trunk/tools/clang Removed: llvm/trunk/projects/test-suite URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/test-suite?rev=95669&view=auto ============================================================================== --- llvm/trunk/projects/test-suite (original) +++ llvm/trunk/projects/test-suite (removed) @@ -1 +0,0 @@ -link ../../llvm-test-suite \ No newline at end of file Removed: llvm/trunk/tools/clang URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/clang?rev=95669&view=auto ============================================================================== --- llvm/trunk/tools/clang (original) +++ llvm/trunk/tools/clang (removed) @@ -1 +0,0 @@ -link ../../clang \ No newline at end of file From echristo at apple.com Tue Feb 9 11:29:19 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 09 Feb 2010 17:29:19 -0000 Subject: [llvm-commits] [llvm] r95671 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/CMakeLists.txt lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ Message-ID: <201002091729.o19HTKDj019088@zion.cs.uiuc.edu> Author: echristo Date: Tue Feb 9 11:29:18 2010 New Revision: 95671 URL: http://llvm.org/viewvc/llvm-project?rev=95671&view=rev Log: Pull these back out, they're a little too aggressive and time consuming for a simple optimization. Added: llvm/trunk/test/Transforms/InstCombine/objsize.ll - copied unchanged from r95627, llvm/trunk/test/Transforms/InstCombine/objsize.ll Removed: llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp llvm/trunk/test/Transforms/ObjSizeLower/ Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Support/StandardPasses.h llvm/trunk/include/llvm/Transforms/Scalar.h llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=95671&r1=95670&r2=95671&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Tue Feb 9 11:29:18 2010 @@ -138,7 +138,6 @@ (void) llvm::createGEPSplitterPass(); (void) llvm::createSCCVNPass(); (void) llvm::createABCDPass(); - (void) llvm::createObjectSizeLoweringPass(); (void)new llvm::IntervalPartition(); (void)new llvm::FindUsedTypes(); Modified: llvm/trunk/include/llvm/Support/StandardPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=95671&r1=95670&r2=95671&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/StandardPasses.h (original) +++ llvm/trunk/include/llvm/Support/StandardPasses.h Tue Feb 9 11:29:18 2010 @@ -118,6 +118,8 @@ // Start of function pass. PM->add(createScalarReplAggregatesPass()); // Break up aggregate allocas + if (SimplifyLibCalls) + PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations PM->add(createInstructionCombiningPass()); // Cleanup for scalarrepl. PM->add(createJumpThreadingPass()); // Thread jumps. PM->add(createCFGSimplificationPass()); // Merge & remove BBs @@ -126,9 +128,6 @@ PM->add(createTailCallEliminationPass()); // Eliminate tail calls PM->add(createCFGSimplificationPass()); // Merge & remove BBs PM->add(createReassociatePass()); // Reassociate expressions - PM->add(createObjectSizeLoweringPass()); // Lower Intrinsic::objsize - if (SimplifyLibCalls) - PM->add(createSimplifyLibCallsPass()); // Library Call Optimizations PM->add(createLoopRotatePass()); // Rotate Loop PM->add(createLICMPass()); // Hoist loop invariants PM->add(createLoopUnswitchPass(OptimizeSize || OptimizationLevel < 3)); Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=95671&r1=95670&r2=95671&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Tue Feb 9 11:29:18 2010 @@ -336,12 +336,6 @@ // FunctionPass *createABCDPass(); -//===----------------------------------------------------------------------===// -// -// ObjSizeLowering - Lower Intrinsic::objsize -// -FunctionPass *createObjectSizeLoweringPass(); - } // End llvm namespace #endif Modified: llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt?rev=95671&r1=95670&r2=95671&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Tue Feb 9 11:29:18 2010 @@ -18,7 +18,6 @@ LoopUnrollPass.cpp LoopUnswitch.cpp MemCpyOptimizer.cpp - ObjectSizeLowering.cpp Reassociate.cpp Reg2Mem.cpp SCCP.cpp Removed: llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp?rev=95670&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ObjectSizeLowering.cpp (removed) @@ -1,114 +0,0 @@ -//===-- ObjectSizeLowering.cpp - Loop unroller pass -----------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass lowers Intrinsic::objectsize using SCEV to determine minimum or -// maximum space left in an allocated object. -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "objsize-lower" -#include "llvm/Constants.h" -#include "llvm/Module.h" -#include "llvm/Value.h" -#include "llvm/Target/TargetData.h" -#include "llvm/IntrinsicInst.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/Analysis/ScalarEvolutionExpander.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; - -namespace { - class ObjSizeLower : public FunctionPass { - ScalarEvolution *SE; - TargetData *TD; - public: - static char ID; // Pass identification, replacement for typeid - ObjSizeLower() : FunctionPass(&ID) {} - - bool runOnFunction(Function &F); - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); - AU.addRequired(); - AU.addPreserved(); - } - private: - bool LowerCall(IntrinsicInst *); - void ReplaceAllUsesWithUnknown(IntrinsicInst *, bool); - }; -} - -char ObjSizeLower::ID = 0; -static RegisterPass X("objsize-lower", - "Object Size Lowering"); - -// Public interface to the Object Size Lowering pass -FunctionPass *llvm::createObjectSizeLoweringPass() { - return new ObjSizeLower(); -} - -/// runOnFunction - Top level algorithm - Loop over each object size intrinsic -/// and use Scalar Evolutions to get the maximum or minimum size left in the -/// allocated object at any point. -bool ObjSizeLower::runOnFunction(Function &F) { - SE = &getAnalysis(); - TD = getAnalysisIfAvailable(); - - // We really need TargetData for size calculations. - if (!TD) return false; - - bool Changed = false; - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { - for (BasicBlock::iterator I = BB->begin(), L = BB->end(); I != L; ) { - CallInst *CI = dyn_cast(I++); - if (!CI) continue; - - // The only thing we care about are Intrinsic::objectsize calls - IntrinsicInst *II = dyn_cast(CI); - if (!II || II->getIntrinsicID() != Intrinsic::objectsize) continue; - - Changed |= LowerCall(II); - } - } - return Changed; -} - -// Unknown for llvm.objsize is -1 for maximum size, and 0 for minimum size. -void ObjSizeLower::ReplaceAllUsesWithUnknown(IntrinsicInst *II, bool min) { - const Type *ReturnTy = II->getCalledFunction()->getReturnType(); - II->replaceAllUsesWith(ConstantInt::get(ReturnTy, min ? 0 : -1ULL)); - II->eraseFromParent(); -} - -bool ObjSizeLower::LowerCall(IntrinsicInst *II) { - ConstantInt *CI = cast(II->getOperand(2)); - bool minimum = (CI->getZExtValue() == 1); - Value *Op = II->getOperand(1); - const Type *ReturnTy = II->getCalledFunction()->getReturnType(); - - // Grab the SCEV for our access. - const SCEV *thisEV = SE->getSCEV(Op); - - if (const SCEVUnknown *SU = dyn_cast(thisEV)) { - if (GlobalVariable *GV = dyn_cast(SU->getValue())) { - if (GV->hasDefinitiveInitializer()) { - Constant *C = GV->getInitializer(); - size_t globalSize = TD->getTypeAllocSize(C->getType()); - II->replaceAllUsesWith(ConstantInt::get(ReturnTy, globalSize)); - II->eraseFromParent(); - return true; - } - } - } - - ReplaceAllUsesWithUnknown(II, minimum); - return true; -} From jyasskin at google.com Tue Feb 9 11:58:21 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 9 Feb 2010 09:58:21 -0800 Subject: [llvm-commits] [PATCH] Shared library for LLVM (issue198059) In-Reply-To: <0016e64640dcdc5da0047ee1e48d@google.com> References: <0016e64640dcdc5da0047ee1e48d@google.com> Message-ID: I've fixed the llvm-config problem: http://codereview.appspot.com/download/issue198059_5012.diff On Fri, Feb 5, 2010 at 2:22 PM, wrote: > Reviewers: llvm-commits_cs.uiuc.edu, > > Message: > We've had requests from packagers in the Unladen Swallow merge PEP that > we link shared against LLVM instead of statically. This patch builds a > libLLVM2.7svn.(so|dylib) and adds an --enable-shared configure flag to > have the tools linked shared. (2.7svn is just $(LLVMVersion) so it'll > change to "2.7" in the release.) > > On my mac laptop, libLLVM2.7svn.dylib is 39MB, and opt (for example) is > 15M static vs 440K shared. > > I know of two things that are less than ideal here: > 1) llvm-config gets rebuilt on the second build from an empty objdir. > It's noticing that libLLVM.dylib got created after it did and might have > dependencies. I'm looking into how to fix this. > 2) The library doesn't include any version information. Since we expect > to break the ABI with every release, I don't expect this to be much of a > problem. If we do release a compatible 2.7.1, we may be able to hack its > library to work with binaries compiled against 2.7.0, or we can just ask > them to recompile. I'm hoping to get a real packaging expert to look at > this for the 2.8 release. > > Current patch at > http://codereview.appspot.com/download/issue198059_3001.diff. > > Description: > We've had requests from packagers in the Unladen Swallow merge PEP that > we link shared against an LLVM instead of statically. This patch builds > a libLLVM2.7svn.(so|dylib) and adds an --enable-shared configure flag to > have the tools linked shared. (2.7svn is just $(LLVMVersion) so it'll > change to "2.7" in the release.) > > On my mac laptop, libLLVM2.7svn.dylib is 39MB, and opt (for example) is > 15M static vs 440K shared. > > I know of two things that are less than ideal here: > 1) llvm-config gets rebuilt on the second build from an empty objdir. > It's noticing that libLLVM.dylib got created after it did and might have > dependencies. I'm looking into how to fix this. > 2) The library doesn't include any version information. Since we expect > to break the ABI with every release, I don't expect this to be much of a > problem. If we do release a compatible 2.7.1, we may be able to hack its > library to work with binaries compiled against 2.7.0, or we can just ask > them to recompile. I'm hoping to get a real packaging expert to look at > this for the 2.8 release. > > Fixes http://llvm.org/PR3201. > > Please review this at http://codereview.appspot.com/198059/show > > Affected files: > ? M ? ? Makefile > ? M ? ? Makefile.config.in > ? M ? ? Makefile.rules > ? M ? ? autoconf/configure.ac > ? M ? ? configure > ? M ? ? test/Makefile > ? M ? ? test/Unit/lit.cfg > ? M ? ? test/Unit/lit.site.cfg.in > ? A ? ? tools/shlib/Makefile > ? M ? ? unittests/Makefile.unittest > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jyasskin at google.com Tue Feb 9 13:07:19 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 09 Feb 2010 19:07:19 -0000 Subject: [llvm-commits] [llvm] r95677 - in /llvm/trunk: include/llvm/Support/TypeBuilder.h unittests/Support/TypeBuilderTest.cpp Message-ID: <201002091907.o19J7JpB023818@zion.cs.uiuc.edu> Author: jyasskin Date: Tue Feb 9 13:07:19 2010 New Revision: 95677 URL: http://llvm.org/viewvc/llvm-project?rev=95677&view=rev Log: Add support for TypeBuilder. Thanks to Jochen Wilhelmy for the suggestion! Modified: llvm/trunk/include/llvm/Support/TypeBuilder.h llvm/trunk/unittests/Support/TypeBuilderTest.cpp Modified: llvm/trunk/include/llvm/Support/TypeBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TypeBuilder.h?rev=95677&r1=95676&r2=95677&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/TypeBuilder.h (original) +++ llvm/trunk/include/llvm/Support/TypeBuilder.h Tue Feb 9 13:07:19 2010 @@ -231,6 +231,12 @@ /// we special case it. template<> class TypeBuilder : public TypeBuilder*, false> {}; +template<> class TypeBuilder + : public TypeBuilder*, false> {}; +template<> class TypeBuilder + : public TypeBuilder*, false> {}; +template<> class TypeBuilder + : public TypeBuilder*, false> {}; template class TypeBuilder { public: Modified: llvm/trunk/unittests/Support/TypeBuilderTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TypeBuilderTest.cpp?rev=95677&r1=95676&r2=95677&view=diff ============================================================================== --- llvm/trunk/unittests/Support/TypeBuilderTest.cpp (original) +++ llvm/trunk/unittests/Support/TypeBuilderTest.cpp Tue Feb 9 13:07:19 2010 @@ -19,9 +19,16 @@ TEST(TypeBuilderTest, Void) { EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder::get(getGlobalContext()))); EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder::get(getGlobalContext()))); - // Special case for C compatibility: + // Special cases for C compatibility: EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()), (TypeBuilder::get(getGlobalContext()))); + EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()), + (TypeBuilder::get(getGlobalContext()))); + EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()), + (TypeBuilder::get(getGlobalContext()))); + EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()), + (TypeBuilder::get( + getGlobalContext()))); } TEST(TypeBuilderTest, HostIntegers) { From grosbach at apple.com Tue Feb 9 13:51:39 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 09 Feb 2010 19:51:39 -0000 Subject: [llvm-commits] [llvm] r95686 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td Thumb2SizeReduction.cpp Message-ID: <201002091951.o19JpdOB026021@zion.cs.uiuc.edu> Author: grosbach Date: Tue Feb 9 13:51:37 2010 New Revision: 95686 URL: http://llvm.org/viewvc/llvm-project?rev=95686&view=rev Log: Radar 7417921 tMOVCCi pattern only valid for low registers, as the Thumb1 mov immediate to register instruction only works with low registers. Allowing high registers for the instruction resulted in the assembler choosing the wide (32-bit) encoding for the mov, but LLVM though the instruction was only 16 bits wide, so offset calculations for constant pools became incorrect, leading to out of range constant pool entries. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=95686&r1=95685&r2=95686&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Feb 9 13:51:37 2010 @@ -775,7 +775,7 @@ "mov", "\t$dst, $rhs", []>, T1Special<{1,0,?,?}>; -def tMOVCCi : T1pIt<(outs GPR:$dst), (ins GPR:$lhs, i32imm:$rhs), IIC_iCMOVi, +def tMOVCCi : T1pIt<(outs tGPR:$dst), (ins tGPR:$lhs, i32imm:$rhs), IIC_iCMOVi, "mov", "\t$dst, $rhs", []>, T1General<{1,0,0,?,?}>; Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=95686&r1=95685&r2=95686&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Tue Feb 9 13:51:37 2010 @@ -83,7 +83,7 @@ // FIXME: Do we need the 16-bit 'S' variant? { ARM::t2MOVr,ARM::tMOVgpr2gpr,0, 0, 0, 0, 0, 1,0, 0 }, { ARM::t2MOVCCr,0, ARM::tMOVCCr, 0, 0, 0, 0, 0,1, 0 }, - { ARM::t2MOVCCi,0, ARM::tMOVCCi, 0, 8, 0, 0, 0,1, 0 }, + { ARM::t2MOVCCi,0, ARM::tMOVCCi, 0, 8, 0, 1, 0,1, 0 }, { ARM::t2MUL, 0, ARM::tMUL, 0, 0, 0, 1, 0,0, 0 }, { ARM::t2MVNr, ARM::tMVN, 0, 0, 0, 1, 0, 0,0, 0 }, { ARM::t2ORRrr, 0, ARM::tORR, 0, 0, 0, 1, 0,0, 0 }, From dalej at apple.com Tue Feb 9 13:54:29 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 09 Feb 2010 19:54:29 -0000 Subject: [llvm-commits] [llvm] r95688 - /llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Message-ID: <201002091954.o19JsTRm026177@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 13:54:29 2010 New Revision: 95688 URL: http://llvm.org/viewvc/llvm-project?rev=95688&view=rev Log: Re-disable for Darwin; I was mistaken to think this was fixed. Modified: llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Modified: llvm/trunk/test/LLVMC/MultiplePluginPriorities.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/MultiplePluginPriorities.td?rev=95688&r1=95687&r2=95688&view=diff ============================================================================== --- llvm/trunk/test/LLVMC/MultiplePluginPriorities.td (original) +++ llvm/trunk/test/LLVMC/MultiplePluginPriorities.td Tue Feb 9 13:54:29 2010 @@ -1,6 +1,9 @@ // Check that multiple plugin priorities are not allowed. // RUN: ignore tblgen -I %p/../../include --gen-llvmc %s |& grep "More than one 'PluginPriority' instance found" +// Disable for Darwin PPC: +// XFAIL: powerpc-apple-darwin + include "llvm/CompilerDriver/Common.td" def Graph : CompilationGraph<[]>; From sabre at nondot.org Tue Feb 9 13:54:29 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 19:54:29 -0000 Subject: [llvm-commits] [llvm] r95687 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ utils/TableGen/ Message-ID: <201002091954.o19JsVZC026245@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 13:54:29 2010 New Revision: 95687 URL: http://llvm.org/viewvc/llvm-project?rev=95687&view=rev Log: move target-independent opcodes out of TargetInstrInfo into TargetOpcodes.h. #include the new TargetOpcodes.h into MachineInstr. Add new inline accessors (like isPHI()) to MachineInstr, and start using them throughout the codebase. Added: llvm/trunk/include/llvm/Target/TargetOpcodes.h Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/include/llvm/Target/Target.td llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp llvm/trunk/lib/CodeGen/GCStrategy.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/LowerSubregs.cpp llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/MachineLICM.cpp llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp llvm/trunk/lib/CodeGen/MachineSink.cpp llvm/trunk/lib/CodeGen/MachineVerifier.cpp llvm/trunk/lib/CodeGen/OptimizeExts.cpp llvm/trunk/lib/CodeGen/PHIElimination.cpp llvm/trunk/lib/CodeGen/PHIElimination.h llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp llvm/trunk/lib/CodeGen/ProcessImplicitDefs.cpp llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/CodeGen/RegAllocLocal.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/SlotIndexes.cpp llvm/trunk/lib/CodeGen/StackSlotColoring.cpp llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp llvm/trunk/lib/CodeGen/TailDuplication.cpp llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.cpp llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/utils/TableGen/CodeEmitterGen.cpp llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Feb 9 13:54:29 2010 @@ -22,6 +22,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/Target/TargetInstrDesc.h" +#include "llvm/Target/TargetOpcodes.h" #include "llvm/Support/DebugLoc.h" #include @@ -193,12 +194,31 @@ /// isLabel - Returns true if the MachineInstr represents a label. /// - bool isLabel() const; - - /// isDebugLabel - Returns true if the MachineInstr represents a debug label. - /// - bool isDebugLabel() const; - + bool isLabel() const { + return getOpcode() == TargetOpcode::DBG_LABEL || + getOpcode() == TargetOpcode::EH_LABEL || + getOpcode() == TargetOpcode::GC_LABEL; + } + + bool isDebugLabel() const { return getOpcode() == TargetOpcode::DBG_LABEL; } + bool isEHLabel() const { return getOpcode() == TargetOpcode::EH_LABEL; } + bool isGCLabel() const { return getOpcode() == TargetOpcode::GC_LABEL; } + bool isDebugValue() const { return getOpcode() == TargetOpcode::DBG_VALUE; } + + bool isPHI() const { return getOpcode() == TargetOpcode::PHI; } + bool isKill() const { return getOpcode() == TargetOpcode::KILL; } + bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; } + bool isInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM; } + bool isExtractSubreg() const { + return getOpcode() == TargetOpcode::EXTRACT_SUBREG; + } + bool isInsertSubreg() const { + return getOpcode() == TargetOpcode::INSERT_SUBREG; + } + bool isSubregToReg() const { + return getOpcode() == TargetOpcode::SUBREG_TO_REG; + } + /// readsRegister - Return true if the MachineInstr reads the specified /// register. If TargetRegisterInfo is passed, then it also checks if there /// is a read of a super-register. Modified: llvm/trunk/include/llvm/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/Target.td (original) +++ llvm/trunk/include/llvm/Target/Target.td Tue Feb 9 13:54:29 2010 @@ -399,19 +399,19 @@ let OutOperandList = (ops); let InOperandList = (ops variable_ops); let AsmString = "PHINODE"; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; } def INLINEASM : Instruction { let OutOperandList = (ops); let InOperandList = (ops variable_ops); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; } def DBG_LABEL : Instruction { let OutOperandList = (ops); let InOperandList = (ops i32imm:$id); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let hasCtrlDep = 1; let isNotDuplicable = 1; } @@ -419,7 +419,7 @@ let OutOperandList = (ops); let InOperandList = (ops i32imm:$id); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let hasCtrlDep = 1; let isNotDuplicable = 1; } @@ -427,7 +427,7 @@ let OutOperandList = (ops); let InOperandList = (ops i32imm:$id); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let hasCtrlDep = 1; let isNotDuplicable = 1; } @@ -435,21 +435,21 @@ let OutOperandList = (ops); let InOperandList = (ops variable_ops); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; } def EXTRACT_SUBREG : Instruction { let OutOperandList = (ops unknown:$dst); let InOperandList = (ops unknown:$supersrc, i32imm:$subidx); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; } def INSERT_SUBREG : Instruction { let OutOperandList = (ops unknown:$dst); let InOperandList = (ops unknown:$supersrc, unknown:$subsrc, i32imm:$subidx); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; let Constraints = "$supersrc = $dst"; } @@ -457,7 +457,7 @@ let OutOperandList = (ops unknown:$dst); let InOperandList = (ops); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; let isReMaterializable = 1; let isAsCheapAsAMove = 1; @@ -466,22 +466,22 @@ let OutOperandList = (ops unknown:$dst); let InOperandList = (ops unknown:$implsrc, unknown:$subsrc, i32imm:$subidx); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; } def COPY_TO_REGCLASS : Instruction { let OutOperandList = (ops unknown:$dst); let InOperandList = (ops unknown:$src, i32imm:$regclass); let AsmString = ""; - let Namespace = "TargetInstrInfo"; + let Namespace = "TargetOpcode"; let neverHasSideEffects = 1; let isAsCheapAsAMove = 1; } -def DEBUG_VALUE : Instruction { +def DBG_VALUE : Instruction { let OutOperandList = (ops); let InOperandList = (ops variable_ops); - let AsmString = "DEBUG_VALUE"; - let Namespace = "TargetInstrInfo"; + let AsmString = "DBG_VALUE"; + let Namespace = "TargetOpcode"; let isAsCheapAsAMove = 1; } } Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Tue Feb 9 13:54:29 2010 @@ -45,55 +45,6 @@ TargetInstrInfo(const TargetInstrDesc *desc, unsigned NumOpcodes); virtual ~TargetInstrInfo(); - // Invariant opcodes: All instruction sets have these as their low opcodes. - enum { - PHI = 0, - INLINEASM = 1, - DBG_LABEL = 2, - EH_LABEL = 3, - GC_LABEL = 4, - - /// KILL - This instruction is a noop that is used only to adjust the liveness - /// of registers. This can be useful when dealing with sub-registers. - KILL = 5, - - /// EXTRACT_SUBREG - This instruction takes two operands: a register - /// that has subregisters, and a subregister index. It returns the - /// extracted subregister value. This is commonly used to implement - /// truncation operations on target architectures which support it. - EXTRACT_SUBREG = 6, - - /// INSERT_SUBREG - This instruction takes three operands: a register - /// that has subregisters, a register providing an insert value, and a - /// subregister index. It returns the value of the first register with - /// the value of the second register inserted. The first register is - /// often defined by an IMPLICIT_DEF, as is commonly used to implement - /// anyext operations on target architectures which support it. - INSERT_SUBREG = 7, - - /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef. - IMPLICIT_DEF = 8, - - /// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except - /// that the first operand is an immediate integer constant. This constant - /// is often zero, as is commonly used to implement zext operations on - /// target architectures which support it, such as with x86-64 (with - /// zext from i32 to i64 via implicit zero-extension). - SUBREG_TO_REG = 9, - - /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain - /// register-to-register copy into a specific register class. This is only - /// used between instruction selection and MachineInstr creation, before - /// virtual registers have been created for all the instructions, and it's - /// only needed in cases where the register classes implied by the - /// instructions are insufficient. The actual MachineInstrs to perform - /// the copy are emitted with the TargetInstrInfo::copyRegToReg hook. - COPY_TO_REGCLASS = 10, - - // DEBUG_VALUE - a mapping of the llvm.dbg.value intrinsic - DEBUG_VALUE = 11 - }; - unsigned getNumOpcodes() const { return NumOpcodes; } /// get - Return the machine instruction descriptor that corresponds to the @@ -109,7 +60,7 @@ /// that aren't always available. bool isTriviallyReMaterializable(const MachineInstr *MI, AliasAnalysis *AA = 0) const { - return MI->getOpcode() == IMPLICIT_DEF || + return MI->getOpcode() == TargetOpcode::IMPLICIT_DEF || (MI->getDesc().isRematerializable() && (isReallyTriviallyReMaterializable(MI, AA) || isReallyTriviallyReMaterializableGeneric(MI, AA))); @@ -167,12 +118,12 @@ SrcReg == DstReg) return true; - if (MI.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG && + if (MI.getOpcode() == TargetOpcode::EXTRACT_SUBREG && MI.getOperand(0).getReg() == MI.getOperand(1).getReg()) return true; - if ((MI.getOpcode() == TargetInstrInfo::INSERT_SUBREG || - MI.getOpcode() == TargetInstrInfo::SUBREG_TO_REG) && + if ((MI.getOpcode() == TargetOpcode::INSERT_SUBREG || + MI.getOpcode() == TargetOpcode::SUBREG_TO_REG) && MI.getOperand(0).getReg() == MI.getOperand(2).getReg()) return true; return false; Added: llvm/trunk/include/llvm/Target/TargetOpcodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOpcodes.h?rev=95687&view=auto ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOpcodes.h (added) +++ llvm/trunk/include/llvm/Target/TargetOpcodes.h Tue Feb 9 13:54:29 2010 @@ -0,0 +1,72 @@ +//===-- llvm/Target/TargetOpcodes.h - Target Indep Opcodes ------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the target independent instruction opcodes. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_TARGETOPCODES_H +#define LLVM_TARGET_TARGETOPCODES_H + +namespace llvm { + +// Invariant opcodes: All instruction sets have these as their low opcodes. +namespace TargetOpcode { + enum { + PHI = 0, + INLINEASM = 1, + DBG_LABEL = 2, + EH_LABEL = 3, + GC_LABEL = 4, + + /// KILL - This instruction is a noop that is used only to adjust the + /// liveness of registers. This can be useful when dealing with + /// sub-registers. + KILL = 5, + + /// EXTRACT_SUBREG - This instruction takes two operands: a register + /// that has subregisters, and a subregister index. It returns the + /// extracted subregister value. This is commonly used to implement + /// truncation operations on target architectures which support it. + EXTRACT_SUBREG = 6, + + /// INSERT_SUBREG - This instruction takes three operands: a register + /// that has subregisters, a register providing an insert value, and a + /// subregister index. It returns the value of the first register with + /// the value of the second register inserted. The first register is + /// often defined by an IMPLICIT_DEF, as is commonly used to implement + /// anyext operations on target architectures which support it. + INSERT_SUBREG = 7, + + /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef. + IMPLICIT_DEF = 8, + + /// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except + /// that the first operand is an immediate integer constant. This constant + /// is often zero, as is commonly used to implement zext operations on + /// target architectures which support it, such as with x86-64 (with + /// zext from i32 to i64 via implicit zero-extension). + SUBREG_TO_REG = 9, + + /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain + /// register-to-register copy into a specific register class. This is only + /// used between instruction selection and MachineInstr creation, before + /// virtual registers have been created for all the instructions, and it's + /// only needed in cases where the register classes implied by the + /// instructions are insufficient. The actual MachineInstrs to perform + /// the copy are emitted with the TargetInstrInfo::copyRegToReg hook. + COPY_TO_REGCLASS = 10, + + // DBG_VALUE - a mapping of the llvm.dbg.value intrinsic + DBG_VALUE = 11 + }; +} // end namespace TargetOpcode +} // end namespace llvm + +#endif Modified: llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp (original) +++ llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp Tue Feb 9 13:54:29 2010 @@ -425,8 +425,7 @@ unsigned Reg = MO.getReg(); if (Reg == 0) continue; // Ignore KILLs and passthru registers for liveness... - if ((MI->getOpcode() == TargetInstrInfo::KILL) || - (PassthruRegs.count(Reg) != 0)) + if (MI->isKill() || (PassthruRegs.count(Reg) != 0)) continue; // Update def for Reg and aliases. @@ -481,7 +480,7 @@ // Form a group of all defs and uses of a KILL instruction to ensure // that all registers are renamed as a group. - if (MI->getOpcode() == TargetInstrInfo::KILL) { + if (MI->isKill()) { DEBUG(dbgs() << "\tKill Group:"); unsigned FirstReg = 0; @@ -792,7 +791,7 @@ // Ignore KILL instructions (they form a group in ScanInstruction // but don't cause any anti-dependence breaking themselves) - if (MI->getOpcode() != TargetInstrInfo::KILL) { + if (!MI->isKill()) { // Attempt to break each anti-dependency... for (unsigned i = 0, e = Edges.size(); i != e; ++i) { SDep *Edge = Edges[i]; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 9 13:54:29 2010 @@ -348,18 +348,18 @@ processDebugLoc(II, true); switch (II->getOpcode()) { - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: - case TargetInstrInfo::GC_LABEL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: + case TargetOpcode::GC_LABEL: printLabelInst(II); break; - case TargetInstrInfo::INLINEASM: + case TargetOpcode::INLINEASM: printInlineAsm(II); break; - case TargetInstrInfo::IMPLICIT_DEF: + case TargetOpcode::IMPLICIT_DEF: printImplicitDef(II); break; - case TargetInstrInfo::KILL: + case TargetOpcode::KILL: printKill(II); break; default: Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Feb 9 13:54:29 2010 @@ -133,7 +133,7 @@ SmallSet ImpDefRegs; MachineBasicBlock::iterator I = MBB->begin(); while (I != MBB->end()) { - if (I->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) + if (!I->isImplicitDef()) break; unsigned Reg = I->getOperand(0).getReg(); ImpDefRegs.insert(Reg); @@ -340,7 +340,7 @@ // relative order. This is untenable because normal compiler // optimizations (like this one) may reorder and/or merge these // directives. - I1->getOpcode() == TargetInstrInfo::INLINEASM) { + I1->isInlineAsm()) { ++I1; ++I2; break; } Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Tue Feb 9 13:54:29 2010 @@ -58,13 +58,7 @@ for (MachineBasicBlock::const_iterator mii = mbb->begin(), mie = mbb->end(); mii != mie; ++mii) { const MachineInstr *mi = mii; - if (tii->isIdentityCopy(*mi)) - continue; - - if (mi->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) - continue; - - if (mi->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + if (tii->isIdentityCopy(*mi) || mi->isImplicitDef() || mi->isDebugValue()) continue; for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Tue Feb 9 13:54:29 2010 @@ -106,7 +106,7 @@ // At the time of this writing, there are blocks which AnalyzeBranch // thinks end in single uncoditional branches, yet which have two CFG // successors. Code in this file is not prepared to reason about such things. - if (!MBB->empty() && MBB->back().getOpcode() == TargetInstrInfo::EH_LABEL) + if (!MBB->empty() && MBB->back().isEHLabel()) return false; // Aggressively handle return blocks and similar constructs. Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Tue Feb 9 13:54:29 2010 @@ -111,7 +111,7 @@ MIE = MBB->rend(); MII != MIE; ) { MachineInstr *MI = &*MII; - if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE) { + if (MI->isDebugValue()) { // Don't delete the DEBUG_VALUE itself, but if its Value operand is // a vreg and this is the only use, substitute an undef operand; // the former operand will then be deleted normally. Modified: llvm/trunk/lib/CodeGen/GCStrategy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCStrategy.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/GCStrategy.cpp (original) +++ llvm/trunk/lib/CodeGen/GCStrategy.cpp Tue Feb 9 13:54:29 2010 @@ -335,7 +335,7 @@ unsigned Label = MMI->NextLabelID(); BuildMI(MBB, MI, DL, - TII->get(TargetInstrInfo::GC_LABEL)).addImm(Label); + TII->get(TargetOpcode::GC_LABEL)).addImm(Label); return Label; } Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 9 13:54:29 2010 @@ -140,7 +140,7 @@ << ":\t\t# derived from " << mbbi->getName() << "\n"; for (MachineBasicBlock::iterator mii = mbbi->begin(), mie = mbbi->end(); mii != mie; ++mii) { - if (mii->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + if (mii->isDebugValue()) OS << SlotIndex::getEmptyKey() << '\t' << *mii; else OS << getInstructionIndex(mii) << '\t' << *mii; @@ -288,9 +288,7 @@ VNInfo *ValNo; MachineInstr *CopyMI = NULL; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; - if (mi->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - mi->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - mi->getOpcode() == TargetInstrInfo::SUBREG_TO_REG || + if (mi->isExtractSubreg() || mi->isInsertSubreg() || mi->isSubregToReg() || tii_->isMoveInstr(*mi, SrcReg, DstReg, SrcSubReg, DstSubReg)) CopyMI = mi; // Earlyclobbers move back one. @@ -460,9 +458,7 @@ VNInfo *ValNo; MachineInstr *CopyMI = NULL; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; - if (mi->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - mi->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - mi->getOpcode() == TargetInstrInfo::SUBREG_TO_REG || + if (mi->isExtractSubreg() || mi->isInsertSubreg() || mi->isSubregToReg()|| tii_->isMoveInstr(*mi, SrcReg, DstReg, SrcSubReg, DstSubReg)) CopyMI = mi; ValNo = interval.getNextValue(defIndex, CopyMI, true, VNInfoAllocator); @@ -577,9 +573,7 @@ else if (allocatableRegs_[MO.getReg()]) { MachineInstr *CopyMI = NULL; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; - if (MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG || + if (MI->isExtractSubreg() || MI->isInsertSubreg() || MI->isSubregToReg() || tii_->isMoveInstr(*MI, SrcReg, DstReg, SrcSubReg, DstSubReg)) CopyMI = MI; handlePhysicalRegisterDef(MBB, MI, MIIdx, MO, @@ -696,7 +690,7 @@ for (MachineBasicBlock::iterator MI = MBB->begin(), miEnd = MBB->end(); MI != miEnd; ++MI) { DEBUG(dbgs() << MIIndex << "\t" << *MI); - if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + if (MI->isDebugValue()) continue; // Handle defs. @@ -745,7 +739,7 @@ if (!VNI->getCopy()) return 0; - if (VNI->getCopy()->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + if (VNI->getCopy()->isExtractSubreg()) { // If it's extracting out of a physical register, return the sub-register. unsigned Reg = VNI->getCopy()->getOperand(1).getReg(); if (TargetRegisterInfo::isPhysicalRegister(Reg)) { @@ -759,8 +753,8 @@ Reg = tri_->getSubReg(Reg, VNI->getCopy()->getOperand(2).getImm()); } return Reg; - } else if (VNI->getCopy()->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - VNI->getCopy()->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) + } else if (VNI->getCopy()->isInsertSubreg() || + VNI->getCopy()->isSubregToReg()) return VNI->getCopy()->getOperand(2).getReg(); unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; @@ -922,7 +916,7 @@ SmallVector &Ops, bool isSS, int Slot, unsigned Reg) { // If it is an implicit def instruction, just delete it. - if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { + if (MI->isImplicitDef()) { RemoveMachineInstrFromMaps(MI); vrm.RemoveMachineInstrFromMaps(MI); MI->eraseFromParent(); @@ -1528,7 +1522,7 @@ MachineInstr *MI = &*ri; ++ri; if (O.isDef()) { - assert(MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF && + assert(MI->isImplicitDef() && "Register def was not rewritten?"); RemoveMachineInstrFromMaps(MI); vrm.RemoveMachineInstrFromMaps(MI); @@ -2059,7 +2053,7 @@ std::string msg; raw_string_ostream Msg(msg); Msg << "Ran out of registers during register allocation!"; - if (MI->getOpcode() == TargetInstrInfo::INLINEASM) { + if (MI->isInlineAsm()) { Msg << "\nPlease check your inline asm statement for invalid " << "constraints:\n"; MI->print(Msg, tm_); Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Tue Feb 9 13:54:29 2010 @@ -543,7 +543,7 @@ for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { MachineInstr *MI = I; - if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + if (MI->isDebugValue()) continue; DistanceMap.insert(std::make_pair(MI, Dist++)); @@ -552,7 +552,7 @@ // Unless it is a PHI node. In this case, ONLY process the DEF, not any // of the uses. They will be handled in other basic blocks. - if (MI->getOpcode() == TargetInstrInfo::PHI) + if (MI->isPHI()) NumOperandsToProcess = 1; SmallVector UseRegs; @@ -694,7 +694,7 @@ for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + BBI != BBE && BBI->isPHI(); ++BBI) for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) PHIVarInfo[BBI->getOperand(i + 1).getMBB()->getNumber()] .push_back(BBI->getOperand(i).getReg()); @@ -773,8 +773,7 @@ // All registers used by PHI nodes in SuccBB must be live through BB. for (MachineBasicBlock::const_iterator BBI = SuccBB->begin(), - BBE = SuccBB->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + BBE = SuccBB->end(); BBI != BBE && BBI->isPHI(); ++BBI) for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) if (BBI->getOperand(i+1).getMBB() == BB) getVarInfo(BBI->getOperand(i).getReg()).AliveBlocks.set(NumNew); Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LowerSubregs.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LowerSubregs.cpp (original) +++ llvm/trunk/lib/CodeGen/LowerSubregs.cpp Tue Feb 9 13:54:29 2010 @@ -129,7 +129,7 @@ if (MI->getOperand(1).isKill()) { // We must make sure the super-register gets killed. Replace the // instruction with KILL. - MI->setDesc(TII->get(TargetInstrInfo::KILL)); + MI->setDesc(TII->get(TargetOpcode::KILL)); MI->RemoveOperand(2); // SubIdx DEBUG(dbgs() << "subreg: replace by: " << *MI); return true; @@ -242,7 +242,7 @@ // , we need to make sure it is alive by inserting a KILL if (MI->getOperand(1).isUndef() && !MI->getOperand(0).isDead()) { MachineInstrBuilder MIB = BuildMI(*MBB, MI, MI->getDebugLoc(), - TII->get(TargetInstrInfo::KILL), DstReg); + TII->get(TargetOpcode::KILL), DstReg); if (MI->getOperand(2).isUndef()) MIB.addReg(InsReg, RegState::Undef); else @@ -260,7 +260,7 @@ // If the source register being inserted is undef, then this becomes a // KILL. BuildMI(*MBB, MI, MI->getDebugLoc(), - TII->get(TargetInstrInfo::KILL), DstSubReg); + TII->get(TargetOpcode::KILL), DstSubReg); else { bool Emitted = TII->copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); (void)Emitted; @@ -314,11 +314,11 @@ mi != me;) { MachineBasicBlock::iterator nmi = llvm::next(mi); MachineInstr *MI = mi; - if (MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + if (MI->isExtractSubreg()) { MadeChange |= LowerExtract(MI); - } else if (MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + } else if (MI->isInsertSubreg()) { MadeChange |= LowerInsert(MI); - } else if (MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) { + } else if (MI->isSubregToReg()) { MadeChange |= LowerSubregToReg(MI); } mi = nmi; Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue Feb 9 13:54:29 2010 @@ -548,8 +548,7 @@ if (MBBI != E) { // Skip debug declarations, we don't want a DebugLoc from them. MachineBasicBlock::iterator MBBI2 = MBBI; - while (MBBI2 != E && - MBBI2->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + while (MBBI2 != E && MBBI2->isDebugValue()) MBBI2++; if (MBBI2 != E) DL = MBBI2->getDebugLoc(); Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Feb 9 13:54:29 2010 @@ -740,20 +740,6 @@ } -/// isLabel - Returns true if the MachineInstr represents a label. -/// -bool MachineInstr::isLabel() const { - return getOpcode() == TargetInstrInfo::DBG_LABEL || - getOpcode() == TargetInstrInfo::EH_LABEL || - getOpcode() == TargetInstrInfo::GC_LABEL; -} - -/// isDebugLabel - Returns true if the MachineInstr represents a debug label. -/// -bool MachineInstr::isDebugLabel() const { - return getOpcode() == TargetInstrInfo::DBG_LABEL; -} - /// findRegisterUseOperandIdx() - Returns the MachineOperand that is a use of /// the specific register or -1 if it is not found. It further tightens /// the search criteria to a use that kills the register if isKill is true. @@ -819,7 +805,7 @@ /// first tied use operand index by reference is UseOpIdx is not null. bool MachineInstr:: isRegTiedToUseOperand(unsigned DefOpIdx, unsigned *UseOpIdx) const { - if (getOpcode() == TargetInstrInfo::INLINEASM) { + if (isInlineAsm()) { assert(DefOpIdx >= 2); const MachineOperand &MO = getOperand(DefOpIdx); if (!MO.isReg() || !MO.isDef() || MO.getReg() == 0) @@ -878,7 +864,7 @@ /// operand index by reference. bool MachineInstr:: isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx) const { - if (getOpcode() == TargetInstrInfo::INLINEASM) { + if (isInlineAsm()) { const MachineOperand &MO = getOperand(UseOpIdx); if (!MO.isReg() || !MO.isUse() || MO.getReg() == 0) return false; @@ -1088,7 +1074,7 @@ /// merges together the same virtual register, return the register, otherwise /// return 0. unsigned MachineInstr::isConstantValuePHI() const { - if (getOpcode() != TargetInstrInfo::PHI) + if (!isPHI()) return 0; assert(getNumOperands() >= 3 && "It's illegal to have a PHI without source operands"); Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Feb 9 13:54:29 2010 @@ -336,7 +336,7 @@ for (MachineRegisterInfo::use_iterator UI = RegInfo->use_begin(Reg), UE = RegInfo->use_end(); UI != UE; ++UI) { MachineInstr *UseMI = &*UI; - if (UseMI->getOpcode() == TargetInstrInfo::PHI) + if (UseMI->isPHI()) return true; } return false; @@ -363,7 +363,7 @@ /// IsProfitableToHoist - Return true if it is potentially profitable to hoist /// the given loop invariant. bool MachineLICM::IsProfitableToHoist(MachineInstr &MI) { - if (MI.getOpcode() == TargetInstrInfo::IMPLICIT_DEF) + if (MI.isImplicitDef()) return false; // FIXME: For now, only hoist re-materilizable instructions. LICM will Modified: llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp Tue Feb 9 13:54:29 2010 @@ -92,13 +92,13 @@ return 0; MachineBasicBlock::iterator I = BB->front(); - if (I->getOpcode() != TargetInstrInfo::PHI) + if (!I->isPHI()) return 0; AvailableValsTy AVals; for (unsigned i = 0, e = PredValues.size(); i != e; ++i) AVals[PredValues[i].first] = PredValues[i].second; - while (I != BB->end() && I->getOpcode() == TargetInstrInfo::PHI) { + while (I != BB->end() && I->isPHI()) { bool Same = true; for (unsigned i = 1, e = I->getNumOperands(); i != e; i += 2) { unsigned SrcReg = I->getOperand(i).getReg(); @@ -155,7 +155,7 @@ // If there are no predecessors, just return undef. if (BB->pred_empty()) { // Insert an implicit_def to represent an undef value. - MachineInstr *NewDef = InsertNewDef(TargetInstrInfo::IMPLICIT_DEF, + MachineInstr *NewDef = InsertNewDef(TargetOpcode::IMPLICIT_DEF, BB, BB->getFirstTerminator(), VRC, MRI, TII); return NewDef->getOperand(0).getReg(); @@ -192,7 +192,7 @@ // Otherwise, we do need a PHI: insert one now. MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front(); - MachineInstr *InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB, + MachineInstr *InsertedPHI = InsertNewDef(TargetOpcode::PHI, BB, Loc, VRC, MRI, TII); // Fill in all the predecessors of the PHI. @@ -231,7 +231,7 @@ void MachineSSAUpdater::RewriteUse(MachineOperand &U) { MachineInstr *UseMI = U.getParent(); unsigned NewVR = 0; - if (UseMI->getOpcode() == TargetInstrInfo::PHI) { + if (UseMI->isPHI()) { MachineBasicBlock *SourceBB = findCorrespondingPred(UseMI, &U); NewVR = GetValueAtEndOfBlockInternal(SourceBB); } else { @@ -277,7 +277,7 @@ // it. When we get back to the first instance of the recursion we will fill // in the PHI node. MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front(); - MachineInstr *NewPHI = InsertNewDef(TargetInstrInfo::PHI, BB, Loc, + MachineInstr *NewPHI = InsertNewDef(TargetOpcode::PHI, BB, Loc, VRC, MRI,TII); unsigned NewVR = NewPHI->getOperand(0).getReg(); InsertRes.first->second = NewVR; @@ -289,7 +289,7 @@ // be invalidated. if (BB->pred_empty()) { // Insert an implicit_def to represent an undef value. - MachineInstr *NewDef = InsertNewDef(TargetInstrInfo::IMPLICIT_DEF, + MachineInstr *NewDef = InsertNewDef(TargetOpcode::IMPLICIT_DEF, BB, BB->getFirstTerminator(), VRC, MRI, TII); return InsertRes.first->second = NewDef->getOperand(0).getReg(); @@ -358,7 +358,7 @@ MachineInstr *InsertedPHI; if (InsertedVal == 0) { MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front(); - InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB, Loc, + InsertedPHI = InsertNewDef(TargetOpcode::PHI, BB, Loc, VRC, MRI, TII); InsertedVal = InsertedPHI->getOperand(0).getReg(); } else { Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSink.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSink.cpp Tue Feb 9 13:54:29 2010 @@ -77,7 +77,7 @@ // Determine the block of the use. MachineInstr *UseInst = &*I; MachineBasicBlock *UseBlock = UseInst->getParent(); - if (UseInst->getOpcode() == TargetInstrInfo::PHI) { + if (UseInst->isPHI()) { // PHI nodes use the operand in the predecessor block, not the block with // the PHI. UseBlock = UseInst->getOperand(I.getOperandNo()+1).getMBB(); @@ -269,8 +269,7 @@ // Determine where to insert into. Skip phi nodes. MachineBasicBlock::iterator InsertPos = SuccToSinkTo->begin(); - while (InsertPos != SuccToSinkTo->end() && - InsertPos->getOpcode() == TargetInstrInfo::PHI) + while (InsertPos != SuccToSinkTo->end() && InsertPos->isPHI()) ++InsertPos; // Move the instruction. Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Tue Feb 9 13:54:29 2010 @@ -590,7 +590,7 @@ // must be live in. PHI instructions are handled separately. if (MInfo.regsKilled.count(Reg)) report("Using a killed virtual register", MO, MONum); - else if (MI->getOpcode() != TargetInstrInfo::PHI) + else if (!MI->isPHI()) MInfo.vregsLiveIn.insert(std::make_pair(Reg, MI)); } } @@ -650,10 +650,8 @@ } case MachineOperand::MO_MachineBasicBlock: - if (MI->getOpcode() == TargetInstrInfo::PHI) { - if (!MO->getMBB()->isSuccessor(MI->getParent())) - report("PHI operand is not in the CFG", MO, MONum); - } + if (MI->isPHI() && !MO->getMBB()->isSuccessor(MI->getParent())) + report("PHI operand is not in the CFG", MO, MONum); break; default: @@ -783,7 +781,7 @@ // calcRegsPassed has been run so BBInfo::isLiveOut is valid. void MachineVerifier::checkPHIOps(const MachineBasicBlock *MBB) { for (MachineBasicBlock::const_iterator BBI = MBB->begin(), BBE = MBB->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) { + BBI != BBE && BBI->isPHI(); ++BBI) { DenseSet seen; for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) { Modified: llvm/trunk/lib/CodeGen/OptimizeExts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/OptimizeExts.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/OptimizeExts.cpp (original) +++ llvm/trunk/lib/CodeGen/OptimizeExts.cpp Tue Feb 9 13:54:29 2010 @@ -110,7 +110,7 @@ MachineInstr *UseMI = &*UI; if (UseMI == MI) continue; - if (UseMI->getOpcode() == TargetInstrInfo::PHI) { + if (UseMI->isPHI()) { ExtendLife = false; continue; } @@ -150,7 +150,7 @@ UI = MRI->use_begin(DstReg); for (MachineRegisterInfo::use_iterator UE = MRI->use_end(); UI != UE; ++UI) - if (UI->getOpcode() == TargetInstrInfo::PHI) + if (UI->isPHI()) PHIBBs.insert(UI->getParent()); const TargetRegisterClass *RC = MRI->getRegClass(SrcReg); @@ -162,7 +162,7 @@ continue; unsigned NewVR = MRI->createVirtualRegister(RC); BuildMI(*UseMBB, UseMI, UseMI->getDebugLoc(), - TII->get(TargetInstrInfo::EXTRACT_SUBREG), NewVR) + TII->get(TargetOpcode::EXTRACT_SUBREG), NewVR) .addReg(DstReg).addImm(SubIdx); UseMO->setReg(NewVR); ++NumReuse; Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Tue Feb 9 13:54:29 2010 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Function.h" #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/SmallPtrSet.h" @@ -95,14 +96,14 @@ /// bool llvm::PHIElimination::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) { - if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) + if (MBB.empty() || !MBB.front().isPHI()) return false; // Quick exit for basic blocks without PHIs. // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = SkipPHIsAndLabels(MBB, MBB.begin()); - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) + while (MBB.front().isPHI()) LowerAtomicPHINode(MBB, AfterPHIsIt); return true; @@ -115,7 +116,7 @@ for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) { unsigned SrcReg = MPhi->getOperand(i).getReg(); const MachineInstr *DefMI = MRI->getVRegDef(SrcReg); - if (!DefMI || DefMI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) + if (!DefMI || !DefMI->isImplicitDef()) return false; } return true; @@ -197,7 +198,7 @@ // If all sources of a PHI node are implicit_def, just emit an // implicit_def instead of a copy. BuildMI(MBB, AfterPHIsIt, MPhi->getDebugLoc(), - TII->get(TargetInstrInfo::IMPLICIT_DEF), DestReg); + TII->get(TargetOpcode::IMPLICIT_DEF), DestReg); else { // Can we reuse an earlier PHI node? This only happens for critical edges, // typically those created by tail duplication. @@ -281,7 +282,7 @@ // If source is defined by an implicit def, there is no need to insert a // copy. MachineInstr *DefMI = MRI->getVRegDef(SrcReg); - if (DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { + if (DefMI->isImplicitDef()) { ImpDefs.insert(DefMI); continue; } @@ -375,7 +376,7 @@ for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + BBI != BBE && BBI->isPHI(); ++BBI) for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) ++VRegPHIUseCount[BBVRegPair(BBI->getOperand(i+1).getMBB()->getNumber(), BBI->getOperand(i).getReg())]; @@ -384,12 +385,11 @@ bool llvm::PHIElimination::SplitPHIEdges(MachineFunction &MF, MachineBasicBlock &MBB, LiveVariables &LV) { - if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI || - MBB.isLandingPad()) + if (MBB.empty() || !MBB.front().isPHI() || MBB.isLandingPad()) return false; // Quick exit for basic blocks without PHIs. for (MachineBasicBlock::const_iterator BBI = MBB.begin(), BBE = MBB.end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) { + BBI != BBE && BBI->isPHI(); ++BBI) { for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) { unsigned Reg = BBI->getOperand(i).getReg(); MachineBasicBlock *PreMBB = BBI->getOperand(i+1).getMBB(); @@ -438,7 +438,7 @@ // Fix PHI nodes in B so they refer to NMBB instead of A for (MachineBasicBlock::iterator i = B->begin(), e = B->end(); - i != e && i->getOpcode() == TargetInstrInfo::PHI; ++i) + i != e && i->isPHI(); ++i) for (unsigned ni = 1, ne = i->getNumOperands(); ni != ne; ni += 2) if (i->getOperand(ni+1).getMBB() == A) i->getOperand(ni+1).setMBB(NMBB); Modified: llvm/trunk/lib/CodeGen/PHIElimination.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.h?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PHIElimination.h (original) +++ llvm/trunk/lib/CodeGen/PHIElimination.h Tue Feb 9 13:54:29 2010 @@ -14,10 +14,11 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" namespace llvm { - + class LiveVariables; + /// Lower PHI instructions to copies. class PHIElimination : public MachineFunctionPass { MachineRegisterInfo *MRI; // Machine register information @@ -112,8 +113,7 @@ MachineBasicBlock::iterator I) { // Rather than assuming that EH labels come before other kinds of labels, // just skip all labels. - while (I != MBB.end() && - (I->getOpcode() == TargetInstrInfo::PHI || I->isLabel())) + while (I != MBB.end() && (I->isPHI() || I->isLabel())) ++I; return I; } Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original) +++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Tue Feb 9 13:54:29 2010 @@ -686,8 +686,7 @@ SlotIndex DefIdx = LIs->getInstructionIndex(&*DI); DefIdx = DefIdx.getDefIndex(); - assert(DI->getOpcode() != TargetInstrInfo::PHI && - "PHI instr in code during pre-alloc splitting."); + assert(!DI->isPHI() && "PHI instr in code during pre-alloc splitting."); VNInfo* NewVN = LI->getNextValue(DefIdx, 0, true, Alloc); // If the def is a move, set the copy field. Modified: llvm/trunk/lib/CodeGen/ProcessImplicitDefs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ProcessImplicitDefs.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ProcessImplicitDefs.cpp (original) +++ llvm/trunk/lib/CodeGen/ProcessImplicitDefs.cpp Tue Feb 9 13:54:29 2010 @@ -49,9 +49,9 @@ Reg == SrcReg) return true; - if (OpIdx == 2 && MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) + if (OpIdx == 2 && MI->isSubregToReg()) return true; - if (OpIdx == 1 && MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) + if (OpIdx == 1 && MI->isExtractSubreg()) return true; return false; } @@ -88,7 +88,7 @@ I != E; ) { MachineInstr *MI = &*I; ++I; - if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { + if (MI->isImplicitDef()) { unsigned Reg = MI->getOperand(0).getReg(); ImpDefRegs.insert(Reg); if (TargetRegisterInfo::isPhysicalRegister(Reg)) { @@ -99,7 +99,7 @@ continue; } - if (MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + if (MI->isInsertSubreg()) { MachineOperand &MO = MI->getOperand(2); if (ImpDefRegs.count(MO.getReg())) { // %reg1032 = INSERT_SUBREG %reg1032, undef, 2 @@ -127,7 +127,7 @@ // Use is a copy, just turn it into an implicit_def. if (CanTurnIntoImplicitDef(MI, Reg, i, tii_)) { bool isKill = MO.isKill(); - MI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF)); + MI->setDesc(tii_->get(TargetOpcode::IMPLICIT_DEF)); for (int j = MI->getNumOperands() - 1, ee = 0; j > ee; --j) MI->RemoveOperand(j); if (isKill) { @@ -187,7 +187,7 @@ for (MachineRegisterInfo::def_iterator DI = mri_->def_begin(Reg), DE = mri_->def_end(); DI != DE; ++DI) { MachineInstr *DeadImpDef = &*DI; - if (DeadImpDef->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) { + if (!DeadImpDef->isImplicitDef()) { Skip = true; break; } @@ -220,7 +220,7 @@ unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; if (tii_->isMoveInstr(*RMI, SrcReg, DstReg, SrcSubReg, DstSubReg) && Reg == SrcReg) { - RMI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF)); + RMI->setDesc(tii_->get(TargetOpcode::IMPLICIT_DEF)); bool isKill = false; SmallVector Ops; Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Tue Feb 9 13:54:29 2010 @@ -161,7 +161,7 @@ if (Size > MaxCallFrameSize) MaxCallFrameSize = Size; HasCalls = true; FrameSDOps.push_back(I); - } else if (I->getOpcode() == TargetInstrInfo::INLINEASM) { + } else if (I->isInlineAsm()) { // An InlineAsm might be a call; assume it is to get the stack frame // aligned correctly for calls. HasCalls = true; Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Tue Feb 9 13:54:29 2010 @@ -531,7 +531,7 @@ std::string msg; raw_string_ostream Msg(msg); Msg << "Ran out of registers during register allocation!"; - if (MI->getOpcode() == TargetInstrInfo::INLINEASM) { + if (MI->isInlineAsm()) { Msg << "\nPlease check your inline asm statement for invalid " << "constraints:\n"; MI->print(Msg, TM); @@ -544,7 +544,7 @@ std::string msg; raw_string_ostream Msg(msg); Msg << "Ran out of registers during register allocation!"; - if (MI->getOpcode() == TargetInstrInfo::INLINEASM) { + if (MI->isInlineAsm()) { Msg << "\nPlease check your inline asm statement for invalid " << "constraints:\n"; MI->print(Msg, TM); @@ -796,7 +796,7 @@ // have in them, then mark them unallocatable. // If any virtual regs are earlyclobber, allocate them now (before // freeing inputs that are killed). - if (MI->getOpcode()==TargetInstrInfo::INLINEASM) { + if (MI->isInlineAsm()) { for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); if (MO.isReg() && MO.isDef() && MO.isEarlyClobber() && @@ -845,7 +845,7 @@ // change the DEBUG_VALUE to be undef, which prevents the register // from being reloaded here. Doing that would change the generated // code, unless another use immediately follows this instruction. - if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE && + if (MI->isDebugValue() && MI->getNumOperands()==3 && MI->getOperand(0).isReg()) { unsigned VirtReg = MI->getOperand(0).getReg(); if (VirtReg && TargetRegisterInfo::isVirtualRegister(VirtReg) && Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Feb 9 13:54:29 2010 @@ -121,7 +121,7 @@ Reg = LocalValueMap[CE]; } else if (isa(V)) { Reg = createResultReg(TLI.getRegClassFor(VT)); - BuildMI(MBB, DL, TII.get(TargetInstrInfo::IMPLICIT_DEF), Reg); + BuildMI(MBB, DL, TII.get(TargetOpcode::IMPLICIT_DEF), Reg); } // If target-independent code couldn't handle the value, give target-specific @@ -971,7 +971,7 @@ const TargetRegisterClass* RC = MRI.getRegClass(Op0); unsigned ResultReg = createResultReg(TLI.getRegClassFor(RetVT)); - const TargetInstrDesc &II = TII.get(TargetInstrInfo::EXTRACT_SUBREG); + const TargetInstrDesc &II = TII.get(TargetOpcode::EXTRACT_SUBREG); if (II.getNumDefs() >= 1) BuildMI(MBB, DL, II, ResultReg).addReg(Op0).addImm(Idx); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Tue Feb 9 13:54:29 2010 @@ -227,7 +227,7 @@ unsigned NumRegisters = TLI.getNumRegisters(Fn->getContext(), VT); const TargetInstrInfo *TII = MF->getTarget().getInstrInfo(); for (unsigned i = 0; i != NumRegisters; ++i) - BuildMI(MBB, DL, TII->get(TargetInstrInfo::PHI), PHIReg + i); + BuildMI(MBB, DL, TII->get(TargetOpcode::PHI), PHIReg + i); PHIReg += NumRegisters; } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -178,7 +178,7 @@ const TargetInstrDesc &II, bool IsClone, bool IsCloned, DenseMap &VRBaseMap) { - assert(Node->getMachineOpcode() != TargetInstrInfo::IMPLICIT_DEF && + assert(Node->getMachineOpcode() != TargetOpcode::IMPLICIT_DEF && "IMPLICIT_DEF should have been handled as a special case elsewhere!"); for (unsigned i = 0; i < II.getNumDefs(); ++i) { @@ -236,7 +236,7 @@ unsigned InstrEmitter::getVR(SDValue Op, DenseMap &VRBaseMap) { if (Op.isMachineOpcode() && - Op.getMachineOpcode() == TargetInstrInfo::IMPLICIT_DEF) { + Op.getMachineOpcode() == TargetOpcode::IMPLICIT_DEF) { // Add an IMPLICIT_DEF instruction before every use. unsigned VReg = getDstOfOnlyCopyToRegUse(Op.getNode(), Op.getResNo()); // IMPLICIT_DEF can produce any type of result so its TargetInstrDesc @@ -246,7 +246,7 @@ VReg = MRI->createVirtualRegister(RC); } BuildMI(MBB, Op.getDebugLoc(), - TII->get(TargetInstrInfo::IMPLICIT_DEF), VReg); + TII->get(TargetOpcode::IMPLICIT_DEF), VReg); return VReg; } @@ -396,12 +396,12 @@ } } - if (Opc == TargetInstrInfo::EXTRACT_SUBREG) { + if (Opc == TargetOpcode::EXTRACT_SUBREG) { unsigned SubIdx = cast(Node->getOperand(1))->getZExtValue(); // Create the extract_subreg machine instruction. MachineInstr *MI = BuildMI(*MF, Node->getDebugLoc(), - TII->get(TargetInstrInfo::EXTRACT_SUBREG)); + TII->get(TargetOpcode::EXTRACT_SUBREG)); // Figure out the register class to create for the destreg. unsigned VReg = getVR(Node->getOperand(0), VRBaseMap); @@ -424,8 +424,8 @@ AddOperand(MI, Node->getOperand(0), 0, 0, VRBaseMap); MI->addOperand(MachineOperand::CreateImm(SubIdx)); MBB->insert(InsertPos, MI); - } else if (Opc == TargetInstrInfo::INSERT_SUBREG || - Opc == TargetInstrInfo::SUBREG_TO_REG) { + } else if (Opc == TargetOpcode::INSERT_SUBREG || + Opc == TargetOpcode::SUBREG_TO_REG) { SDValue N0 = Node->getOperand(0); SDValue N1 = Node->getOperand(1); SDValue N2 = Node->getOperand(2); @@ -452,7 +452,7 @@ // If creating a subreg_to_reg, then the first input operand // is an implicit value immediate, otherwise it's a register - if (Opc == TargetInstrInfo::SUBREG_TO_REG) { + if (Opc == TargetOpcode::SUBREG_TO_REG) { const ConstantSDNode *SD = cast(N0); MI->addOperand(MachineOperand::CreateImm(SD->getZExtValue())); } else @@ -507,20 +507,20 @@ unsigned Opc = Node->getMachineOpcode(); // Handle subreg insert/extract specially - if (Opc == TargetInstrInfo::EXTRACT_SUBREG || - Opc == TargetInstrInfo::INSERT_SUBREG || - Opc == TargetInstrInfo::SUBREG_TO_REG) { + if (Opc == TargetOpcode::EXTRACT_SUBREG || + Opc == TargetOpcode::INSERT_SUBREG || + Opc == TargetOpcode::SUBREG_TO_REG) { EmitSubregNode(Node, VRBaseMap); return; } // Handle COPY_TO_REGCLASS specially. - if (Opc == TargetInstrInfo::COPY_TO_REGCLASS) { + if (Opc == TargetOpcode::COPY_TO_REGCLASS) { EmitCopyToRegClassNode(Node, VRBaseMap); return; } - if (Opc == TargetInstrInfo::IMPLICIT_DEF) + if (Opc == TargetOpcode::IMPLICIT_DEF) // We want a unique VR for each IMPLICIT_DEF use. return; @@ -640,7 +640,7 @@ // Create the inline asm machine instruction. MachineInstr *MI = BuildMI(*MF, Node->getDebugLoc(), - TII->get(TargetInstrInfo::INLINEASM)); + TII->get(TargetOpcode::INLINEASM)); // Add the asm string as an external symbol operand. const char *AsmStr = Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Feb 9 13:54:29 2010 @@ -1042,9 +1042,9 @@ // CopyToReg should be close to its uses to facilitate coalescing and // avoid spilling. return 0; - if (Opc == TargetInstrInfo::EXTRACT_SUBREG || - Opc == TargetInstrInfo::SUBREG_TO_REG || - Opc == TargetInstrInfo::INSERT_SUBREG) + if (Opc == TargetOpcode::EXTRACT_SUBREG || + Opc == TargetOpcode::SUBREG_TO_REG || + Opc == TargetOpcode::INSERT_SUBREG) // EXTRACT_SUBREG, INSERT_SUBREG, and SUBREG_TO_REG nodes should be // close to their uses to facilitate coalescing. return 0; @@ -1445,7 +1445,7 @@ while (SuccSU->Succs.size() == 1 && SuccSU->getNode()->isMachineOpcode() && SuccSU->getNode()->getMachineOpcode() == - TargetInstrInfo::COPY_TO_REGCLASS) + TargetOpcode::COPY_TO_REGCLASS) SuccSU = SuccSU->Succs.front().getSUnit(); // Don't constrain non-instruction nodes. if (!SuccSU->getNode() || !SuccSU->getNode()->isMachineOpcode()) @@ -1459,9 +1459,9 @@ // Don't constrain EXTRACT_SUBREG, INSERT_SUBREG, and SUBREG_TO_REG; // these may be coalesced away. We want them close to their uses. unsigned SuccOpc = SuccSU->getNode()->getMachineOpcode(); - if (SuccOpc == TargetInstrInfo::EXTRACT_SUBREG || - SuccOpc == TargetInstrInfo::INSERT_SUBREG || - SuccOpc == TargetInstrInfo::SUBREG_TO_REG) + if (SuccOpc == TargetOpcode::EXTRACT_SUBREG || + SuccOpc == TargetOpcode::INSERT_SUBREG || + SuccOpc == TargetOpcode::SUBREG_TO_REG) continue; if ((!canClobber(SuccSU, DUSU) || (hasCopyToRegUse(SU) && !hasCopyToRegUse(SuccSU)) || Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 9 13:54:29 2010 @@ -4872,23 +4872,23 @@ } /// getTargetExtractSubreg - A convenience function for creating -/// TargetInstrInfo::EXTRACT_SUBREG nodes. +/// TargetOpcode::EXTRACT_SUBREG nodes. SDValue SelectionDAG::getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT, SDValue Operand) { SDValue SRIdxVal = getTargetConstant(SRIdx, MVT::i32); - SDNode *Subreg = getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, DL, + SDNode *Subreg = getMachineNode(TargetOpcode::EXTRACT_SUBREG, DL, VT, Operand, SRIdxVal); return SDValue(Subreg, 0); } /// getTargetInsertSubreg - A convenience function for creating -/// TargetInstrInfo::INSERT_SUBREG nodes. +/// TargetOpcode::INSERT_SUBREG nodes. SDValue SelectionDAG::getTargetInsertSubreg(int SRIdx, DebugLoc DL, EVT VT, SDValue Operand, SDValue Subreg) { SDValue SRIdxVal = getTargetConstant(SRIdx, MVT::i32); - SDNode *Result = getMachineNode(TargetInstrInfo::INSERT_SUBREG, DL, + SDNode *Result = getMachineNode(TargetOpcode::INSERT_SUBREG, DL, VT, Operand, Subreg, SRIdxVal); return SDValue(Result, 0); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 9 13:54:29 2010 @@ -801,7 +801,7 @@ // landing pad can thus be detected via the MachineModuleInfo. unsigned LabelID = MMI->addLandingPad(BB); - const TargetInstrDesc &II = TII.get(TargetInstrInfo::EH_LABEL); + const TargetInstrDesc &II = TII.get(TargetOpcode::EH_LABEL); BuildMI(BB, SDB->getCurDebugLoc(), II).addImm(LabelID); // Mark exception register as live in. @@ -953,7 +953,7 @@ SDB->BitTestCases.empty()) { for (unsigned i = 0, e = SDB->PHINodesToUpdate.size(); i != e; ++i) { MachineInstr *PHI = SDB->PHINodesToUpdate[i].first; - assert(PHI->getOpcode() == TargetInstrInfo::PHI && + assert(PHI->isPHI() && "This is not a machine PHI node that we are updating!"); PHI->addOperand(MachineOperand::CreateReg(SDB->PHINodesToUpdate[i].second, false)); @@ -1000,7 +1000,7 @@ for (unsigned pi = 0, pe = SDB->PHINodesToUpdate.size(); pi != pe; ++pi) { MachineInstr *PHI = SDB->PHINodesToUpdate[pi].first; MachineBasicBlock *PHIBB = PHI->getParent(); - assert(PHI->getOpcode() == TargetInstrInfo::PHI && + assert(PHI->isPHI() && "This is not a machine PHI node that we are updating!"); // This is "default" BB. We have two jumps to it. From "header" BB and // from last "case" BB. @@ -1056,7 +1056,7 @@ for (unsigned pi = 0, pe = SDB->PHINodesToUpdate.size(); pi != pe; ++pi) { MachineInstr *PHI = SDB->PHINodesToUpdate[pi].first; MachineBasicBlock *PHIBB = PHI->getParent(); - assert(PHI->getOpcode() == TargetInstrInfo::PHI && + assert(PHI->isPHI() && "This is not a machine PHI node that we are updating!"); // "default" BB. We can go there only from header BB. if (PHIBB == SDB->JTCases[i].second.Default) { @@ -1079,7 +1079,7 @@ // need to update PHI nodes in that block. for (unsigned i = 0, e = SDB->PHINodesToUpdate.size(); i != e; ++i) { MachineInstr *PHI = SDB->PHINodesToUpdate[i].first; - assert(PHI->getOpcode() == TargetInstrInfo::PHI && + assert(PHI->isPHI() && "This is not a machine PHI node that we are updating!"); if (BB->isSuccessor(PHI->getParent())) { PHI->addOperand(MachineOperand::CreateReg(SDB->PHINodesToUpdate[i].second, @@ -1116,7 +1116,7 @@ // BB may have been removed from the CFG if a branch was constant folded. if (ThisBB->isSuccessor(BB)) { for (MachineBasicBlock::iterator Phi = BB->begin(); - Phi != BB->end() && Phi->getOpcode() == TargetInstrInfo::PHI; + Phi != BB->end() && Phi->isPHI(); ++Phi) { // This value for this PHI node is recorded in PHINodesToUpdate. for (unsigned pn = 0; ; ++pn) { @@ -1410,15 +1410,14 @@ } SDNode *SelectionDAGISel::Select_UNDEF(SDNode *N) { - return CurDAG->SelectNodeTo(N, TargetInstrInfo::IMPLICIT_DEF, - N->getValueType(0)); + return CurDAG->SelectNodeTo(N, TargetOpcode::IMPLICIT_DEF,N->getValueType(0)); } SDNode *SelectionDAGISel::Select_EH_LABEL(SDNode *N) { SDValue Chain = N->getOperand(0); unsigned C = cast(N)->getLabelID(); SDValue Tmp = CurDAG->getTargetConstant(C, MVT::i32); - return CurDAG->SelectNodeTo(N, TargetInstrInfo::EH_LABEL, + return CurDAG->SelectNodeTo(N, TargetOpcode::EH_LABEL, MVT::Other, Tmp, Chain); } Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Feb 9 13:54:29 2010 @@ -659,7 +659,7 @@ return false; if (TID.getNumDefs() != 1) return false; - if (DefMI->getOpcode() != TargetInstrInfo::IMPLICIT_DEF) { + if (!DefMI->isImplicitDef()) { // Make sure the copy destination register class fits the instruction // definition register class. The mismatch can happen as a result of earlier // extract_subreg, insert_subreg, subreg_to_reg coalescing. @@ -1170,7 +1170,7 @@ unsigned SubIdx = O.getSubReg(); if (SubIdx && !tri_->getSubReg(PhysReg, SubIdx)) return true; - if (MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + if (MI->isExtractSubreg()) { SubIdx = MI->getOperand(2).getImm(); if (O.isUse() && !tri_->getSubReg(PhysReg, SubIdx)) return true; @@ -1184,8 +1184,7 @@ return true; } } - if (MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) { + if (MI->isInsertSubreg() || MI->isSubregToReg()) { SubIdx = MI->getOperand(3).getImm(); if (VirtReg == MI->getOperand(0).getReg()) { if (!tri_->getSubReg(PhysReg, SubIdx)) @@ -1296,9 +1295,9 @@ DEBUG(dbgs() << li_->getInstructionIndex(CopyMI) << '\t' << *CopyMI); unsigned SrcReg, DstReg, SrcSubIdx = 0, DstSubIdx = 0; - bool isExtSubReg = CopyMI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG; - bool isInsSubReg = CopyMI->getOpcode() == TargetInstrInfo::INSERT_SUBREG; - bool isSubRegToReg = CopyMI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG; + bool isExtSubReg = CopyMI->isExtractSubreg(); + bool isInsSubReg = CopyMI->isInsertSubreg(); + bool isSubRegToReg = CopyMI->isSubregToReg(); unsigned SubIdx = 0; if (isExtSubReg) { DstReg = CopyMI->getOperand(0).getReg(); @@ -1866,11 +1865,11 @@ unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; if (TII->isMoveInstr(*MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) ; - else if (MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + else if (MI->isExtractSubreg()) { DstReg = MI->getOperand(0).getReg(); SrcReg = MI->getOperand(1).getReg(); - } else if (MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG || - MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + } else if (MI->isSubregToReg() || + MI->isInsertSubreg()) { DstReg = MI->getOperand(0).getReg(); SrcReg = MI->getOperand(2).getReg(); } else @@ -2442,16 +2441,15 @@ // If this isn't a copy nor a extract_subreg, we can't join intervals. unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; bool isInsUndef = false; - if (Inst->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + if (Inst->isExtractSubreg()) { DstReg = Inst->getOperand(0).getReg(); SrcReg = Inst->getOperand(1).getReg(); - } else if (Inst->getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + } else if (Inst->isInsertSubreg()) { DstReg = Inst->getOperand(0).getReg(); SrcReg = Inst->getOperand(2).getReg(); if (Inst->getOperand(1).isUndef()) isInsUndef = true; - } else if (Inst->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - Inst->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) { + } else if (Inst->isInsertSubreg() || Inst->isSubregToReg()) { DstReg = Inst->getOperand(0).getReg(); SrcReg = Inst->getOperand(2).getReg(); } else if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) @@ -2687,10 +2685,8 @@ // Delete all coalesced copies. bool DoDelete = true; if (!tii_->isMoveInstr(*MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { - assert((MI->getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - MI->getOpcode() == TargetInstrInfo::INSERT_SUBREG || - MI->getOpcode() == TargetInstrInfo::SUBREG_TO_REG) && - "Unrecognized copy instruction"); + assert((MI->isExtractSubreg() || MI->isInsertSubreg() || + MI->isSubregToReg()) && "Unrecognized copy instruction"); DstReg = MI->getOperand(0).getReg(); if (TargetRegisterInfo::isPhysicalRegister(DstReg)) // Do not delete extract_subreg, insert_subreg of physical Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Tue Feb 9 13:54:29 2010 @@ -107,8 +107,8 @@ for (MachineBasicBlock::iterator miItr = mbb->begin(), miEnd = mbb->end(); miItr != miEnd; ++miItr) { - MachineInstr *mi = &*miItr; - if (mi->getOpcode()==TargetInstrInfo::DEBUG_VALUE) + MachineInstr *mi = miItr; + if (mi->isDebugValue()) continue; if (miItr == mbb->getFirstTerminator()) { Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Tue Feb 9 13:54:29 2010 @@ -504,10 +504,8 @@ // Abort the use is actually a sub-register def. We don't have enough // information to figure out if it is really legal. - if (MO.getSubReg() || - TID.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG || - TID.getOpcode() == TargetInstrInfo::INSERT_SUBREG || - TID.getOpcode() == TargetInstrInfo::SUBREG_TO_REG) + if (MO.getSubReg() || MII->isExtractSubreg() || + MII->isInsertSubreg() || MII->isSubregToReg()) return false; const TargetRegisterClass *RC = TID.OpInfo[i].getRegClass(TRI); @@ -569,8 +567,7 @@ // Abort the use is actually a sub-register use. We don't have enough // information to figure out if it is really legal. - if (MO.getSubReg() || - TID.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) + if (MO.getSubReg() || MII->isExtractSubreg()) return false; const TargetRegisterClass *RC = TID.OpInfo[i].getRegClass(TRI); Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Feb 9 13:54:29 2010 @@ -419,7 +419,7 @@ // Iterate over all the PHI nodes in this block MachineBasicBlock::iterator P = MBB->begin(); - while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) { + while (P != MBB->end() && P->isPHI()) { unsigned DestReg = P->getOperand(0).getReg(); // Don't both doing PHI elimination for dead PHI's. @@ -452,7 +452,7 @@ // We don't need to insert copies for implicit_defs. MachineInstr* DefMI = MRI.getVRegDef(SrcReg); - if (DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) + if (DefMI->isImplicitDef()) ProcessedNames.insert(SrcReg); // Check for trivial interferences via liveness information, allowing us @@ -470,7 +470,7 @@ if (isLiveIn(SrcReg, P->getParent(), LI) || isLiveOut(P->getOperand(0).getReg(), MRI.getVRegDef(SrcReg)->getParent(), LI) || - ( MRI.getVRegDef(SrcReg)->getOpcode() == TargetInstrInfo::PHI && + ( MRI.getVRegDef(SrcReg)->isPHI() && isLiveIn(P->getOperand(0).getReg(), MRI.getVRegDef(SrcReg)->getParent(), LI) ) || ProcessedNames.count(SrcReg) || @@ -810,7 +810,7 @@ // Rewrite register uses from Stacks for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { - if (I->getOpcode() == TargetInstrInfo::PHI) + if (I->isPHI()) continue; for (unsigned i = 0; i < I->getNumOperands(); ++i) @@ -907,8 +907,7 @@ // Determine which phi node operands need copies for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) - if (!I->empty() && - I->begin()->getOpcode() == TargetInstrInfo::PHI) + if (!I->empty() && I->begin()->isPHI()) processBlock(I); // Break interferences where two different phis want to coalesce @@ -996,7 +995,7 @@ for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) { for (MachineBasicBlock::iterator BI = I->begin(), BE = I->end(); BI != BE; ++BI) - if (BI->getOpcode() == TargetInstrInfo::PHI) + if (BI->isPHI()) phis.push_back(BI); } Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Tue Feb 9 13:54:29 2010 @@ -121,7 +121,7 @@ MBB->pred_end()); MachineBasicBlock::iterator MI = MBB->begin(); while (MI != MBB->end()) { - if (MI->getOpcode() != TargetInstrInfo::PHI) + if (!MI->isPHI()) break; for (SmallSetVector::iterator PI = Preds.begin(), PE = Preds.end(); PI != PE; ++PI) { @@ -378,7 +378,7 @@ MachineBasicBlock *SuccBB = *SI; for (MachineBasicBlock::iterator II = SuccBB->begin(), EE = SuccBB->end(); II != EE; ++II) { - if (II->getOpcode() != TargetInstrInfo::PHI) + if (!II->isPHI()) break; unsigned Idx = 0; for (unsigned i = 1, e = II->getNumOperands(); i != e; i += 2) { @@ -476,7 +476,7 @@ if (InstrCount == MaxDuplicateCount) return false; // Remember if we saw a call. if (I->getDesc().isCall()) HasCall = true; - if (I->getOpcode() != TargetInstrInfo::PHI) + if (!I->isPHI()) InstrCount += 1; } // Heuristically, don't tail-duplicate calls if it would expand code size, @@ -528,7 +528,7 @@ while (I != TailBB->end()) { MachineInstr *MI = &*I; ++I; - if (MI->getOpcode() == TargetInstrInfo::PHI) { + if (MI->isPHI()) { // Replace the uses of the def of the PHI with the register coming // from PredBB. ProcessPHI(MI, TailBB, PredBB, LocalVRMap, CopyInfos); @@ -580,7 +580,7 @@ SmallVector, 4> CopyInfos; MachineBasicBlock::iterator I = TailBB->begin(); // Process PHI instructions first. - while (I != TailBB->end() && I->getOpcode() == TargetInstrInfo::PHI) { + while (I != TailBB->end() && I->isPHI()) { // Replace the uses of the def of the PHI with the register coming // from PredBB. MachineInstr *MI = &*I++; Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Feb 9 13:54:29 2010 @@ -316,9 +316,7 @@ E = MRI->reg_end(); I != E; ++I) { MachineOperand &MO = I.getOperand(); MachineInstr *MI = MO.getParent(); - if (MI->getParent() != MBB) - continue; - if (MI->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + if (MI->getParent() != MBB || MI->isDebugValue()) continue; DenseMap::iterator DI = DistanceMap.find(MI); if (DI == DistanceMap.end()) @@ -341,9 +339,7 @@ E = MRI->reg_end(); I != E; ++I) { MachineOperand &MO = I.getOperand(); MachineInstr *MI = MO.getParent(); - if (MI->getParent() != MBB) - continue; - if (MI->getOpcode() == TargetInstrInfo::DEBUG_VALUE) + if (MI->getParent() != MBB || MI->isDebugValue()) continue; DenseMap::iterator DI = DistanceMap.find(MI); if (DI == DistanceMap.end()) @@ -369,13 +365,13 @@ DstReg = 0; unsigned SrcSubIdx, DstSubIdx; if (!TII->isMoveInstr(MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { - if (MI.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG) { + if (MI.isExtractSubreg()) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(1).getReg(); - } else if (MI.getOpcode() == TargetInstrInfo::INSERT_SUBREG) { + } else if (MI.isInsertSubreg()) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(2).getReg(); - } else if (MI.getOpcode() == TargetInstrInfo::SUBREG_TO_REG) { + } else if (MI.isSubregToReg()) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(2).getReg(); } @@ -433,8 +429,7 @@ /// as a two-address use. If so, return the destination register by reference. static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) { const TargetInstrDesc &TID = MI.getDesc(); - unsigned NumOps = (MI.getOpcode() == TargetInstrInfo::INLINEASM) - ? MI.getNumOperands() : TID.getNumOperands(); + unsigned NumOps = MI.isInlineAsm() ? MI.getNumOperands():TID.getNumOperands(); for (unsigned i = 0; i != NumOps; ++i) { const MachineOperand &MO = MI.getOperand(i); if (!MO.isReg() || !MO.isUse() || MO.getReg() != Reg) @@ -937,7 +932,7 @@ // First scan through all the tied register uses in this instruction // and record a list of pairs of tied operands for each register. - unsigned NumOps = (mi->getOpcode() == TargetInstrInfo::INLINEASM) + unsigned NumOps = mi->isInlineAsm() ? mi->getNumOperands() : TID.getNumOperands(); for (unsigned SrcIdx = 0; SrcIdx < NumOps; ++SrcIdx) { unsigned DstIdx = 0; Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original) +++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Tue Feb 9 13:54:29 2010 @@ -148,8 +148,7 @@ MachineBasicBlock* succ = *BB->succ_begin(); MachineBasicBlock::iterator start = succ->begin(); - while (start != succ->end() && - start->getOpcode() == TargetInstrInfo::PHI) { + while (start != succ->end() && start->isPHI()) { for (unsigned i = start->getNumOperands() - 1; i >= 2; i-=2) if (start->getOperand(i).isMBB() && start->getOperand(i).getMBB() == BB) { @@ -188,8 +187,7 @@ SmallPtrSet preds(BB->pred_begin(), BB->pred_end()); MachineBasicBlock::iterator phi = BB->begin(); - while (phi != BB->end() && - phi->getOpcode() == TargetInstrInfo::PHI) { + while (phi != BB->end() && phi->isPHI()) { for (unsigned i = phi->getNumOperands() - 1; i >= 2; i-=2) if (!preds.count(phi->getOperand(i).getMBB())) { phi->RemoveOperand(i); Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 9 13:54:29 2010 @@ -1866,7 +1866,7 @@ if (VRM.isImplicitlyDefined(VirtReg)) // FIXME: Is this needed? BuildMI(MBB, &MI, MI.getDebugLoc(), - TII->get(TargetInstrInfo::IMPLICIT_DEF), Phys); + TII->get(TargetOpcode::IMPLICIT_DEF), Phys); continue; } @@ -1902,8 +1902,7 @@ // = EXTRACT_SUBREG fi#1 // fi#1 is available in EDI, but it cannot be reused because it's not in // the right register file. - if (PhysReg && !AvoidReload && - (SubIdx || MI.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG)) { + if (PhysReg && !AvoidReload && (SubIdx || MI.isExtractSubreg())) { const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg); if (!RC->contains(PhysReg)) PhysReg = 0; Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Tue Feb 9 13:54:29 2010 @@ -450,10 +450,10 @@ switch (Opc) { default: llvm_unreachable("Unknown or unset size field for instr!"); - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: return 0; } break; Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -553,7 +553,7 @@ default: llvm_unreachable("ARMCodeEmitter::emitPseudoInstruction"); // FIXME: Add support for MOVimm32. - case TargetInstrInfo::INLINEASM: { + case TargetOpcode::INLINEASM: { // We allow inline assembler nodes with empty bodies - they can // implicitly define registers, which is ok for JIT. if (MI.getOperand(0).getSymbolName()[0]) { @@ -561,12 +561,12 @@ } break; } - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getImm()); break; - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: // Do nothing. break; case ARM::CONSTPOOL_ENTRY: Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Feb 9 13:54:29 2010 @@ -732,7 +732,7 @@ // This pass should be run after register allocation, so there should be no // PHI nodes to update. - assert((Succ->empty() || Succ->begin()->getOpcode() != TargetInstrInfo::PHI) + assert((Succ->empty() || !Succ->begin()->isPHI()) && "PHI nodes should be eliminated by now!"); } Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Feb 9 13:54:29 2010 @@ -1007,12 +1007,12 @@ SDNode *ARMDAGToDAGISel::PairDRegs(EVT VT, SDValue V0, SDValue V1) { DebugLoc dl = V0.getNode()->getDebugLoc(); SDValue Undef = - SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, dl, VT), 0); + SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, VT), 0); SDValue SubReg0 = CurDAG->getTargetConstant(ARM::DSUBREG_0, MVT::i32); SDValue SubReg1 = CurDAG->getTargetConstant(ARM::DSUBREG_1, MVT::i32); - SDNode *Pair = CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, + SDNode *Pair = CurDAG->getMachineNode(TargetOpcode::INSERT_SUBREG, dl, VT, Undef, V0, SubReg0); - return CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, + return CurDAG->getMachineNode(TargetOpcode::INSERT_SUBREG, dl, VT, SDValue(Pair, 0), V1, SubReg1); } Modified: llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -95,8 +95,8 @@ case Alpha::ALTENT: case Alpha::PCLABEL: case Alpha::MEMLABEL: - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: break; //skip these } MCE.processDebugLoc(MI.getDebugLoc(), false); Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp Tue Feb 9 13:54:29 2010 @@ -175,7 +175,7 @@ // We cannot copy CC <-> !(CC/D) if ((isCC(DefRC) && !isDCC(UseRC)) || (isCC(UseRC) && !isDCC(DefRC))) { SDNode *Copy = - DAG.getMachineNode(TargetInstrInfo::COPY_TO_REGCLASS, + DAG.getMachineNode(TargetOpcode::COPY_TO_REGCLASS, NI->getDebugLoc(), MVT::i32, UI.getUse().get(), Modified: llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.cpp Tue Feb 9 13:54:29 2010 @@ -356,12 +356,12 @@ switch (Desc.getOpcode()) { default: assert(0 && "Unknown instruction size!"); - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: return 0; - case TargetInstrInfo::INLINEASM: { + case TargetOpcode::INLINEASM: { const MachineFunction *MF = MI->getParent()->getParent(); const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); return TII.getInlineAsmLength(MI->getOperand(0).getSymbolName(), Modified: llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td (original) +++ llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td Tue Feb 9 13:54:29 2010 @@ -285,7 +285,7 @@ // up to 16 bits. def def8 : PatLeaf<(i8 GR8:$src), [{ return N->getOpcode() != ISD::TRUNCATE && - N->getOpcode() != TargetInstrInfo::EXTRACT_SUBREG && + N->getOpcode() != TargetOpcode::EXTRACT_SUBREG && N->getOpcode() != ISD::CopyFromReg; }]>; Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Tue Feb 9 13:54:29 2010 @@ -245,7 +245,7 @@ // lwc $f1, X+4($3) SDNode *LD0 = CurDAG->getMachineNode(Mips::LWC1, dl, MVT::f32, MVT::Other, Offset0, Base, Chain); - SDValue Undef = SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + SDValue Undef = SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, NVT), 0); SDValue I0 = CurDAG->getTargetInsertSubreg(Mips::SUBREG_FPEVEN, dl, MVT::f64, Undef, SDValue(LD0, 0)); @@ -464,8 +464,7 @@ SDValue Zero = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, Mips::ZERO, MVT::i32); SDValue Undef = SDValue( - CurDAG->getMachineNode( - TargetInstrInfo::IMPLICIT_DEF, dl, MVT::f64), 0); + CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, MVT::f64), 0); SDNode *MTC = CurDAG->getMachineNode(Mips::MTC1, dl, MVT::f32, Zero); SDValue I0 = CurDAG->getTargetInsertSubreg(Mips::SUBREG_FPEVEN, dl, MVT::f64, Undef, SDValue(MTC, 0)); Modified: llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -108,12 +108,12 @@ default: MCE.emitWordBE(getBinaryCodeForInstr(MI)); break; - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getImm()); break; - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: break; // pseudo opcode, no side effects case PPC::MovePCtoLR: case PPC::MovePCtoLR8: Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Feb 9 13:54:29 2010 @@ -724,7 +724,7 @@ } // Take into account whether it's an add or mem instruction unsigned OffsetOperandNo = (FIOperandNo == 2) ? 1 : 2; - if (MI.getOpcode() == TargetInstrInfo::INLINEASM) + if (MI.isInlineAsm()) OffsetOperandNo = FIOperandNo-1; // Get the frame index. @@ -817,7 +817,7 @@ // addi 0:rA 1:rB, 2, imm ==> add 0:rA, 1:rB, 2:r0 unsigned OperandBase; - if (OpC != TargetInstrInfo::INLINEASM) { + if (OpC != TargetOpcode::INLINEASM) { assert(ImmToIdxMap.count(OpC) && "No indexed form of load or store available!"); unsigned NewOpcode = ImmToIdxMap.find(OpC)->second; Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp Tue Feb 9 13:54:29 2010 @@ -665,10 +665,10 @@ Dividend = N0.getNode(); // Insert prepared dividend into suitable 'subreg' - SDNode *Tmp = CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + SDNode *Tmp = CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, ResVT); Dividend = - CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, + CurDAG->getMachineNode(TargetOpcode::INSERT_SUBREG, dl, ResVT, SDValue(Tmp, 0), SDValue(Dividend, 0), CurDAG->getTargetConstant(subreg_odd, MVT::i32)); @@ -687,7 +687,7 @@ // Copy the division (odd subreg) result, if it is needed. if (!SDValue(Node, 0).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); - SDNode *Div = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + SDNode *Div = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, NVT, SDValue(Result, 0), CurDAG->getTargetConstant(SubRegIdx, @@ -702,7 +702,7 @@ // Copy the remainder (even subreg) result, if it is needed. if (!SDValue(Node, 1).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_even32 : subreg_even); - SDNode *Rem = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + SDNode *Rem = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, NVT, SDValue(Result, 0), CurDAG->getTargetConstant(SubRegIdx, @@ -749,12 +749,12 @@ SDNode *Dividend = N0.getNode(); // Insert prepared dividend into suitable 'subreg' - SDNode *Tmp = CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + SDNode *Tmp = CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, ResVT); { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); Dividend = - CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, + CurDAG->getMachineNode(TargetOpcode::INSERT_SUBREG, dl, ResVT, SDValue(Tmp, 0), SDValue(Dividend, 0), CurDAG->getTargetConstant(SubRegIdx, MVT::i32)); } @@ -777,7 +777,7 @@ // Copy the division (odd subreg) result, if it is needed. if (!SDValue(Node, 0).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); - SDNode *Div = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + SDNode *Div = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, NVT, SDValue(Result, 0), CurDAG->getTargetConstant(SubRegIdx, @@ -791,7 +791,7 @@ // Copy the remainder (even subreg) result, if it is needed. if (!SDValue(Node, 1).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_even32 : subreg_even); - SDNode *Rem = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + SDNode *Rem = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, dl, NVT, SDValue(Result, 0), CurDAG->getTargetConstant(SubRegIdx, Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Tue Feb 9 13:54:29 2010 @@ -302,7 +302,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { X86MCInstLower MCInstLowering(OutContext, Mang, *this); switch (MI->getOpcode()) { - case TargetInstrInfo::DEBUG_VALUE: { + case TargetOpcode::DBG_VALUE: { // FIXME: if this is implemented for another target before it goes // away completely, the common part should be moved into AsmPrinter. if (!VerboseAsm) Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -578,19 +578,19 @@ llvm_unreachable("psuedo instructions should be removed before code" " emission"); break; - case TargetInstrInfo::INLINEASM: + case TargetOpcode::INLINEASM: // We allow inline assembler nodes with empty bodies - they can // implicitly define registers, which is ok for JIT. if (MI.getOperand(0).getSymbolName()[0]) llvm_report_error("JIT does not support inline asm!"); break; - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: - case TargetInstrInfo::GC_LABEL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: + case TargetOpcode::GC_LABEL: MCE.emitLabel(MI.getOperand(0).getImm()); break; - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: case X86::FP_REG_KILL: break; case X86::MOVPC32r: { Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Feb 9 13:54:29 2010 @@ -1012,7 +1012,7 @@ // of X86::CL, emit an EXTRACT_SUBREG to precisely describe what // we're doing here. if (CReg != X86::CL) - BuildMI(MBB, DL, TII.get(TargetInstrInfo::EXTRACT_SUBREG), X86::CL) + BuildMI(MBB, DL, TII.get(TargetOpcode::EXTRACT_SUBREG), X86::CL) .addReg(CReg).addImm(X86::SUBREG_8BIT); unsigned ResultReg = createResultReg(RC); @@ -1159,7 +1159,7 @@ assert(DI->getAddress() && "Null address should be checked earlier!"); if (!X86SelectAddress(DI->getAddress(), AM)) return false; - const TargetInstrDesc &II = TII.get(TargetInstrInfo::DEBUG_VALUE); + const TargetInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE); addFullAddress(BuildMI(MBB, DL, II), AM).addImm(0). addMetadata(DI->getVariable()); return true; Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Feb 9 13:54:29 2010 @@ -235,7 +235,7 @@ unsigned Flags = MI->getDesc().TSFlags; unsigned FPInstClass = Flags & X86II::FPTypeMask; - if (MI->getOpcode() == TargetInstrInfo::INLINEASM) + if (MI->isInlineAsm()) FPInstClass = X86II::SpecialFP; if (FPInstClass == X86II::NotFP) @@ -1083,7 +1083,7 @@ } } break; - case TargetInstrInfo::INLINEASM: { + case TargetOpcode::INLINEASM: { // The inline asm MachineInstr currently only *uses* FP registers for the // 'f' constraint. These should be turned into the current ST(x) register // in the machine instr. Also, any kills should be explicitly popped after Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Feb 9 13:54:29 2010 @@ -1606,7 +1606,7 @@ } DebugLoc dl = Node->getDebugLoc(); - SDValue Undef = SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + SDValue Undef = SDValue(CurDAG->getMachineNode(TargetOpcode::IMPLICIT_DEF, dl, NVT), 0); MachineSDNode::mmo_iterator MemOp = MF->allocateMemRefsArray(1); MemOp[0] = cast(Node)->getMemOperand(); Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Feb 9 13:54:29 2010 @@ -435,7 +435,7 @@ // up to 64 bits. def def32 : PatLeaf<(i32 GR32:$src), [{ return N->getOpcode() != ISD::TRUNCATE && - N->getOpcode() != TargetInstrInfo::EXTRACT_SUBREG && + N->getOpcode() != TargetOpcode::EXTRACT_SUBREG && N->getOpcode() != ISD::CopyFromReg && N->getOpcode() != X86ISD::CMOV; }]>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Feb 9 13:54:29 2010 @@ -3372,18 +3372,18 @@ switch (Opcode) { default: break; - case TargetInstrInfo::INLINEASM: { + case TargetOpcode::INLINEASM: { const MachineFunction *MF = MI.getParent()->getParent(); const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); FinalSize += TII.getInlineAsmLength(MI.getOperand(0).getSymbolName(), *MF->getTarget().getMCAsmInfo()); break; } - case TargetInstrInfo::DBG_LABEL: - case TargetInstrInfo::EH_LABEL: + case TargetOpcode::DBG_LABEL: + case TargetOpcode::EH_LABEL: break; - case TargetInstrInfo::IMPLICIT_DEF: - case TargetInstrInfo::KILL: + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: case X86::FP_REG_KILL: break; case X86::MOVPC32r: { Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original) +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Tue Feb 9 13:54:29 2010 @@ -35,7 +35,7 @@ R->getName() == "IMPLICIT_DEF" || R->getName() == "SUBREG_TO_REG" || R->getName() == "COPY_TO_REGCLASS" || - R->getName() == "DEBUG_VALUE") continue; + R->getName() == "DBG_VALUE") continue; BitsInit *BI = R->getValueAsBitsInit("Inst"); @@ -113,7 +113,7 @@ R->getName() == "IMPLICIT_DEF" || R->getName() == "SUBREG_TO_REG" || R->getName() == "COPY_TO_REGCLASS" || - R->getName() == "DEBUG_VALUE") { + R->getName() == "DBG_VALUE") { o << " 0U,\n"; continue; } @@ -152,7 +152,7 @@ InstName == "IMPLICIT_DEF" || InstName == "SUBREG_TO_REG" || InstName == "COPY_TO_REGCLASS" || - InstName == "DEBUG_VALUE") continue; + InstName == "DBG_VALUE") continue; BitsInit *BI = R->getValueAsBitsInit("Inst"); const std::vector &Vals = R->getValues(); Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Feb 9 13:54:29 2010 @@ -337,10 +337,10 @@ throw "Could not find 'COPY_TO_REGCLASS' instruction!"; const CodeGenInstruction *COPY_TO_REGCLASS = &I->second; - I = getInstructions().find("DEBUG_VALUE"); + I = getInstructions().find("DBG_VALUE"); if (I == Instructions.end()) - throw "Could not find 'DEBUG_VALUE' instruction!"; - const CodeGenInstruction *DEBUG_VALUE = &I->second; + throw "Could not find 'DBG_VALUE' instruction!"; + const CodeGenInstruction *DBG_VALUE = &I->second; // Print out the rest of the instructions now. NumberedInstructions.push_back(PHI); @@ -354,7 +354,7 @@ NumberedInstructions.push_back(IMPLICIT_DEF); NumberedInstructions.push_back(SUBREG_TO_REG); NumberedInstructions.push_back(COPY_TO_REGCLASS); - NumberedInstructions.push_back(DEBUG_VALUE); + NumberedInstructions.push_back(DBG_VALUE); for (inst_iterator II = inst_begin(), E = inst_end(); II != E; ++II) if (&II->second != PHI && &II->second != INLINEASM && @@ -367,7 +367,7 @@ &II->second != IMPLICIT_DEF && &II->second != SUBREG_TO_REG && &II->second != COPY_TO_REGCLASS && - &II->second != DEBUG_VALUE) + &II->second != DBG_VALUE) NumberedInstructions.push_back(&II->second); } Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=95687&r1=95686&r2=95687&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Tue Feb 9 13:54:29 2010 @@ -346,7 +346,7 @@ R->getName() != "IMPLICIT_DEF" && R->getName() != "SUBREG_TO_REG" && R->getName() != "COPY_TO_REGCLASS" && - R->getName() != "DEBUG_VALUE") + R->getName() != "DBG_VALUE") throw R->getName() + " doesn't have a field named '" + Val->getValue() + "'!"; return; From sabre at nondot.org Tue Feb 9 15:00:12 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 21:00:12 -0000 Subject: [llvm-commits] [llvm] r95689 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <201002092100.o19L0Cdx029513@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 15:00:12 2010 New Revision: 95689 URL: http://llvm.org/viewvc/llvm-project?rev=95689&view=rev Log: simplify. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95689&r1=95688&r2=95689&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 15:00:12 2010 @@ -389,8 +389,8 @@ // 2-7) and absolute references. if ((!Is64BitMode || DispForReloc || BaseReg != 0) && IndexReg.getReg() == 0 && - ((BaseReg == 0 && MCE.earlyResolveAddresses()) || BaseReg == X86::RIP || - (BaseReg != 0 && getX86RegNum(BaseReg) != N86::ESP))) { + ((BaseReg == 0 && IsPCRel) || BaseReg == X86::RIP || + (BaseReg != 0 && BaseReg != X86::ESP))) { if (BaseReg == 0 || BaseReg == X86::RIP) { // Just a displacement? // Emit special case [disp32] encoding MCE.emitByte(ModRMByte(0, RegOpcodeField, 5)); From sabre at nondot.org Tue Feb 9 15:21:26 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 21:21:26 -0000 Subject: [llvm-commits] [llvm] r95690 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <201002092121.o19LLQlC030559@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 15:21:26 2010 New Revision: 95690 URL: http://llvm.org/viewvc/llvm-project?rev=95690&view=rev Log: revert r95689: getX86RegNum(BaseReg) != N86::ESP is a confusing idiom to check for ESP or RSP. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95690&r1=95689&r2=95690&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 15:21:26 2010 @@ -389,8 +389,8 @@ // 2-7) and absolute references. if ((!Is64BitMode || DispForReloc || BaseReg != 0) && IndexReg.getReg() == 0 && - ((BaseReg == 0 && IsPCRel) || BaseReg == X86::RIP || - (BaseReg != 0 && BaseReg != X86::ESP))) { + ((BaseReg == 0 && MCE.earlyResolveAddresses()) || BaseReg == X86::RIP || + (BaseReg != 0 && getX86RegNum(BaseReg) != N86::ESP))) { if (BaseReg == 0 || BaseReg == X86::RIP) { // Just a displacement? // Emit special case [disp32] encoding MCE.emitByte(ModRMByte(0, RegOpcodeField, 5)); From echristo at apple.com Tue Feb 9 15:24:28 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 09 Feb 2010 21:24:28 -0000 Subject: [llvm-commits] [llvm] r95691 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll Message-ID: <201002092124.o19LOSYE030713@zion.cs.uiuc.edu> Author: echristo Date: Tue Feb 9 15:24:27 2010 New Revision: 95691 URL: http://llvm.org/viewvc/llvm-project?rev=95691&view=rev Log: Move Intrinsic::objectsize lowering back to InstCombineCalls and enable constant 0 offset lowering. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/trunk/test/Transforms/InstCombine/objsize.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=95691&r1=95690&r2=95691&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Tue Feb 9 15:24:27 2010 @@ -230,7 +230,6 @@ return 0; } - /// visitCallInst - CallInst simplification. This mostly only handles folding /// of intrinsic instructions. For normal calls, it allows visitCallSite to do /// the heavy lifting. @@ -304,6 +303,25 @@ switch (II->getIntrinsicID()) { default: break; + case Intrinsic::objectsize: { + const Type *ReturnTy = CI.getType(); + Value *Op1 = II->getOperand(1); + bool Min = (cast(II->getOperand(2))->getZExtValue() == 1); + + if (!TD) break; + Op1 = Op1->stripPointerCasts(); + + if (GlobalVariable *GV = dyn_cast(Op1)) { + if (GV->hasDefinitiveInitializer()) { + Constant *C = GV->getInitializer(); + size_t globalSize = TD->getTypeAllocSize(C->getType()); + return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy, globalSize)); + } else { + Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL); + return ReplaceInstUsesWith(CI, RetVal); + } + } + } case Intrinsic::bswap: // bswap(bswap(x)) -> x if (IntrinsicInst *Operand = dyn_cast(II->getOperand(1))) Modified: llvm/trunk/test/Transforms/InstCombine/objsize.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=95691&r1=95690&r2=95691&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll Tue Feb 9 15:24:27 2010 @@ -1,6 +1,5 @@ ; Test a pile of objectsize bounds checking. ; RUN: opt < %s -instcombine -S | FileCheck %s -; XFAIL: * ; We need target data to get the sizes of the arrays and structures. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" @@ -32,9 +31,10 @@ ret i8* %2; } +; FIXME: Should be ret i32 0 define i32 @f() nounwind { ; CHECK: @f -; CHECK-NEXT: ret i32 0 +; CHECK-NEXT: llvm.objectsize.i32 %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false) ret i32 %1 } @@ -43,7 +43,7 @@ define i1 @baz() nounwind { ; CHECK: @baz -; CHECK-NEXT: llvm.objectsize.i32 +; CHECK-NEXT: ret i1 true %1 = tail call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 0), i1 false) %2 = icmp eq i32 %1, -1 ret i1 %2 From sabre at nondot.org Tue Feb 9 15:47:19 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 21:47:19 -0000 Subject: [llvm-commits] [llvm] r95693 - in /llvm/trunk: lib/Target/X86/X86CodeEmitter.cpp test/MC/AsmParser/X86/x86_32-encoding.s Message-ID: <201002092147.o19LlJBK031743@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 15:47:19 2010 New Revision: 95693 URL: http://llvm.org/viewvc/llvm-project?rev=95693&view=rev Log: fix X86 encoder to output [disp] only addresses with no SIB byte in X86-32 mode. This is still required in x86-64 mode to avoid forming [disp+rip] encoding. Rewrite the SIB byte decision logic to be actually understandable. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95693&r1=95692&r2=95693&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 15:47:19 2010 @@ -387,86 +387,98 @@ // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table // 2-7) and absolute references. - if ((!Is64BitMode || DispForReloc || BaseReg != 0) && + if (// The SIB byte must be used if there is an index register. IndexReg.getReg() == 0 && - ((BaseReg == 0 && MCE.earlyResolveAddresses()) || BaseReg == X86::RIP || - (BaseReg != 0 && getX86RegNum(BaseReg) != N86::ESP))) { - if (BaseReg == 0 || BaseReg == X86::RIP) { // Just a displacement? - // Emit special case [disp32] encoding + // The SIB byte must be used if the base is ESP/RSP. + BaseReg != X86::ESP && BaseReg != X86::RSP && + // If there is no base register and we're in 64-bit mode, we need a SIB + // byte to emit an addr that is just 'disp32' (the non-RIP relative form). + (!Is64BitMode || BaseReg != 0)) { + if (BaseReg == 0 || // [disp32] in X86-32 mode + BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode MCE.emitByte(ModRMByte(0, RegOpcodeField, 5)); emitDisplacementField(DispForReloc, DispVal, PCAdj, true); - } else { - unsigned BaseRegNo = getX86RegNum(BaseReg); - if (!DispForReloc && DispVal == 0 && BaseRegNo != N86::EBP) { - // Emit simple indirect register encoding... [EAX] f.e. - MCE.emitByte(ModRMByte(0, RegOpcodeField, BaseRegNo)); - } else if (!DispForReloc && isDisp8(DispVal)) { - // Emit the disp8 encoding... [REG+disp8] - MCE.emitByte(ModRMByte(1, RegOpcodeField, BaseRegNo)); - emitConstant(DispVal, 1); - } else { - // Emit the most general non-SIB encoding: [REG+disp32] - MCE.emitByte(ModRMByte(2, RegOpcodeField, BaseRegNo)); - emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel); - } - } - - } else { // We need a SIB byte, so start by outputting the ModR/M byte first - assert(IndexReg.getReg() != X86::ESP && - IndexReg.getReg() != X86::RSP && "Cannot use ESP as index reg!"); - - bool ForceDisp32 = false; - bool ForceDisp8 = false; - if (BaseReg == 0) { - // If there is no base register, we emit the special case SIB byte with - // MOD=0, BASE=5, to JUST get the index, scale, and displacement. - MCE.emitByte(ModRMByte(0, RegOpcodeField, 4)); - ForceDisp32 = true; - } else if (DispForReloc) { - // Emit the normal disp32 encoding. - MCE.emitByte(ModRMByte(2, RegOpcodeField, 4)); - ForceDisp32 = true; - } else if (DispVal == 0 && getX86RegNum(BaseReg) != N86::EBP) { - // Emit no displacement ModR/M byte - MCE.emitByte(ModRMByte(0, RegOpcodeField, 4)); - } else if (isDisp8(DispVal)) { - // Emit the disp8 encoding... - MCE.emitByte(ModRMByte(1, RegOpcodeField, 4)); - ForceDisp8 = true; // Make sure to force 8 bit disp if Base=EBP - } else { - // Emit the normal disp32 encoding... - MCE.emitByte(ModRMByte(2, RegOpcodeField, 4)); + return; } - - // Calculate what the SS field value should be... - static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 }; - unsigned SS = SSTable[Scale.getImm()]; - - if (BaseReg == 0) { - // Handle the SIB byte for the case where there is no base, see Intel - // Manual 2A, table 2-7. The displacement has already been output. - unsigned IndexRegNo; - if (IndexReg.getReg()) - IndexRegNo = getX86RegNum(IndexReg.getReg()); - else // Examples: [ESP+1*+4] or [scaled idx]+disp32 (MOD=0,BASE=5) - IndexRegNo = 4; - emitSIBByte(SS, IndexRegNo, 5); - } else { - unsigned BaseRegNo = getX86RegNum(BaseReg); - unsigned IndexRegNo; - if (IndexReg.getReg()) - IndexRegNo = getX86RegNum(IndexReg.getReg()); - else - IndexRegNo = 4; // For example [ESP+1*+4] - emitSIBByte(SS, IndexRegNo, BaseRegNo); + + unsigned BaseRegNo = getX86RegNum(BaseReg); + // If the base is not EBP/ESP and there is no displacement, use simple + // indirect register encoding, this handles addresses like [EAX]. The + // encoding for [EBP] with no displacement means [disp32] so we handle it + // by emitting a displacement of 0 below. + if (!DispForReloc && DispVal == 0 && BaseRegNo != N86::EBP) { + MCE.emitByte(ModRMByte(0, RegOpcodeField, BaseRegNo)); + return; } - - // Do we need to output a displacement? - if (ForceDisp8) { + + // Otherwise, if the displacement fits in a byte, encode as [REG+disp8]. + if (!DispForReloc && isDisp8(DispVal)) { + MCE.emitByte(ModRMByte(1, RegOpcodeField, BaseRegNo)); emitConstant(DispVal, 1); - } else if (DispVal != 0 || ForceDisp32) { - emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel); + return; } + + // Otherwise, emit the most general non-SIB encoding: [REG+disp32] + MCE.emitByte(ModRMByte(2, RegOpcodeField, BaseRegNo)); + emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel); + return; + } + + // Otherwise we need a SIB byte, so start by outputting the ModR/M byte first. + assert(IndexReg.getReg() != X86::ESP && + IndexReg.getReg() != X86::RSP && "Cannot use ESP as index reg!"); + + bool ForceDisp32 = false; + bool ForceDisp8 = false; + if (BaseReg == 0) { + // If there is no base register, we emit the special case SIB byte with + // MOD=0, BASE=4, to JUST get the index, scale, and displacement. + MCE.emitByte(ModRMByte(0, RegOpcodeField, 4)); + ForceDisp32 = true; + } else if (DispForReloc) { + // Emit the normal disp32 encoding. + MCE.emitByte(ModRMByte(2, RegOpcodeField, 4)); + ForceDisp32 = true; + } else if (DispVal == 0 && getX86RegNum(BaseReg) != N86::EBP) { + // Emit no displacement ModR/M byte + MCE.emitByte(ModRMByte(0, RegOpcodeField, 4)); + } else if (isDisp8(DispVal)) { + // Emit the disp8 encoding... + MCE.emitByte(ModRMByte(1, RegOpcodeField, 4)); + ForceDisp8 = true; // Make sure to force 8 bit disp if Base=EBP + } else { + // Emit the normal disp32 encoding... + MCE.emitByte(ModRMByte(2, RegOpcodeField, 4)); + } + + // Calculate what the SS field value should be... + static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 }; + unsigned SS = SSTable[Scale.getImm()]; + + if (BaseReg == 0) { + // Handle the SIB byte for the case where there is no base, see Intel + // Manual 2A, table 2-7. The displacement has already been output. + unsigned IndexRegNo; + if (IndexReg.getReg()) + IndexRegNo = getX86RegNum(IndexReg.getReg()); + else // Examples: [ESP+1*+4] or [scaled idx]+disp32 (MOD=0,BASE=5) + IndexRegNo = 4; + emitSIBByte(SS, IndexRegNo, 5); + } else { + unsigned BaseRegNo = getX86RegNum(BaseReg); + unsigned IndexRegNo; + if (IndexReg.getReg()) + IndexRegNo = getX86RegNum(IndexReg.getReg()); + else + IndexRegNo = 4; // For example [ESP+1*+4] + emitSIBByte(SS, IndexRegNo, BaseRegNo); + } + + // Do we need to output a displacement? + if (ForceDisp8) { + emitConstant(DispVal, 1); + } else if (DispVal != 0 || ForceDisp32) { + emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel); } } Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=95693&r1=95692&r2=95693&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Tue Feb 9 15:47:19 2010 @@ -4,5 +4,8 @@ # CHECK: encoding: [0xdb,0x8c,0xcb,0xef,0xbe,0xad,0xde] sbbb $0xfe,0xdeadbeef(%ebx,%ecx,8) +# CHECK: encoding: [0x80,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xfe] + +psllw 69, %mm3 +# CHECK: encoding: [0x0f,0xf1,0x1d,0x45,0x00,0x00,0x00] -# CHECK: encoding: [0x80,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xfe] \ No newline at end of file From scallanan at apple.com Tue Feb 9 15:50:42 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 09 Feb 2010 21:50:42 -0000 Subject: [llvm-commits] [llvm] r95697 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp AsmWriterInst.cpp AsmWriterInst.h Message-ID: <201002092150.o19Log9j031940@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 15:50:41 2010 New Revision: 95697 URL: http://llvm.org/viewvc/llvm-project?rev=95697&view=rev Log: Per PR 6219, factored AsmWriterInst and AsmWriterOperand out of the AsmWriterEmitter. This patch does the physical code movement, but leaves the implementation unchanged. I'll make any changes necessary to generalize the code in a separate patch. Added: llvm/trunk/utils/TableGen/AsmWriterInst.cpp llvm/trunk/utils/TableGen/AsmWriterInst.h Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=95697&r1=95696&r2=95697&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Feb 9 15:50:41 2010 @@ -13,339 +13,15 @@ //===----------------------------------------------------------------------===// #include "AsmWriterEmitter.h" +#include "AsmWriterInst.h" #include "CodeGenTarget.h" #include "Record.h" #include "StringToOffsetTable.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include using namespace llvm; - -static bool isIdentChar(char C) { - return (C >= 'a' && C <= 'z') || - (C >= 'A' && C <= 'Z') || - (C >= '0' && C <= '9') || - C == '_'; -} - -// This should be an anon namespace, this works around a GCC warning. -namespace llvm { - struct AsmWriterOperand { - enum OpType { - // Output this text surrounded by quotes to the asm. - isLiteralTextOperand, - // This is the name of a routine to call to print the operand. - isMachineInstrOperand, - // Output this text verbatim to the asm writer. It is code that - // will output some text to the asm. - isLiteralStatementOperand - } OperandType; - - /// Str - For isLiteralTextOperand, this IS the literal text. For - /// isMachineInstrOperand, this is the PrinterMethodName for the operand.. - /// For isLiteralStatementOperand, this is the code to insert verbatim - /// into the asm writer. - std::string Str; - - /// MiOpNo - For isMachineInstrOperand, this is the operand number of the - /// machine instruction. - unsigned MIOpNo; - - /// MiModifier - For isMachineInstrOperand, this is the modifier string for - /// an operand, specified with syntax like ${opname:modifier}. - std::string MiModifier; - - // To make VS STL happy - AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} - - AsmWriterOperand(const std::string &LitStr, - OpType op = isLiteralTextOperand) - : OperandType(op), Str(LitStr) {} - - AsmWriterOperand(const std::string &Printer, unsigned OpNo, - const std::string &Modifier, - OpType op = isMachineInstrOperand) - : OperandType(op), Str(Printer), MIOpNo(OpNo), - MiModifier(Modifier) {} - - bool operator!=(const AsmWriterOperand &Other) const { - if (OperandType != Other.OperandType || Str != Other.Str) return true; - if (OperandType == isMachineInstrOperand) - return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier; - return false; - } - bool operator==(const AsmWriterOperand &Other) const { - return !operator!=(Other); - } - - /// getCode - Return the code that prints this operand. - std::string getCode() const; - }; -} - -namespace llvm { - class AsmWriterInst { - public: - std::vector Operands; - const CodeGenInstruction *CGI; - - AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); - - /// MatchesAllButOneOp - If this instruction is exactly identical to the - /// specified instruction except for one differing operand, return the - /// differing operand number. Otherwise return ~0. - unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; - - private: - void AddLiteralString(const std::string &Str) { - // If the last operand was already a literal text string, append this to - // it, otherwise add a new operand. - if (!Operands.empty() && - Operands.back().OperandType == AsmWriterOperand::isLiteralTextOperand) - Operands.back().Str.append(Str); - else - Operands.push_back(AsmWriterOperand(Str)); - } - }; -} - - -std::string AsmWriterOperand::getCode() const { - if (OperandType == isLiteralTextOperand) { - if (Str.size() == 1) - return "O << '" + Str + "'; "; - return "O << \"" + Str + "\"; "; - } - - if (OperandType == isLiteralStatementOperand) - return Str; - - std::string Result = Str + "(MI"; - if (MIOpNo != ~0U) - Result += ", " + utostr(MIOpNo); - if (!MiModifier.empty()) - Result += ", \"" + MiModifier + '"'; - return Result + "); "; -} - - -/// ParseAsmString - Parse the specified Instruction's AsmString into this -/// AsmWriterInst. -/// -AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { - this->CGI = &CGI; - - unsigned Variant = AsmWriter->getValueAsInt("Variant"); - int FirstOperandColumn = AsmWriter->getValueAsInt("FirstOperandColumn"); - int OperandSpacing = AsmWriter->getValueAsInt("OperandSpacing"); - - unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} region, other #. - - // This is the number of tabs we've seen if we're doing columnar layout. - unsigned CurColumn = 0; - - - // NOTE: Any extensions to this code need to be mirrored in the - // AsmPrinter::printInlineAsm code that executes as compile time (assuming - // that inline asm strings should also get the new feature)! - const std::string &AsmString = CGI.AsmString; - std::string::size_type LastEmitted = 0; - while (LastEmitted != AsmString.size()) { - std::string::size_type DollarPos = - AsmString.find_first_of("${|}\\", LastEmitted); - if (DollarPos == std::string::npos) DollarPos = AsmString.size(); - - // Emit a constant string fragment. - - if (DollarPos != LastEmitted) { - if (CurVariant == Variant || CurVariant == ~0U) { - for (; LastEmitted != DollarPos; ++LastEmitted) - switch (AsmString[LastEmitted]) { - case '\n': - AddLiteralString("\\n"); - break; - case '\t': - // If the asm writer is not using a columnar layout, \t is not - // magic. - if (FirstOperandColumn == -1 || OperandSpacing == -1) { - AddLiteralString("\\t"); - } else { - // We recognize a tab as an operand delimeter. - unsigned DestColumn = FirstOperandColumn + - CurColumn++ * OperandSpacing; - Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + - utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); - } - break; - case '"': - AddLiteralString("\\\""); - break; - case '\\': - AddLiteralString("\\\\"); - break; - default: - AddLiteralString(std::string(1, AsmString[LastEmitted])); - break; - } - } else { - LastEmitted = DollarPos; - } - } else if (AsmString[DollarPos] == '\\') { - if (DollarPos+1 != AsmString.size() && - (CurVariant == Variant || CurVariant == ~0U)) { - if (AsmString[DollarPos+1] == 'n') { - AddLiteralString("\\n"); - } else if (AsmString[DollarPos+1] == 't') { - // If the asm writer is not using a columnar layout, \t is not - // magic. - if (FirstOperandColumn == -1 || OperandSpacing == -1) { - AddLiteralString("\\t"); - break; - } - - // We recognize a tab as an operand delimeter. - unsigned DestColumn = FirstOperandColumn + - CurColumn++ * OperandSpacing; - Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); - break; - } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) - != std::string::npos) { - AddLiteralString(std::string(1, AsmString[DollarPos+1])); - } else { - throw "Non-supported escaped character found in instruction '" + - CGI.TheDef->getName() + "'!"; - } - LastEmitted = DollarPos+2; - continue; - } - } else if (AsmString[DollarPos] == '{') { - if (CurVariant != ~0U) - throw "Nested variants found for instruction '" + - CGI.TheDef->getName() + "'!"; - LastEmitted = DollarPos+1; - CurVariant = 0; // We are now inside of the variant! - } else if (AsmString[DollarPos] == '|') { - if (CurVariant == ~0U) - throw "'|' character found outside of a variant in instruction '" - + CGI.TheDef->getName() + "'!"; - ++CurVariant; - ++LastEmitted; - } else if (AsmString[DollarPos] == '}') { - if (CurVariant == ~0U) - throw "'}' character found outside of a variant in instruction '" - + CGI.TheDef->getName() + "'!"; - ++LastEmitted; - CurVariant = ~0U; - } else if (DollarPos+1 != AsmString.size() && - AsmString[DollarPos+1] == '$') { - if (CurVariant == Variant || CurVariant == ~0U) { - AddLiteralString("$"); // "$$" -> $ - } - LastEmitted = DollarPos+2; - } else { - // Get the name of the variable. - std::string::size_type VarEnd = DollarPos+1; - - // handle ${foo}bar as $foo by detecting whether the character following - // the dollar sign is a curly brace. If so, advance VarEnd and DollarPos - // so the variable name does not contain the leading curly brace. - bool hasCurlyBraces = false; - if (VarEnd < AsmString.size() && '{' == AsmString[VarEnd]) { - hasCurlyBraces = true; - ++DollarPos; - ++VarEnd; - } - - while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) - ++VarEnd; - std::string VarName(AsmString.begin()+DollarPos+1, - AsmString.begin()+VarEnd); - - // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed - // into printOperand. Also support ${:feature}, which is passed into - // PrintSpecial. - std::string Modifier; - - // In order to avoid starting the next string at the terminating curly - // brace, advance the end position past it if we found an opening curly - // brace. - if (hasCurlyBraces) { - if (VarEnd >= AsmString.size()) - throw "Reached end of string before terminating curly brace in '" - + CGI.TheDef->getName() + "'"; - - // Look for a modifier string. - if (AsmString[VarEnd] == ':') { - ++VarEnd; - if (VarEnd >= AsmString.size()) - throw "Reached end of string before terminating curly brace in '" - + CGI.TheDef->getName() + "'"; - - unsigned ModifierStart = VarEnd; - while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) - ++VarEnd; - Modifier = std::string(AsmString.begin()+ModifierStart, - AsmString.begin()+VarEnd); - if (Modifier.empty()) - throw "Bad operand modifier name in '"+ CGI.TheDef->getName() + "'"; - } - - if (AsmString[VarEnd] != '}') - throw "Variable name beginning with '{' did not end with '}' in '" - + CGI.TheDef->getName() + "'"; - ++VarEnd; - } - if (VarName.empty() && Modifier.empty()) - throw "Stray '$' in '" + CGI.TheDef->getName() + - "' asm string, maybe you want $$?"; - - if (VarName.empty()) { - // Just a modifier, pass this into PrintSpecial. - Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier)); - } else { - // Otherwise, normal operand. - unsigned OpNo = CGI.getOperandNamed(VarName); - CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo]; - - if (CurVariant == Variant || CurVariant == ~0U) { - unsigned MIOp = OpInfo.MIOperandNo; - Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, - Modifier)); - } - } - LastEmitted = VarEnd; - } - } - - Operands.push_back(AsmWriterOperand("return;", - AsmWriterOperand::isLiteralStatementOperand)); -} - -/// MatchesAllButOneOp - If this instruction is exactly identical to the -/// specified instruction except for one differing operand, return the differing -/// operand number. If more than one operand mismatches, return ~1, otherwise -/// if the instructions are identical return ~0. -unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{ - if (Operands.size() != Other.Operands.size()) return ~1; - - unsigned MismatchOperand = ~0U; - for (unsigned i = 0, e = Operands.size(); i != e; ++i) { - if (Operands[i] != Other.Operands[i]) { - if (MismatchOperand != ~0U) // Already have one mismatch? - return ~1U; - else - MismatchOperand = i; - } - } - return MismatchOperand; -} - static void PrintCases(std::vector > &OpsToPrint, raw_ostream &O) { O << " case " << OpsToPrint.back().first << ": "; Added: llvm/trunk/utils/TableGen/AsmWriterInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.cpp?rev=95697&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.cpp (added) +++ llvm/trunk/utils/TableGen/AsmWriterInst.cpp Tue Feb 9 15:50:41 2010 @@ -0,0 +1,259 @@ +//===- AsmWriterInst.h - Classes encapsulating a printable inst -----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// These classes implement a parser for assembly strings. +// +//===----------------------------------------------------------------------===// + +#include "AsmWriterInst.h" +#include "CodeGenTarget.h" +#include "Record.h" +#include "llvm/ADT/StringExtras.h" + +using namespace llvm; + +static bool isIdentChar(char C) { + return (C >= 'a' && C <= 'z') || + (C >= 'A' && C <= 'Z') || + (C >= '0' && C <= '9') || + C == '_'; +} + +std::string AsmWriterOperand::getCode() const { + if (OperandType == isLiteralTextOperand) { + if (Str.size() == 1) + return "O << '" + Str + "'; "; + return "O << \"" + Str + "\"; "; + } + + if (OperandType == isLiteralStatementOperand) + return Str; + + std::string Result = Str + "(MI"; + if (MIOpNo != ~0U) + Result += ", " + utostr(MIOpNo); + if (!MiModifier.empty()) + Result += ", \"" + MiModifier + '"'; + return Result + "); "; +} + +/// ParseAsmString - Parse the specified Instruction's AsmString into this +/// AsmWriterInst. +/// +AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { + this->CGI = &CGI; + + unsigned Variant = AsmWriter->getValueAsInt("Variant"); + int FirstOperandColumn = AsmWriter->getValueAsInt("FirstOperandColumn"); + int OperandSpacing = AsmWriter->getValueAsInt("OperandSpacing"); + + unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} region, other #. + + // This is the number of tabs we've seen if we're doing columnar layout. + unsigned CurColumn = 0; + + + // NOTE: Any extensions to this code need to be mirrored in the + // AsmPrinter::printInlineAsm code that executes as compile time (assuming + // that inline asm strings should also get the new feature)! + const std::string &AsmString = CGI.AsmString; + std::string::size_type LastEmitted = 0; + while (LastEmitted != AsmString.size()) { + std::string::size_type DollarPos = + AsmString.find_first_of("${|}\\", LastEmitted); + if (DollarPos == std::string::npos) DollarPos = AsmString.size(); + + // Emit a constant string fragment. + + if (DollarPos != LastEmitted) { + if (CurVariant == Variant || CurVariant == ~0U) { + for (; LastEmitted != DollarPos; ++LastEmitted) + switch (AsmString[LastEmitted]) { + case '\n': + AddLiteralString("\\n"); + break; + case '\t': + // If the asm writer is not using a columnar layout, \t is not + // magic. + if (FirstOperandColumn == -1 || OperandSpacing == -1) { + AddLiteralString("\\t"); + } else { + // We recognize a tab as an operand delimeter. + unsigned DestColumn = FirstOperandColumn + + CurColumn++ * OperandSpacing; + Operands.push_back( + AsmWriterOperand("O.PadToColumn(" + + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); + } + break; + case '"': + AddLiteralString("\\\""); + break; + case '\\': + AddLiteralString("\\\\"); + break; + default: + AddLiteralString(std::string(1, AsmString[LastEmitted])); + break; + } + } else { + LastEmitted = DollarPos; + } + } else if (AsmString[DollarPos] == '\\') { + if (DollarPos+1 != AsmString.size() && + (CurVariant == Variant || CurVariant == ~0U)) { + if (AsmString[DollarPos+1] == 'n') { + AddLiteralString("\\n"); + } else if (AsmString[DollarPos+1] == 't') { + // If the asm writer is not using a columnar layout, \t is not + // magic. + if (FirstOperandColumn == -1 || OperandSpacing == -1) { + AddLiteralString("\\t"); + break; + } + + // We recognize a tab as an operand delimeter. + unsigned DestColumn = FirstOperandColumn + + CurColumn++ * OperandSpacing; + Operands.push_back( + AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); + break; + } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) + != std::string::npos) { + AddLiteralString(std::string(1, AsmString[DollarPos+1])); + } else { + throw "Non-supported escaped character found in instruction '" + + CGI.TheDef->getName() + "'!"; + } + LastEmitted = DollarPos+2; + continue; + } + } else if (AsmString[DollarPos] == '{') { + if (CurVariant != ~0U) + throw "Nested variants found for instruction '" + + CGI.TheDef->getName() + "'!"; + LastEmitted = DollarPos+1; + CurVariant = 0; // We are now inside of the variant! + } else if (AsmString[DollarPos] == '|') { + if (CurVariant == ~0U) + throw "'|' character found outside of a variant in instruction '" + + CGI.TheDef->getName() + "'!"; + ++CurVariant; + ++LastEmitted; + } else if (AsmString[DollarPos] == '}') { + if (CurVariant == ~0U) + throw "'}' character found outside of a variant in instruction '" + + CGI.TheDef->getName() + "'!"; + ++LastEmitted; + CurVariant = ~0U; + } else if (DollarPos+1 != AsmString.size() && + AsmString[DollarPos+1] == '$') { + if (CurVariant == Variant || CurVariant == ~0U) { + AddLiteralString("$"); // "$$" -> $ + } + LastEmitted = DollarPos+2; + } else { + // Get the name of the variable. + std::string::size_type VarEnd = DollarPos+1; + + // handle ${foo}bar as $foo by detecting whether the character following + // the dollar sign is a curly brace. If so, advance VarEnd and DollarPos + // so the variable name does not contain the leading curly brace. + bool hasCurlyBraces = false; + if (VarEnd < AsmString.size() && '{' == AsmString[VarEnd]) { + hasCurlyBraces = true; + ++DollarPos; + ++VarEnd; + } + + while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) + ++VarEnd; + std::string VarName(AsmString.begin()+DollarPos+1, + AsmString.begin()+VarEnd); + + // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed + // into printOperand. Also support ${:feature}, which is passed into + // PrintSpecial. + std::string Modifier; + + // In order to avoid starting the next string at the terminating curly + // brace, advance the end position past it if we found an opening curly + // brace. + if (hasCurlyBraces) { + if (VarEnd >= AsmString.size()) + throw "Reached end of string before terminating curly brace in '" + + CGI.TheDef->getName() + "'"; + + // Look for a modifier string. + if (AsmString[VarEnd] == ':') { + ++VarEnd; + if (VarEnd >= AsmString.size()) + throw "Reached end of string before terminating curly brace in '" + + CGI.TheDef->getName() + "'"; + + unsigned ModifierStart = VarEnd; + while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) + ++VarEnd; + Modifier = std::string(AsmString.begin()+ModifierStart, + AsmString.begin()+VarEnd); + if (Modifier.empty()) + throw "Bad operand modifier name in '"+ CGI.TheDef->getName() + "'"; + } + + if (AsmString[VarEnd] != '}') + throw "Variable name beginning with '{' did not end with '}' in '" + + CGI.TheDef->getName() + "'"; + ++VarEnd; + } + if (VarName.empty() && Modifier.empty()) + throw "Stray '$' in '" + CGI.TheDef->getName() + + "' asm string, maybe you want $$?"; + + if (VarName.empty()) { + // Just a modifier, pass this into PrintSpecial. + Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier)); + } else { + // Otherwise, normal operand. + unsigned OpNo = CGI.getOperandNamed(VarName); + CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo]; + + if (CurVariant == Variant || CurVariant == ~0U) { + unsigned MIOp = OpInfo.MIOperandNo; + Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, + Modifier)); + } + } + LastEmitted = VarEnd; + } + } + + Operands.push_back(AsmWriterOperand("return;", + AsmWriterOperand::isLiteralStatementOperand)); +} + +/// MatchesAllButOneOp - If this instruction is exactly identical to the +/// specified instruction except for one differing operand, return the differing +/// operand number. If more than one operand mismatches, return ~1, otherwise +/// if the instructions are identical return ~0. +unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{ + if (Operands.size() != Other.Operands.size()) return ~1; + + unsigned MismatchOperand = ~0U; + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { + if (Operands[i] != Other.Operands[i]) { + if (MismatchOperand != ~0U) // Already have one mismatch? + return ~1U; + else + MismatchOperand = i; + } + } + return MismatchOperand; +} \ No newline at end of file Added: llvm/trunk/utils/TableGen/AsmWriterInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.h?rev=95697&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.h (added) +++ llvm/trunk/utils/TableGen/AsmWriterInst.h Tue Feb 9 15:50:41 2010 @@ -0,0 +1,104 @@ +//===- AsmWriterInst.h - Classes encapsulating a printable inst -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// These classes implement a parser for assembly strings. The parser splits +// the string into operands, which can be literal strings (the constant bits of +// the string), actual operands (i.e., operands from the MachineInstr), and +// dynamically-generated text, specified by raw C++ code. +// +//===----------------------------------------------------------------------===// + +#ifndef ASMWRITER_INST_H +#define ASMWRITER_INST_H + +#include +#include + +namespace llvm { + class CodeGenInstruction; + class Record; + + struct AsmWriterOperand { + enum OpType { + // Output this text surrounded by quotes to the asm. + isLiteralTextOperand, + // This is the name of a routine to call to print the operand. + isMachineInstrOperand, + // Output this text verbatim to the asm writer. It is code that + // will output some text to the asm. + isLiteralStatementOperand + } OperandType; + + /// Str - For isLiteralTextOperand, this IS the literal text. For + /// isMachineInstrOperand, this is the PrinterMethodName for the operand.. + /// For isLiteralStatementOperand, this is the code to insert verbatim + /// into the asm writer. + std::string Str; + + /// MiOpNo - For isMachineInstrOperand, this is the operand number of the + /// machine instruction. + unsigned MIOpNo; + + /// MiModifier - For isMachineInstrOperand, this is the modifier string for + /// an operand, specified with syntax like ${opname:modifier}. + std::string MiModifier; + + // To make VS STL happy + AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {} + + AsmWriterOperand(const std::string &LitStr, + OpType op = isLiteralTextOperand) + : OperandType(op), Str(LitStr) {} + + AsmWriterOperand(const std::string &Printer, unsigned OpNo, + const std::string &Modifier, + OpType op = isMachineInstrOperand) + : OperandType(op), Str(Printer), MIOpNo(OpNo), + MiModifier(Modifier) {} + + bool operator!=(const AsmWriterOperand &Other) const { + if (OperandType != Other.OperandType || Str != Other.Str) return true; + if (OperandType == isMachineInstrOperand) + return MIOpNo != Other.MIOpNo || MiModifier != Other.MiModifier; + return false; + } + bool operator==(const AsmWriterOperand &Other) const { + return !operator!=(Other); + } + + /// getCode - Return the code that prints this operand. + std::string getCode() const; + }; + + class AsmWriterInst { + public: + std::vector Operands; + const CodeGenInstruction *CGI; + + AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); + + /// MatchesAllButOneOp - If this instruction is exactly identical to the + /// specified instruction except for one differing operand, return the + /// differing operand number. Otherwise return ~0. + unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; + + private: + void AddLiteralString(const std::string &Str) { + // If the last operand was already a literal text string, append this to + // it, otherwise add a new operand. + if (!Operands.empty() && + Operands.back().OperandType == AsmWriterOperand::isLiteralTextOperand) + Operands.back().Str.append(Str); + else + Operands.push_back(AsmWriterOperand(Str)); + } + }; +} + +#endif From sabre at nondot.org Tue Feb 9 15:57:35 2010 From: sabre at nondot.org (Chris Lattner) Date: Tue, 09 Feb 2010 21:57:35 -0000 Subject: [llvm-commits] [llvm] r95699 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002092157.o19LvZ2K032273@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 15:57:34 2010 New Revision: 95699 URL: http://llvm.org/viewvc/llvm-project?rev=95699&view=rev Log: port encoder enhancements over to the new encoder. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95699&r1=95698&r2=95699&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Tue Feb 9 15:57:34 2010 @@ -180,33 +180,47 @@ // FIXME: Eliminate! bool IsPCRel = false; - - // Is a SIB byte needed? + + // Determine whether a SIB byte is needed. // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table // 2-7) and absolute references. - if ((!Is64BitMode || DispForReloc || BaseReg != 0) && + if (// The SIB byte must be used if there is an index register. IndexReg.getReg() == 0 && - (BaseReg == X86::RIP || (BaseReg != 0 && BaseReg != X86::ESP))) { - if (BaseReg == 0 || BaseReg == X86::RIP) { // Just a displacement? - // Emit special case [disp32] encoding + // The SIB byte must be used if the base is ESP/RSP. + BaseReg != X86::ESP && BaseReg != X86::RSP && + // If there is no base register and we're in 64-bit mode, we need a SIB + // byte to emit an addr that is just 'disp32' (the non-RIP relative form). + (!Is64BitMode || BaseReg != 0)) { + + if (BaseReg == 0 || // [disp32] in X86-32 mode + BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), OS); EmitDisplacementField(DispForReloc, DispVal, PCAdj, true, OS); - } else { - unsigned BaseRegNo = GetX86RegNum(Base); - if (!DispForReloc && DispVal == 0 && BaseRegNo != N86::EBP) { - // Emit simple indirect register encoding... [EAX] f.e. - EmitByte(ModRMByte(0, RegOpcodeField, BaseRegNo), OS); - } else if (!DispForReloc && isDisp8(DispVal)) { - // Emit the disp8 encoding... [REG+disp8] - EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), OS); - EmitConstant(DispVal, 1, OS); - } else { - // Emit the most general non-SIB encoding: [REG+disp32] - EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), OS); - EmitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel, OS); - } + return; + } + + unsigned BaseRegNo = GetX86RegNum(Base); + + // If the base is not EBP/ESP and there is no displacement, use simple + // indirect register encoding, this handles addresses like [EAX]. The + // encoding for [EBP] with no displacement means [disp32] so we handle it + // by emitting a displacement of 0 below. + if (!DispForReloc && DispVal == 0 && BaseRegNo != N86::EBP) { + EmitByte(ModRMByte(0, RegOpcodeField, BaseRegNo), OS); + return; + } + + // Otherwise, if the displacement fits in a byte, encode as [REG+disp8]. + if (!DispForReloc && isDisp8(DispVal)) { + EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), OS); + EmitConstant(DispVal, 1, OS); + return; } + + // Otherwise, emit the most general non-SIB encoding: [REG+disp32] + EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), OS); + EmitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel, OS); return; } From dalej at apple.com Tue Feb 9 16:15:27 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 09 Feb 2010 22:15:27 -0000 Subject: [llvm-commits] [llvm] r95700 - in /llvm/trunk/unittests/ADT: BitVectorTest.cpp Makefile Message-ID: <201002092215.o19MFR5L001025@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 16:15:27 2010 New Revision: 95700 URL: http://llvm.org/viewvc/llvm-project?rev=95700&view=rev Log: Disable unittests/ADT/BitVectorTest on PPC Darwin. It fails with a release build only, for reasons as yet unknown. (If there's a better way to Xfail things here let me know, doesn't seem to be any prior art in unittests.) Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp llvm/trunk/unittests/ADT/Makefile Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/BitVectorTest.cpp?rev=95700&r1=95699&r2=95700&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/BitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/BitVectorTest.cpp Tue Feb 9 16:15:27 2010 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#ifndef XFAIL #include "llvm/ADT/BitVector.h" #include "gtest/gtest.h" @@ -138,3 +139,4 @@ } } +#endif Modified: llvm/trunk/unittests/ADT/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/Makefile?rev=95700&r1=95699&r2=95700&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/Makefile (original) +++ llvm/trunk/unittests/ADT/Makefile Tue Feb 9 16:15:27 2010 @@ -12,4 +12,12 @@ LINK_COMPONENTS := core support include $(LEVEL)/Makefile.config + +# Xfail BitVectorTest for now on PPC Darwin. 7598360. +ifeq ($(ARCH),PowerPC) +ifeq ($(TARGET_OS),Darwin) +CPP.Flags += -DXFAIL +endif +endif + include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest From scallanan at apple.com Tue Feb 9 16:29:17 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 09 Feb 2010 22:29:17 -0000 Subject: [llvm-commits] [llvm] r95702 - /llvm/trunk/utils/TableGen/CMakeLists.txt Message-ID: <201002092229.o19MTHBl001717@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 16:29:16 2010 New Revision: 95702 URL: http://llvm.org/viewvc/llvm-project?rev=95702&view=rev Log: Added AsmWriterInst.cpp to the CMakeList so that it builds OK on Visual Studio. Modified: llvm/trunk/utils/TableGen/CMakeLists.txt Modified: llvm/trunk/utils/TableGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CMakeLists.txt?rev=95702&r1=95701&r2=95702&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CMakeLists.txt (original) +++ llvm/trunk/utils/TableGen/CMakeLists.txt Tue Feb 9 16:29:16 2010 @@ -1,6 +1,7 @@ add_executable(tblgen AsmMatcherEmitter.cpp AsmWriterEmitter.cpp + AsmWriterInst.cpp CallingConvEmitter.cpp ClangDiagnosticsEmitter.cpp CodeEmitterGen.cpp From johnny.chen at apple.com Tue Feb 9 16:35:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 09 Feb 2010 22:35:38 -0000 Subject: [llvm-commits] [llvm] r95703 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002092235.o19MZcwU002099@zion.cs.uiuc.edu> Author: johnny Date: Tue Feb 9 16:35:38 2010 New Revision: 95703 URL: http://llvm.org/viewvc/llvm-project?rev=95703&view=rev Log: Added VMRS/VMSR for disassembly only. A8.6.335 & A8.6.336 Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95703&r1=95702&r2=95703&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Tue Feb 9 16:35:38 2010 @@ -516,6 +516,31 @@ let Inst{4} = 1; } +// FPSCR <-> GPR (for disassembly only) + +let Uses = [FPSCR] in { +def VMRS : VFPAI<(outs GPR:$dst), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs", + "\t$dst, fpscr", + [/* For disassembly only; pattern left blank */]> { + let Inst{27-20} = 0b11101111; + let Inst{19-16} = 0b0001; + let Inst{11-8} = 0b1010; + let Inst{7} = 0; + let Inst{4} = 1; +} +} + +let Defs = [FPSCR] in { +def VMSR : VFPAI<(outs), (ins GPR:$src), VFPMiscFrm, IIC_fpSTAT, "vmsr", + "\tfpscr, $src", + [/* For disassembly only; pattern left blank */]> { + let Inst{27-20} = 0b11101110; + let Inst{19-16} = 0b0001; + let Inst{11-8} = 0b1010; + let Inst{7} = 0; + let Inst{4} = 1; +} +} // Materialize FP immediates. VFP3 only. let isReMaterializable = 1 in { From isanbard at gmail.com Tue Feb 9 16:49:16 2010 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 09 Feb 2010 22:49:16 -0000 Subject: [llvm-commits] [llvm] r95707 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <201002092249.o19MnGrh002899@zion.cs.uiuc.edu> Author: void Date: Tue Feb 9 16:49:16 2010 New Revision: 95707 URL: http://llvm.org/viewvc/llvm-project?rev=95707&view=rev Log: Improve comments in the LSDA somewhat. They can be improved much more. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=95707&r1=95706&r2=95707&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Feb 9 16:49:16 2010 @@ -34,6 +34,7 @@ #include "llvm/Support/Timer.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Twine.h" using namespace llvm; DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A, @@ -868,13 +869,14 @@ // Offset of the landing pad, counted in 16-byte bundles relative to the // @LPStart address. - if (!S.PadLabel) + if (!S.PadLabel) { + Asm->OutStreamer.AddComment("Landing pad"); Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/); - else + } else { EmitSectionOffset("label", "eh_func_begin", S.PadLabel, SubprogramCount, true, true); - - EOL("Landing pad"); + EOL("Landing pad"); + } // Offset of the first associated action record, relative to the start of // the action table. This value is biased by 1 (1 indicates the start of @@ -884,35 +886,40 @@ } // Emit the Action Table. + EOL("Action Record Table:"); + unsigned Iter = 1; for (SmallVectorImpl::const_iterator I = Actions.begin(), E = Actions.end(); I != E; ++I) { const ActionEntry &Action = *I; + EOL(Twine("Action Record ") + Twine(Iter++)); // Type Filter // // Used by the runtime to match the type of the thrown exception to the // type of the catch clauses or the types in the exception specification. - EmitSLEB128(Action.ValueForTypeID, "TypeInfo index"); + EmitSLEB128(Action.ValueForTypeID, " TypeInfo index"); // Action Record // // Self-relative signed displacement in bytes of the next action record, // or 0 if there is no next action record. - EmitSLEB128(Action.NextAction, "Next action"); + EmitSLEB128(Action.NextAction, " Next action"); } // Emit the Catch TypeInfos. + Iter = TypeInfos.size(); for (std::vector::const_reverse_iterator I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) { const GlobalVariable *GV = *I; PrintRelDirective(); - if (GV) + if (GV) { O << *Asm->GetGlobalValueSymbol(GV); - else + EOL(Twine("TypeInfo ") + Twine(Iter--)); + } else { O << "0x0"; - - EOL("TypeInfo"); + EOL(""); + } } // Emit the Exception Specifications. From clattner at apple.com Tue Feb 9 16:51:01 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 14:51:01 -0800 Subject: [llvm-commits] [llvm] r95637 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp In-Reply-To: <6a8523d61002090841t24ae9095hfcc4f028306d6ef4@mail.gmail.com> References: <201002090054.o190spPw018610@zion.cs.uiuc.edu> <6a8523d61002090841t24ae9095hfcc4f028306d6ef4@mail.gmail.com> Message-ID: On Feb 9, 2010, at 8:41 AM, Daniel Dunbar wrote: > > This was intentionally before encoding. --show-inst is most likely > only useful when debugging matcher and encoder issues, in which case > its good to have it come first in case something bad happens (encoder > crashes). Daniel and I spoke about this, and he relents! :) -Chris From clattner at apple.com Tue Feb 9 16:52:29 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 14:52:29 -0800 Subject: [llvm-commits] [llvm] r95697 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp AsmWriterInst.cpp AsmWriterInst.h In-Reply-To: <201002092150.o19Log9j031940@zion.cs.uiuc.edu> References: <201002092150.o19Log9j031940@zion.cs.uiuc.edu> Message-ID: On Feb 9, 2010, at 1:50 PM, Sean Callanan wrote: > Author: spyffe > Date: Tue Feb 9 15:50:41 2010 > New Revision: 95697 > > URL: http://llvm.org/viewvc/llvm-project?rev=95697&view=rev > Log: > Per PR 6219, factored AsmWriterInst and AsmWriterOperand > out of the AsmWriterEmitter. This patch does the physical > code movement, but leaves the implementation unchanged. I'll > make any changes necessary to generalize the code in a > separate patch. Nice! Please add newlines at the end of files, and watch 80 columns. It looks like your editor reindented the code you moved and broke the formatting. -Chris > > Added: > llvm/trunk/utils/TableGen/AsmWriterInst.cpp > llvm/trunk/utils/TableGen/AsmWriterInst.h > Modified: > llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp > > Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=95697&r1=95696&r2=95697&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Feb 9 > 15:50:41 2010 > @@ -13,339 +13,15 @@ > // > = > = > = > ----------------------------------------------------------------------= > ==// > > #include "AsmWriterEmitter.h" > +#include "AsmWriterInst.h" > #include "CodeGenTarget.h" > #include "Record.h" > #include "StringToOffsetTable.h" > -#include "llvm/ADT/StringExtras.h" > #include "llvm/Support/Debug.h" > #include "llvm/Support/MathExtras.h" > #include > using namespace llvm; > > - > -static bool isIdentChar(char C) { > - return (C >= 'a' && C <= 'z') || > - (C >= 'A' && C <= 'Z') || > - (C >= '0' && C <= '9') || > - C == '_'; > -} > - > -// This should be an anon namespace, this works around a GCC warning. > -namespace llvm { > - struct AsmWriterOperand { > - enum OpType { > - // Output this text surrounded by quotes to the asm. > - isLiteralTextOperand, > - // This is the name of a routine to call to print the operand. > - isMachineInstrOperand, > - // Output this text verbatim to the asm writer. It is code > that > - // will output some text to the asm. > - isLiteralStatementOperand > - } OperandType; > - > - /// Str - For isLiteralTextOperand, this IS the literal text. > For > - /// isMachineInstrOperand, this is the PrinterMethodName for > the operand.. > - /// For isLiteralStatementOperand, this is the code to insert > verbatim > - /// into the asm writer. > - std::string Str; > - > - /// MiOpNo - For isMachineInstrOperand, this is the operand > number of the > - /// machine instruction. > - unsigned MIOpNo; > - > - /// MiModifier - For isMachineInstrOperand, this is the > modifier string for > - /// an operand, specified with syntax like ${opname:modifier}. > - std::string MiModifier; > - > - // To make VS STL happy > - AsmWriterOperand(OpType op = > isLiteralTextOperand):OperandType(op) {} > - > - AsmWriterOperand(const std::string &LitStr, > - OpType op = isLiteralTextOperand) > - : OperandType(op), Str(LitStr) {} > - > - AsmWriterOperand(const std::string &Printer, unsigned OpNo, > - const std::string &Modifier, > - OpType op = isMachineInstrOperand) > - : OperandType(op), Str(Printer), MIOpNo(OpNo), > - MiModifier(Modifier) {} > - > - bool operator!=(const AsmWriterOperand &Other) const { > - if (OperandType != Other.OperandType || Str != Other.Str) > return true; > - if (OperandType == isMachineInstrOperand) > - return MIOpNo != Other.MIOpNo || MiModifier != > Other.MiModifier; > - return false; > - } > - bool operator==(const AsmWriterOperand &Other) const { > - return !operator!=(Other); > - } > - > - /// getCode - Return the code that prints this operand. > - std::string getCode() const; > - }; > -} > - > -namespace llvm { > - class AsmWriterInst { > - public: > - std::vector Operands; > - const CodeGenInstruction *CGI; > - > - AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); > - > - /// MatchesAllButOneOp - If this instruction is exactly > identical to the > - /// specified instruction except for one differing operand, > return the > - /// differing operand number. Otherwise return ~0. > - unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; > - > - private: > - void AddLiteralString(const std::string &Str) { > - // If the last operand was already a literal text string, > append this to > - // it, otherwise add a new operand. > - if (!Operands.empty() && > - Operands.back().OperandType == > AsmWriterOperand::isLiteralTextOperand) > - Operands.back().Str.append(Str); > - else > - Operands.push_back(AsmWriterOperand(Str)); > - } > - }; > -} > - > - > -std::string AsmWriterOperand::getCode() const { > - if (OperandType == isLiteralTextOperand) { > - if (Str.size() == 1) > - return "O << '" + Str + "'; "; > - return "O << \"" + Str + "\"; "; > - } > - > - if (OperandType == isLiteralStatementOperand) > - return Str; > - > - std::string Result = Str + "(MI"; > - if (MIOpNo != ~0U) > - Result += ", " + utostr(MIOpNo); > - if (!MiModifier.empty()) > - Result += ", \"" + MiModifier + '"'; > - return Result + "); "; > -} > - > - > -/// ParseAsmString - Parse the specified Instruction's AsmString > into this > -/// AsmWriterInst. > -/// > -AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record > *AsmWriter) { > - this->CGI = &CGI; > - > - unsigned Variant = AsmWriter->getValueAsInt("Variant"); > - int FirstOperandColumn = AsmWriter- > >getValueAsInt("FirstOperandColumn"); > - int OperandSpacing = AsmWriter- > >getValueAsInt("OperandSpacing"); > - > - unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} > region, other #. > - > - // This is the number of tabs we've seen if we're doing columnar > layout. > - unsigned CurColumn = 0; > - > - > - // NOTE: Any extensions to this code need to be mirrored in the > - // AsmPrinter::printInlineAsm code that executes as compile time > (assuming > - // that inline asm strings should also get the new feature)! > - const std::string &AsmString = CGI.AsmString; > - std::string::size_type LastEmitted = 0; > - while (LastEmitted != AsmString.size()) { > - std::string::size_type DollarPos = > - AsmString.find_first_of("${|}\\", LastEmitted); > - if (DollarPos == std::string::npos) DollarPos = AsmString.size(); > - > - // Emit a constant string fragment. > - > - if (DollarPos != LastEmitted) { > - if (CurVariant == Variant || CurVariant == ~0U) { > - for (; LastEmitted != DollarPos; ++LastEmitted) > - switch (AsmString[LastEmitted]) { > - case '\n': > - AddLiteralString("\\n"); > - break; > - case '\t': > - // If the asm writer is not using a columnar layout, \t > is not > - // magic. > - if (FirstOperandColumn == -1 || OperandSpacing == -1) { > - AddLiteralString("\\t"); > - } else { > - // We recognize a tab as an operand delimeter. > - unsigned DestColumn = FirstOperandColumn + > - CurColumn++ * OperandSpacing; > - Operands.push_back( > - AsmWriterOperand("O.PadToColumn(" + > - utostr(DestColumn) + ");\n", > - > AsmWriterOperand::isLiteralStatementOperand)); > - } > - break; > - case '"': > - AddLiteralString("\\\""); > - break; > - case '\\': > - AddLiteralString("\\\\"); > - break; > - default: > - AddLiteralString(std::string(1, AsmString[LastEmitted])); > - break; > - } > - } else { > - LastEmitted = DollarPos; > - } > - } else if (AsmString[DollarPos] == '\\') { > - if (DollarPos+1 != AsmString.size() && > - (CurVariant == Variant || CurVariant == ~0U)) { > - if (AsmString[DollarPos+1] == 'n') { > - AddLiteralString("\\n"); > - } else if (AsmString[DollarPos+1] == 't') { > - // If the asm writer is not using a columnar layout, \t > is not > - // magic. > - if (FirstOperandColumn == -1 || OperandSpacing == -1) { > - AddLiteralString("\\t"); > - break; > - } > - > - // We recognize a tab as an operand delimeter. > - unsigned DestColumn = FirstOperandColumn + > - CurColumn++ * OperandSpacing; > - Operands.push_back( > - AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) > + ");\n", > - > AsmWriterOperand::isLiteralStatementOperand)); > - break; > - } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) > - != std::string::npos) { > - AddLiteralString(std::string(1, AsmString[DollarPos+1])); > - } else { > - throw "Non-supported escaped character found in > instruction '" + > - CGI.TheDef->getName() + "'!"; > - } > - LastEmitted = DollarPos+2; > - continue; > - } > - } else if (AsmString[DollarPos] == '{') { > - if (CurVariant != ~0U) > - throw "Nested variants found for instruction '" + > - CGI.TheDef->getName() + "'!"; > - LastEmitted = DollarPos+1; > - CurVariant = 0; // We are now inside of the variant! > - } else if (AsmString[DollarPos] == '|') { > - if (CurVariant == ~0U) > - throw "'|' character found outside of a variant in > instruction '" > - + CGI.TheDef->getName() + "'!"; > - ++CurVariant; > - ++LastEmitted; > - } else if (AsmString[DollarPos] == '}') { > - if (CurVariant == ~0U) > - throw "'}' character found outside of a variant in > instruction '" > - + CGI.TheDef->getName() + "'!"; > - ++LastEmitted; > - CurVariant = ~0U; > - } else if (DollarPos+1 != AsmString.size() && > - AsmString[DollarPos+1] == '$') { > - if (CurVariant == Variant || CurVariant == ~0U) { > - AddLiteralString("$"); // "$$" -> $ > - } > - LastEmitted = DollarPos+2; > - } else { > - // Get the name of the variable. > - std::string::size_type VarEnd = DollarPos+1; > - > - // handle ${foo}bar as $foo by detecting whether the > character following > - // the dollar sign is a curly brace. If so, advance VarEnd > and DollarPos > - // so the variable name does not contain the leading curly > brace. > - bool hasCurlyBraces = false; > - if (VarEnd < AsmString.size() && '{' == AsmString[VarEnd]) { > - hasCurlyBraces = true; > - ++DollarPos; > - ++VarEnd; > - } > - > - while (VarEnd < AsmString.size() && > isIdentChar(AsmString[VarEnd])) > - ++VarEnd; > - std::string VarName(AsmString.begin()+DollarPos+1, > - AsmString.begin()+VarEnd); > - > - // Modifier - Support ${foo:modifier} syntax, where > "modifier" is passed > - // into printOperand. Also support ${:feature}, which is > passed into > - // PrintSpecial. > - std::string Modifier; > - > - // In order to avoid starting the next string at the > terminating curly > - // brace, advance the end position past it if we found an > opening curly > - // brace. > - if (hasCurlyBraces) { > - if (VarEnd >= AsmString.size()) > - throw "Reached end of string before terminating curly > brace in '" > - + CGI.TheDef->getName() + "'"; > - > - // Look for a modifier string. > - if (AsmString[VarEnd] == ':') { > - ++VarEnd; > - if (VarEnd >= AsmString.size()) > - throw "Reached end of string before terminating curly > brace in '" > - + CGI.TheDef->getName() + "'"; > - > - unsigned ModifierStart = VarEnd; > - while (VarEnd < AsmString.size() && > isIdentChar(AsmString[VarEnd])) > - ++VarEnd; > - Modifier = std::string(AsmString.begin()+ModifierStart, > - AsmString.begin()+VarEnd); > - if (Modifier.empty()) > - throw "Bad operand modifier name in '"+ CGI.TheDef- > >getName() + "'"; > - } > - > - if (AsmString[VarEnd] != '}') > - throw "Variable name beginning with '{' did not end with > '}' in '" > - + CGI.TheDef->getName() + "'"; > - ++VarEnd; > - } > - if (VarName.empty() && Modifier.empty()) > - throw "Stray '$' in '" + CGI.TheDef->getName() + > - "' asm string, maybe you want $$?"; > - > - if (VarName.empty()) { > - // Just a modifier, pass this into PrintSpecial. > - Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, > Modifier)); > - } else { > - // Otherwise, normal operand. > - unsigned OpNo = CGI.getOperandNamed(VarName); > - CodeGenInstruction::OperandInfo OpInfo = > CGI.OperandList[OpNo]; > - > - if (CurVariant == Variant || CurVariant == ~0U) { > - unsigned MIOp = OpInfo.MIOperandNo; > - > Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, > - Modifier)); > - } > - } > - LastEmitted = VarEnd; > - } > - } > - > - Operands.push_back(AsmWriterOperand("return;", > - > AsmWriterOperand::isLiteralStatementOperand)); > -} > - > -/// MatchesAllButOneOp - If this instruction is exactly identical > to the > -/// specified instruction except for one differing operand, return > the differing > -/// operand number. If more than one operand mismatches, return > ~1, otherwise > -/// if the instructions are identical return ~0. > -unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst > &Other)const{ > - if (Operands.size() != Other.Operands.size()) return ~1; > - > - unsigned MismatchOperand = ~0U; > - for (unsigned i = 0, e = Operands.size(); i != e; ++i) { > - if (Operands[i] != Other.Operands[i]) { > - if (MismatchOperand != ~0U) // Already have one mismatch? > - return ~1U; > - else > - MismatchOperand = i; > - } > - } > - return MismatchOperand; > -} > - > static void PrintCases(std::vector AsmWriterOperand> > &OpsToPrint, raw_ostream > &O) { > O << " case " << OpsToPrint.back().first << ": "; > > Added: llvm/trunk/utils/TableGen/AsmWriterInst.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.cpp?rev=95697&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/AsmWriterInst.cpp (added) > +++ llvm/trunk/utils/TableGen/AsmWriterInst.cpp Tue Feb 9 15:50:41 > 2010 > @@ -0,0 +1,259 @@ > +//===- AsmWriterInst.h - Classes encapsulating a printable inst > -----------===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// These classes implement a parser for assembly strings. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#include "AsmWriterInst.h" > +#include "CodeGenTarget.h" > +#include "Record.h" > +#include "llvm/ADT/StringExtras.h" > + > +using namespace llvm; > + > +static bool isIdentChar(char C) { > + return (C >= 'a' && C <= 'z') || > + (C >= 'A' && C <= 'Z') || > + (C >= '0' && C <= '9') || > + C == '_'; > +} > + > +std::string AsmWriterOperand::getCode() const { > + if (OperandType == isLiteralTextOperand) { > + if (Str.size() == 1) > + return "O << '" + Str + "'; "; > + return "O << \"" + Str + "\"; "; > + } > + > + if (OperandType == isLiteralStatementOperand) > + return Str; > + > + std::string Result = Str + "(MI"; > + if (MIOpNo != ~0U) > + Result += ", " + utostr(MIOpNo); > + if (!MiModifier.empty()) > + Result += ", \"" + MiModifier + '"'; > + return Result + "); "; > +} > + > +/// ParseAsmString - Parse the specified Instruction's AsmString > into this > +/// AsmWriterInst. > +/// > +AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record > *AsmWriter) { > + this->CGI = &CGI; > + > + unsigned Variant = AsmWriter->getValueAsInt("Variant"); > + int FirstOperandColumn = AsmWriter- > >getValueAsInt("FirstOperandColumn"); > + int OperandSpacing = AsmWriter- > >getValueAsInt("OperandSpacing"); > + > + unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} > region, other #. > + > + // This is the number of tabs we've seen if we're doing columnar > layout. > + unsigned CurColumn = 0; > + > + > + // NOTE: Any extensions to this code need to be mirrored in the > + // AsmPrinter::printInlineAsm code that executes as compile time > (assuming > + // that inline asm strings should also get the new feature)! > + const std::string &AsmString = CGI.AsmString; > + std::string::size_type LastEmitted = 0; > + while (LastEmitted != AsmString.size()) { > + std::string::size_type DollarPos = > + AsmString.find_first_of("${|}\\", LastEmitted); > + if (DollarPos == std::string::npos) DollarPos = AsmString.size(); > + > + // Emit a constant string fragment. > + > + if (DollarPos != LastEmitted) { > + if (CurVariant == Variant || CurVariant == ~0U) { > + for (; LastEmitted != DollarPos; ++LastEmitted) > + switch (AsmString[LastEmitted]) { > + case '\n': > + AddLiteralString("\\n"); > + break; > + case '\t': > + // If the asm writer is not using a columnar layout, > \t is not > + // magic. > + if (FirstOperandColumn == -1 || OperandSpacing == -1) { > + AddLiteralString("\\t"); > + } else { > + // We recognize a tab as an operand delimeter. > + unsigned DestColumn = FirstOperandColumn + > + CurColumn++ * OperandSpacing; > + Operands.push_back( > + > AsmWriterOperand("O.PadToColumn(" + > + > utostr(DestColumn) + ");\n", > + > AsmWriterOperand::isLiteralStatementOperand)); > + } > + break; > + case '"': > + AddLiteralString("\\\""); > + break; > + case '\\': > + AddLiteralString("\\\\"); > + break; > + default: > + AddLiteralString(std::string(1, > AsmString[LastEmitted])); > + break; > + } > + } else { > + LastEmitted = DollarPos; > + } > + } else if (AsmString[DollarPos] == '\\') { > + if (DollarPos+1 != AsmString.size() && > + (CurVariant == Variant || CurVariant == ~0U)) { > + if (AsmString[DollarPos+1] == 'n') { > + AddLiteralString("\\n"); > + } else if (AsmString[DollarPos+1] == 't') { > + // If the asm writer is not using a columnar layout, \t > is not > + // magic. > + if (FirstOperandColumn == -1 || OperandSpacing == -1) { > + AddLiteralString("\\t"); > + break; > + } > + > + // We recognize a tab as an operand delimeter. > + unsigned DestColumn = FirstOperandColumn + > + CurColumn++ * OperandSpacing; > + Operands.push_back( > + AsmWriterOperand("O.PadToColumn(" + > utostr(DestColumn) + ");\n", > + > AsmWriterOperand::isLiteralStatementOperand)); > + break; > + } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) > + != std::string::npos) { > + AddLiteralString(std::string(1, AsmString[DollarPos+1])); > + } else { > + throw "Non-supported escaped character found in > instruction '" + > + CGI.TheDef->getName() + "'!"; > + } > + LastEmitted = DollarPos+2; > + continue; > + } > + } else if (AsmString[DollarPos] == '{') { > + if (CurVariant != ~0U) > + throw "Nested variants found for instruction '" + > + CGI.TheDef->getName() + "'!"; > + LastEmitted = DollarPos+1; > + CurVariant = 0; // We are now inside of the variant! > + } else if (AsmString[DollarPos] == '|') { > + if (CurVariant == ~0U) > + throw "'|' character found outside of a variant in > instruction '" > + + CGI.TheDef->getName() + "'!"; > + ++CurVariant; > + ++LastEmitted; > + } else if (AsmString[DollarPos] == '}') { > + if (CurVariant == ~0U) > + throw "'}' character found outside of a variant in > instruction '" > + + CGI.TheDef->getName() + "'!"; > + ++LastEmitted; > + CurVariant = ~0U; > + } else if (DollarPos+1 != AsmString.size() && > + AsmString[DollarPos+1] == '$') { > + if (CurVariant == Variant || CurVariant == ~0U) { > + AddLiteralString("$"); // "$$" -> $ > + } > + LastEmitted = DollarPos+2; > + } else { > + // Get the name of the variable. > + std::string::size_type VarEnd = DollarPos+1; > + > + // handle ${foo}bar as $foo by detecting whether the > character following > + // the dollar sign is a curly brace. If so, advance VarEnd > and DollarPos > + // so the variable name does not contain the leading curly > brace. > + bool hasCurlyBraces = false; > + if (VarEnd < AsmString.size() && '{' == AsmString[VarEnd]) { > + hasCurlyBraces = true; > + ++DollarPos; > + ++VarEnd; > + } > + > + while (VarEnd < AsmString.size() && > isIdentChar(AsmString[VarEnd])) > + ++VarEnd; > + std::string VarName(AsmString.begin()+DollarPos+1, > + AsmString.begin()+VarEnd); > + > + // Modifier - Support ${foo:modifier} syntax, where > "modifier" is passed > + // into printOperand. Also support ${:feature}, which is > passed into > + // PrintSpecial. > + std::string Modifier; > + > + // In order to avoid starting the next string at the > terminating curly > + // brace, advance the end position past it if we found an > opening curly > + // brace. > + if (hasCurlyBraces) { > + if (VarEnd >= AsmString.size()) > + throw "Reached end of string before terminating curly > brace in '" > + + CGI.TheDef->getName() + "'"; > + > + // Look for a modifier string. > + if (AsmString[VarEnd] == ':') { > + ++VarEnd; > + if (VarEnd >= AsmString.size()) > + throw "Reached end of string before terminating curly > brace in '" > + + CGI.TheDef->getName() + "'"; > + > + unsigned ModifierStart = VarEnd; > + while (VarEnd < AsmString.size() && > isIdentChar(AsmString[VarEnd])) > + ++VarEnd; > + Modifier = std::string(AsmString.begin()+ModifierStart, > + AsmString.begin()+VarEnd); > + if (Modifier.empty()) > + throw "Bad operand modifier name in '"+ CGI.TheDef- > >getName() + "'"; > + } > + > + if (AsmString[VarEnd] != '}') > + throw "Variable name beginning with '{' did not end with > '}' in '" > + + CGI.TheDef->getName() + "'"; > + ++VarEnd; > + } > + if (VarName.empty() && Modifier.empty()) > + throw "Stray '$' in '" + CGI.TheDef->getName() + > + "' asm string, maybe you want $$?"; > + > + if (VarName.empty()) { > + // Just a modifier, pass this into PrintSpecial. > + Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, > Modifier)); > + } else { > + // Otherwise, normal operand. > + unsigned OpNo = CGI.getOperandNamed(VarName); > + CodeGenInstruction::OperandInfo OpInfo = > CGI.OperandList[OpNo]; > + > + if (CurVariant == Variant || CurVariant == ~0U) { > + unsigned MIOp = OpInfo.MIOperandNo; > + > Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, > + Modifier)); > + } > + } > + LastEmitted = VarEnd; > + } > + } > + > + Operands.push_back(AsmWriterOperand("return;", > + > AsmWriterOperand::isLiteralStatementOperand)); > +} > + > +/// MatchesAllButOneOp - If this instruction is exactly identical > to the > +/// specified instruction except for one differing operand, return > the differing > +/// operand number. If more than one operand mismatches, return > ~1, otherwise > +/// if the instructions are identical return ~0. > +unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst > &Other)const{ > + if (Operands.size() != Other.Operands.size()) return ~1; > + > + unsigned MismatchOperand = ~0U; > + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { > + if (Operands[i] != Other.Operands[i]) { > + if (MismatchOperand != ~0U) // Already have one mismatch? > + return ~1U; > + else > + MismatchOperand = i; > + } > + } > + return MismatchOperand; > +} > \ No newline at end of file > > Added: llvm/trunk/utils/TableGen/AsmWriterInst.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.h?rev=95697&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/AsmWriterInst.h (added) > +++ llvm/trunk/utils/TableGen/AsmWriterInst.h Tue Feb 9 15:50:41 2010 > @@ -0,0 +1,104 @@ > +//===- AsmWriterInst.h - Classes encapsulating a printable inst -*- > C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// These classes implement a parser for assembly strings. The > parser splits > +// the string into operands, which can be literal strings (the > constant bits of > +// the string), actual operands (i.e., operands from the > MachineInstr), and > +// dynamically-generated text, specified by raw C++ code. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +#ifndef ASMWRITER_INST_H > +#define ASMWRITER_INST_H > + > +#include > +#include > + > +namespace llvm { > + class CodeGenInstruction; > + class Record; > + > + struct AsmWriterOperand { > + enum OpType { > + // Output this text surrounded by quotes to the asm. > + isLiteralTextOperand, > + // This is the name of a routine to call to print the operand. > + isMachineInstrOperand, > + // Output this text verbatim to the asm writer. It is code > that > + // will output some text to the asm. > + isLiteralStatementOperand > + } OperandType; > + > + /// Str - For isLiteralTextOperand, this IS the literal text. > For > + /// isMachineInstrOperand, this is the PrinterMethodName for > the operand.. > + /// For isLiteralStatementOperand, this is the code to insert > verbatim > + /// into the asm writer. > + std::string Str; > + > + /// MiOpNo - For isMachineInstrOperand, this is the operand > number of the > + /// machine instruction. > + unsigned MIOpNo; > + > + /// MiModifier - For isMachineInstrOperand, this is the > modifier string for > + /// an operand, specified with syntax like ${opname:modifier}. > + std::string MiModifier; > + > + // To make VS STL happy > + AsmWriterOperand(OpType op = > isLiteralTextOperand):OperandType(op) {} > + > + AsmWriterOperand(const std::string &LitStr, > + OpType op = isLiteralTextOperand) > + : OperandType(op), Str(LitStr) {} > + > + AsmWriterOperand(const std::string &Printer, unsigned OpNo, > + const std::string &Modifier, > + OpType op = isMachineInstrOperand) > + : OperandType(op), Str(Printer), MIOpNo(OpNo), > + MiModifier(Modifier) {} > + > + bool operator!=(const AsmWriterOperand &Other) const { > + if (OperandType != Other.OperandType || Str != Other.Str) > return true; > + if (OperandType == isMachineInstrOperand) > + return MIOpNo != Other.MIOpNo || MiModifier != > Other.MiModifier; > + return false; > + } > + bool operator==(const AsmWriterOperand &Other) const { > + return !operator!=(Other); > + } > + > + /// getCode - Return the code that prints this operand. > + std::string getCode() const; > + }; > + > + class AsmWriterInst { > + public: > + std::vector Operands; > + const CodeGenInstruction *CGI; > + > + AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); > + > + /// MatchesAllButOneOp - If this instruction is exactly > identical to the > + /// specified instruction except for one differing operand, > return the > + /// differing operand number. Otherwise return ~0. > + unsigned MatchesAllButOneOp(const AsmWriterInst &Other) const; > + > + private: > + void AddLiteralString(const std::string &Str) { > + // If the last operand was already a literal text string, > append this to > + // it, otherwise add a new operand. > + if (!Operands.empty() && > + Operands.back().OperandType == > AsmWriterOperand::isLiteralTextOperand) > + Operands.back().Str.append(Str); > + else > + Operands.push_back(AsmWriterOperand(Str)); > + } > + }; > +} > + > +#endif > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Feb 9 16:54:51 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 14:54:51 -0800 Subject: [llvm-commits] [llvm] r95656 - in /llvm/trunk/test/CodeGen: Generic/ X86/ In-Reply-To: References: <201002090641.o196f4JO005764@zion.cs.uiuc.edu> Message-ID: On Feb 8, 2010, at 11:49 PM, Anton Korobeynikov wrote: > Hi, Chris > >> llvm/trunk/test/CodeGen/Generic/2007-04-14-BitTestsBadMask.ll >> llvm/trunk/test/CodeGen/Generic/2007-04-27-BitTestsBadMask.ll > Why have you removed these two ones? They test actual regressions! The former is huge and unreduced. The later didn't seem very important. >> >> -; RUN: grep jb %t | count 1 >> -; RUN: grep \\\$6 %t | count 2 >> -; RUN: grep 1024 %t | count 1 >> -; RUN: grep 1023 %t | count 1 >> -; RUN: grep 119 %t | count 1 >> -; RUN: grep JTI %t | count 2 >> -; RUN: grep jg %t | count 3 >> -; RUN: grep ja %t | count 1 >> -; RUN: grep jns %t | count 1 > These files actually test the behaviour of switch lowering. You just > removed that. Surely, it will never crash. We have several other tests for switch lowering. Why is this one important? Are you worried about switch lowering miscompiling a switch? How is that any more likely than switch lowering crashing? -Chris From daniel at zuster.org Tue Feb 9 16:59:55 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 09 Feb 2010 22:59:55 -0000 Subject: [llvm-commits] [llvm] r95708 - in /llvm/trunk: include/llvm/MC/MCCodeEmitter.h include/llvm/MC/MCFixup.h lib/MC/MCAsmStreamer.cpp lib/MC/MCMachOStreamer.cpp lib/Target/X86/X86CodeEmitter.cpp lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002092259.o19MxufC003442@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 16:59:55 2010 New Revision: 95708 URL: http://llvm.org/viewvc/llvm-project?rev=95708&view=rev Log: MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter. Added: llvm/trunk/include/llvm/MC/MCFixup.h Modified: llvm/trunk/include/llvm/MC/MCCodeEmitter.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/include/llvm/MC/MCCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCCodeEmitter.h?rev=95708&r1=95707&r2=95708&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCCodeEmitter.h (original) +++ llvm/trunk/include/llvm/MC/MCCodeEmitter.h Tue Feb 9 16:59:55 2010 @@ -10,23 +10,60 @@ #ifndef LLVM_MC_MCCODEEMITTER_H #define LLVM_MC_MCCODEEMITTER_H +#include "llvm/MC/MCFixup.h" + +#include + namespace llvm { +class MCExpr; class MCInst; class raw_ostream; +template class SmallVectorImpl; + +/// MCFixupKindInfo - Target independent information on a fixup kind. +struct MCFixupKindInfo { + /// A target specific name for the fixup kind. The names will be unique for + /// distinct kinds on any given target. + const char *Name; + + /// The bit offset to write the relocation into. + // + // FIXME: These two fields are under-specified and not general enough, but it + // is covers many things, and is enough to let the AsmStreamer pretty-print + // the encoding. + unsigned TargetOffset; + + /// The number of bits written by this fixup. The bits are assumed to be + /// contiguous. + unsigned TargetSize; +}; /// MCCodeEmitter - Generic instruction encoding interface. class MCCodeEmitter { +private: MCCodeEmitter(const MCCodeEmitter &); // DO NOT IMPLEMENT void operator=(const MCCodeEmitter &); // DO NOT IMPLEMENT protected: // Can only create subclasses. MCCodeEmitter(); - + public: virtual ~MCCodeEmitter(); + /// @name Target Independent Fixup Information + /// @{ + + /// getNumFixupKinds - Get the number of target specific fixup kinds. + virtual unsigned getNumFixupKinds() const = 0; + + /// getFixupKindInfo - Get information on a fixup kind. + virtual MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const = 0; + + /// @} + /// EncodeInstruction - Encode the given \arg Inst to bytes on the output /// stream \arg OS. - virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS) const = 0; + virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS, + SmallVectorImpl &Fixups) const = 0; }; } // End llvm namespace Added: llvm/trunk/include/llvm/MC/MCFixup.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=95708&view=auto ============================================================================== --- llvm/trunk/include/llvm/MC/MCFixup.h (added) +++ llvm/trunk/include/llvm/MC/MCFixup.h Tue Feb 9 16:59:55 2010 @@ -0,0 +1,95 @@ +//===-- llvm/MC/MCFixup.h - Instruction Relocation and Patching -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCFIXUP_H +#define LLVM_MC_MCFIXUP_H + +#include + +namespace llvm { + +// Private constants, do not use. +// +// This is currently layed out so that the MCFixup fields can be efficiently +// accessed, while keeping the offset field large enought that the assembler +// backend can reasonably use the MCFixup representation for an entire fragment +// (splitting any overly large fragments). +// +// The division of bits between the kind and the opindex can be tweaked if we +// end up needing more bits for target dependent kinds. +enum { + MCFIXUP_NUM_GENERIC_KINDS = 128, + MCFIXUP_NUM_KIND_BITS = 8, + MCFIXUP_NUM_OPINDEX_BITS = 8, + MCFIXUP_NUM_OFFSET_BITS = (32 - MCFIXUP_NUM_OPINDEX_BITS - + MCFIXUP_NUM_OPINDEX_BITS) +}; + +/// MCFixupKind - Extensible enumeration to represent the type of a fixup. +enum MCFixupKind { + FK_Data_1 = 0, ///< A one-byte fixup. + FK_Data_2, ///< A two-byte fixup. + FK_Data_4, ///< A four-byte fixup. + FK_Data_8, ///< A eight-byte fixup. + + FirstTargetFixupKind = MCFIXUP_NUM_GENERIC_KINDS, + + MaxTargetFixupKind = (1 << MCFIXUP_NUM_KIND_BITS) +}; + +/// MCFixup - Encode information on a single operation to perform on an byte +/// sequence (e.g., an encoded instruction) which requires assemble- or run- +/// time patching. +/// +/// Fixups are used any time the target instruction encoder needs to represent +/// some value in an instruction which is not yet concrete. The encoder will +/// encode the instruction assuming the value is 0, and emit a fixup which +/// communicates to the assembler backend how it should rewrite the encoded +/// value. +/// +/// During the process of relaxation, the assembler will apply fixups as +/// symbolic values become concrete. When relaxation is complete, any remaining +/// fixups become relocations in the object file (or errors, if the fixup cannot +/// be encoded on the target). +class MCFixup { + static const unsigned MaxOffset = 1 << MCFIXUP_NUM_KIND_BITS; + + /// The byte index of start of the relocation inside the encoded instruction. + unsigned Offset : MCFIXUP_NUM_OFFSET_BITS; + + /// The index of the operand to encode into the instruction. + unsigned OpIndex : MCFIXUP_NUM_OPINDEX_BITS; + + /// The target dependent kind of fixup item this is. The kind is used to + /// determine how the operand value should be encoded into the instruction. + unsigned Kind : MCFIXUP_NUM_KIND_BITS; + +public: + static MCFixup Create(unsigned Offset, unsigned OpIndex, MCFixupKind Kind) { + MCFixup FI; + FI.Offset = Offset; + FI.OpIndex = OpIndex; + FI.Kind = unsigned(Kind); + + assert(Offset == FI.Offset && "Offset out of range!"); + assert(OpIndex == FI.OpIndex && "Operand index out of range!"); + assert(Kind == FI.Kind && "Kind out of range!"); + return FI; + } + + unsigned getOffset() const { return Offset; } + + unsigned getOpIndex() const { return OpIndex; } + + MCFixupKind getKind() const { return MCFixupKind(Kind); } +}; + +} // End llvm namespace + +#endif Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95708&r1=95707&r2=95708&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 16:59:55 2010 @@ -535,8 +535,9 @@ // Show the encoding in a comment if we have a code emitter. if (Emitter) { SmallString<256> Code; + SmallVector Fixups; raw_svector_ostream VecOS(Code); - Emitter->EncodeInstruction(Inst, VecOS); + Emitter->EncodeInstruction(Inst, VecOS, Fixups); VecOS.flush(); raw_ostream &OS = GetCommentOS(); Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=95708&r1=95707&r2=95708&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Tue Feb 9 16:59:55 2010 @@ -366,9 +366,10 @@ CurSectionData->setHasInstructions(true); // FIXME: Relocations! + SmallVector Fixups; SmallString<256> Code; raw_svector_ostream VecOS(Code); - Emitter->EncodeInstruction(Inst, VecOS); + Emitter->EncodeInstruction(Inst, VecOS, Fixups); EmitBytes(VecOS.str(), 0); } Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95708&r1=95707&r2=95708&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 16:59:55 2010 @@ -944,6 +944,24 @@ delete DummyF; } + unsigned getNumFixupKinds() const { + return 5; + } + + MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { + static MCFixupKindInfo Infos[] = { + { "reloc_pcrel_word", 0, 4 * 8 }, + { "reloc_picrel_word", 0, 4 * 8 }, + { "reloc_absolute_word", 0, 4 * 8 }, + { "reloc_absolute_word_sext", 0, 4 * 8 }, + { "reloc_absolute_dword", 0, 8 * 8 } + }; + + assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind && + "Invalid kind!"); + return Infos[Kind - FirstTargetFixupKind]; + } + bool AddRegToInstr(const MCInst &MI, MachineInstr *Instr, unsigned Start) const { if (Start + 1 > MI.getNumOperands()) @@ -997,7 +1015,8 @@ AddRegToInstr(MI, Instr, Start + 4)); } - void EncodeInstruction(const MCInst &MI, raw_ostream &OS) const { + void EncodeInstruction(const MCInst &MI, raw_ostream &OS, + SmallVectorImpl &Fixups) const { // Don't look yet! // Convert the MCInst to a MachineInstr so we can (ab)use the regular Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95708&r1=95707&r2=95708&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Tue Feb 9 16:59:55 2010 @@ -33,6 +33,24 @@ } ~X86MCCodeEmitter() {} + + unsigned getNumFixupKinds() const { + return 5; + } + + MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { + static MCFixupKindInfo Infos[] = { + { "reloc_pcrel_word", 0, 4 * 8 }, + { "reloc_picrel_word", 0, 4 * 8 }, + { "reloc_absolute_word", 0, 4 * 8 }, + { "reloc_absolute_word_sext", 0, 4 * 8 }, + { "reloc_absolute_dword", 0, 8 * 8 } + }; + + assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind && + "Invalid kind!"); + return Infos[Kind - FirstTargetFixupKind]; + } static unsigned GetX86RegNum(const MCOperand &MO) { return X86RegisterInfo::getX86RegNum(MO.getReg()); @@ -75,7 +93,8 @@ unsigned RegOpcodeField, intptr_t PCAdj, raw_ostream &OS) const; - void EncodeInstruction(const MCInst &MI, raw_ostream &OS) const; + void EncodeInstruction(const MCInst &MI, raw_ostream &OS, + SmallVectorImpl &Fixups) const; }; @@ -379,7 +398,8 @@ } void X86MCCodeEmitter:: -EncodeInstruction(const MCInst &MI, raw_ostream &OS) const { +EncodeInstruction(const MCInst &MI, raw_ostream &OS, + SmallVectorImpl &Fixups) const { unsigned Opcode = MI.getOpcode(); const TargetInstrDesc &Desc = TII.get(Opcode); unsigned TSFlags = Desc.TSFlags; From daniel at zuster.org Tue Feb 9 17:00:03 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 09 Feb 2010 23:00:03 -0000 Subject: [llvm-commits] [llvm] r95709 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <201002092300.o19N03RN003461@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 17:00:03 2010 New Revision: 95709 URL: http://llvm.org/viewvc/llvm-project?rev=95709&view=rev Log: MC/X86: Add a dummy implementation of MCFixup generation for hacky X86 MCCodeEmitter. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95709&r1=95708&r2=95709&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 17:00:03 2010 @@ -647,6 +647,12 @@ emitExternalSymbolAddress(MO.getSymbolName(), X86::reloc_pcrel_word); break; } + + // FIXME: Only used by hackish MCCodeEmitter, remove when dead. + if (MO.isJTI()) { + emitJumpTableAddress(MO.getIndex(), X86::reloc_pcrel_word); + break; + } assert(MO.isImm() && "Unknown RawFrm operand!"); if (Opcode == X86::CALLpcrel32 || Opcode == X86::CALL64pcrel32) { @@ -872,11 +878,13 @@ namespace { class MCSingleInstructionCodeEmitter : public MachineCodeEmitter { uint8_t Data[256]; + SmallVectorImpl *FixupList; public: - MCSingleInstructionCodeEmitter() { reset(); } + MCSingleInstructionCodeEmitter() { reset(0); } - void reset() { + void reset(SmallVectorImpl *Fixups) { + FixupList = Fixups; BufferBegin = Data; BufferEnd = array_endof(Data); CurBufferPtr = Data; @@ -889,23 +897,50 @@ virtual void startFunction(MachineFunction &F) {} virtual bool finishFunction(MachineFunction &F) { return false; } - virtual void emitLabel(uint64_t LabelID) {} virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {} virtual bool earlyResolveAddresses() const { return false; } - virtual void addRelocation(const MachineRelocation &MR) { } + virtual void addRelocation(const MachineRelocation &MR) { + unsigned Offset = 0, OpIndex = 0, Kind = MR.getRelocationType(); + + // This form is only used in one case, for branches. + if (MR.isBasicBlock()) { + Offset = unsigned(MR.getMachineCodeOffset()); + OpIndex = 0; + } else { + assert(MR.isJumpTableIndex() && "Unexpected relocation!"); + + Offset = unsigned(MR.getMachineCodeOffset()); + + // The operand index is encoded as the first byte of the fake operand. + OpIndex = MR.getJumpTableIndex(); + } + + FixupList->push_back(MCFixup::Create(Offset, OpIndex, + MCFixupKind(FirstTargetFixupKind + Kind))); + } + virtual void setModuleInfo(MachineModuleInfo* Info) {} + + // Interface functions which should never get called in our usage. + + virtual void emitLabel(uint64_t LabelID) { + assert(0 && "Unexpected code emitter call!"); + } virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const { + assert(0 && "Unexpected code emitter call!"); return 0; } virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const { + assert(0 && "Unexpected code emitter call!"); return 0; } virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const { + assert(0 && "Unexpected code emitter call!"); return 0; } virtual uintptr_t getLabelAddress(uint64_t LabelID) const { + assert(0 && "Unexpected code emitter call!"); return 0; } - virtual void setModuleInfo(MachineModuleInfo* Info) {} }; class X86MCCodeEmitter : public MCCodeEmitter { @@ -993,8 +1028,9 @@ return true; } - // FIXME: Relocation / fixup. - Instr->addOperand(MachineOperand::CreateImm(0)); + // Fake this as an external symbol to the code emitter to add a relcoation + // entry we will recognize. + Instr->addOperand(MachineOperand::CreateJTI(Start, 0)); return true; } @@ -1127,7 +1163,7 @@ Instr->dump(); } - InstrEmitter->reset(); + InstrEmitter->reset(&Fixups); if (OK) Emit->emitInstruction(*Instr, &Desc); OS << InstrEmitter->str(); From daniel at zuster.org Tue Feb 9 17:00:14 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 09 Feb 2010 23:00:14 -0000 Subject: [llvm-commits] [llvm] r95710 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp lib/MC/MCAssembler.cpp tools/llvm-mc/llvm-mc.cpp Message-ID: <201002092300.o19N0ELW003487@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 17:00:14 2010 New Revision: 95710 URL: http://llvm.org/viewvc/llvm-project?rev=95710&view=rev Log: llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCAssembler.cpp llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=95710&r1=95709&r2=95710&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Feb 9 17:00:14 2010 @@ -278,12 +278,15 @@ /// /// \param ShowInst - Whether to show the MCInst representation inline with /// the assembly. + /// + /// \param ShowFixups - Whether to show the fixups in an encoded instruction. MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS, const MCAsmInfo &MAI, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *InstPrint = 0, MCCodeEmitter *CE = 0, - bool ShowInst = false); + bool ShowInst = false, + bool ShowFixups = false); // FIXME: These two may end up getting rolled into a single // createObjectStreamer interface, which implements the assembler backend, and Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95710&r1=95709&r2=95710&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 17:00:14 2010 @@ -37,21 +37,22 @@ unsigned IsLittleEndian : 1; unsigned IsVerboseAsm : 1; + unsigned ShowFixups : 1; unsigned ShowInst : 1; public: MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os, const MCAsmInfo &mai, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *printer, - MCCodeEmitter *emitter, bool showInst) + MCCodeEmitter *emitter, bool showInst, bool showFixups) : MCStreamer(Context), OS(os), MAI(mai), InstPrinter(printer), Emitter(emitter), CommentStream(CommentToEmit), IsLittleEndian(isLittleEndian), IsVerboseAsm(isVerboseAsm), - ShowInst(showInst) {} + ShowFixups(showFixups), ShowInst(showInst) {} ~MCAsmStreamer() {} bool isLittleEndian() const { return IsLittleEndian; } - + inline void EmitEOL() { // If we don't have any comments, just emit a \n. if (!IsVerboseAsm) { @@ -65,13 +66,16 @@ /// isVerboseAsm - Return true if this streamer supports verbose assembly at /// all. virtual bool isVerboseAsm() const { return IsVerboseAsm; } - + /// AddComment - Add a comment that can be emitted to the generated .s /// file if applicable as a QoI issue to make the output of the compiler /// more readable. This only affects the MCAsmStreamer, and only when /// verbose assembly output is enabled. virtual void AddComment(const Twine &T); - + + /// AddEncodingComment - Add a comment showing the encoding of an instruction. + virtual void AddEncodingComment(const MCInst &Inst); + /// GetCommentOS - Return a raw_ostream that comments can be written to. /// Unlike AddComment, you are required to terminate comments with \n if you /// use this method. @@ -80,12 +84,12 @@ return nulls(); // Discard comments unless in verbose asm mode. return CommentStream; } - + /// AddBlankLine - Emit a blank line to a .s file to pretty it up. virtual void AddBlankLine() { EmitEOL(); } - + /// @name MCStreamer Interface /// @{ @@ -528,19 +532,16 @@ EmitEOL(); } +void MCAsmStreamer::AddEncodingComment(const MCInst &Inst) { + raw_ostream &OS = GetCommentOS(); + SmallString<256> Code; + SmallVector Fixups; + raw_svector_ostream VecOS(Code); + Emitter->EncodeInstruction(Inst, VecOS, Fixups); + VecOS.flush(); -void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { - assert(CurSection && "Cannot emit contents before setting section!"); - - // Show the encoding in a comment if we have a code emitter. - if (Emitter) { - SmallString<256> Code; - SmallVector Fixups; - raw_svector_ostream VecOS(Code); - Emitter->EncodeInstruction(Inst, VecOS, Fixups); - VecOS.flush(); - - raw_ostream &OS = GetCommentOS(); + // If we aren't showing fixups, just show the bytes. + if (!ShowFixups) { OS << "encoding: ["; for (unsigned i = 0, e = Code.size(); i != e; ++i) { if (i) @@ -550,6 +551,75 @@ OS << "]\n"; } + // If we are showing fixups, create symbolic markers in the encoded + // representation. We do this by making a per-bit map to the fixup item index, + // then trying to display it as nicely as possible. + uint8_t *FixupMap = new uint8_t[Code.size() * 8]; + for (unsigned i = 0, e = Code.size() * 8; i != e; ++i) + FixupMap[i] = 0; + + for (unsigned i = 0, e = Fixups.size(); i != e; ++i) { + MCFixup &F = Fixups[i]; + MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind()); + for (unsigned j = 0; j != Info.TargetSize; ++j) { + unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j; + assert(Index < Code.size() * 8 && "Invalid offset in fixup!"); + FixupMap[Index] = 1 + i; + } + } + + OS << "encoding: ["; + for (unsigned i = 0, e = Code.size(); i != e; ++i) { + if (i) + OS << ','; + + // See if all bits are the same map entry. + uint8_t MapEntry = FixupMap[i * 8 + 0]; + for (unsigned j = 1; j != 8; ++j) { + if (FixupMap[i * 8 + j] == MapEntry) + continue; + + MapEntry = uint8_t(~0U); + break; + } + + if (MapEntry != uint8_t(~0U)) { + if (MapEntry == 0) { + OS << format("0x%02x", uint8_t(Code[i])); + } else { + assert(Code[i] == 0 && "Encoder wrote into fixed up bit!"); + OS << char('A' + MapEntry - 1); + } + } else { + // Otherwise, write out in binary. + OS << "0b"; + for (unsigned j = 8; j--;) { + unsigned Bit = (Code[i] >> j) & 1; + if (uint8_t MapEntry = FixupMap[i * 8 + j]) { + assert(Bit == 0 && "Encoder wrote into fixed up bit!"); + OS << char('A' + MapEntry - 1); + } else + OS << Bit; + } + } + } + OS << "]\n"; + + for (unsigned i = 0, e = Fixups.size(); i != e; ++i) { + MCFixup &F = Fixups[i]; + MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind()); + OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset() + << ", op: " << F.getOpIndex() << ", kind: " << Info.Name << "\n"; + } +} + +void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { + assert(CurSection && "Cannot emit contents before setting section!"); + + // Show the encoding in a comment if we have a code emitter. + if (Emitter) + AddEncodingComment(Inst); + // Show the MCInst if enabled. if (ShowInst) { raw_ostream &OS = GetCommentOS(); @@ -578,7 +648,8 @@ formatted_raw_ostream &OS, const MCAsmInfo &MAI, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *IP, - MCCodeEmitter *CE, bool ShowInst) { + MCCodeEmitter *CE, bool ShowInst, + bool ShowFixups) { return new MCAsmStreamer(Context, OS, MAI, isLittleEndian, isVerboseAsm, - IP, CE, ShowInst); + IP, CE, ShowInst, ShowFixups); } Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=95710&r1=95709&r2=95710&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Tue Feb 9 17:00:14 2010 @@ -746,7 +746,7 @@ SD.getAddress() + SD.getFileSize()); } - // The section data is passed to 4 bytes. + // The section data is padded to 4 bytes. // // FIXME: Is this machine dependent? unsigned SectionDataPadding = OffsetToAlignment(SectionDataFileSize, 4); @@ -761,9 +761,9 @@ // ... and then the section headers. // // We also compute the section relocations while we do this. Note that - // compute relocation info will also update the fixup to have the correct - // value; this will be overwrite the appropriate data in the fragment when - // it is written. + // computing relocation info will also update the fixup to have the correct + // value; this will overwrite the appropriate data in the fragment when it + // is written. std::vector RelocInfos; uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize; for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=95710&r1=95709&r2=95710&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Feb 9 17:00:14 2010 @@ -47,6 +47,9 @@ ShowEncoding("show-encoding", cl::desc("Show instruction encodings")); static cl::opt +ShowFixups("show-fixups", cl::desc("Show fixups inside encodings")); + +static cl::opt ShowInst("show-inst", cl::desc("Show internal instruction representation")); static cl::opt @@ -270,7 +273,7 @@ Str.reset(createAsmStreamer(Ctx, *Out, *MAI, TM->getTargetData()->isLittleEndian(), /*asmverbose*/true, IP.get(), CE.get(), - ShowInst)); + ShowInst, ShowFixups)); } else { assert(FileType == OFT_ObjectFile && "Invalid file type!"); CE.reset(TheTarget->createCodeEmitter(*TM)); From greened at obbligato.org Tue Feb 9 17:03:05 2010 From: greened at obbligato.org (David Greene) Date: Tue, 09 Feb 2010 23:03:05 -0000 Subject: [llvm-commits] [llvm] r95711 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <201002092303.o19N35U0003807@zion.cs.uiuc.edu> Author: greened Date: Tue Feb 9 17:03:05 2010 New Revision: 95711 URL: http://llvm.org/viewvc/llvm-project?rev=95711&view=rev Log: Only dump output in debug mode. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=95711&r1=95710&r2=95711&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Feb 9 17:03:05 2010 @@ -5224,11 +5224,12 @@ } } if (I == SortedPos) { - allnodes_iterator J = I; - SDNode *S = ++J; - dbgs() << "Offending node:\n"; +#ifndef NDEBUG + SDNode *S = ++I; + dbgs() << "Overran sorted position:\n"; S->dumprFull(); - assert(0 && "Overran sorted position"); +#endif + llvm_unreachable(0); } } From jyasskin at google.com Tue Feb 9 17:03:44 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Tue, 09 Feb 2010 23:03:44 -0000 Subject: [llvm-commits] [llvm] r95712 - in /llvm/trunk: autoconf/configure.ac configure docs/ReleaseNotes.html Message-ID: <201002092303.o19N3ix3003872@zion.cs.uiuc.edu> Author: jyasskin Date: Tue Feb 9 17:03:44 2010 New Revision: 95712 URL: http://llvm.org/viewvc/llvm-project?rev=95712&view=rev Log: Make --disable-libffi work on systems with libffi installed. Also make no-ffi the default even on systems with libffi. This fixes http://llvm.org/PR5018. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=95712&r1=95711&r2=95712&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Tue Feb 9 17:03:44 2010 @@ -727,13 +727,13 @@ dnl --enable-libffi : check whether the user wants to turn off libffi: AC_ARG_ENABLE(libffi,AS_HELP_STRING( - --enable-libffi,[Check for the presence of libffi (default is YES)]),, - enableval=yes) -case "$enableval" in - yes) llvm_cv_enable_libffi="yes" ;; - no) llvm_cv_enable_libffi="no" ;; - *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;; -esac + --enable-libffi,[Check for the presence of libffi (default is NO)]), + [case "$enableval" in + yes) llvm_cv_enable_libffi="yes" ;; + no) llvm_cv_enable_libffi="no" ;; + *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;; + esac], + llvm_cv_enable_libffi=no) dnl Only Windows needs dynamic libCompilerDriver to support plugins. if test "$llvm_cv_os_type" = "Win32" ; then @@ -1021,7 +1021,7 @@ if test "$llvm_cv_enable_libffi" = "yes" ; then AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], [Define if libffi is available on this platform.]), - AC_MSG_WARN([libffi not found - disabling external calls from interpreter])) + AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it])) fi dnl mallinfo is optional; the code can compile (minus features) without it Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=95712&r1=95711&r2=95712&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Tue Feb 9 17:03:44 2010 @@ -1410,7 +1410,7 @@ %a (default is YES) --enable-bindings Build specific language bindings: all,auto,none,{binding-name} (default=auto) - --enable-libffi Check for the presence of libffi (default is YES) + --enable-libffi Check for the presence of libffi (default is NO) --enable-llvmc-dynamic Link LLVMC dynamically (default is NO, unless on Win32) --enable-llvmc-dynamic-plugins @@ -5203,18 +5203,17 @@ # Check whether --enable-libffi was given. if test "${enable_libffi+set}" = set; then - enableval=$enable_libffi; + enableval=$enable_libffi; case "$enableval" in + yes) llvm_cv_enable_libffi="yes" ;; + no) llvm_cv_enable_libffi="no" ;; + *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-libffi. Use \"yes\" or \"no\"" >&5 +echo "$as_me: error: Invalid setting for --enable-libffi. Use \"yes\" or \"no\"" >&2;} + { (exit 1); exit 1; }; } ;; + esac else - enableval=yes + llvm_cv_enable_libffi=no fi -case "$enableval" in - yes) llvm_cv_enable_libffi="yes" ;; - no) llvm_cv_enable_libffi="no" ;; - *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-libffi. Use \"yes\" or \"no\"" >&5 -echo "$as_me: error: Invalid setting for --enable-libffi. Use \"yes\" or \"no\"" >&2;} - { (exit 1); exit 1; }; } ;; -esac if test "$llvm_cv_os_type" = "Win32" ; then llvmc_dynamic="yes" @@ -11036,7 +11035,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 -echo "$as_me: WARNING: libffi not found - disabling external calls from interpreter" >&2;} + { { echo "$as_me:$LINENO: error: libffi not found - configure without --enable-libffi to compile without it" >&5 +echo "$as_me: error: libffi not found - configure without --enable-libffi to compile without it" >&2;} + { (exit 1); exit 1; }; } fi fi Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=95712&r1=95711&r2=95712&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Tue Feb 9 17:03:44 2010 @@ -604,7 +604,11 @@ from the previous release.

    -
  • ...
  • +
  • The LLVM interpreter now defaults to not using libffi even +if you have it installed. This makes it more likely that an LLVM built on one +system will work when copied to a similar system. To use libffi, +configure with --enable-libffi. +
From johnny.chen at apple.com Tue Feb 9 17:05:23 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 09 Feb 2010 23:05:23 -0000 Subject: [llvm-commits] [llvm] r95713 - /llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Message-ID: <201002092305.o19N5NIr003952@zion.cs.uiuc.edu> Author: johnny Date: Tue Feb 9 17:05:23 2010 New Revision: 95713 URL: http://llvm.org/viewvc/llvm-project?rev=95713&view=rev Log: Add VBIF/VBIT for disassembly only. A8.6.279 Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=95713&r1=95712&r2=95713&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Tue Feb 9 17:05:23 2010 @@ -2192,9 +2192,27 @@ // VBIF : Vector Bitwise Insert if False // like VBSL but with: "vbif $dst, $src3, $src1", "$src2 = $dst", +def VBIFd : N3VX<1, 0, 0b11, 0b0001, 0, 1, + (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), + IIC_VBINiD, "vbif", "$dst, $src2, $src3", "$src1 = $dst", + [/* For disassembly only; pattern left blank */]>; +def VBIFq : N3VX<1, 0, 0b11, 0b0001, 1, 1, + (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), + IIC_VBINiQ, "vbif", "$dst, $src2, $src3", "$src1 = $dst", + [/* For disassembly only; pattern left blank */]>; + // VBIT : Vector Bitwise Insert if True // like VBSL but with: "vbit $dst, $src2, $src1", "$src3 = $dst", -// These are not yet implemented. The TwoAddress pass will not go looking +def VBITd : N3VX<1, 0, 0b10, 0b0001, 0, 1, + (outs DPR:$dst), (ins DPR:$src1, DPR:$src2, DPR:$src3), + IIC_VBINiD, "vbit", "$dst, $src2, $src3", "$src1 = $dst", + [/* For disassembly only; pattern left blank */]>; +def VBITq : N3VX<1, 0, 0b10, 0b0001, 1, 1, + (outs QPR:$dst), (ins QPR:$src1, QPR:$src2, QPR:$src3), + IIC_VBINiQ, "vbit", "$dst, $src2, $src3", "$src1 = $dst", + [/* For disassembly only; pattern left blank */]>; + +// VBIT/VBIF are not yet implemented. The TwoAddress pass will not go looking // for equivalent operations with different register constraints; it just // inserts copies. From scallanan at apple.com Tue Feb 9 17:06:36 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 09 Feb 2010 23:06:36 -0000 Subject: [llvm-commits] [llvm] r95715 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp AsmWriterInst.cpp AsmWriterInst.h EDEmitter.cpp Message-ID: <201002092306.o19N6axl004117@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 17:06:35 2010 New Revision: 95715 URL: http://llvm.org/viewvc/llvm-project?rev=95715&view=rev Log: Fixed some indentation in the AsmWriterInst implementation. Also changed the constructor so that it does not require a Record, making it usable by the EDEmitter. Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp llvm/trunk/utils/TableGen/AsmWriterInst.cpp llvm/trunk/utils/TableGen/AsmWriterInst.h llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=95715&r1=95714&r2=95715&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Tue Feb 9 17:06:35 2010 @@ -256,7 +256,11 @@ E = Target.inst_end(); I != E; ++I) if (!I->second.AsmString.empty() && I->second.TheDef->getName() != "PHI") - Instructions.push_back(AsmWriterInst(I->second, AsmWriter)); + Instructions.push_back( + AsmWriterInst(I->second, + AsmWriter->getValueAsInt("Variant"), + AsmWriter->getValueAsInt("FirstOperandColumn"), + AsmWriter->getValueAsInt("OperandSpacing"))); // Get the instruction numbering. Target.getInstructionsByEnumValue(NumberedInstructions); Modified: llvm/trunk/utils/TableGen/AsmWriterInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.cpp?rev=95715&r1=95714&r2=95715&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterInst.cpp Tue Feb 9 17:06:35 2010 @@ -46,13 +46,12 @@ /// ParseAsmString - Parse the specified Instruction's AsmString into this /// AsmWriterInst. /// -AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) { +AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, + unsigned Variant, + int FirstOperandColumn, + int OperandSpacing) { this->CGI = &CGI; - unsigned Variant = AsmWriter->getValueAsInt("Variant"); - int FirstOperandColumn = AsmWriter->getValueAsInt("FirstOperandColumn"); - int OperandSpacing = AsmWriter->getValueAsInt("OperandSpacing"); - unsigned CurVariant = ~0U; // ~0 if we are outside a {.|.|.} region, other #. // This is the number of tabs we've seen if we're doing columnar layout. @@ -88,9 +87,10 @@ unsigned DestColumn = FirstOperandColumn + CurColumn++ * OperandSpacing; Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + - utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand( + "O.PadToColumn(" + + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); } break; case '"': @@ -123,8 +123,8 @@ unsigned DestColumn = FirstOperandColumn + CurColumn++ * OperandSpacing; Operands.push_back( - AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand("O.PadToColumn(" + utostr(DestColumn) + ");\n", + AsmWriterOperand::isLiteralStatementOperand)); break; } else if (std::string("${|}\\").find(AsmString[DollarPos+1]) != std::string::npos) { @@ -236,7 +236,7 @@ } Operands.push_back(AsmWriterOperand("return;", - AsmWriterOperand::isLiteralStatementOperand)); + AsmWriterOperand::isLiteralStatementOperand)); } /// MatchesAllButOneOp - If this instruction is exactly identical to the @@ -256,4 +256,4 @@ } } return MismatchOperand; -} \ No newline at end of file +} Modified: llvm/trunk/utils/TableGen/AsmWriterInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.h?rev=95715&r1=95714&r2=95715&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.h (original) +++ llvm/trunk/utils/TableGen/AsmWriterInst.h Tue Feb 9 17:06:35 2010 @@ -81,7 +81,10 @@ std::vector Operands; const CodeGenInstruction *CGI; - AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter); + AsmWriterInst(const CodeGenInstruction &CGI, + unsigned Variant, + int FirstOperandColumn, + int OperandSpacing); /// MatchesAllButOneOp - If this instruction is exactly identical to the /// specified instruction except for one differing operand, return the Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=95715&r1=95714&r2=95715&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Tue Feb 9 17:06:35 2010 @@ -15,6 +15,7 @@ #include "EDEmitter.h" +#include "AsmWriterInst.h" #include "CodeGenTarget.h" #include "Record.h" From gvenn.cfe.dev at gmail.com Tue Feb 9 17:22:44 2010 From: gvenn.cfe.dev at gmail.com (Garrison Venn) Date: Tue, 09 Feb 2010 23:22:44 -0000 Subject: [llvm-commits] [llvm] r95723 - in /llvm/trunk/examples: CMakeLists.txt ExceptionDemo/ ExceptionDemo/CMakeLists.txt ExceptionDemo/ExceptionDemo.cpp ExceptionDemo/Makefile Makefile Message-ID: <201002092322.o19NMiQ3005105@zion.cs.uiuc.edu> Author: gvenn Date: Tue Feb 9 17:22:43 2010 New Revision: 95723 URL: http://llvm.org/viewvc/llvm-project?rev=95723&view=rev Log: Adds a JIT based exception handling example to the examples directory. Both zero cost example domain specific, and C++ foreign exception handling are shown. The example's documentation fully explains how to run the example. Notes: 1) The code uses an extremely simple type info model. 2) Only a single landing pad is used per unwind edge (one call to llvm.eh.selector) 3) llvm.eh.selector support for filter arguments is not given. 4) llvm.eh.typeid.for is not used. 5) Forced unwind behavior is not supported. 6) Very little if any error handling is given. 7) __attribute__((__aligned__)) is used. 8) The code uses parts from the llvm compiler-rt project and the llvm Kaleidoscope example. 9) The code has not been ported or tested on WINDOWS. 10) The code was not tested with a cmake build. 11) The code was tested for a debug build on 32bit X86 CentOS LINUX, and both a debug and release build on OS X 10.6.2 (64bit). Added: llvm/trunk/examples/ExceptionDemo/ llvm/trunk/examples/ExceptionDemo/CMakeLists.txt llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp llvm/trunk/examples/ExceptionDemo/Makefile Modified: llvm/trunk/examples/CMakeLists.txt llvm/trunk/examples/Makefile Modified: llvm/trunk/examples/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=95723&r1=95722&r2=95723&view=diff ============================================================================== --- llvm/trunk/examples/CMakeLists.txt (original) +++ llvm/trunk/examples/CMakeLists.txt Tue Feb 9 17:22:43 2010 @@ -3,6 +3,7 @@ add_subdirectory(HowToUseJIT) add_subdirectory(Kaleidoscope) add_subdirectory(ModuleMaker) +add_subdirectory(ExceptionDemo) include(CheckIncludeFile) check_include_file(pthread.h HAVE_PTHREAD_H) Added: llvm/trunk/examples/ExceptionDemo/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/CMakeLists.txt?rev=95723&view=auto ============================================================================== --- llvm/trunk/examples/ExceptionDemo/CMakeLists.txt (added) +++ llvm/trunk/examples/ExceptionDemo/CMakeLists.txt Tue Feb 9 17:22:43 2010 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS jit nativecodegen) + +add_llvm_example(ExceptionDemo + ExceptionDemo.cpp + ) Added: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=95723&view=auto ============================================================================== --- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (added) +++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Feb 9 17:22:43 2010 @@ -0,0 +1,2028 @@ +//===-- examples/ExceptionDemo/ExceptionDemo.cpp - +// An example use of the llvm Exception mechanism --===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--------------------------------------------------------------------===// +// +// Demo program which implements an example LLVM exception implementation, and +// shows several test cases including the handling of foreign exceptions. +// It is run with type info types arguments to throw. A test will +// be run for each given type info type. While type info types with the value +// of -1 will trigger a foreign C++ exception to be thrown; type info types +// <= 6 and >= 1 will cause the associated generated exceptions to be thrown +// and caught by generated test functions; and type info types > 6 +// will result in exceptions which pass through to the test harness. All other +// type info types are not supported and could cause a crash. In all cases, +// the "finally" blocks of every generated test functions will executed +// regardless of whether or not that test function ignores or catches the +// thrown exception. +// +// examples: +// +// ExceptionDemo +// +// causes a usage to be printed to stderr +// +// ExceptionDemo 2 3 7 -1 +// +// results in the following cases: +// - Value 2 causes an exception with a type info type of 2 to be +// thrown and caught by an inner generated test function. +// - Value 3 causes an exception with a type info type of 3 to be +// thrown and caught by an outer generated test function. +// - Value 7 causes an exception with a type info type of 7 to be +// thrown and NOT be caught by any generated function. +// - Value -1 causes a foreign C++ exception to be thrown and not be +// caught by any generated function +// +// Cases -1 and 7 are caught by a C++ test harness where the validity of +// of a C++ catch(...) clause catching a generated exception with a +// type info type of 7 is questionable. +// +// This code uses code from the llvm compiler-rt project and the llvm +// Kaleidoscope project. +// +//===--------------------------------------------------------------------===// + + +#include "llvm/LLVMContext.h" +#include "llvm/DerivedTypes.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/Module.h" +#include "llvm/PassManager.h" +#include "llvm/Intrinsics.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetSelect.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Support/IRBuilder.h" +#include "llvm/Support/Dwarf.h" + +#include +#include +#include +#include +#include +#include + + +#ifndef USE_GLOBAL_STR_CONSTS +#define USE_GLOBAL_STR_CONSTS true +#endif + +// System C++ ABI unwind types from: +// http://refspecs.freestandards.org/abi-eh-1.21.html + +extern "C" { + +typedef enum { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + +typedef enum { + _UA_SEARCH_PHASE = 1, + _UA_CLEANUP_PHASE = 2, + _UA_HANDLER_FRAME = 4, + _UA_FORCE_UNWIND = 8, + _UA_END_OF_STACK = 16 +} _Unwind_Action; + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception { + uint64_t exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + + uintptr_t private_1; + uintptr_t private_2; + + // @@@ The IA-64 ABI says that this structure must be double-word aligned. + // Taking that literally does not make much sense generically. Instead + // we provide the maximum alignment required by any type for the machine. +} __attribute__((__aligned__)); + +struct _Unwind_Context; +typedef struct _Unwind_Context* _Unwind_Context_t; + +extern const uint8_t* _Unwind_GetLanguageSpecificData (_Unwind_Context_t c); +extern uintptr_t _Unwind_GetGR (_Unwind_Context_t c, int i); +extern void _Unwind_SetGR (_Unwind_Context_t c, int i, uintptr_t n); +extern void _Unwind_SetIP (_Unwind_Context_t, uintptr_t new_value); +extern uintptr_t _Unwind_GetIP (_Unwind_Context_t context); +extern uintptr_t _Unwind_GetRegionStart (_Unwind_Context_t context); + +} // extern "C" + +// +// Example types +// + +/// This is our simplistic type info +struct OurExceptionType_t { + /// type info type + int type; +}; + + +/// This is our Exception class which relies on a negative offset to calculate +/// pointers to its instances from pointers to its unwindException member. +/// +/// Note: The above unwind.h defines struct _Unwind_Exception to be aligned +/// on a double word boundary. This is necessary to match the standard: +/// http://refspecs.freestandards.org/abi-eh-1.21.html +struct OurBaseException_t { + struct OurExceptionType_t type; + + // Note: This is properly aligned in unwind.h + struct _Unwind_Exception unwindException; +}; + + +// Note: Not needed since we are C++ +typedef struct OurBaseException_t OurException; +typedef struct _Unwind_Exception OurUnwindException; + +// +// Various globals used to support typeinfo and generatted exceptions in +// general +// + +static std::map namedValues; + +int64_t ourBaseFromUnwindOffset; + +const unsigned char ourBaseExcpClassChars[] = + {'o', 'b', 'j', '\0', 'b', 'a', 's', '\0'}; + + +static uint64_t ourBaseExceptionClass = 0; + +static std::vector ourTypeInfoNames; +static std::map ourTypeInfoNamesIndex; + +static llvm::StructType* ourTypeInfoType; +static llvm::StructType* ourExceptionType; +static llvm::StructType* ourUnwindExceptionType; + +static llvm::ConstantInt* ourExceptionNotThrownState; +static llvm::ConstantInt* ourExceptionThrownState; +static llvm::ConstantInt* ourExceptionCaughtState; + +typedef std::vector ArgNames; +typedef std::vector ArgTypes; + +// +// Code Generation Utilities +// + +/// Utility used to create a function, both declarations and definitions +/// @param module for module instance +/// @param retType function return type +/// @param theArgTypes function's ordered argument types +/// @param theArgNames function's ordered arguments needed if use of this +/// function corresponds to a function definition. Use empty +/// aggregate for function declarations. +/// @param functName function name +/// @param linkage function linkage +/// @param declarationOnly for function declarations +/// @param isVarArg function uses vararg arguments +/// @returns function instance +llvm::Function *createFunction(llvm::Module& module, + const llvm::Type* retType, + const ArgTypes& theArgTypes, + const ArgNames& theArgNames, + const std::string& functName, + llvm::GlobalValue::LinkageTypes linkage, + bool declarationOnly, + bool isVarArg) { + llvm::FunctionType* functType = llvm::FunctionType::get(retType, + theArgTypes, + isVarArg); + llvm::Function* ret = llvm::Function::Create(functType, + linkage, + functName, + &module); + if (!ret || declarationOnly) + return(ret); + + namedValues.clear(); + unsigned i = 0; + for (llvm::Function::arg_iterator argIndex = ret->arg_begin(); + i != theArgNames.size(); + ++argIndex, ++i) { + + argIndex->setName(theArgNames[i]); + namedValues[theArgNames[i]] = argIndex; + } + + return(ret); +} + + +/// Create an alloca instruction in the entry block of +/// the parent function. This is used for mutable variables etc. +/// @param function parent instance +/// @param varName stack variable name +/// @param type stack variable type +/// @param initWith optional constant initialization value +/// @returns AllocaInst instance +static llvm::AllocaInst *createEntryBlockAlloca(llvm::Function& function, + const std::string &varName, + const llvm::Type* type, + llvm::Constant* initWith = NULL) { + llvm::BasicBlock& block = function.getEntryBlock(); + llvm::IRBuilder<> tmp(&block, block.begin()); + llvm::AllocaInst* ret = tmp.CreateAlloca(type, 0, varName.c_str()); + + if (initWith) + tmp.CreateStore(initWith, ret); + + return(ret); +} + + +// +// Code Generation Utilities End +// + +// +// Runtime C Library functions +// + +// Note: using an extern "C" block so that static functions can be used +extern "C" { + +// Note: Better ways to decide on bit width +// +/// Prints a 32 bit number, according to the format, to stderr. +/// @param intToPrint integer to print +/// @param format printf like format to use when printing +void print32Int(int intToPrint, const char* format) { + if (format) { + // Note: No NULL check + fprintf(stderr, format, intToPrint); + } + else { + // Note: No NULL check + fprintf(stderr, "::print32Int(...):NULL arg.\n"); + } +} + + +// Note: Better ways to decide on bit width +// +/// Prints a 64 bit number, according to the format, to stderr. +/// @param intToPrint integer to print +/// @param format printf like format to use when printing +void print64Int(long int intToPrint, const char* format) { + if (format) { + // Note: No NULL check + fprintf(stderr, format, intToPrint); + } + else { + // Note: No NULL check + fprintf(stderr, "::print64Int(...):NULL arg.\n"); + } +} + + +/// Prints a C string to stderr +/// @param toPrint string to print +void printStr(char* toPrint) { + if (toPrint) { + fprintf(stderr, "%s", toPrint); + } + else { + fprintf(stderr, "::printStr(...):NULL arg.\n"); + } +} + + +/// Deletes the true previosly allocated exception whose address +/// is calculated from the supplied OurBaseException_t::unwindException +/// member address. Handles (ignores), NULL pointers. +/// @param expToDelete exception to delete +void deleteOurException(OurUnwindException* expToDelete) { +#ifdef DEBUG + fprintf(stderr, + "deleteOurException(...).\n"); +#endif + + if (expToDelete && + (expToDelete->exception_class == ourBaseExceptionClass)) { + + free(((char*) expToDelete) + ourBaseFromUnwindOffset); + } +} + + +/// This function is the struct _Unwind_Exception API mandated delete function +/// used by foreign exception handlers when deleting our exception +/// (OurException), instances. +/// @param reason @link http://refspecs.freestandards.org/abi-eh-1.21.html +/// @unlink +/// @param expToDelete exception instance to delete +void deleteFromUnwindOurException(_Unwind_Reason_Code reason, + OurUnwindException* expToDelete) { +#ifdef DEBUG + fprintf(stderr, + "deleteFromUnwindOurException(...).\n"); +#endif + + deleteOurException(expToDelete); +} + + +/// Creates (allocates on the heap), an exception (OurException instance), +/// of the supplied type info type. +/// @param type type info type +OurUnwindException* createOurException(int type) { + size_t size = sizeof(OurException); + OurException* ret = (OurException*) memset(malloc(size), 0, size); + (ret->type).type = type; + (ret->unwindException).exception_class = ourBaseExceptionClass; + (ret->unwindException).exception_cleanup = deleteFromUnwindOurException; + + return(&(ret->unwindException)); +} + + +/// Read a uleb128 encoded value and advance pointer +/// See Variable Length Data in: +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink +/// @param data reference variable holding memory pointer to decode from +/// @returns decoded value +static uintptr_t readULEB128(const uint8_t** data) { + uintptr_t result = 0; + uintptr_t shift = 0; + unsigned char byte; + const uint8_t* p = *data; + + do { + byte = *p++; + result |= (byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + *data = p; + + return result; +} + + +/// Read a sleb128 encoded value and advance pointer +/// See Variable Length Data in: +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink +/// @param data reference variable holding memory pointer to decode from +/// @returns decoded value +static uintptr_t readSLEB128(const uint8_t** data) { + uintptr_t result = 0; + uintptr_t shift = 0; + unsigned char byte; + const uint8_t* p = *data; + + do { + byte = *p++; + result |= (byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + *data = p; + + if ((byte & 0x40) && (shift < (sizeof(result) << 3))) { + result |= (~0 << shift); + } + + return result; +} + + +/// Read a pointer encoded value and advance pointer +/// See Variable Length Data in: +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink +/// @param data reference variable holding memory pointer to decode from +/// @param encoding dwarf encoding type +/// @returns decoded value +static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { + uintptr_t result = 0; + const uint8_t* p = *data; + + if (encoding == llvm::dwarf::DW_EH_PE_omit) + return(result); + + // first get value + switch (encoding & 0x0F) { + case llvm::dwarf::DW_EH_PE_absptr: + result = *((uintptr_t*)p); + p += sizeof(uintptr_t); + break; + case llvm::dwarf::DW_EH_PE_uleb128: + result = readULEB128(&p); + break; + // Note: This case has not been tested + case llvm::dwarf::DW_EH_PE_sleb128: + result = readSLEB128(&p); + break; + case llvm::dwarf::DW_EH_PE_udata2: + result = *((uint16_t*)p); + p += sizeof(uint16_t); + break; + case llvm::dwarf::DW_EH_PE_udata4: + result = *((uint32_t*)p); + p += sizeof(uint32_t); + break; + case llvm::dwarf::DW_EH_PE_udata8: + result = *((uint64_t*)p); + p += sizeof(uint64_t); + break; + case llvm::dwarf::DW_EH_PE_sdata2: + result = *((int16_t*)p); + p += sizeof(int16_t); + break; + case llvm::dwarf::DW_EH_PE_sdata4: + result = *((int32_t*)p); + p += sizeof(int32_t); + break; + case llvm::dwarf::DW_EH_PE_sdata8: + result = *((int64_t*)p); + p += sizeof(int64_t); + break; + default: + // not supported + abort(); + break; + } + + // then add relative offset + switch (encoding & 0x70) { + case llvm::dwarf::DW_EH_PE_absptr: + // do nothing + break; + case llvm::dwarf::DW_EH_PE_pcrel: + result += (uintptr_t)(*data); + break; + case llvm::dwarf::DW_EH_PE_textrel: + case llvm::dwarf::DW_EH_PE_datarel: + case llvm::dwarf::DW_EH_PE_funcrel: + case llvm::dwarf::DW_EH_PE_aligned: + default: + // not supported + abort(); + break; + } + + // then apply indirection + if (encoding & llvm::dwarf::DW_EH_PE_indirect) { + result = *((uintptr_t*)result); + } + + *data = p; + + return result; +} + + +/// Deals with Dwarf actions matching our type infos +/// (OurExceptionType_t instances). Returns whether or not a dwarf emitted +/// action matches the supplied exception type. If such a match succeeds, +/// the resultAction argument will be set with > 0 index value. Only +/// corresponding llvm.eh.selector type info arguments, cleanup arguments +/// are supported. Filters are not supported. +/// See Variable Length Data in: +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink +/// Also see @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink +/// @param resultAction reference variable which will be set with result +/// @param classInfo our array of type info pointers (to globals) +/// @param actionEntry index into above type info array or 0 (clean up). +/// We do not support filters. +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) +/// of thrown exception. +/// @param exceptionObject thrown _Unwind_Exception instance. +/// @returns whether or not a type info was found. False is returned if only +/// a cleanup was found +static bool handleActionValue(int64_t *resultAction, + struct OurExceptionType_t **classInfo, + uintptr_t actionEntry, + uint64_t exceptionClass, + struct _Unwind_Exception *exceptionObject) { + bool ret = false; + + if (!resultAction || + !exceptionObject || + (exceptionClass != ourBaseExceptionClass)) + return(ret); + + struct OurBaseException_t* excp = (struct OurBaseException_t*) + (((char*) exceptionObject) + ourBaseFromUnwindOffset); + struct OurExceptionType_t *excpType = &(excp->type); + int type = excpType->type; + +#ifdef DEBUG + fprintf(stderr, + "handleActionValue(...): exceptionObject = <%p>, " + "excp = <%p>.\n", + exceptionObject, + excp); +#endif + + const uint8_t *actionPos = (uint8_t*) actionEntry, + *tempActionPos; + int64_t typeOffset = 0, + actionOffset; + + for (int i = 0; true; ++i) { + // Each emitted dwarf action corresponds to a 2 tuple of + // type info address offset, and action offset to the next + // emitted action. + typeOffset = readSLEB128(&actionPos); + tempActionPos = actionPos; + actionOffset = readSLEB128(&tempActionPos); + +#ifdef DEBUG + fprintf(stderr, + "handleActionValue(...):typeOffset: <%lld>, " + "actionOffset: <%lld>.\n", + typeOffset, + actionOffset); +#endif + assert((typeOffset >= 0) && + "handleActionValue(...):filters are not supported."); + + // Note: A typeOffset == 0 implies that a cleanup llvm.eh.selector + // argument has been matched. + if ((typeOffset > 0) && + (type == (classInfo[-typeOffset])->type)) { +#ifdef DEBUG + fprintf(stderr, + "handleActionValue(...):actionValue <%d> found.\n", + i); +#endif + *resultAction = i + 1; + ret = true; + break; + } + +#ifdef DEBUG + fprintf(stderr, + "handleActionValue(...):actionValue not found.\n"); +#endif + if (!actionOffset) + break; + + actionPos += actionOffset; + } + + return(ret); +} + + +/// Deals with the Language specific data portion of the emitted dwarf code. +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink +/// @param version unsupported (ignored), unwind version +/// @param lsda language specific data area +/// @param _Unwind_Action actions minimally supported unwind stage +/// (forced specifically not supported) +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) +/// of thrown exception. +/// @param exceptionObject thrown _Unwind_Exception instance. +/// @param context unwind system context +/// @returns minimally supported unwinding control indicator +static _Unwind_Reason_Code handleLsda(int version, + const uint8_t* lsda, + _Unwind_Action actions, + uint64_t exceptionClass, + struct _Unwind_Exception* exceptionObject, + _Unwind_Context_t context) { + _Unwind_Reason_Code ret = _URC_CONTINUE_UNWIND; + + if (!lsda) + return(ret); + +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...):lsda is non-zero.\n"); +#endif + + // Get the current instruction pointer and offset it before next + // instruction in the current frame which threw the exception. + uintptr_t pc = _Unwind_GetIP(context)-1; + + // Get beginning current frame's code (as defined by the + // emitted dwarf code) + uintptr_t funcStart = _Unwind_GetRegionStart(context); + uintptr_t pcOffset = pc - funcStart; + struct OurExceptionType_t** classInfo = NULL; + + // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding + // dwarf emission + + // Parse LSDA header. + uint8_t lpStartEncoding = *lsda++; + + if (lpStartEncoding != llvm::dwarf::DW_EH_PE_omit) { + readEncodedPointer(&lsda, lpStartEncoding); + } + + uint8_t ttypeEncoding = *lsda++; + uintptr_t classInfoOffset; + + if (ttypeEncoding != llvm::dwarf::DW_EH_PE_omit) { + // Calculate type info locations in emitted dwarf code which + // were flagged by type info arguments to llvm.eh.selector + // intrinsic + classInfoOffset = readULEB128(&lsda); + classInfo = (struct OurExceptionType_t**) (lsda + classInfoOffset); + } + + // Walk call-site table looking for range that + // includes current PC. + + uint8_t callSiteEncoding = *lsda++; + uint32_t callSiteTableLength = readULEB128(&lsda); + const uint8_t* callSiteTableStart = lsda; + const uint8_t* callSiteTableEnd = callSiteTableStart + + callSiteTableLength; + const uint8_t* actionTableStart = callSiteTableEnd; + const uint8_t* callSitePtr = callSiteTableStart; + + bool foreignException = false; + + while (callSitePtr < callSiteTableEnd) { + uintptr_t start = readEncodedPointer(&callSitePtr, + callSiteEncoding); + uintptr_t length = readEncodedPointer(&callSitePtr, + callSiteEncoding); + uintptr_t landingPad = readEncodedPointer(&callSitePtr, + callSiteEncoding); + + // Note: Action value + uintptr_t actionEntry = readULEB128(&callSitePtr); + + if (exceptionClass != ourBaseExceptionClass) { + // We have been notified of a foreign exception being thrown, + // and we therefore need to execute cleanup landing pads + actionEntry = 0; + foreignException = true; + } + + if (landingPad == 0) { +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...): No landing pad found.\n"); +#endif + + continue; // no landing pad for this entry + } + + if (actionEntry) { + actionEntry += ((uintptr_t) actionTableStart) - 1; + } + else { +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...):No action table found.\n"); +#endif + } + + bool exceptionMatched = false; + + if ((start <= pcOffset) && (pcOffset < (start + length))) { +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...): Landing pad found.\n"); +#endif + int64_t actionValue = 0; + + if (actionEntry) { + exceptionMatched = handleActionValue + ( + &actionValue, + classInfo, + actionEntry, + exceptionClass, + exceptionObject + ); + } + + if (!(actions & _UA_SEARCH_PHASE)) { +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...): installed landing pad " + "context.\n"); +#endif + + // Found landing pad for the PC. + // Set Instruction Pointer to so we re-enter function + // at landing pad. The landing pad is created by the + // compiler to take two parameters in registers. + _Unwind_SetGR(context, + __builtin_eh_return_data_regno(0), + (uintptr_t)exceptionObject); + + // Note: this virtual register directly corresponds + // to the return of the llvm.eh.selector intrinsic + if (!actionEntry || !exceptionMatched) { + // We indicate cleanup only + _Unwind_SetGR(context, + __builtin_eh_return_data_regno(1), + 0); + } + else { + // Matched type info index of llvm.eh.selector intrinsic + // passed here. + _Unwind_SetGR(context, + __builtin_eh_return_data_regno(1), + actionValue); + } + + // To execute landing pad set here + _Unwind_SetIP(context, funcStart + landingPad); + ret = _URC_INSTALL_CONTEXT; + } + else if (exceptionMatched) { +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...): setting handler found.\n"); +#endif + ret = _URC_HANDLER_FOUND; + } + else { + // Note: Only non-clean up handlers are marked as + // found. Otherwise the clean up handlers will be + // re-found and executed during the clean up + // phase. +#ifdef DEBUG + fprintf(stderr, + "handleLsda(...): cleanup handler found.\n"); +#endif + } + + break; + } + } + + return(ret); +} + + +/// This is the personality function which is embedded (dwarf emitted), in the +/// dwarf unwind info block. Again see: JITDwarfEmitter.cpp. +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink +/// @param version unsupported (ignored), unwind version +/// @param _Unwind_Action actions minimally supported unwind stage +/// (forced specifically not supported) +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) +/// of thrown exception. +/// @param exceptionObject thrown _Unwind_Exception instance. +/// @param context unwind system context +/// @returns minimally supported unwinding control indicator +_Unwind_Reason_Code ourPersonality(int version, + _Unwind_Action actions, + uint64_t exceptionClass, + struct _Unwind_Exception* exceptionObject, + _Unwind_Context_t context) { +#ifdef DEBUG + fprintf(stderr, + "We are in ourPersonality(...):actions is <%d>.\n", + actions); + + if (actions & _UA_SEARCH_PHASE) { + fprintf(stderr, "ourPersonality(...):In search phase.\n"); + } + else { + fprintf(stderr, "ourPersonality(...):In non-search phase.\n"); + } +#endif + + const uint8_t* lsda = (uint8_t*) + _Unwind_GetLanguageSpecificData(context); + +#ifdef DEBUG + fprintf(stderr, + "ourPersonality(...):lsda = <%p>.\n", + lsda); +#endif + + // The real work of the personality function is captured here + return(handleLsda(version, + lsda, + actions, + exceptionClass, + exceptionObject, + context)); +} + + +/// Generates our _Unwind_Exception class from a given character array. +/// thereby handling arbitrary lengths (not in standard), and handling +/// embedded \0s. +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink +/// @param classChars char array to encode. NULL values not checkedf +/// @param classCharsSize number of chars in classChars. Value is not checked. +/// @returns class value +uint64_t genClass(const unsigned char classChars[], size_t classCharsSize) +{ + uint64_t ret = classChars[0]; + + for (unsigned i = 1; i < classCharsSize; ++i) { + ret <<= 8; + ret += classChars[i]; + } + + return(ret); +} + +} // extern "C" + +// +// Runtime C Library functions End +// + +// +// Code generation functions +// + +/// Generates code to print given constant string +/// @param context llvm context +/// @param module code for module instance +/// @param builder builder instance +/// @param toPrint string to print +/// @param useGlobal A value of true (default) indicates a GlobalValue is +/// generated, and is used to hold the constant string. A value of +/// false indicates that the constant string will be stored on the +/// stack. +void generateStringPrint(llvm::LLVMContext& context, + llvm::Module& module, + llvm::IRBuilder<>& builder, + std::string toPrint, + bool useGlobal = true) { + llvm::Function *printFunct = module.getFunction("printStr"); + + llvm::Value *stringVar; + llvm::Constant* stringConstant = + llvm::ConstantArray::get(context, toPrint); + + if (useGlobal) { + // Note: Does not work without allocation + stringVar = + new llvm::GlobalVariable(module, + stringConstant->getType(), + true, + llvm::GlobalValue::LinkerPrivateLinkage, + stringConstant, + ""); + } + else { + stringVar = builder.CreateAlloca(stringConstant->getType()); + builder.CreateStore(stringConstant, stringVar); + } + + llvm::Value* cast = + builder.CreatePointerCast(stringVar, + builder.getInt8Ty()->getPointerTo()); + builder.CreateCall(printFunct, cast); +} + + +/// Generates code to print given runtime integer according to constant +/// string format, and a given print function. +/// @param context llvm context +/// @param module code for module instance +/// @param builder builder instance +/// @param printFunct function used to "print" integer +/// @param toPrint string to print +/// @param format printf like formating string for print +/// @param useGlobal A value of true (default) indicates a GlobalValue is +/// generated, and is used to hold the constant string. A value of +/// false indicates that the constant string will be stored on the +/// stack. +void generateIntegerPrint(llvm::LLVMContext& context, + llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::Function& printFunct, + llvm::Value& toPrint, + std::string format, + bool useGlobal = true) { + llvm::Constant *stringConstant = llvm::ConstantArray::get(context, format); + llvm::Value *stringVar; + + if (useGlobal) { + // Note: Does not seem to work without allocation + stringVar = + new llvm::GlobalVariable(module, + stringConstant->getType(), + true, + llvm::GlobalValue::LinkerPrivateLinkage, + stringConstant, + ""); + } + else { + stringVar = builder.CreateAlloca(stringConstant->getType()); + builder.CreateStore(stringConstant, stringVar); + } + + llvm::Value* cast = + builder.CreateBitCast(stringVar, + builder.getInt8Ty()->getPointerTo()); + builder.CreateCall2(&printFunct, &toPrint, cast); +} + + +/// Generates code to handle finally block type semantics: always runs +/// regardless of whether a thrown exception is passing through or the +/// parent function is simply exiting. In addition to printing some state +/// to stderr, this code will resume the exception handling--runs the +/// unwind resume block, if the exception has not been previously caught +/// by a catch clause, and will otherwise execute the end block (terminator +/// block). In addition this function creates the corresponding function's +/// stack storage for the exception pointer and catch flag status. +/// @param context llvm context +/// @param module code for module instance +/// @param builder builder instance +/// @param toAddTo parent function to add block to +/// @param blockName block name of new "finally" block. +/// @param functionId output id used for printing +/// @param terminatorBlock terminator "end" block +/// @param unwindResumeBlock unwind resume block +/// @param exceptionCaughtFlag reference exception caught/thrown status storage +/// @param exceptionStorage reference to exception pointer storage +/// @returns newly created block +static llvm::BasicBlock* createFinallyBlock(llvm::LLVMContext& context, + llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::Function& toAddTo, + std::string& blockName, + std::string& functionId, + llvm::BasicBlock& terminatorBlock, + llvm::BasicBlock& unwindResumeBlock, + llvm::Value** exceptionCaughtFlag, + llvm::Value** exceptionStorage) { + assert(exceptionCaughtFlag && + "ExceptionDemo::createFinallyBlock(...):exceptionCaughtFlag " + "is NULL"); + assert(exceptionStorage && + "ExceptionDemo::createFinallyBlock(...):exceptionStorage " + "is NULL"); + + *exceptionCaughtFlag = + createEntryBlockAlloca(toAddTo, + "exceptionCaught", + ourExceptionNotThrownState->getType(), + ourExceptionNotThrownState); + + const llvm::PointerType* exceptionStorageType = + builder.getInt8Ty()->getPointerTo(); + *exceptionStorage = + createEntryBlockAlloca(toAddTo, + "exceptionStorage", + exceptionStorageType, + llvm::ConstantPointerNull::get( + exceptionStorageType)); + + llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, + blockName, + &toAddTo); + + builder.SetInsertPoint(ret); + + std::ostringstream bufferToPrint; + bufferToPrint << "Gen: Executing finally block " + << blockName + << " in " + << functionId + << std::endl; + generateStringPrint(context, + module, + builder, + bufferToPrint.str(), + USE_GLOBAL_STR_CONSTS); + + llvm::SwitchInst* theSwitch = + builder.CreateSwitch(builder.CreateLoad(*exceptionCaughtFlag), + &terminatorBlock, + 2); + theSwitch->addCase(ourExceptionCaughtState, &terminatorBlock); + theSwitch->addCase(ourExceptionThrownState, &unwindResumeBlock); + + return(ret); +} + + +/// Generates catch block semantics which print a string to indicate type of +/// catch executed, sets an exception caught flag, and executes passed in +/// end block (terminator block). +/// @param context llvm context +/// @param module code for module instance +/// @param builder builder instance +/// @param toAddTo parent function to add block to +/// @param blockName block name of new "catch" block. +/// @param functionId output id used for printing +/// @param terminatorBlock terminator "end" block +/// @param exceptionCaughtFlag exception caught/thrown status +/// @returns newly created block +static llvm::BasicBlock* createCatchBlock(llvm::LLVMContext& context, + llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::Function& toAddTo, + std::string& blockName, + std::string& functionId, + llvm::BasicBlock& terminatorBlock, + llvm::Value& exceptionCaughtFlag) { + + llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, + blockName, + &toAddTo); + + builder.SetInsertPoint(ret); + + std::ostringstream bufferToPrint; + bufferToPrint << "Gen: Executing catch block " + << blockName + << " in " + << functionId + << std::endl; + generateStringPrint(context, + module, + builder, + bufferToPrint.str(), + USE_GLOBAL_STR_CONSTS); + builder.CreateStore(ourExceptionCaughtState, &exceptionCaughtFlag); + builder.CreateBr(&terminatorBlock); + + return(ret); +} + + +/// Generates a function which invokes a function (toInvoke) and, whose +/// unwind block will "catch" the type info types correspondingly held in the +/// exceptionTypesToCatch argument. If the toInvoke function throws an +/// exception which does not match any type info types contained in +/// exceptionTypesToCatch, the generated code will call _Unwind_Resume +/// with the raised exception. On the other hand the generated code will +/// normally exit if the toInvoke function does not throw an exception. +/// The generated "finally" block is always run regardless of the cause of +/// the generated function exit. +/// The generated function is returned after being verified. +/// @param module code for module instance +/// @param builder builder instance +/// @param fpm a function pass manager holding optional IR to IR +/// transformations +/// @param toInvoke inner function to invoke +/// @param ourId id used to printing purposes +/// @param numExceptionsToCatch length of exceptionTypesToCatch array +/// @param exceptionTypesToCatch array of type info types to "catch" +/// @returns generated function +static +llvm::Function* createCatchWrappedInvokeFunction(llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::FunctionPassManager& fpm, + llvm::Function& toInvoke, + std::string ourId, + unsigned numExceptionsToCatch, + unsigned exceptionTypesToCatch[]) { + + llvm::LLVMContext& context = module.getContext(); + llvm::Function *toPrint32Int = module.getFunction("print32Int"); + + ArgTypes argTypes; + argTypes.push_back(builder.getInt32Ty()); + + ArgNames argNames; + argNames.push_back("exceptTypeToThrow"); + + llvm::Function* ret = createFunction(module, + builder.getVoidTy(), + argTypes, + argNames, + ourId, + llvm::Function::ExternalLinkage, + false, + false); + + // Block which calls invoke + llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, + "entry", + ret); + // Normal block for invoke + llvm::BasicBlock *normalBlock = llvm::BasicBlock::Create(context, + "normal", + ret); + // Unwind block for invoke + llvm::BasicBlock *exceptionBlock = + llvm::BasicBlock::Create(context, "exception", ret); + + // Block which routes exception to correct catch handler block + llvm::BasicBlock *exceptionRouteBlock = + llvm::BasicBlock::Create(context, "exceptionRoute", ret); + + // Foreign exception handler + llvm::BasicBlock *externalExceptionBlock = + llvm::BasicBlock::Create(context, "externalException", ret); + + // Block which calls _Unwind_Resume + llvm::BasicBlock *unwindResumeBlock = + llvm::BasicBlock::Create(context, "unwindResume", ret); + + // Clean up block which delete exception if needed + llvm::BasicBlock *endBlock = + llvm::BasicBlock::Create(context, "end", ret); + + std::string nextName; + std::vector catchBlocks(numExceptionsToCatch); + llvm::Value* exceptionCaughtFlag = NULL; + llvm::Value* exceptionStorage = NULL; + + // Finally block which will branch to unwindResumeBlock if + // exception is not caught. Initializes/allocates stack locations. + llvm::BasicBlock* finallyBlock = createFinallyBlock(context, + module, + builder, + *ret, + nextName = "finally", + ourId, + *endBlock, + *unwindResumeBlock, + &exceptionCaughtFlag, + &exceptionStorage); + + for (unsigned i = 0; i < numExceptionsToCatch; ++i) { + nextName = ourTypeInfoNames[exceptionTypesToCatch[i]]; + + // One catch block per type info to be caught + catchBlocks[i] = createCatchBlock(context, + module, + builder, + *ret, + nextName, + ourId, + *finallyBlock, + *exceptionCaughtFlag); + } + + // Entry Block + + builder.SetInsertPoint(entryBlock); + + std::vector args; + args.push_back(namedValues["exceptTypeToThrow"]); + builder.CreateInvoke(&toInvoke, + normalBlock, + exceptionBlock, + args.begin(), + args.end()); + + // End Block + + builder.SetInsertPoint(endBlock); + + generateStringPrint(context, + module, + builder, + "Gen: In end block: exiting in " + ourId + ".\n", + USE_GLOBAL_STR_CONSTS); + llvm::Function *deleteOurException = + module.getFunction("deleteOurException"); + + // Note: function handles NULL exceptions + builder.CreateCall(deleteOurException, + builder.CreateLoad(exceptionStorage)); + builder.CreateRetVoid(); + + // Normal Block + + builder.SetInsertPoint(normalBlock); + + generateStringPrint(context, + module, + builder, + "Gen: No exception in " + ourId + "!\n", + USE_GLOBAL_STR_CONSTS); + + // Finally block is always called + builder.CreateBr(finallyBlock); + + // Unwind Resume Block + + builder.SetInsertPoint(unwindResumeBlock); + + llvm::Function *resumeOurException = + module.getFunction("_Unwind_Resume"); + builder.CreateCall(resumeOurException, + builder.CreateLoad(exceptionStorage)); + builder.CreateUnreachable(); + + // Exception Block + + builder.SetInsertPoint(exceptionBlock); + + llvm::Function *ehException = module.getFunction("llvm.eh.exception"); + + // Retrieve thrown exception + llvm::Value* unwindException = builder.CreateCall(ehException); + + // Store exception and flag + builder.CreateStore(unwindException, exceptionStorage); + builder.CreateStore(ourExceptionThrownState, exceptionCaughtFlag); + llvm::Function *personality = module.getFunction("ourPersonality"); + llvm::Value* functPtr = + builder.CreatePointerCast(personality, + builder.getInt8Ty()->getPointerTo()); + + args.clear(); + args.push_back(unwindException); + args.push_back(functPtr); + + // Note: Skipping index 0 + for (unsigned i = 0; i < numExceptionsToCatch; ++i) { + // Set up type infos to be caught + args.push_back( + module.getGlobalVariable( + ourTypeInfoNames[exceptionTypesToCatch[i]])); + } + + args.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), 0)); + + llvm::Function *ehSelector = module.getFunction("llvm.eh.selector"); + + // Set up this exeption block as the landing pad which will handle + // given type infos. See case Intrinsic::eh_selector in + // SelectionDAGBuilder::visitIntrinsicCall(...) and AddCatchInfo(...) + // implemented in FunctionLoweringInfo.cpp to see how the implementation + // handles this call. This landing pad (this exception block), will be + // called either because it nees to cleanup (call finally) or a type + // info was found which matched the thrown exception. + llvm::Value* retTypeInfoIndex = builder.CreateCall(ehSelector, + args.begin(), + args.end()); + + // Retrieve exception_class member from thrown exception + // (_Unwind_Exception instance). This member tells us whether or not + // the exception is foreign. + llvm::Value* unwindExceptionClass = + builder.CreateLoad( + builder.CreateStructGEP( + builder.CreatePointerCast( + unwindException, + ourUnwindExceptionType->getPointerTo()), + 0)); + + // Branch to the externalExceptionBlock if the exception is foreign or + // to a catch router if not. Either way the finally block will be run. + builder.CreateCondBr( + builder.CreateICmpEQ(unwindExceptionClass, + llvm::ConstantInt::get(builder.getInt64Ty(), + ourBaseExceptionClass)), + exceptionRouteBlock, + externalExceptionBlock); + + // External Exception Block + + builder.SetInsertPoint(externalExceptionBlock); + + generateStringPrint(context, + module, + builder, + "Gen: Foreign exception received.\n", + USE_GLOBAL_STR_CONSTS); + + // Branch to the finally block + builder.CreateBr(finallyBlock); + + // Exception Route Block + + builder.SetInsertPoint(exceptionRouteBlock); + + // Casts exception pointer (_Unwind_Exception instance) to parent + // (OurException instance). + // + // Note: ourBaseFromUnwindOffset is usually negative + llvm::Value* typeInfoThrown = + builder.CreatePointerCast( + builder.CreateConstGEP1_64(unwindException, + ourBaseFromUnwindOffset), + ourExceptionType->getPointerTo()); + + // Retrieve thrown exception type info type + // + // Note: Index is not relative to pointer but instead to structure + // unlike a true getelementptr (GEP) instruction + typeInfoThrown = builder.CreateStructGEP(typeInfoThrown, 0); + + llvm::Value* typeInfoThrownType = + builder.CreateStructGEP(typeInfoThrown, 0); + + generateIntegerPrint(context, + module, + builder, + *toPrint32Int, + *(builder.CreateLoad(typeInfoThrownType)), + "Gen: Exception type <%d> received (stack unwound) " + " in " + + ourId + + ".\n", + USE_GLOBAL_STR_CONSTS); + + // Route to matched type info catch block or run cleanup finally block + llvm::SwitchInst* switchToCatchBlock = + builder.CreateSwitch(retTypeInfoIndex, + finallyBlock, + numExceptionsToCatch); + + unsigned nextTypeToCatch; + + for (unsigned i = 1; i <= numExceptionsToCatch; ++i) { + nextTypeToCatch = i - 1; + switchToCatchBlock->addCase(llvm::ConstantInt::get( + llvm::Type::getInt32Ty(context), + i), + catchBlocks[nextTypeToCatch]); + } + + llvm::verifyFunction(*ret); + fpm.run(*ret); + + return(ret); +} + + +/// Generates function which throws either an exception matched to a runtime +/// determined type info type (argument to generated function), or if this +/// runtime value matches nativeThrowType, throws a foreign exception by +/// calling nativeThrowFunct. +/// @param module code for module instance +/// @param builder builder instance +/// @param fpm a function pass manager holding optional IR to IR +/// transformations +/// @param ourId id used to printing purposes +/// @param nativeThrowType a runtime argument of this value results in +/// nativeThrowFunct being called to generate/throw exception. +/// @param nativeThrowFunct function which will throw a foreign exception +/// if the above nativeThrowType matches generated function's arg. +/// @returns generated function +static +llvm::Function* createThrowExceptionFunction(llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::FunctionPassManager& fpm, + std::string ourId, + int32_t nativeThrowType, + llvm::Function& nativeThrowFunct) { + llvm::LLVMContext& context = module.getContext(); + namedValues.clear(); + ArgTypes unwindArgTypes; + unwindArgTypes.push_back(builder.getInt32Ty()); + ArgNames unwindArgNames; + unwindArgNames.push_back("exceptTypeToThrow"); + + llvm::Function *ret = createFunction(module, + builder.getVoidTy(), + unwindArgTypes, + unwindArgNames, + ourId, + llvm::Function::ExternalLinkage, + false, + false); + + // Throws either one of our exception or a native C++ exception depending + // on a runtime argument value containing a type info type. + llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, + "entry", + ret); + // Throws a foreign exception + llvm::BasicBlock *nativeThrowBlock = + llvm::BasicBlock::Create(context, + "nativeThrow", + ret); + // Throws one of our Exceptions + llvm::BasicBlock *generatedThrowBlock = + llvm::BasicBlock::Create(context, + "generatedThrow", + ret); + // Retrieved runtime type info type to throw + llvm::Value* exceptionType = namedValues["exceptTypeToThrow"]; + + // nativeThrowBlock block + + builder.SetInsertPoint(nativeThrowBlock); + + // Throws foreign exception + builder.CreateCall(&nativeThrowFunct, exceptionType); + builder.CreateUnreachable(); + + // entry block + + builder.SetInsertPoint(entryBlock); + + llvm::Function *toPrint32Int = module.getFunction("print32Int"); + generateIntegerPrint(context, + module, + builder, + *toPrint32Int, + *exceptionType, + "\nGen: About to throw exception type <%d> in " + + ourId + + ".\n", + USE_GLOBAL_STR_CONSTS); + + // Switches on runtime type info type value to determine whether or not + // a foreign exception is thrown. Defaults to throwing one of our + // generated exceptions. + llvm::SwitchInst* theSwitch = builder.CreateSwitch(exceptionType, + generatedThrowBlock, + 1); + + theSwitch->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), + nativeThrowType), + nativeThrowBlock); + + // generatedThrow block + + builder.SetInsertPoint(generatedThrowBlock); + + llvm::Function *createOurException = + module.getFunction("createOurException"); + llvm::Function *raiseOurException = + module.getFunction("_Unwind_RaiseException"); + + // Creates exception to throw with runtime type info type. + llvm::Value* exception = + builder.CreateCall(createOurException, + namedValues["exceptTypeToThrow"]); + + // Throw generated Exception + builder.CreateCall(raiseOurException, exception); + builder.CreateUnreachable(); + + llvm::verifyFunction(*ret); + fpm.run(*ret); + + return(ret); +} + +static void createStandardUtilityFunctions(unsigned numTypeInfos, + llvm::Module& module, + llvm::IRBuilder<>& builder); + +/// Creates test code by generating and organizing these functions into the +/// test case. The test case consists of an outer function setup to invoke +/// an inner function within an environment having multiple catch and single +/// finally blocks. This inner function is also setup to invoke a throw +/// function within an evironment similar in nature to the outer function's +/// catch and finally blocks. Each of these two functions catch mutually +/// exclusive subsets (even or odd) of the type info types configured +/// for this this. All generated functions have a runtime argument which +/// holds a type info type to throw that each function takes and passes it +/// to the inner one if such a inner function exists. This type info type is +/// looked at by the generated throw function to see whether or not it should +/// throw a generated exception with the same type info type, or instead call +/// a supplied a function which in turn will throw a foreign exception. +/// @param module code for module instance +/// @param builder builder instance +/// @param fpm a function pass manager holding optional IR to IR +/// transformations +/// @param nativeThrowFunctName name of external function which will throw +/// a foreign exception +/// @returns outermost generated test function. +llvm::Function* createUnwindExceptionTest(llvm::Module& module, + llvm::IRBuilder<>& builder, + llvm::FunctionPassManager& fpm, + std::string nativeThrowFunctName) { + // Number of type infos to generate + unsigned numTypeInfos = 6; + + // Initialze intrisics and external functions to use along with exception + // and type info globals. + createStandardUtilityFunctions(numTypeInfos, + module, + builder); + llvm::Function *nativeThrowFunct = + module.getFunction(nativeThrowFunctName); + + // Create exception throw function using the value ~0 to cause + // foreign exceptions to be thrown. + llvm::Function* throwFunct = + createThrowExceptionFunction(module, + builder, + fpm, + "throwFunct", + ~0, + *nativeThrowFunct); + // Inner function will catch even type infos + unsigned innerExceptionTypesToCatch[] = {6, 2, 4}; + size_t numExceptionTypesToCatch = sizeof(innerExceptionTypesToCatch) / + sizeof(unsigned); + + // Generate inner function. + llvm::Function* innerCatchFunct = + createCatchWrappedInvokeFunction(module, + builder, + fpm, + *throwFunct, + "innerCatchFunct", + numExceptionTypesToCatch, + innerExceptionTypesToCatch); + + // Outer function will catch odd type infos + unsigned outerExceptionTypesToCatch[] = {3, 1, 5}; + numExceptionTypesToCatch = sizeof(outerExceptionTypesToCatch) / + sizeof(unsigned); + + // Generate outer function + llvm::Function* outerCatchFunct = + createCatchWrappedInvokeFunction(module, + builder, + fpm, + *innerCatchFunct, + "outerCatchFunct", + numExceptionTypesToCatch, + outerExceptionTypesToCatch); + + // Return outer function to run + return(outerCatchFunct); +} + + +/// Represents our foreign exceptions +class OurCppRunException : public std::runtime_error { +public: + OurCppRunException(const std::string reason) : + std::runtime_error(reason) {} + + OurCppRunException (const OurCppRunException& toCopy) : + std::runtime_error(toCopy) {} + + OurCppRunException& operator = (const OurCppRunException& toCopy) { + return(reinterpret_cast( + std::runtime_error::operator = (toCopy) + )); + } + + ~OurCppRunException (void) throw () {}; +}; + + +/// Throws foreign C++ exception. +/// @param ignoreIt unused parameter that allows function to match implied +/// generated function contract. +extern "C" +void throwCppException (int32_t ignoreIt) { + throw(OurCppRunException("thrown by throwCppException(...)")); +} + +typedef void (*OurExceptionThrowFunctType) (int32_t typeToThrow); + +/// This is a test harness which runs test by executing generated +/// function with a type info type to throw. Harness wraps the excecution +/// of generated function in a C++ try catch clause. +/// @param engine execution engine to use for executing generated function. +/// This demo program expects this to be a JIT instance for demo +/// purposes. +/// @param function generated test function to run +/// @param typeToThrow type info type of generated exception to throw, or +/// indicator to cause foreign exception to be thrown. +static +void runExceptionThrow(llvm::ExecutionEngine* engine, + llvm::Function* function, + int32_t typeToThrow) { + + // Find test's function pointer + OurExceptionThrowFunctType functPtr = + reinterpret_cast( + reinterpret_cast( + engine->getPointerToFunction(function) + ) + ); + + try { + // Run test + (*functPtr)(typeToThrow); + } + catch (OurCppRunException exc) { + // Catch foreign C++ exception + fprintf(stderr, + "\nrunExceptionThrow(...):In C++ catch OurCppRunException " + "with reason: %s.\n", + exc.what()); + } + catch (...) { + // Catch all exceptions including our generated ones. I'm not sure + // why this latter functionality should work, as it seems that + // our exceptions should be foreign to C++ (the _Unwind_Exception:: + // exception_class should be different from the one used by C++), and + // therefore C++ should ignore the generated exceptions. + + fprintf(stderr, + "\nrunExceptionThrow(...):In C++ catch all.\n"); + } +} + +// +// End test functions +// + +/// This initialization routine creates type info globals and +/// adds external function declarations to module. +/// @param numTypeInfos number of linear type info associated type info types +/// to create as GlobalVariable instances, starting with the value 1. +/// @param module code for module instance +/// @param builder builder instance +static void createStandardUtilityFunctions(unsigned numTypeInfos, + llvm::Module& module, + llvm::IRBuilder<>& builder) { + + llvm::LLVMContext& context = module.getContext(); + + // Exception initializations + + // Setup exception catch state + ourExceptionNotThrownState = + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 0), + ourExceptionThrownState = + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 1), + ourExceptionCaughtState = + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 2), + + + // Create our type info type + ourTypeInfoType = llvm::StructType::get(context, + builder.getInt32Ty(), + NULL); + + // Create OurException type + ourExceptionType = llvm::StructType::get(context, + ourTypeInfoType, + NULL); + + // Create portion of _Unwind_Exception type + // + // Note: Declaring only a portion of the _Unwind_Exception struct. + // Does this cause problems? + ourUnwindExceptionType = llvm::StructType::get(context, + builder.getInt64Ty(), + NULL); + struct OurBaseException_t dummyException; + + // Calculate offset of OurException::unwindException member. + ourBaseFromUnwindOffset = ((uintptr_t) &dummyException) - + ((uintptr_t) &(dummyException.unwindException)); + +#ifdef DEBUG + fprintf(stderr, + "createStandardUtilityFunctions(...):ourBaseFromUnwindOffset " + "= %lld, sizeof(struct OurBaseException_t) - " + "sizeof(struct _Unwind_Exception) = %lu.\n", + ourBaseFromUnwindOffset, + sizeof(struct OurBaseException_t) - + sizeof(struct _Unwind_Exception)); +#endif + + size_t numChars = sizeof(ourBaseExcpClassChars) / sizeof(char); + + // Create our _Unwind_Exception::exception_class value + ourBaseExceptionClass = genClass(ourBaseExcpClassChars, numChars); + + // Type infos + + std::string baseStr = "typeInfo", typeInfoName; + std::ostringstream typeInfoNameBuilder; + std::vector structVals; + + llvm::Constant *nextStruct; + llvm::GlobalVariable* nextGlobal = NULL; + + // Generate each type info + // + // Note: First type info is not used. + for (unsigned i = 0; i <= numTypeInfos; ++i) { + structVals.clear(); + structVals.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), i)); + nextStruct = llvm::ConstantStruct::get(ourTypeInfoType, structVals); + + typeInfoNameBuilder.str(""); + typeInfoNameBuilder << baseStr << i; + typeInfoName = typeInfoNameBuilder.str(); + + // Note: Does not seem to work without allocation + nextGlobal = + new llvm::GlobalVariable(module, + ourTypeInfoType, + true, + llvm::GlobalValue::ExternalLinkage, + nextStruct, + typeInfoName); + + ourTypeInfoNames.push_back(typeInfoName); + ourTypeInfoNamesIndex[i] = typeInfoName; + } + + ArgNames argNames; + ArgTypes argTypes; + llvm::Function* funct = NULL; + + // print32Int + + const llvm::Type* retType = builder.getVoidTy(); + + argTypes.clear(); + argTypes.push_back(builder.getInt32Ty()); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "print32Int", + llvm::Function::ExternalLinkage, + true, + false); + + // print64Int + + retType = builder.getVoidTy(); + + argTypes.clear(); + argTypes.push_back(builder.getInt64Ty()); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "print64Int", + llvm::Function::ExternalLinkage, + true, + false); + + // printStr + + retType = builder.getVoidTy(); + + argTypes.clear(); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "printStr", + llvm::Function::ExternalLinkage, + true, + false); + + // throwCppException + + retType = builder.getVoidTy(); + + argTypes.clear(); + argTypes.push_back(builder.getInt32Ty()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "throwCppException", + llvm::Function::ExternalLinkage, + true, + false); + + // deleteOurException + + retType = builder.getVoidTy(); + + argTypes.clear(); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "deleteOurException", + llvm::Function::ExternalLinkage, + true, + false); + + // createOurException + + retType = builder.getInt8Ty()->getPointerTo(); + + argTypes.clear(); + argTypes.push_back(builder.getInt32Ty()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "createOurException", + llvm::Function::ExternalLinkage, + true, + false); + + // _Unwind_RaiseException + + retType = builder.getInt32Ty(); + + argTypes.clear(); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + funct = createFunction(module, + retType, + argTypes, + argNames, + "_Unwind_RaiseException", + llvm::Function::ExternalLinkage, + true, + false); + + funct->addFnAttr(llvm::Attribute::NoReturn); + + // _Unwind_Resume + + retType = builder.getInt32Ty(); + + argTypes.clear(); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + funct = createFunction(module, + retType, + argTypes, + argNames, + "_Unwind_Resume", + llvm::Function::ExternalLinkage, + true, + false); + + funct->addFnAttr(llvm::Attribute::NoReturn); + + // ourPersonality + + retType = builder.getInt32Ty(); + + argTypes.clear(); + argTypes.push_back(builder.getInt32Ty()); + argTypes.push_back(builder.getInt32Ty()); + argTypes.push_back(builder.getInt64Ty()); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); + + argNames.clear(); + + createFunction(module, + retType, + argTypes, + argNames, + "ourPersonality", + llvm::Function::ExternalLinkage, + true, + false); + + // llvm.eh.selector intrinsic + + getDeclaration(&module, llvm::Intrinsic::eh_selector); + + // llvm.eh.exception intrinsic + + getDeclaration(&module, llvm::Intrinsic::eh_exception); + + // llvm.eh.typeid.for intrinsic + + getDeclaration(&module, llvm::Intrinsic::eh_typeid_for); +} + + +//===---------------------------------------------------------------------===// +// Main test driver code. +//===---------------------------------------------------------------------===// + +/// Demo main routine which takes the type info types to throw. A test will +/// be run for each given type info type. While type info types with the value +/// of -1 will trigger a foreign C++ exception to be thrown; type info types +/// <= 6 and >= 1 will be caught by test functions; and type info types > 6 +/// will result in exceptions which pass through to the test harness. All other +/// type info types are not supported and could cause a crash. +int main(int argc, char* argv[]) { + if (argc == 1) { + fprintf(stderr, + "\nUsage: ExceptionDemo " + "[...].\n" + " Each type must have the value of 1 - 6 for " + "generated exceptions to be caught;\n" + " the value -1 for foreign C++ exceptions to be " + "generated and thrown;\n" + " or the values > 6 for exceptions to be ignored.\n" + "\nTry: ExceptionDemo 2 3 7 -1\n" + " for a full test.\n\n"); + return(0); + } + + // If not set, exception handling will not be turned on + llvm::DwarfExceptionHandling = true; + + llvm::InitializeNativeTarget(); + llvm::LLVMContext& context = llvm::getGlobalContext(); + llvm::IRBuilder<> theBuilder(context); + + // Make the module, which holds all the code. + llvm::Module* module = new llvm::Module("my cool jit", context); + + // Build engine with JIT + llvm::EngineBuilder factory(module); + factory.setEngineKind(llvm::EngineKind::JIT); + factory.setAllocateGVsWithCode(false); + llvm::ExecutionEngine* executionEngine = factory.create(); + + { + llvm::FunctionPassManager fpm(module); + + // Set up the optimizer pipeline. + // Start with registering info about how the + // target lays out data structures. + fpm.add(new llvm::TargetData(*executionEngine->getTargetData())); + + // Optimizations turned on +#ifdef ADD_OPT_PASSES + + // Promote allocas to registers. + fpm.add(llvm::createPromoteMemoryToRegisterPass()); + + // Do simple "peephole" optimizations and bit-twiddling optzns. + fpm.add(llvm::createInstructionCombiningPass()); + + // Reassociate expressions. + fpm.add(llvm::createReassociatePass()); + + // Eliminate Common SubExpressions. + fpm.add(llvm::createGVNPass()); + + // Simplify the control flow graph (deleting unreachable + // blocks, etc). + fpm.add(llvm::createCFGSimplificationPass()); +#endif // ADD_OPT_PASSES + + fpm.doInitialization(); + + // Generate test code using function throwCppException(...) as + // the function which throws foreign exceptions. + llvm::Function* toRun = + createUnwindExceptionTest(*module, + theBuilder, + fpm, + "throwCppException"); + + fprintf(stderr, "\nBegin module dump:\n\n"); + + module->dump(); + + fprintf(stderr, "\nEnd module dump:\n"); + + fprintf(stderr, "\n\nBegin Test:\n"); + + for (int i = 1; i < argc; ++i) { + // Run test for each argument whose value is the exception + // type to throw. + runExceptionThrow(executionEngine, + toRun, + (unsigned) strtoul(argv[i], NULL, 10)); + } + + fprintf(stderr, "\nEnd Test:\n\n"); + } + + delete executionEngine; + + return 0; +} + Added: llvm/trunk/examples/ExceptionDemo/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/Makefile?rev=95723&view=auto ============================================================================== --- llvm/trunk/examples/ExceptionDemo/Makefile (added) +++ llvm/trunk/examples/ExceptionDemo/Makefile Tue Feb 9 17:22:43 2010 @@ -0,0 +1,17 @@ +##===- examples/ExceptionDemo/Makefile --------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===---------------------------------------------------------------------===## +LEVEL = ../.. +TOOLNAME = ExceptionDemo +EXAMPLE_TOOL = 1 + +LINK_COMPONENTS := jit interpreter nativecodegen + +include $(LEVEL)/Makefile.common + +CXXFLAGS += -fexceptions Modified: llvm/trunk/examples/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=95723&r1=95722&r2=95723&view=diff ============================================================================== --- llvm/trunk/examples/Makefile (original) +++ llvm/trunk/examples/Makefile Tue Feb 9 17:22:43 2010 @@ -10,7 +10,8 @@ include $(LEVEL)/Makefile.config -PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \ + ExceptionDemo ifeq ($(HAVE_PTHREAD),1) PARALLEL_DIRS += ParallelJIT From greened at obbligato.org Tue Feb 9 17:52:19 2010 From: greened at obbligato.org (David Greene) Date: Tue, 09 Feb 2010 23:52:19 -0000 Subject: [llvm-commits] [llvm] r95727 - in /llvm/trunk/lib/Target/X86: X86InstrFragmentsSIMD.td X86InstrInfo.td X86InstrMMX.td Message-ID: <201002092352.o19NqKY9006628@zion.cs.uiuc.edu> Author: greened Date: Tue Feb 9 17:52:19 2010 New Revision: 95727 URL: http://llvm.org/viewvc/llvm-project?rev=95727&view=rev Log: TableGen fragment refactoring. Move some utility TableGen defs, classes, etc. into a common file so they may be used my multiple pattern files. We will use this for the AVX specification to help with the transition from the current SSE specification. Added: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrMMX.td Added: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td?rev=95727&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td (added) +++ llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Tue Feb 9 17:52:19 2010 @@ -0,0 +1,62 @@ +//======- X86InstrFragmentsSIMD.td - x86 ISA -------------*- tablegen -*-=====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides pattern fragments useful for SIMD instructions. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// MMX Pattern Fragments +//===----------------------------------------------------------------------===// + +def load_mmx : PatFrag<(ops node:$ptr), (v1i64 (load node:$ptr))>; + +def bc_v8i8 : PatFrag<(ops node:$in), (v8i8 (bitconvert node:$in))>; +def bc_v4i16 : PatFrag<(ops node:$in), (v4i16 (bitconvert node:$in))>; +def bc_v2i32 : PatFrag<(ops node:$in), (v2i32 (bitconvert node:$in))>; +def bc_v1i64 : PatFrag<(ops node:$in), (v1i64 (bitconvert node:$in))>; + +//===----------------------------------------------------------------------===// +// MMX Masks +//===----------------------------------------------------------------------===// + +// MMX_SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to +// PSHUFW imm. +def MMX_SHUFFLE_get_shuf_imm : SDNodeXForm; + +// Patterns for: vector_shuffle v1, v2, <2, 6, 3, 7, ...> +def mmx_unpckh : PatFrag<(ops node:$lhs, node:$rhs), + (vector_shuffle node:$lhs, node:$rhs), [{ + return X86::isUNPCKHMask(cast(N)); +}]>; + +// Patterns for: vector_shuffle v1, v2, <0, 4, 2, 5, ...> +def mmx_unpckl : PatFrag<(ops node:$lhs, node:$rhs), + (vector_shuffle node:$lhs, node:$rhs), [{ + return X86::isUNPCKLMask(cast(N)); +}]>; + +// Patterns for: vector_shuffle v1, , <0, 0, 1, 1, ...> +def mmx_unpckh_undef : PatFrag<(ops node:$lhs, node:$rhs), + (vector_shuffle node:$lhs, node:$rhs), [{ + return X86::isUNPCKH_v_undef_Mask(cast(N)); +}]>; + +// Patterns for: vector_shuffle v1, , <2, 2, 3, 3, ...> +def mmx_unpckl_undef : PatFrag<(ops node:$lhs, node:$rhs), + (vector_shuffle node:$lhs, node:$rhs), [{ + return X86::isUNPCKL_v_undef_Mask(cast(N)); +}]>; + +def mmx_pshufw : PatFrag<(ops node:$lhs, node:$rhs), + (vector_shuffle node:$lhs, node:$rhs), [{ + return X86::isPSHUFDMask(cast(N)); +}], MMX_SHUFFLE_get_shuf_imm>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95727&r1=95726&r2=95727&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Feb 9 17:52:19 2010 @@ -5224,6 +5224,12 @@ include "X86Instr64bit.td" //===----------------------------------------------------------------------===// +// SIMD support (SSE, MMX and AVX) +//===----------------------------------------------------------------------===// + +include "X86InstrFragmentsSIMD.td" + +//===----------------------------------------------------------------------===// // XMM Floating point support (requires SSE / SSE2) //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=95727&r1=95726&r2=95727&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Tue Feb 9 17:52:19 2010 @@ -14,56 +14,6 @@ //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// -// MMX Pattern Fragments -//===----------------------------------------------------------------------===// - -def load_mmx : PatFrag<(ops node:$ptr), (v1i64 (load node:$ptr))>; - -def bc_v8i8 : PatFrag<(ops node:$in), (v8i8 (bitconvert node:$in))>; -def bc_v4i16 : PatFrag<(ops node:$in), (v4i16 (bitconvert node:$in))>; -def bc_v2i32 : PatFrag<(ops node:$in), (v2i32 (bitconvert node:$in))>; -def bc_v1i64 : PatFrag<(ops node:$in), (v1i64 (bitconvert node:$in))>; - -//===----------------------------------------------------------------------===// -// MMX Masks -//===----------------------------------------------------------------------===// - -// MMX_SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to -// PSHUFW imm. -def MMX_SHUFFLE_get_shuf_imm : SDNodeXForm; - -// Patterns for: vector_shuffle v1, v2, <2, 6, 3, 7, ...> -def mmx_unpckh : PatFrag<(ops node:$lhs, node:$rhs), - (vector_shuffle node:$lhs, node:$rhs), [{ - return X86::isUNPCKHMask(cast(N)); -}]>; - -// Patterns for: vector_shuffle v1, v2, <0, 4, 2, 5, ...> -def mmx_unpckl : PatFrag<(ops node:$lhs, node:$rhs), - (vector_shuffle node:$lhs, node:$rhs), [{ - return X86::isUNPCKLMask(cast(N)); -}]>; - -// Patterns for: vector_shuffle v1, , <0, 0, 1, 1, ...> -def mmx_unpckh_undef : PatFrag<(ops node:$lhs, node:$rhs), - (vector_shuffle node:$lhs, node:$rhs), [{ - return X86::isUNPCKH_v_undef_Mask(cast(N)); -}]>; - -// Patterns for: vector_shuffle v1, , <2, 2, 3, 3, ...> -def mmx_unpckl_undef : PatFrag<(ops node:$lhs, node:$rhs), - (vector_shuffle node:$lhs, node:$rhs), [{ - return X86::isUNPCKL_v_undef_Mask(cast(N)); -}]>; - -def mmx_pshufw : PatFrag<(ops node:$lhs, node:$rhs), - (vector_shuffle node:$lhs, node:$rhs), [{ - return X86::isPSHUFDMask(cast(N)); -}], MMX_SHUFFLE_get_shuf_imm>; - -//===----------------------------------------------------------------------===// // MMX Multiclasses //===----------------------------------------------------------------------===// From sabre at nondot.org Tue Feb 9 18:10:18 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 00:10:18 -0000 Subject: [llvm-commits] [llvm] r95728 - in /llvm/trunk: include/llvm/MC/MCFixup.h include/llvm/MC/MCInstPrinter.h lib/MC/MCAsmStreamer.cpp lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Message-ID: <201002100010.o1A0AIbG007344@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 18:10:18 2010 New Revision: 95728 URL: http://llvm.org/viewvc/llvm-project?rev=95728&view=rev Log: Add ability for MCInstPrinters to add comments for instructions. Enhance the x86 backend to show the hex values of immediates in comments when they are large. For example: movl $1072693248, 4(%esp) ## imm = 0x3FF00000 Modified: llvm/trunk/include/llvm/MC/MCFixup.h llvm/trunk/include/llvm/MC/MCInstPrinter.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Modified: llvm/trunk/include/llvm/MC/MCFixup.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=95728&r1=95727&r2=95728&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCFixup.h (original) +++ llvm/trunk/include/llvm/MC/MCFixup.h Tue Feb 9 18:10:18 2010 @@ -16,7 +16,7 @@ // Private constants, do not use. // -// This is currently layed out so that the MCFixup fields can be efficiently +// This is currently laid out so that the MCFixup fields can be efficiently // accessed, while keeping the offset field large enought that the assembler // backend can reasonably use the MCFixup representation for an entire fragment // (splitting any overly large fragments). Modified: llvm/trunk/include/llvm/MC/MCInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInstPrinter.h?rev=95728&r1=95727&r2=95728&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInstPrinter.h (original) +++ llvm/trunk/include/llvm/MC/MCInstPrinter.h Tue Feb 9 18:10:18 2010 @@ -20,12 +20,22 @@ /// that converts an MCInst to valid target assembly syntax. class MCInstPrinter { protected: + /// O - The main stream to emit instruction text to. raw_ostream &O; + + /// CommentStream - a stream that comments can be emitted to if desired. + /// Each comment must end with a newline. This will be null if verbose + /// assembly emission is disable. + raw_ostream *CommentStream; const MCAsmInfo &MAI; public: - MCInstPrinter(raw_ostream &o, const MCAsmInfo &mai) : O(o), MAI(mai) {} + MCInstPrinter(raw_ostream &o, const MCAsmInfo &mai) + : O(o), CommentStream(0), MAI(mai) {} virtual ~MCInstPrinter(); + + /// setCommentStream - Specify a stream to emit comments to. + void setCommentStream(raw_ostream &OS) { CommentStream = &OS; } /// printInst - Print the specified MCInst to the current raw_ostream. /// Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95728&r1=95727&r2=95728&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 18:10:18 2010 @@ -48,7 +48,10 @@ : MCStreamer(Context), OS(os), MAI(mai), InstPrinter(printer), Emitter(emitter), CommentStream(CommentToEmit), IsLittleEndian(isLittleEndian), IsVerboseAsm(isVerboseAsm), - ShowFixups(showFixups), ShowInst(showInst) {} + ShowFixups(showFixups), ShowInst(showInst) { + if (InstPrinter && IsVerboseAsm) + InstPrinter->setCommentStream(CommentStream); + } ~MCAsmStreamer() {} bool isLittleEndian() const { return IsLittleEndian; } Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp?rev=95728&r1=95727&r2=95728&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Tue Feb 9 18:10:18 2010 @@ -18,6 +18,7 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" #include "X86GenInstrNames.inc" using namespace llvm; @@ -65,6 +66,10 @@ O << '%' << getRegisterName(Op.getReg()); } else if (Op.isImm()) { O << '$' << Op.getImm(); + + if (CommentStream && (Op.getImm() > 255 || Op.getImm() < -256)) + *CommentStream << format("imm = 0x%X\n", Op.getImm()); + } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); O << '$' << *Op.getExpr(); From enderby at apple.com Tue Feb 9 18:10:31 2010 From: enderby at apple.com (Kevin Enderby) Date: Wed, 10 Feb 2010 00:10:31 -0000 Subject: [llvm-commits] [llvm] r95729 - in /llvm/trunk: lib/Target/X86/X86InstrSSE.td test/MC/AsmParser/X86/x86_32-encoding.s Message-ID: <201002100010.o1A0AVhO007364@zion.cs.uiuc.edu> Author: enderby Date: Tue Feb 9 18:10:31 2010 New Revision: 95729 URL: http://llvm.org/viewvc/llvm-project?rev=95729&view=rev Log: Fix the encoding of the movntdqa X86 instruction. It was missing the 0x66 prefix which is part of the opcode encoding. Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=95729&r1=95728&r2=95729&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Feb 9 18:10:31 2010 @@ -3747,7 +3747,8 @@ def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), "movntdqa\t{$src, $dst|$dst, $src}", - [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>; + [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>, + OpSize; //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=95729&r1=95728&r2=95729&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Tue Feb 9 18:10:31 2010 @@ -9,3 +9,5 @@ psllw 69, %mm3 # CHECK: encoding: [0x0f,0xf1,0x1d,0x45,0x00,0x00,0x00] +movntdqa 0xdeadbeef(%ebx,%ecx,8),%xmm5 +# CHECK: encoding: [0x66,0x0f,0x38,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] From dalej at apple.com Tue Feb 9 18:11:11 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 00:11:11 -0000 Subject: [llvm-commits] [llvm] r95730 - in /llvm/trunk/lib/CodeGen: MachineBasicBlock.cpp RegAllocLocal.cpp SelectionDAG/FastISel.cpp Message-ID: <201002100011.o1A0BBuw007405@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 18:11:11 2010 New Revision: 95730 URL: http://llvm.org/viewvc/llvm-project?rev=95730&view=rev Log: Fix comments to reflect renaming elsewhere. Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp llvm/trunk/lib/CodeGen/RegAllocLocal.cpp llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=95730&r1=95729&r2=95730&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue Feb 9 18:11:11 2010 @@ -540,7 +540,7 @@ } /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping -/// any DEBUG_VALUE instructions. Return UnknownLoc if there is none. +/// any DBG_VALUE instructions. Return UnknownLoc if there is none. DebugLoc MachineBasicBlock::findDebugLoc(MachineBasicBlock::iterator &MBBI) { DebugLoc DL; Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=95730&r1=95729&r2=95730&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Tue Feb 9 18:11:11 2010 @@ -841,8 +841,8 @@ } } - // If a DEBUG_VALUE says something is located in a spilled register, - // change the DEBUG_VALUE to be undef, which prevents the register + // If a DBG_VALUE says something is located in a spilled register, + // change the DBG_VALUE to be undef, which prevents the register // from being reloaded here. Doing that would change the generated // code, unless another use immediately follows this instruction. if (MI->isDebugValue() && Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=95730&r1=95729&r2=95730&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Feb 9 18:11:11 2010 @@ -345,7 +345,7 @@ if (MDNode *Dbg = DI->getMetadata("dbg")) MMI->setVariableDbgInfo(DI->getVariable(), FI, Dbg); } - // Building the map above is target independent. Generating DEBUG_VALUE + // Building the map above is target independent. Generating DBG_VALUE // inline is target dependent; do this now. (void)TargetSelectInstruction(cast(I)); return true; From kennethuil at gmail.com Tue Feb 9 18:14:03 2010 From: kennethuil at gmail.com (Kenneth Uildriks) Date: Wed, 10 Feb 2010 00:14:03 -0000 Subject: [llvm-commits] [llvm] r95731 - /llvm/trunk/lib/VMCore/TypesContext.h Message-ID: <201002100014.o1A0E3J0007582@zion.cs.uiuc.edu> Author: kennethuil Date: Tue Feb 9 18:14:03 2010 New Revision: 95731 URL: http://llvm.org/viewvc/llvm-project?rev=95731&view=rev Log: IntegerValType holds a uint32_t, so its constructor should take a uint32_t. This allows it to be properly initialized with bit widths > 65535 Modified: llvm/trunk/lib/VMCore/TypesContext.h Modified: llvm/trunk/lib/VMCore/TypesContext.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/TypesContext.h?rev=95731&r1=95730&r2=95731&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/TypesContext.h (original) +++ llvm/trunk/lib/VMCore/TypesContext.h Tue Feb 9 18:14:03 2010 @@ -68,7 +68,7 @@ class IntegerValType { uint32_t bits; public: - IntegerValType(uint16_t numbits) : bits(numbits) {} + IntegerValType(uint32_t numbits) : bits(numbits) {} static IntegerValType get(const IntegerType *Ty) { return IntegerValType(Ty->getBitWidth()); From sabre at nondot.org Tue Feb 9 18:36:00 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 00:36:00 -0000 Subject: [llvm-commits] [llvm] r95734 - in /llvm/trunk/lib: CodeGen/AsmPrinter/ Target/ARM/AsmPrinter/ Target/Alpha/AsmPrinter/ Target/Blackfin/AsmPrinter/ Target/CellSPU/AsmPrinter/ Target/Mips/AsmPrinter/ Target/PIC16/AsmPrinter/ Target/PowerPC/AsmPrinter/ Target/Sparc/AsmPrinter/ Target/SystemZ/AsmPrinter/ Target/X86/AsmPrinter/ Target/XCore/AsmPrinter/ Message-ID: <201002100036.o1A0a1U0008582@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 18:36:00 2010 New Revision: 95734 URL: http://llvm.org/viewvc/llvm-project?rev=95734&view=rev Log: print all the newlines at the end of instructions with OutStreamer.AddBlankLine instead of textually. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -1442,7 +1442,8 @@ } } } - O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd() << '\n'; + O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd(); + OutStreamer.AddBlankLine(); } /// printImplicitDef - This method prints the specified machine instruction @@ -1451,7 +1452,8 @@ if (!VerboseAsm) return; O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << " implicit-def: " - << TRI->getName(MI->getOperand(0).getReg()) << '\n'; + << TRI->getName(MI->getOperand(0).getReg()); + OutStreamer.AddBlankLine(); } void AsmPrinter::printKill(const MachineInstr *MI) const { @@ -1463,14 +1465,14 @@ assert(op.isReg() && "KILL instruction must have only register operands"); O << ' ' << TRI->getName(op.getReg()) << (op.isDef() ? "" : ""); } - O << '\n'; + OutStreamer.AddBlankLine(); } /// printLabel - This method prints a local label used by debug and /// exception handling tables. void AsmPrinter::printLabelInst(const MachineInstr *MI) const { printLabel(MI->getOperand(0).getImm()); - O << '\n'; + OutStreamer.AddBlankLine(); } void AsmPrinter::printLabel(unsigned Id) const { Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -220,7 +220,7 @@ O << "-."; O << ')'; } - O << '\n'; + OutStreamer.AddBlankLine(); } void getAnalysisUsage(AnalysisUsage &AU) const { @@ -819,7 +819,7 @@ // data itself. if (!strcmp(Modifier, "label")) { unsigned ID = MI->getOperand(OpNum).getImm(); - O << *GetCPISymbol(ID) << ":\n"; + OutStreamer.EmitLabel(GetCPISymbol(ID)); } else { assert(!strcmp(Modifier, "cpentry") && "Unknown modifier for CPE"); unsigned CPI = MI->getOperand(OpNum).getIndex(); @@ -1030,7 +1030,7 @@ EmitAlignment(2); printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } } Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -47,7 +47,7 @@ void printInstruction(const MachineInstr *MI); void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } static const char *getRegisterName(unsigned RegNo); Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -54,7 +54,7 @@ void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -58,7 +58,7 @@ void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void printOp(const MachineOperand &MO); Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -77,7 +77,7 @@ void printInstruction(const MachineInstr *MI); // autogenerated. void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } virtual void EmitFunctionBodyStart(); virtual void EmitFunctionBodyEnd(); Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -45,7 +45,7 @@ void PIC16AsmPrinter::EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } static int getFunctionColor(const Function *F) { Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -555,7 +555,7 @@ O << ", "; printOperand(MI, 1); O << ", " << (unsigned int)SH; - O << '\n'; + OutStreamer.AddBlankLine(); return; } } @@ -566,7 +566,7 @@ printOperand(MI, 0); O << ", "; printOperand(MI, 1); - O << '\n'; + OutStreamer.AddBlankLine(); return; } @@ -580,13 +580,13 @@ O << ", "; printOperand(MI, 1); O << ", " << (unsigned int)SH; - O << '\n'; + OutStreamer.AddBlankLine(); return; } } printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() { Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -19,6 +19,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/StringExtras.h" @@ -44,7 +45,7 @@ virtual void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void printInstruction(const MachineInstr *MI); // autogenerated. static const char *getRegisterName(unsigned RegNo); Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -79,7 +79,7 @@ void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) { // Call the autogenerated instruction printer routines. printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){ Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Tue Feb 9 18:36:00 2010 @@ -321,7 +321,8 @@ if (MI->getOperand(0).getType()==MachineOperand::MO_Register && MI->getOperand(0).getReg()==0) { // Suppress offset in this case, it is not meaningful. - O << "undef\n"; + O << "undef"; + OutStreamer.AddBlankLine(); return; } else if (MI->getOperand(0).getType()==MachineOperand::MO_FPImmediate) { // This is more naturally done in printOperand, but since the only use @@ -350,7 +351,7 @@ } O << "+"; printOperand(MI, NOps-2); - O << '\n'; + OutStreamer.AddBlankLine(); return; } case X86::MOVPC32r: { @@ -421,7 +422,6 @@ MCInst TmpInst; MCInstLowering.Lower(MI, TmpInst); - OutStreamer.EmitInstruction(TmpInst); } Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=95734&r1=95733&r2=95734&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Tue Feb 9 18:36:00 2010 @@ -305,11 +305,12 @@ unsigned src, dst, srcSR, dstSR; if (TM.getInstrInfo()->isMoveInstr(*MI, src, dst, srcSR, dstSR)) { O << "\tmov " << getRegisterName(dst) << ", "; - O << getRegisterName(src) << '\n'; + O << getRegisterName(src); + OutStreamer.AddBlankLine(); return; } printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } // Force static initialization. From dalej at apple.com Tue Feb 9 18:41:50 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 00:41:50 -0000 Subject: [llvm-commits] [llvm] r95735 - in /llvm/trunk: include/llvm/CodeGen/MachineOperand.h lib/CodeGen/MachineInstr.cpp Message-ID: <201002100041.o1A0foIZ008832@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 18:41:49 2010 New Revision: 95735 URL: http://llvm.org/viewvc/llvm-project?rev=95735&view=rev Log: Add isDebug argument to ChangeToRegister; this prevents the field from being used uninitialized later in some cases. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=95735&r1=95734&r2=95735&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Tue Feb 9 18:41:49 2010 @@ -379,7 +379,7 @@ /// the setReg method should be used. void ChangeToRegister(unsigned Reg, bool isDef, bool isImp = false, bool isKill = false, bool isDead = false, - bool isUndef = false); + bool isUndef = false, bool isDebug = false); //===--------------------------------------------------------------------===// // Construction methods. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=95735&r1=95734&r2=95735&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Feb 9 18:41:49 2010 @@ -127,7 +127,8 @@ /// the specified value. If an operand is known to be an register already, /// the setReg method should be used. void MachineOperand::ChangeToRegister(unsigned Reg, bool isDef, bool isImp, - bool isKill, bool isDead, bool isUndef) { + bool isKill, bool isDead, bool isUndef, + bool isDebug) { // If this operand is already a register operand, use setReg to update the // register's use/def lists. if (isReg()) { @@ -152,6 +153,7 @@ IsDead = isDead; IsUndef = isUndef; IsEarlyClobber = false; + IsDebug = isDebug; SubReg = 0; } From dalej at apple.com Tue Feb 9 18:44:23 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 00:44:23 -0000 Subject: [llvm-commits] [llvm] r95736 - in /llvm/trunk: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/DeadMachineInstructionElim.cpp Message-ID: <201002100044.o1A0iN03008930@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 18:44:23 2010 New Revision: 95736 URL: http://llvm.org/viewvc/llvm-project?rev=95736&view=rev Log: more comment updates Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=95736&r1=95735&r2=95736&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Feb 9 18:44:23 2010 @@ -338,7 +338,7 @@ bool isCond); /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping - /// any DEBUG_VALUE instructions. Return UnknownLoc if there is none. + /// any DBG_VALUE instructions. Return UnknownLoc if there is none. DebugLoc findDebugLoc(MachineBasicBlock::iterator &MBBI); // Debugging methods. Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95736&r1=95735&r2=95736&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Tue Feb 9 18:44:23 2010 @@ -112,7 +112,7 @@ MachineInstr *MI = &*MII; if (MI->isDebugValue()) { - // Don't delete the DEBUG_VALUE itself, but if its Value operand is + // Don't delete the DBG_VALUE itself, but if its Value operand is // a vreg and this is the only use, substitute an undef operand; // the former operand will then be deleted normally. if (MI->getNumOperands()==3 && MI->getOperand(0).isReg()) { @@ -120,7 +120,7 @@ MachineRegisterInfo::use_iterator I = MRI->use_begin(Reg); assert(I != MRI->use_end()); if (++I == MRI->use_end()) - // only one use, which must be this DEBUG_VALUE. + // only one use, which must be this DBG_VALUE. MI->getOperand(0).setReg(0U); } } From isanbard at gmail.com Tue Feb 9 18:45:28 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 10 Feb 2010 00:45:28 -0000 Subject: [llvm-commits] [llvm] r95737 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <201002100045.o1A0jTPW008976@zion.cs.uiuc.edu> Author: void Date: Tue Feb 9 18:45:28 2010 New Revision: 95737 URL: http://llvm.org/viewvc/llvm-project?rev=95737&view=rev Log: Improve comments a bit more. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=95737&r1=95736&r2=95737&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Feb 9 18:45:28 2010 @@ -762,7 +762,7 @@ // does, instead output it before the table. unsigned SizeTypes = TypeInfos.size() * TypeFormatSize; unsigned TyOffset = sizeof(int8_t) + // Call site format - MCAsmInfo::getULEB128Size(SizeSites) + // Call-site table length + MCAsmInfo::getULEB128Size(SizeSites) + // Call site table length SizeSites + SizeActions + SizeTypes; unsigned TotalSize = sizeof(int8_t) + // LPStart format sizeof(int8_t) + // TType format @@ -836,7 +836,7 @@ // Emit the landing pad call site table. EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); - EmitULEB128(SizeSites, "Call site table size"); + EmitULEB128(SizeSites, "Call site table length"); for (SmallVectorImpl::const_iterator I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { @@ -886,12 +886,12 @@ } // Emit the Action Table. - EOL("Action Record Table:"); + if (Actions.size() != 0) EOL("-- Action Record Table --"); unsigned Iter = 1; for (SmallVectorImpl::const_iterator I = Actions.begin(), E = Actions.end(); I != E; ++I) { const ActionEntry &Action = *I; - EOL(Twine("Action Record ") + Twine(Iter++)); + EOL("Action Record:"); // Type Filter // From sabre at nondot.org Tue Feb 9 18:47:53 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 00:47:53 -0000 Subject: [llvm-commits] [llvm] r95738 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <201002100047.o1A0lrJi009094@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 18:47:53 2010 New Revision: 95738 URL: http://llvm.org/viewvc/llvm-project?rev=95738&view=rev Log: Move verbose asm instruction comments to using MCStreamer. The major win of this is that the code is simpler and they print on the same line as the instruction again: movl %eax, 96(%esp) ## 4-byte Spill movl 96(%esp), %eax ## 4-byte Reload cmpl 92(%esp), %eax ## 4-byte Folded Reload jl LBB7_86 Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=95738&r1=95737&r2=95738&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Feb 9 18:47:53 2010 @@ -313,9 +313,6 @@ /// debug tables. void printDeclare(const MachineInstr *MI) const; - /// EmitComments - Pretty-print comments for instructions - void EmitComments(const MachineInstr &MI) const; - /// GetGlobalValueSymbol - Return the MCSymbol for the specified global /// value. MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) const; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95738&r1=95737&r2=95738&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 9 18:47:53 2010 @@ -324,6 +324,64 @@ } +/// EmitComments - Pretty-print comments for instructions. +static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) { + const MachineFunction *MF = MI.getParent()->getParent(); + const TargetMachine &TM = MF->getTarget(); + + if (!MI.getDebugLoc().isUnknown()) { + DILocation DLT = MF->getDILocation(MI.getDebugLoc()); + + // Print source line info. + DIScope Scope = DLT.getScope(); + // Omit the directory, because it's likely to be long and uninteresting. + if (!Scope.isNull()) + CommentOS << Scope.getFilename(); + else + CommentOS << ""; + CommentOS << ':' << DLT.getLineNumber(); + if (DLT.getColumnNumber() != 0) + CommentOS << ':' << DLT.getColumnNumber(); + CommentOS << '\n'; + } + + // Check for spills and reloads + int FI; + + const MachineFrameInfo *FrameInfo = MF->getFrameInfo(); + + // We assume a single instruction only has a spill or reload, not + // both. + const MachineMemOperand *MMO; + if (TM.getInstrInfo()->isLoadFromStackSlotPostFE(&MI, FI)) { + if (FrameInfo->isSpillSlotObjectIndex(FI)) { + MMO = *MI.memoperands_begin(); + CommentOS << MMO->getSize() << "-byte Reload\n"; + } + } else if (TM.getInstrInfo()->hasLoadFromStackSlot(&MI, MMO, FI)) { + if (FrameInfo->isSpillSlotObjectIndex(FI)) + CommentOS << MMO->getSize() << "-byte Folded Reload\n"; + } else if (TM.getInstrInfo()->isStoreToStackSlotPostFE(&MI, FI)) { + if (FrameInfo->isSpillSlotObjectIndex(FI)) { + MMO = *MI.memoperands_begin(); + CommentOS << MMO->getSize() << "-byte Spill\n"; + } + } else if (TM.getInstrInfo()->hasStoreToStackSlot(&MI, MMO, FI)) { + if (FrameInfo->isSpillSlotObjectIndex(FI)) + CommentOS << MMO->getSize() << "-byte Folded Spill\n"; + } + + // Check for spill-induced copies + unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; + if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg, + SrcSubIdx, DstSubIdx)) { + if (MI.getAsmPrinterFlag(AsmPrinter::ReloadReuse)) + CommentOS << " Reload Reuse\n"; + } +} + + + /// EmitFunctionBody - This method emits the body and trailer for a /// function. void AsmPrinter::EmitFunctionBody() { @@ -347,6 +405,9 @@ // FIXME: Clean up processDebugLoc. processDebugLoc(II, true); + if (VerboseAsm) + EmitComments(*II, OutStreamer.GetCommentOS()); + switch (II->getOpcode()) { case TargetOpcode::DBG_LABEL: case TargetOpcode::EH_LABEL: @@ -366,8 +427,6 @@ EmitInstruction(II); break; } - if (VerboseAsm) - EmitComments(*II); // FIXME: Clean up processDebugLoc. processDebugLoc(II, false); @@ -1729,75 +1788,3 @@ return 0; } -/// EmitComments - Pretty-print comments for instructions -void AsmPrinter::EmitComments(const MachineInstr &MI) const { - if (!VerboseAsm) - return; - - if (!MI.getDebugLoc().isUnknown()) { - DILocation DLT = MF->getDILocation(MI.getDebugLoc()); - - // Print source line info. - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << ' '; - DIScope Scope = DLT.getScope(); - // Omit the directory, because it's likely to be long and uninteresting. - if (!Scope.isNull()) - O << Scope.getFilename(); - else - O << ""; - O << ':' << DLT.getLineNumber(); - if (DLT.getColumnNumber() != 0) - O << ':' << DLT.getColumnNumber(); - O << '\n'; - } - - // Check for spills and reloads - int FI; - - const MachineFrameInfo *FrameInfo = - MI.getParent()->getParent()->getFrameInfo(); - - // We assume a single instruction only has a spill or reload, not - // both. - const MachineMemOperand *MMO; - if (TM.getInstrInfo()->isLoadFromStackSlotPostFE(&MI, FI)) { - if (FrameInfo->isSpillSlotObjectIndex(FI)) { - MMO = *MI.memoperands_begin(); - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Reload\n"; - } - } - else if (TM.getInstrInfo()->hasLoadFromStackSlot(&MI, MMO, FI)) { - if (FrameInfo->isSpillSlotObjectIndex(FI)) { - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << ' ' - << MMO->getSize() << "-byte Folded Reload\n"; - } - } - else if (TM.getInstrInfo()->isStoreToStackSlotPostFE(&MI, FI)) { - if (FrameInfo->isSpillSlotObjectIndex(FI)) { - MMO = *MI.memoperands_begin(); - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Spill\n"; - } - } - else if (TM.getInstrInfo()->hasStoreToStackSlot(&MI, MMO, FI)) { - if (FrameInfo->isSpillSlotObjectIndex(FI)) { - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << ' ' - << MMO->getSize() << "-byte Folded Spill\n"; - } - } - - // Check for spill-induced copies - unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; - if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg, - SrcSubIdx, DstSubIdx)) { - if (MI.getAsmPrinterFlag(ReloadReuse)) { - O.PadToColumn(MAI->getCommentColumn()); - O << MAI->getCommentString() << " Reload Reuse\n"; - } - } -} - From echristo at apple.com Tue Feb 9 18:48:34 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 9 Feb 2010 16:48:34 -0800 Subject: [llvm-commits] [llvm] r95738 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp In-Reply-To: <201002100047.o1A0lrJi009094@zion.cs.uiuc.edu> References: <201002100047.o1A0lrJi009094@zion.cs.uiuc.edu> Message-ID: <8BC9B8BF-5366-45AD-ABE8-07DB7C9C9E0B@apple.com> On Feb 9, 2010, at 4:47 PM, Chris Lattner wrote: > Move verbose asm instruction comments to using MCStreamer. > The major win of this is that the code is simpler and they > print on the same line as the instruction again: > > movl %eax, 96(%esp) ## 4-byte Spill > movl 96(%esp), %eax ## 4-byte Reload > cmpl 92(%esp), %eax ## 4-byte Folded Reload Woot! -eric From dalej at apple.com Tue Feb 9 18:55:42 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 00:55:42 -0000 Subject: [llvm-commits] [llvm] r95739 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp SimpleRegisterCoalescing.cpp Message-ID: <201002100055.o1A0tgpH009442@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 18:55:42 2010 New Revision: 95739 URL: http://llvm.org/viewvc/llvm-project?rev=95739&view=rev Log: Skip DBG_VALUE many places in live intervals and register coalescing. This fixes many crashes and places where debug info affects codegen (when dbg.value is lowered to machine instructions, which it isn't yet in TOT). Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95739&r1=95738&r2=95739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 9 18:55:42 2010 @@ -512,6 +512,8 @@ baseIndex = baseIndex.getNextIndex(); while (++mi != MBB->end()) { + if (mi->isDebugValue()) + continue; if (getInstructionFromIndex(baseIndex) == 0) baseIndex = indexes_->getNextNonNullIndex(baseIndex); @@ -527,8 +529,8 @@ end = baseIndex.getDefIndex(); } else { // Another instruction redefines the register before it is ever read. - // Then the register is essentially dead at the instruction that defines - // it. Hence its interval is: + // Then the register is essentially dead at the instruction that + // defines it. Hence its interval is: // [defSlot(def), defSlot(def)+1) DEBUG(dbgs() << " dead"); end = start.getStoreIndex(); @@ -606,26 +608,28 @@ SlotIndex end = baseIndex; bool SeenDefUse = false; - - while (mi != MBB->end()) { - if (mi->killsRegister(interval.reg, tri_)) { - DEBUG(dbgs() << " killed"); - end = baseIndex.getDefIndex(); - SeenDefUse = true; - break; - } else if (mi->modifiesRegister(interval.reg, tri_)) { - // Another instruction redefines the register before it is ever read. - // Then the register is essentially dead at the instruction that defines - // it. Hence its interval is: - // [defSlot(def), defSlot(def)+1) - DEBUG(dbgs() << " dead"); - end = start.getStoreIndex(); - SeenDefUse = true; - break; - } + MachineBasicBlock::iterator E = MBB->end(); + while (mi != E) { + if (!mi->isDebugValue()) { + if (mi->killsRegister(interval.reg, tri_)) { + DEBUG(dbgs() << " killed"); + end = baseIndex.getDefIndex(); + SeenDefUse = true; + break; + } else if (mi->modifiesRegister(interval.reg, tri_)) { + // Another instruction redefines the register before it is ever read. + // Then the register is essentially dead at the instruction that defines + // it. Hence its interval is: + // [defSlot(def), defSlot(def)+1) + DEBUG(dbgs() << " dead"); + end = start.getStoreIndex(); + SeenDefUse = true; + break; + } + } ++mi; - if (mi != MBB->end()) { + if (mi != E && !mi->isDebugValue()) { baseIndex = indexes_->getNextNonNullIndex(baseIndex); } } @@ -1056,7 +1060,7 @@ // If this is the rematerializable definition MI itself and // all of its uses are rematerialized, simply delete it. if (MI == ReMatOrigDefMI && CanDelete) { - DEBUG(dbgs() << "\t\t\t\tErasing re-materlizable def: " + DEBUG(dbgs() << "\t\t\t\tErasing re-materializable def: " << MI << '\n'); RemoveMachineInstrFromMaps(MI); vrm.RemoveMachineInstrFromMaps(MI); @@ -1299,6 +1303,12 @@ MachineInstr *MI = &*ri; MachineOperand &O = ri.getOperand(); ++ri; + if (MI->isDebugValue()) { + // Remove debug info for now. + O.setReg(0U); + DEBUG(dbgs() << "Removing debug info due to spill:" << "\t" << *MI); + continue; + } assert(!O.isImplicit() && "Spilling register that's used as implicit use?"); SlotIndex index = getInstructionIndex(MI); if (index < start || index >= end) Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95739&r1=95738&r2=95739&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Feb 9 18:55:42 2010 @@ -375,8 +375,9 @@ // If some of the uses of IntA.reg is already coalesced away, return false. // It's not possible to determine whether it's safe to perform the coalescing. - for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(IntA.reg), - UE = mri_->use_end(); UI != UE; ++UI) { + for (MachineRegisterInfo::use_nodbg_iterator UI = + mri_->use_nodbg_begin(IntA.reg), + UE = mri_->use_nodbg_end(); UI != UE; ++UI) { MachineInstr *UseMI = &*UI; SlotIndex UseIdx = li_->getInstructionIndex(UseMI); LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx); @@ -430,6 +431,12 @@ ++UI; if (JoinedCopies.count(UseMI)) continue; + if (UseMI->isDebugValue()) { + // FIXME These don't have an instruction index. Not clear we have enough + // info to decide whether to do this replacement or not. For now do it. + UseMO.setReg(NewReg); + continue; + } SlotIndex UseIdx = li_->getInstructionIndex(UseMI).getUseIndex(); LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx); if (ULR == IntA.end() || ULR->valno != AValNo) @@ -1029,8 +1036,9 @@ unsigned Threshold = allocatableRCRegs_[RC].count() * 2; unsigned Length = li_->getApproximateInstructionCount(DstInt); if (Length > Threshold && - (((float)std::distance(mri_->use_begin(DstInt.reg), - mri_->use_end()) / Length) < (1.0 / Threshold))) + (((float)std::distance(mri_->use_nodbg_begin(DstInt.reg), + mri_->use_nodbg_end()) / Length) < + (1.0 / Threshold))) return false; // If the virtual register live interval extends into a loop, turn down @@ -1079,15 +1087,16 @@ MachineBasicBlock *CopyMBB, LiveInterval &DstInt, LiveInterval &SrcInt) { - // If the virtual register live interval is long but it has low use desity, + // If the virtual register live interval is long but it has low use density, // do not join them, instead mark the physical register as its allocation // preference. const TargetRegisterClass *RC = mri_->getRegClass(SrcInt.reg); unsigned Threshold = allocatableRCRegs_[RC].count() * 2; unsigned Length = li_->getApproximateInstructionCount(SrcInt); if (Length > Threshold && - (((float)std::distance(mri_->use_begin(SrcInt.reg), - mri_->use_end()) / Length) < (1.0 / Threshold))) + (((float)std::distance(mri_->use_nodbg_begin(SrcInt.reg), + mri_->use_nodbg_end()) / Length) < + (1.0 / Threshold))) return false; if (SrcInt.empty()) @@ -1140,10 +1149,10 @@ unsigned LargeSize = li_->getApproximateInstructionCount(LargeInt); unsigned SmallSize = li_->getApproximateInstructionCount(SmallInt); if (SmallSize > Threshold || LargeSize > Threshold) - if ((float)std::distance(mri_->use_begin(SmallReg), - mri_->use_end()) / SmallSize < - (float)std::distance(mri_->use_begin(LargeReg), - mri_->use_end()) / LargeSize) + if ((float)std::distance(mri_->use_nodbg_begin(SmallReg), + mri_->use_nodbg_end()) / SmallSize < + (float)std::distance(mri_->use_nodbg_begin(LargeReg), + mri_->use_nodbg_end()) / LargeSize) return false; return true; } @@ -1630,8 +1639,8 @@ unsigned Length = li_->getApproximateInstructionCount(JoinVInt); float Ratio = 1.0 / Threshold; if (Length > Threshold && - (((float)std::distance(mri_->use_begin(JoinVReg), - mri_->use_end()) / Length) < Ratio)) { + (((float)std::distance(mri_->use_nodbg_begin(JoinVReg), + mri_->use_nodbg_end()) / Length) < Ratio)) { mri_->setRegAllocationHint(JoinVInt.reg, 0, JoinPReg); ++numAborts; DEBUG(dbgs() << "\tMay tie down a physical register, abort!\n"); @@ -2564,8 +2573,8 @@ return !RegClassA->contains(RegB); } -/// lastRegisterUse - Returns the last use of the specific register between -/// cycles Start and End or NULL if there are no uses. +/// lastRegisterUse - Returns the last (non-debug) use of the specific register +/// between cycles Start and End or NULL if there are no uses. MachineOperand * SimpleRegisterCoalescing::lastRegisterUse(SlotIndex Start, SlotIndex End, @@ -2574,8 +2583,8 @@ UseIdx = SlotIndex(); if (TargetRegisterInfo::isVirtualRegister(Reg)) { MachineOperand *LastUse = NULL; - for (MachineRegisterInfo::use_iterator I = mri_->use_begin(Reg), - E = mri_->use_end(); I != E; ++I) { + for (MachineRegisterInfo::use_nodbg_iterator I = mri_->use_nodbg_begin(Reg), + E = mri_->use_nodbg_end(); I != E; ++I) { MachineOperand &Use = I.getOperand(); MachineInstr *UseMI = Use.getParent(); unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; From isanbard at gmail.com Tue Feb 9 18:59:47 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 10 Feb 2010 00:59:47 -0000 Subject: [llvm-commits] [llvm] r95740 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <201002100059.o1A0xlSi009648@zion.cs.uiuc.edu> Author: void Date: Tue Feb 9 18:59:47 2010 New Revision: 95740 URL: http://llvm.org/viewvc/llvm-project?rev=95740&view=rev Log: Improve comments a even more. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=95740&r1=95739&r2=95740&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Tue Feb 9 18:59:47 2010 @@ -887,7 +887,6 @@ // Emit the Action Table. if (Actions.size() != 0) EOL("-- Action Record Table --"); - unsigned Iter = 1; for (SmallVectorImpl::const_iterator I = Actions.begin(), E = Actions.end(); I != E; ++I) { const ActionEntry &Action = *I; @@ -907,7 +906,7 @@ } // Emit the Catch TypeInfos. - Iter = TypeInfos.size(); + if (TypeInfos.size() != 0) EOL("-- Catch TypeInfos --"); for (std::vector::const_reverse_iterator I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) { const GlobalVariable *GV = *I; @@ -915,7 +914,7 @@ if (GV) { O << *Asm->GetGlobalValueSymbol(GV); - EOL(Twine("TypeInfo ") + Twine(Iter--)); + EOL("TypeInfo"); } else { O << "0x0"; EOL(""); @@ -923,6 +922,7 @@ } // Emit the Exception Specifications. + if (FilterIds.size() != 0) EOL("-- Filter IDs --"); for (std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) { unsigned TypeID = *I; From sabre at nondot.org Tue Feb 9 19:04:17 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 01:04:17 -0000 Subject: [llvm-commits] [llvm] r95741 - in /llvm/trunk/include/llvm/CodeGen: MachineBasicBlock.h MachineFunction.h MachineInstr.h Message-ID: <201002100104.o1A14HDo009865@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 19:04:16 2010 New Revision: 95741 URL: http://llvm.org/viewvc/llvm-project?rev=95741&view=rev Log: Stop MachineInstr.h from #including AsmPrinter.h Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=95741&r1=95740&r2=95741&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Feb 9 19:04:16 2010 @@ -21,6 +21,9 @@ class BasicBlock; class MachineFunction; +class MCContext; +class MCSymbol; +class StringRef; class raw_ostream; template <> Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=95741&r1=95740&r2=95741&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Tue Feb 9 19:04:16 2010 @@ -33,6 +33,7 @@ class MachineFrameInfo; class MachineConstantPool; class MachineJumpTableInfo; +class Pass; class TargetMachine; class TargetRegisterClass; Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95741&r1=95740&r2=95741&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Feb 9 19:04:16 2010 @@ -19,7 +19,6 @@ #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/Target/TargetInstrDesc.h" #include "llvm/Target/TargetOpcodes.h" @@ -122,7 +121,7 @@ /// getAsmPrinterFlag - Return whether an AsmPrinter flag is set. /// - bool getAsmPrinterFlag(AsmPrinter::CommentFlag Flag) const { + bool getAsmPrinterFlag(unsigned Flag) const { return AsmPrinterFlags & Flag; } From sabre at nondot.org Tue Feb 9 19:05:28 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 01:05:28 -0000 Subject: [llvm-commits] [llvm] r95742 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp Message-ID: <201002100105.o1A15SP9009918@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 19:05:28 2010 New Revision: 95742 URL: http://llvm.org/viewvc/llvm-project?rev=95742&view=rev Log: daniel *really* likes fixups! Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95742&r1=95741&r2=95742&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 19:05:28 2010 @@ -552,6 +552,7 @@ OS << format("0x%02x", uint8_t(Code[i])); } OS << "]\n"; + return; } // If we are showing fixups, create symbolic markers in the encoded From clattner at apple.com Tue Feb 9 19:11:23 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 17:11:23 -0800 Subject: [llvm-commits] [llvm] r95739 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp SimpleRegisterCoalescing.cpp In-Reply-To: <201002100055.o1A0tgpH009442@zion.cs.uiuc.edu> References: <201002100055.o1A0tgpH009442@zion.cs.uiuc.edu> Message-ID: <3C62ACAA-9E23-43FF-911A-325C0D398494@apple.com> On Feb 9, 2010, at 4:55 PM, Dale Johannesen wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=95739&view=rev > Log: > Skip DBG_VALUE many places in live intervals and > register coalescing. This fixes many crashes and > places where debug info affects codegen (when > dbg.value is lowered to machine instructions, which > it isn't yet in TOT). Ok. > + MachineBasicBlock::iterator E = MBB->end(); > + while (mi != E) { > + if (!mi->isDebugValue()) { Can't this use continue like this: if (!mi->isDebugValue()) { ++mi; continue; } ? -Chris > + if (mi->killsRegister(interval.reg, tri_)) { > + DEBUG(dbgs() << " killed"); > + end = baseIndex.getDefIndex(); > + SeenDefUse = true; > + break; > + } else if (mi->modifiesRegister(interval.reg, tri_)) { > + // Another instruction redefines the register before it is > ever read. > + // Then the register is essentially dead at the instruction > that defines > + // it. Hence its interval is: > + // [defSlot(def), defSlot(def)+1) > + DEBUG(dbgs() << " dead"); > + end = start.getStoreIndex(); > + SeenDefUse = true; > + break; > + } > + } > From dalej at apple.com Tue Feb 9 19:15:18 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 9 Feb 2010 17:15:18 -0800 Subject: [llvm-commits] [llvm] r95739 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp SimpleRegisterCoalescing.cpp In-Reply-To: <3C62ACAA-9E23-43FF-911A-325C0D398494@apple.com> References: <201002100055.o1A0tgpH009442@zion.cs.uiuc.edu> <3C62ACAA-9E23-43FF-911A-325C0D398494@apple.com> Message-ID: <10F09684-3595-4366-B041-41B66BF5F992@apple.com> On Feb 9, 2010, at 5:11 PMPST, Chris Lattner wrote: > On Feb 9, 2010, at 4:55 PM, Dale Johannesen wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=95739&view=rev >> Log: >> Skip DBG_VALUE many places in live intervals and >> register coalescing. This fixes many crashes and >> places where debug info affects codegen (when >> dbg.value is lowered to machine instructions, which >> it isn't yet in TOT). > > Ok. > >> + MachineBasicBlock::iterator E = MBB->end(); >> + while (mi != E) { >> + if (!mi->isDebugValue()) { > > Can't this use continue like this: > > if (!mi->isDebugValue()) { > ++mi; > continue; > } It could. I feel pretty strongly it's easier to read this way, but it's not worth arguing about. >> + if (mi->killsRegister(interval.reg, tri_)) { >> + DEBUG(dbgs() << " killed"); >> + end = baseIndex.getDefIndex(); >> + SeenDefUse = true; >> + break; >> + } else if (mi->modifiesRegister(interval.reg, tri_)) { >> + // Another instruction redefines the register before it is >> ever read. >> + // Then the register is essentially dead at the >> instruction that defines >> + // it. Hence its interval is: >> + // [defSlot(def), defSlot(def)+1) >> + DEBUG(dbgs() << " dead"); >> + end = start.getStoreIndex(); >> + SeenDefUse = true; >> + break; >> + } >> + } >> > From sabre at nondot.org Tue Feb 9 19:17:37 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 01:17:37 -0000 Subject: [llvm-commits] [llvm] r95745 - in /llvm/trunk/lib/CodeGen: CalcSpillWeights.cpp MachineSSAUpdater.cpp VirtRegRewriter.cpp Message-ID: <201002100117.o1A1HbEW010480@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 19:17:36 2010 New Revision: 95745 URL: http://llvm.org/viewvc/llvm-project?rev=95745&view=rev Log: fix missing #includes. Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=95745&r1=95744&r2=95745&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Tue Feb 9 19:17:36 2010 @@ -21,7 +21,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetRegisterInfo.h" - +#include "llvm/Target/TargetMachine.h" using namespace llvm; char CalculateSpillWeights::ID = 0; Modified: llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp?rev=95745&r1=95744&r2=95745&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSSAUpdater.cpp Tue Feb 9 19:17:36 2010 @@ -20,6 +20,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=95745&r1=95744&r2=95745&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 9 19:17:36 2010 @@ -10,6 +10,7 @@ #define DEBUG_TYPE "virtregrewriter" #include "VirtRegRewriter.h" #include "llvm/Function.h" +#include "llvm/CodeGen/AsmPrinter.h" // FIXME: Layering! #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" From evan.cheng at apple.com Tue Feb 9 19:21:02 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 10 Feb 2010 01:21:02 -0000 Subject: [llvm-commits] [llvm] r95746 - in /llvm/trunk/lib/CodeGen: CalcSpillWeights.cpp SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <201002100121.o1A1L3Xo010659@zion.cs.uiuc.edu> Author: evancheng Date: Tue Feb 9 19:21:02 2010 New Revision: 95746 URL: http://llvm.org/viewvc/llvm-project?rev=95746&view=rev Log: Emit an error for illegal inline asm constraint (which uses illegal type) rather than asserting. Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=95746&r1=95745&r2=95746&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Tue Feb 9 19:21:02 2010 @@ -20,6 +20,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" using namespace llvm; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95746&r1=95745&r2=95746&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Feb 9 19:21:02 2010 @@ -131,6 +131,17 @@ } } + /// areValueTypesLegal - Return true if types of all the values are legal. + bool areValueTypesLegal() { + for (unsigned Value = 0, e = ValueVTs.size(); Value != e; ++Value) { + EVT RegisterVT = RegVTs[Value]; + if (!TLI->isTypeLegal(RegisterVT)) + return false; + } + return true; + } + + /// append - Add the specified values to this one. void append(const RegsForValue &RHS) { TLI = RHS.TLI; @@ -5515,7 +5526,8 @@ "Don't know how to handle indirect register inputs yet!"); // Copy the input into the appropriate registers. - if (OpInfo.AssignedRegs.Regs.empty()) { + if (OpInfo.AssignedRegs.Regs.empty() || + !OpInfo.AssignedRegs.areValueTypesLegal()) { llvm_report_error("Couldn't allocate input reg for" " constraint '"+ OpInfo.ConstraintCode +"'!"); } From evan.cheng at apple.com Tue Feb 9 19:22:58 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 10 Feb 2010 01:22:58 -0000 Subject: [llvm-commits] [llvm] r95747 - /llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Message-ID: <201002100122.o1A1MwAO010758@zion.cs.uiuc.edu> Author: evancheng Date: Tue Feb 9 19:22:57 2010 New Revision: 95747 URL: http://llvm.org/viewvc/llvm-project?rev=95747&view=rev Log: Remove duplicated #include. Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=95747&r1=95746&r2=95747&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Tue Feb 9 19:22:57 2010 @@ -22,7 +22,6 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegisterInfo.h" -#include "llvm/Target/TargetMachine.h" using namespace llvm; char CalculateSpillWeights::ID = 0; From sabre at nondot.org Tue Feb 9 19:23:18 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 01:23:18 -0000 Subject: [llvm-commits] [llvm] r95748 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/CodeGen/MachineInstr.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/VirtRegRewriter.cpp Message-ID: <201002100123.o1A1NI04010784@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 19:23:18 2010 New Revision: 95748 URL: http://llvm.org/viewvc/llvm-project?rev=95748&view=rev Log: fix a layering violation: VirtRegRewriter.cpp shouldn't use AsmPrinter.h. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=95748&r1=95747&r2=95748&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Feb 9 19:23:18 2010 @@ -80,13 +80,6 @@ DwarfWriter *DW; public: - /// Flags to specify different kinds of comments to output in - /// assembly code. These flags carry semantic information not - /// otherwise easily derivable from the IR text. - /// - enum CommentFlag { - ReloadReuse = 0x1 - }; /// Output stream on which we're printing assembly code. /// Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95748&r1=95747&r2=95748&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Feb 9 19:23:18 2010 @@ -41,6 +41,14 @@ public: typedef MachineMemOperand **mmo_iterator; + /// Flags to specify different kinds of comments to output in + /// assembly code. These flags carry semantic information not + /// otherwise easily derivable from the IR text. + /// + enum CommentFlag { + ReloadReuse = 0x1 + }; + private: const TargetInstrDesc *TID; // Instruction descriptor. unsigned short NumImplicitOps; // Number of implicit operands (which @@ -121,14 +129,14 @@ /// getAsmPrinterFlag - Return whether an AsmPrinter flag is set. /// - bool getAsmPrinterFlag(unsigned Flag) const { + bool getAsmPrinterFlag(CommentFlag Flag) const { return AsmPrinterFlags & Flag; } /// setAsmPrinterFlag - Set a flag for the AsmPrinter. /// - void setAsmPrinterFlag(unsigned short Flag) { - AsmPrinterFlags |= Flag; + void setAsmPrinterFlag(CommentFlag Flag) { + AsmPrinterFlags |= (unsigned short)Flag; } /// getDebugLoc - Returns the debug location id of this MachineInstr. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95748&r1=95747&r2=95748&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 9 19:23:18 2010 @@ -375,7 +375,7 @@ unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { - if (MI.getAsmPrinterFlag(AsmPrinter::ReloadReuse)) + if (MI.getAsmPrinterFlag(MachineInstr::ReloadReuse)) CommentOS << " Reload Reuse\n"; } } Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=95748&r1=95747&r2=95748&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 9 19:23:18 2010 @@ -10,7 +10,6 @@ #define DEBUG_TYPE "virtregrewriter" #include "VirtRegRewriter.h" #include "llvm/Function.h" -#include "llvm/CodeGen/AsmPrinter.h" // FIXME: Layering! #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -1760,7 +1759,7 @@ // Mark is killed. MachineInstr *CopyMI = prior(InsertLoc); - CopyMI->setAsmPrinterFlag(AsmPrinter::ReloadReuse); + CopyMI->setAsmPrinterFlag(MachineInstr::ReloadReuse); MachineOperand *KillOpnd = CopyMI->findRegisterUseOperand(InReg); KillOpnd->setIsKill(); UpdateKills(*CopyMI, TRI, RegKills, KillOps); @@ -2038,7 +2037,7 @@ TII->copyRegToReg(MBB, InsertLoc, DesignatedReg, PhysReg, RC, RC); MachineInstr *CopyMI = prior(InsertLoc); - CopyMI->setAsmPrinterFlag(AsmPrinter::ReloadReuse); + CopyMI->setAsmPrinterFlag(MachineInstr::ReloadReuse); UpdateKills(*CopyMI, TRI, RegKills, KillOps); // This invalidates DesignatedReg. @@ -2167,7 +2166,7 @@ // virtual or needing to clobber any values if it's physical). NextMII = &MI; --NextMII; // backtrack to the copy. - NextMII->setAsmPrinterFlag(AsmPrinter::ReloadReuse); + NextMII->setAsmPrinterFlag(MachineInstr::ReloadReuse); // Propagate the sub-register index over. if (SubIdx) { DefMO = NextMII->findRegisterDefOperand(DestReg); From clattner at apple.com Tue Feb 9 19:25:12 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 17:25:12 -0800 Subject: [llvm-commits] [llvm] r95739 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp SimpleRegisterCoalescing.cpp In-Reply-To: <10F09684-3595-4366-B041-41B66BF5F992@apple.com> References: <201002100055.o1A0tgpH009442@zion.cs.uiuc.edu> <3C62ACAA-9E23-43FF-911A-325C0D398494@apple.com> <10F09684-3595-4366-B041-41B66BF5F992@apple.com> Message-ID: <44679141-A345-4FAC-AE16-2A88F4D4D37B@apple.com> On Feb 9, 2010, at 5:15 PM, Dale Johannesen wrote: > > On Feb 9, 2010, at 5:11 PMPST, Chris Lattner wrote: > >> On Feb 9, 2010, at 4:55 PM, Dale Johannesen wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=95739&view=rev >>> Log: >>> Skip DBG_VALUE many places in live intervals and >>> register coalescing. This fixes many crashes and >>> places where debug info affects codegen (when >>> dbg.value is lowered to machine instructions, which >>> it isn't yet in TOT). >> >> Ok. >> >>> + MachineBasicBlock::iterator E = MBB->end(); >>> + while (mi != E) { >>> + if (!mi->isDebugValue()) { >> >> Can't this use continue like this: >> >> if (!mi->isDebugValue()) { >> ++mi; >> continue; >> } > > It could. I feel pretty strongly it's easier to read this way, but > it's not worth arguing about. Please strive to reduce nesting, including in this case. -Chris > >>> + if (mi->killsRegister(interval.reg, tri_)) { >>> + DEBUG(dbgs() << " killed"); >>> + end = baseIndex.getDefIndex(); >>> + SeenDefUse = true; >>> + break; >>> + } else if (mi->modifiesRegister(interval.reg, tri_)) { >>> + // Another instruction redefines the register before it >>> is ever read. >>> + // Then the register is essentially dead at the >>> instruction that defines >>> + // it. Hence its interval is: >>> + // [defSlot(def), defSlot(def)+1) >>> + DEBUG(dbgs() << " dead"); >>> + end = start.getStoreIndex(); >>> + SeenDefUse = true; >>> + break; >>> + } >>> + } >>> >> > From daniel at zuster.org Tue Feb 9 19:26:09 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 9 Feb 2010 17:26:09 -0800 Subject: [llvm-commits] [llvm] r95723 - in /llvm/trunk/examples: CMakeLists.txt ExceptionDemo/ ExceptionDemo/CMakeLists.txt ExceptionDemo/ExceptionDemo.cpp ExceptionDemo/Makefile Makefile In-Reply-To: <201002092322.o19NMiQ3005105@zion.cs.uiuc.edu> References: <201002092322.o19NMiQ3005105@zion.cs.uiuc.edu> Message-ID: <6a8523d61002091726q69844076j6bce6dee3a3f3500@mail.gmail.com> Hi Garrison, Can you change the CMake files to make sure this example doesn't try and get built on Windows? See here: http://google1.osuosl.org:8011/builders/clang-i686-xp-msvc9/builds/3779 - Daniel On Tue, Feb 9, 2010 at 3:22 PM, Garrison Venn wrote: > Author: gvenn > Date: Tue Feb ?9 17:22:43 2010 > New Revision: 95723 > > URL: http://llvm.org/viewvc/llvm-project?rev=95723&view=rev > Log: > Adds a JIT based exception handling example to the examples directory. > Both zero cost example domain specific, and C++ foreign exception handling are > shown. The example's documentation fully explains how to run the example. > > Notes: > > 1) ? The code uses an extremely simple type info model. > 2) ? Only a single landing pad is used per unwind edge > ? ? (one call to llvm.eh.selector) > 3) ? llvm.eh.selector support for filter arguments is not given. > 4) ? llvm.eh.typeid.for is not used. > 5) ? Forced unwind behavior is not supported. > 6) ? Very little if any error handling is given. > 7) ? __attribute__((__aligned__)) is used. > 8) ? The code uses parts from the llvm compiler-rt project and > ? ? the llvm Kaleidoscope example. > 9) ? The code has not been ported or tested on WINDOWS. > 10) ?The code was not tested with a cmake build. > 11) ?The code was tested for a debug build on 32bit X86 CentOS LINUX, > ? ? and both a debug and release build on OS X 10.6.2 (64bit). > > Added: > ? ?llvm/trunk/examples/ExceptionDemo/ > ? ?llvm/trunk/examples/ExceptionDemo/CMakeLists.txt > ? ?llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp > ? ?llvm/trunk/examples/ExceptionDemo/Makefile > Modified: > ? ?llvm/trunk/examples/CMakeLists.txt > ? ?llvm/trunk/examples/Makefile > > Modified: llvm/trunk/examples/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=95723&r1=95722&r2=95723&view=diff > > ============================================================================== > --- llvm/trunk/examples/CMakeLists.txt (original) > +++ llvm/trunk/examples/CMakeLists.txt Tue Feb ?9 17:22:43 2010 > @@ -3,6 +3,7 @@ > ?add_subdirectory(HowToUseJIT) > ?add_subdirectory(Kaleidoscope) > ?add_subdirectory(ModuleMaker) > +add_subdirectory(ExceptionDemo) > > ?include(CheckIncludeFile) > ?check_include_file(pthread.h HAVE_PTHREAD_H) > > Added: llvm/trunk/examples/ExceptionDemo/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/CMakeLists.txt?rev=95723&view=auto > > ============================================================================== > --- llvm/trunk/examples/ExceptionDemo/CMakeLists.txt (added) > +++ llvm/trunk/examples/ExceptionDemo/CMakeLists.txt Tue Feb ?9 17:22:43 2010 > @@ -0,0 +1,5 @@ > +set(LLVM_LINK_COMPONENTS jit nativecodegen) > + > +add_llvm_example(ExceptionDemo > + ?ExceptionDemo.cpp > + ?) > > Added: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=95723&view=auto > > ============================================================================== > --- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (added) > +++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Feb ?9 17:22:43 2010 > @@ -0,0 +1,2028 @@ > +//===-- examples/ExceptionDemo/ExceptionDemo.cpp - > +// ? ? ? ? ? ? ? ? ? ? ?An example use of the llvm Exception mechanism --===// > +// > +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===--------------------------------------------------------------------===// > +// > +// Demo program which implements an example LLVM exception implementation, and > +// shows several test cases including the handling of foreign exceptions. > +// It is run with type info types arguments to throw. A test will > +// be run for each given type info type. While type info types with the value > +// of -1 will trigger a foreign C++ exception to be thrown; type info types > +// <= 6 and >= 1 will cause the associated generated exceptions to be thrown > +// and caught by generated test functions; and type info types > 6 > +// will result in exceptions which pass through to the test harness. All other > +// type info types are not supported and could cause a crash. In all cases, > +// the "finally" blocks of every generated test functions will executed > +// regardless of whether or not that test function ignores or catches the > +// thrown exception. > +// > +// examples: > +// > +// ExceptionDemo > +// > +// ? ? causes a usage to be printed to stderr > +// > +// ExceptionDemo 2 3 7 -1 > +// > +// ? ? results in the following cases: > +// ? ? ? ? - Value 2 causes an exception with a type info type of 2 to be > +// ? ? ? ? ? thrown and caught by an inner generated test function. > +// ? ? ? ? - Value 3 causes an exception with a type info type of 3 to be > +// ? ? ? ? ? thrown and caught by an outer generated test function. > +// ? ? ? ? - Value 7 causes an exception with a type info type of 7 to be > +// ? ? ? ? ? thrown and NOT be caught by any generated function. > +// ? ? ? ? - Value -1 causes a foreign C++ exception to be thrown and not be > +// ? ? ? ? ? caught by any generated function > +// > +// ? ? Cases -1 and 7 are caught by a C++ test harness where the validity of > +// ? ? ? ? of a C++ catch(...) clause catching a generated exception with a > +// ? ? ? ? type info type of 7 is questionable. > +// > +// This code uses code from the llvm compiler-rt project and the llvm > +// Kaleidoscope project. > +// > +//===--------------------------------------------------------------------===// > + > + > +#include "llvm/LLVMContext.h" > +#include "llvm/DerivedTypes.h" > +#include "llvm/ExecutionEngine/ExecutionEngine.h" > +#include "llvm/ExecutionEngine/JIT.h" > +#include "llvm/Module.h" > +#include "llvm/PassManager.h" > +#include "llvm/Intrinsics.h" > +#include "llvm/Analysis/Verifier.h" > +#include "llvm/Target/TargetData.h" > +#include "llvm/Target/TargetSelect.h" > +#include "llvm/Target/TargetOptions.h" > +#include "llvm/Transforms/Scalar.h" > +#include "llvm/Support/IRBuilder.h" > +#include "llvm/Support/Dwarf.h" > + > +#include > +#include > +#include > +#include > +#include > +#include > + > + > +#ifndef USE_GLOBAL_STR_CONSTS > +#define USE_GLOBAL_STR_CONSTS true > +#endif > + > +// System C++ ABI unwind types from: > +// ? ? http://refspecs.freestandards.org/abi-eh-1.21.html > + > +extern "C" { > + > +typedef enum { > + ? ?_URC_NO_REASON = 0, > + ? ?_URC_FOREIGN_EXCEPTION_CAUGHT = 1, > + ? ?_URC_FATAL_PHASE2_ERROR = 2, > + ? ?_URC_FATAL_PHASE1_ERROR = 3, > + ? ?_URC_NORMAL_STOP = 4, > + ? ?_URC_END_OF_STACK = 5, > + ? ?_URC_HANDLER_FOUND = 6, > + ? ?_URC_INSTALL_CONTEXT = 7, > + ? ?_URC_CONTINUE_UNWIND = 8 > +} _Unwind_Reason_Code; > + > +typedef enum { > + ? ?_UA_SEARCH_PHASE = 1, > + ? ?_UA_CLEANUP_PHASE = 2, > + ? ?_UA_HANDLER_FRAME = 4, > + ? ?_UA_FORCE_UNWIND = 8, > + ? ?_UA_END_OF_STACK = 16 > +} _Unwind_Action; > + > +struct _Unwind_Exception; > + > +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception *); > + > +struct _Unwind_Exception { > + ? ?uint64_t exception_class; > + ? ?_Unwind_Exception_Cleanup_Fn exception_cleanup; > + > + ? ?uintptr_t private_1; > + ? ?uintptr_t private_2; > + > + ? ?// @@@ The IA-64 ABI says that this structure must be double-word aligned. > + ? ?// ?Taking that literally does not make much sense generically. ?Instead > + ? ?// ?we provide the maximum alignment required by any type for the machine. > +} __attribute__((__aligned__)); > + > +struct _Unwind_Context; > +typedef struct _Unwind_Context* _Unwind_Context_t; > + > +extern const uint8_t* _Unwind_GetLanguageSpecificData (_Unwind_Context_t c); > +extern uintptr_t _Unwind_GetGR (_Unwind_Context_t c, int i); > +extern void _Unwind_SetGR (_Unwind_Context_t c, int i, uintptr_t n); > +extern void _Unwind_SetIP (_Unwind_Context_t, uintptr_t new_value); > +extern uintptr_t _Unwind_GetIP (_Unwind_Context_t context); > +extern uintptr_t _Unwind_GetRegionStart (_Unwind_Context_t context); > + > +} // extern "C" > + > +// > +// Example types > +// > + > +/// This is our simplistic type info > +struct OurExceptionType_t { > + ? ?/// type info type > + ? ?int type; > +}; > + > + > +/// This is our Exception class which relies on a negative offset to calculate > +/// pointers to its instances from pointers to its unwindException member. > +/// > +/// Note: The above unwind.h defines struct _Unwind_Exception to be aligned > +/// ? ? ? on a double word boundary. This is necessary to match the standard: > +/// ? ? ? http://refspecs.freestandards.org/abi-eh-1.21.html > +struct OurBaseException_t { > + ? ?struct OurExceptionType_t type; > + > + ? ?// Note: This is properly aligned in unwind.h > + ? ?struct _Unwind_Exception unwindException; > +}; > + > + > +// Note: Not needed since we are C++ > +typedef struct OurBaseException_t OurException; > +typedef struct _Unwind_Exception OurUnwindException; > + > +// > +// Various globals used to support typeinfo and generatted exceptions in > +// general > +// > + > +static std::map namedValues; > + > +int64_t ourBaseFromUnwindOffset; > + > +const unsigned char ourBaseExcpClassChars[] = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{'o', 'b', 'j', '\0', 'b', 'a', 's', '\0'}; > + > + > +static uint64_t ourBaseExceptionClass = 0; > + > +static std::vector ourTypeInfoNames; > +static std::map ourTypeInfoNamesIndex; > + > +static llvm::StructType* ourTypeInfoType; > +static llvm::StructType* ourExceptionType; > +static llvm::StructType* ourUnwindExceptionType; > + > +static llvm::ConstantInt* ourExceptionNotThrownState; > +static llvm::ConstantInt* ourExceptionThrownState; > +static llvm::ConstantInt* ourExceptionCaughtState; > + > +typedef std::vector ArgNames; > +typedef std::vector ArgTypes; > + > +// > +// Code Generation Utilities > +// > + > +/// Utility used to create a function, both declarations and definitions > +/// @param module for module instance > +/// @param retType function return type > +/// @param theArgTypes function's ordered argument types > +/// @param theArgNames function's ordered arguments needed if use of this > +/// ? ? ? ?function corresponds to a function definition. Use empty > +/// ? ? ? ?aggregate for function declarations. > +/// @param functName function name > +/// @param linkage function linkage > +/// @param declarationOnly for function declarations > +/// @param isVarArg function uses vararg arguments > +/// @returns function instance > +llvm::Function *createFunction(llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const llvm::Type* retType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const ArgTypes& theArgTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const ArgNames& theArgNames, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const std::string& functName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkageTypes linkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool declarationOnly, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isVarArg) { > + ? ?llvm::FunctionType* functType = llvm::FunctionType::get(retType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?theArgTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isVarArg); > + ? ?llvm::Function* ret = llvm::Function::Create(functType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? linkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? functName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &module); > + ? ?if (!ret || declarationOnly) > + ? ? ? ?return(ret); > + > + ? ?namedValues.clear(); > + ? ?unsigned i = 0; > + ? ?for (llvm::Function::arg_iterator argIndex = ret->arg_begin(); > + ? ? ? ? i != theArgNames.size(); > + ? ? ? ? ++argIndex, ++i) { > + > + ? ? ? ?argIndex->setName(theArgNames[i]); > + ? ? ? ?namedValues[theArgNames[i]] = argIndex; > + ? ?} > + > + ? ?return(ret); > +} > + > + > +/// Create an alloca instruction in the entry block of > +/// the parent function. ?This is used for mutable variables etc. > +/// @param function parent instance > +/// @param varName stack variable name > +/// @param type stack variable type > +/// @param initWith optional constant initialization value > +/// @returns AllocaInst instance > +static llvm::AllocaInst *createEntryBlockAlloca(llvm::Function& function, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const std::string &varName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const llvm::Type* type, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Constant* initWith = NULL) { > + ? ?llvm::BasicBlock& block = function.getEntryBlock(); > + ? ?llvm::IRBuilder<> tmp(&block, block.begin()); > + ? ?llvm::AllocaInst* ret = tmp.CreateAlloca(type, 0, varName.c_str()); > + > + ? ?if (initWith) > + ? ? ? ?tmp.CreateStore(initWith, ret); > + > + ? ?return(ret); > +} > + > + > +// > +// Code Generation Utilities End > +// > + > +// > +// Runtime C Library functions > +// > + > +// Note: using an extern "C" block so that static functions can be used > +extern "C" { > + > +// Note: Better ways to decide on bit width > +// > +/// Prints a 32 bit number, according to the format, to stderr. > +/// @param intToPrint integer to print > +/// @param format printf like format to use when printing > +void print32Int(int intToPrint, const char* format) { > + ? ?if (format) { > + ? ? ? ?// Note: No NULL check > + ? ? ? ?fprintf(stderr, format, intToPrint); > + ? ?} > + ? ?else { > + ? ? ? ?// Note: No NULL check > + ? ? ? ?fprintf(stderr, "::print32Int(...):NULL arg.\n"); > + ? ?} > +} > + > + > +// Note: Better ways to decide on bit width > +// > +/// Prints a 64 bit number, according to the format, to stderr. > +/// @param intToPrint integer to print > +/// @param format printf like format to use when printing > +void print64Int(long int intToPrint, const char* format) { > + ? ?if (format) { > + ? ? ? ?// Note: No NULL check > + ? ? ? ?fprintf(stderr, format, intToPrint); > + ? ?} > + ? ?else { > + ? ? ? ?// Note: No NULL check > + ? ? ? ?fprintf(stderr, "::print64Int(...):NULL arg.\n"); > + ? ?} > +} > + > + > +/// Prints a C string to stderr > +/// @param toPrint string to print > +void printStr(char* toPrint) { > + ? ?if (toPrint) { > + ? ? ? ?fprintf(stderr, "%s", toPrint); > + ? ?} > + ? ?else { > + ? ? ? ?fprintf(stderr, "::printStr(...):NULL arg.\n"); > + ? ?} > +} > + > + > +/// Deletes the true previosly allocated exception whose address > +/// is calculated from the supplied OurBaseException_t::unwindException > +/// member address. Handles (ignores), NULL pointers. > +/// @param expToDelete exception to delete > +void deleteOurException(OurUnwindException* expToDelete) { > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"deleteOurException(...).\n"); > +#endif > + > + ? ?if (expToDelete && > + ? ? ? ?(expToDelete->exception_class == ourBaseExceptionClass)) { > + > + ? ? ? ?free(((char*) expToDelete) + ourBaseFromUnwindOffset); > + ? ?} > +} > + > + > +/// This function is the struct _Unwind_Exception API mandated delete function > +/// used by foreign exception handlers when deleting our exception > +/// (OurException), instances. > +/// @param reason @link http://refspecs.freestandards.org/abi-eh-1.21.html > +/// @unlink > +/// @param expToDelete exception instance to delete > +void deleteFromUnwindOurException(_Unwind_Reason_Code reason, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OurUnwindException* expToDelete) { > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"deleteFromUnwindOurException(...).\n"); > +#endif > + > + ? ?deleteOurException(expToDelete); > +} > + > + > +/// Creates (allocates on the heap), an exception (OurException instance), > +/// of the supplied type info type. > +/// @param type type info type > +OurUnwindException* createOurException(int type) { > + ? ?size_t size = sizeof(OurException); > + ? ?OurException* ret = (OurException*) memset(malloc(size), 0, size); > + ? ?(ret->type).type = type; > + ? ?(ret->unwindException).exception_class = ourBaseExceptionClass; > + ? ?(ret->unwindException).exception_cleanup = deleteFromUnwindOurException; > + > + ? ?return(&(ret->unwindException)); > +} > + > + > +/// Read a uleb128 encoded value and advance pointer > +/// See Variable Length Data in: > +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink > +/// @param data reference variable holding memory pointer to decode from > +/// @returns decoded value > +static uintptr_t readULEB128(const uint8_t** data) { > + ? ?uintptr_t result = 0; > + ? ?uintptr_t shift = 0; > + ? ?unsigned char byte; > + ? ?const uint8_t* p = *data; > + > + ? ?do { > + ? ? ? ?byte = *p++; > + ? ? ? ?result |= (byte & 0x7f) << shift; > + ? ? ? ?shift += 7; > + ? ?} > + ? ?while (byte & 0x80); > + > + ? ?*data = p; > + > + ? ?return result; > +} > + > + > +/// Read a sleb128 encoded value and advance pointer > +/// See Variable Length Data in: > +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink > +/// @param data reference variable holding memory pointer to decode from > +/// @returns decoded value > +static uintptr_t readSLEB128(const uint8_t** data) { > + ? ?uintptr_t result = 0; > + ? ?uintptr_t shift = 0; > + ? ?unsigned char byte; > + ? ?const uint8_t* p = *data; > + > + ? ?do { > + ? ? ? ?byte = *p++; > + ? ? ? ?result |= (byte & 0x7f) << shift; > + ? ? ? ?shift += 7; > + ? ?} > + ? ?while (byte & 0x80); > + > + ? ?*data = p; > + > + ? ?if ((byte & 0x40) && (shift < (sizeof(result) << 3))) { > + ? ? ? ?result |= (~0 << shift); > + ? ?} > + > + ? ?return result; > +} > + > + > +/// Read a pointer encoded value and advance pointer > +/// See Variable Length Data in: > +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink > +/// @param data reference variable holding memory pointer to decode from > +/// @param encoding dwarf encoding type > +/// @returns decoded value > +static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { > + ? ?uintptr_t result = 0; > + ? ?const uint8_t* p = *data; > + > + ? ?if (encoding == llvm::dwarf::DW_EH_PE_omit) > + ? ? ? ?return(result); > + > + ? ?// first get value > + ? ?switch (encoding & 0x0F) { > + ? ? ? ?case llvm::dwarf::DW_EH_PE_absptr: > + ? ? ? ? ? ?result = *((uintptr_t*)p); > + ? ? ? ? ? ?p += sizeof(uintptr_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_uleb128: > + ? ? ? ? ? ?result = readULEB128(&p); > + ? ? ? ? ? ?break; > + ? ? ? ?// Note: This case has not been tested > + ? ? ? ?case llvm::dwarf::DW_EH_PE_sleb128: > + ? ? ? ? ? ?result = readSLEB128(&p); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata2: > + ? ? ? ? ? ?result = *((uint16_t*)p); > + ? ? ? ? ? ?p += sizeof(uint16_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata4: > + ? ? ? ? ? ?result = *((uint32_t*)p); > + ? ? ? ? ? ?p += sizeof(uint32_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata8: > + ? ? ? ? ? ?result = *((uint64_t*)p); > + ? ? ? ? ? ?p += sizeof(uint64_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata2: > + ? ? ? ? ? ?result = *((int16_t*)p); > + ? ? ? ? ? ?p += sizeof(int16_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata4: > + ? ? ? ? ? ?result = *((int32_t*)p); > + ? ? ? ? ? ?p += sizeof(int32_t); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata8: > + ? ? ? ? ? ?result = *((int64_t*)p); > + ? ? ? ? ? ?p += sizeof(int64_t); > + ? ? ? ? ? ?break; > + ? ? ? ?default: > + ? ? ? ? ? ?// not supported > + ? ? ? ? ? ?abort(); > + ? ? ? ? ? ?break; > + ? ?} > + > + ? ?// then add relative offset > + ? ?switch (encoding & 0x70) { > + ? ? ? ?case llvm::dwarf::DW_EH_PE_absptr: > + ? ? ? ? ? ?// do nothing > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_pcrel: > + ? ? ? ? ? ?result += (uintptr_t)(*data); > + ? ? ? ? ? ?break; > + ? ? ? ?case llvm::dwarf::DW_EH_PE_textrel: > + ? ? ? ?case llvm::dwarf::DW_EH_PE_datarel: > + ? ? ? ?case llvm::dwarf::DW_EH_PE_funcrel: > + ? ? ? ?case llvm::dwarf::DW_EH_PE_aligned: > + ? ? ? ?default: > + ? ? ? ? ? ?// not supported > + ? ? ? ? ? ?abort(); > + ? ? ? ? ? ?break; > + ? ?} > + > + ? ?// then apply indirection > + ? ?if (encoding & llvm::dwarf::DW_EH_PE_indirect) { > + ? ? ? ?result = *((uintptr_t*)result); > + ? ?} > + > + ? ?*data = p; > + > + ? ?return result; > +} > + > + > +/// Deals with Dwarf actions matching our type infos > +/// (OurExceptionType_t instances). Returns whether or not a dwarf emitted > +/// action matches the supplied exception type. If such a match succeeds, > +/// the resultAction argument will be set with > 0 index value. Only > +/// corresponding llvm.eh.selector type info arguments, cleanup arguments > +/// are supported. Filters are not supported. > +/// See Variable Length Data in: > +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink > +/// Also see @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink > +/// @param resultAction reference variable which will be set with result > +/// @param classInfo our array of type info pointers (to globals) > +/// @param actionEntry index into above type info array or 0 (clean up). > +/// ? ? ? ?We do not support filters. > +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) > +/// ? ? ? ?of thrown exception. > +/// @param exceptionObject thrown _Unwind_Exception instance. > +/// @returns whether or not a type info was found. False is returned if only > +/// ? ? ? ? ?a cleanup was found > +static bool handleActionValue(int64_t *resultAction, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct OurExceptionType_t **classInfo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uintptr_t actionEntry, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint64_t exceptionClass, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception *exceptionObject) { > + ? ?bool ret = false; > + > + ? ?if (!resultAction || > + ? ? ? ?!exceptionObject || > + ? ? ? ?(exceptionClass != ourBaseExceptionClass)) > + ? ? ? ?return(ret); > + > + ? ?struct OurBaseException_t* excp = (struct OurBaseException_t*) > + ? ? ? ? ? ? ? ? ? ? ? ?(((char*) exceptionObject) + ourBaseFromUnwindOffset); > + ? ?struct OurExceptionType_t *excpType = &(excp->type); > + ? ?int type = excpType->type; > + > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"handleActionValue(...): exceptionObject = <%p>, " > + ? ? ? ? ? ? ? ?"excp = <%p>.\n", > + ? ? ? ? ? ?exceptionObject, > + ? ? ? ? ? ?excp); > +#endif > + > + ? ?const uint8_t *actionPos = (uint8_t*) actionEntry, > + ? ? ? ? ? ? ? ? ?*tempActionPos; > + ? ?int64_t typeOffset = 0, > + ? ? ? ? ? ?actionOffset; > + > + ? ?for (int i = 0; true; ++i) { > + ? ? ? ?// Each emitted dwarf action corresponds to a 2 tuple of > + ? ? ? ?// type info address offset, and action offset to the next > + ? ? ? ?// emitted action. > + ? ? ? ?typeOffset = readSLEB128(&actionPos); > + ? ? ? ?tempActionPos = actionPos; > + ? ? ? ?actionOffset = readSLEB128(&tempActionPos); > + > +#ifdef DEBUG > + ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ?"handleActionValue(...):typeOffset: <%lld>, " > + ? ? ? ? ? ? ? ? ? ?"actionOffset: <%lld>.\n", > + ? ? ? ? ? ? ? ?typeOffset, > + ? ? ? ? ? ? ? ?actionOffset); > +#endif > + ? ? ? ?assert((typeOffset >= 0) && > + ? ? ? ? ? ? ? "handleActionValue(...):filters are not supported."); > + > + ? ? ? ?// Note: A typeOffset == 0 implies that a cleanup llvm.eh.selector > + ? ? ? ?// ? ? ? argument has been matched. > + ? ? ? ?if ((typeOffset > 0) && > + ? ? ? ? ? ?(type == (classInfo[-typeOffset])->type)) { > +#ifdef DEBUG > + ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ?"handleActionValue(...):actionValue <%d> found.\n", > + ? ? ? ? ? ? ? ? ? ?i); > +#endif > + ? ? ? ? ? ?*resultAction = i + 1; > + ? ? ? ? ? ?ret = true; > + ? ? ? ? ? ?break; > + ? ? ? ?} > + > +#ifdef DEBUG > + ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ?"handleActionValue(...):actionValue not found.\n"); > +#endif > + ? ? ? ?if (!actionOffset) > + ? ? ? ? ? ?break; > + > + ? ? ? ?actionPos += actionOffset; > + ? ?} > + > + ? ?return(ret); > +} > + > + > +/// Deals with the Language specific data portion of the emitted dwarf code. > +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink > +/// @param version unsupported (ignored), unwind version > +/// @param lsda language specific data area > +/// @param _Unwind_Action actions minimally supported unwind stage > +/// ? ? ? ?(forced specifically not supported) > +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) > +/// ? ? ? ?of thrown exception. > +/// @param exceptionObject thrown _Unwind_Exception instance. > +/// @param context unwind system context > +/// @returns minimally supported unwinding control indicator > +static _Unwind_Reason_Code handleLsda(int version, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const uint8_t* lsda, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_Action actions, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint64_t exceptionClass, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception* exceptionObject, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_Context_t context) { > + ? ?_Unwind_Reason_Code ret = _URC_CONTINUE_UNWIND; > + > + ? ?if (!lsda) > + ? ? ? ?return(ret); > + > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"handleLsda(...):lsda is non-zero.\n"); > +#endif > + > + ? ?// Get the current instruction pointer and offset it before next > + ? ?// instruction in the current frame which threw the exception. > + ? ?uintptr_t pc = _Unwind_GetIP(context)-1; > + > + ? ?// Get beginning current frame's code (as defined by the > + ? ?// emitted dwarf code) > + ? ?uintptr_t funcStart = _Unwind_GetRegionStart(context); > + ? ?uintptr_t pcOffset = pc - funcStart; > + ? ?struct OurExceptionType_t** classInfo = NULL; > + > + ? ?// Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding > + ? ?// ? ? ? dwarf emission > + > + ? ?// Parse LSDA header. > + ? ?uint8_t lpStartEncoding = *lsda++; > + > + ? ?if (lpStartEncoding != llvm::dwarf::DW_EH_PE_omit) { > + ? ? ? ?readEncodedPointer(&lsda, lpStartEncoding); > + ? ?} > + > + ? ?uint8_t ttypeEncoding = *lsda++; > + ? ?uintptr_t classInfoOffset; > + > + ? ?if (ttypeEncoding != llvm::dwarf::DW_EH_PE_omit) { > + ? ? ? ?// Calculate type info locations in emitted dwarf code which > + ? ? ? ?// were flagged by type info arguments to llvm.eh.selector > + ? ? ? ?// intrinsic > + ? ? ? ?classInfoOffset = readULEB128(&lsda); > + ? ? ? ?classInfo = (struct OurExceptionType_t**) (lsda + classInfoOffset); > + ? ?} > + > + ? ?// Walk call-site table looking for range that > + ? ?// includes current PC. > + > + ? ?uint8_t ? ? ? ? callSiteEncoding = *lsda++; > + ? ?uint32_t ? ? ? ?callSiteTableLength = readULEB128(&lsda); > + ? ?const uint8_t* ?callSiteTableStart = lsda; > + ? ?const uint8_t* ?callSiteTableEnd = callSiteTableStart + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteTableLength; > + ? ?const uint8_t* ?actionTableStart = callSiteTableEnd; > + ? ?const uint8_t* ?callSitePtr = callSiteTableStart; > + > + ? ?bool foreignException = false; > + > + ? ?while (callSitePtr < callSiteTableEnd) { > + ? ? ? ?uintptr_t start = readEncodedPointer(&callSitePtr, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? callSiteEncoding); > + ? ? ? ?uintptr_t length = readEncodedPointer(&callSitePtr, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteEncoding); > + ? ? ? ?uintptr_t landingPad = readEncodedPointer(&callSitePtr, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteEncoding); > + > + ? ? ? ?// Note: Action value > + ? ? ? ?uintptr_t actionEntry = readULEB128(&callSitePtr); > + > + ? ? ? ?if (exceptionClass != ourBaseExceptionClass) { > + ? ? ? ? ? ?// We have been notified of a foreign exception being thrown, > + ? ? ? ? ? ?// and we therefore need to execute cleanup landing pads > + ? ? ? ? ? ?actionEntry = 0; > + ? ? ? ? ? ?foreignException = true; > + ? ? ? ?} > + > + ? ? ? ?if (landingPad == 0) { > +#ifdef DEBUG > + ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ?"handleLsda(...): No landing pad found.\n"); > +#endif > + > + ? ? ? ? ? ?continue; // no landing pad for this entry > + ? ? ? ?} > + > + ? ? ? ?if (actionEntry) { > + ? ? ? ? ? ?actionEntry += ((uintptr_t) actionTableStart) - 1; > + ? ? ? ?} > + ? ? ? ?else { > +#ifdef DEBUG > + ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ?"handleLsda(...):No action table found.\n"); > +#endif > + ? ? ? ?} > + > + ? ? ? ?bool exceptionMatched = false; > + > + ? ? ? ?if ((start <= pcOffset) && (pcOffset < (start + length))) { > +#ifdef DEBUG > + ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ?"handleLsda(...): Landing pad found.\n"); > +#endif > + ? ? ? ? ? ?int64_t actionValue = 0; > + > + ? ? ? ? ? ?if (actionEntry) { > + ? ? ? ? ? ? ? ?exceptionMatched = handleActionValue > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ( > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &actionValue, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? classInfo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? actionEntry, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionClass, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionObject > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ); > + ? ? ? ? ? ?} > + > + ? ? ? ? ? ?if (!(actions & _UA_SEARCH_PHASE)) { > +#ifdef DEBUG > + ? ? ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): installed landing pad " > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?"context.\n"); > +#endif > + > + ? ? ? ? ? ? ? ?// Found landing pad for the PC. > + ? ? ? ? ? ? ? ?// Set Instruction Pointer to so we re-enter function > + ? ? ? ? ? ? ? ?// at landing pad. The landing pad is created by the > + ? ? ? ? ? ? ? ?// compiler to take two parameters in registers. > + ? ? ? ? ? ? ? ?_Unwind_SetGR(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(0), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(uintptr_t)exceptionObject); > + > + ? ? ? ? ? ? ? ?// Note: this virtual register directly corresponds > + ? ? ? ? ? ? ? ?// ? ? ? to the return of the llvm.eh.selector intrinsic > + ? ? ? ? ? ? ? ?if (!actionEntry || !exceptionMatched) { > + ? ? ? ? ? ? ? ? ? ?// We indicate cleanup only > + ? ? ? ? ? ? ? ? ? ?_Unwind_SetGR(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(1), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0); > + ? ? ? ? ? ? ? ?} > + ? ? ? ? ? ? ? ?else { > + ? ? ? ? ? ? ? ? ? ?// Matched type info index of llvm.eh.selector intrinsic > + ? ? ? ? ? ? ? ? ? ?// passed here. > + ? ? ? ? ? ? ? ? ? ?_Unwind_SetGR(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(1), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?actionValue); > + ? ? ? ? ? ? ? ?} > + > + ? ? ? ? ? ? ? ?// To execute landing pad set here > + ? ? ? ? ? ? ? ?_Unwind_SetIP(context, funcStart + landingPad); > + ? ? ? ? ? ? ? ?ret = _URC_INSTALL_CONTEXT; > + ? ? ? ? ? ?} > + ? ? ? ? ? ?else if (exceptionMatched) { > +#ifdef DEBUG > + ? ? ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): setting handler found.\n"); > +#endif > + ? ? ? ? ? ? ? ?ret = _URC_HANDLER_FOUND; > + ? ? ? ? ? ?} > + ? ? ? ? ? ?else { > + ? ? ? ? ? ? ? ?// Note: Only non-clean up handlers are marked as > + ? ? ? ? ? ? ? ?// ? ? ? found. Otherwise the clean up handlers will be > + ? ? ? ? ? ? ? ?// ? ? ? re-found and executed during the clean up > + ? ? ? ? ? ? ? ?// ? ? ? phase. > +#ifdef DEBUG > + ? ? ? ? ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): cleanup handler found.\n"); > +#endif > + ? ? ? ? ? ?} > + > + ? ? ? ? ? ?break; > + ? ? ? ?} > + ? ?} > + > + ? ?return(ret); > +} > + > + > +/// This is the personality function which is embedded (dwarf emitted), in the > +/// dwarf unwind info block. Again see: JITDwarfEmitter.cpp. > +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink > +/// @param version unsupported (ignored), unwind version > +/// @param _Unwind_Action actions minimally supported unwind stage > +/// ? ? ? ?(forced specifically not supported) > +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) > +/// ? ? ? ?of thrown exception. > +/// @param exceptionObject thrown _Unwind_Exception instance. > +/// @param context unwind system context > +/// @returns minimally supported unwinding control indicator > +_Unwind_Reason_Code ourPersonality(int version, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _Unwind_Action actions, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint64_t exceptionClass, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct _Unwind_Exception* exceptionObject, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _Unwind_Context_t context) { > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"We are in ourPersonality(...):actions is <%d>.\n", > + ? ? ? ? ? ?actions); > + > + ? ?if (actions & _UA_SEARCH_PHASE) { > + ? ? ? ?fprintf(stderr, "ourPersonality(...):In search phase.\n"); > + ? ?} > + ? ?else { > + ? ? ? ?fprintf(stderr, "ourPersonality(...):In non-search phase.\n"); > + ? ?} > +#endif > + > + ? ?const uint8_t* lsda = (uint8_t*) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_GetLanguageSpecificData(context); > + > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"ourPersonality(...):lsda = <%p>.\n", > + ? ? ? ? ? ?lsda); > +#endif > + > + ? ?// The real work of the personality function is captured here > + ? ?return(handleLsda(version, > + ? ? ? ? ? ? ? ? ? ? ?lsda, > + ? ? ? ? ? ? ? ? ? ? ?actions, > + ? ? ? ? ? ? ? ? ? ? ?exceptionClass, > + ? ? ? ? ? ? ? ? ? ? ?exceptionObject, > + ? ? ? ? ? ? ? ? ? ? ?context)); > +} > + > + > +/// Generates our _Unwind_Exception class from a given character array. > +/// thereby handling arbitrary lengths (not in standard), and handling > +/// embedded \0s. > +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink > +/// @param classChars char array to encode. NULL values not checkedf > +/// @param classCharsSize number of chars in classChars. Value is not checked. > +/// @returns class value > +uint64_t genClass(const unsigned char classChars[], size_t classCharsSize) > +{ > + ? ?uint64_t ret = classChars[0]; > + > + ? ?for (unsigned i = 1; i < classCharsSize; ++i) { > + ? ? ? ?ret <<= 8; > + ? ? ? ?ret += classChars[i]; > + ? ?} > + > + ? ?return(ret); > +} > + > +} // extern "C" > + > +// > +// Runtime C Library functions End > +// > + > +// > +// Code generation functions > +// > + > +/// Generates code to print given constant string > +/// @param context llvm context > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param toPrint string to print > +/// @param useGlobal A value of true (default) indicates a GlobalValue is > +/// ? ? ? ?generated, and is used to hold the constant string. A value of > +/// ? ? ? ?false indicates that the constant string will be stored on the > +/// ? ? ? ?stack. > +void generateStringPrint(llvm::LLVMContext& context, > + ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? std::string toPrint, > + ? ? ? ? ? ? ? ? ? ? ? ? bool useGlobal = true) { > + ? ?llvm::Function *printFunct = module.getFunction("printStr"); > + > + ? ?llvm::Value *stringVar; > + ? ?llvm::Constant* stringConstant = > + ? ? ? ?llvm::ConstantArray::get(context, toPrint); > + > + ? ?if (useGlobal) { > + ? ? ? ?// Note: Does not work without allocation > + ? ? ? ?stringVar = > + ? ? ? ? ? ?new llvm::GlobalVariable(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant->getType(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkerPrivateLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ""); > + ? ?} > + ? ?else { > + ? ? ? ?stringVar = builder.CreateAlloca(stringConstant->getType()); > + ? ? ? ?builder.CreateStore(stringConstant, stringVar); > + ? ?} > + > + ? ?llvm::Value* cast = > + ? ? ? ?builder.CreatePointerCast(stringVar, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); > + ? ?builder.CreateCall(printFunct, cast); > +} > + > + > +/// Generates code to print given runtime integer according to constant > +/// string format, and a given print function. > +/// @param context llvm context > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param printFunct function used to "print" integer > +/// @param toPrint string to print > +/// @param format printf like formating string for print > +/// @param useGlobal A value of true (default) indicates a GlobalValue is > +/// ? ? ? ?generated, and is used to hold the constant string. A value of > +/// ? ? ? ?false indicates that the constant string will be stored on the > +/// ? ? ? ?stack. > +void generateIntegerPrint(llvm::LLVMContext& context, > + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Function& printFunct, > + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Value& toPrint, > + ? ? ? ? ? ? ? ? ? ? ? ? ?std::string format, > + ? ? ? ? ? ? ? ? ? ? ? ? ?bool useGlobal = true) { > + ? ?llvm::Constant *stringConstant = llvm::ConstantArray::get(context, format); > + ? ?llvm::Value *stringVar; > + > + ? ?if (useGlobal) { > + ? ? ? ?// Note: Does not seem to work without allocation > + ? ? ? ?stringVar = > + ? ? ? ? ? ?new llvm::GlobalVariable(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant->getType(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?true, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkerPrivateLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ""); > + ? ?} > + ? ?else { > + ? ? ? ?stringVar = builder.CreateAlloca(stringConstant->getType()); > + ? ? ? ?builder.CreateStore(stringConstant, stringVar); > + ? ?} > + > + ? ?llvm::Value* cast = > + ? ? ? ?builder.CreateBitCast(stringVar, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); > + ? ?builder.CreateCall2(&printFunct, &toPrint, cast); > +} > + > + > +/// Generates code to handle finally block type semantics: always runs > +/// regardless of whether a thrown exception is passing through or the > +/// parent function is simply exiting. In addition to printing some state > +/// to stderr, this code will resume the exception handling--runs the > +/// unwind resume block, if the exception has not been previously caught > +/// by a catch clause, and will otherwise execute the end block (terminator > +/// block). In addition this function creates the corresponding function's > +/// stack storage for the exception pointer and catch flag status. > +/// @param context llvm context > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param toAddTo parent function to add block to > +/// @param blockName block name of new "finally" block. > +/// @param functionId output id used for printing > +/// @param terminatorBlock terminator "end" block > +/// @param unwindResumeBlock unwind resume block > +/// @param exceptionCaughtFlag reference exception caught/thrown status storage > +/// @param exceptionStorage reference to exception pointer storage > +/// @returns newly created block > +static llvm::BasicBlock* createFinallyBlock(llvm::LLVMContext& context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function& toAddTo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string& blockName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string& functionId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::BasicBlock& terminatorBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::BasicBlock& unwindResumeBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Value** exceptionCaughtFlag, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Value** exceptionStorage) { > + ? ?assert(exceptionCaughtFlag && > + ? ? ? ? ? "ExceptionDemo::createFinallyBlock(...):exceptionCaughtFlag " > + ? ? ? ? ? ? ? "is NULL"); > + ? ?assert(exceptionStorage && > + ? ? ? ? ? "ExceptionDemo::createFinallyBlock(...):exceptionStorage " > + ? ? ? ? ? ? ? "is NULL"); > + > + ? ?*exceptionCaughtFlag = > + ? ? ? ?createEntryBlockAlloca(toAddTo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "exceptionCaught", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourExceptionNotThrownState->getType(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourExceptionNotThrownState); > + > + ? ?const llvm::PointerType* exceptionStorageType = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo(); > + ? ?*exceptionStorage = > + ? ? ? ?createEntryBlockAlloca(toAddTo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "exceptionStorage", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionStorageType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::ConstantPointerNull::get( > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionStorageType)); > + > + ? ?llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? blockName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &toAddTo); > + > + ? ?builder.SetInsertPoint(ret); > + > + ? ?std::ostringstream bufferToPrint; > + ? ?bufferToPrint << "Gen: Executing finally block " > + ? ? ? ? ? ? ? ? ?<< blockName > + ? ? ? ? ? ? ? ? ?<< " in " > + ? ? ? ? ? ? ? ? ?<< functionId > + ? ? ? ? ? ? ? ? ?<< std::endl; > + ? ?generateStringPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ?bufferToPrint.str(), > + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); > + > + ? ?llvm::SwitchInst* theSwitch = > + ? ? ? ?builder.CreateSwitch(builder.CreateLoad(*exceptionCaughtFlag), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? &terminatorBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2); > + ? ?theSwitch->addCase(ourExceptionCaughtState, &terminatorBlock); > + ? ?theSwitch->addCase(ourExceptionThrownState, &unwindResumeBlock); > + > + ? ?return(ret); > +} > + > + > +/// Generates catch block semantics which print a string to indicate type of > +/// catch executed, sets an exception caught flag, and executes passed in > +/// end block (terminator block). > +/// @param context llvm context > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param toAddTo parent function to add block to > +/// @param blockName block name of new "catch" block. > +/// @param functionId output id used for printing > +/// @param terminatorBlock terminator "end" block > +/// @param exceptionCaughtFlag exception caught/thrown status > +/// @returns newly created block > +static llvm::BasicBlock* createCatchBlock(llvm::LLVMContext& context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Function& toAddTo, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string& blockName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string& functionId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock& terminatorBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Value& exceptionCaughtFlag) { > + > + ? ?llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? blockName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &toAddTo); > + > + ? ?builder.SetInsertPoint(ret); > + > + ? ?std::ostringstream bufferToPrint; > + ? ?bufferToPrint << "Gen: Executing catch block " > + ? ? ? ? ? ? ? ? ?<< blockName > + ? ? ? ? ? ? ? ? ?<< " in " > + ? ? ? ? ? ? ? ? ?<< functionId > + ? ? ? ? ? ? ? ? ?<< std::endl; > + ? ?generateStringPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ?bufferToPrint.str(), > + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); > + ? ?builder.CreateStore(ourExceptionCaughtState, &exceptionCaughtFlag); > + ? ?builder.CreateBr(&terminatorBlock); > + > + ? ?return(ret); > +} > + > + > +/// Generates a function which invokes a function (toInvoke) and, whose > +/// unwind block will "catch" the type info types correspondingly held in the > +/// exceptionTypesToCatch argument. If the toInvoke function throws an > +/// exception which does not match any type info types contained in > +/// exceptionTypesToCatch, the generated code will call _Unwind_Resume > +/// with the raised exception. On the other hand the generated code will > +/// normally exit if the toInvoke function does not throw an exception. > +/// The generated "finally" block is always run regardless of the cause of > +/// the generated function exit. > +/// The generated function is returned after being verified. > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param fpm a function pass manager holding optional IR to IR > +/// ? ? ? ?transformations > +/// @param toInvoke inner function to invoke > +/// @param ourId id used to printing purposes > +/// @param numExceptionsToCatch length of exceptionTypesToCatch array > +/// @param exceptionTypesToCatch array of type info types to "catch" > +/// @returns generated function > +static > +llvm::Function* createCatchWrappedInvokeFunction(llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ?llvm::FunctionPassManager& fpm, > + ? ? ? ? ? ? ? ? ? ?llvm::Function& toInvoke, > + ? ? ? ? ? ? ? ? ? ?std::string ourId, > + ? ? ? ? ? ? ? ? ? ?unsigned numExceptionsToCatch, > + ? ? ? ? ? ? ? ? ? ?unsigned exceptionTypesToCatch[]) { > + > + ? ?llvm::LLVMContext& context = module.getContext(); > + ? ?llvm::Function *toPrint32Int = module.getFunction("print32Int"); > + > + ? ?ArgTypes argTypes; > + ? ?argTypes.push_back(builder.getInt32Ty()); > + > + ? ?ArgNames argNames; > + ? ?argNames.push_back("exceptTypeToThrow"); > + > + ? ?llvm::Function* ret = createFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getVoidTy(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false); > + > + ? ?// Block which calls invoke > + ? ?llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"entry", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ret); > + ? ?// Normal block for invoke > + ? ?llvm::BasicBlock *normalBlock = llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "normal", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); > + ? ?// Unwind block for invoke > + ? ?llvm::BasicBlock *exceptionBlock = > + ? ? ? ?llvm::BasicBlock::Create(context, "exception", ret); > + > + ? ?// Block which routes exception to correct catch handler block > + ? ?llvm::BasicBlock *exceptionRouteBlock = > + ? ? ? ?llvm::BasicBlock::Create(context, "exceptionRoute", ret); > + > + ? ?// Foreign exception handler > + ? ?llvm::BasicBlock *externalExceptionBlock = > + ? ? ? ?llvm::BasicBlock::Create(context, "externalException", ret); > + > + ? ?// Block which calls _Unwind_Resume > + ? ?llvm::BasicBlock *unwindResumeBlock = > + ? ? ? ?llvm::BasicBlock::Create(context, "unwindResume", ret); > + > + ? ?// Clean up block which delete exception if needed > + ? ?llvm::BasicBlock *endBlock = > + ? ? ? ?llvm::BasicBlock::Create(context, "end", ret); > + > + ? ?std::string nextName; > + ? ?std::vector catchBlocks(numExceptionsToCatch); > + ? ?llvm::Value* exceptionCaughtFlag = NULL; > + ? ?llvm::Value* exceptionStorage = NULL; > + > + ? ?// Finally block which will branch to unwindResumeBlock if > + ? ?// exception is not caught. Initializes/allocates stack locations. > + ? ?llvm::BasicBlock* finallyBlock = createFinallyBlock(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*ret, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nextName = "finally", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*endBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*unwindResumeBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&exceptionCaughtFlag, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&exceptionStorage); > + > + ? ?for (unsigned i = 0; i < numExceptionsToCatch; ++i) { > + ? ? ? ?nextName = ourTypeInfoNames[exceptionTypesToCatch[i]]; > + > + ? ? ? ?// One catch block per type info to be caught > + ? ? ? ?catchBlocks[i] = createCatchBlock(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*ret, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nextName, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*finallyBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*exceptionCaughtFlag); > + ? ?} > + > + ? ?// Entry Block > + > + ? ?builder.SetInsertPoint(entryBlock); > + > + ? ?std::vector args; > + ? ?args.push_back(namedValues["exceptTypeToThrow"]); > + ? ?builder.CreateInvoke(&toInvoke, > + ? ? ? ? ? ? ? ? ? ? ? ? normalBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? exceptionBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? args.begin(), > + ? ? ? ? ? ? ? ? ? ? ? ? args.end()); > + > + ? ?// End Block > + > + ? ?builder.SetInsertPoint(endBlock); > + > + ? ?generateStringPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: In end block: exiting in " + ourId + ".\n", > + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); > + ? ?llvm::Function *deleteOurException = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module.getFunction("deleteOurException"); > + > + ? ?// Note: function handles NULL exceptions > + ? ?builder.CreateCall(deleteOurException, > + ? ? ? ? ? ? ? ? ? ? ? builder.CreateLoad(exceptionStorage)); > + ? ?builder.CreateRetVoid(); > + > + ? ?// Normal Block > + > + ? ?builder.SetInsertPoint(normalBlock); > + > + ? ?generateStringPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: No exception in " + ourId + "!\n", > + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); > + > + ? ?// Finally block is always called > + ? ?builder.CreateBr(finallyBlock); > + > + ? ?// Unwind Resume Block > + > + ? ?builder.SetInsertPoint(unwindResumeBlock); > + > + ? ?llvm::Function *resumeOurException = > + ? ? ? ? ? ? ? ?module.getFunction("_Unwind_Resume"); > + ? ?builder.CreateCall(resumeOurException, > + ? ? ? ? ? ? ? ? ? ? ? builder.CreateLoad(exceptionStorage)); > + ? ?builder.CreateUnreachable(); > + > + ? ?// Exception Block > + > + ? ?builder.SetInsertPoint(exceptionBlock); > + > + ? ?llvm::Function *ehException = module.getFunction("llvm.eh.exception"); > + > + ? ?// Retrieve thrown exception > + ? ?llvm::Value* unwindException = builder.CreateCall(ehException); > + > + ? ?// Store exception and flag > + ? ?builder.CreateStore(unwindException, exceptionStorage); > + ? ?builder.CreateStore(ourExceptionThrownState, exceptionCaughtFlag); > + ? ?llvm::Function *personality = module.getFunction("ourPersonality"); > + ? ?llvm::Value* functPtr = > + ? ? ? ?builder.CreatePointerCast(personality, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); > + > + ? ?args.clear(); > + ? ?args.push_back(unwindException); > + ? ?args.push_back(functPtr); > + > + ? ?// Note: Skipping index 0 > + ? ?for (unsigned i = 0; i < numExceptionsToCatch; ++i) { > + ? ? ? ?// Set up type infos to be caught > + ? ? ? ?args.push_back( > + ? ? ? ? ? ?module.getGlobalVariable( > + ? ? ? ? ? ? ? ?ourTypeInfoNames[exceptionTypesToCatch[i]])); > + ? ?} > + > + ? ?args.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), 0)); > + > + ? ?llvm::Function *ehSelector = module.getFunction("llvm.eh.selector"); > + > + ? ?// Set up this exeption block as the landing pad which will handle > + ? ?// given type infos. See case Intrinsic::eh_selector in > + ? ?// SelectionDAGBuilder::visitIntrinsicCall(...) and AddCatchInfo(...) > + ? ?// implemented in FunctionLoweringInfo.cpp to see how the implementation > + ? ?// handles this call. This landing pad (this exception block), will be > + ? ?// called either because it nees to cleanup (call finally) or a type > + ? ?// info was found which matched the thrown exception. > + ? ?llvm::Value* retTypeInfoIndex = builder.CreateCall(ehSelector, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? args.begin(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? args.end()); > + > + ? ?// Retrieve exception_class member from thrown exception > + ? ?// (_Unwind_Exception instance). This member tells us whether or not > + ? ?// the exception is foreign. > + ? ?llvm::Value* unwindExceptionClass = > + ? ? ? ?builder.CreateLoad( > + ? ? ? ? ? ?builder.CreateStructGEP( > + ? ? ? ? ? ? ? ?builder.CreatePointerCast( > + ? ? ? ? ? ? ? ? ? ?unwindException, > + ? ? ? ? ? ? ? ? ? ?ourUnwindExceptionType->getPointerTo()), > + ? ? ? ? ? ? ? ?0)); > + > + ? ?// Branch to the externalExceptionBlock if the exception is foreign or > + ? ?// to a catch router if not. Either way the finally block will be run. > + ? ?builder.CreateCondBr( > + ? ? ? ?builder.CreateICmpEQ(unwindExceptionClass, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::ConstantInt::get(builder.getInt64Ty(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourBaseExceptionClass)), > + ? ? ? ?exceptionRouteBlock, > + ? ? ? ?externalExceptionBlock); > + > + ? ?// External Exception Block > + > + ? ?builder.SetInsertPoint(externalExceptionBlock); > + > + ? ?generateStringPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ?module, > + ? ? ? ? ? ? ? ? ? ? ? ?builder, > + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: Foreign exception received.\n", > + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); > + > + ? ?// Branch to the finally block > + ? ?builder.CreateBr(finallyBlock); > + > + ? ?// Exception Route Block > + > + ? ?builder.SetInsertPoint(exceptionRouteBlock); > + > + ? ?// Casts exception pointer (_Unwind_Exception instance) to parent > + ? ?// (OurException instance). > + ? ?// > + ? ?// Note: ourBaseFromUnwindOffset is usually negative > + ? ?llvm::Value* typeInfoThrown = > + ? ? ? ?builder.CreatePointerCast( > + ? ? ? ? ? ?builder.CreateConstGEP1_64(unwindException, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourBaseFromUnwindOffset), > + ? ? ? ? ? ?ourExceptionType->getPointerTo()); > + > + ? ?// Retrieve thrown exception type info type > + ? ?// > + ? ?// Note: Index is not relative to pointer but instead to structure > + ? ?// ? ? ? unlike a true getelementptr (GEP) instruction > + ? ?typeInfoThrown = builder.CreateStructGEP(typeInfoThrown, 0); > + > + ? ?llvm::Value* typeInfoThrownType = > + ? ? ? ? ? ? ? ? ? ? builder.CreateStructGEP(typeInfoThrown, 0); > + > + ? ?generateIntegerPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ? module, > + ? ? ? ? ? ? ? ? ? ? ? ? builder, > + ? ? ? ? ? ? ? ? ? ? ? ? *toPrint32Int, > + ? ? ? ? ? ? ? ? ? ? ? ? *(builder.CreateLoad(typeInfoThrownType)), > + ? ? ? ? ? ? ? ? ? ? ? ? "Gen: Exception type <%d> received (stack unwound) " > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " in " + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ".\n", > + ? ? ? ? ? ? ? ? ? ? ? ? USE_GLOBAL_STR_CONSTS); > + > + ? ?// Route to matched type info catch block or run cleanup finally block > + ? ?llvm::SwitchInst* switchToCatchBlock = > + ? ? ? ?builder.CreateSwitch(retTypeInfoIndex, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? finallyBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionsToCatch); > + > + ? ?unsigned nextTypeToCatch; > + > + ? ?for (unsigned i = 1; i <= numExceptionsToCatch; ++i) { > + ? ? ? ?nextTypeToCatch = i - 1; > + ? ? ? ?switchToCatchBlock->addCase(llvm::ConstantInt::get( > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Type::getInt32Ty(context), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?i), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?catchBlocks[nextTypeToCatch]); > + ? ?} > + > + ? ?llvm::verifyFunction(*ret); > + ? ?fpm.run(*ret); > + > + ? ?return(ret); > +} > + > + > +/// Generates function which throws either an exception matched to a runtime > +/// determined type info type (argument to generated function), or if this > +/// runtime value matches nativeThrowType, throws a foreign exception by > +/// calling nativeThrowFunct. > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param fpm a function pass manager holding optional IR to IR > +/// ? ? ? ?transformations > +/// @param ourId id used to printing purposes > +/// @param nativeThrowType a runtime argument of this value results in > +/// ? ? ? ?nativeThrowFunct being called to generate/throw exception. > +/// @param nativeThrowFunct function which will throw a foreign exception > +/// ? ? ? ?if the above nativeThrowType matches generated function's arg. > +/// @returns generated function > +static > +llvm::Function* createThrowExceptionFunction(llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::FunctionPassManager& fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string ourId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int32_t nativeThrowType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function& nativeThrowFunct) { > + ? ?llvm::LLVMContext& context = module.getContext(); > + ? ?namedValues.clear(); > + ? ?ArgTypes unwindArgTypes; > + ? ?unwindArgTypes.push_back(builder.getInt32Ty()); > + ? ?ArgNames unwindArgNames; > + ? ?unwindArgNames.push_back("exceptTypeToThrow"); > + > + ? ?llvm::Function *ret = createFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getVoidTy(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unwindArgTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unwindArgNames, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false); > + > + ? ?// Throws either one of our exception or a native C++ exception depending > + ? ?// on a runtime argument value containing a type info type. > + ? ?llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"entry", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ret); > + ? ?// Throws a foreign exception > + ? ?llvm::BasicBlock *nativeThrowBlock = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "nativeThrow", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); > + ? ?// Throws one of our Exceptions > + ? ?llvm::BasicBlock *generatedThrowBlock = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock::Create(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "generatedThrow", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); > + ? ?// Retrieved runtime type info type to throw > + ? ?llvm::Value* exceptionType = namedValues["exceptTypeToThrow"]; > + > + ? ?// nativeThrowBlock block > + > + ? ?builder.SetInsertPoint(nativeThrowBlock); > + > + ? ?// Throws foreign exception > + ? ?builder.CreateCall(&nativeThrowFunct, exceptionType); > + ? ?builder.CreateUnreachable(); > + > + ? ?// entry block > + > + ? ?builder.SetInsertPoint(entryBlock); > + > + ? ?llvm::Function *toPrint32Int = module.getFunction("print32Int"); > + ? ?generateIntegerPrint(context, > + ? ? ? ? ? ? ? ? ? ? ? ? module, > + ? ? ? ? ? ? ? ? ? ? ? ? builder, > + ? ? ? ? ? ? ? ? ? ? ? ? *toPrint32Int, > + ? ? ? ? ? ? ? ? ? ? ? ? *exceptionType, > + ? ? ? ? ? ? ? ? ? ? ? ? "\nGen: About to throw exception type <%d> in " + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ".\n", > + ? ? ? ? ? ? ? ? ? ? ? ? USE_GLOBAL_STR_CONSTS); > + > + ? ?// Switches on runtime type info type value to determine whether or not > + ? ?// a foreign exception is thrown. Defaults to throwing one of our > + ? ?// generated exceptions. > + ? ?llvm::SwitchInst* theSwitch = builder.CreateSwitch(exceptionType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? generatedThrowBlock, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1); > + > + ? ?theSwitch->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nativeThrowType), > + ? ? ? ? ? ? ? ? ? ? ? nativeThrowBlock); > + > + ? ?// generatedThrow block > + > + ? ?builder.SetInsertPoint(generatedThrowBlock); > + > + ? ?llvm::Function *createOurException = > + ? ? ? ? ? ? ? ?module.getFunction("createOurException"); > + ? ?llvm::Function *raiseOurException = > + ? ? ? ? ? ? ? ?module.getFunction("_Unwind_RaiseException"); > + > + ? ?// Creates exception to throw with runtime type info type. > + ? ?llvm::Value* exception = > + ? ? ? ?builder.CreateCall(createOurException, > + ? ? ? ? ? ? ? ? ? ? ? ? ? namedValues["exceptTypeToThrow"]); > + > + ? ?// Throw generated Exception > + ? ?builder.CreateCall(raiseOurException, exception); > + ? ?builder.CreateUnreachable(); > + > + ? ?llvm::verifyFunction(*ret); > + ? ?fpm.run(*ret); > + > + ? ?return(ret); > +} > + > +static void createStandardUtilityFunctions(unsigned numTypeInfos, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder); > + > +/// Creates test code by generating and organizing these functions into the > +/// test case. The test case consists of an outer function setup to invoke > +/// an inner function within an environment having multiple catch and single > +/// finally blocks. This inner function is also setup to invoke a throw > +/// function within an evironment similar in nature to the outer function's > +/// catch and finally blocks. Each of these two functions catch mutually > +/// exclusive subsets (even or odd) of the type info types configured > +/// for this this. All generated functions have a runtime argument which > +/// holds a type info type to throw that each function takes and passes it > +/// to the inner one if such a inner function exists. This type info type is > +/// looked at by the generated throw function to see whether or not it should > +/// throw a generated exception with the same type info type, or instead call > +/// a supplied a function which in turn will throw a foreign exception. > +/// @param module code for module instance > +/// @param builder builder instance > +/// @param fpm a function pass manager holding optional IR to IR > +/// ? ? ? ?transformations > +/// @param nativeThrowFunctName name of external function which will throw > +/// ? ? ? ?a foreign exception > +/// @returns outermost generated test function. > +llvm::Function* createUnwindExceptionTest(llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::FunctionPassManager& fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string nativeThrowFunctName) { > + ? ?// Number of type infos to generate > + ? ?unsigned numTypeInfos = 6; > + > + ? ?// Initialze intrisics and external functions to use along with exception > + ? ?// and type info globals. > + ? ?createStandardUtilityFunctions(numTypeInfos, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder); > + ? ?llvm::Function *nativeThrowFunct = > + ? ? ? ?module.getFunction(nativeThrowFunctName); > + > + ? ?// Create exception throw function using the value ~0 to cause > + ? ?// foreign exceptions to be thrown. > + ? ?llvm::Function* throwFunct = > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?createThrowExceptionFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "throwFunct", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ~0, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *nativeThrowFunct); > + ? ?// Inner function will catch even type infos > + ? ?unsigned innerExceptionTypesToCatch[] = {6, 2, 4}; > + ? ?size_t numExceptionTypesToCatch = sizeof(innerExceptionTypesToCatch) / > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sizeof(unsigned); > + > + ? ?// Generate inner function. > + ? ?llvm::Function* innerCatchFunct = > + ? ? ? ?createCatchWrappedInvokeFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *throwFunct, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "innerCatchFunct", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionTypesToCatch, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? innerExceptionTypesToCatch); > + > + ? ?// Outer function will catch odd type infos > + ? ?unsigned outerExceptionTypesToCatch[] = {3, 1, 5}; > + ? ?numExceptionTypesToCatch = sizeof(outerExceptionTypesToCatch) / > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sizeof(unsigned); > + > + ? ?// Generate outer function > + ? ?llvm::Function* outerCatchFunct = > + ? ? ? ?createCatchWrappedInvokeFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *innerCatchFunct, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "outerCatchFunct", > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionTypesToCatch, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? outerExceptionTypesToCatch); > + > + ? ?// Return outer function to run > + ? ?return(outerCatchFunct); > +} > + > + > +/// Represents our foreign exceptions > +class OurCppRunException : public std::runtime_error { > +public: > + ? ?OurCppRunException(const std::string reason) : > + ? ? ? ?std::runtime_error(reason) {} > + > + ? ?OurCppRunException (const OurCppRunException& toCopy) : > + ? ? ? ?std::runtime_error(toCopy) {} > + > + ? ?OurCppRunException& operator = (const OurCppRunException& toCopy) { > + ? ? ? ?return(reinterpret_cast( > + ? ? ? ? ? ? ? ? ? std::runtime_error::operator = (toCopy) > + ? ? ? ? ? ? ? )); > + ? ?} > + > + ? ?~OurCppRunException (void) throw () {}; > +}; > + > + > +/// Throws foreign C++ exception. > +/// @param ignoreIt unused parameter that allows function to match implied > +/// ? ? ? ?generated function contract. > +extern "C" > +void throwCppException (int32_t ignoreIt) { > + ? ?throw(OurCppRunException("thrown by throwCppException(...)")); > +} > + > +typedef void (*OurExceptionThrowFunctType) (int32_t typeToThrow); > + > +/// This is a test harness which runs test by executing generated > +/// function with a type info type to throw. Harness wraps the excecution > +/// of generated function in a C++ try catch clause. > +/// @param engine execution engine to use for executing generated function. > +/// ? ? ? ?This demo program expects this to be a JIT instance for demo > +/// ? ? ? ?purposes. > +/// @param function generated test function to run > +/// @param typeToThrow type info type of generated exception to throw, or > +/// ? ? ? ?indicator to cause foreign exception to be thrown. > +static > +void runExceptionThrow(llvm::ExecutionEngine* engine, > + ? ? ? ? ? ? ? ? ? ? ? llvm::Function* function, > + ? ? ? ? ? ? ? ? ? ? ? int32_t typeToThrow) { > + > + ? ?// Find test's function pointer > + ? ?OurExceptionThrowFunctType functPtr = > + ? ? ? ? ?reinterpret_cast( > + ? ? ? ? ? ? ?reinterpret_cast( > + ? ? ? ? ? ? ? ? ?engine->getPointerToFunction(function) > + ? ? ? ? ? ? ?) > + ? ? ? ? ?); > + > + ? ?try { > + ? ? ? ?// Run test > + ? ? ? ?(*functPtr)(typeToThrow); > + ? ?} > + ? ?catch (OurCppRunException exc) { > + ? ? ? ?// Catch foreign C++ exception > + ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ?"\nrunExceptionThrow(...):In C++ catch OurCppRunException " > + ? ? ? ? ? ? ? ? ? ?"with reason: %s.\n", > + ? ? ? ? ? ? ? ?exc.what()); > + ? ?} > + ? ?catch (...) { > + ? ? ? ?// Catch all exceptions including our generated ones. I'm not sure > + ? ? ? ?// why this latter functionality should work, as it seems that > + ? ? ? ?// our exceptions should be foreign to C++ (the _Unwind_Exception:: > + ? ? ? ?// exception_class should be different from the one used by C++), and > + ? ? ? ?// therefore C++ should ignore the generated exceptions. > + > + ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ?"\nrunExceptionThrow(...):In C++ catch all.\n"); > + ? ?} > +} > + > +// > +// End test functions > +// > + > +/// This initialization routine creates type info globals and > +/// adds external function declarations to module. > +/// @param numTypeInfos number of linear type info associated type info types > +/// ? ? ? ?to create as GlobalVariable instances, starting with the value 1. > +/// @param module code for module instance > +/// @param builder builder instance > +static void createStandardUtilityFunctions(unsigned numTypeInfos, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder) { > + > + ? ?llvm::LLVMContext& context = module.getContext(); > + > + ? ?// Exception initializations > + > + ? ?// Setup exception catch state > + ? ?ourExceptionNotThrownState = > + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 0), > + ? ?ourExceptionThrownState = > + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 1), > + ? ?ourExceptionCaughtState = > + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 2), > + > + > + ? ?// Create our type info type > + ? ?ourTypeInfoType = llvm::StructType::get(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt32Ty(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?NULL); > + > + ? ?// Create OurException type > + ? ?ourExceptionType = llvm::StructType::get(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourTypeInfoType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NULL); > + > + ? ?// Create portion of _Unwind_Exception type > + ? ?// > + ? ?// Note: Declaring only a portion of the _Unwind_Exception struct. > + ? ?// ? ? ? Does this cause problems? > + ? ?ourUnwindExceptionType = llvm::StructType::get(context, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getInt64Ty(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NULL); > + ? ?struct OurBaseException_t dummyException; > + > + ? ?// Calculate offset of OurException::unwindException member. > + ? ?ourBaseFromUnwindOffset = ((uintptr_t) &dummyException) - > + ? ? ? ? ? ? ? ? ? ? ? ? ? ((uintptr_t) &(dummyException.unwindException)); > + > +#ifdef DEBUG > + ? ?fprintf(stderr, > + ? ? ? ? ? ?"createStandardUtilityFunctions(...):ourBaseFromUnwindOffset " > + ? ? ? ? ? ? ? ?"= %lld, sizeof(struct OurBaseException_t) - " > + ? ? ? ? ? ? ? ?"sizeof(struct _Unwind_Exception) = %lu.\n", > + ? ? ? ? ? ?ourBaseFromUnwindOffset, > + ? ? ? ? ? ?sizeof(struct OurBaseException_t) - > + ? ? ? ? ? ? ? ?sizeof(struct _Unwind_Exception)); > +#endif > + > + ? ?size_t numChars = sizeof(ourBaseExcpClassChars) / sizeof(char); > + > + ? ?// Create our _Unwind_Exception::exception_class value > + ? ?ourBaseExceptionClass = genClass(ourBaseExcpClassChars, numChars); > + > + ? ?// Type infos > + > + ? ?std::string baseStr = "typeInfo", typeInfoName; > + ? ?std::ostringstream typeInfoNameBuilder; > + ? ?std::vector structVals; > + > + ? ?llvm::Constant *nextStruct; > + ? ?llvm::GlobalVariable* nextGlobal = NULL; > + > + ? ?// Generate each type info > + ? ?// > + ? ?// Note: First type info is not used. > + ? ?for (unsigned i = 0; i <= numTypeInfos; ++i) { > + ? ? ? ?structVals.clear(); > + ? ? ? ?structVals.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), i)); > + ? ? ? ?nextStruct = llvm::ConstantStruct::get(ourTypeInfoType, structVals); > + > + ? ? ? ?typeInfoNameBuilder.str(""); > + ? ? ? ?typeInfoNameBuilder << baseStr << i; > + ? ? ? ?typeInfoName = typeInfoNameBuilder.str(); > + > + ? ? ? ?// Note: Does not seem to work without allocation > + ? ? ? ?nextGlobal = > + ? ? ? ? ? ?new llvm::GlobalVariable(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourTypeInfoType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nextStruct, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? typeInfoName); > + > + ? ? ? ?ourTypeInfoNames.push_back(typeInfoName); > + ? ? ? ?ourTypeInfoNamesIndex[i] = typeInfoName; > + ? ?} > + > + ? ?ArgNames argNames; > + ? ?ArgTypes argTypes; > + ? ?llvm::Function* funct = NULL; > + > + ? ?// print32Int > + > + ? ?const llvm::Type* retType = builder.getVoidTy(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt32Ty()); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "print32Int", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// print64Int > + > + ? ?retType = builder.getVoidTy(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt64Ty()); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "print64Int", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// printStr > + > + ? ?retType = builder.getVoidTy(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "printStr", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// throwCppException > + > + ? ?retType = builder.getVoidTy(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt32Ty()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "throwCppException", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// deleteOurException > + > + ? ?retType = builder.getVoidTy(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "deleteOurException", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// createOurException > + > + ? ?retType = builder.getInt8Ty()->getPointerTo(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt32Ty()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "createOurException", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// _Unwind_RaiseException > + > + ? ?retType = builder.getInt32Ty(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?funct = createFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? ? ? ? ? "_Unwind_RaiseException", > + ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? ? ? ? ? false); > + > + ? ?funct->addFnAttr(llvm::Attribute::NoReturn); > + > + ? ?// _Unwind_Resume > + > + ? ?retType = builder.getInt32Ty(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?funct = createFunction(module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? ? ? ? ? "_Unwind_Resume", > + ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? ? ? ? ? false); > + > + ? ?funct->addFnAttr(llvm::Attribute::NoReturn); > + > + ? ?// ourPersonality > + > + ? ?retType = builder.getInt32Ty(); > + > + ? ?argTypes.clear(); > + ? ?argTypes.push_back(builder.getInt32Ty()); > + ? ?argTypes.push_back(builder.getInt32Ty()); > + ? ?argTypes.push_back(builder.getInt64Ty()); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); > + > + ? ?argNames.clear(); > + > + ? ?createFunction(module, > + ? ? ? ? ? ? ? ? ? retType, > + ? ? ? ? ? ? ? ? ? argTypes, > + ? ? ? ? ? ? ? ? ? argNames, > + ? ? ? ? ? ? ? ? ? "ourPersonality", > + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, > + ? ? ? ? ? ? ? ? ? true, > + ? ? ? ? ? ? ? ? ? false); > + > + ? ?// llvm.eh.selector intrinsic > + > + ? ?getDeclaration(&module, llvm::Intrinsic::eh_selector); > + > + ? ?// llvm.eh.exception intrinsic > + > + ? ?getDeclaration(&module, llvm::Intrinsic::eh_exception); > + > + ? ?// llvm.eh.typeid.for intrinsic > + > + ? ?getDeclaration(&module, llvm::Intrinsic::eh_typeid_for); > +} > + > + > +//===---------------------------------------------------------------------===// > +// Main test driver code. > +//===---------------------------------------------------------------------===// > + > +/// Demo main routine which takes the type info types to throw. A test will > +/// be run for each given type info type. While type info types with the value > +/// of -1 will trigger a foreign C++ exception to be thrown; type info types > +/// <= 6 and >= 1 will be caught by test functions; and type info types > 6 > +/// will result in exceptions which pass through to the test harness. All other > +/// type info types are not supported and could cause a crash. > +int main(int argc, char* argv[]) { > + ? ?if (argc == 1) { > + ? ? ? ?fprintf(stderr, > + ? ? ? ? ? ? ? ?"\nUsage: ExceptionDemo " > + ? ? ? ? ? ? ? ? ? ?"[...].\n" > + ? ? ? ? ? ? ? ? ? ?" ? Each type must have the value of 1 - 6 for " > + ? ? ? ? ? ? ? ? ? ?"generated exceptions to be caught;\n" > + ? ? ? ? ? ? ? ? ? ?" ? the value -1 for foreign C++ exceptions to be " > + ? ? ? ? ? ? ? ? ? ?"generated and thrown;\n" > + ? ? ? ? ? ? ? ? ? ?" ? or the values > 6 for exceptions to be ignored.\n" > + ? ? ? ? ? ? ? ? ? ?"\nTry: ExceptionDemo 2 3 7 -1\n" > + ? ? ? ? ? ? ? ? ? ?" ? for a full test.\n\n"); > + ? ? ? ?return(0); > + ? ?} > + > + ? ?// If not set, exception handling will not be turned on > + ? ?llvm::DwarfExceptionHandling = true; > + > + ? ?llvm::InitializeNativeTarget(); > + ? ?llvm::LLVMContext& context = llvm::getGlobalContext(); > + ? ?llvm::IRBuilder<> theBuilder(context); > + > + ? ?// Make the module, which holds all the code. > + ? ?llvm::Module* module = new llvm::Module("my cool jit", context); > + > + ? ?// Build engine with JIT > + ? ?llvm::EngineBuilder factory(module); > + ? ?factory.setEngineKind(llvm::EngineKind::JIT); > + ? ?factory.setAllocateGVsWithCode(false); > + ? ?llvm::ExecutionEngine* executionEngine = factory.create(); > + > + ? ?{ > + ? ? ? ?llvm::FunctionPassManager fpm(module); > + > + ? ? ? ?// Set up the optimizer pipeline. > + ? ? ? ?// Start with registering info about how the > + ? ? ? ?// target lays out data structures. > + ? ? ? ?fpm.add(new llvm::TargetData(*executionEngine->getTargetData())); > + > + ? ? ? ?// Optimizations turned on > +#ifdef ADD_OPT_PASSES > + > + ? ? ? ?// Promote allocas to registers. > + ? ? ? ?fpm.add(llvm::createPromoteMemoryToRegisterPass()); > + > + ? ? ? ?// Do simple "peephole" optimizations and bit-twiddling optzns. > + ? ? ? ?fpm.add(llvm::createInstructionCombiningPass()); > + > + ? ? ? ?// Reassociate expressions. > + ? ? ? ?fpm.add(llvm::createReassociatePass()); > + > + ? ? ? ?// Eliminate Common SubExpressions. > + ? ? ? ?fpm.add(llvm::createGVNPass()); > + > + ? ? ? ?// Simplify the control flow graph (deleting unreachable > + ? ? ? ?// blocks, etc). > + ? ? ? ?fpm.add(llvm::createCFGSimplificationPass()); > +#endif ?// ADD_OPT_PASSES > + > + ? ? ? ?fpm.doInitialization(); > + > + ? ? ? ?// Generate test code using function throwCppException(...) as > + ? ? ? ?// the function which throws foreign exceptions. > + ? ? ? ?llvm::Function* toRun = > + ? ? ? ? ? ? ? ? ? ? ? ? ?createUnwindExceptionTest(*module, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?theBuilder, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fpm, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"throwCppException"); > + > + ? ? ? ?fprintf(stderr, "\nBegin module dump:\n\n"); > + > + ? ? ? ?module->dump(); > + > + ? ? ? ?fprintf(stderr, "\nEnd module dump:\n"); > + > + ? ? ? ?fprintf(stderr, "\n\nBegin Test:\n"); > + > + ? ? ? ?for (int i = 1; i < argc; ++i) { > + ? ? ? ? ? ?// Run test for each argument whose value is the exception > + ? ? ? ? ? ?// type to throw. > + ? ? ? ? ? ?runExceptionThrow(executionEngine, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?toRun, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(unsigned) strtoul(argv[i], NULL, 10)); > + ? ? ? ?} > + > + ? ? ? ?fprintf(stderr, "\nEnd Test:\n\n"); > + ? ?} > + > + ? ?delete executionEngine; > + > + ? ?return 0; > +} > + > > Added: llvm/trunk/examples/ExceptionDemo/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/Makefile?rev=95723&view=auto > > ============================================================================== > --- llvm/trunk/examples/ExceptionDemo/Makefile (added) > +++ llvm/trunk/examples/ExceptionDemo/Makefile Tue Feb ?9 17:22:43 2010 > @@ -0,0 +1,17 @@ > +##===- examples/ExceptionDemo/Makefile --------------------*- Makefile -*-===## > +# > +# ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure > +# > +# This file is distributed under the University of Illinois Open Source > +# License. See LICENSE.TXT for details. > +# > +##===---------------------------------------------------------------------===## > +LEVEL = ../.. > +TOOLNAME = ExceptionDemo > +EXAMPLE_TOOL = 1 > + > +LINK_COMPONENTS := jit interpreter nativecodegen > + > +include $(LEVEL)/Makefile.common > + > +CXXFLAGS += -fexceptions > > Modified: llvm/trunk/examples/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=95723&r1=95722&r2=95723&view=diff > > ============================================================================== > --- llvm/trunk/examples/Makefile (original) > +++ llvm/trunk/examples/Makefile Tue Feb ?9 17:22:43 2010 > @@ -10,7 +10,8 @@ > > ?include $(LEVEL)/Makefile.config > > -PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker > +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \ > + ? ? ? ? ? ? ? ExceptionDemo > > ?ifeq ($(HAVE_PTHREAD),1) > ?PARALLEL_DIRS += ParallelJIT > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dalej at apple.com Tue Feb 9 19:31:26 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 01:31:26 -0000 Subject: [llvm-commits] [llvm] r95749 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <201002100131.o1A1VQ5S011223@zion.cs.uiuc.edu> Author: johannes Date: Tue Feb 9 19:31:26 2010 New Revision: 95749 URL: http://llvm.org/viewvc/llvm-project?rev=95749&view=rev Log: Rewrite loop to suit Chris' preference. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95749&r1=95748&r2=95749&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 9 19:31:26 2010 @@ -611,23 +611,26 @@ MachineBasicBlock::iterator E = MBB->end(); while (mi != E) { - if (!mi->isDebugValue()) { - if (mi->killsRegister(interval.reg, tri_)) { - DEBUG(dbgs() << " killed"); - end = baseIndex.getDefIndex(); - SeenDefUse = true; - break; - } else if (mi->modifiesRegister(interval.reg, tri_)) { - // Another instruction redefines the register before it is ever read. - // Then the register is essentially dead at the instruction that defines - // it. Hence its interval is: - // [defSlot(def), defSlot(def)+1) - DEBUG(dbgs() << " dead"); - end = start.getStoreIndex(); - SeenDefUse = true; - break; - } + if (mi->isDebugValue()) { + ++mi; + continue; } + if (mi->killsRegister(interval.reg, tri_)) { + DEBUG(dbgs() << " killed"); + end = baseIndex.getDefIndex(); + SeenDefUse = true; + break; + } else if (mi->modifiesRegister(interval.reg, tri_)) { + // Another instruction redefines the register before it is ever read. + // Then the register is essentially dead at the instruction that defines + // it. Hence its interval is: + // [defSlot(def), defSlot(def)+1) + DEBUG(dbgs() << " dead"); + end = start.getStoreIndex(); + SeenDefUse = true; + break; + } + ++mi; if (mi != E && !mi->isDebugValue()) { baseIndex = indexes_->getNextNonNullIndex(baseIndex); From daniel at zuster.org Tue Feb 9 19:41:14 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 01:41:14 -0000 Subject: [llvm-commits] [llvm] r95752 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp tools/llvm-mc/llvm-mc.cpp Message-ID: <201002100141.o1A1fEXX011641@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 19:41:14 2010 New Revision: 95752 URL: http://llvm.org/viewvc/llvm-project?rev=95752&view=rev Log: llvm-mc: Remove --show-fixups and always show as part of --show-encoding. Also, fix a silly memory leak. Modified: llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/tools/llvm-mc/llvm-mc.cpp Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=95752&r1=95751&r2=95752&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Feb 9 19:41:14 2010 @@ -278,15 +278,12 @@ /// /// \param ShowInst - Whether to show the MCInst representation inline with /// the assembly. - /// - /// \param ShowFixups - Whether to show the fixups in an encoded instruction. MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS, const MCAsmInfo &MAI, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *InstPrint = 0, MCCodeEmitter *CE = 0, - bool ShowInst = false, - bool ShowFixups = false); + bool ShowInst = false); // FIXME: These two may end up getting rolled into a single // createObjectStreamer interface, which implements the assembler backend, and Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95752&r1=95751&r2=95752&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 19:41:14 2010 @@ -37,18 +37,17 @@ unsigned IsLittleEndian : 1; unsigned IsVerboseAsm : 1; - unsigned ShowFixups : 1; unsigned ShowInst : 1; public: MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os, const MCAsmInfo &mai, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *printer, - MCCodeEmitter *emitter, bool showInst, bool showFixups) + MCCodeEmitter *emitter, bool showInst) : MCStreamer(Context), OS(os), MAI(mai), InstPrinter(printer), Emitter(emitter), CommentStream(CommentToEmit), IsLittleEndian(isLittleEndian), IsVerboseAsm(isVerboseAsm), - ShowFixups(showFixups), ShowInst(showInst) { + ShowInst(showInst) { if (InstPrinter && IsVerboseAsm) InstPrinter->setCommentStream(CommentStream); } @@ -543,22 +542,11 @@ Emitter->EncodeInstruction(Inst, VecOS, Fixups); VecOS.flush(); - // If we aren't showing fixups, just show the bytes. - if (!ShowFixups) { - OS << "encoding: ["; - for (unsigned i = 0, e = Code.size(); i != e; ++i) { - if (i) - OS << ','; - OS << format("0x%02x", uint8_t(Code[i])); - } - OS << "]\n"; - return; - } - // If we are showing fixups, create symbolic markers in the encoded // representation. We do this by making a per-bit map to the fixup item index, // then trying to display it as nicely as possible. - uint8_t *FixupMap = new uint8_t[Code.size() * 8]; + SmallVector FixupMap; + FixupMap.resize(Code.size() * 8); for (unsigned i = 0, e = Code.size() * 8; i != e; ++i) FixupMap[i] = 0; @@ -652,8 +640,7 @@ formatted_raw_ostream &OS, const MCAsmInfo &MAI, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *IP, - MCCodeEmitter *CE, bool ShowInst, - bool ShowFixups) { + MCCodeEmitter *CE, bool ShowInst) { return new MCAsmStreamer(Context, OS, MAI, isLittleEndian, isVerboseAsm, - IP, CE, ShowInst, ShowFixups); + IP, CE, ShowInst); } Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=95752&r1=95751&r2=95752&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original) +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Feb 9 19:41:14 2010 @@ -47,9 +47,6 @@ ShowEncoding("show-encoding", cl::desc("Show instruction encodings")); static cl::opt -ShowFixups("show-fixups", cl::desc("Show fixups inside encodings")); - -static cl::opt ShowInst("show-inst", cl::desc("Show internal instruction representation")); static cl::opt @@ -273,7 +270,7 @@ Str.reset(createAsmStreamer(Ctx, *Out, *MAI, TM->getTargetData()->isLittleEndian(), /*asmverbose*/true, IP.get(), CE.get(), - ShowInst, ShowFixups)); + ShowInst)); } else { assert(FileType == OFT_ObjectFile && "Invalid file type!"); CE.reset(TheTarget->createCodeEmitter(*TM)); From sabre at nondot.org Tue Feb 9 19:45:28 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 01:45:28 -0000 Subject: [llvm-commits] [llvm] r95753 - in /llvm/trunk/utils/TableGen: CodeGenInstruction.cpp CodeGenInstruction.h InstrInfoEmitter.cpp X86RecognizableInstr.cpp Message-ID: <201002100145.o1A1jSh4011923@zion.cs.uiuc.edu> Author: lattner Date: Tue Feb 9 19:45:28 2010 New Revision: 95753 URL: http://llvm.org/viewvc/llvm-project?rev=95753&view=rev Log: Introduce a new CodeGenInstruction::ConstraintInfo class for representing constraint info semantically instead of as a c expression that will be blatted out to the .inc file. Fix X86RecognizableInstr to use this instead of parsing C code :). Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp llvm/trunk/utils/TableGen/CodeGenInstruction.h llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=95753&r1=95752&r2=95753&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Tue Feb 9 19:45:28 2010 @@ -33,10 +33,10 @@ I->ParseOperandName(Name, false); // Build the string for the operand - std::string OpConstraint = "(1 << TOI::EARLY_CLOBBER)"; - if (!I->OperandList[Op.first].Constraints[Op.second].empty()) + if (!I->OperandList[Op.first].Constraints[Op.second].isNone()) throw "Operand '" + Name + "' cannot have multiple constraints!"; - I->OperandList[Op.first].Constraints[Op.second] = OpConstraint; + I->OperandList[Op.first].Constraints[Op.second] = + CodeGenInstruction::ConstraintInfo::getEarlyClobber(); return; } @@ -65,13 +65,11 @@ unsigned FlatOpNo = I->getFlattenedOperandNumber(SrcOp); - // Build the string for the operand. - std::string OpConstraint = - "((" + utostr(FlatOpNo) + " << 16) | (1 << TOI::TIED_TO))"; - if (!I->OperandList[DestOp.first].Constraints[DestOp.second].empty()) + if (!I->OperandList[DestOp.first].Constraints[DestOp.second].isNone()) throw "Operand '" + DestOpName + "' cannot have multiple constraints!"; - I->OperandList[DestOp.first].Constraints[DestOp.second] = OpConstraint; + I->OperandList[DestOp.first].Constraints[DestOp.second] = + CodeGenInstruction::ConstraintInfo::getTied(FlatOpNo); } static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) { @@ -210,18 +208,13 @@ // For backward compatibility: isTwoAddress means operand 1 is tied to // operand 0. if (isTwoAddress) { - if (!OperandList[1].Constraints[0].empty()) + if (!OperandList[1].Constraints[0].isNone()) throw R->getName() + ": cannot use isTwoAddress property: instruction " "already has constraint set!"; - OperandList[1].Constraints[0] = "((0 << 16) | (1 << TOI::TIED_TO))"; + OperandList[1].Constraints[0] = + CodeGenInstruction::ConstraintInfo::getTied(0); } - // Any operands with unset constraints get 0 as their constraint. - for (unsigned op = 0, e = OperandList.size(); op != e; ++op) - for (unsigned j = 0, e = OperandList[op].MINumOperands; j != e; ++j) - if (OperandList[op].Constraints[j].empty()) - OperandList[op].Constraints[j] = "0"; - // Parse the DisableEncoding field. std::string DisableEncoding = R->getValueAsString("DisableEncoding"); while (1) { Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=95753&r1=95752&r2=95753&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Tue Feb 9 19:45:28 2010 @@ -32,6 +32,35 @@ /// instruction. std::string AsmString; + class ConstraintInfo { + enum { None, EarlyClobber, Tied } Kind; + unsigned OtherTiedOperand; + public: + ConstraintInfo() : Kind(None) {} + + static ConstraintInfo getEarlyClobber() { + ConstraintInfo I; + I.Kind = EarlyClobber; + return I; + } + + static ConstraintInfo getTied(unsigned Op) { + ConstraintInfo I; + I.Kind = Tied; + I.OtherTiedOperand = Op; + return I; + } + + bool isNone() const { return Kind == None; } + bool isEarlyClobber() const { return Kind == EarlyClobber; } + bool isTied() const { return Kind == Tied; } + + unsigned getTiedOperand() const { + assert(isTied()); + return OtherTiedOperand; + } + }; + /// OperandInfo - The information we keep track of for each operand in the /// operand list for a tablegen instruction. struct OperandInfo { @@ -67,7 +96,7 @@ /// Constraint info for this operand. This operand can have pieces, so we /// track constraint info for each. - std::vector Constraints; + std::vector Constraints; OperandInfo(Record *R, const std::string &N, const std::string &PMN, unsigned MION, unsigned MINO, DagInit *MIOI) Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=95753&r1=95752&r2=95753&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Tue Feb 9 19:45:28 2010 @@ -118,7 +118,20 @@ Res += "|(1< Author: lattner Date: Tue Feb 9 19:46:47 2010 New Revision: 95754 URL: http://llvm.org/viewvc/llvm-project?rev=95754&view=rev Log: "fixup" a comment. Modified: llvm/trunk/include/llvm/MC/MCFixup.h Modified: llvm/trunk/include/llvm/MC/MCFixup.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=95754&r1=95753&r2=95754&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCFixup.h (original) +++ llvm/trunk/include/llvm/MC/MCFixup.h Tue Feb 9 19:46:47 2010 @@ -17,7 +17,7 @@ // Private constants, do not use. // // This is currently laid out so that the MCFixup fields can be efficiently -// accessed, while keeping the offset field large enought that the assembler +// accessed, while keeping the offset field large enough that the assembler // backend can reasonably use the MCFixup representation for an entire fragment // (splitting any overly large fragments). // From clattner at apple.com Tue Feb 9 20:02:07 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 9 Feb 2010 18:02:07 -0800 Subject: [llvm-commits] [llvm] r95749 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: <201002100131.o1A1VQ5S011223@zion.cs.uiuc.edu> References: <201002100131.o1A1VQ5S011223@zion.cs.uiuc.edu> Message-ID: On Feb 9, 2010, at 5:31 PM, Dale Johannesen wrote: > Author: johannes > Date: Tue Feb 9 19:31:26 2010 > New Revision: 95749 > > URL: http://llvm.org/viewvc/llvm-project?rev=95749&view=rev > Log: > Rewrite loop to suit Chris' preference. The second !mi->isDebugValue() you added is now dead. -Chris > > > Modified: > llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95749&r1=95748&r2=95749&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 9 > 19:31:26 2010 > @@ -611,23 +611,26 @@ > > MachineBasicBlock::iterator E = MBB->end(); > while (mi != E) { > - if (!mi->isDebugValue()) { > - if (mi->killsRegister(interval.reg, tri_)) { > - DEBUG(dbgs() << " killed"); > - end = baseIndex.getDefIndex(); > - SeenDefUse = true; > - break; > - } else if (mi->modifiesRegister(interval.reg, tri_)) { > - // Another instruction redefines the register before it is > ever read. > - // Then the register is essentially dead at the instruction > that defines > - // it. Hence its interval is: > - // [defSlot(def), defSlot(def)+1) > - DEBUG(dbgs() << " dead"); > - end = start.getStoreIndex(); > - SeenDefUse = true; > - break; > - } > + if (mi->isDebugValue()) { > + ++mi; > + continue; > } > + if (mi->killsRegister(interval.reg, tri_)) { > + DEBUG(dbgs() << " killed"); > + end = baseIndex.getDefIndex(); > + SeenDefUse = true; > + break; > + } else if (mi->modifiesRegister(interval.reg, tri_)) { > + // Another instruction redefines the register before it is > ever read. > + // Then the register is essentially dead at the instruction > that defines > + // it. Hence its interval is: > + // [defSlot(def), defSlot(def)+1) > + DEBUG(dbgs() << " dead"); > + end = start.getStoreIndex(); > + SeenDefUse = true; > + break; > + } > + > ++mi; > if (mi != E && !mi->isDebugValue()) { > baseIndex = indexes_->getNextNonNullIndex(baseIndex); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Tue Feb 9 20:17:34 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 10 Feb 2010 02:17:34 -0000 Subject: [llvm-commits] [llvm] r95757 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/zext-trunc.ll Message-ID: <201002100217.o1A2HYwn013342@zion.cs.uiuc.edu> Author: evancheng Date: Tue Feb 9 20:17:34 2010 New Revision: 95757 URL: http://llvm.org/viewvc/llvm-project?rev=95757&view=rev Log: Now that ShrinkDemandedOps() is separated out from DAG combine. It sometimes leave some obvious nops which dag combine used to clean up afterwards e.g. (trunk (ext n)) -> n. Look for them and squash them. Added: llvm/trunk/test/CodeGen/X86/zext-trunc.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=95757&r1=95756&r2=95757&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 9 20:17:34 2010 @@ -457,6 +457,21 @@ }; } +/// TrivialTruncElim - Eliminate some trivial nops that can result from +/// ShrinkDemandedOps: (trunc (ext n)) -> n. +static bool TrivialTruncElim(SDValue Op, + TargetLowering::TargetLoweringOpt &TLO) { + SDValue N0 = Op.getOperand(0); + EVT VT = Op.getValueType(); + if ((N0.getOpcode() == ISD::ZERO_EXTEND || + N0.getOpcode() == ISD::SIGN_EXTEND || + N0.getOpcode() == ISD::ANY_EXTEND) && + N0.getOperand(0).getValueType() == VT) { + return TLO.CombineTo(Op, N0.getOperand(0)); + } + return false; +} + /// ShrinkDemandedOps - A late transformation pass that shrink expressions /// using TargetLowering::TargetLoweringOpt::ShrinkDemandedOp. It converts /// x+y to (VT)((SmallVT)x+(SmallVT)y) if the casts are free. @@ -489,7 +504,9 @@ APInt Demanded = APInt::getAllOnesValue(BitWidth); APInt KnownZero, KnownOne; if (TLI.SimplifyDemandedBits(SDValue(N, 0), Demanded, - KnownZero, KnownOne, TLO)) { + KnownZero, KnownOne, TLO) || + (N->getOpcode() == ISD::TRUNCATE && + TrivialTruncElim(SDValue(N, 0), TLO))) { // Revisit the node. Worklist.erase(std::remove(Worklist.begin(), Worklist.end(), N), Worklist.end()); Added: llvm/trunk/test/CodeGen/X86/zext-trunc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/zext-trunc.ll?rev=95757&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/zext-trunc.ll (added) +++ llvm/trunk/test/CodeGen/X86/zext-trunc.ll Tue Feb 9 20:17:34 2010 @@ -0,0 +1,13 @@ +; RUN: llc < %s -march=x86-64 | FileCheck %s +; rdar://7570931 + +define i64 @foo(i64 %a, i64 %b) nounwind { +; CHECK: foo: +; CHECK: leal +; CHECK-NOT: movl +; CHECK: ret + %c = add i64 %a, %b + %d = trunc i64 %c to i32 + %e = zext i32 %d to i64 + ret i64 %e +} From scallanan at apple.com Tue Feb 9 20:27:43 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 10 Feb 2010 02:27:43 -0000 Subject: [llvm-commits] [llvm] r95759 - in /llvm/trunk/utils/TableGen: AsmWriterInst.cpp AsmWriterInst.h Message-ID: <201002100227.o1A2Rhgk013923@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 20:27:43 2010 New Revision: 95759 URL: http://llvm.org/viewvc/llvm-project?rev=95759&view=rev Log: Changed AsmWriterOperand to also include the index of the operand into the CodeGenInstruction's list of operands, which is useful for EDEmitter. (Still working on PR6219) Modified: llvm/trunk/utils/TableGen/AsmWriterInst.cpp llvm/trunk/utils/TableGen/AsmWriterInst.h Modified: llvm/trunk/utils/TableGen/AsmWriterInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.cpp?rev=95759&r1=95758&r2=95759&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterInst.cpp Tue Feb 9 20:27:43 2010 @@ -219,7 +219,10 @@ if (VarName.empty()) { // Just a modifier, pass this into PrintSpecial. - Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier)); + Operands.push_back(AsmWriterOperand("PrintSpecial", + ~0U, + ~0U, + Modifier)); } else { // Otherwise, normal operand. unsigned OpNo = CGI.getOperandNamed(VarName); @@ -227,7 +230,9 @@ if (CurVariant == Variant || CurVariant == ~0U) { unsigned MIOp = OpInfo.MIOperandNo; - Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, + Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, + OpNo, + MIOp, Modifier)); } } Modified: llvm/trunk/utils/TableGen/AsmWriterInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.h?rev=95759&r1=95758&r2=95759&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterInst.h (original) +++ llvm/trunk/utils/TableGen/AsmWriterInst.h Tue Feb 9 20:27:43 2010 @@ -41,6 +41,10 @@ /// into the asm writer. std::string Str; + /// CGIOpNo - For isMachineInstrOperand, this is the index of the operand in + /// the CodeGenInstruction. + unsigned CGIOpNo; + /// MiOpNo - For isMachineInstrOperand, this is the operand number of the /// machine instruction. unsigned MIOpNo; @@ -56,10 +60,12 @@ OpType op = isLiteralTextOperand) : OperandType(op), Str(LitStr) {} - AsmWriterOperand(const std::string &Printer, unsigned OpNo, + AsmWriterOperand(const std::string &Printer, + unsigned _CGIOpNo, + unsigned _MIOpNo, const std::string &Modifier, OpType op = isMachineInstrOperand) - : OperandType(op), Str(Printer), MIOpNo(OpNo), + : OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo), MiModifier(Modifier) {} bool operator!=(const AsmWriterOperand &Other) const { From scallanan at apple.com Tue Feb 9 20:47:09 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 10 Feb 2010 02:47:09 -0000 Subject: [llvm-commits] [llvm] r95760 - /llvm/trunk/utils/TableGen/EDEmitter.cpp Message-ID: <201002100247.o1A2lA15014805@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 20:47:08 2010 New Revision: 95760 URL: http://llvm.org/viewvc/llvm-project?rev=95760&view=rev Log: Updated the TableGen emitter for the Enhanced Disassembler to take advantage of the refactored AsmWriterInst.h. Note removed parser code. Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=95760&r1=95759&r2=95760&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Tue Feb 9 20:47:08 2010 @@ -199,223 +199,40 @@ EDEmitter::EDEmitter(RecordKeeper &R) : Records(R) { } -////////////////////////////////////////////// -// Support functions for parsing AsmStrings // -////////////////////////////////////////////// - -/// parseError - A better error reporter for use in AsmString parsers -/// -/// @arg asmString - The original assembly string, for use in the error report -/// @arg index - The character where the error occurred -/// @arg err - The text of the error itself -static void parseError(const std::string& asmString, - unsigned int index, - const char* err) { - errs() << "In: " << asmString.c_str() << "\n"; - errs() << "Error at " << format("%d", index) << ": " << err << "\n"; - llvm_unreachable("Parse error"); -} - -/// resolveBraces - Interprets the brace syntax in an AsmString in favor of just -/// one syntax, and returns the result. "{A}" is resolved to "A" for syntax 0 -/// and "" for all others; "{A|B}" is resolved to "A" for syntax 0, "B" for -/// syntax 1, and "" for all others; and so on. -/// -/// @arg asmString - The original string, as loaded from the .td file -/// @arg syntaxIndex - The index to use -static std::string resolveBraces(const std::string &asmString, - unsigned int syntaxIndex) { - std::string ret; - - unsigned int index; - unsigned int numChars = asmString.length(); - - // Brace parsing countable-state transducer - // - // STATES - -1, 0, 1, ..., error - // SYMBOLS - '{', '|', '}', ?, EOF - // START STATE - -1 - // - // state input -> state output - // -1 '{' -> 0 - // -1 '|' -> error - // -1 '}' -> error - // -1 ? -> -1 ? - // -1 EOF -> -1 - // n '{' -> error - // n '|' -> n+1 - // n '}' -> -1 - // n ? -> n ? if n == syntaxIndex - // if not - // n EOF -> error - - int state = -1; - - for (index = 0; index < numChars; ++index) { - char input = asmString[index]; - - switch (state) { - default: - switch (input) { - default: - if (state == (int)syntaxIndex) - ret.push_back(input); - break; - case '{': - parseError(asmString, index, "Nested { in AsmString"); - break; - case '|': - state++; - break; - case '}': - state = -1; - break; - } - break; - case -1: - switch (input) { - default: - ret.push_back(input); - break; - case '{': - state = 0; - break; - case '|': - parseError(asmString, index, "| outside braces in AsmString"); - break; - case '}': - parseError(asmString, index, "Unmatched } in AsmString"); - break; - } - break; - } - } - - if (state != -1) - parseError(asmString, index, "Unmatched { in AsmString"); - - return ret; -} - -/// getOperandIndex - looks up a named operand in an instruction and determines -/// its index in the operand descriptor array, returning the index or -1 if it -/// is not present. -/// -/// @arg asmString - The assembly string for the instruction, for errors only -/// @arg operand - The operand's name -/// @arg inst - The instruction to use when looking up the operand -static int8_t getOperandIndex(const std::string &asmString, - const std::string &operand, - const CodeGenInstruction &inst) { - int8_t operandIndex; - - if(operand.length() == 0) { - errs() << "In: " << asmString << "\n"; - errs() << "Operand: " << operand << "\n"; - llvm_unreachable("Empty operand"); - } - - try { - operandIndex = inst.getOperandNamed(operand); - } - catch (...) { - return -1; - } - - return operandIndex; -} - -/// isAlphanumeric - returns true if a character is a valid alphanumeric -/// character, and false otherwise -/// -/// input - The character to query -static inline bool isAlphanumeric(char input) { - if((input >= 'a' && input <= 'z') || - (input >= 'A' && input <= 'Z') || - (input >= '0' && input <= '9') || - (input == '_')) - return true; - else - return false; -} - -/// populateOperandOrder - reads a resolved AsmString (see resolveBraces) and -/// records the index into the operand descriptor array for each operand in -/// that string, in the order of appearance. +/// populateOperandOrder - Accepts a CodeGenInstruction and generates its +/// AsmWriterInst for the desired assembly syntax, giving an ordered list of +/// operands in the order they appear in the printed instruction. Then, for +/// each entry in that list, determines the index of the same operand in the +/// CodeGenInstruction, and emits the resulting mapping into an array, filling +/// in unused slots with -1. /// /// @arg operandOrder - The array that will be populated with the operand /// mapping. Each entry will contain -1 (invalid index /// into the operands present in the AsmString) or a number /// representing an index in the operand descriptor array. -/// @arg asmString - The operand's name -/// @arg inst - The instruction to use when looking up the operand +/// @arg inst - The instruction to use when looking up the operands +/// @arg syntax - The syntax to use, according to LLVM's enumeration void populateOperandOrder(CompoundConstantEmitter *operandOrder, - const std::string &asmString, - const CodeGenInstruction &inst) { - std::string aux; - - unsigned int index; - unsigned int numChars = asmString.length(); + const CodeGenInstruction &inst, + unsigned syntax) { unsigned int numArgs = 0; - // Argument processing finite-state transducer - // - // STATES - 0, 1, error - // SYMBOLS - A(lphanumeric), '$', ?, EOF - // START STATE - 0 - // - // state input -> state aux - // 0 A -> 0 - // 0 '$' -> 1 - // 0 ? -> 0 - // 0 EOF -> 0 - // 1 A -> 1 A - // 1 '$' -> error - // 1 ? -> 0 clear - // 1 EOF -> 0 clear + AsmWriterInst awInst(inst, syntax, -1, -1); - unsigned int state = 0; + std::vector::iterator operandIterator; - for (index = 0; index < numChars; ++index) { - char input = asmString[index]; - - switch (state) { - default: - parseError(asmString, index, "Parser in unreachable state"); - case 0: - if (input == '$') { - state = 1; - } - break; - case 1: - if (isAlphanumeric(input)) { - aux.push_back(input); - } - else if (input == '$') { - parseError(asmString, index, "$ found in argument name"); - } - else { - int8_t operandIndex = getOperandIndex(asmString, aux, inst); - char buf[3]; - snprintf(buf, sizeof(buf), "%d", operandIndex); - operandOrder->addEntry(new LiteralConstantEmitter(buf)); - aux.clear(); - state = 0; - numArgs++; - } - break; + for (operandIterator = awInst.Operands.begin(); + operandIterator != awInst.Operands.end(); + ++operandIterator) { + if (operandIterator->OperandType == + AsmWriterOperand::isMachineInstrOperand) { + char buf[2]; + snprintf(buf, sizeof(buf), "%u", operandIterator->CGIOpNo); + operandOrder->addEntry(new LiteralConstantEmitter(buf)); + numArgs++; } } - if (state == 1) { - int8_t operandIndex = getOperandIndex(asmString, aux, inst); - char buf[2]; - snprintf(buf, 2, "%d", operandIndex); - operandOrder->addEntry(new LiteralConstantEmitter(buf)); - aux.clear(); - numArgs++; - } - for(; numArgs < MAX_OPERANDS; numArgs++) { operandOrder->addEntry(new LiteralConstantEmitter("-1")); } @@ -780,9 +597,7 @@ operandOrderArray->addEntry(operandOrder); if (syntaxIndex < numSyntaxes) { - std::string asmString = inst.AsmString; - asmString = resolveBraces(asmString, syntaxIndex); - populateOperandOrder(operandOrder, asmString, inst); + populateOperandOrder(operandOrder, inst, syntaxIndex); } else { for (unsigned operandIndex = 0; From gvenn.cfe.dev at gmail.com Tue Feb 9 20:50:08 2010 From: gvenn.cfe.dev at gmail.com (Garrison Venn) Date: Wed, 10 Feb 2010 02:50:08 -0000 Subject: [llvm-commits] [llvm] r95761 - /llvm/trunk/examples/CMakeLists.txt Message-ID: <201002100250.o1A2o8lC014945@zion.cs.uiuc.edu> Author: gvenn Date: Tue Feb 9 20:50:08 2010 New Revision: 95761 URL: http://llvm.org/viewvc/llvm-project?rev=95761&view=rev Log: Prevented ExceptionDemo example being built on WINDOWS via if( NOT WIN32 ) check in examples cmake list file. This has NOT been tested. Modified: llvm/trunk/examples/CMakeLists.txt Modified: llvm/trunk/examples/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=95761&r1=95760&r2=95761&view=diff ============================================================================== --- llvm/trunk/examples/CMakeLists.txt (original) +++ llvm/trunk/examples/CMakeLists.txt Tue Feb 9 20:50:08 2010 @@ -3,7 +3,10 @@ add_subdirectory(HowToUseJIT) add_subdirectory(Kaleidoscope) add_subdirectory(ModuleMaker) -add_subdirectory(ExceptionDemo) + +if( NOT WIN32 ) + add_subdirectory(ExceptionDemo) +endif() include(CheckIncludeFile) check_include_file(pthread.h HAVE_PTHREAD_H) From gvenn.cfe.dev at gmail.com Tue Feb 9 21:08:06 2010 From: gvenn.cfe.dev at gmail.com (Garrison Venn) Date: Tue, 9 Feb 2010 22:08:06 -0500 Subject: [llvm-commits] [llvm] r95723 - in /llvm/trunk/examples: CMakeLists.txt ExceptionDemo/ ExceptionDemo/CMakeLists.txt ExceptionDemo/ExceptionDemo.cpp ExceptionDemo/Makefile Makefile In-Reply-To: <6a8523d61002091726q69844076j6bce6dee3a3f3500@mail.gmail.com> References: <201002092322.o19NMiQ3005105@zion.cs.uiuc.edu> <6a8523d61002091726q69844076j6bce6dee3a3f3500@mail.gmail.com> Message-ID: Ok Daniel, added: if( NOT WIN32 ) add_subdirectory(ExceptionDemo) endif() to examples CMakeLists.txt. Seems like WIN32 is the correct def. to use. Is there another more preferable one? Is the default make system used for WINDOWS? Garrison On Feb 9, 2010, at 20:26, Daniel Dunbar wrote: > Hi Garrison, > > Can you change the CMake files to make sure this example doesn't try > and get built on Windows? See here: > http://google1.osuosl.org:8011/builders/clang-i686-xp-msvc9/builds/3779 > > - Daniel > > On Tue, Feb 9, 2010 at 3:22 PM, Garrison Venn wrote: >> Author: gvenn >> Date: Tue Feb 9 17:22:43 2010 >> New Revision: 95723 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95723&view=rev >> Log: >> Adds a JIT based exception handling example to the examples directory. >> Both zero cost example domain specific, and C++ foreign exception handling are >> shown. The example's documentation fully explains how to run the example. >> >> Notes: >> >> 1) The code uses an extremely simple type info model. >> 2) Only a single landing pad is used per unwind edge >> (one call to llvm.eh.selector) >> 3) llvm.eh.selector support for filter arguments is not given. >> 4) llvm.eh.typeid.for is not used. >> 5) Forced unwind behavior is not supported. >> 6) Very little if any error handling is given. >> 7) __attribute__((__aligned__)) is used. >> 8) The code uses parts from the llvm compiler-rt project and >> the llvm Kaleidoscope example. >> 9) The code has not been ported or tested on WINDOWS. >> 10) The code was not tested with a cmake build. >> 11) The code was tested for a debug build on 32bit X86 CentOS LINUX, >> and both a debug and release build on OS X 10.6.2 (64bit). >> >> Added: >> llvm/trunk/examples/ExceptionDemo/ >> llvm/trunk/examples/ExceptionDemo/CMakeLists.txt >> llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp >> llvm/trunk/examples/ExceptionDemo/Makefile >> Modified: >> llvm/trunk/examples/CMakeLists.txt >> llvm/trunk/examples/Makefile >> >> Modified: llvm/trunk/examples/CMakeLists.txt >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=95723&r1=95722&r2=95723&view=diff >> >> ============================================================================== >> --- llvm/trunk/examples/CMakeLists.txt (original) >> +++ llvm/trunk/examples/CMakeLists.txt Tue Feb 9 17:22:43 2010 >> @@ -3,6 +3,7 @@ >> add_subdirectory(HowToUseJIT) >> add_subdirectory(Kaleidoscope) >> add_subdirectory(ModuleMaker) >> +add_subdirectory(ExceptionDemo) >> >> include(CheckIncludeFile) >> check_include_file(pthread.h HAVE_PTHREAD_H) >> >> Added: llvm/trunk/examples/ExceptionDemo/CMakeLists.txt >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/CMakeLists.txt?rev=95723&view=auto >> >> ============================================================================== >> --- llvm/trunk/examples/ExceptionDemo/CMakeLists.txt (added) >> +++ llvm/trunk/examples/ExceptionDemo/CMakeLists.txt Tue Feb 9 17:22:43 2010 >> @@ -0,0 +1,5 @@ >> +set(LLVM_LINK_COMPONENTS jit nativecodegen) >> + >> +add_llvm_example(ExceptionDemo >> + ExceptionDemo.cpp >> + ) >> >> Added: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=95723&view=auto >> >> ============================================================================== >> --- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (added) >> +++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Feb 9 17:22:43 2010 >> @@ -0,0 +1,2028 @@ >> +//===-- examples/ExceptionDemo/ExceptionDemo.cpp - >> +// An example use of the llvm Exception mechanism --===// >> +// >> +// The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open Source >> +// License. See LICENSE.TXT for details. >> +// >> +//===--------------------------------------------------------------------===// >> +// >> +// Demo program which implements an example LLVM exception implementation, and >> +// shows several test cases including the handling of foreign exceptions. >> +// It is run with type info types arguments to throw. A test will >> +// be run for each given type info type. While type info types with the value >> +// of -1 will trigger a foreign C++ exception to be thrown; type info types >> +// <= 6 and >= 1 will cause the associated generated exceptions to be thrown >> +// and caught by generated test functions; and type info types > 6 >> +// will result in exceptions which pass through to the test harness. All other >> +// type info types are not supported and could cause a crash. In all cases, >> +// the "finally" blocks of every generated test functions will executed >> +// regardless of whether or not that test function ignores or catches the >> +// thrown exception. >> +// >> +// examples: >> +// >> +// ExceptionDemo >> +// >> +// causes a usage to be printed to stderr >> +// >> +// ExceptionDemo 2 3 7 -1 >> +// >> +// results in the following cases: >> +// - Value 2 causes an exception with a type info type of 2 to be >> +// thrown and caught by an inner generated test function. >> +// - Value 3 causes an exception with a type info type of 3 to be >> +// thrown and caught by an outer generated test function. >> +// - Value 7 causes an exception with a type info type of 7 to be >> +// thrown and NOT be caught by any generated function. >> +// - Value -1 causes a foreign C++ exception to be thrown and not be >> +// caught by any generated function >> +// >> +// Cases -1 and 7 are caught by a C++ test harness where the validity of >> +// of a C++ catch(...) clause catching a generated exception with a >> +// type info type of 7 is questionable. >> +// >> +// This code uses code from the llvm compiler-rt project and the llvm >> +// Kaleidoscope project. >> +// >> +//===--------------------------------------------------------------------===// >> + >> + >> +#include "llvm/LLVMContext.h" >> +#include "llvm/DerivedTypes.h" >> +#include "llvm/ExecutionEngine/ExecutionEngine.h" >> +#include "llvm/ExecutionEngine/JIT.h" >> +#include "llvm/Module.h" >> +#include "llvm/PassManager.h" >> +#include "llvm/Intrinsics.h" >> +#include "llvm/Analysis/Verifier.h" >> +#include "llvm/Target/TargetData.h" >> +#include "llvm/Target/TargetSelect.h" >> +#include "llvm/Target/TargetOptions.h" >> +#include "llvm/Transforms/Scalar.h" >> +#include "llvm/Support/IRBuilder.h" >> +#include "llvm/Support/Dwarf.h" >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> + >> +#ifndef USE_GLOBAL_STR_CONSTS >> +#define USE_GLOBAL_STR_CONSTS true >> +#endif >> + >> +// System C++ ABI unwind types from: >> +// http://refspecs.freestandards.org/abi-eh-1.21.html >> + >> +extern "C" { >> + >> +typedef enum { >> + _URC_NO_REASON = 0, >> + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, >> + _URC_FATAL_PHASE2_ERROR = 2, >> + _URC_FATAL_PHASE1_ERROR = 3, >> + _URC_NORMAL_STOP = 4, >> + _URC_END_OF_STACK = 5, >> + _URC_HANDLER_FOUND = 6, >> + _URC_INSTALL_CONTEXT = 7, >> + _URC_CONTINUE_UNWIND = 8 >> +} _Unwind_Reason_Code; >> + >> +typedef enum { >> + _UA_SEARCH_PHASE = 1, >> + _UA_CLEANUP_PHASE = 2, >> + _UA_HANDLER_FRAME = 4, >> + _UA_FORCE_UNWIND = 8, >> + _UA_END_OF_STACK = 16 >> +} _Unwind_Action; >> + >> +struct _Unwind_Exception; >> + >> +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, >> + struct _Unwind_Exception *); >> + >> +struct _Unwind_Exception { >> + uint64_t exception_class; >> + _Unwind_Exception_Cleanup_Fn exception_cleanup; >> + >> + uintptr_t private_1; >> + uintptr_t private_2; >> + >> + // @@@ The IA-64 ABI says that this structure must be double-word aligned. >> + // Taking that literally does not make much sense generically. Instead >> + // we provide the maximum alignment required by any type for the machine. >> +} __attribute__((__aligned__)); >> + >> +struct _Unwind_Context; >> +typedef struct _Unwind_Context* _Unwind_Context_t; >> + >> +extern const uint8_t* _Unwind_GetLanguageSpecificData (_Unwind_Context_t c); >> +extern uintptr_t _Unwind_GetGR (_Unwind_Context_t c, int i); >> +extern void _Unwind_SetGR (_Unwind_Context_t c, int i, uintptr_t n); >> +extern void _Unwind_SetIP (_Unwind_Context_t, uintptr_t new_value); >> +extern uintptr_t _Unwind_GetIP (_Unwind_Context_t context); >> +extern uintptr_t _Unwind_GetRegionStart (_Unwind_Context_t context); >> + >> +} // extern "C" >> + >> +// >> +// Example types >> +// >> + >> +/// This is our simplistic type info >> +struct OurExceptionType_t { >> + /// type info type >> + int type; >> +}; >> + >> + >> +/// This is our Exception class which relies on a negative offset to calculate >> +/// pointers to its instances from pointers to its unwindException member. >> +/// >> +/// Note: The above unwind.h defines struct _Unwind_Exception to be aligned >> +/// on a double word boundary. This is necessary to match the standard: >> +/// http://refspecs.freestandards.org/abi-eh-1.21.html >> +struct OurBaseException_t { >> + struct OurExceptionType_t type; >> + >> + // Note: This is properly aligned in unwind.h >> + struct _Unwind_Exception unwindException; >> +}; >> + >> + >> +// Note: Not needed since we are C++ >> +typedef struct OurBaseException_t OurException; >> +typedef struct _Unwind_Exception OurUnwindException; >> + >> +// >> +// Various globals used to support typeinfo and generatted exceptions in >> +// general >> +// >> + >> +static std::map namedValues; >> + >> +int64_t ourBaseFromUnwindOffset; >> + >> +const unsigned char ourBaseExcpClassChars[] = >> + {'o', 'b', 'j', '\0', 'b', 'a', 's', '\0'}; >> + >> + >> +static uint64_t ourBaseExceptionClass = 0; >> + >> +static std::vector ourTypeInfoNames; >> +static std::map ourTypeInfoNamesIndex; >> + >> +static llvm::StructType* ourTypeInfoType; >> +static llvm::StructType* ourExceptionType; >> +static llvm::StructType* ourUnwindExceptionType; >> + >> +static llvm::ConstantInt* ourExceptionNotThrownState; >> +static llvm::ConstantInt* ourExceptionThrownState; >> +static llvm::ConstantInt* ourExceptionCaughtState; >> + >> +typedef std::vector ArgNames; >> +typedef std::vector ArgTypes; >> + >> +// >> +// Code Generation Utilities >> +// >> + >> +/// Utility used to create a function, both declarations and definitions >> +/// @param module for module instance >> +/// @param retType function return type >> +/// @param theArgTypes function's ordered argument types >> +/// @param theArgNames function's ordered arguments needed if use of this >> +/// function corresponds to a function definition. Use empty >> +/// aggregate for function declarations. >> +/// @param functName function name >> +/// @param linkage function linkage >> +/// @param declarationOnly for function declarations >> +/// @param isVarArg function uses vararg arguments >> +/// @returns function instance >> +llvm::Function *createFunction(llvm::Module& module, >> + const llvm::Type* retType, >> + const ArgTypes& theArgTypes, >> + const ArgNames& theArgNames, >> + const std::string& functName, >> + llvm::GlobalValue::LinkageTypes linkage, >> + bool declarationOnly, >> + bool isVarArg) { >> + llvm::FunctionType* functType = llvm::FunctionType::get(retType, >> + theArgTypes, >> + isVarArg); >> + llvm::Function* ret = llvm::Function::Create(functType, >> + linkage, >> + functName, >> + &module); >> + if (!ret || declarationOnly) >> + return(ret); >> + >> + namedValues.clear(); >> + unsigned i = 0; >> + for (llvm::Function::arg_iterator argIndex = ret->arg_begin(); >> + i != theArgNames.size(); >> + ++argIndex, ++i) { >> + >> + argIndex->setName(theArgNames[i]); >> + namedValues[theArgNames[i]] = argIndex; >> + } >> + >> + return(ret); >> +} >> + >> + >> +/// Create an alloca instruction in the entry block of >> +/// the parent function. This is used for mutable variables etc. >> +/// @param function parent instance >> +/// @param varName stack variable name >> +/// @param type stack variable type >> +/// @param initWith optional constant initialization value >> +/// @returns AllocaInst instance >> +static llvm::AllocaInst *createEntryBlockAlloca(llvm::Function& function, >> + const std::string &varName, >> + const llvm::Type* type, >> + llvm::Constant* initWith = NULL) { >> + llvm::BasicBlock& block = function.getEntryBlock(); >> + llvm::IRBuilder<> tmp(&block, block.begin()); >> + llvm::AllocaInst* ret = tmp.CreateAlloca(type, 0, varName.c_str()); >> + >> + if (initWith) >> + tmp.CreateStore(initWith, ret); >> + >> + return(ret); >> +} >> + >> + >> +// >> +// Code Generation Utilities End >> +// >> + >> +// >> +// Runtime C Library functions >> +// >> + >> +// Note: using an extern "C" block so that static functions can be used >> +extern "C" { >> + >> +// Note: Better ways to decide on bit width >> +// >> +/// Prints a 32 bit number, according to the format, to stderr. >> +/// @param intToPrint integer to print >> +/// @param format printf like format to use when printing >> +void print32Int(int intToPrint, const char* format) { >> + if (format) { >> + // Note: No NULL check >> + fprintf(stderr, format, intToPrint); >> + } >> + else { >> + // Note: No NULL check >> + fprintf(stderr, "::print32Int(...):NULL arg.\n"); >> + } >> +} >> + >> + >> +// Note: Better ways to decide on bit width >> +// >> +/// Prints a 64 bit number, according to the format, to stderr. >> +/// @param intToPrint integer to print >> +/// @param format printf like format to use when printing >> +void print64Int(long int intToPrint, const char* format) { >> + if (format) { >> + // Note: No NULL check >> + fprintf(stderr, format, intToPrint); >> + } >> + else { >> + // Note: No NULL check >> + fprintf(stderr, "::print64Int(...):NULL arg.\n"); >> + } >> +} >> + >> + >> +/// Prints a C string to stderr >> +/// @param toPrint string to print >> +void printStr(char* toPrint) { >> + if (toPrint) { >> + fprintf(stderr, "%s", toPrint); >> + } >> + else { >> + fprintf(stderr, "::printStr(...):NULL arg.\n"); >> + } >> +} >> + >> + >> +/// Deletes the true previosly allocated exception whose address >> +/// is calculated from the supplied OurBaseException_t::unwindException >> +/// member address. Handles (ignores), NULL pointers. >> +/// @param expToDelete exception to delete >> +void deleteOurException(OurUnwindException* expToDelete) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "deleteOurException(...).\n"); >> +#endif >> + >> + if (expToDelete && >> + (expToDelete->exception_class == ourBaseExceptionClass)) { >> + >> + free(((char*) expToDelete) + ourBaseFromUnwindOffset); >> + } >> +} >> + >> + >> +/// This function is the struct _Unwind_Exception API mandated delete function >> +/// used by foreign exception handlers when deleting our exception >> +/// (OurException), instances. >> +/// @param reason @link http://refspecs.freestandards.org/abi-eh-1.21.html >> +/// @unlink >> +/// @param expToDelete exception instance to delete >> +void deleteFromUnwindOurException(_Unwind_Reason_Code reason, >> + OurUnwindException* expToDelete) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "deleteFromUnwindOurException(...).\n"); >> +#endif >> + >> + deleteOurException(expToDelete); >> +} >> + >> + >> +/// Creates (allocates on the heap), an exception (OurException instance), >> +/// of the supplied type info type. >> +/// @param type type info type >> +OurUnwindException* createOurException(int type) { >> + size_t size = sizeof(OurException); >> + OurException* ret = (OurException*) memset(malloc(size), 0, size); >> + (ret->type).type = type; >> + (ret->unwindException).exception_class = ourBaseExceptionClass; >> + (ret->unwindException).exception_cleanup = deleteFromUnwindOurException; >> + >> + return(&(ret->unwindException)); >> +} >> + >> + >> +/// Read a uleb128 encoded value and advance pointer >> +/// See Variable Length Data in: >> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >> +/// @param data reference variable holding memory pointer to decode from >> +/// @returns decoded value >> +static uintptr_t readULEB128(const uint8_t** data) { >> + uintptr_t result = 0; >> + uintptr_t shift = 0; >> + unsigned char byte; >> + const uint8_t* p = *data; >> + >> + do { >> + byte = *p++; >> + result |= (byte & 0x7f) << shift; >> + shift += 7; >> + } >> + while (byte & 0x80); >> + >> + *data = p; >> + >> + return result; >> +} >> + >> + >> +/// Read a sleb128 encoded value and advance pointer >> +/// See Variable Length Data in: >> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >> +/// @param data reference variable holding memory pointer to decode from >> +/// @returns decoded value >> +static uintptr_t readSLEB128(const uint8_t** data) { >> + uintptr_t result = 0; >> + uintptr_t shift = 0; >> + unsigned char byte; >> + const uint8_t* p = *data; >> + >> + do { >> + byte = *p++; >> + result |= (byte & 0x7f) << shift; >> + shift += 7; >> + } >> + while (byte & 0x80); >> + >> + *data = p; >> + >> + if ((byte & 0x40) && (shift < (sizeof(result) << 3))) { >> + result |= (~0 << shift); >> + } >> + >> + return result; >> +} >> + >> + >> +/// Read a pointer encoded value and advance pointer >> +/// See Variable Length Data in: >> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >> +/// @param data reference variable holding memory pointer to decode from >> +/// @param encoding dwarf encoding type >> +/// @returns decoded value >> +static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { >> + uintptr_t result = 0; >> + const uint8_t* p = *data; >> + >> + if (encoding == llvm::dwarf::DW_EH_PE_omit) >> + return(result); >> + >> + // first get value >> + switch (encoding & 0x0F) { >> + case llvm::dwarf::DW_EH_PE_absptr: >> + result = *((uintptr_t*)p); >> + p += sizeof(uintptr_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_uleb128: >> + result = readULEB128(&p); >> + break; >> + // Note: This case has not been tested >> + case llvm::dwarf::DW_EH_PE_sleb128: >> + result = readSLEB128(&p); >> + break; >> + case llvm::dwarf::DW_EH_PE_udata2: >> + result = *((uint16_t*)p); >> + p += sizeof(uint16_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_udata4: >> + result = *((uint32_t*)p); >> + p += sizeof(uint32_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_udata8: >> + result = *((uint64_t*)p); >> + p += sizeof(uint64_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_sdata2: >> + result = *((int16_t*)p); >> + p += sizeof(int16_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_sdata4: >> + result = *((int32_t*)p); >> + p += sizeof(int32_t); >> + break; >> + case llvm::dwarf::DW_EH_PE_sdata8: >> + result = *((int64_t*)p); >> + p += sizeof(int64_t); >> + break; >> + default: >> + // not supported >> + abort(); >> + break; >> + } >> + >> + // then add relative offset >> + switch (encoding & 0x70) { >> + case llvm::dwarf::DW_EH_PE_absptr: >> + // do nothing >> + break; >> + case llvm::dwarf::DW_EH_PE_pcrel: >> + result += (uintptr_t)(*data); >> + break; >> + case llvm::dwarf::DW_EH_PE_textrel: >> + case llvm::dwarf::DW_EH_PE_datarel: >> + case llvm::dwarf::DW_EH_PE_funcrel: >> + case llvm::dwarf::DW_EH_PE_aligned: >> + default: >> + // not supported >> + abort(); >> + break; >> + } >> + >> + // then apply indirection >> + if (encoding & llvm::dwarf::DW_EH_PE_indirect) { >> + result = *((uintptr_t*)result); >> + } >> + >> + *data = p; >> + >> + return result; >> +} >> + >> + >> +/// Deals with Dwarf actions matching our type infos >> +/// (OurExceptionType_t instances). Returns whether or not a dwarf emitted >> +/// action matches the supplied exception type. If such a match succeeds, >> +/// the resultAction argument will be set with > 0 index value. Only >> +/// corresponding llvm.eh.selector type info arguments, cleanup arguments >> +/// are supported. Filters are not supported. >> +/// See Variable Length Data in: >> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >> +/// Also see @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >> +/// @param resultAction reference variable which will be set with result >> +/// @param classInfo our array of type info pointers (to globals) >> +/// @param actionEntry index into above type info array or 0 (clean up). >> +/// We do not support filters. >> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >> +/// of thrown exception. >> +/// @param exceptionObject thrown _Unwind_Exception instance. >> +/// @returns whether or not a type info was found. False is returned if only >> +/// a cleanup was found >> +static bool handleActionValue(int64_t *resultAction, >> + struct OurExceptionType_t **classInfo, >> + uintptr_t actionEntry, >> + uint64_t exceptionClass, >> + struct _Unwind_Exception *exceptionObject) { >> + bool ret = false; >> + >> + if (!resultAction || >> + !exceptionObject || >> + (exceptionClass != ourBaseExceptionClass)) >> + return(ret); >> + >> + struct OurBaseException_t* excp = (struct OurBaseException_t*) >> + (((char*) exceptionObject) + ourBaseFromUnwindOffset); >> + struct OurExceptionType_t *excpType = &(excp->type); >> + int type = excpType->type; >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleActionValue(...): exceptionObject = <%p>, " >> + "excp = <%p>.\n", >> + exceptionObject, >> + excp); >> +#endif >> + >> + const uint8_t *actionPos = (uint8_t*) actionEntry, >> + *tempActionPos; >> + int64_t typeOffset = 0, >> + actionOffset; >> + >> + for (int i = 0; true; ++i) { >> + // Each emitted dwarf action corresponds to a 2 tuple of >> + // type info address offset, and action offset to the next >> + // emitted action. >> + typeOffset = readSLEB128(&actionPos); >> + tempActionPos = actionPos; >> + actionOffset = readSLEB128(&tempActionPos); >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleActionValue(...):typeOffset: <%lld>, " >> + "actionOffset: <%lld>.\n", >> + typeOffset, >> + actionOffset); >> +#endif >> + assert((typeOffset >= 0) && >> + "handleActionValue(...):filters are not supported."); >> + >> + // Note: A typeOffset == 0 implies that a cleanup llvm.eh.selector >> + // argument has been matched. >> + if ((typeOffset > 0) && >> + (type == (classInfo[-typeOffset])->type)) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleActionValue(...):actionValue <%d> found.\n", >> + i); >> +#endif >> + *resultAction = i + 1; >> + ret = true; >> + break; >> + } >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleActionValue(...):actionValue not found.\n"); >> +#endif >> + if (!actionOffset) >> + break; >> + >> + actionPos += actionOffset; >> + } >> + >> + return(ret); >> +} >> + >> + >> +/// Deals with the Language specific data portion of the emitted dwarf code. >> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >> +/// @param version unsupported (ignored), unwind version >> +/// @param lsda language specific data area >> +/// @param _Unwind_Action actions minimally supported unwind stage >> +/// (forced specifically not supported) >> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >> +/// of thrown exception. >> +/// @param exceptionObject thrown _Unwind_Exception instance. >> +/// @param context unwind system context >> +/// @returns minimally supported unwinding control indicator >> +static _Unwind_Reason_Code handleLsda(int version, >> + const uint8_t* lsda, >> + _Unwind_Action actions, >> + uint64_t exceptionClass, >> + struct _Unwind_Exception* exceptionObject, >> + _Unwind_Context_t context) { >> + _Unwind_Reason_Code ret = _URC_CONTINUE_UNWIND; >> + >> + if (!lsda) >> + return(ret); >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...):lsda is non-zero.\n"); >> +#endif >> + >> + // Get the current instruction pointer and offset it before next >> + // instruction in the current frame which threw the exception. >> + uintptr_t pc = _Unwind_GetIP(context)-1; >> + >> + // Get beginning current frame's code (as defined by the >> + // emitted dwarf code) >> + uintptr_t funcStart = _Unwind_GetRegionStart(context); >> + uintptr_t pcOffset = pc - funcStart; >> + struct OurExceptionType_t** classInfo = NULL; >> + >> + // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding >> + // dwarf emission >> + >> + // Parse LSDA header. >> + uint8_t lpStartEncoding = *lsda++; >> + >> + if (lpStartEncoding != llvm::dwarf::DW_EH_PE_omit) { >> + readEncodedPointer(&lsda, lpStartEncoding); >> + } >> + >> + uint8_t ttypeEncoding = *lsda++; >> + uintptr_t classInfoOffset; >> + >> + if (ttypeEncoding != llvm::dwarf::DW_EH_PE_omit) { >> + // Calculate type info locations in emitted dwarf code which >> + // were flagged by type info arguments to llvm.eh.selector >> + // intrinsic >> + classInfoOffset = readULEB128(&lsda); >> + classInfo = (struct OurExceptionType_t**) (lsda + classInfoOffset); >> + } >> + >> + // Walk call-site table looking for range that >> + // includes current PC. >> + >> + uint8_t callSiteEncoding = *lsda++; >> + uint32_t callSiteTableLength = readULEB128(&lsda); >> + const uint8_t* callSiteTableStart = lsda; >> + const uint8_t* callSiteTableEnd = callSiteTableStart + >> + callSiteTableLength; >> + const uint8_t* actionTableStart = callSiteTableEnd; >> + const uint8_t* callSitePtr = callSiteTableStart; >> + >> + bool foreignException = false; >> + >> + while (callSitePtr < callSiteTableEnd) { >> + uintptr_t start = readEncodedPointer(&callSitePtr, >> + callSiteEncoding); >> + uintptr_t length = readEncodedPointer(&callSitePtr, >> + callSiteEncoding); >> + uintptr_t landingPad = readEncodedPointer(&callSitePtr, >> + callSiteEncoding); >> + >> + // Note: Action value >> + uintptr_t actionEntry = readULEB128(&callSitePtr); >> + >> + if (exceptionClass != ourBaseExceptionClass) { >> + // We have been notified of a foreign exception being thrown, >> + // and we therefore need to execute cleanup landing pads >> + actionEntry = 0; >> + foreignException = true; >> + } >> + >> + if (landingPad == 0) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...): No landing pad found.\n"); >> +#endif >> + >> + continue; // no landing pad for this entry >> + } >> + >> + if (actionEntry) { >> + actionEntry += ((uintptr_t) actionTableStart) - 1; >> + } >> + else { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...):No action table found.\n"); >> +#endif >> + } >> + >> + bool exceptionMatched = false; >> + >> + if ((start <= pcOffset) && (pcOffset < (start + length))) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...): Landing pad found.\n"); >> +#endif >> + int64_t actionValue = 0; >> + >> + if (actionEntry) { >> + exceptionMatched = handleActionValue >> + ( >> + &actionValue, >> + classInfo, >> + actionEntry, >> + exceptionClass, >> + exceptionObject >> + ); >> + } >> + >> + if (!(actions & _UA_SEARCH_PHASE)) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...): installed landing pad " >> + "context.\n"); >> +#endif >> + >> + // Found landing pad for the PC. >> + // Set Instruction Pointer to so we re-enter function >> + // at landing pad. The landing pad is created by the >> + // compiler to take two parameters in registers. >> + _Unwind_SetGR(context, >> + __builtin_eh_return_data_regno(0), >> + (uintptr_t)exceptionObject); >> + >> + // Note: this virtual register directly corresponds >> + // to the return of the llvm.eh.selector intrinsic >> + if (!actionEntry || !exceptionMatched) { >> + // We indicate cleanup only >> + _Unwind_SetGR(context, >> + __builtin_eh_return_data_regno(1), >> + 0); >> + } >> + else { >> + // Matched type info index of llvm.eh.selector intrinsic >> + // passed here. >> + _Unwind_SetGR(context, >> + __builtin_eh_return_data_regno(1), >> + actionValue); >> + } >> + >> + // To execute landing pad set here >> + _Unwind_SetIP(context, funcStart + landingPad); >> + ret = _URC_INSTALL_CONTEXT; >> + } >> + else if (exceptionMatched) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...): setting handler found.\n"); >> +#endif >> + ret = _URC_HANDLER_FOUND; >> + } >> + else { >> + // Note: Only non-clean up handlers are marked as >> + // found. Otherwise the clean up handlers will be >> + // re-found and executed during the clean up >> + // phase. >> +#ifdef DEBUG >> + fprintf(stderr, >> + "handleLsda(...): cleanup handler found.\n"); >> +#endif >> + } >> + >> + break; >> + } >> + } >> + >> + return(ret); >> +} >> + >> + >> +/// This is the personality function which is embedded (dwarf emitted), in the >> +/// dwarf unwind info block. Again see: JITDwarfEmitter.cpp. >> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >> +/// @param version unsupported (ignored), unwind version >> +/// @param _Unwind_Action actions minimally supported unwind stage >> +/// (forced specifically not supported) >> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >> +/// of thrown exception. >> +/// @param exceptionObject thrown _Unwind_Exception instance. >> +/// @param context unwind system context >> +/// @returns minimally supported unwinding control indicator >> +_Unwind_Reason_Code ourPersonality(int version, >> + _Unwind_Action actions, >> + uint64_t exceptionClass, >> + struct _Unwind_Exception* exceptionObject, >> + _Unwind_Context_t context) { >> +#ifdef DEBUG >> + fprintf(stderr, >> + "We are in ourPersonality(...):actions is <%d>.\n", >> + actions); >> + >> + if (actions & _UA_SEARCH_PHASE) { >> + fprintf(stderr, "ourPersonality(...):In search phase.\n"); >> + } >> + else { >> + fprintf(stderr, "ourPersonality(...):In non-search phase.\n"); >> + } >> +#endif >> + >> + const uint8_t* lsda = (uint8_t*) >> + _Unwind_GetLanguageSpecificData(context); >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "ourPersonality(...):lsda = <%p>.\n", >> + lsda); >> +#endif >> + >> + // The real work of the personality function is captured here >> + return(handleLsda(version, >> + lsda, >> + actions, >> + exceptionClass, >> + exceptionObject, >> + context)); >> +} >> + >> + >> +/// Generates our _Unwind_Exception class from a given character array. >> +/// thereby handling arbitrary lengths (not in standard), and handling >> +/// embedded \0s. >> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >> +/// @param classChars char array to encode. NULL values not checkedf >> +/// @param classCharsSize number of chars in classChars. Value is not checked. >> +/// @returns class value >> +uint64_t genClass(const unsigned char classChars[], size_t classCharsSize) >> +{ >> + uint64_t ret = classChars[0]; >> + >> + for (unsigned i = 1; i < classCharsSize; ++i) { >> + ret <<= 8; >> + ret += classChars[i]; >> + } >> + >> + return(ret); >> +} >> + >> +} // extern "C" >> + >> +// >> +// Runtime C Library functions End >> +// >> + >> +// >> +// Code generation functions >> +// >> + >> +/// Generates code to print given constant string >> +/// @param context llvm context >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param toPrint string to print >> +/// @param useGlobal A value of true (default) indicates a GlobalValue is >> +/// generated, and is used to hold the constant string. A value of >> +/// false indicates that the constant string will be stored on the >> +/// stack. >> +void generateStringPrint(llvm::LLVMContext& context, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + std::string toPrint, >> + bool useGlobal = true) { >> + llvm::Function *printFunct = module.getFunction("printStr"); >> + >> + llvm::Value *stringVar; >> + llvm::Constant* stringConstant = >> + llvm::ConstantArray::get(context, toPrint); >> + >> + if (useGlobal) { >> + // Note: Does not work without allocation >> + stringVar = >> + new llvm::GlobalVariable(module, >> + stringConstant->getType(), >> + true, >> + llvm::GlobalValue::LinkerPrivateLinkage, >> + stringConstant, >> + ""); >> + } >> + else { >> + stringVar = builder.CreateAlloca(stringConstant->getType()); >> + builder.CreateStore(stringConstant, stringVar); >> + } >> + >> + llvm::Value* cast = >> + builder.CreatePointerCast(stringVar, >> + builder.getInt8Ty()->getPointerTo()); >> + builder.CreateCall(printFunct, cast); >> +} >> + >> + >> +/// Generates code to print given runtime integer according to constant >> +/// string format, and a given print function. >> +/// @param context llvm context >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param printFunct function used to "print" integer >> +/// @param toPrint string to print >> +/// @param format printf like formating string for print >> +/// @param useGlobal A value of true (default) indicates a GlobalValue is >> +/// generated, and is used to hold the constant string. A value of >> +/// false indicates that the constant string will be stored on the >> +/// stack. >> +void generateIntegerPrint(llvm::LLVMContext& context, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::Function& printFunct, >> + llvm::Value& toPrint, >> + std::string format, >> + bool useGlobal = true) { >> + llvm::Constant *stringConstant = llvm::ConstantArray::get(context, format); >> + llvm::Value *stringVar; >> + >> + if (useGlobal) { >> + // Note: Does not seem to work without allocation >> + stringVar = >> + new llvm::GlobalVariable(module, >> + stringConstant->getType(), >> + true, >> + llvm::GlobalValue::LinkerPrivateLinkage, >> + stringConstant, >> + ""); >> + } >> + else { >> + stringVar = builder.CreateAlloca(stringConstant->getType()); >> + builder.CreateStore(stringConstant, stringVar); >> + } >> + >> + llvm::Value* cast = >> + builder.CreateBitCast(stringVar, >> + builder.getInt8Ty()->getPointerTo()); >> + builder.CreateCall2(&printFunct, &toPrint, cast); >> +} >> + >> + >> +/// Generates code to handle finally block type semantics: always runs >> +/// regardless of whether a thrown exception is passing through or the >> +/// parent function is simply exiting. In addition to printing some state >> +/// to stderr, this code will resume the exception handling--runs the >> +/// unwind resume block, if the exception has not been previously caught >> +/// by a catch clause, and will otherwise execute the end block (terminator >> +/// block). In addition this function creates the corresponding function's >> +/// stack storage for the exception pointer and catch flag status. >> +/// @param context llvm context >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param toAddTo parent function to add block to >> +/// @param blockName block name of new "finally" block. >> +/// @param functionId output id used for printing >> +/// @param terminatorBlock terminator "end" block >> +/// @param unwindResumeBlock unwind resume block >> +/// @param exceptionCaughtFlag reference exception caught/thrown status storage >> +/// @param exceptionStorage reference to exception pointer storage >> +/// @returns newly created block >> +static llvm::BasicBlock* createFinallyBlock(llvm::LLVMContext& context, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::Function& toAddTo, >> + std::string& blockName, >> + std::string& functionId, >> + llvm::BasicBlock& terminatorBlock, >> + llvm::BasicBlock& unwindResumeBlock, >> + llvm::Value** exceptionCaughtFlag, >> + llvm::Value** exceptionStorage) { >> + assert(exceptionCaughtFlag && >> + "ExceptionDemo::createFinallyBlock(...):exceptionCaughtFlag " >> + "is NULL"); >> + assert(exceptionStorage && >> + "ExceptionDemo::createFinallyBlock(...):exceptionStorage " >> + "is NULL"); >> + >> + *exceptionCaughtFlag = >> + createEntryBlockAlloca(toAddTo, >> + "exceptionCaught", >> + ourExceptionNotThrownState->getType(), >> + ourExceptionNotThrownState); >> + >> + const llvm::PointerType* exceptionStorageType = >> + builder.getInt8Ty()->getPointerTo(); >> + *exceptionStorage = >> + createEntryBlockAlloca(toAddTo, >> + "exceptionStorage", >> + exceptionStorageType, >> + llvm::ConstantPointerNull::get( >> + exceptionStorageType)); >> + >> + llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, >> + blockName, >> + &toAddTo); >> + >> + builder.SetInsertPoint(ret); >> + >> + std::ostringstream bufferToPrint; >> + bufferToPrint << "Gen: Executing finally block " >> + << blockName >> + << " in " >> + << functionId >> + << std::endl; >> + generateStringPrint(context, >> + module, >> + builder, >> + bufferToPrint.str(), >> + USE_GLOBAL_STR_CONSTS); >> + >> + llvm::SwitchInst* theSwitch = >> + builder.CreateSwitch(builder.CreateLoad(*exceptionCaughtFlag), >> + &terminatorBlock, >> + 2); >> + theSwitch->addCase(ourExceptionCaughtState, &terminatorBlock); >> + theSwitch->addCase(ourExceptionThrownState, &unwindResumeBlock); >> + >> + return(ret); >> +} >> + >> + >> +/// Generates catch block semantics which print a string to indicate type of >> +/// catch executed, sets an exception caught flag, and executes passed in >> +/// end block (terminator block). >> +/// @param context llvm context >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param toAddTo parent function to add block to >> +/// @param blockName block name of new "catch" block. >> +/// @param functionId output id used for printing >> +/// @param terminatorBlock terminator "end" block >> +/// @param exceptionCaughtFlag exception caught/thrown status >> +/// @returns newly created block >> +static llvm::BasicBlock* createCatchBlock(llvm::LLVMContext& context, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::Function& toAddTo, >> + std::string& blockName, >> + std::string& functionId, >> + llvm::BasicBlock& terminatorBlock, >> + llvm::Value& exceptionCaughtFlag) { >> + >> + llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, >> + blockName, >> + &toAddTo); >> + >> + builder.SetInsertPoint(ret); >> + >> + std::ostringstream bufferToPrint; >> + bufferToPrint << "Gen: Executing catch block " >> + << blockName >> + << " in " >> + << functionId >> + << std::endl; >> + generateStringPrint(context, >> + module, >> + builder, >> + bufferToPrint.str(), >> + USE_GLOBAL_STR_CONSTS); >> + builder.CreateStore(ourExceptionCaughtState, &exceptionCaughtFlag); >> + builder.CreateBr(&terminatorBlock); >> + >> + return(ret); >> +} >> + >> + >> +/// Generates a function which invokes a function (toInvoke) and, whose >> +/// unwind block will "catch" the type info types correspondingly held in the >> +/// exceptionTypesToCatch argument. If the toInvoke function throws an >> +/// exception which does not match any type info types contained in >> +/// exceptionTypesToCatch, the generated code will call _Unwind_Resume >> +/// with the raised exception. On the other hand the generated code will >> +/// normally exit if the toInvoke function does not throw an exception. >> +/// The generated "finally" block is always run regardless of the cause of >> +/// the generated function exit. >> +/// The generated function is returned after being verified. >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param fpm a function pass manager holding optional IR to IR >> +/// transformations >> +/// @param toInvoke inner function to invoke >> +/// @param ourId id used to printing purposes >> +/// @param numExceptionsToCatch length of exceptionTypesToCatch array >> +/// @param exceptionTypesToCatch array of type info types to "catch" >> +/// @returns generated function >> +static >> +llvm::Function* createCatchWrappedInvokeFunction(llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::FunctionPassManager& fpm, >> + llvm::Function& toInvoke, >> + std::string ourId, >> + unsigned numExceptionsToCatch, >> + unsigned exceptionTypesToCatch[]) { >> + >> + llvm::LLVMContext& context = module.getContext(); >> + llvm::Function *toPrint32Int = module.getFunction("print32Int"); >> + >> + ArgTypes argTypes; >> + argTypes.push_back(builder.getInt32Ty()); >> + >> + ArgNames argNames; >> + argNames.push_back("exceptTypeToThrow"); >> + >> + llvm::Function* ret = createFunction(module, >> + builder.getVoidTy(), >> + argTypes, >> + argNames, >> + ourId, >> + llvm::Function::ExternalLinkage, >> + false, >> + false); >> + >> + // Block which calls invoke >> + llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, >> + "entry", >> + ret); >> + // Normal block for invoke >> + llvm::BasicBlock *normalBlock = llvm::BasicBlock::Create(context, >> + "normal", >> + ret); >> + // Unwind block for invoke >> + llvm::BasicBlock *exceptionBlock = >> + llvm::BasicBlock::Create(context, "exception", ret); >> + >> + // Block which routes exception to correct catch handler block >> + llvm::BasicBlock *exceptionRouteBlock = >> + llvm::BasicBlock::Create(context, "exceptionRoute", ret); >> + >> + // Foreign exception handler >> + llvm::BasicBlock *externalExceptionBlock = >> + llvm::BasicBlock::Create(context, "externalException", ret); >> + >> + // Block which calls _Unwind_Resume >> + llvm::BasicBlock *unwindResumeBlock = >> + llvm::BasicBlock::Create(context, "unwindResume", ret); >> + >> + // Clean up block which delete exception if needed >> + llvm::BasicBlock *endBlock = >> + llvm::BasicBlock::Create(context, "end", ret); >> + >> + std::string nextName; >> + std::vector catchBlocks(numExceptionsToCatch); >> + llvm::Value* exceptionCaughtFlag = NULL; >> + llvm::Value* exceptionStorage = NULL; >> + >> + // Finally block which will branch to unwindResumeBlock if >> + // exception is not caught. Initializes/allocates stack locations. >> + llvm::BasicBlock* finallyBlock = createFinallyBlock(context, >> + module, >> + builder, >> + *ret, >> + nextName = "finally", >> + ourId, >> + *endBlock, >> + *unwindResumeBlock, >> + &exceptionCaughtFlag, >> + &exceptionStorage); >> + >> + for (unsigned i = 0; i < numExceptionsToCatch; ++i) { >> + nextName = ourTypeInfoNames[exceptionTypesToCatch[i]]; >> + >> + // One catch block per type info to be caught >> + catchBlocks[i] = createCatchBlock(context, >> + module, >> + builder, >> + *ret, >> + nextName, >> + ourId, >> + *finallyBlock, >> + *exceptionCaughtFlag); >> + } >> + >> + // Entry Block >> + >> + builder.SetInsertPoint(entryBlock); >> + >> + std::vector args; >> + args.push_back(namedValues["exceptTypeToThrow"]); >> + builder.CreateInvoke(&toInvoke, >> + normalBlock, >> + exceptionBlock, >> + args.begin(), >> + args.end()); >> + >> + // End Block >> + >> + builder.SetInsertPoint(endBlock); >> + >> + generateStringPrint(context, >> + module, >> + builder, >> + "Gen: In end block: exiting in " + ourId + ".\n", >> + USE_GLOBAL_STR_CONSTS); >> + llvm::Function *deleteOurException = >> + module.getFunction("deleteOurException"); >> + >> + // Note: function handles NULL exceptions >> + builder.CreateCall(deleteOurException, >> + builder.CreateLoad(exceptionStorage)); >> + builder.CreateRetVoid(); >> + >> + // Normal Block >> + >> + builder.SetInsertPoint(normalBlock); >> + >> + generateStringPrint(context, >> + module, >> + builder, >> + "Gen: No exception in " + ourId + "!\n", >> + USE_GLOBAL_STR_CONSTS); >> + >> + // Finally block is always called >> + builder.CreateBr(finallyBlock); >> + >> + // Unwind Resume Block >> + >> + builder.SetInsertPoint(unwindResumeBlock); >> + >> + llvm::Function *resumeOurException = >> + module.getFunction("_Unwind_Resume"); >> + builder.CreateCall(resumeOurException, >> + builder.CreateLoad(exceptionStorage)); >> + builder.CreateUnreachable(); >> + >> + // Exception Block >> + >> + builder.SetInsertPoint(exceptionBlock); >> + >> + llvm::Function *ehException = module.getFunction("llvm.eh.exception"); >> + >> + // Retrieve thrown exception >> + llvm::Value* unwindException = builder.CreateCall(ehException); >> + >> + // Store exception and flag >> + builder.CreateStore(unwindException, exceptionStorage); >> + builder.CreateStore(ourExceptionThrownState, exceptionCaughtFlag); >> + llvm::Function *personality = module.getFunction("ourPersonality"); >> + llvm::Value* functPtr = >> + builder.CreatePointerCast(personality, >> + builder.getInt8Ty()->getPointerTo()); >> + >> + args.clear(); >> + args.push_back(unwindException); >> + args.push_back(functPtr); >> + >> + // Note: Skipping index 0 >> + for (unsigned i = 0; i < numExceptionsToCatch; ++i) { >> + // Set up type infos to be caught >> + args.push_back( >> + module.getGlobalVariable( >> + ourTypeInfoNames[exceptionTypesToCatch[i]])); >> + } >> + >> + args.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), 0)); >> + >> + llvm::Function *ehSelector = module.getFunction("llvm.eh.selector"); >> + >> + // Set up this exeption block as the landing pad which will handle >> + // given type infos. See case Intrinsic::eh_selector in >> + // SelectionDAGBuilder::visitIntrinsicCall(...) and AddCatchInfo(...) >> + // implemented in FunctionLoweringInfo.cpp to see how the implementation >> + // handles this call. This landing pad (this exception block), will be >> + // called either because it nees to cleanup (call finally) or a type >> + // info was found which matched the thrown exception. >> + llvm::Value* retTypeInfoIndex = builder.CreateCall(ehSelector, >> + args.begin(), >> + args.end()); >> + >> + // Retrieve exception_class member from thrown exception >> + // (_Unwind_Exception instance). This member tells us whether or not >> + // the exception is foreign. >> + llvm::Value* unwindExceptionClass = >> + builder.CreateLoad( >> + builder.CreateStructGEP( >> + builder.CreatePointerCast( >> + unwindException, >> + ourUnwindExceptionType->getPointerTo()), >> + 0)); >> + >> + // Branch to the externalExceptionBlock if the exception is foreign or >> + // to a catch router if not. Either way the finally block will be run. >> + builder.CreateCondBr( >> + builder.CreateICmpEQ(unwindExceptionClass, >> + llvm::ConstantInt::get(builder.getInt64Ty(), >> + ourBaseExceptionClass)), >> + exceptionRouteBlock, >> + externalExceptionBlock); >> + >> + // External Exception Block >> + >> + builder.SetInsertPoint(externalExceptionBlock); >> + >> + generateStringPrint(context, >> + module, >> + builder, >> + "Gen: Foreign exception received.\n", >> + USE_GLOBAL_STR_CONSTS); >> + >> + // Branch to the finally block >> + builder.CreateBr(finallyBlock); >> + >> + // Exception Route Block >> + >> + builder.SetInsertPoint(exceptionRouteBlock); >> + >> + // Casts exception pointer (_Unwind_Exception instance) to parent >> + // (OurException instance). >> + // >> + // Note: ourBaseFromUnwindOffset is usually negative >> + llvm::Value* typeInfoThrown = >> + builder.CreatePointerCast( >> + builder.CreateConstGEP1_64(unwindException, >> + ourBaseFromUnwindOffset), >> + ourExceptionType->getPointerTo()); >> + >> + // Retrieve thrown exception type info type >> + // >> + // Note: Index is not relative to pointer but instead to structure >> + // unlike a true getelementptr (GEP) instruction >> + typeInfoThrown = builder.CreateStructGEP(typeInfoThrown, 0); >> + >> + llvm::Value* typeInfoThrownType = >> + builder.CreateStructGEP(typeInfoThrown, 0); >> + >> + generateIntegerPrint(context, >> + module, >> + builder, >> + *toPrint32Int, >> + *(builder.CreateLoad(typeInfoThrownType)), >> + "Gen: Exception type <%d> received (stack unwound) " >> + " in " + >> + ourId + >> + ".\n", >> + USE_GLOBAL_STR_CONSTS); >> + >> + // Route to matched type info catch block or run cleanup finally block >> + llvm::SwitchInst* switchToCatchBlock = >> + builder.CreateSwitch(retTypeInfoIndex, >> + finallyBlock, >> + numExceptionsToCatch); >> + >> + unsigned nextTypeToCatch; >> + >> + for (unsigned i = 1; i <= numExceptionsToCatch; ++i) { >> + nextTypeToCatch = i - 1; >> + switchToCatchBlock->addCase(llvm::ConstantInt::get( >> + llvm::Type::getInt32Ty(context), >> + i), >> + catchBlocks[nextTypeToCatch]); >> + } >> + >> + llvm::verifyFunction(*ret); >> + fpm.run(*ret); >> + >> + return(ret); >> +} >> + >> + >> +/// Generates function which throws either an exception matched to a runtime >> +/// determined type info type (argument to generated function), or if this >> +/// runtime value matches nativeThrowType, throws a foreign exception by >> +/// calling nativeThrowFunct. >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param fpm a function pass manager holding optional IR to IR >> +/// transformations >> +/// @param ourId id used to printing purposes >> +/// @param nativeThrowType a runtime argument of this value results in >> +/// nativeThrowFunct being called to generate/throw exception. >> +/// @param nativeThrowFunct function which will throw a foreign exception >> +/// if the above nativeThrowType matches generated function's arg. >> +/// @returns generated function >> +static >> +llvm::Function* createThrowExceptionFunction(llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::FunctionPassManager& fpm, >> + std::string ourId, >> + int32_t nativeThrowType, >> + llvm::Function& nativeThrowFunct) { >> + llvm::LLVMContext& context = module.getContext(); >> + namedValues.clear(); >> + ArgTypes unwindArgTypes; >> + unwindArgTypes.push_back(builder.getInt32Ty()); >> + ArgNames unwindArgNames; >> + unwindArgNames.push_back("exceptTypeToThrow"); >> + >> + llvm::Function *ret = createFunction(module, >> + builder.getVoidTy(), >> + unwindArgTypes, >> + unwindArgNames, >> + ourId, >> + llvm::Function::ExternalLinkage, >> + false, >> + false); >> + >> + // Throws either one of our exception or a native C++ exception depending >> + // on a runtime argument value containing a type info type. >> + llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, >> + "entry", >> + ret); >> + // Throws a foreign exception >> + llvm::BasicBlock *nativeThrowBlock = >> + llvm::BasicBlock::Create(context, >> + "nativeThrow", >> + ret); >> + // Throws one of our Exceptions >> + llvm::BasicBlock *generatedThrowBlock = >> + llvm::BasicBlock::Create(context, >> + "generatedThrow", >> + ret); >> + // Retrieved runtime type info type to throw >> + llvm::Value* exceptionType = namedValues["exceptTypeToThrow"]; >> + >> + // nativeThrowBlock block >> + >> + builder.SetInsertPoint(nativeThrowBlock); >> + >> + // Throws foreign exception >> + builder.CreateCall(&nativeThrowFunct, exceptionType); >> + builder.CreateUnreachable(); >> + >> + // entry block >> + >> + builder.SetInsertPoint(entryBlock); >> + >> + llvm::Function *toPrint32Int = module.getFunction("print32Int"); >> + generateIntegerPrint(context, >> + module, >> + builder, >> + *toPrint32Int, >> + *exceptionType, >> + "\nGen: About to throw exception type <%d> in " + >> + ourId + >> + ".\n", >> + USE_GLOBAL_STR_CONSTS); >> + >> + // Switches on runtime type info type value to determine whether or not >> + // a foreign exception is thrown. Defaults to throwing one of our >> + // generated exceptions. >> + llvm::SwitchInst* theSwitch = builder.CreateSwitch(exceptionType, >> + generatedThrowBlock, >> + 1); >> + >> + theSwitch->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), >> + nativeThrowType), >> + nativeThrowBlock); >> + >> + // generatedThrow block >> + >> + builder.SetInsertPoint(generatedThrowBlock); >> + >> + llvm::Function *createOurException = >> + module.getFunction("createOurException"); >> + llvm::Function *raiseOurException = >> + module.getFunction("_Unwind_RaiseException"); >> + >> + // Creates exception to throw with runtime type info type. >> + llvm::Value* exception = >> + builder.CreateCall(createOurException, >> + namedValues["exceptTypeToThrow"]); >> + >> + // Throw generated Exception >> + builder.CreateCall(raiseOurException, exception); >> + builder.CreateUnreachable(); >> + >> + llvm::verifyFunction(*ret); >> + fpm.run(*ret); >> + >> + return(ret); >> +} >> + >> +static void createStandardUtilityFunctions(unsigned numTypeInfos, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder); >> + >> +/// Creates test code by generating and organizing these functions into the >> +/// test case. The test case consists of an outer function setup to invoke >> +/// an inner function within an environment having multiple catch and single >> +/// finally blocks. This inner function is also setup to invoke a throw >> +/// function within an evironment similar in nature to the outer function's >> +/// catch and finally blocks. Each of these two functions catch mutually >> +/// exclusive subsets (even or odd) of the type info types configured >> +/// for this this. All generated functions have a runtime argument which >> +/// holds a type info type to throw that each function takes and passes it >> +/// to the inner one if such a inner function exists. This type info type is >> +/// looked at by the generated throw function to see whether or not it should >> +/// throw a generated exception with the same type info type, or instead call >> +/// a supplied a function which in turn will throw a foreign exception. >> +/// @param module code for module instance >> +/// @param builder builder instance >> +/// @param fpm a function pass manager holding optional IR to IR >> +/// transformations >> +/// @param nativeThrowFunctName name of external function which will throw >> +/// a foreign exception >> +/// @returns outermost generated test function. >> +llvm::Function* createUnwindExceptionTest(llvm::Module& module, >> + llvm::IRBuilder<>& builder, >> + llvm::FunctionPassManager& fpm, >> + std::string nativeThrowFunctName) { >> + // Number of type infos to generate >> + unsigned numTypeInfos = 6; >> + >> + // Initialze intrisics and external functions to use along with exception >> + // and type info globals. >> + createStandardUtilityFunctions(numTypeInfos, >> + module, >> + builder); >> + llvm::Function *nativeThrowFunct = >> + module.getFunction(nativeThrowFunctName); >> + >> + // Create exception throw function using the value ~0 to cause >> + // foreign exceptions to be thrown. >> + llvm::Function* throwFunct = >> + createThrowExceptionFunction(module, >> + builder, >> + fpm, >> + "throwFunct", >> + ~0, >> + *nativeThrowFunct); >> + // Inner function will catch even type infos >> + unsigned innerExceptionTypesToCatch[] = {6, 2, 4}; >> + size_t numExceptionTypesToCatch = sizeof(innerExceptionTypesToCatch) / >> + sizeof(unsigned); >> + >> + // Generate inner function. >> + llvm::Function* innerCatchFunct = >> + createCatchWrappedInvokeFunction(module, >> + builder, >> + fpm, >> + *throwFunct, >> + "innerCatchFunct", >> + numExceptionTypesToCatch, >> + innerExceptionTypesToCatch); >> + >> + // Outer function will catch odd type infos >> + unsigned outerExceptionTypesToCatch[] = {3, 1, 5}; >> + numExceptionTypesToCatch = sizeof(outerExceptionTypesToCatch) / >> + sizeof(unsigned); >> + >> + // Generate outer function >> + llvm::Function* outerCatchFunct = >> + createCatchWrappedInvokeFunction(module, >> + builder, >> + fpm, >> + *innerCatchFunct, >> + "outerCatchFunct", >> + numExceptionTypesToCatch, >> + outerExceptionTypesToCatch); >> + >> + // Return outer function to run >> + return(outerCatchFunct); >> +} >> + >> + >> +/// Represents our foreign exceptions >> +class OurCppRunException : public std::runtime_error { >> +public: >> + OurCppRunException(const std::string reason) : >> + std::runtime_error(reason) {} >> + >> + OurCppRunException (const OurCppRunException& toCopy) : >> + std::runtime_error(toCopy) {} >> + >> + OurCppRunException& operator = (const OurCppRunException& toCopy) { >> + return(reinterpret_cast( >> + std::runtime_error::operator = (toCopy) >> + )); >> + } >> + >> + ~OurCppRunException (void) throw () {}; >> +}; >> + >> + >> +/// Throws foreign C++ exception. >> +/// @param ignoreIt unused parameter that allows function to match implied >> +/// generated function contract. >> +extern "C" >> +void throwCppException (int32_t ignoreIt) { >> + throw(OurCppRunException("thrown by throwCppException(...)")); >> +} >> + >> +typedef void (*OurExceptionThrowFunctType) (int32_t typeToThrow); >> + >> +/// This is a test harness which runs test by executing generated >> +/// function with a type info type to throw. Harness wraps the excecution >> +/// of generated function in a C++ try catch clause. >> +/// @param engine execution engine to use for executing generated function. >> +/// This demo program expects this to be a JIT instance for demo >> +/// purposes. >> +/// @param function generated test function to run >> +/// @param typeToThrow type info type of generated exception to throw, or >> +/// indicator to cause foreign exception to be thrown. >> +static >> +void runExceptionThrow(llvm::ExecutionEngine* engine, >> + llvm::Function* function, >> + int32_t typeToThrow) { >> + >> + // Find test's function pointer >> + OurExceptionThrowFunctType functPtr = >> + reinterpret_cast( >> + reinterpret_cast( >> + engine->getPointerToFunction(function) >> + ) >> + ); >> + >> + try { >> + // Run test >> + (*functPtr)(typeToThrow); >> + } >> + catch (OurCppRunException exc) { >> + // Catch foreign C++ exception >> + fprintf(stderr, >> + "\nrunExceptionThrow(...):In C++ catch OurCppRunException " >> + "with reason: %s.\n", >> + exc.what()); >> + } >> + catch (...) { >> + // Catch all exceptions including our generated ones. I'm not sure >> + // why this latter functionality should work, as it seems that >> + // our exceptions should be foreign to C++ (the _Unwind_Exception:: >> + // exception_class should be different from the one used by C++), and >> + // therefore C++ should ignore the generated exceptions. >> + >> + fprintf(stderr, >> + "\nrunExceptionThrow(...):In C++ catch all.\n"); >> + } >> +} >> + >> +// >> +// End test functions >> +// >> + >> +/// This initialization routine creates type info globals and >> +/// adds external function declarations to module. >> +/// @param numTypeInfos number of linear type info associated type info types >> +/// to create as GlobalVariable instances, starting with the value 1. >> +/// @param module code for module instance >> +/// @param builder builder instance >> +static void createStandardUtilityFunctions(unsigned numTypeInfos, >> + llvm::Module& module, >> + llvm::IRBuilder<>& builder) { >> + >> + llvm::LLVMContext& context = module.getContext(); >> + >> + // Exception initializations >> + >> + // Setup exception catch state >> + ourExceptionNotThrownState = >> + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 0), >> + ourExceptionThrownState = >> + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 1), >> + ourExceptionCaughtState = >> + llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 2), >> + >> + >> + // Create our type info type >> + ourTypeInfoType = llvm::StructType::get(context, >> + builder.getInt32Ty(), >> + NULL); >> + >> + // Create OurException type >> + ourExceptionType = llvm::StructType::get(context, >> + ourTypeInfoType, >> + NULL); >> + >> + // Create portion of _Unwind_Exception type >> + // >> + // Note: Declaring only a portion of the _Unwind_Exception struct. >> + // Does this cause problems? >> + ourUnwindExceptionType = llvm::StructType::get(context, >> + builder.getInt64Ty(), >> + NULL); >> + struct OurBaseException_t dummyException; >> + >> + // Calculate offset of OurException::unwindException member. >> + ourBaseFromUnwindOffset = ((uintptr_t) &dummyException) - >> + ((uintptr_t) &(dummyException.unwindException)); >> + >> +#ifdef DEBUG >> + fprintf(stderr, >> + "createStandardUtilityFunctions(...):ourBaseFromUnwindOffset " >> + "= %lld, sizeof(struct OurBaseException_t) - " >> + "sizeof(struct _Unwind_Exception) = %lu.\n", >> + ourBaseFromUnwindOffset, >> + sizeof(struct OurBaseException_t) - >> + sizeof(struct _Unwind_Exception)); >> +#endif >> + >> + size_t numChars = sizeof(ourBaseExcpClassChars) / sizeof(char); >> + >> + // Create our _Unwind_Exception::exception_class value >> + ourBaseExceptionClass = genClass(ourBaseExcpClassChars, numChars); >> + >> + // Type infos >> + >> + std::string baseStr = "typeInfo", typeInfoName; >> + std::ostringstream typeInfoNameBuilder; >> + std::vector structVals; >> + >> + llvm::Constant *nextStruct; >> + llvm::GlobalVariable* nextGlobal = NULL; >> + >> + // Generate each type info >> + // >> + // Note: First type info is not used. >> + for (unsigned i = 0; i <= numTypeInfos; ++i) { >> + structVals.clear(); >> + structVals.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), i)); >> + nextStruct = llvm::ConstantStruct::get(ourTypeInfoType, structVals); >> + >> + typeInfoNameBuilder.str(""); >> + typeInfoNameBuilder << baseStr << i; >> + typeInfoName = typeInfoNameBuilder.str(); >> + >> + // Note: Does not seem to work without allocation >> + nextGlobal = >> + new llvm::GlobalVariable(module, >> + ourTypeInfoType, >> + true, >> + llvm::GlobalValue::ExternalLinkage, >> + nextStruct, >> + typeInfoName); >> + >> + ourTypeInfoNames.push_back(typeInfoName); >> + ourTypeInfoNamesIndex[i] = typeInfoName; >> + } >> + >> + ArgNames argNames; >> + ArgTypes argTypes; >> + llvm::Function* funct = NULL; >> + >> + // print32Int >> + >> + const llvm::Type* retType = builder.getVoidTy(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt32Ty()); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "print32Int", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // print64Int >> + >> + retType = builder.getVoidTy(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt64Ty()); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "print64Int", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // printStr >> + >> + retType = builder.getVoidTy(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "printStr", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // throwCppException >> + >> + retType = builder.getVoidTy(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt32Ty()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "throwCppException", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // deleteOurException >> + >> + retType = builder.getVoidTy(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "deleteOurException", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // createOurException >> + >> + retType = builder.getInt8Ty()->getPointerTo(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt32Ty()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "createOurException", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // _Unwind_RaiseException >> + >> + retType = builder.getInt32Ty(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + funct = createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "_Unwind_RaiseException", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + funct->addFnAttr(llvm::Attribute::NoReturn); >> + >> + // _Unwind_Resume >> + >> + retType = builder.getInt32Ty(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + funct = createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "_Unwind_Resume", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + funct->addFnAttr(llvm::Attribute::NoReturn); >> + >> + // ourPersonality >> + >> + retType = builder.getInt32Ty(); >> + >> + argTypes.clear(); >> + argTypes.push_back(builder.getInt32Ty()); >> + argTypes.push_back(builder.getInt32Ty()); >> + argTypes.push_back(builder.getInt64Ty()); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >> + >> + argNames.clear(); >> + >> + createFunction(module, >> + retType, >> + argTypes, >> + argNames, >> + "ourPersonality", >> + llvm::Function::ExternalLinkage, >> + true, >> + false); >> + >> + // llvm.eh.selector intrinsic >> + >> + getDeclaration(&module, llvm::Intrinsic::eh_selector); >> + >> + // llvm.eh.exception intrinsic >> + >> + getDeclaration(&module, llvm::Intrinsic::eh_exception); >> + >> + // llvm.eh.typeid.for intrinsic >> + >> + getDeclaration(&module, llvm::Intrinsic::eh_typeid_for); >> +} >> + >> + >> +//===---------------------------------------------------------------------===// >> +// Main test driver code. >> +//===---------------------------------------------------------------------===// >> + >> +/// Demo main routine which takes the type info types to throw. A test will >> +/// be run for each given type info type. While type info types with the value >> +/// of -1 will trigger a foreign C++ exception to be thrown; type info types >> +/// <= 6 and >= 1 will be caught by test functions; and type info types > 6 >> +/// will result in exceptions which pass through to the test harness. All other >> +/// type info types are not supported and could cause a crash. >> +int main(int argc, char* argv[]) { >> + if (argc == 1) { >> + fprintf(stderr, >> + "\nUsage: ExceptionDemo " >> + "[...].\n" >> + " Each type must have the value of 1 - 6 for " >> + "generated exceptions to be caught;\n" >> + " the value -1 for foreign C++ exceptions to be " >> + "generated and thrown;\n" >> + " or the values > 6 for exceptions to be ignored.\n" >> + "\nTry: ExceptionDemo 2 3 7 -1\n" >> + " for a full test.\n\n"); >> + return(0); >> + } >> + >> + // If not set, exception handling will not be turned on >> + llvm::DwarfExceptionHandling = true; >> + >> + llvm::InitializeNativeTarget(); >> + llvm::LLVMContext& context = llvm::getGlobalContext(); >> + llvm::IRBuilder<> theBuilder(context); >> + >> + // Make the module, which holds all the code. >> + llvm::Module* module = new llvm::Module("my cool jit", context); >> + >> + // Build engine with JIT >> + llvm::EngineBuilder factory(module); >> + factory.setEngineKind(llvm::EngineKind::JIT); >> + factory.setAllocateGVsWithCode(false); >> + llvm::ExecutionEngine* executionEngine = factory.create(); >> + >> + { >> + llvm::FunctionPassManager fpm(module); >> + >> + // Set up the optimizer pipeline. >> + // Start with registering info about how the >> + // target lays out data structures. >> + fpm.add(new llvm::TargetData(*executionEngine->getTargetData())); >> + >> + // Optimizations turned on >> +#ifdef ADD_OPT_PASSES >> + >> + // Promote allocas to registers. >> + fpm.add(llvm::createPromoteMemoryToRegisterPass()); >> + >> + // Do simple "peephole" optimizations and bit-twiddling optzns. >> + fpm.add(llvm::createInstructionCombiningPass()); >> + >> + // Reassociate expressions. >> + fpm.add(llvm::createReassociatePass()); >> + >> + // Eliminate Common SubExpressions. >> + fpm.add(llvm::createGVNPass()); >> + >> + // Simplify the control flow graph (deleting unreachable >> + // blocks, etc). >> + fpm.add(llvm::createCFGSimplificationPass()); >> +#endif // ADD_OPT_PASSES >> + >> + fpm.doInitialization(); >> + >> + // Generate test code using function throwCppException(...) as >> + // the function which throws foreign exceptions. >> + llvm::Function* toRun = >> + createUnwindExceptionTest(*module, >> + theBuilder, >> + fpm, >> + "throwCppException"); >> + >> + fprintf(stderr, "\nBegin module dump:\n\n"); >> + >> + module->dump(); >> + >> + fprintf(stderr, "\nEnd module dump:\n"); >> + >> + fprintf(stderr, "\n\nBegin Test:\n"); >> + >> + for (int i = 1; i < argc; ++i) { >> + // Run test for each argument whose value is the exception >> + // type to throw. >> + runExceptionThrow(executionEngine, >> + toRun, >> + (unsigned) strtoul(argv[i], NULL, 10)); >> + } >> + >> + fprintf(stderr, "\nEnd Test:\n\n"); >> + } >> + >> + delete executionEngine; >> + >> + return 0; >> +} >> + >> >> Added: llvm/trunk/examples/ExceptionDemo/Makefile >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/Makefile?rev=95723&view=auto >> >> ============================================================================== >> --- llvm/trunk/examples/ExceptionDemo/Makefile (added) >> +++ llvm/trunk/examples/ExceptionDemo/Makefile Tue Feb 9 17:22:43 2010 >> @@ -0,0 +1,17 @@ >> +##===- examples/ExceptionDemo/Makefile --------------------*- Makefile -*-===## >> +# >> +# The LLVM Compiler Infrastructure >> +# >> +# This file is distributed under the University of Illinois Open Source >> +# License. See LICENSE.TXT for details. >> +# >> +##===---------------------------------------------------------------------===## >> +LEVEL = ../.. >> +TOOLNAME = ExceptionDemo >> +EXAMPLE_TOOL = 1 >> + >> +LINK_COMPONENTS := jit interpreter nativecodegen >> + >> +include $(LEVEL)/Makefile.common >> + >> +CXXFLAGS += -fexceptions >> >> Modified: llvm/trunk/examples/Makefile >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=95723&r1=95722&r2=95723&view=diff >> >> ============================================================================== >> --- llvm/trunk/examples/Makefile (original) >> +++ llvm/trunk/examples/Makefile Tue Feb 9 17:22:43 2010 >> @@ -10,7 +10,8 @@ >> >> include $(LEVEL)/Makefile.config >> >> -PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker >> +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \ >> + ExceptionDemo >> >> ifeq ($(HAVE_PTHREAD),1) >> PARALLEL_DIRS += ParallelJIT >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> From scallanan at apple.com Tue Feb 9 21:23:24 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 10 Feb 2010 03:23:24 -0000 Subject: [llvm-commits] [llvm] r95762 - /llvm/trunk/utils/TableGen/EDEmitter.cpp Message-ID: <201002100323.o1A3NOE4016351@zion.cs.uiuc.edu> Author: spyffe Date: Tue Feb 9 21:23:23 2010 New Revision: 95762 URL: http://llvm.org/viewvc/llvm-project?rev=95762&view=rev Log: Updated the enhanced disassembly library's TableGen backend to not use exceptions at all except in cases of actual error. Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=95762&r1=95761&r2=95762&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Tue Feb 9 21:23:23 2010 @@ -371,14 +371,7 @@ const char *opFlag) { unsigned opIndex; - try { - opIndex = inst.getOperandNamed(std::string(opName)); - } - catch (...) { - errs() << "Instruction: " << inst.TheDef->getName().c_str() << "\n"; - errs() << "Operand name: " << opName << "\n"; - llvm_unreachable("Couldn't find operand"); - } + opIndex = inst.getOperandNamed(std::string(opName)); operandFlags[opIndex]->addEntry(opFlag); } From gvenn.cfe.dev at gmail.com Tue Feb 9 21:38:29 2010 From: gvenn.cfe.dev at gmail.com (Garrison Venn) Date: Wed, 10 Feb 2010 03:38:29 -0000 Subject: [llvm-commits] [llvm] r95763 - /llvm/trunk/examples/Makefile Message-ID: <201002100338.o1A3cTmh016920@zion.cs.uiuc.edu> Author: gvenn Date: Tue Feb 9 21:38:29 2010 New Revision: 95763 URL: http://llvm.org/viewvc/llvm-project?rev=95763&view=rev Log: Prevented build on WINDOWS using default make system. Stopped WINDOWS build at eh llvm/examples level using if check on LLVM_ON_UNIX. Modified: llvm/trunk/examples/Makefile Modified: llvm/trunk/examples/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=95763&r1=95762&r2=95763&view=diff ============================================================================== --- llvm/trunk/examples/Makefile (original) +++ llvm/trunk/examples/Makefile Tue Feb 9 21:38:29 2010 @@ -10,11 +10,14 @@ include $(LEVEL)/Makefile.config -PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \ - ExceptionDemo +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker ifeq ($(HAVE_PTHREAD),1) PARALLEL_DIRS += ParallelJIT endif +ifeq ($(LLVM_ON_UNIX),1) +PARALLEL_DIRS += ExceptionDemo +endif + include $(LEVEL)/Makefile.common From daniel at zuster.org Tue Feb 9 22:09:54 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 04:09:54 -0000 Subject: [llvm-commits] [llvm] r95764 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <201002100409.o1A49tRU018395@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 22:09:52 2010 New Revision: 95764 URL: http://llvm.org/viewvc/llvm-project?rev=95764&view=rev Log: Add a ReleaseNotes FIXME. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=95764&r1=95763&r2=95764&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Tue Feb 9 22:09:52 2010 @@ -634,6 +634,9 @@ Clients must replace calls to GlobalValue::hasNotBeenReadFromBitcode with GlobalValue::isMaterializable. + +
  • FIXME: Debug info has been totally redone. Add pointers to new APIs. Substantial caveats about compatibility of .ll and .bc files.
  • + From daniel at zuster.org Tue Feb 9 22:10:10 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 04:10:10 -0000 Subject: [llvm-commits] [llvm] r95765 - /llvm/trunk/utils/lit/lit/ShUtil.py Message-ID: <201002100410.o1A4ABxC018416@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 22:10:10 2010 New Revision: 95765 URL: http://llvm.org/viewvc/llvm-project?rev=95765&view=rev Log: Remove stray DOS newline. Modified: llvm/trunk/utils/lit/lit/ShUtil.py Modified: llvm/trunk/utils/lit/lit/ShUtil.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShUtil.py?rev=95765&r1=95764&r2=95765&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/ShUtil.py (original) +++ llvm/trunk/utils/lit/lit/ShUtil.py Tue Feb 9 22:10:10 2010 @@ -66,7 +66,7 @@ return (tok[0], num) elif c == '"': self.eat() - str += self.lex_arg_quoted('"') + str += self.lex_arg_quoted('"') elif not self.win32Escapes and c == '\\': # Outside of a string, '\\' escapes everything. self.eat() From daniel at zuster.org Tue Feb 9 22:47:08 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 04:47:08 -0000 Subject: [llvm-commits] [llvm] r95767 - in /llvm/trunk: include/llvm/MC/MCFixup.h lib/MC/MCAsmStreamer.cpp lib/Target/X86/X86CodeEmitter.cpp Message-ID: <201002100447.o1A4l9TT020027@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 22:47:08 2010 New Revision: 95767 URL: http://llvm.org/viewvc/llvm-project?rev=95767&view=rev Log: MC: Switch MCFixup to just hold an MCExpr pointer instead of index into the MCInst it came from. Modified: llvm/trunk/include/llvm/MC/MCFixup.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/include/llvm/MC/MCFixup.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=95767&r1=95766&r2=95767&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCFixup.h (original) +++ llvm/trunk/include/llvm/MC/MCFixup.h Tue Feb 9 22:47:08 2010 @@ -13,6 +13,7 @@ #include namespace llvm { +class MCExpr; // Private constants, do not use. // @@ -25,10 +26,8 @@ // end up needing more bits for target dependent kinds. enum { MCFIXUP_NUM_GENERIC_KINDS = 128, - MCFIXUP_NUM_KIND_BITS = 8, - MCFIXUP_NUM_OPINDEX_BITS = 8, - MCFIXUP_NUM_OFFSET_BITS = (32 - MCFIXUP_NUM_OPINDEX_BITS - - MCFIXUP_NUM_OPINDEX_BITS) + MCFIXUP_NUM_KIND_BITS = 16, + MCFIXUP_NUM_OFFSET_BITS = (32 - MCFIXUP_NUM_KIND_BITS) }; /// MCFixupKind - Extensible enumeration to represent the type of a fixup. @@ -60,34 +59,36 @@ class MCFixup { static const unsigned MaxOffset = 1 << MCFIXUP_NUM_KIND_BITS; + /// The value to put into the fixup location. The exact interpretation of the + /// expression is target dependent, usually it will one of the operands to an + /// instruction or an assembler directive. + const MCExpr *Value; + /// The byte index of start of the relocation inside the encoded instruction. unsigned Offset : MCFIXUP_NUM_OFFSET_BITS; - /// The index of the operand to encode into the instruction. - unsigned OpIndex : MCFIXUP_NUM_OPINDEX_BITS; - /// The target dependent kind of fixup item this is. The kind is used to /// determine how the operand value should be encoded into the instruction. unsigned Kind : MCFIXUP_NUM_KIND_BITS; public: - static MCFixup Create(unsigned Offset, unsigned OpIndex, MCFixupKind Kind) { + static MCFixup Create(unsigned Offset, const MCExpr *Value, + MCFixupKind Kind) { MCFixup FI; + FI.Value = Value; FI.Offset = Offset; - FI.OpIndex = OpIndex; FI.Kind = unsigned(Kind); assert(Offset == FI.getOffset() && "Offset out of range!"); - assert(OpIndex == FI.getOpIndex() && "Operand index out of range!"); assert(Kind == FI.getKind() && "Kind out of range!"); return FI; } - unsigned getOffset() const { return Offset; } + MCFixupKind getKind() const { return MCFixupKind(Kind); } - unsigned getOpIndex() const { return OpIndex; } + unsigned getOffset() const { return Offset; } - MCFixupKind getKind() const { return MCFixupKind(Kind); } + const MCExpr *getValue() const { return Value; } }; } // End llvm namespace Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95767&r1=95766&r2=95767&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 9 22:47:08 2010 @@ -601,7 +601,7 @@ MCFixup &F = Fixups[i]; MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind()); OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset() - << ", op: " << F.getOpIndex() << ", kind: " << Info.Name << "\n"; + << ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n"; } } Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95767&r1=95766&r2=95767&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 9 22:47:08 2010 @@ -878,12 +878,14 @@ namespace { class MCSingleInstructionCodeEmitter : public MachineCodeEmitter { uint8_t Data[256]; + const MCInst *CurrentInst; SmallVectorImpl *FixupList; public: - MCSingleInstructionCodeEmitter() { reset(0); } + MCSingleInstructionCodeEmitter() { reset(0, 0); } - void reset(SmallVectorImpl *Fixups) { + void reset(const MCInst *Inst, SmallVectorImpl *Fixups) { + CurrentInst = Inst; FixupList = Fixups; BufferBegin = Data; BufferEnd = array_endof(Data); @@ -915,7 +917,9 @@ OpIndex = MR.getJumpTableIndex(); } - FixupList->push_back(MCFixup::Create(Offset, OpIndex, + MCOperand Op = CurrentInst->getOperand(OpIndex); + assert(Op.isExpr() && "FIXME: Not yet implemented!"); + FixupList->push_back(MCFixup::Create(Offset, Op.getExpr(), MCFixupKind(FirstTargetFixupKind + Kind))); } virtual void setModuleInfo(MachineModuleInfo* Info) {} @@ -1163,7 +1167,7 @@ Instr->dump(); } - InstrEmitter->reset(&Fixups); + InstrEmitter->reset(&MI, &Fixups); if (OK) Emit->emitInstruction(*Instr, &Desc); OS << InstrEmitter->str(); From daniel at zuster.org Tue Feb 9 22:46:54 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 04:46:54 -0000 Subject: [llvm-commits] [llvm] r95766 - /llvm/trunk/include/llvm/MC/MCFixup.h Message-ID: <201002100446.o1A4ks4H020002@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Feb 9 22:46:51 2010 New Revision: 95766 URL: http://llvm.org/viewvc/llvm-project?rev=95766&view=rev Log: Fix a signed comparison warning. Modified: llvm/trunk/include/llvm/MC/MCFixup.h Modified: llvm/trunk/include/llvm/MC/MCFixup.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=95766&r1=95765&r2=95766&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCFixup.h (original) +++ llvm/trunk/include/llvm/MC/MCFixup.h Tue Feb 9 22:46:51 2010 @@ -77,9 +77,9 @@ FI.OpIndex = OpIndex; FI.Kind = unsigned(Kind); - assert(Offset == FI.Offset && "Offset out of range!"); - assert(OpIndex == FI.OpIndex && "Operand index out of range!"); - assert(Kind == FI.Kind && "Kind out of range!"); + assert(Offset == FI.getOffset() && "Offset out of range!"); + assert(OpIndex == FI.getOpIndex() && "Operand index out of range!"); + assert(Kind == FI.getKind() && "Kind out of range!"); return FI; } From espindola at google.com Tue Feb 9 23:47:35 2010 From: espindola at google.com (Rafael Espindola) Date: Tue, 9 Feb 2010 21:47:35 -0800 Subject: [llvm-commits] [patch][llvm-gcc] Move all ppc-linux only code to an auxiliary function Message-ID: <38a0d8451002092147y500d3f2dm76bb954e6b626b3d@mail.gmail.com> The attached patch moves all the ppc-linux only functions to llvm_ppc_try_pass_aggregate_custom. In a next patch I should be able to finally merge the two ABI implementations. I will likely be unable to test this until Sunday, so it would be really nice if anyone with a ppc linux machine could give it a try Cheers, -- Rafael ?vila de Esp?ndola -------------- next part -------------- A non-text attachment was scrubbed... Name: factor.patch Type: application/octet-stream Size: 8640 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100209/307a93cc/attachment.obj From gohman at apple.com Tue Feb 9 23:54:05 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 05:54:05 -0000 Subject: [llvm-commits] [llvm] r95768 - in /llvm/trunk: include/llvm/ADT/BitVector.h include/llvm/ADT/SmallBitVector.h unittests/ADT/BitVectorTest.cpp unittests/ADT/SmallBitVectorTest.cpp Message-ID: <201002100554.o1A5s6en022694@zion.cs.uiuc.edu> Author: djg Date: Tue Feb 9 23:54:04 2010 New Revision: 95768 URL: http://llvm.org/viewvc/llvm-project?rev=95768&view=rev Log: Implement operators |=, &=, and ^= for SmallBitVector, and remove the restriction in BitVector for |= and ^= that the operand must be the same length. Modified: llvm/trunk/include/llvm/ADT/BitVector.h llvm/trunk/include/llvm/ADT/SmallBitVector.h llvm/trunk/unittests/ADT/BitVectorTest.cpp llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Modified: llvm/trunk/include/llvm/ADT/BitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=95768&r1=95767&r2=95768&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/BitVector.h (original) +++ llvm/trunk/include/llvm/ADT/BitVector.h Tue Feb 9 23:54:04 2010 @@ -307,15 +307,17 @@ } BitVector &operator|=(const BitVector &RHS) { - assert(Size == RHS.Size && "Illegal operation!"); - for (unsigned i = 0; i < NumBitWords(size()); ++i) + if (size() < RHS.size()) + resize(RHS.size()); + for (size_t i = 0, e = NumBitWords(RHS.size()); i != e; ++i) Bits[i] |= RHS.Bits[i]; return *this; } BitVector &operator^=(const BitVector &RHS) { - assert(Size == RHS.Size && "Illegal operation!"); - for (unsigned i = 0; i < NumBitWords(size()); ++i) + if (size() < RHS.size()) + resize(RHS.size()); + for (size_t i = 0, e = NumBitWords(RHS.size()); i != e; ++i) Bits[i] ^= RHS.Bits[i]; return *this; } Modified: llvm/trunk/include/llvm/ADT/SmallBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallBitVector.h?rev=95768&r1=95767&r2=95768&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallBitVector.h Tue Feb 9 23:54:04 2010 @@ -310,11 +310,47 @@ } // Intersection, union, disjoint union. - BitVector &operator&=(const SmallBitVector &RHS); // TODO: implement + SmallBitVector &operator&=(const SmallBitVector &RHS) { + resize(std::max(size(), RHS.size())); + if (isSmall()) + setSmallBits(getSmallBits() & RHS.getSmallBits()); + else if (!RHS.isSmall()) + X.getPointer()->operator&=(*RHS.X.getPointer()); + else { + SmallBitVector Copy = RHS; + Copy.resize(size()); + X.getPointer()->operator&=(*Copy.X.getPointer()); + } + return *this; + } - BitVector &operator|=(const SmallBitVector &RHS); // TODO: implement + SmallBitVector &operator|=(const SmallBitVector &RHS) { + resize(std::max(size(), RHS.size())); + if (isSmall()) + setSmallBits(getSmallBits() | RHS.getSmallBits()); + else if (!RHS.isSmall()) + X.getPointer()->operator|=(*RHS.X.getPointer()); + else { + SmallBitVector Copy = RHS; + Copy.resize(size()); + X.getPointer()->operator|=(*Copy.X.getPointer()); + } + return *this; + } - BitVector &operator^=(const SmallBitVector &RHS); // TODO: implement + SmallBitVector &operator^=(const SmallBitVector &RHS) { + resize(std::max(size(), RHS.size())); + if (isSmall()) + setSmallBits(getSmallBits() ^ RHS.getSmallBits()); + else if (!RHS.isSmall()) + X.getPointer()->operator^=(*RHS.X.getPointer()); + else { + SmallBitVector Copy = RHS; + Copy.resize(size()); + X.getPointer()->operator^=(*Copy.X.getPointer()); + } + return *this; + } // Assignment operator. const SmallBitVector &operator=(const SmallBitVector &RHS) { Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/BitVectorTest.cpp?rev=95768&r1=95767&r2=95768&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/BitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/BitVectorTest.cpp Tue Feb 9 23:54:04 2010 @@ -138,5 +138,45 @@ EXPECT_TRUE(Vec.empty()); } +TEST(BitVectorTest, CompoundAssignment) { + BitVector A; + A.resize(10); + A.set(4); + A.set(7); + + BitVector B; + B.resize(50); + B.set(5); + B.set(18); + + A |= B; + EXPECT_TRUE(A.test(4)); + EXPECT_TRUE(A.test(5)); + EXPECT_TRUE(A.test(7)); + EXPECT_TRUE(A.test(18)); + EXPECT_EQ(A.count(), 4); + EXPECT_EQ(A.size(), 50); + + B.resize(10); + B.set(); + B.reset(2); + B.reset(7); + A &= B; + EXPECT_FALSE(A.test(2)); + EXPECT_FALSE(A.test(7)); + EXPECT_EQ(A.size(), 50); + EXPECT_EQ(A.count(), 2); + + B.resize(100); + B.set(); + + A ^= B; + EXPECT_TRUE(A.test(2)); + EXPECT_TRUE(A.test(7)); + EXPECT_EQ(A.size(), 100); + EXPECT_EQ(A.count(), 98); +} + } + #endif Modified: llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp?rev=95768&r1=95767&r2=95768&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Tue Feb 9 23:54:04 2010 @@ -137,4 +137,43 @@ EXPECT_TRUE(Vec.empty()); } +TEST(SmallBitVectorTest, CompoundAssignment) { + SmallBitVector A; + A.resize(10); + A.set(4); + A.set(7); + + SmallBitVector B; + B.resize(50); + B.set(5); + B.set(18); + + A |= B; + EXPECT_TRUE(A.test(4)); + EXPECT_TRUE(A.test(5)); + EXPECT_TRUE(A.test(7)); + EXPECT_TRUE(A.test(18)); + EXPECT_EQ(A.count(), 4); + EXPECT_EQ(A.size(), 50); + + B.resize(10); + B.set(); + B.reset(2); + B.reset(7); + A &= B; + EXPECT_FALSE(A.test(2)); + EXPECT_FALSE(A.test(7)); + EXPECT_EQ(A.size(), 50); + EXPECT_EQ(A.count(), 2); + + B.resize(100); + B.set(); + + A ^= B; + EXPECT_TRUE(A.test(2)); + EXPECT_TRUE(A.test(7)); + EXPECT_EQ(A.size(), 100); + EXPECT_EQ(A.count(), 98); +} + } From gohman at apple.com Wed Feb 10 00:13:08 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 06:13:08 -0000 Subject: [llvm-commits] [llvm] r95769 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Other/constant-fold-gep.ll Message-ID: <201002100613.o1A6D8CM023384@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 00:13:07 2010 New Revision: 95769 URL: http://llvm.org/viewvc/llvm-project?rev=95769&view=rev Log: Canonicalize sizeof and alignof on pointer types to a canonical pointer type. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/test/Other/constant-fold-gep.ll Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=95769&r1=95768&r2=95769&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Wed Feb 10 00:13:07 2010 @@ -361,6 +361,15 @@ } } + // Pointer size doesn't depend on the pointee type, so canonicalize them + // to an arbitrary pointee. + if (const PointerType *PTy = dyn_cast(Ty)) + if (!PTy->getElementType()->isInteger(1)) + return + getFoldedSizeOf(PointerType::get(IntegerType::get(PTy->getContext(), 1), + PTy->getAddressSpace()), + DestTy, true); + // If there's no interesting folding happening, bail so that we don't create // a constant that looks like it needs folding but really doesn't. if (!Folded) @@ -417,6 +426,16 @@ return MemberAlign; } + // Pointer alignment doesn't depend on the pointee type, so canonicalize them + // to an arbitrary pointee. + if (const PointerType *PTy = dyn_cast(Ty)) + if (!PTy->getElementType()->isInteger(1)) + return + getFoldedAlignOf(PointerType::get(IntegerType::get(PTy->getContext(), + 1), + PTy->getAddressSpace()), + DestTy, true); + // If there's no interesting folding happening, bail so that we don't create // a constant that looks like it needs folding but really doesn't. if (!Folded) Modified: llvm/trunk/test/Other/constant-fold-gep.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/constant-fold-gep.ll?rev=95769&r1=95768&r2=95769&view=diff ============================================================================== --- llvm/trunk/test/Other/constant-fold-gep.ll (original) +++ llvm/trunk/test/Other/constant-fold-gep.ll Wed Feb 10 00:13:07 2010 @@ -19,10 +19,12 @@ ; PLAIN: %0 = type { i1, double } ; PLAIN: %1 = type { double, float, double, double } -; PLAIN: %2 = type { i64, i64 } +; PLAIN: %2 = type { i1, i1* } +; PLAIN: %3 = type { i64, i64 } ; OPT: %0 = type { i1, double } ; OPT: %1 = type { double, float, double, double } -; OPT: %2 = type { i64, i64 } +; OPT: %2 = type { i1, i1* } +; OPT: %3 = type { i64, i64 } ; The automatic constant folder in opt does not have targetdata access, so ; it can't fold gep arithmetic, in general. However, the constant folder run @@ -65,6 +67,8 @@ ; PLAIN: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) ; PLAIN: @f = constant i64 1 ; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; PLAIN: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; PLAIN: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) ; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) ; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) ; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) @@ -72,6 +76,8 @@ ; OPT: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) ; OPT: @f = constant i64 1 ; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; OPT: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; OPT: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) ; TO: @a = constant i64 18480 ; TO: @b = constant i64 8 ; TO: @c = constant i64 16 @@ -79,6 +85,8 @@ ; TO: @e = constant i64 16 ; TO: @f = constant i64 1 ; TO: @g = constant i64 8 +; TO: @h = constant i64 8 +; TO: @i = constant i64 8 @a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) @b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64) @@ -87,14 +95,16 @@ @e = constant i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64) @f = constant i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64) @g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) + at h = constant i64 ptrtoint (double** getelementptr (double** null, i64 1) to i64) + at i = constant i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) ; The target-dependent folder should cast GEP indices to integer-sized pointers. ; PLAIN: @M = constant i64* getelementptr (i64* null, i32 1) -; PLAIN: @N = constant i64* getelementptr (%2* null, i32 0, i32 1) +; PLAIN: @N = constant i64* getelementptr (%3* null, i32 0, i32 1) ; PLAIN: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1) ; OPT: @M = constant i64* getelementptr (i64* null, i32 1) -; OPT: @N = constant i64* getelementptr (%2* null, i32 0, i32 1) +; OPT: @N = constant i64* getelementptr (%3* null, i32 0, i32 1) ; OPT: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1) ; TO: @M = constant i64* inttoptr (i64 8 to i64*) ; TO: @N = constant i64* inttoptr (i64 8 to i64*) @@ -237,6 +247,14 @@ ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) ; PLAIN: ret i64 %t ; PLAIN: } +; PLAIN: define i64 @fh() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fi() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; PLAIN: ret i64 %t +; PLAIN: } ; OPT: define i64 @fa() nounwind { ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) ; OPT: } @@ -258,6 +276,12 @@ ; OPT: define i64 @fg() nounwind { ; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) ; OPT: } +; OPT: define i64 @fh() nounwind { +; OPT: ret i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; OPT: } +; OPT: define i64 @fi() nounwind { +; OPT: ret i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; OPT: } ; TO: define i64 @fa() nounwind { ; TO: ret i64 18480 ; TO: } @@ -279,6 +303,12 @@ ; TO: define i64 @fg() nounwind { ; TO: ret i64 8 ; TO: } +; TO: define i64 @fh() nounwind { +; TO: ret i64 8 +; TO: } +; TO: define i64 @fi() nounwind { +; TO: ret i64 8 +; TO: } ; SCEV: Classifying expressions for: @fa ; SCEV: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 ; SCEV: --> (2310 * sizeof(double)) @@ -300,6 +330,12 @@ ; SCEV: Classifying expressions for: @fg ; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) ; SCEV: --> alignof(double) +; SCEV: Classifying expressions for: @fh +; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; SCEV: --> sizeof(i1*) +; SCEV: Classifying expressions for: @fi +; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; SCEV: --> alignof(i1*) define i64 @fa() nounwind { %t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64 @@ -329,13 +365,21 @@ %t = bitcast i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) to i64 ret i64 %t } +define i64 @fh() nounwind { + %t = bitcast i64 ptrtoint (double** getelementptr (double** null, i32 1) to i64) to i64 + ret i64 %t +} +define i64 @fi() nounwind { + %t = bitcast i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) to i64 + ret i64 %t +} ; PLAIN: define i64* @fM() nounwind { ; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64* ; PLAIN: ret i64* %t ; PLAIN: } ; PLAIN: define i64* @fN() nounwind { -; PLAIN: %t = bitcast i64* getelementptr (%2* null, i32 0, i32 1) to i64* +; PLAIN: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64* ; PLAIN: ret i64* %t ; PLAIN: } ; PLAIN: define i64* @fO() nounwind { @@ -346,7 +390,7 @@ ; OPT: ret i64* getelementptr (i64* null, i32 1) ; OPT: } ; OPT: define i64* @fN() nounwind { -; OPT: ret i64* getelementptr (%2* null, i32 0, i32 1) +; OPT: ret i64* getelementptr (%3* null, i32 0, i32 1) ; OPT: } ; OPT: define i64* @fO() nounwind { ; OPT: ret i64* getelementptr ([2 x i64]* null, i32 0, i32 1) @@ -364,7 +408,7 @@ ; SCEV: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64* ; SCEV: --> sizeof(i64) ; SCEV: Classifying expressions for: @fN -; SCEV: %t = bitcast i64* getelementptr (%2* null, i32 0, i32 1) to i64* +; SCEV: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64* ; SCEV: --> sizeof(i64) ; SCEV: Classifying expressions for: @fO ; SCEV: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64* From sabre at nondot.org Wed Feb 10 00:30:01 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 06:30:01 -0000 Subject: [llvm-commits] [llvm] r95770 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002100630.o1A6U1FU024020@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 00:30:00 2010 New Revision: 95770 URL: http://llvm.org/viewvc/llvm-project?rev=95770&view=rev Log: simplify displacement handling, emit displacements by-operand even for the immediate case. No functionality change. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95770&r1=95769&r2=95770&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Wed Feb 10 00:30:00 2010 @@ -68,8 +68,8 @@ } } - void EmitDisplacementField(const MCOperand *RelocOp, int DispVal, - int64_t Adj, bool IsPCRel, raw_ostream &OS) const; + void EmitDisplacementField(const MCOperand &Disp, int64_t Adj, bool IsPCRel, + raw_ostream &OS) const; inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, unsigned RM) { @@ -119,12 +119,12 @@ } void X86MCCodeEmitter:: -EmitDisplacementField(const MCOperand *RelocOp, int DispVal, - int64_t Adj, bool IsPCRel, raw_ostream &OS) const { +EmitDisplacementField(const MCOperand &DispOp, int64_t Adj, bool IsPCRel, + raw_ostream &OS) const { // If this is a simple integer displacement that doesn't require a relocation, // emit it now. - if (!RelocOp) { - EmitConstant(DispVal, 4, OS); + if (DispOp.isImm()) { + EmitConstant(DispOp.getImm(), 4, OS); return; } @@ -159,39 +159,8 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, - intptr_t PCAdj, - raw_ostream &OS) const { - const MCOperand &Op3 = MI.getOperand(Op+3); - int DispVal = 0; - const MCOperand *DispForReloc = 0; - - // Figure out what sort of displacement we have to handle here. - if (Op3.isImm()) { - DispVal = Op3.getImm(); - } else { - assert(0 && "relocatable operand"); -#if 0 - if (Op3.isGlobal()) { - DispForReloc = &Op3; - } else if (Op3.isSymbol()) { - DispForReloc = &Op3; - } else if (Op3.isCPI()) { - if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) { - DispForReloc = &Op3; - } else { - DispVal += MCE.getConstantPoolEntryAddress(Op3.getIndex()); - DispVal += Op3.getOffset(); - } - } else { - assert(Op3.isJTI()); - if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) { - DispForReloc = &Op3; - } else { - DispVal += MCE.getJumpTableEntryAddress(Op3.getIndex()); - } -#endif - } - + intptr_t PCAdj, raw_ostream &OS) const { + const MCOperand &Disp = MI.getOperand(Op+3); const MCOperand &Base = MI.getOperand(Op); const MCOperand &Scale = MI.getOperand(Op+1); const MCOperand &IndexReg = MI.getOperand(Op+2); @@ -215,7 +184,7 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), OS); - EmitDisplacementField(DispForReloc, DispVal, PCAdj, true, OS); + EmitDisplacementField(Disp, PCAdj, true, OS); return; } @@ -225,21 +194,21 @@ // indirect register encoding, this handles addresses like [EAX]. The // encoding for [EBP] with no displacement means [disp32] so we handle it // by emitting a displacement of 0 below. - if (!DispForReloc && DispVal == 0 && BaseRegNo != N86::EBP) { + if (Disp.isImm() && Disp.getImm() == 0 && BaseRegNo != N86::EBP) { EmitByte(ModRMByte(0, RegOpcodeField, BaseRegNo), OS); return; } // Otherwise, if the displacement fits in a byte, encode as [REG+disp8]. - if (!DispForReloc && isDisp8(DispVal)) { + if (Disp.isImm() && isDisp8(Disp.getImm())) { EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), OS); - EmitConstant(DispVal, 1, OS); + EmitConstant(Disp.getImm(), 1, OS); return; } // Otherwise, emit the most general non-SIB encoding: [REG+disp32] EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), OS); - EmitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel, OS); + EmitDisplacementField(Disp, PCAdj, IsPCRel, OS); return; } @@ -254,14 +223,14 @@ // MOD=0, BASE=5, to JUST get the index, scale, and displacement. EmitByte(ModRMByte(0, RegOpcodeField, 4), OS); ForceDisp32 = true; - } else if (DispForReloc) { + } else if (!Disp.isImm()) { // Emit the normal disp32 encoding. EmitByte(ModRMByte(2, RegOpcodeField, 4), OS); ForceDisp32 = true; - } else if (DispVal == 0 && BaseReg != X86::EBP) { + } else if (Disp.getImm() == 0 && BaseReg != X86::EBP) { // Emit no displacement ModR/M byte EmitByte(ModRMByte(0, RegOpcodeField, 4), OS); - } else if (isDisp8(DispVal)) { + } else if (isDisp8(Disp.getImm())) { // Emit the disp8 encoding. EmitByte(ModRMByte(1, RegOpcodeField, 4), OS); ForceDisp8 = true; // Make sure to force 8 bit disp if Base=EBP @@ -294,9 +263,9 @@ // Do we need to output a displacement? if (ForceDisp8) - EmitConstant(DispVal, 1, OS); - else if (DispVal != 0 || ForceDisp32) - EmitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel, OS); + EmitConstant(Disp.getImm(), 1, OS); + else if (ForceDisp32 || Disp.getImm() != 0) + EmitDisplacementField(Disp, PCAdj, IsPCRel, OS); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 From sabre at nondot.org Wed Feb 10 00:41:02 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 06:41:02 -0000 Subject: [llvm-commits] [llvm] r95771 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002100641.o1A6f2iN024490@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 00:41:02 2010 New Revision: 95771 URL: http://llvm.org/viewvc/llvm-project?rev=95771&view=rev Log: keep track of what the current byte being emitted is throughout the X86 encoder. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95771&r1=95770&r2=95771&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Wed Feb 10 00:41:02 2010 @@ -56,20 +56,22 @@ return X86RegisterInfo::getX86RegNum(MO.getReg()); } - void EmitByte(unsigned char C, raw_ostream &OS) const { + void EmitByte(unsigned char C, unsigned &CurByte, raw_ostream &OS) const { OS << (char)C; + ++CurByte; } - void EmitConstant(uint64_t Val, unsigned Size, raw_ostream &OS) const { + void EmitConstant(uint64_t Val, unsigned Size, unsigned &CurByte, + raw_ostream &OS) const { // Output the constant in little endian byte order. for (unsigned i = 0; i != Size; ++i) { - EmitByte(Val & 255, OS); + EmitByte(Val & 255, CurByte, OS); Val >>= 8; } } void EmitDisplacementField(const MCOperand &Disp, int64_t Adj, bool IsPCRel, - raw_ostream &OS) const; + unsigned &CurByte, raw_ostream &OS) const; inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, unsigned RM) { @@ -78,20 +80,20 @@ } void EmitRegModRMByte(const MCOperand &ModRMReg, unsigned RegOpcodeFld, - raw_ostream &OS) const { - EmitByte(ModRMByte(3, RegOpcodeFld, GetX86RegNum(ModRMReg)), OS); + unsigned &CurByte, raw_ostream &OS) const { + EmitByte(ModRMByte(3, RegOpcodeFld, GetX86RegNum(ModRMReg)), CurByte, OS); } void EmitSIBByte(unsigned SS, unsigned Index, unsigned Base, - raw_ostream &OS) const { - // SIB byte is in the same format as the ModRMByte... - EmitByte(ModRMByte(SS, Index, Base), OS); + unsigned &CurByte, raw_ostream &OS) const { + // SIB byte is in the same format as the ModRMByte. + EmitByte(ModRMByte(SS, Index, Base), CurByte, OS); } void EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, intptr_t PCAdj, - raw_ostream &OS) const; + unsigned &CurByte, raw_ostream &OS) const; void EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl &Fixups) const; @@ -120,13 +122,18 @@ void X86MCCodeEmitter:: EmitDisplacementField(const MCOperand &DispOp, int64_t Adj, bool IsPCRel, - raw_ostream &OS) const { + unsigned &CurByte, raw_ostream &OS) const { // If this is a simple integer displacement that doesn't require a relocation, // emit it now. if (DispOp.isImm()) { - EmitConstant(DispOp.getImm(), 4, OS); + EmitConstant(DispOp.getImm(), 4, CurByte, OS); + CurByte += 4; return; } + + // Emit a symbolic constant as 4 0's and a Fixup. + EmitConstant(0, 4, CurByte, OS); + CurByte += 4; assert(0 && "Reloc not handled yet"); #if 0 @@ -159,7 +166,9 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, - intptr_t PCAdj, raw_ostream &OS) const { + intptr_t PCAdj, + unsigned &CurByte, + raw_ostream &OS) const { const MCOperand &Disp = MI.getOperand(Op+3); const MCOperand &Base = MI.getOperand(Op); const MCOperand &Scale = MI.getOperand(Op+1); @@ -183,8 +192,8 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode - EmitByte(ModRMByte(0, RegOpcodeField, 5), OS); - EmitDisplacementField(Disp, PCAdj, true, OS); + EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); + EmitDisplacementField(Disp, PCAdj, true, CurByte, OS); return; } @@ -195,20 +204,20 @@ // encoding for [EBP] with no displacement means [disp32] so we handle it // by emitting a displacement of 0 below. if (Disp.isImm() && Disp.getImm() == 0 && BaseRegNo != N86::EBP) { - EmitByte(ModRMByte(0, RegOpcodeField, BaseRegNo), OS); + EmitByte(ModRMByte(0, RegOpcodeField, BaseRegNo), CurByte, OS); return; } // Otherwise, if the displacement fits in a byte, encode as [REG+disp8]. if (Disp.isImm() && isDisp8(Disp.getImm())) { - EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), OS); - EmitConstant(Disp.getImm(), 1, OS); + EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), CurByte, OS); + EmitConstant(Disp.getImm(), 1, CurByte, OS); return; } // Otherwise, emit the most general non-SIB encoding: [REG+disp32] - EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), OS); - EmitDisplacementField(Disp, PCAdj, IsPCRel, OS); + EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), CurByte, OS); + EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS); return; } @@ -221,22 +230,22 @@ if (BaseReg == 0) { // If there is no base register, we emit the special case SIB byte with // MOD=0, BASE=5, to JUST get the index, scale, and displacement. - EmitByte(ModRMByte(0, RegOpcodeField, 4), OS); + EmitByte(ModRMByte(0, RegOpcodeField, 4), CurByte, OS); ForceDisp32 = true; } else if (!Disp.isImm()) { // Emit the normal disp32 encoding. - EmitByte(ModRMByte(2, RegOpcodeField, 4), OS); + EmitByte(ModRMByte(2, RegOpcodeField, 4), CurByte, OS); ForceDisp32 = true; } else if (Disp.getImm() == 0 && BaseReg != X86::EBP) { // Emit no displacement ModR/M byte - EmitByte(ModRMByte(0, RegOpcodeField, 4), OS); + EmitByte(ModRMByte(0, RegOpcodeField, 4), CurByte, OS); } else if (isDisp8(Disp.getImm())) { // Emit the disp8 encoding. - EmitByte(ModRMByte(1, RegOpcodeField, 4), OS); + EmitByte(ModRMByte(1, RegOpcodeField, 4), CurByte, OS); ForceDisp8 = true; // Make sure to force 8 bit disp if Base=EBP } else { // Emit the normal disp32 encoding. - EmitByte(ModRMByte(2, RegOpcodeField, 4), OS); + EmitByte(ModRMByte(2, RegOpcodeField, 4), CurByte, OS); } // Calculate what the SS field value should be... @@ -251,21 +260,21 @@ IndexRegNo = GetX86RegNum(IndexReg); else // Examples: [ESP+1*+4] or [scaled idx]+disp32 (MOD=0,BASE=5) IndexRegNo = 4; - EmitSIBByte(SS, IndexRegNo, 5, OS); + EmitSIBByte(SS, IndexRegNo, 5, CurByte, OS); } else { unsigned IndexRegNo; if (IndexReg.getReg()) IndexRegNo = GetX86RegNum(IndexReg); else IndexRegNo = 4; // For example [ESP+1*+4] - EmitSIBByte(SS, IndexRegNo, GetX86RegNum(Base), OS); + EmitSIBByte(SS, IndexRegNo, GetX86RegNum(Base), CurByte, OS); } // Do we need to output a displacement? if (ForceDisp8) - EmitConstant(Disp.getImm(), 1, OS); + EmitConstant(Disp.getImm(), 1, CurByte, OS); else if (ForceDisp32 || Disp.getImm() != 0) - EmitDisplacementField(Disp, PCAdj, IsPCRel, OS); + EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 @@ -373,36 +382,39 @@ const TargetInstrDesc &Desc = TII.get(Opcode); unsigned TSFlags = Desc.TSFlags; + // Keep track of the current byte being emitted. + unsigned CurByte = 0; + // FIXME: We should emit the prefixes in exactly the same order as GAS does, // in order to provide diffability. // Emit the lock opcode prefix as needed. if (TSFlags & X86II::LOCK) - EmitByte(0xF0, OS); + EmitByte(0xF0, CurByte, OS); // Emit segment override opcode prefix as needed. switch (TSFlags & X86II::SegOvrMask) { default: assert(0 && "Invalid segment!"); case 0: break; // No segment override! case X86II::FS: - EmitByte(0x64, OS); + EmitByte(0x64, CurByte, OS); break; case X86II::GS: - EmitByte(0x65, OS); + EmitByte(0x65, CurByte, OS); break; } // Emit the repeat opcode prefix as needed. if ((TSFlags & X86II::Op0Mask) == X86II::REP) - EmitByte(0xF3, OS); + EmitByte(0xF3, CurByte, OS); // Emit the operand size opcode prefix as needed. if (TSFlags & X86II::OpSize) - EmitByte(0x66, OS); + EmitByte(0x66, CurByte, OS); // Emit the address size opcode prefix as needed. if (TSFlags & X86II::AdSize) - EmitByte(0x67, OS); + EmitByte(0x67, CurByte, OS); bool Need0FPrefix = false; switch (TSFlags & X86II::Op0Mask) { @@ -415,46 +427,46 @@ Need0FPrefix = true; break; case X86II::TF: // F2 0F 38 - EmitByte(0xF2, OS); + EmitByte(0xF2, CurByte, OS); Need0FPrefix = true; break; case X86II::XS: // F3 0F - EmitByte(0xF3, OS); + EmitByte(0xF3, CurByte, OS); Need0FPrefix = true; break; case X86II::XD: // F2 0F - EmitByte(0xF2, OS); + EmitByte(0xF2, CurByte, OS); Need0FPrefix = true; break; - case X86II::D8: EmitByte(0xD8, OS); break; - case X86II::D9: EmitByte(0xD9, OS); break; - case X86II::DA: EmitByte(0xDA, OS); break; - case X86II::DB: EmitByte(0xDB, OS); break; - case X86II::DC: EmitByte(0xDC, OS); break; - case X86II::DD: EmitByte(0xDD, OS); break; - case X86II::DE: EmitByte(0xDE, OS); break; - case X86II::DF: EmitByte(0xDF, OS); break; + case X86II::D8: EmitByte(0xD8, CurByte, OS); break; + case X86II::D9: EmitByte(0xD9, CurByte, OS); break; + case X86II::DA: EmitByte(0xDA, CurByte, OS); break; + case X86II::DB: EmitByte(0xDB, CurByte, OS); break; + case X86II::DC: EmitByte(0xDC, CurByte, OS); break; + case X86II::DD: EmitByte(0xDD, CurByte, OS); break; + case X86II::DE: EmitByte(0xDE, CurByte, OS); break; + case X86II::DF: EmitByte(0xDF, CurByte, OS); break; } // Handle REX prefix. // FIXME: Can this come before F2 etc to simplify emission? if (Is64BitMode) { if (unsigned REX = DetermineREXPrefix(MI, TSFlags, Desc)) - EmitByte(0x40 | REX, OS); + EmitByte(0x40 | REX, CurByte, OS); } // 0x0F escape code must be emitted just before the opcode. if (Need0FPrefix) - EmitByte(0x0F, OS); + EmitByte(0x0F, CurByte, OS); // FIXME: Pull this up into previous switch if REX can be moved earlier. switch (TSFlags & X86II::Op0Mask) { case X86II::TF: // F2 0F 38 case X86II::T8: // 0F 38 - EmitByte(0x38, OS); + EmitByte(0x38, CurByte, OS); break; case X86II::TA: // 0F 3A - EmitByte(0x3A, OS); + EmitByte(0x3A, CurByte, OS); break; } @@ -474,7 +486,7 @@ default: errs() << "FORM: " << (TSFlags & X86II::FormMask) << "\n"; assert(0 && "Unknown FormMask value in X86MCCodeEmitter!"); case X86II::RawFrm: { - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); if (CurOp == NumOps) break; @@ -484,14 +496,14 @@ } case X86II::AddRegFrm: { - EmitByte(BaseOpcode + GetX86RegNum(MI.getOperand(CurOp++)),OS); + EmitByte(BaseOpcode + GetX86RegNum(MI.getOperand(CurOp++)), CurByte, OS); if (CurOp == NumOps) break; const MCOperand &MO1 = MI.getOperand(CurOp++); if (MO1.isImm()) { unsigned Size = X86II::getSizeOfImm(TSFlags); - EmitConstant(MO1.getImm(), Size, OS); + EmitConstant(MO1.getImm(), Size, CurByte, OS); break; } @@ -500,38 +512,38 @@ } case X86II::MRMDestReg: - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); EmitRegModRMByte(MI.getOperand(CurOp), - GetX86RegNum(MI.getOperand(CurOp+1)), OS); + GetX86RegNum(MI.getOperand(CurOp+1)), CurByte, OS); CurOp += 2; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), OS); + X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMDestMem: - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, GetX86RegNum(MI.getOperand(CurOp + X86AddrNumOperands)), - 0, OS); + 0, CurByte, OS); CurOp += X86AddrNumOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), OS); + X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMSrcReg: - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); EmitRegModRMByte(MI.getOperand(CurOp+1), GetX86RegNum(MI.getOperand(CurOp)), - OS); + CurByte, OS); CurOp += 2; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), OS); + X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMSrcMem: { - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); // FIXME: Maybe lea should have its own form? This is a horrible hack. int AddrOperands; @@ -546,11 +558,11 @@ X86II::getSizeOfImm(TSFlags) : 0; EmitMemModRMByte(MI, CurOp+1, GetX86RegNum(MI.getOperand(CurOp)), - PCAdj, OS); + PCAdj, CurByte, OS); CurOp += AddrOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), OS); + X86II::getSizeOfImm(TSFlags), CurByte, OS); break; } @@ -558,23 +570,24 @@ case X86II::MRM2r: case X86II::MRM3r: case X86II::MRM4r: case X86II::MRM5r: case X86II::MRM6r: case X86II::MRM7r: { - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); // Special handling of lfence, mfence, monitor, and mwait. // FIXME: This is terrible, they should get proper encoding bits in TSFlags. if (Opcode == X86::LFENCE || Opcode == X86::MFENCE || Opcode == X86::MONITOR || Opcode == X86::MWAIT) { - EmitByte(ModRMByte(3, (TSFlags & X86II::FormMask)-X86II::MRM0r, 0), OS); + EmitByte(ModRMByte(3, (TSFlags & X86II::FormMask)-X86II::MRM0r, 0), + CurByte, OS); switch (Opcode) { default: break; - case X86::MONITOR: EmitByte(0xC8, OS); break; - case X86::MWAIT: EmitByte(0xC9, OS); break; + case X86::MONITOR: EmitByte(0xC8, CurByte, OS); break; + case X86::MWAIT: EmitByte(0xC9, CurByte, OS); break; } } else { EmitRegModRMByte(MI.getOperand(CurOp++), (TSFlags & X86II::FormMask)-X86II::MRM0r, - OS); + CurByte, OS); } if (CurOp == NumOps) @@ -582,7 +595,7 @@ const MCOperand &MO1 = MI.getOperand(CurOp++); if (MO1.isImm()) { - EmitConstant(MO1.getImm(), X86II::getSizeOfImm(TSFlags), OS); + EmitConstant(MO1.getImm(), X86II::getSizeOfImm(TSFlags), CurByte, OS); break; } @@ -617,9 +630,9 @@ PCAdj = 4; } - EmitByte(BaseOpcode, OS); + EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, (TSFlags & X86II::FormMask)-X86II::MRM0m, - PCAdj, OS); + PCAdj, CurByte, OS); CurOp += X86AddrNumOperands; if (CurOp == NumOps) @@ -627,7 +640,7 @@ const MCOperand &MO = MI.getOperand(CurOp++); if (MO.isImm()) { - EmitConstant(MO.getImm(), X86II::getSizeOfImm(TSFlags), OS); + EmitConstant(MO.getImm(), X86II::getSizeOfImm(TSFlags), CurByte, OS); break; } From sabre at nondot.org Wed Feb 10 00:52:12 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 06:52:12 -0000 Subject: [llvm-commits] [llvm] r95773 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002100652.o1A6qCXJ025001@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 00:52:12 2010 New Revision: 95773 URL: http://llvm.org/viewvc/llvm-project?rev=95773&view=rev Log: emit some simple (and probably incorrect) fixups for symbolic displacement values. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95773&r1=95772&r2=95773&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Wed Feb 10 00:52:12 2010 @@ -19,6 +19,19 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +// FIXME: This should move to a header. +namespace llvm { +namespace X86 { +enum Fixups { + reloc_pcrel_word = FirstTargetFixupKind, + reloc_picrel_word, + reloc_absolute_word, + reloc_absolute_word_sext, + reloc_absolute_dword +}; +} +} + namespace { class X86MCCodeEmitter : public MCCodeEmitter { X86MCCodeEmitter(const X86MCCodeEmitter &); // DO NOT IMPLEMENT @@ -71,7 +84,8 @@ } void EmitDisplacementField(const MCOperand &Disp, int64_t Adj, bool IsPCRel, - unsigned &CurByte, raw_ostream &OS) const; + unsigned &CurByte, raw_ostream &OS, + SmallVectorImpl &Fixups) const; inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, unsigned RM) { @@ -93,7 +107,8 @@ void EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, intptr_t PCAdj, - unsigned &CurByte, raw_ostream &OS) const; + unsigned &CurByte, raw_ostream &OS, + SmallVectorImpl &Fixups) const; void EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl &Fixups) const; @@ -122,45 +137,27 @@ void X86MCCodeEmitter:: EmitDisplacementField(const MCOperand &DispOp, int64_t Adj, bool IsPCRel, - unsigned &CurByte, raw_ostream &OS) const { + unsigned &CurByte, raw_ostream &OS, + SmallVectorImpl &Fixups) const { // If this is a simple integer displacement that doesn't require a relocation, // emit it now. if (DispOp.isImm()) { EmitConstant(DispOp.getImm(), 4, CurByte, OS); - CurByte += 4; return; } - // Emit a symbolic constant as 4 0's and a Fixup. - EmitConstant(0, 4, CurByte, OS); - CurByte += 4; - - assert(0 && "Reloc not handled yet"); #if 0 // Otherwise, this is something that requires a relocation. Emit it as such // now. unsigned RelocType = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (RelocOp->isGlobal()) { - // In 64-bit static small code model, we could potentially emit absolute. - // But it's probably not beneficial. If the MCE supports using RIP directly - // do it, otherwise fallback to absolute (this is determined by IsPCRel). - // 89 05 00 00 00 00 mov %eax,0(%rip) # PC-relative - // 89 04 25 00 00 00 00 mov %eax,0x0 # Absolute - bool Indirect = gvNeedsNonLazyPtr(*RelocOp, TM); - emitGlobalAddress(RelocOp->getGlobal(), RelocType, RelocOp->getOffset(), - Adj, Indirect); - } else if (RelocOp->isSymbol()) { - emitExternalSymbolAddress(RelocOp->getSymbolName(), RelocType); - } else if (RelocOp->isCPI()) { - emitConstPoolAddress(RelocOp->getIndex(), RelocType, - RelocOp->getOffset(), Adj); - } else { - assert(RelocOp->isJTI() && "Unexpected machine operand!"); - emitJumpTableAddress(RelocOp->getIndex(), RelocType, Adj); - } #endif + + // Emit a symbolic constant as a fixup and 4 zeros. + Fixups.push_back(MCFixup::Create(CurByte, DispOp.getExpr(), + MCFixupKind(X86::reloc_absolute_word))); + EmitConstant(0, 4, CurByte, OS); } @@ -168,7 +165,8 @@ unsigned RegOpcodeField, intptr_t PCAdj, unsigned &CurByte, - raw_ostream &OS) const { + raw_ostream &OS, + SmallVectorImpl &Fixups) const{ const MCOperand &Disp = MI.getOperand(Op+3); const MCOperand &Base = MI.getOperand(Op); const MCOperand &Scale = MI.getOperand(Op+1); @@ -193,7 +191,7 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); - EmitDisplacementField(Disp, PCAdj, true, CurByte, OS); + EmitDisplacementField(Disp, PCAdj, true, CurByte, OS, Fixups); return; } @@ -217,7 +215,7 @@ // Otherwise, emit the most general non-SIB encoding: [REG+disp32] EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), CurByte, OS); - EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS); + EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS, Fixups); return; } @@ -274,7 +272,7 @@ if (ForceDisp8) EmitConstant(Disp.getImm(), 1, CurByte, OS); else if (ForceDisp32 || Disp.getImm() != 0) - EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS); + EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS, Fixups); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 @@ -525,7 +523,7 @@ EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, GetX86RegNum(MI.getOperand(CurOp + X86AddrNumOperands)), - 0, CurByte, OS); + 0, CurByte, OS, Fixups); CurOp += X86AddrNumOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), @@ -558,7 +556,7 @@ X86II::getSizeOfImm(TSFlags) : 0; EmitMemModRMByte(MI, CurOp+1, GetX86RegNum(MI.getOperand(CurOp)), - PCAdj, CurByte, OS); + PCAdj, CurByte, OS, Fixups); CurOp += AddrOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), @@ -632,7 +630,7 @@ EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, (TSFlags & X86II::FormMask)-X86II::MRM0m, - PCAdj, CurByte, OS); + PCAdj, CurByte, OS, Fixups); CurOp += X86AddrNumOperands; if (CurOp == NumOps) From daniel at zuster.org Wed Feb 10 02:15:49 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 08:15:49 -0000 Subject: [llvm-commits] [llvm] r95774 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <201002100815.o1A8Fnje028810@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Feb 10 02:15:48 2010 New Revision: 95774 URL: http://llvm.org/viewvc/llvm-project?rev=95774&view=rev Log: MC/AsmMatcher: Add support for creating tied operands when constructing MCInsts. - Pretty messy, but we need to rework how we handle tied operands in MCInst anyway. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=95774&r1=95773&r2=95774&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Wed Feb 10 02:15:48 2010 @@ -944,10 +944,29 @@ OperandName.str() + "'"); } - const CodeGenInstruction::OperandInfo &OI = II->Instr->OperandList[Idx]; + // FIXME: This is annoying, the named operand may be tied (e.g., + // XCHG8rm). What we want is the untied operand, which we now have to + // grovel for. Only worry about this for single entry operands, we have to + // clean this up anyway. + const CodeGenInstruction::OperandInfo *OI = &II->Instr->OperandList[Idx]; + if (OI->Constraints[0].isTied()) { + unsigned TiedOp = OI->Constraints[0].getTiedOperand(); + + // The tied operand index is an MIOperand index, find the operand that + // contains it. + for (unsigned i = 0, e = II->Instr->OperandList.size(); i != e; ++i) { + if (II->Instr->OperandList[i].MIOperandNo == TiedOp) { + OI = &II->Instr->OperandList[i]; + break; + } + } + + assert(OI && "Unable to find tied operand target!"); + } + InstructionInfo::Operand Op; - Op.Class = getOperandClass(Token, OI); - Op.OperandInfo = &OI; + Op.Class = getOperandClass(Token, *OI); + Op.OperandInfo = OI; II->Operands.push_back(Op); } } @@ -996,6 +1015,19 @@ if (Op.OperandInfo) MIOperandList.push_back(std::make_pair(Op.OperandInfo->MIOperandNo, i)); } + + // Find any tied operands. + SmallVector, 4> TiedOperands; + for (unsigned i = 0, e = II.Instr->OperandList.size(); i != e; ++i) { + const CodeGenInstruction::OperandInfo &OpInfo = II.Instr->OperandList[i]; + for (unsigned j = 0, e = OpInfo.Constraints.size(); j != e; ++j) { + const CodeGenInstruction::ConstraintInfo &CI = OpInfo.Constraints[j]; + if (CI.isTied()) + TiedOperands.push_back(std::make_pair(OpInfo.MIOperandNo + j, + CI.getTiedOperand())); + } + } + std::sort(MIOperandList.begin(), MIOperandList.end()); // Compute the total number of operands. @@ -1014,14 +1046,23 @@ assert(CurIndex <= Op.OperandInfo->MIOperandNo && "Duplicate match for instruction operand!"); - Signature += "_"; - // Skip operands which weren't matched by anything, this occurs when the // .td file encodes "implicit" operands as explicit ones. // // FIXME: This should be removed from the MCInst structure. - for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) - Signature += "Imp"; + for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) { + // See if this is a tied operand. + unsigned i, e = TiedOperands.size(); + for (i = 0; i != e; ++i) + if (CurIndex == TiedOperands[i].first) + break; + if (i == e) + Signature += "__Imp"; + else + Signature += "__Tie" + utostr(TiedOperands[i].second); + } + + Signature += "__"; // Registers are always converted the same, don't duplicate the conversion // function based on them. @@ -1060,8 +1101,25 @@ InstructionInfo::Operand &Op = II.Operands[MIOperandList[i].second]; // Add the implicit operands. - for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) - CvtOS << " Inst.addOperand(MCOperand::CreateReg(0));\n"; + for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) { + // See if this is a tied operand. + unsigned i, e = TiedOperands.size(); + for (i = 0; i != e; ++i) + if (CurIndex == TiedOperands[i].first) + break; + + if (i == e) { + // If not, this is some implicit operand. Just assume it is a register + // for now. + CvtOS << " Inst.addOperand(MCOperand::CreateReg(0));\n"; + } else { + // Copy the tied operand. + assert(TiedOperands[i].first > TiedOperands[i].second && + "Tied operand preceeds its target!"); + CvtOS << " Inst.addOperand(Inst.getOperand(" + << TiedOperands[i].second << "));\n"; + } + } CvtOS << " ((" << TargetOperandClass << "*)Operands[" << MIOperandList[i].second From daniel at zuster.org Wed Feb 10 02:30:24 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 00:30:24 -0800 Subject: [llvm-commits] [llvm] r95723 - in /llvm/trunk/examples: CMakeLists.txt ExceptionDemo/ ExceptionDemo/CMakeLists.txt ExceptionDemo/ExceptionDemo.cpp ExceptionDemo/Makefile Makefile In-Reply-To: References: <201002092322.o19NMiQ3005105@zion.cs.uiuc.edu> <6a8523d61002091726q69844076j6bce6dee3a3f3500@mail.gmail.com> Message-ID: <6a8523d61002100030x41572863y8f6cbcc6c58b2307@mail.gmail.com> On Tue, Feb 9, 2010 at 7:08 PM, Garrison Venn wrote: > Ok Daniel, added: > > if( NOT WIN32 ) > ? ?add_subdirectory(ExceptionDemo) > endif() Thanks! > to examples CMakeLists.txt. Seems like WIN32 is the correct def. to use. > Is there another more preferable one? Is the default make system used > for WINDOWS? I believe make works with mingw and perhaps cygwin, but I have only used CMake + MSVC, which is what the buildbots test. - Daniel > Garrison > > On Feb 9, 2010, at 20:26, Daniel Dunbar wrote: > >> Hi Garrison, >> >> Can you change the CMake files to make sure this example doesn't try >> and get built on Windows? See here: >> ?http://google1.osuosl.org:8011/builders/clang-i686-xp-msvc9/builds/3779 >> >> - Daniel >> >> On Tue, Feb 9, 2010 at 3:22 PM, Garrison Venn wrote: >>> Author: gvenn >>> Date: Tue Feb ?9 17:22:43 2010 >>> New Revision: 95723 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=95723&view=rev >>> Log: >>> Adds a JIT based exception handling example to the examples directory. >>> Both zero cost example domain specific, and C++ foreign exception handling are >>> shown. The example's documentation fully explains how to run the example. >>> >>> Notes: >>> >>> 1) ? The code uses an extremely simple type info model. >>> 2) ? Only a single landing pad is used per unwind edge >>> ? ? (one call to llvm.eh.selector) >>> 3) ? llvm.eh.selector support for filter arguments is not given. >>> 4) ? llvm.eh.typeid.for is not used. >>> 5) ? Forced unwind behavior is not supported. >>> 6) ? Very little if any error handling is given. >>> 7) ? __attribute__((__aligned__)) is used. >>> 8) ? The code uses parts from the llvm compiler-rt project and >>> ? ? the llvm Kaleidoscope example. >>> 9) ? The code has not been ported or tested on WINDOWS. >>> 10) ?The code was not tested with a cmake build. >>> 11) ?The code was tested for a debug build on 32bit X86 CentOS LINUX, >>> ? ? and both a debug and release build on OS X 10.6.2 (64bit). >>> >>> Added: >>> ? ?llvm/trunk/examples/ExceptionDemo/ >>> ? ?llvm/trunk/examples/ExceptionDemo/CMakeLists.txt >>> ? ?llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp >>> ? ?llvm/trunk/examples/ExceptionDemo/Makefile >>> Modified: >>> ? ?llvm/trunk/examples/CMakeLists.txt >>> ? ?llvm/trunk/examples/Makefile >>> >>> Modified: llvm/trunk/examples/CMakeLists.txt >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=95723&r1=95722&r2=95723&view=diff >>> >>> ============================================================================== >>> --- llvm/trunk/examples/CMakeLists.txt (original) >>> +++ llvm/trunk/examples/CMakeLists.txt Tue Feb ?9 17:22:43 2010 >>> @@ -3,6 +3,7 @@ >>> ?add_subdirectory(HowToUseJIT) >>> ?add_subdirectory(Kaleidoscope) >>> ?add_subdirectory(ModuleMaker) >>> +add_subdirectory(ExceptionDemo) >>> >>> ?include(CheckIncludeFile) >>> ?check_include_file(pthread.h HAVE_PTHREAD_H) >>> >>> Added: llvm/trunk/examples/ExceptionDemo/CMakeLists.txt >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/CMakeLists.txt?rev=95723&view=auto >>> >>> ============================================================================== >>> --- llvm/trunk/examples/ExceptionDemo/CMakeLists.txt (added) >>> +++ llvm/trunk/examples/ExceptionDemo/CMakeLists.txt Tue Feb ?9 17:22:43 2010 >>> @@ -0,0 +1,5 @@ >>> +set(LLVM_LINK_COMPONENTS jit nativecodegen) >>> + >>> +add_llvm_example(ExceptionDemo >>> + ?ExceptionDemo.cpp >>> + ?) >>> >>> Added: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=95723&view=auto >>> >>> ============================================================================== >>> --- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (added) >>> +++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Feb ?9 17:22:43 2010 >>> @@ -0,0 +1,2028 @@ >>> +//===-- examples/ExceptionDemo/ExceptionDemo.cpp - >>> +// ? ? ? ? ? ? ? ? ? ? ?An example use of the llvm Exception mechanism --===// >>> +// >>> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>> +// >>> +// This file is distributed under the University of Illinois Open Source >>> +// License. See LICENSE.TXT for details. >>> +// >>> +//===--------------------------------------------------------------------===// >>> +// >>> +// Demo program which implements an example LLVM exception implementation, and >>> +// shows several test cases including the handling of foreign exceptions. >>> +// It is run with type info types arguments to throw. A test will >>> +// be run for each given type info type. While type info types with the value >>> +// of -1 will trigger a foreign C++ exception to be thrown; type info types >>> +// <= 6 and >= 1 will cause the associated generated exceptions to be thrown >>> +// and caught by generated test functions; and type info types > 6 >>> +// will result in exceptions which pass through to the test harness. All other >>> +// type info types are not supported and could cause a crash. In all cases, >>> +// the "finally" blocks of every generated test functions will executed >>> +// regardless of whether or not that test function ignores or catches the >>> +// thrown exception. >>> +// >>> +// examples: >>> +// >>> +// ExceptionDemo >>> +// >>> +// ? ? causes a usage to be printed to stderr >>> +// >>> +// ExceptionDemo 2 3 7 -1 >>> +// >>> +// ? ? results in the following cases: >>> +// ? ? ? ? - Value 2 causes an exception with a type info type of 2 to be >>> +// ? ? ? ? ? thrown and caught by an inner generated test function. >>> +// ? ? ? ? - Value 3 causes an exception with a type info type of 3 to be >>> +// ? ? ? ? ? thrown and caught by an outer generated test function. >>> +// ? ? ? ? - Value 7 causes an exception with a type info type of 7 to be >>> +// ? ? ? ? ? thrown and NOT be caught by any generated function. >>> +// ? ? ? ? - Value -1 causes a foreign C++ exception to be thrown and not be >>> +// ? ? ? ? ? caught by any generated function >>> +// >>> +// ? ? Cases -1 and 7 are caught by a C++ test harness where the validity of >>> +// ? ? ? ? of a C++ catch(...) clause catching a generated exception with a >>> +// ? ? ? ? type info type of 7 is questionable. >>> +// >>> +// This code uses code from the llvm compiler-rt project and the llvm >>> +// Kaleidoscope project. >>> +// >>> +//===--------------------------------------------------------------------===// >>> + >>> + >>> +#include "llvm/LLVMContext.h" >>> +#include "llvm/DerivedTypes.h" >>> +#include "llvm/ExecutionEngine/ExecutionEngine.h" >>> +#include "llvm/ExecutionEngine/JIT.h" >>> +#include "llvm/Module.h" >>> +#include "llvm/PassManager.h" >>> +#include "llvm/Intrinsics.h" >>> +#include "llvm/Analysis/Verifier.h" >>> +#include "llvm/Target/TargetData.h" >>> +#include "llvm/Target/TargetSelect.h" >>> +#include "llvm/Target/TargetOptions.h" >>> +#include "llvm/Transforms/Scalar.h" >>> +#include "llvm/Support/IRBuilder.h" >>> +#include "llvm/Support/Dwarf.h" >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> + >>> +#ifndef USE_GLOBAL_STR_CONSTS >>> +#define USE_GLOBAL_STR_CONSTS true >>> +#endif >>> + >>> +// System C++ ABI unwind types from: >>> +// ? ? http://refspecs.freestandards.org/abi-eh-1.21.html >>> + >>> +extern "C" { >>> + >>> +typedef enum { >>> + ? ?_URC_NO_REASON = 0, >>> + ? ?_URC_FOREIGN_EXCEPTION_CAUGHT = 1, >>> + ? ?_URC_FATAL_PHASE2_ERROR = 2, >>> + ? ?_URC_FATAL_PHASE1_ERROR = 3, >>> + ? ?_URC_NORMAL_STOP = 4, >>> + ? ?_URC_END_OF_STACK = 5, >>> + ? ?_URC_HANDLER_FOUND = 6, >>> + ? ?_URC_INSTALL_CONTEXT = 7, >>> + ? ?_URC_CONTINUE_UNWIND = 8 >>> +} _Unwind_Reason_Code; >>> + >>> +typedef enum { >>> + ? ?_UA_SEARCH_PHASE = 1, >>> + ? ?_UA_CLEANUP_PHASE = 2, >>> + ? ?_UA_HANDLER_FRAME = 4, >>> + ? ?_UA_FORCE_UNWIND = 8, >>> + ? ?_UA_END_OF_STACK = 16 >>> +} _Unwind_Action; >>> + >>> +struct _Unwind_Exception; >>> + >>> +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception *); >>> + >>> +struct _Unwind_Exception { >>> + ? ?uint64_t exception_class; >>> + ? ?_Unwind_Exception_Cleanup_Fn exception_cleanup; >>> + >>> + ? ?uintptr_t private_1; >>> + ? ?uintptr_t private_2; >>> + >>> + ? ?// @@@ The IA-64 ABI says that this structure must be double-word aligned. >>> + ? ?// ?Taking that literally does not make much sense generically. ?Instead >>> + ? ?// ?we provide the maximum alignment required by any type for the machine. >>> +} __attribute__((__aligned__)); >>> + >>> +struct _Unwind_Context; >>> +typedef struct _Unwind_Context* _Unwind_Context_t; >>> + >>> +extern const uint8_t* _Unwind_GetLanguageSpecificData (_Unwind_Context_t c); >>> +extern uintptr_t _Unwind_GetGR (_Unwind_Context_t c, int i); >>> +extern void _Unwind_SetGR (_Unwind_Context_t c, int i, uintptr_t n); >>> +extern void _Unwind_SetIP (_Unwind_Context_t, uintptr_t new_value); >>> +extern uintptr_t _Unwind_GetIP (_Unwind_Context_t context); >>> +extern uintptr_t _Unwind_GetRegionStart (_Unwind_Context_t context); >>> + >>> +} // extern "C" >>> + >>> +// >>> +// Example types >>> +// >>> + >>> +/// This is our simplistic type info >>> +struct OurExceptionType_t { >>> + ? ?/// type info type >>> + ? ?int type; >>> +}; >>> + >>> + >>> +/// This is our Exception class which relies on a negative offset to calculate >>> +/// pointers to its instances from pointers to its unwindException member. >>> +/// >>> +/// Note: The above unwind.h defines struct _Unwind_Exception to be aligned >>> +/// ? ? ? on a double word boundary. This is necessary to match the standard: >>> +/// ? ? ? http://refspecs.freestandards.org/abi-eh-1.21.html >>> +struct OurBaseException_t { >>> + ? ?struct OurExceptionType_t type; >>> + >>> + ? ?// Note: This is properly aligned in unwind.h >>> + ? ?struct _Unwind_Exception unwindException; >>> +}; >>> + >>> + >>> +// Note: Not needed since we are C++ >>> +typedef struct OurBaseException_t OurException; >>> +typedef struct _Unwind_Exception OurUnwindException; >>> + >>> +// >>> +// Various globals used to support typeinfo and generatted exceptions in >>> +// general >>> +// >>> + >>> +static std::map namedValues; >>> + >>> +int64_t ourBaseFromUnwindOffset; >>> + >>> +const unsigned char ourBaseExcpClassChars[] = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{'o', 'b', 'j', '\0', 'b', 'a', 's', '\0'}; >>> + >>> + >>> +static uint64_t ourBaseExceptionClass = 0; >>> + >>> +static std::vector ourTypeInfoNames; >>> +static std::map ourTypeInfoNamesIndex; >>> + >>> +static llvm::StructType* ourTypeInfoType; >>> +static llvm::StructType* ourExceptionType; >>> +static llvm::StructType* ourUnwindExceptionType; >>> + >>> +static llvm::ConstantInt* ourExceptionNotThrownState; >>> +static llvm::ConstantInt* ourExceptionThrownState; >>> +static llvm::ConstantInt* ourExceptionCaughtState; >>> + >>> +typedef std::vector ArgNames; >>> +typedef std::vector ArgTypes; >>> + >>> +// >>> +// Code Generation Utilities >>> +// >>> + >>> +/// Utility used to create a function, both declarations and definitions >>> +/// @param module for module instance >>> +/// @param retType function return type >>> +/// @param theArgTypes function's ordered argument types >>> +/// @param theArgNames function's ordered arguments needed if use of this >>> +/// ? ? ? ?function corresponds to a function definition. Use empty >>> +/// ? ? ? ?aggregate for function declarations. >>> +/// @param functName function name >>> +/// @param linkage function linkage >>> +/// @param declarationOnly for function declarations >>> +/// @param isVarArg function uses vararg arguments >>> +/// @returns function instance >>> +llvm::Function *createFunction(llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const llvm::Type* retType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const ArgTypes& theArgTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const ArgNames& theArgNames, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const std::string& functName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkageTypes linkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool declarationOnly, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bool isVarArg) { >>> + ? ?llvm::FunctionType* functType = llvm::FunctionType::get(retType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?theArgTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isVarArg); >>> + ? ?llvm::Function* ret = llvm::Function::Create(functType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? linkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? functName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &module); >>> + ? ?if (!ret || declarationOnly) >>> + ? ? ? ?return(ret); >>> + >>> + ? ?namedValues.clear(); >>> + ? ?unsigned i = 0; >>> + ? ?for (llvm::Function::arg_iterator argIndex = ret->arg_begin(); >>> + ? ? ? ? i != theArgNames.size(); >>> + ? ? ? ? ++argIndex, ++i) { >>> + >>> + ? ? ? ?argIndex->setName(theArgNames[i]); >>> + ? ? ? ?namedValues[theArgNames[i]] = argIndex; >>> + ? ?} >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// Create an alloca instruction in the entry block of >>> +/// the parent function. ?This is used for mutable variables etc. >>> +/// @param function parent instance >>> +/// @param varName stack variable name >>> +/// @param type stack variable type >>> +/// @param initWith optional constant initialization value >>> +/// @returns AllocaInst instance >>> +static llvm::AllocaInst *createEntryBlockAlloca(llvm::Function& function, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const std::string &varName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const llvm::Type* type, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Constant* initWith = NULL) { >>> + ? ?llvm::BasicBlock& block = function.getEntryBlock(); >>> + ? ?llvm::IRBuilder<> tmp(&block, block.begin()); >>> + ? ?llvm::AllocaInst* ret = tmp.CreateAlloca(type, 0, varName.c_str()); >>> + >>> + ? ?if (initWith) >>> + ? ? ? ?tmp.CreateStore(initWith, ret); >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +// >>> +// Code Generation Utilities End >>> +// >>> + >>> +// >>> +// Runtime C Library functions >>> +// >>> + >>> +// Note: using an extern "C" block so that static functions can be used >>> +extern "C" { >>> + >>> +// Note: Better ways to decide on bit width >>> +// >>> +/// Prints a 32 bit number, according to the format, to stderr. >>> +/// @param intToPrint integer to print >>> +/// @param format printf like format to use when printing >>> +void print32Int(int intToPrint, const char* format) { >>> + ? ?if (format) { >>> + ? ? ? ?// Note: No NULL check >>> + ? ? ? ?fprintf(stderr, format, intToPrint); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?// Note: No NULL check >>> + ? ? ? ?fprintf(stderr, "::print32Int(...):NULL arg.\n"); >>> + ? ?} >>> +} >>> + >>> + >>> +// Note: Better ways to decide on bit width >>> +// >>> +/// Prints a 64 bit number, according to the format, to stderr. >>> +/// @param intToPrint integer to print >>> +/// @param format printf like format to use when printing >>> +void print64Int(long int intToPrint, const char* format) { >>> + ? ?if (format) { >>> + ? ? ? ?// Note: No NULL check >>> + ? ? ? ?fprintf(stderr, format, intToPrint); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?// Note: No NULL check >>> + ? ? ? ?fprintf(stderr, "::print64Int(...):NULL arg.\n"); >>> + ? ?} >>> +} >>> + >>> + >>> +/// Prints a C string to stderr >>> +/// @param toPrint string to print >>> +void printStr(char* toPrint) { >>> + ? ?if (toPrint) { >>> + ? ? ? ?fprintf(stderr, "%s", toPrint); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?fprintf(stderr, "::printStr(...):NULL arg.\n"); >>> + ? ?} >>> +} >>> + >>> + >>> +/// Deletes the true previosly allocated exception whose address >>> +/// is calculated from the supplied OurBaseException_t::unwindException >>> +/// member address. Handles (ignores), NULL pointers. >>> +/// @param expToDelete exception to delete >>> +void deleteOurException(OurUnwindException* expToDelete) { >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"deleteOurException(...).\n"); >>> +#endif >>> + >>> + ? ?if (expToDelete && >>> + ? ? ? ?(expToDelete->exception_class == ourBaseExceptionClass)) { >>> + >>> + ? ? ? ?free(((char*) expToDelete) + ourBaseFromUnwindOffset); >>> + ? ?} >>> +} >>> + >>> + >>> +/// This function is the struct _Unwind_Exception API mandated delete function >>> +/// used by foreign exception handlers when deleting our exception >>> +/// (OurException), instances. >>> +/// @param reason @link http://refspecs.freestandards.org/abi-eh-1.21.html >>> +/// @unlink >>> +/// @param expToDelete exception instance to delete >>> +void deleteFromUnwindOurException(_Unwind_Reason_Code reason, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?OurUnwindException* expToDelete) { >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"deleteFromUnwindOurException(...).\n"); >>> +#endif >>> + >>> + ? ?deleteOurException(expToDelete); >>> +} >>> + >>> + >>> +/// Creates (allocates on the heap), an exception (OurException instance), >>> +/// of the supplied type info type. >>> +/// @param type type info type >>> +OurUnwindException* createOurException(int type) { >>> + ? ?size_t size = sizeof(OurException); >>> + ? ?OurException* ret = (OurException*) memset(malloc(size), 0, size); >>> + ? ?(ret->type).type = type; >>> + ? ?(ret->unwindException).exception_class = ourBaseExceptionClass; >>> + ? ?(ret->unwindException).exception_cleanup = deleteFromUnwindOurException; >>> + >>> + ? ?return(&(ret->unwindException)); >>> +} >>> + >>> + >>> +/// Read a uleb128 encoded value and advance pointer >>> +/// See Variable Length Data in: >>> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >>> +/// @param data reference variable holding memory pointer to decode from >>> +/// @returns decoded value >>> +static uintptr_t readULEB128(const uint8_t** data) { >>> + ? ?uintptr_t result = 0; >>> + ? ?uintptr_t shift = 0; >>> + ? ?unsigned char byte; >>> + ? ?const uint8_t* p = *data; >>> + >>> + ? ?do { >>> + ? ? ? ?byte = *p++; >>> + ? ? ? ?result |= (byte & 0x7f) << shift; >>> + ? ? ? ?shift += 7; >>> + ? ?} >>> + ? ?while (byte & 0x80); >>> + >>> + ? ?*data = p; >>> + >>> + ? ?return result; >>> +} >>> + >>> + >>> +/// Read a sleb128 encoded value and advance pointer >>> +/// See Variable Length Data in: >>> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >>> +/// @param data reference variable holding memory pointer to decode from >>> +/// @returns decoded value >>> +static uintptr_t readSLEB128(const uint8_t** data) { >>> + ? ?uintptr_t result = 0; >>> + ? ?uintptr_t shift = 0; >>> + ? ?unsigned char byte; >>> + ? ?const uint8_t* p = *data; >>> + >>> + ? ?do { >>> + ? ? ? ?byte = *p++; >>> + ? ? ? ?result |= (byte & 0x7f) << shift; >>> + ? ? ? ?shift += 7; >>> + ? ?} >>> + ? ?while (byte & 0x80); >>> + >>> + ? ?*data = p; >>> + >>> + ? ?if ((byte & 0x40) && (shift < (sizeof(result) << 3))) { >>> + ? ? ? ?result |= (~0 << shift); >>> + ? ?} >>> + >>> + ? ?return result; >>> +} >>> + >>> + >>> +/// Read a pointer encoded value and advance pointer >>> +/// See Variable Length Data in: >>> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >>> +/// @param data reference variable holding memory pointer to decode from >>> +/// @param encoding dwarf encoding type >>> +/// @returns decoded value >>> +static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { >>> + ? ?uintptr_t result = 0; >>> + ? ?const uint8_t* p = *data; >>> + >>> + ? ?if (encoding == llvm::dwarf::DW_EH_PE_omit) >>> + ? ? ? ?return(result); >>> + >>> + ? ?// first get value >>> + ? ?switch (encoding & 0x0F) { >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_absptr: >>> + ? ? ? ? ? ?result = *((uintptr_t*)p); >>> + ? ? ? ? ? ?p += sizeof(uintptr_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_uleb128: >>> + ? ? ? ? ? ?result = readULEB128(&p); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?// Note: This case has not been tested >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_sleb128: >>> + ? ? ? ? ? ?result = readSLEB128(&p); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata2: >>> + ? ? ? ? ? ?result = *((uint16_t*)p); >>> + ? ? ? ? ? ?p += sizeof(uint16_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata4: >>> + ? ? ? ? ? ?result = *((uint32_t*)p); >>> + ? ? ? ? ? ?p += sizeof(uint32_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_udata8: >>> + ? ? ? ? ? ?result = *((uint64_t*)p); >>> + ? ? ? ? ? ?p += sizeof(uint64_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata2: >>> + ? ? ? ? ? ?result = *((int16_t*)p); >>> + ? ? ? ? ? ?p += sizeof(int16_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata4: >>> + ? ? ? ? ? ?result = *((int32_t*)p); >>> + ? ? ? ? ? ?p += sizeof(int32_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_sdata8: >>> + ? ? ? ? ? ?result = *((int64_t*)p); >>> + ? ? ? ? ? ?p += sizeof(int64_t); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?default: >>> + ? ? ? ? ? ?// not supported >>> + ? ? ? ? ? ?abort(); >>> + ? ? ? ? ? ?break; >>> + ? ?} >>> + >>> + ? ?// then add relative offset >>> + ? ?switch (encoding & 0x70) { >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_absptr: >>> + ? ? ? ? ? ?// do nothing >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_pcrel: >>> + ? ? ? ? ? ?result += (uintptr_t)(*data); >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_textrel: >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_datarel: >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_funcrel: >>> + ? ? ? ?case llvm::dwarf::DW_EH_PE_aligned: >>> + ? ? ? ?default: >>> + ? ? ? ? ? ?// not supported >>> + ? ? ? ? ? ?abort(); >>> + ? ? ? ? ? ?break; >>> + ? ?} >>> + >>> + ? ?// then apply indirection >>> + ? ?if (encoding & llvm::dwarf::DW_EH_PE_indirect) { >>> + ? ? ? ?result = *((uintptr_t*)result); >>> + ? ?} >>> + >>> + ? ?*data = p; >>> + >>> + ? ?return result; >>> +} >>> + >>> + >>> +/// Deals with Dwarf actions matching our type infos >>> +/// (OurExceptionType_t instances). Returns whether or not a dwarf emitted >>> +/// action matches the supplied exception type. If such a match succeeds, >>> +/// the resultAction argument will be set with > 0 index value. Only >>> +/// corresponding llvm.eh.selector type info arguments, cleanup arguments >>> +/// are supported. Filters are not supported. >>> +/// See Variable Length Data in: >>> +/// @link http://dwarfstd.org/Dwarf3.pdf @unlink >>> +/// Also see @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >>> +/// @param resultAction reference variable which will be set with result >>> +/// @param classInfo our array of type info pointers (to globals) >>> +/// @param actionEntry index into above type info array or 0 (clean up). >>> +/// ? ? ? ?We do not support filters. >>> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >>> +/// ? ? ? ?of thrown exception. >>> +/// @param exceptionObject thrown _Unwind_Exception instance. >>> +/// @returns whether or not a type info was found. False is returned if only >>> +/// ? ? ? ? ?a cleanup was found >>> +static bool handleActionValue(int64_t *resultAction, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct OurExceptionType_t **classInfo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uintptr_t actionEntry, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint64_t exceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception *exceptionObject) { >>> + ? ?bool ret = false; >>> + >>> + ? ?if (!resultAction || >>> + ? ? ? ?!exceptionObject || >>> + ? ? ? ?(exceptionClass != ourBaseExceptionClass)) >>> + ? ? ? ?return(ret); >>> + >>> + ? ?struct OurBaseException_t* excp = (struct OurBaseException_t*) >>> + ? ? ? ? ? ? ? ? ? ? ? ?(((char*) exceptionObject) + ourBaseFromUnwindOffset); >>> + ? ?struct OurExceptionType_t *excpType = &(excp->type); >>> + ? ?int type = excpType->type; >>> + >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"handleActionValue(...): exceptionObject = <%p>, " >>> + ? ? ? ? ? ? ? ?"excp = <%p>.\n", >>> + ? ? ? ? ? ?exceptionObject, >>> + ? ? ? ? ? ?excp); >>> +#endif >>> + >>> + ? ?const uint8_t *actionPos = (uint8_t*) actionEntry, >>> + ? ? ? ? ? ? ? ? ?*tempActionPos; >>> + ? ?int64_t typeOffset = 0, >>> + ? ? ? ? ? ?actionOffset; >>> + >>> + ? ?for (int i = 0; true; ++i) { >>> + ? ? ? ?// Each emitted dwarf action corresponds to a 2 tuple of >>> + ? ? ? ?// type info address offset, and action offset to the next >>> + ? ? ? ?// emitted action. >>> + ? ? ? ?typeOffset = readSLEB128(&actionPos); >>> + ? ? ? ?tempActionPos = actionPos; >>> + ? ? ? ?actionOffset = readSLEB128(&tempActionPos); >>> + >>> +#ifdef DEBUG >>> + ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ?"handleActionValue(...):typeOffset: <%lld>, " >>> + ? ? ? ? ? ? ? ? ? ?"actionOffset: <%lld>.\n", >>> + ? ? ? ? ? ? ? ?typeOffset, >>> + ? ? ? ? ? ? ? ?actionOffset); >>> +#endif >>> + ? ? ? ?assert((typeOffset >= 0) && >>> + ? ? ? ? ? ? ? "handleActionValue(...):filters are not supported."); >>> + >>> + ? ? ? ?// Note: A typeOffset == 0 implies that a cleanup llvm.eh.selector >>> + ? ? ? ?// ? ? ? argument has been matched. >>> + ? ? ? ?if ((typeOffset > 0) && >>> + ? ? ? ? ? ?(type == (classInfo[-typeOffset])->type)) { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ?"handleActionValue(...):actionValue <%d> found.\n", >>> + ? ? ? ? ? ? ? ? ? ?i); >>> +#endif >>> + ? ? ? ? ? ?*resultAction = i + 1; >>> + ? ? ? ? ? ?ret = true; >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?} >>> + >>> +#ifdef DEBUG >>> + ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ?"handleActionValue(...):actionValue not found.\n"); >>> +#endif >>> + ? ? ? ?if (!actionOffset) >>> + ? ? ? ? ? ?break; >>> + >>> + ? ? ? ?actionPos += actionOffset; >>> + ? ?} >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// Deals with the Language specific data portion of the emitted dwarf code. >>> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >>> +/// @param version unsupported (ignored), unwind version >>> +/// @param lsda language specific data area >>> +/// @param _Unwind_Action actions minimally supported unwind stage >>> +/// ? ? ? ?(forced specifically not supported) >>> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >>> +/// ? ? ? ?of thrown exception. >>> +/// @param exceptionObject thrown _Unwind_Exception instance. >>> +/// @param context unwind system context >>> +/// @returns minimally supported unwinding control indicator >>> +static _Unwind_Reason_Code handleLsda(int version, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const uint8_t* lsda, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_Action actions, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?uint64_t exceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct _Unwind_Exception* exceptionObject, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_Context_t context) { >>> + ? ?_Unwind_Reason_Code ret = _URC_CONTINUE_UNWIND; >>> + >>> + ? ?if (!lsda) >>> + ? ? ? ?return(ret); >>> + >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"handleLsda(...):lsda is non-zero.\n"); >>> +#endif >>> + >>> + ? ?// Get the current instruction pointer and offset it before next >>> + ? ?// instruction in the current frame which threw the exception. >>> + ? ?uintptr_t pc = _Unwind_GetIP(context)-1; >>> + >>> + ? ?// Get beginning current frame's code (as defined by the >>> + ? ?// emitted dwarf code) >>> + ? ?uintptr_t funcStart = _Unwind_GetRegionStart(context); >>> + ? ?uintptr_t pcOffset = pc - funcStart; >>> + ? ?struct OurExceptionType_t** classInfo = NULL; >>> + >>> + ? ?// Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding >>> + ? ?// ? ? ? dwarf emission >>> + >>> + ? ?// Parse LSDA header. >>> + ? ?uint8_t lpStartEncoding = *lsda++; >>> + >>> + ? ?if (lpStartEncoding != llvm::dwarf::DW_EH_PE_omit) { >>> + ? ? ? ?readEncodedPointer(&lsda, lpStartEncoding); >>> + ? ?} >>> + >>> + ? ?uint8_t ttypeEncoding = *lsda++; >>> + ? ?uintptr_t classInfoOffset; >>> + >>> + ? ?if (ttypeEncoding != llvm::dwarf::DW_EH_PE_omit) { >>> + ? ? ? ?// Calculate type info locations in emitted dwarf code which >>> + ? ? ? ?// were flagged by type info arguments to llvm.eh.selector >>> + ? ? ? ?// intrinsic >>> + ? ? ? ?classInfoOffset = readULEB128(&lsda); >>> + ? ? ? ?classInfo = (struct OurExceptionType_t**) (lsda + classInfoOffset); >>> + ? ?} >>> + >>> + ? ?// Walk call-site table looking for range that >>> + ? ?// includes current PC. >>> + >>> + ? ?uint8_t ? ? ? ? callSiteEncoding = *lsda++; >>> + ? ?uint32_t ? ? ? ?callSiteTableLength = readULEB128(&lsda); >>> + ? ?const uint8_t* ?callSiteTableStart = lsda; >>> + ? ?const uint8_t* ?callSiteTableEnd = callSiteTableStart + >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteTableLength; >>> + ? ?const uint8_t* ?actionTableStart = callSiteTableEnd; >>> + ? ?const uint8_t* ?callSitePtr = callSiteTableStart; >>> + >>> + ? ?bool foreignException = false; >>> + >>> + ? ?while (callSitePtr < callSiteTableEnd) { >>> + ? ? ? ?uintptr_t start = readEncodedPointer(&callSitePtr, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? callSiteEncoding); >>> + ? ? ? ?uintptr_t length = readEncodedPointer(&callSitePtr, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteEncoding); >>> + ? ? ? ?uintptr_t landingPad = readEncodedPointer(&callSitePtr, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?callSiteEncoding); >>> + >>> + ? ? ? ?// Note: Action value >>> + ? ? ? ?uintptr_t actionEntry = readULEB128(&callSitePtr); >>> + >>> + ? ? ? ?if (exceptionClass != ourBaseExceptionClass) { >>> + ? ? ? ? ? ?// We have been notified of a foreign exception being thrown, >>> + ? ? ? ? ? ?// and we therefore need to execute cleanup landing pads >>> + ? ? ? ? ? ?actionEntry = 0; >>> + ? ? ? ? ? ?foreignException = true; >>> + ? ? ? ?} >>> + >>> + ? ? ? ?if (landingPad == 0) { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ?"handleLsda(...): No landing pad found.\n"); >>> +#endif >>> + >>> + ? ? ? ? ? ?continue; // no landing pad for this entry >>> + ? ? ? ?} >>> + >>> + ? ? ? ?if (actionEntry) { >>> + ? ? ? ? ? ?actionEntry += ((uintptr_t) actionTableStart) - 1; >>> + ? ? ? ?} >>> + ? ? ? ?else { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ?"handleLsda(...):No action table found.\n"); >>> +#endif >>> + ? ? ? ?} >>> + >>> + ? ? ? ?bool exceptionMatched = false; >>> + >>> + ? ? ? ?if ((start <= pcOffset) && (pcOffset < (start + length))) { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ?"handleLsda(...): Landing pad found.\n"); >>> +#endif >>> + ? ? ? ? ? ?int64_t actionValue = 0; >>> + >>> + ? ? ? ? ? ?if (actionEntry) { >>> + ? ? ? ? ? ? ? ?exceptionMatched = handleActionValue >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ( >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &actionValue, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? classInfo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? actionEntry, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionObject >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ); >>> + ? ? ? ? ? ?} >>> + >>> + ? ? ? ? ? ?if (!(actions & _UA_SEARCH_PHASE)) { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): installed landing pad " >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?"context.\n"); >>> +#endif >>> + >>> + ? ? ? ? ? ? ? ?// Found landing pad for the PC. >>> + ? ? ? ? ? ? ? ?// Set Instruction Pointer to so we re-enter function >>> + ? ? ? ? ? ? ? ?// at landing pad. The landing pad is created by the >>> + ? ? ? ? ? ? ? ?// compiler to take two parameters in registers. >>> + ? ? ? ? ? ? ? ?_Unwind_SetGR(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(0), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(uintptr_t)exceptionObject); >>> + >>> + ? ? ? ? ? ? ? ?// Note: this virtual register directly corresponds >>> + ? ? ? ? ? ? ? ?// ? ? ? to the return of the llvm.eh.selector intrinsic >>> + ? ? ? ? ? ? ? ?if (!actionEntry || !exceptionMatched) { >>> + ? ? ? ? ? ? ? ? ? ?// We indicate cleanup only >>> + ? ? ? ? ? ? ? ? ? ?_Unwind_SetGR(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(1), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0); >>> + ? ? ? ? ? ? ? ?} >>> + ? ? ? ? ? ? ? ?else { >>> + ? ? ? ? ? ? ? ? ? ?// Matched type info index of llvm.eh.selector intrinsic >>> + ? ? ? ? ? ? ? ? ? ?// passed here. >>> + ? ? ? ? ? ? ? ? ? ?_Unwind_SetGR(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__builtin_eh_return_data_regno(1), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?actionValue); >>> + ? ? ? ? ? ? ? ?} >>> + >>> + ? ? ? ? ? ? ? ?// To execute landing pad set here >>> + ? ? ? ? ? ? ? ?_Unwind_SetIP(context, funcStart + landingPad); >>> + ? ? ? ? ? ? ? ?ret = _URC_INSTALL_CONTEXT; >>> + ? ? ? ? ? ?} >>> + ? ? ? ? ? ?else if (exceptionMatched) { >>> +#ifdef DEBUG >>> + ? ? ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): setting handler found.\n"); >>> +#endif >>> + ? ? ? ? ? ? ? ?ret = _URC_HANDLER_FOUND; >>> + ? ? ? ? ? ?} >>> + ? ? ? ? ? ?else { >>> + ? ? ? ? ? ? ? ?// Note: Only non-clean up handlers are marked as >>> + ? ? ? ? ? ? ? ?// ? ? ? found. Otherwise the clean up handlers will be >>> + ? ? ? ? ? ? ? ?// ? ? ? re-found and executed during the clean up >>> + ? ? ? ? ? ? ? ?// ? ? ? phase. >>> +#ifdef DEBUG >>> + ? ? ? ? ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"handleLsda(...): cleanup handler found.\n"); >>> +#endif >>> + ? ? ? ? ? ?} >>> + >>> + ? ? ? ? ? ?break; >>> + ? ? ? ?} >>> + ? ?} >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// This is the personality function which is embedded (dwarf emitted), in the >>> +/// dwarf unwind info block. Again see: JITDwarfEmitter.cpp. >>> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >>> +/// @param version unsupported (ignored), unwind version >>> +/// @param _Unwind_Action actions minimally supported unwind stage >>> +/// ? ? ? ?(forced specifically not supported) >>> +/// @param exceptionClass exception class (_Unwind_Exception::exception_class) >>> +/// ? ? ? ?of thrown exception. >>> +/// @param exceptionObject thrown _Unwind_Exception instance. >>> +/// @param context unwind system context >>> +/// @returns minimally supported unwinding control indicator >>> +_Unwind_Reason_Code ourPersonality(int version, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _Unwind_Action actions, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint64_t exceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct _Unwind_Exception* exceptionObject, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _Unwind_Context_t context) { >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"We are in ourPersonality(...):actions is <%d>.\n", >>> + ? ? ? ? ? ?actions); >>> + >>> + ? ?if (actions & _UA_SEARCH_PHASE) { >>> + ? ? ? ?fprintf(stderr, "ourPersonality(...):In search phase.\n"); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?fprintf(stderr, "ourPersonality(...):In non-search phase.\n"); >>> + ? ?} >>> +#endif >>> + >>> + ? ?const uint8_t* lsda = (uint8_t*) >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?_Unwind_GetLanguageSpecificData(context); >>> + >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"ourPersonality(...):lsda = <%p>.\n", >>> + ? ? ? ? ? ?lsda); >>> +#endif >>> + >>> + ? ?// The real work of the personality function is captured here >>> + ? ?return(handleLsda(version, >>> + ? ? ? ? ? ? ? ? ? ? ?lsda, >>> + ? ? ? ? ? ? ? ? ? ? ?actions, >>> + ? ? ? ? ? ? ? ? ? ? ?exceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ?exceptionObject, >>> + ? ? ? ? ? ? ? ? ? ? ?context)); >>> +} >>> + >>> + >>> +/// Generates our _Unwind_Exception class from a given character array. >>> +/// thereby handling arbitrary lengths (not in standard), and handling >>> +/// embedded \0s. >>> +/// See @link http://refspecs.freestandards.org/abi-eh-1.21.html @unlink >>> +/// @param classChars char array to encode. NULL values not checkedf >>> +/// @param classCharsSize number of chars in classChars. Value is not checked. >>> +/// @returns class value >>> +uint64_t genClass(const unsigned char classChars[], size_t classCharsSize) >>> +{ >>> + ? ?uint64_t ret = classChars[0]; >>> + >>> + ? ?for (unsigned i = 1; i < classCharsSize; ++i) { >>> + ? ? ? ?ret <<= 8; >>> + ? ? ? ?ret += classChars[i]; >>> + ? ?} >>> + >>> + ? ?return(ret); >>> +} >>> + >>> +} // extern "C" >>> + >>> +// >>> +// Runtime C Library functions End >>> +// >>> + >>> +// >>> +// Code generation functions >>> +// >>> + >>> +/// Generates code to print given constant string >>> +/// @param context llvm context >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param toPrint string to print >>> +/// @param useGlobal A value of true (default) indicates a GlobalValue is >>> +/// ? ? ? ?generated, and is used to hold the constant string. A value of >>> +/// ? ? ? ?false indicates that the constant string will be stored on the >>> +/// ? ? ? ?stack. >>> +void generateStringPrint(llvm::LLVMContext& context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? std::string toPrint, >>> + ? ? ? ? ? ? ? ? ? ? ? ? bool useGlobal = true) { >>> + ? ?llvm::Function *printFunct = module.getFunction("printStr"); >>> + >>> + ? ?llvm::Value *stringVar; >>> + ? ?llvm::Constant* stringConstant = >>> + ? ? ? ?llvm::ConstantArray::get(context, toPrint); >>> + >>> + ? ?if (useGlobal) { >>> + ? ? ? ?// Note: Does not work without allocation >>> + ? ? ? ?stringVar = >>> + ? ? ? ? ? ?new llvm::GlobalVariable(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant->getType(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkerPrivateLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ""); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?stringVar = builder.CreateAlloca(stringConstant->getType()); >>> + ? ? ? ?builder.CreateStore(stringConstant, stringVar); >>> + ? ?} >>> + >>> + ? ?llvm::Value* cast = >>> + ? ? ? ?builder.CreatePointerCast(stringVar, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); >>> + ? ?builder.CreateCall(printFunct, cast); >>> +} >>> + >>> + >>> +/// Generates code to print given runtime integer according to constant >>> +/// string format, and a given print function. >>> +/// @param context llvm context >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param printFunct function used to "print" integer >>> +/// @param toPrint string to print >>> +/// @param format printf like formating string for print >>> +/// @param useGlobal A value of true (default) indicates a GlobalValue is >>> +/// ? ? ? ?generated, and is used to hold the constant string. A value of >>> +/// ? ? ? ?false indicates that the constant string will be stored on the >>> +/// ? ? ? ?stack. >>> +void generateIntegerPrint(llvm::LLVMContext& context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Function& printFunct, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Value& toPrint, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?std::string format, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?bool useGlobal = true) { >>> + ? ?llvm::Constant *stringConstant = llvm::ConstantArray::get(context, format); >>> + ? ?llvm::Value *stringVar; >>> + >>> + ? ?if (useGlobal) { >>> + ? ? ? ?// Note: Does not seem to work without allocation >>> + ? ? ? ?stringVar = >>> + ? ? ? ? ? ?new llvm::GlobalVariable(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant->getType(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?true, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::LinkerPrivateLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stringConstant, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ""); >>> + ? ?} >>> + ? ?else { >>> + ? ? ? ?stringVar = builder.CreateAlloca(stringConstant->getType()); >>> + ? ? ? ?builder.CreateStore(stringConstant, stringVar); >>> + ? ?} >>> + >>> + ? ?llvm::Value* cast = >>> + ? ? ? ?builder.CreateBitCast(stringVar, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); >>> + ? ?builder.CreateCall2(&printFunct, &toPrint, cast); >>> +} >>> + >>> + >>> +/// Generates code to handle finally block type semantics: always runs >>> +/// regardless of whether a thrown exception is passing through or the >>> +/// parent function is simply exiting. In addition to printing some state >>> +/// to stderr, this code will resume the exception handling--runs the >>> +/// unwind resume block, if the exception has not been previously caught >>> +/// by a catch clause, and will otherwise execute the end block (terminator >>> +/// block). In addition this function creates the corresponding function's >>> +/// stack storage for the exception pointer and catch flag status. >>> +/// @param context llvm context >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param toAddTo parent function to add block to >>> +/// @param blockName block name of new "finally" block. >>> +/// @param functionId output id used for printing >>> +/// @param terminatorBlock terminator "end" block >>> +/// @param unwindResumeBlock unwind resume block >>> +/// @param exceptionCaughtFlag reference exception caught/thrown status storage >>> +/// @param exceptionStorage reference to exception pointer storage >>> +/// @returns newly created block >>> +static llvm::BasicBlock* createFinallyBlock(llvm::LLVMContext& context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function& toAddTo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string& blockName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string& functionId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::BasicBlock& terminatorBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::BasicBlock& unwindResumeBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Value** exceptionCaughtFlag, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Value** exceptionStorage) { >>> + ? ?assert(exceptionCaughtFlag && >>> + ? ? ? ? ? "ExceptionDemo::createFinallyBlock(...):exceptionCaughtFlag " >>> + ? ? ? ? ? ? ? "is NULL"); >>> + ? ?assert(exceptionStorage && >>> + ? ? ? ? ? "ExceptionDemo::createFinallyBlock(...):exceptionStorage " >>> + ? ? ? ? ? ? ? "is NULL"); >>> + >>> + ? ?*exceptionCaughtFlag = >>> + ? ? ? ?createEntryBlockAlloca(toAddTo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "exceptionCaught", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourExceptionNotThrownState->getType(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourExceptionNotThrownState); >>> + >>> + ? ?const llvm::PointerType* exceptionStorageType = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo(); >>> + ? ?*exceptionStorage = >>> + ? ? ? ?createEntryBlockAlloca(toAddTo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "exceptionStorage", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionStorageType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::ConstantPointerNull::get( >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? exceptionStorageType)); >>> + >>> + ? ?llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? blockName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &toAddTo); >>> + >>> + ? ?builder.SetInsertPoint(ret); >>> + >>> + ? ?std::ostringstream bufferToPrint; >>> + ? ?bufferToPrint << "Gen: Executing finally block " >>> + ? ? ? ? ? ? ? ? ?<< blockName >>> + ? ? ? ? ? ? ? ? ?<< " in " >>> + ? ? ? ? ? ? ? ? ?<< functionId >>> + ? ? ? ? ? ? ? ? ?<< std::endl; >>> + ? ?generateStringPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ?bufferToPrint.str(), >>> + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); >>> + >>> + ? ?llvm::SwitchInst* theSwitch = >>> + ? ? ? ?builder.CreateSwitch(builder.CreateLoad(*exceptionCaughtFlag), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? &terminatorBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2); >>> + ? ?theSwitch->addCase(ourExceptionCaughtState, &terminatorBlock); >>> + ? ?theSwitch->addCase(ourExceptionThrownState, &unwindResumeBlock); >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// Generates catch block semantics which print a string to indicate type of >>> +/// catch executed, sets an exception caught flag, and executes passed in >>> +/// end block (terminator block). >>> +/// @param context llvm context >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param toAddTo parent function to add block to >>> +/// @param blockName block name of new "catch" block. >>> +/// @param functionId output id used for printing >>> +/// @param terminatorBlock terminator "end" block >>> +/// @param exceptionCaughtFlag exception caught/thrown status >>> +/// @returns newly created block >>> +static llvm::BasicBlock* createCatchBlock(llvm::LLVMContext& context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Function& toAddTo, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string& blockName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string& functionId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock& terminatorBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Value& exceptionCaughtFlag) { >>> + >>> + ? ?llvm::BasicBlock *ret = llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? blockName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &toAddTo); >>> + >>> + ? ?builder.SetInsertPoint(ret); >>> + >>> + ? ?std::ostringstream bufferToPrint; >>> + ? ?bufferToPrint << "Gen: Executing catch block " >>> + ? ? ? ? ? ? ? ? ?<< blockName >>> + ? ? ? ? ? ? ? ? ?<< " in " >>> + ? ? ? ? ? ? ? ? ?<< functionId >>> + ? ? ? ? ? ? ? ? ?<< std::endl; >>> + ? ?generateStringPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ?bufferToPrint.str(), >>> + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); >>> + ? ?builder.CreateStore(ourExceptionCaughtState, &exceptionCaughtFlag); >>> + ? ?builder.CreateBr(&terminatorBlock); >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// Generates a function which invokes a function (toInvoke) and, whose >>> +/// unwind block will "catch" the type info types correspondingly held in the >>> +/// exceptionTypesToCatch argument. If the toInvoke function throws an >>> +/// exception which does not match any type info types contained in >>> +/// exceptionTypesToCatch, the generated code will call _Unwind_Resume >>> +/// with the raised exception. On the other hand the generated code will >>> +/// normally exit if the toInvoke function does not throw an exception. >>> +/// The generated "finally" block is always run regardless of the cause of >>> +/// the generated function exit. >>> +/// The generated function is returned after being verified. >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param fpm a function pass manager holding optional IR to IR >>> +/// ? ? ? ?transformations >>> +/// @param toInvoke inner function to invoke >>> +/// @param ourId id used to printing purposes >>> +/// @param numExceptionsToCatch length of exceptionTypesToCatch array >>> +/// @param exceptionTypesToCatch array of type info types to "catch" >>> +/// @returns generated function >>> +static >>> +llvm::Function* createCatchWrappedInvokeFunction(llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ?llvm::FunctionPassManager& fpm, >>> + ? ? ? ? ? ? ? ? ? ?llvm::Function& toInvoke, >>> + ? ? ? ? ? ? ? ? ? ?std::string ourId, >>> + ? ? ? ? ? ? ? ? ? ?unsigned numExceptionsToCatch, >>> + ? ? ? ? ? ? ? ? ? ?unsigned exceptionTypesToCatch[]) { >>> + >>> + ? ?llvm::LLVMContext& context = module.getContext(); >>> + ? ?llvm::Function *toPrint32Int = module.getFunction("print32Int"); >>> + >>> + ? ?ArgTypes argTypes; >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + >>> + ? ?ArgNames argNames; >>> + ? ?argNames.push_back("exceptTypeToThrow"); >>> + >>> + ? ?llvm::Function* ret = createFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getVoidTy(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// Block which calls invoke >>> + ? ?llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"entry", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ret); >>> + ? ?// Normal block for invoke >>> + ? ?llvm::BasicBlock *normalBlock = llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "normal", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); >>> + ? ?// Unwind block for invoke >>> + ? ?llvm::BasicBlock *exceptionBlock = >>> + ? ? ? ?llvm::BasicBlock::Create(context, "exception", ret); >>> + >>> + ? ?// Block which routes exception to correct catch handler block >>> + ? ?llvm::BasicBlock *exceptionRouteBlock = >>> + ? ? ? ?llvm::BasicBlock::Create(context, "exceptionRoute", ret); >>> + >>> + ? ?// Foreign exception handler >>> + ? ?llvm::BasicBlock *externalExceptionBlock = >>> + ? ? ? ?llvm::BasicBlock::Create(context, "externalException", ret); >>> + >>> + ? ?// Block which calls _Unwind_Resume >>> + ? ?llvm::BasicBlock *unwindResumeBlock = >>> + ? ? ? ?llvm::BasicBlock::Create(context, "unwindResume", ret); >>> + >>> + ? ?// Clean up block which delete exception if needed >>> + ? ?llvm::BasicBlock *endBlock = >>> + ? ? ? ?llvm::BasicBlock::Create(context, "end", ret); >>> + >>> + ? ?std::string nextName; >>> + ? ?std::vector catchBlocks(numExceptionsToCatch); >>> + ? ?llvm::Value* exceptionCaughtFlag = NULL; >>> + ? ?llvm::Value* exceptionStorage = NULL; >>> + >>> + ? ?// Finally block which will branch to unwindResumeBlock if >>> + ? ?// exception is not caught. Initializes/allocates stack locations. >>> + ? ?llvm::BasicBlock* finallyBlock = createFinallyBlock(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*ret, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nextName = "finally", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*endBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*unwindResumeBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&exceptionCaughtFlag, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&exceptionStorage); >>> + >>> + ? ?for (unsigned i = 0; i < numExceptionsToCatch; ++i) { >>> + ? ? ? ?nextName = ourTypeInfoNames[exceptionTypesToCatch[i]]; >>> + >>> + ? ? ? ?// One catch block per type info to be caught >>> + ? ? ? ?catchBlocks[i] = createCatchBlock(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*ret, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nextName, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*finallyBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*exceptionCaughtFlag); >>> + ? ?} >>> + >>> + ? ?// Entry Block >>> + >>> + ? ?builder.SetInsertPoint(entryBlock); >>> + >>> + ? ?std::vector args; >>> + ? ?args.push_back(namedValues["exceptTypeToThrow"]); >>> + ? ?builder.CreateInvoke(&toInvoke, >>> + ? ? ? ? ? ? ? ? ? ? ? ? normalBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? exceptionBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? args.begin(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? args.end()); >>> + >>> + ? ?// End Block >>> + >>> + ? ?builder.SetInsertPoint(endBlock); >>> + >>> + ? ?generateStringPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: In end block: exiting in " + ourId + ".\n", >>> + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); >>> + ? ?llvm::Function *deleteOurException = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?module.getFunction("deleteOurException"); >>> + >>> + ? ?// Note: function handles NULL exceptions >>> + ? ?builder.CreateCall(deleteOurException, >>> + ? ? ? ? ? ? ? ? ? ? ? builder.CreateLoad(exceptionStorage)); >>> + ? ?builder.CreateRetVoid(); >>> + >>> + ? ?// Normal Block >>> + >>> + ? ?builder.SetInsertPoint(normalBlock); >>> + >>> + ? ?generateStringPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: No exception in " + ourId + "!\n", >>> + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); >>> + >>> + ? ?// Finally block is always called >>> + ? ?builder.CreateBr(finallyBlock); >>> + >>> + ? ?// Unwind Resume Block >>> + >>> + ? ?builder.SetInsertPoint(unwindResumeBlock); >>> + >>> + ? ?llvm::Function *resumeOurException = >>> + ? ? ? ? ? ? ? ?module.getFunction("_Unwind_Resume"); >>> + ? ?builder.CreateCall(resumeOurException, >>> + ? ? ? ? ? ? ? ? ? ? ? builder.CreateLoad(exceptionStorage)); >>> + ? ?builder.CreateUnreachable(); >>> + >>> + ? ?// Exception Block >>> + >>> + ? ?builder.SetInsertPoint(exceptionBlock); >>> + >>> + ? ?llvm::Function *ehException = module.getFunction("llvm.eh.exception"); >>> + >>> + ? ?// Retrieve thrown exception >>> + ? ?llvm::Value* unwindException = builder.CreateCall(ehException); >>> + >>> + ? ?// Store exception and flag >>> + ? ?builder.CreateStore(unwindException, exceptionStorage); >>> + ? ?builder.CreateStore(ourExceptionThrownState, exceptionCaughtFlag); >>> + ? ?llvm::Function *personality = module.getFunction("ourPersonality"); >>> + ? ?llvm::Value* functPtr = >>> + ? ? ? ?builder.CreatePointerCast(personality, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?args.clear(); >>> + ? ?args.push_back(unwindException); >>> + ? ?args.push_back(functPtr); >>> + >>> + ? ?// Note: Skipping index 0 >>> + ? ?for (unsigned i = 0; i < numExceptionsToCatch; ++i) { >>> + ? ? ? ?// Set up type infos to be caught >>> + ? ? ? ?args.push_back( >>> + ? ? ? ? ? ?module.getGlobalVariable( >>> + ? ? ? ? ? ? ? ?ourTypeInfoNames[exceptionTypesToCatch[i]])); >>> + ? ?} >>> + >>> + ? ?args.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), 0)); >>> + >>> + ? ?llvm::Function *ehSelector = module.getFunction("llvm.eh.selector"); >>> + >>> + ? ?// Set up this exeption block as the landing pad which will handle >>> + ? ?// given type infos. See case Intrinsic::eh_selector in >>> + ? ?// SelectionDAGBuilder::visitIntrinsicCall(...) and AddCatchInfo(...) >>> + ? ?// implemented in FunctionLoweringInfo.cpp to see how the implementation >>> + ? ?// handles this call. This landing pad (this exception block), will be >>> + ? ?// called either because it nees to cleanup (call finally) or a type >>> + ? ?// info was found which matched the thrown exception. >>> + ? ?llvm::Value* retTypeInfoIndex = builder.CreateCall(ehSelector, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? args.begin(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? args.end()); >>> + >>> + ? ?// Retrieve exception_class member from thrown exception >>> + ? ?// (_Unwind_Exception instance). This member tells us whether or not >>> + ? ?// the exception is foreign. >>> + ? ?llvm::Value* unwindExceptionClass = >>> + ? ? ? ?builder.CreateLoad( >>> + ? ? ? ? ? ?builder.CreateStructGEP( >>> + ? ? ? ? ? ? ? ?builder.CreatePointerCast( >>> + ? ? ? ? ? ? ? ? ? ?unwindException, >>> + ? ? ? ? ? ? ? ? ? ?ourUnwindExceptionType->getPointerTo()), >>> + ? ? ? ? ? ? ? ?0)); >>> + >>> + ? ?// Branch to the externalExceptionBlock if the exception is foreign or >>> + ? ?// to a catch router if not. Either way the finally block will be run. >>> + ? ?builder.CreateCondBr( >>> + ? ? ? ?builder.CreateICmpEQ(unwindExceptionClass, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::ConstantInt::get(builder.getInt64Ty(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ourBaseExceptionClass)), >>> + ? ? ? ?exceptionRouteBlock, >>> + ? ? ? ?externalExceptionBlock); >>> + >>> + ? ?// External Exception Block >>> + >>> + ? ?builder.SetInsertPoint(externalExceptionBlock); >>> + >>> + ? ?generateStringPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ?module, >>> + ? ? ? ? ? ? ? ? ? ? ? ?builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ?"Gen: Foreign exception received.\n", >>> + ? ? ? ? ? ? ? ? ? ? ? ?USE_GLOBAL_STR_CONSTS); >>> + >>> + ? ?// Branch to the finally block >>> + ? ?builder.CreateBr(finallyBlock); >>> + >>> + ? ?// Exception Route Block >>> + >>> + ? ?builder.SetInsertPoint(exceptionRouteBlock); >>> + >>> + ? ?// Casts exception pointer (_Unwind_Exception instance) to parent >>> + ? ?// (OurException instance). >>> + ? ?// >>> + ? ?// Note: ourBaseFromUnwindOffset is usually negative >>> + ? ?llvm::Value* typeInfoThrown = >>> + ? ? ? ?builder.CreatePointerCast( >>> + ? ? ? ? ? ?builder.CreateConstGEP1_64(unwindException, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourBaseFromUnwindOffset), >>> + ? ? ? ? ? ?ourExceptionType->getPointerTo()); >>> + >>> + ? ?// Retrieve thrown exception type info type >>> + ? ?// >>> + ? ?// Note: Index is not relative to pointer but instead to structure >>> + ? ?// ? ? ? unlike a true getelementptr (GEP) instruction >>> + ? ?typeInfoThrown = builder.CreateStructGEP(typeInfoThrown, 0); >>> + >>> + ? ?llvm::Value* typeInfoThrownType = >>> + ? ? ? ? ? ? ? ? ? ? builder.CreateStructGEP(typeInfoThrown, 0); >>> + >>> + ? ?generateIntegerPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? *toPrint32Int, >>> + ? ? ? ? ? ? ? ? ? ? ? ? *(builder.CreateLoad(typeInfoThrownType)), >>> + ? ? ? ? ? ? ? ? ? ? ? ? "Gen: Exception type <%d> received (stack unwound) " >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " in " + >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId + >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ".\n", >>> + ? ? ? ? ? ? ? ? ? ? ? ? USE_GLOBAL_STR_CONSTS); >>> + >>> + ? ?// Route to matched type info catch block or run cleanup finally block >>> + ? ?llvm::SwitchInst* switchToCatchBlock = >>> + ? ? ? ?builder.CreateSwitch(retTypeInfoIndex, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? finallyBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionsToCatch); >>> + >>> + ? ?unsigned nextTypeToCatch; >>> + >>> + ? ?for (unsigned i = 1; i <= numExceptionsToCatch; ++i) { >>> + ? ? ? ?nextTypeToCatch = i - 1; >>> + ? ? ? ?switchToCatchBlock->addCase(llvm::ConstantInt::get( >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::Type::getInt32Ty(context), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?i), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?catchBlocks[nextTypeToCatch]); >>> + ? ?} >>> + >>> + ? ?llvm::verifyFunction(*ret); >>> + ? ?fpm.run(*ret); >>> + >>> + ? ?return(ret); >>> +} >>> + >>> + >>> +/// Generates function which throws either an exception matched to a runtime >>> +/// determined type info type (argument to generated function), or if this >>> +/// runtime value matches nativeThrowType, throws a foreign exception by >>> +/// calling nativeThrowFunct. >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param fpm a function pass manager holding optional IR to IR >>> +/// ? ? ? ?transformations >>> +/// @param ourId id used to printing purposes >>> +/// @param nativeThrowType a runtime argument of this value results in >>> +/// ? ? ? ?nativeThrowFunct being called to generate/throw exception. >>> +/// @param nativeThrowFunct function which will throw a foreign exception >>> +/// ? ? ? ?if the above nativeThrowType matches generated function's arg. >>> +/// @returns generated function >>> +static >>> +llvm::Function* createThrowExceptionFunction(llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::FunctionPassManager& fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? std::string ourId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int32_t nativeThrowType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function& nativeThrowFunct) { >>> + ? ?llvm::LLVMContext& context = module.getContext(); >>> + ? ?namedValues.clear(); >>> + ? ?ArgTypes unwindArgTypes; >>> + ? ?unwindArgTypes.push_back(builder.getInt32Ty()); >>> + ? ?ArgNames unwindArgNames; >>> + ? ?unwindArgNames.push_back("exceptTypeToThrow"); >>> + >>> + ? ?llvm::Function *ret = createFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getVoidTy(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unwindArgTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unwindArgNames, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// Throws either one of our exception or a native C++ exception depending >>> + ? ?// on a runtime argument value containing a type info type. >>> + ? ?llvm::BasicBlock *entryBlock = llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"entry", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ret); >>> + ? ?// Throws a foreign exception >>> + ? ?llvm::BasicBlock *nativeThrowBlock = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "nativeThrow", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); >>> + ? ?// Throws one of our Exceptions >>> + ? ?llvm::BasicBlock *generatedThrowBlock = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::BasicBlock::Create(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "generatedThrow", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret); >>> + ? ?// Retrieved runtime type info type to throw >>> + ? ?llvm::Value* exceptionType = namedValues["exceptTypeToThrow"]; >>> + >>> + ? ?// nativeThrowBlock block >>> + >>> + ? ?builder.SetInsertPoint(nativeThrowBlock); >>> + >>> + ? ?// Throws foreign exception >>> + ? ?builder.CreateCall(&nativeThrowFunct, exceptionType); >>> + ? ?builder.CreateUnreachable(); >>> + >>> + ? ?// entry block >>> + >>> + ? ?builder.SetInsertPoint(entryBlock); >>> + >>> + ? ?llvm::Function *toPrint32Int = module.getFunction("print32Int"); >>> + ? ?generateIntegerPrint(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? *toPrint32Int, >>> + ? ? ? ? ? ? ? ? ? ? ? ? *exceptionType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? "\nGen: About to throw exception type <%d> in " + >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourId + >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ".\n", >>> + ? ? ? ? ? ? ? ? ? ? ? ? USE_GLOBAL_STR_CONSTS); >>> + >>> + ? ?// Switches on runtime type info type value to determine whether or not >>> + ? ?// a foreign exception is thrown. Defaults to throwing one of our >>> + ? ?// generated exceptions. >>> + ? ?llvm::SwitchInst* theSwitch = builder.CreateSwitch(exceptionType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? generatedThrowBlock, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1); >>> + >>> + ? ?theSwitch->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nativeThrowType), >>> + ? ? ? ? ? ? ? ? ? ? ? nativeThrowBlock); >>> + >>> + ? ?// generatedThrow block >>> + >>> + ? ?builder.SetInsertPoint(generatedThrowBlock); >>> + >>> + ? ?llvm::Function *createOurException = >>> + ? ? ? ? ? ? ? ?module.getFunction("createOurException"); >>> + ? ?llvm::Function *raiseOurException = >>> + ? ? ? ? ? ? ? ?module.getFunction("_Unwind_RaiseException"); >>> + >>> + ? ?// Creates exception to throw with runtime type info type. >>> + ? ?llvm::Value* exception = >>> + ? ? ? ?builder.CreateCall(createOurException, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? namedValues["exceptTypeToThrow"]); >>> + >>> + ? ?// Throw generated Exception >>> + ? ?builder.CreateCall(raiseOurException, exception); >>> + ? ?builder.CreateUnreachable(); >>> + >>> + ? ?llvm::verifyFunction(*ret); >>> + ? ?fpm.run(*ret); >>> + >>> + ? ?return(ret); >>> +} >>> + >>> +static void createStandardUtilityFunctions(unsigned numTypeInfos, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder); >>> + >>> +/// Creates test code by generating and organizing these functions into the >>> +/// test case. The test case consists of an outer function setup to invoke >>> +/// an inner function within an environment having multiple catch and single >>> +/// finally blocks. This inner function is also setup to invoke a throw >>> +/// function within an evironment similar in nature to the outer function's >>> +/// catch and finally blocks. Each of these two functions catch mutually >>> +/// exclusive subsets (even or odd) of the type info types configured >>> +/// for this this. All generated functions have a runtime argument which >>> +/// holds a type info type to throw that each function takes and passes it >>> +/// to the inner one if such a inner function exists. This type info type is >>> +/// looked at by the generated throw function to see whether or not it should >>> +/// throw a generated exception with the same type info type, or instead call >>> +/// a supplied a function which in turn will throw a foreign exception. >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +/// @param fpm a function pass manager holding optional IR to IR >>> +/// ? ? ? ?transformations >>> +/// @param nativeThrowFunctName name of external function which will throw >>> +/// ? ? ? ?a foreign exception >>> +/// @returns outermost generated test function. >>> +llvm::Function* createUnwindExceptionTest(llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::IRBuilder<>& builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?llvm::FunctionPassManager& fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?std::string nativeThrowFunctName) { >>> + ? ?// Number of type infos to generate >>> + ? ?unsigned numTypeInfos = 6; >>> + >>> + ? ?// Initialze intrisics and external functions to use along with exception >>> + ? ?// and type info globals. >>> + ? ?createStandardUtilityFunctions(numTypeInfos, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder); >>> + ? ?llvm::Function *nativeThrowFunct = >>> + ? ? ? ?module.getFunction(nativeThrowFunctName); >>> + >>> + ? ?// Create exception throw function using the value ~0 to cause >>> + ? ?// foreign exceptions to be thrown. >>> + ? ?llvm::Function* throwFunct = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?createThrowExceptionFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "throwFunct", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ~0, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *nativeThrowFunct); >>> + ? ?// Inner function will catch even type infos >>> + ? ?unsigned innerExceptionTypesToCatch[] = {6, 2, 4}; >>> + ? ?size_t numExceptionTypesToCatch = sizeof(innerExceptionTypesToCatch) / >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sizeof(unsigned); >>> + >>> + ? ?// Generate inner function. >>> + ? ?llvm::Function* innerCatchFunct = >>> + ? ? ? ?createCatchWrappedInvokeFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *throwFunct, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "innerCatchFunct", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionTypesToCatch, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? innerExceptionTypesToCatch); >>> + >>> + ? ?// Outer function will catch odd type infos >>> + ? ?unsigned outerExceptionTypesToCatch[] = {3, 1, 5}; >>> + ? ?numExceptionTypesToCatch = sizeof(outerExceptionTypesToCatch) / >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sizeof(unsigned); >>> + >>> + ? ?// Generate outer function >>> + ? ?llvm::Function* outerCatchFunct = >>> + ? ? ? ?createCatchWrappedInvokeFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *innerCatchFunct, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "outerCatchFunct", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? numExceptionTypesToCatch, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? outerExceptionTypesToCatch); >>> + >>> + ? ?// Return outer function to run >>> + ? ?return(outerCatchFunct); >>> +} >>> + >>> + >>> +/// Represents our foreign exceptions >>> +class OurCppRunException : public std::runtime_error { >>> +public: >>> + ? ?OurCppRunException(const std::string reason) : >>> + ? ? ? ?std::runtime_error(reason) {} >>> + >>> + ? ?OurCppRunException (const OurCppRunException& toCopy) : >>> + ? ? ? ?std::runtime_error(toCopy) {} >>> + >>> + ? ?OurCppRunException& operator = (const OurCppRunException& toCopy) { >>> + ? ? ? ?return(reinterpret_cast( >>> + ? ? ? ? ? ? ? ? ? std::runtime_error::operator = (toCopy) >>> + ? ? ? ? ? ? ? )); >>> + ? ?} >>> + >>> + ? ?~OurCppRunException (void) throw () {}; >>> +}; >>> + >>> + >>> +/// Throws foreign C++ exception. >>> +/// @param ignoreIt unused parameter that allows function to match implied >>> +/// ? ? ? ?generated function contract. >>> +extern "C" >>> +void throwCppException (int32_t ignoreIt) { >>> + ? ?throw(OurCppRunException("thrown by throwCppException(...)")); >>> +} >>> + >>> +typedef void (*OurExceptionThrowFunctType) (int32_t typeToThrow); >>> + >>> +/// This is a test harness which runs test by executing generated >>> +/// function with a type info type to throw. Harness wraps the excecution >>> +/// of generated function in a C++ try catch clause. >>> +/// @param engine execution engine to use for executing generated function. >>> +/// ? ? ? ?This demo program expects this to be a JIT instance for demo >>> +/// ? ? ? ?purposes. >>> +/// @param function generated test function to run >>> +/// @param typeToThrow type info type of generated exception to throw, or >>> +/// ? ? ? ?indicator to cause foreign exception to be thrown. >>> +static >>> +void runExceptionThrow(llvm::ExecutionEngine* engine, >>> + ? ? ? ? ? ? ? ? ? ? ? llvm::Function* function, >>> + ? ? ? ? ? ? ? ? ? ? ? int32_t typeToThrow) { >>> + >>> + ? ?// Find test's function pointer >>> + ? ?OurExceptionThrowFunctType functPtr = >>> + ? ? ? ? ?reinterpret_cast( >>> + ? ? ? ? ? ? ?reinterpret_cast( >>> + ? ? ? ? ? ? ? ? ?engine->getPointerToFunction(function) >>> + ? ? ? ? ? ? ?) >>> + ? ? ? ? ?); >>> + >>> + ? ?try { >>> + ? ? ? ?// Run test >>> + ? ? ? ?(*functPtr)(typeToThrow); >>> + ? ?} >>> + ? ?catch (OurCppRunException exc) { >>> + ? ? ? ?// Catch foreign C++ exception >>> + ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ?"\nrunExceptionThrow(...):In C++ catch OurCppRunException " >>> + ? ? ? ? ? ? ? ? ? ?"with reason: %s.\n", >>> + ? ? ? ? ? ? ? ?exc.what()); >>> + ? ?} >>> + ? ?catch (...) { >>> + ? ? ? ?// Catch all exceptions including our generated ones. I'm not sure >>> + ? ? ? ?// why this latter functionality should work, as it seems that >>> + ? ? ? ?// our exceptions should be foreign to C++ (the _Unwind_Exception:: >>> + ? ? ? ?// exception_class should be different from the one used by C++), and >>> + ? ? ? ?// therefore C++ should ignore the generated exceptions. >>> + >>> + ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ?"\nrunExceptionThrow(...):In C++ catch all.\n"); >>> + ? ?} >>> +} >>> + >>> +// >>> +// End test functions >>> +// >>> + >>> +/// This initialization routine creates type info globals and >>> +/// adds external function declarations to module. >>> +/// @param numTypeInfos number of linear type info associated type info types >>> +/// ? ? ? ?to create as GlobalVariable instances, starting with the value 1. >>> +/// @param module code for module instance >>> +/// @param builder builder instance >>> +static void createStandardUtilityFunctions(unsigned numTypeInfos, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Module& module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::IRBuilder<>& builder) { >>> + >>> + ? ?llvm::LLVMContext& context = module.getContext(); >>> + >>> + ? ?// Exception initializations >>> + >>> + ? ?// Setup exception catch state >>> + ? ?ourExceptionNotThrownState = >>> + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 0), >>> + ? ?ourExceptionThrownState = >>> + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 1), >>> + ? ?ourExceptionCaughtState = >>> + ? ? ? ? ? ? ? ? ? ?llvm::ConstantInt::get(llvm::Type::getInt8Ty(context), 2), >>> + >>> + >>> + ? ?// Create our type info type >>> + ? ?ourTypeInfoType = llvm::StructType::get(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?builder.getInt32Ty(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?NULL); >>> + >>> + ? ?// Create OurException type >>> + ? ?ourExceptionType = llvm::StructType::get(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourTypeInfoType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NULL); >>> + >>> + ? ?// Create portion of _Unwind_Exception type >>> + ? ?// >>> + ? ?// Note: Declaring only a portion of the _Unwind_Exception struct. >>> + ? ?// ? ? ? Does this cause problems? >>> + ? ?ourUnwindExceptionType = llvm::StructType::get(context, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? builder.getInt64Ty(), >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NULL); >>> + ? ?struct OurBaseException_t dummyException; >>> + >>> + ? ?// Calculate offset of OurException::unwindException member. >>> + ? ?ourBaseFromUnwindOffset = ((uintptr_t) &dummyException) - >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ((uintptr_t) &(dummyException.unwindException)); >>> + >>> +#ifdef DEBUG >>> + ? ?fprintf(stderr, >>> + ? ? ? ? ? ?"createStandardUtilityFunctions(...):ourBaseFromUnwindOffset " >>> + ? ? ? ? ? ? ? ?"= %lld, sizeof(struct OurBaseException_t) - " >>> + ? ? ? ? ? ? ? ?"sizeof(struct _Unwind_Exception) = %lu.\n", >>> + ? ? ? ? ? ?ourBaseFromUnwindOffset, >>> + ? ? ? ? ? ?sizeof(struct OurBaseException_t) - >>> + ? ? ? ? ? ? ? ?sizeof(struct _Unwind_Exception)); >>> +#endif >>> + >>> + ? ?size_t numChars = sizeof(ourBaseExcpClassChars) / sizeof(char); >>> + >>> + ? ?// Create our _Unwind_Exception::exception_class value >>> + ? ?ourBaseExceptionClass = genClass(ourBaseExcpClassChars, numChars); >>> + >>> + ? ?// Type infos >>> + >>> + ? ?std::string baseStr = "typeInfo", typeInfoName; >>> + ? ?std::ostringstream typeInfoNameBuilder; >>> + ? ?std::vector structVals; >>> + >>> + ? ?llvm::Constant *nextStruct; >>> + ? ?llvm::GlobalVariable* nextGlobal = NULL; >>> + >>> + ? ?// Generate each type info >>> + ? ?// >>> + ? ?// Note: First type info is not used. >>> + ? ?for (unsigned i = 0; i <= numTypeInfos; ++i) { >>> + ? ? ? ?structVals.clear(); >>> + ? ? ? ?structVals.push_back(llvm::ConstantInt::get(builder.getInt32Ty(), i)); >>> + ? ? ? ?nextStruct = llvm::ConstantStruct::get(ourTypeInfoType, structVals); >>> + >>> + ? ? ? ?typeInfoNameBuilder.str(""); >>> + ? ? ? ?typeInfoNameBuilder << baseStr << i; >>> + ? ? ? ?typeInfoName = typeInfoNameBuilder.str(); >>> + >>> + ? ? ? ?// Note: Does not seem to work without allocation >>> + ? ? ? ?nextGlobal = >>> + ? ? ? ? ? ?new llvm::GlobalVariable(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ourTypeInfoType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::GlobalValue::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nextStruct, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? typeInfoName); >>> + >>> + ? ? ? ?ourTypeInfoNames.push_back(typeInfoName); >>> + ? ? ? ?ourTypeInfoNamesIndex[i] = typeInfoName; >>> + ? ?} >>> + >>> + ? ?ArgNames argNames; >>> + ? ?ArgTypes argTypes; >>> + ? ?llvm::Function* funct = NULL; >>> + >>> + ? ?// print32Int >>> + >>> + ? ?const llvm::Type* retType = builder.getVoidTy(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "print32Int", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// print64Int >>> + >>> + ? ?retType = builder.getVoidTy(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt64Ty()); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "print64Int", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// printStr >>> + >>> + ? ?retType = builder.getVoidTy(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "printStr", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// throwCppException >>> + >>> + ? ?retType = builder.getVoidTy(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "throwCppException", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// deleteOurException >>> + >>> + ? ?retType = builder.getVoidTy(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "deleteOurException", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// createOurException >>> + >>> + ? ?retType = builder.getInt8Ty()->getPointerTo(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "createOurException", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// _Unwind_RaiseException >>> + >>> + ? ?retType = builder.getInt32Ty(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?funct = createFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? "_Unwind_RaiseException", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?funct->addFnAttr(llvm::Attribute::NoReturn); >>> + >>> + ? ?// _Unwind_Resume >>> + >>> + ? ?retType = builder.getInt32Ty(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?funct = createFunction(module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? "_Unwind_Resume", >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?funct->addFnAttr(llvm::Attribute::NoReturn); >>> + >>> + ? ?// ourPersonality >>> + >>> + ? ?retType = builder.getInt32Ty(); >>> + >>> + ? ?argTypes.clear(); >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + ? ?argTypes.push_back(builder.getInt32Ty()); >>> + ? ?argTypes.push_back(builder.getInt64Ty()); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + ? ?argTypes.push_back(builder.getInt8Ty()->getPointerTo()); >>> + >>> + ? ?argNames.clear(); >>> + >>> + ? ?createFunction(module, >>> + ? ? ? ? ? ? ? ? ? retType, >>> + ? ? ? ? ? ? ? ? ? argTypes, >>> + ? ? ? ? ? ? ? ? ? argNames, >>> + ? ? ? ? ? ? ? ? ? "ourPersonality", >>> + ? ? ? ? ? ? ? ? ? llvm::Function::ExternalLinkage, >>> + ? ? ? ? ? ? ? ? ? true, >>> + ? ? ? ? ? ? ? ? ? false); >>> + >>> + ? ?// llvm.eh.selector intrinsic >>> + >>> + ? ?getDeclaration(&module, llvm::Intrinsic::eh_selector); >>> + >>> + ? ?// llvm.eh.exception intrinsic >>> + >>> + ? ?getDeclaration(&module, llvm::Intrinsic::eh_exception); >>> + >>> + ? ?// llvm.eh.typeid.for intrinsic >>> + >>> + ? ?getDeclaration(&module, llvm::Intrinsic::eh_typeid_for); >>> +} >>> + >>> + >>> +//===---------------------------------------------------------------------===// >>> +// Main test driver code. >>> +//===---------------------------------------------------------------------===// >>> + >>> +/// Demo main routine which takes the type info types to throw. A test will >>> +/// be run for each given type info type. While type info types with the value >>> +/// of -1 will trigger a foreign C++ exception to be thrown; type info types >>> +/// <= 6 and >= 1 will be caught by test functions; and type info types > 6 >>> +/// will result in exceptions which pass through to the test harness. All other >>> +/// type info types are not supported and could cause a crash. >>> +int main(int argc, char* argv[]) { >>> + ? ?if (argc == 1) { >>> + ? ? ? ?fprintf(stderr, >>> + ? ? ? ? ? ? ? ?"\nUsage: ExceptionDemo " >>> + ? ? ? ? ? ? ? ? ? ?"[...].\n" >>> + ? ? ? ? ? ? ? ? ? ?" ? Each type must have the value of 1 - 6 for " >>> + ? ? ? ? ? ? ? ? ? ?"generated exceptions to be caught;\n" >>> + ? ? ? ? ? ? ? ? ? ?" ? the value -1 for foreign C++ exceptions to be " >>> + ? ? ? ? ? ? ? ? ? ?"generated and thrown;\n" >>> + ? ? ? ? ? ? ? ? ? ?" ? or the values > 6 for exceptions to be ignored.\n" >>> + ? ? ? ? ? ? ? ? ? ?"\nTry: ExceptionDemo 2 3 7 -1\n" >>> + ? ? ? ? ? ? ? ? ? ?" ? for a full test.\n\n"); >>> + ? ? ? ?return(0); >>> + ? ?} >>> + >>> + ? ?// If not set, exception handling will not be turned on >>> + ? ?llvm::DwarfExceptionHandling = true; >>> + >>> + ? ?llvm::InitializeNativeTarget(); >>> + ? ?llvm::LLVMContext& context = llvm::getGlobalContext(); >>> + ? ?llvm::IRBuilder<> theBuilder(context); >>> + >>> + ? ?// Make the module, which holds all the code. >>> + ? ?llvm::Module* module = new llvm::Module("my cool jit", context); >>> + >>> + ? ?// Build engine with JIT >>> + ? ?llvm::EngineBuilder factory(module); >>> + ? ?factory.setEngineKind(llvm::EngineKind::JIT); >>> + ? ?factory.setAllocateGVsWithCode(false); >>> + ? ?llvm::ExecutionEngine* executionEngine = factory.create(); >>> + >>> + ? ?{ >>> + ? ? ? ?llvm::FunctionPassManager fpm(module); >>> + >>> + ? ? ? ?// Set up the optimizer pipeline. >>> + ? ? ? ?// Start with registering info about how the >>> + ? ? ? ?// target lays out data structures. >>> + ? ? ? ?fpm.add(new llvm::TargetData(*executionEngine->getTargetData())); >>> + >>> + ? ? ? ?// Optimizations turned on >>> +#ifdef ADD_OPT_PASSES >>> + >>> + ? ? ? ?// Promote allocas to registers. >>> + ? ? ? ?fpm.add(llvm::createPromoteMemoryToRegisterPass()); >>> + >>> + ? ? ? ?// Do simple "peephole" optimizations and bit-twiddling optzns. >>> + ? ? ? ?fpm.add(llvm::createInstructionCombiningPass()); >>> + >>> + ? ? ? ?// Reassociate expressions. >>> + ? ? ? ?fpm.add(llvm::createReassociatePass()); >>> + >>> + ? ? ? ?// Eliminate Common SubExpressions. >>> + ? ? ? ?fpm.add(llvm::createGVNPass()); >>> + >>> + ? ? ? ?// Simplify the control flow graph (deleting unreachable >>> + ? ? ? ?// blocks, etc). >>> + ? ? ? ?fpm.add(llvm::createCFGSimplificationPass()); >>> +#endif ?// ADD_OPT_PASSES >>> + >>> + ? ? ? ?fpm.doInitialization(); >>> + >>> + ? ? ? ?// Generate test code using function throwCppException(...) as >>> + ? ? ? ?// the function which throws foreign exceptions. >>> + ? ? ? ?llvm::Function* toRun = >>> + ? ? ? ? ? ? ? ? ? ? ? ? ?createUnwindExceptionTest(*module, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?theBuilder, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fpm, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"throwCppException"); >>> + >>> + ? ? ? ?fprintf(stderr, "\nBegin module dump:\n\n"); >>> + >>> + ? ? ? ?module->dump(); >>> + >>> + ? ? ? ?fprintf(stderr, "\nEnd module dump:\n"); >>> + >>> + ? ? ? ?fprintf(stderr, "\n\nBegin Test:\n"); >>> + >>> + ? ? ? ?for (int i = 1; i < argc; ++i) { >>> + ? ? ? ? ? ?// Run test for each argument whose value is the exception >>> + ? ? ? ? ? ?// type to throw. >>> + ? ? ? ? ? ?runExceptionThrow(executionEngine, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?toRun, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(unsigned) strtoul(argv[i], NULL, 10)); >>> + ? ? ? ?} >>> + >>> + ? ? ? ?fprintf(stderr, "\nEnd Test:\n\n"); >>> + ? ?} >>> + >>> + ? ?delete executionEngine; >>> + >>> + ? ?return 0; >>> +} >>> + >>> >>> Added: llvm/trunk/examples/ExceptionDemo/Makefile >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/Makefile?rev=95723&view=auto >>> >>> ============================================================================== >>> --- llvm/trunk/examples/ExceptionDemo/Makefile (added) >>> +++ llvm/trunk/examples/ExceptionDemo/Makefile Tue Feb ?9 17:22:43 2010 >>> @@ -0,0 +1,17 @@ >>> +##===- examples/ExceptionDemo/Makefile --------------------*- Makefile -*-===## >>> +# >>> +# ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>> +# >>> +# This file is distributed under the University of Illinois Open Source >>> +# License. See LICENSE.TXT for details. >>> +# >>> +##===---------------------------------------------------------------------===## >>> +LEVEL = ../.. >>> +TOOLNAME = ExceptionDemo >>> +EXAMPLE_TOOL = 1 >>> + >>> +LINK_COMPONENTS := jit interpreter nativecodegen >>> + >>> +include $(LEVEL)/Makefile.common >>> + >>> +CXXFLAGS += -fexceptions >>> >>> Modified: llvm/trunk/examples/Makefile >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=95723&r1=95722&r2=95723&view=diff >>> >>> ============================================================================== >>> --- llvm/trunk/examples/Makefile (original) >>> +++ llvm/trunk/examples/Makefile Tue Feb ?9 17:22:43 2010 >>> @@ -10,7 +10,8 @@ >>> >>> ?include $(LEVEL)/Makefile.config >>> >>> -PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker >>> +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT Kaleidoscope ModuleMaker \ >>> + ? ? ? ? ? ? ? ExceptionDemo >>> >>> ?ifeq ($(HAVE_PTHREAD),1) >>> ?PARALLEL_DIRS += ParallelJIT >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> > > From baldrick at free.fr Wed Feb 10 02:41:50 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Feb 2010 09:41:50 +0100 Subject: [llvm-commits] [llvm] r95740 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp In-Reply-To: <201002100059.o1A0xlSi009648@zion.cs.uiuc.edu> References: <201002100059.o1A0xlSi009648@zion.cs.uiuc.edu> Message-ID: <4B72714E.5000803@free.fr> Hi Bill, > + if (TypeInfos.size() != 0) EOL("-- Catch TypeInfos --"); how about: if (!TypeInfos.empty()) ... > + if (FilterIds.size() != 0) EOL("-- Filter IDs --"); Likewise. Ciao, Duncan. From baldrick at free.fr Wed Feb 10 06:05:03 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Feb 2010 12:05:03 -0000 Subject: [llvm-commits] [dragonegg] r95776 - in /dragonegg/trunk: TODO llvm-backend.cpp Message-ID: <201002101205.o1AC54dj022461@zion.cs.uiuc.edu> Author: baldrick Date: Wed Feb 10 06:05:02 2010 New Revision: 95776 URL: http://llvm.org/viewvc/llvm-project?rev=95776&view=rev Log: Suppress generation of debug info by GCC. Previously, when compiling with -g, vast reams of debug output would be created by GCC, for no benefit since it would all be sent to /dev/null. With this change, debug sections are still output, but that's about it. As well as improving efficiency, this makes the compiler more stable, since -lfto (turned on internally by the plugin) and -g are not yet fully supported. Modified: dragonegg/trunk/TODO dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/TODO URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/TODO?rev=95776&r1=95775&r2=95776&view=diff ============================================================================== --- dragonegg/trunk/TODO (original) +++ dragonegg/trunk/TODO Wed Feb 10 06:05:02 2010 @@ -28,10 +28,6 @@ Consider using separate caches for types and globals. -Work out how to stop GCC from outputting debug info for global variables -when compiling with -g. The output is all thrown away, so harmless, but it -would be more efficient not to produce any in the first place. - Correctness ----------- Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95776&r1=95775&r2=95776&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Wed Feb 10 06:05:02 2010 @@ -65,6 +65,7 @@ #include "tree.h" #include "cgraph.h" +#include "debug.h" #include "diagnostic.h" #include "flags.h" #include "function.h" @@ -1498,6 +1499,9 @@ #else # error "LTO support required but not enabled in GCC" #endif + + // Stop GCC outputting serious amounts of debug info. + debug_hooks = &do_nothing_debug_hooks; } From baldrick at free.fr Wed Feb 10 06:31:10 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Feb 2010 12:31:10 -0000 Subject: [llvm-commits] [dragonegg] r95777 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002101231.o1ACVANn023525@zion.cs.uiuc.edu> Author: baldrick Date: Wed Feb 10 06:31:09 2010 New Revision: 95777 URL: http://llvm.org/viewvc/llvm-project?rev=95777&view=rev Log: Only used internally - make it static. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95777&r1=95776&r2=95777&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Wed Feb 10 06:31:09 2010 @@ -1684,7 +1684,7 @@ } /// emit_alias - Given decl and target emit alias to target. -void emit_alias(tree decl, tree target) { +static void emit_alias(tree decl, tree target) { if (errorcount || sorrycount) return; // Do not process broken code. From baldrick at free.fr Wed Feb 10 07:18:14 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Feb 2010 13:18:14 -0000 Subject: [llvm-commits] [dragonegg] r95778 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002101318.o1ADIEmW025512@zion.cs.uiuc.edu> Author: baldrick Date: Wed Feb 10 07:18:14 2010 New Revision: 95778 URL: http://llvm.org/viewvc/llvm-project?rev=95778&view=rev Log: Forget to set the linkage for thunks. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95778&r1=95777&r2=95778&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Wed Feb 10 07:18:14 2010 @@ -1552,6 +1552,32 @@ pop_cfun (); } +/// GetLinkageForAlias - The given GCC declaration is an alias or thunk. Return +/// the appropriate LLVM linkage type for it. +static GlobalValue::LinkageTypes GetLinkageForAlias(tree decl) { + if (DECL_COMDAT(decl)) + // Need not be put out unless needed in this translation unit. + return GlobalValue::InternalLinkage; + + if (DECL_ONE_ONLY(decl)) + // Copies of this DECL in multiple translation units should be merged. + return GlobalValue::WeakODRLinkage; + + if (DECL_WEAK(decl)) + // The user may have explicitly asked for weak linkage - ignore flag_odr. + return GlobalValue::WeakAnyLinkage; + + if (!TREE_PUBLIC(decl)) + // Not accessible from outside this translation unit. + return GlobalValue::InternalLinkage; + + if (DECL_EXTERNAL(decl)) + // Do not allocate storage, and refer to a definition elsewhere. + return GlobalValue::InternalLinkage; + + return GlobalValue::ExternalLinkage; +} + /// ApplyVirtualOffset - Adjust 'this' by a virtual offset. static Value *ApplyVirtualOffset(Value *This, HOST_WIDE_INT virtual_value, LLVMBuilder &Builder) { @@ -1595,6 +1621,10 @@ // Mark the thunk as written so gcc doesn't waste time outputting it. TREE_ASM_WRITTEN(node->decl) = 1; + // Set the linkage and visibility. + Thunk->setLinkage(GetLinkageForAlias(node->decl)); + handleVisibility(node->decl, Thunk); + // Whether the thunk adjusts 'this' before calling the thunk alias (otherwise // it is the value returned by the alias that is adjusted). bool ThisAdjusting = node->thunk.this_adjusting; @@ -1728,23 +1758,7 @@ Aliasee = cast(DEFINITION_LLVM(target)); } - GlobalValue::LinkageTypes Linkage = GlobalValue::ExternalLinkage; - - if (DECL_COMDAT(decl)) - // Need not be put out unless needed in this translation unit. - Linkage = GlobalValue::InternalLinkage; - else if (DECL_ONE_ONLY(decl)) - // Copies of this DECL in multiple translation units should be merged. - Linkage = GlobalValue::WeakODRLinkage; - else if (DECL_WEAK(decl)) - // The user may have explicitly asked for weak linkage - ignore flag_odr. - Linkage = GlobalValue::WeakAnyLinkage; - else if (!TREE_PUBLIC(decl)) - // Not accessible from outside this translation unit. - Linkage = GlobalValue::InternalLinkage; - else if (DECL_EXTERNAL(decl)) - // Do not allocate storage, and refer to a definition elsewhere. - Linkage = GlobalValue::InternalLinkage; + GlobalValue::LinkageTypes Linkage = GetLinkageForAlias(decl); if (Linkage != GlobalValue::InternalLinkage) { // Create the LLVM alias. From benny.kra at googlemail.com Wed Feb 10 07:34:02 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 10 Feb 2010 13:34:02 -0000 Subject: [llvm-commits] [llvm] r95779 - in /llvm/trunk/unittests/ADT: BitVectorTest.cpp SmallBitVectorTest.cpp Message-ID: <201002101334.o1ADY2ZP026355@zion.cs.uiuc.edu> Author: d0k Date: Wed Feb 10 07:34:02 2010 New Revision: 95779 URL: http://llvm.org/viewvc/llvm-project?rev=95779&view=rev Log: Silence GCC warnings. Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Modified: llvm/trunk/unittests/ADT/BitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/BitVectorTest.cpp?rev=95779&r1=95778&r2=95779&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/BitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/BitVectorTest.cpp Wed Feb 10 07:34:02 2010 @@ -154,8 +154,8 @@ EXPECT_TRUE(A.test(5)); EXPECT_TRUE(A.test(7)); EXPECT_TRUE(A.test(18)); - EXPECT_EQ(A.count(), 4); - EXPECT_EQ(A.size(), 50); + EXPECT_EQ(4U, A.count()); + EXPECT_EQ(50U, A.size()); B.resize(10); B.set(); @@ -164,8 +164,8 @@ A &= B; EXPECT_FALSE(A.test(2)); EXPECT_FALSE(A.test(7)); - EXPECT_EQ(A.size(), 50); - EXPECT_EQ(A.count(), 2); + EXPECT_EQ(2U, A.count()); + EXPECT_EQ(50U, A.size()); B.resize(100); B.set(); @@ -173,8 +173,8 @@ A ^= B; EXPECT_TRUE(A.test(2)); EXPECT_TRUE(A.test(7)); - EXPECT_EQ(A.size(), 100); - EXPECT_EQ(A.count(), 98); + EXPECT_EQ(98U, A.count()); + EXPECT_EQ(100U, A.size()); } } Modified: llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp?rev=95779&r1=95778&r2=95779&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp (original) +++ llvm/trunk/unittests/ADT/SmallBitVectorTest.cpp Wed Feb 10 07:34:02 2010 @@ -153,8 +153,8 @@ EXPECT_TRUE(A.test(5)); EXPECT_TRUE(A.test(7)); EXPECT_TRUE(A.test(18)); - EXPECT_EQ(A.count(), 4); - EXPECT_EQ(A.size(), 50); + EXPECT_EQ(4U, A.count()); + EXPECT_EQ(50U, A.size()); B.resize(10); B.set(); @@ -163,8 +163,8 @@ A &= B; EXPECT_FALSE(A.test(2)); EXPECT_FALSE(A.test(7)); - EXPECT_EQ(A.size(), 50); - EXPECT_EQ(A.count(), 2); + EXPECT_EQ(2U, A.count()); + EXPECT_EQ(50U, A.size()); B.resize(100); B.set(); @@ -172,8 +172,8 @@ A ^= B; EXPECT_TRUE(A.test(2)); EXPECT_TRUE(A.test(7)); - EXPECT_EQ(A.size(), 100); - EXPECT_EQ(A.count(), 98); + EXPECT_EQ(98U, A.count()); + EXPECT_EQ(100U, A.size()); } } From gohman at apple.com Wed Feb 10 09:54:23 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 15:54:23 -0000 Subject: [llvm-commits] [llvm] r95780 - /llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Message-ID: <201002101554.o1AFsNOQ000841@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 09:54:22 2010 New Revision: 95780 URL: http://llvm.org/viewvc/llvm-project?rev=95780&view=rev Log: Minor code simplification. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=95780&r1=95779&r2=95780&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Wed Feb 10 09:54:22 2010 @@ -412,8 +412,7 @@ } virtual bool hasComputableLoopEvolution(const Loop *QL) const { - if (L == QL) return true; - return false; + return L == QL; } virtual bool isLoopInvariant(const Loop *QueryLoop) const; From gohman at apple.com Wed Feb 10 10:03:49 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 16:03:49 -0000 Subject: [llvm-commits] [llvm] r95781 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/MC/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ lib/Analysis/ lib/Analysis/IPA/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/PBQP/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Support/ lib/Target/ lib/Target/CBackend/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/X86/ lib/Target/XCore/ lib/Transforms/IPO/ lib/Transforms/InstCombine/ lib/Transfo... Message-ID: <201002101603.o1AG3pfJ001324@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 10:03:48 2010 New Revision: 95781 URL: http://llvm.org/viewvc/llvm-project?rev=95781&view=rev Log: Fix "the the" and similar typos. Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/include/llvm/InlineAsm.h llvm/trunk/include/llvm/Instruction.h llvm/trunk/include/llvm/Linker.h llvm/trunk/include/llvm/MC/MCSymbol.h llvm/trunk/include/llvm/PassManagers.h llvm/trunk/include/llvm/Support/IRBuilder.h llvm/trunk/include/llvm/System/DynamicLibrary.h llvm/trunk/include/llvm/System/Path.h llvm/trunk/include/llvm/Target/Target.td llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp llvm/trunk/lib/Analysis/LiveValues.cpp llvm/trunk/lib/Analysis/MemoryBuiltins.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/SlotIndexes.cpp llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp llvm/trunk/lib/CodeGen/VirtRegMap.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/Support/APInt.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/trunk/lib/Target/SubtargetFeature.cpp llvm/trunk/lib/Target/X86/README-SSE.txt llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp llvm/trunk/lib/VMCore/IRBuilder.cpp Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h (original) +++ llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h Wed Feb 10 10:03:48 2010 @@ -72,7 +72,7 @@ // free Call Utility Functions. // -/// isFreeCall - Returns true if the the value is a call to the builtin free() +/// isFreeCall - Returns true if the value is a call to the builtin free() bool isFreeCall(const Value *I); } // End llvm namespace Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original) +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Wed Feb 10 10:03:48 2010 @@ -291,7 +291,7 @@ /// EmitRecordWithAbbrevImpl - This is the core implementation of the record /// emission code. If BlobData is non-null, then it specifies an array of /// data that should be emitted as part of the Blob or Array operand that is - /// known to exist at the end of the the record. + /// known to exist at the end of the record. template void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl &Vals, StringRef Blob) { Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h Wed Feb 10 10:03:48 2010 @@ -146,7 +146,7 @@ } } - /// emitAlignment - Move the CurBufferPtr pointer up the the specified + /// emitAlignment - Move the CurBufferPtr pointer up the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment) { if (Alignment == 0) Alignment = 1; Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 10 10:03:48 2010 @@ -320,7 +320,7 @@ /// advanceTo - Advance the specified iterator to point to the LiveRange /// containing the specified position, or end() if the position is past the /// end of the interval. If no LiveRange contains this position, but the - /// position is in a hole, this method returns an iterator pointing the the + /// position is in a hole, this method returns an iterator pointing the /// LiveRange immediately after the hole. iterator advanceTo(iterator I, SlotIndex Pos) { if (Pos >= endIndex()) Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Wed Feb 10 10:03:48 2010 @@ -155,7 +155,7 @@ } } - /// emitAlignment - Move the CurBufferPtr pointer up the the specified + /// emitAlignment - Move the CurBufferPtr pointer up the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment) { if (Alignment == 0) Alignment = 1; Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h Wed Feb 10 10:03:48 2010 @@ -136,7 +136,7 @@ : TD(td), PoolAlignment(1) {} ~MachineConstantPool(); - /// getConstantPoolAlignment - Return the the alignment required by + /// getConstantPoolAlignment - Return the alignment required by /// the whole constant pool, of which the first element must be aligned. unsigned getConstantPoolAlignment() const { return PoolAlignment; } Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Feb 10 10:03:48 2010 @@ -330,7 +330,7 @@ bool NoImp = false); /// CloneMachineInstr - Create a new MachineInstr which is a copy of the - /// 'Orig' instruction, identical in all ways except the the instruction + /// 'Orig' instruction, identical in all ways except the instruction /// has no parent, prev, or next. /// /// See also TargetInstrInfo::duplicate() for target-specific fixes to cloned Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Wed Feb 10 10:03:48 2010 @@ -347,7 +347,7 @@ /// isInvariantLoad - Return true if this instruction is loading from a /// location whose value is invariant across the function. For example, - /// loading a value from the constant pool or from from the argument area of + /// loading a value from the constant pool or from the argument area of /// a function if it does not change. This should only return true of *all* /// loads the instruction does are invariant (if it does multiple loads). bool isInvariantLoad(AliasAnalysis *AA) const; Modified: llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h Wed Feb 10 10:03:48 2010 @@ -81,7 +81,7 @@ /// written to the data stream in big-endian format. void emitDWordBE(uint64_t W); - /// emitAlignment - Move the CurBufferPtr pointer up the the specified + /// emitAlignment - Move the CurBufferPtr pointer up the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment = 0, uint8_t fill = 0); Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Wed Feb 10 10:03:48 2010 @@ -92,7 +92,7 @@ void setSection(StringRef S) { Section = S; } /// If the usage is empty (except transitively dead constants), then this - /// global value can can be safely deleted since the destructor will + /// global value can be safely deleted since the destructor will /// delete the dead constants as well. /// @brief Determine if the usage of this global value is empty except /// for transitively dead constants. Modified: llvm/trunk/include/llvm/InlineAsm.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/InlineAsm.h (original) +++ llvm/trunk/include/llvm/InlineAsm.h Wed Feb 10 10:03:48 2010 @@ -39,7 +39,7 @@ virtual ~InlineAsm(); public: - /// InlineAsm::get - Return the the specified uniqued inline asm string. + /// InlineAsm::get - Return the specified uniqued inline asm string. /// static InlineAsm *get(const FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, Modified: llvm/trunk/include/llvm/Instruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instruction.h (original) +++ llvm/trunk/include/llvm/Instruction.h Wed Feb 10 10:03:48 2010 @@ -148,7 +148,7 @@ getAllMetadataImpl(MDs); } - /// setMetadata - Set the metadata of of the specified kind to the specified + /// setMetadata - Set the metadata of the specified kind to the specified /// node. This updates/replaces metadata if already present, or removes it if /// Node is null. void setMetadata(unsigned KindID, MDNode *Node); Modified: llvm/trunk/include/llvm/Linker.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Linker.h (original) +++ llvm/trunk/include/llvm/Linker.h Wed Feb 10 10:03:48 2010 @@ -223,7 +223,7 @@ /// the archive that resolve outstanding symbols will be linked in. The /// library is searched repeatedly until no more modules that resolve /// symbols can be found. If an error occurs, the error string is set. - /// To speed up this function, ensure the the archive has been processed + /// To speed up this function, ensure the archive has been processed /// llvm-ranlib or the S option was given to llvm-ar when the archive was /// created. These tools add a symbol table to the archive which makes the /// search for undefined symbols much faster. Modified: llvm/trunk/include/llvm/MC/MCSymbol.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Feb 10 10:03:48 2010 @@ -89,7 +89,7 @@ return !isDefined(); } - /// isAbsolute - Check if this this is an absolute symbol. + /// isAbsolute - Check if this is an absolute symbol. bool isAbsolute() const { return Section == AbsolutePseudoSection; } Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Wed Feb 10 10:03:48 2010 @@ -394,8 +394,8 @@ const AnalysisUsage::VectorType &Set) const; // Set of available Analysis. This information is used while scheduling - // pass. If a pass requires an analysis which is not not available then - // equired analysis pass is scheduled to run before the pass itself is + // pass. If a pass requires an analysis which is not available then + // the required analysis pass is scheduled to run before the pass itself is // scheduled to run. std::map AvailableAnalysis; Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Feb 10 10:03:48 2010 @@ -94,7 +94,7 @@ //===--------------------------------------------------------------------===// /// CreateGlobalString - Make a new global variable with an initializer that - /// has array of i8 type filled in the the nul terminated string value + /// has array of i8 type filled in the nul terminated string value /// specified. If Name is specified, it is the name of the global variable /// created. Value *CreateGlobalString(const char *Str = "", const Twine &Name = ""); Modified: llvm/trunk/include/llvm/System/DynamicLibrary.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/DynamicLibrary.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/DynamicLibrary.h (original) +++ llvm/trunk/include/llvm/System/DynamicLibrary.h Wed Feb 10 10:03:48 2010 @@ -23,7 +23,7 @@ /// might be known as shared libraries, shared objects, dynamic shared /// objects, or dynamic link libraries. Regardless of the terminology or the /// operating system interface, this class provides a portable interface that - /// allows dynamic libraries to be loaded and and searched for externally + /// allows dynamic libraries to be loaded and searched for externally /// defined symbols. This is typically used to provide "plug-in" support. /// It also allows for symbols to be defined which don't live in any library, /// but rather the main program itself, useful on Windows where the main Modified: llvm/trunk/include/llvm/System/Path.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Path.h (original) +++ llvm/trunk/include/llvm/System/Path.h Wed Feb 10 10:03:48 2010 @@ -28,7 +28,7 @@ /// platform independent and eliminates many of the unix-specific fields. /// However, to support llvm-ar, the mode, user, and group fields are /// retained. These pertain to unix security and may not have a meaningful - /// value on non-Unix platforms. However, the other fields fields should + /// value on non-Unix platforms. However, the other fields should /// always be applicable on all platforms. The structure is filled in by /// the PathWithStatus class. /// @brief File status structure Modified: llvm/trunk/include/llvm/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/Target.td (original) +++ llvm/trunk/include/llvm/Target/Target.td Wed Feb 10 10:03:48 2010 @@ -376,7 +376,7 @@ // InstrInfo - This class should only be instantiated once to provide parameters -// which are global to the the target machine. +// which are global to the target machine. // class InstrInfo { // If the target wants to associate some target-specific information with each Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Wed Feb 10 10:03:48 2010 @@ -169,7 +169,7 @@ return I; } - /// hasSubClass - return true if the the specified TargetRegisterClass + /// hasSubClass - return true if the specified TargetRegisterClass /// is a proper subset of this TargetRegisterClass. bool hasSubClass(const TargetRegisterClass *cs) const { for (int i = 0; SubClasses[i] != NULL; ++i) Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Wed Feb 10 10:03:48 2010 @@ -486,7 +486,7 @@ if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = 0; if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = 0; - // If the the two pointers are derived from two different non-addr-taken + // If the two pointers are derived from two different non-addr-taken // globals, or if one is and the other isn't, we know these can't alias. if ((GV1 || GV2) && GV1 != GV2) return NoAlias; Modified: llvm/trunk/lib/Analysis/LiveValues.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LiveValues.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LiveValues.cpp (original) +++ llvm/trunk/lib/Analysis/LiveValues.cpp Wed Feb 10 10:03:48 2010 @@ -184,7 +184,7 @@ } } - // If the value was never used outside the the block in which it was + // If the value was never used outside the block in which it was // defined, it's killed in that block. if (!LiveOutOfDefBB) M.Killed.insert(DefBB); Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Wed Feb 10 10:03:48 2010 @@ -24,7 +24,7 @@ // malloc Call Utility Functions. // -/// isMalloc - Returns true if the the value is either a malloc call or a +/// isMalloc - Returns true if the value is either a malloc call or a /// bitcast of the result of a malloc call. bool llvm::isMalloc(const Value *I) { return extractMallocCall(I) || extractMallocCallFromBitCast(I); @@ -183,7 +183,7 @@ // free Call Utility Functions. // -/// isFreeCall - Returns true if the the value is a call to the builtin free() +/// isFreeCall - Returns true if the value is a call to the builtin free() bool llvm::isFreeCall(const Value *I) { const CallInst *CI = dyn_cast(I); if (!CI) Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Feb 10 10:03:48 2010 @@ -5032,7 +5032,7 @@ if (Step->isOne()) { // With unit stride, the iteration never steps past the limit value. } else if (isKnownPositive(Step)) { - // Test whether a positive iteration iteration can step past the limit + // Test whether a positive iteration can step past the limit // value and past the maximum value for its type in a single step. // Note that it's not sufficient to check NoWrap here, because even // though the value after a wrap is undefined, it's not undefined Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Feb 10 10:03:48 2010 @@ -302,7 +302,7 @@ OutStreamer.GetCommentOS() << '\n'; } - // Emit the CurrentFnSym. This is is a virtual function to allow targets to + // Emit the CurrentFnSym. This is a virtual function to allow targets to // do their wild and crazy things as required. EmitFunctionEntryLabel(); Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 10 10:03:48 2010 @@ -618,7 +618,7 @@ 1). Add the offset of the forwarding field. - 2). Follow that pointer to get the the real __Block_byref_x_VarName + 2). Follow that pointer to get the real __Block_byref_x_VarName struct to use (the real one may have been copied onto the heap). 3). Add the offset for the field VarName, to find the actual variable. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 10 10:03:48 2010 @@ -103,7 +103,7 @@ /// SmallVector, 8> SourceIds; - /// Lines - List of of source line correspondence. + /// Lines - List of source line correspondence. std::vector Lines; /// DIEValues - A list of all the unique values in use. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Wed Feb 10 10:03:48 2010 @@ -103,7 +103,7 @@ /// exception. If it matches then the exception and type id are passed /// on to the landing pad. Otherwise the next action is looked up. This /// chain is terminated with a next action of zero. If no type id is - /// found the the frame is unwound and handling continues. + /// found the frame is unwound and handling continues. /// 3. Type id table contains references to all the C++ typeinfo for all /// catches in the function. This tables is reversed indexed base 1. Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Wed Feb 10 10:03:48 2010 @@ -115,7 +115,7 @@ // Ask the target's AnalyzeBranch if it can handle this block. MachineBasicBlock *TBB = 0, *FBB = 0; SmallVector Cond; - // Make the the terminator is understood. + // Make the terminator is understood. if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond)) return false; // Make sure we have the option of reversing the condition. Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Wed Feb 10 10:03:48 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This implements a a hazard recognizer using the instructions itineraries +// This implements a hazard recognizer using the instructions itineraries // defined for the current target. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Feb 10 10:03:48 2010 @@ -187,7 +187,7 @@ } /// CloneMachineInstr - Create a new MachineInstr which is a copy of the -/// 'Orig' instruction, identical in all ways except the the instruction +/// 'Orig' instruction, identical in all ways except the instruction /// has no parent, prev, or next. /// MachineInstr * Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Feb 10 10:03:48 2010 @@ -1034,7 +1034,7 @@ /// isInvariantLoad - Return true if this instruction is loading from a /// location whose value is invariant across the function. For example, -/// loading a value from the constant pool or from from the argument area +/// loading a value from the constant pool or from the argument area /// of a function if it does not change. This should only return true of /// *all* loads the instruction does are invariant (if it does multiple loads). bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const { Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original) +++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Wed Feb 10 10:03:48 2010 @@ -9,7 +9,7 @@ // // Heuristic PBQP solver. This solver is able to perform optimal reductions for // nodes of degree 0, 1 or 2. For nodes of degree >2 a plugable heuristic is -// used to to select a node for reduction. +// used to select a node for reduction. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 10 10:03:48 2010 @@ -2640,7 +2640,7 @@ // If the shift is not a no-op (in which case this should be just a sign // extend already), the truncated to type is legal, sign_extend is legal - // on that type, and the the truncate to that type is both legal and free, + // on that type, and the truncate to that type is both legal and free, // perform the transform. if ((ShiftAmt > 0) && TLI.isOperationLegalOrCustom(ISD::SIGN_EXTEND, TruncVT) && Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 10 10:03:48 2010 @@ -2767,7 +2767,7 @@ DAG.getIntPtrConstant(1)); } else { // FIXME: We should be able to fall back to a libcall with an illegal - // type in some cases cases. + // type in some cases. // Also, we can fall back to a division in some cases, but that's a big // performance hit in the general case. llvm_unreachable("Don't know how to expand this operation yet!"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 10:03:48 2010 @@ -1349,7 +1349,7 @@ DAG.getConstant(JTH.First, VT)); // The SDNode we just created, which holds the value being switched on minus - // the the smallest case value, needs to be copied to a virtual register so it + // the smallest case value, needs to be copied to a virtual register so it // can be used as an index into the jump table in a subsequent basic block. // This value may be smaller or larger than the target's pointer type, and // therefore require extension or truncating. @@ -4865,7 +4865,7 @@ EVT ThisVT = MVT::Other; const TargetRegisterClass *RC = *RCI; - // If none of the the value types for this register class are valid, we + // If none of the value types for this register class are valid, we // can't use it. For example, 64-bit reg classes on 32-bit targets. for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); I != E; ++I) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Feb 10 10:03:48 2010 @@ -2366,7 +2366,7 @@ E = RI->regclass_end(); RCI != E; ++RCI) { const TargetRegisterClass *RC = *RCI; - // If none of the the value types for this register class are valid, we + // If none of the value types for this register class are valid, we // can't use it. For example, 64-bit reg classes on 32-bit targets. bool isLegal = false; for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Feb 10 10:03:48 2010 @@ -197,7 +197,7 @@ SlotIndex FillerStart = ValLR->end, FillerEnd = BLR->start; // We are about to delete CopyMI, so need to remove it as the 'instruction - // that defines this value #'. Update the the valnum with the new defining + // that defines this value #'. Update the valnum with the new defining // instruction #. BValNo->def = FillerStart; BValNo->setCopy(0); Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Wed Feb 10 10:03:48 2010 @@ -95,7 +95,7 @@ push_back(createEntry(0, index)); - // Iterate over the the function. + // Iterate over the function. for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end(); mbbItr != mbbEnd; ++mbbItr) { MachineBasicBlock *mbb = &*mbbItr; Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Feb 10 10:03:48 2010 @@ -49,7 +49,7 @@ std::map > Stacks; // Registers in UsedByAnother are PHI nodes that are themselves - // used as operands to another another PHI node + // used as operands to another PHI node std::set UsedByAnother; // RenameSets are the is a map from a PHI-defined register Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Wed Feb 10 10:03:48 2010 @@ -9,7 +9,7 @@ // // This file implements the VirtRegMap class. // -// It also contains implementations of the the Spiller interface, which, given a +// It also contains implementations of the Spiller interface, which, given a // virtual register map and a machine function, eliminates all virtual // references by replacing them with physical register references - adding spill // code as necessary. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Feb 10 10:03:48 2010 @@ -171,7 +171,7 @@ ob->encoding.i = 0; ob->encoding.b.encoding = llvm::dwarf::DW_EH_PE_omit; - // Put the info on both places, as libgcc uses the first or the the second + // Put the info on both places, as libgcc uses the first or the second // field. Note that we rely on having two pointers here. If fde_end was a // char, things would get complicated. ob->fde_end = (char*)LOI->unseenObjects; Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Wed Feb 10 10:03:48 2010 @@ -273,7 +273,7 @@ return clearUnusedBits(); } -/// Multiplies an integer array, x by a a uint64_t integer and places the result +/// Multiplies an integer array, x, by a uint64_t integer and places the result /// into dest. /// @returns the carry out of the multiplication. /// @brief Multiply a multi-digit APInt by a single digit (64-bit) integer. @@ -1766,7 +1766,7 @@ // First, compose the values into an array of 32-bit words instead of // 64-bit words. This is a necessity of both the "short division" algorithm - // and the the Knuth "classical algorithm" which requires there to be native + // and the Knuth "classical algorithm" which requires there to be native // operations for +, -, and * on an m bit value with an m*2 bit result. We // can't use 64-bit operands here because we don't have native results of // 128-bits. Furthermore, casting the 64-bit values to 32-bit values won't Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Feb 10 10:03:48 2010 @@ -1841,7 +1841,7 @@ return GlobalDtors; } - // Otherwise, it it is other metadata, don't print it. This catches things + // Otherwise, if it is other metadata, don't print it. This catches things // like debug information. if (GV->getSection() == "llvm.metadata") return NotPrinted; @@ -3113,7 +3113,7 @@ } /// visitBuiltinCall - Handle the call to the specified builtin. Returns true -/// if the entire call is handled, return false it it wasn't handled, and +/// if the entire call is handled, return false if it wasn't handled, and /// optionally set 'WroteCallee' if the callee has already been printed out. bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID, bool &WroteCallee) { Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Wed Feb 10 10:03:48 2010 @@ -68,7 +68,7 @@ TypeNo = TypeNo << PIC16Dbg::S_DERIVED; } - // We also need to encode the the information about the base type of + // We also need to encode the information about the base type of // pointer in TypeNo. DIType BaseType = DIDerivedType(Ty.getNode()).getTypeDerivedFrom(); PopulateDebugInfo(BaseType, TypeNo, HasAux, Aux, TagName); Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp Wed Feb 10 10:03:48 2010 @@ -118,7 +118,7 @@ } /// getHazardType - We return hazard for any non-branch instruction that would -/// terminate terminate the dispatch group. We turn NoopHazard for any +/// terminate the dispatch group. We turn NoopHazard for any /// instructions that wouldn't terminate the dispatch group that would cause a /// pipeline flush. ScheduleHazardRecognizer::HazardType PPCHazardRecognizer970:: Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Wed Feb 10 10:03:48 2010 @@ -199,7 +199,7 @@ // Check to see if this function uses vector registers, which means we have to // save and restore the VRSAVE register and update it with the regs we use. // - // In this case, there will be virtual registers of vector type type created + // In this case, there will be virtual registers of vector type created // by the scheduler. Detect them now. bool HasVectorVReg = false; for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, Modified: llvm/trunk/lib/Target/SubtargetFeature.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SubtargetFeature.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/SubtargetFeature.cpp (original) +++ llvm/trunk/lib/Target/SubtargetFeature.cpp Wed Feb 10 10:03:48 2010 @@ -67,7 +67,7 @@ while (true) { // Find the next comma size_t Comma = S.find(',', Pos); - // If no comma found then the the rest of the string is used + // If no comma found then the rest of the string is used if (Comma == std::string::npos) { // Add string to vector V.push_back(S.substr(Pos)); Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Wed Feb 10 10:03:48 2010 @@ -376,7 +376,7 @@ ... saving two instructions. The basic idea is that a reload from a spill slot, can, if only one 4-byte -chunk is used, bring in 3 zeros the the one element instead of 4 elements. +chunk is used, bring in 3 zeros the one element instead of 4 elements. This can be used to simplify a variety of shuffle operations, where the elements are fixed zeros. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 10 10:03:48 2010 @@ -2172,7 +2172,7 @@ if (IsCalleePop(isVarArg, CallConv)) NumBytesForCalleeToPush = NumBytes; // Callee pops everything else if (!Is64Bit && CallConv != CallingConv::Fast && IsStructRet) - // If this is is a call to a struct-return function, the callee + // If this is a call to a struct-return function, the callee // pops the hidden struct pointer, so we have to push it back. // This is common for Darwin/X86, Linux & Mingw32 targets. NumBytesForCalleeToPush = 4; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Feb 10 10:03:48 2010 @@ -3704,7 +3704,7 @@ "movz{wl|x}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; -// These are the same as the regular regular MOVZX32rr8 and MOVZX32rm8 +// These are the same as the regular MOVZX32rr8 and MOVZX32rm8 // except that they use GR32_NOREX for the output operand register class // instead of GR32. This allows them to operate on h registers on x86-64. def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg, Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 10 10:03:48 2010 @@ -686,7 +686,7 @@ [(set R11, (pcrelwrapper tblockaddress:$addr))]>; let isCall=1, -// All calls clobber the the link register and the non-callee-saved registers: +// All calls clobber the link register and the non-callee-saved registers: Defs = [R0, R1, R2, R3, R11, LR] in { def BL_u10 : _FU10< (outs), @@ -779,7 +779,7 @@ []>; let isCall=1, -// All calls clobber the the link register and the non-callee-saved registers: +// All calls clobber the link register and the non-callee-saved registers: Defs = [R0, R1, R2, R3, R11, LR] in { def BLA_1r : _F1R<(outs), (ins GRRegs:$addr, variable_ops), "bla $addr", Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Feb 10 10:03:48 2010 @@ -247,7 +247,7 @@ return Low != Set.end() && IsPrefix(*Low, Indices); } -/// Mark the given indices (ToMark) as safe in the the given set of indices +/// Mark the given indices (ToMark) as safe in the given set of indices /// (Safe). Marking safe usually means adding ToMark to Safe. However, if there /// is already a prefix of Indices in Safe, Indices are implicitely marked safe /// already. Furthermore, any indices that Indices is itself a prefix of, are Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Wed Feb 10 10:03:48 2010 @@ -117,7 +117,7 @@ DominatorTree DT; DT.runOnFunction(*duplicateFunction); - // Extract the body of the the if. + // Extract the body of the if. Function* extractedFunction = ExtractCodeRegion(DT, toExtract); // Inline the top-level if test into all callers. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Wed Feb 10 10:03:48 2010 @@ -546,7 +546,7 @@ std::swap(LHSCC, RHSCC); } - // At this point, we know we have have two icmp instructions + // At this point, we know we have two icmp instructions // comparing a value against two constants and and'ing the result // together. Because of the above check, we know that we only have // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know @@ -1226,7 +1226,7 @@ std::swap(LHSCC, RHSCC); } - // At this point, we know we have have two icmp instructions + // At this point, we know we have two icmp instructions // comparing a value against two constants and or'ing the result // together. Because of the above check, we know that we only have // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Feb 10 10:03:48 2010 @@ -380,7 +380,7 @@ NeedCannIV = true; } - // Now that we know the largest of of the induction variable expressions + // Now that we know the largest of the induction variable expressions // in this loop, insert a canonical induction variable of the largest size. Value *IndVar = 0; if (NeedCannIV) { Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Feb 10 10:03:48 2010 @@ -249,7 +249,7 @@ /// LinearizeExprTree - Given an associative binary expression tree, traverse /// all of the uses putting it into canonical form. This forces a left-linear -/// form of the the expression (((a+b)+c)+d), and collects information about the +/// form of the expression (((a+b)+c)+d), and collects information about the /// rank of the non-tree operands. /// /// NOTE: These intentionally destroys the expression tree operands (turning @@ -299,7 +299,7 @@ Success = false; MadeChange = true; } else if (RHSBO) { - // Turn (A+B)+(C+D) -> (((A+B)+C)+D). This guarantees the the RHS is not + // Turn (A+B)+(C+D) -> (((A+B)+C)+D). This guarantees the RHS is not // part of the expression tree. LinearizeExpr(I); LHS = LHSBO = cast(I->getOperand(0)); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp Wed Feb 10 10:03:48 2010 @@ -68,7 +68,7 @@ Function *Callee = Call->getCalledFunction(); // Minimally sanity-check the CFG of half_powr to ensure that it contains - // the the kind of code we expect. If we're running this pass, we have + // the kind of code we expect. If we're running this pass, we have // reason to believe it will be what we expect. Function::iterator I = Callee->begin(); BasicBlock *Prologue = I++; Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IRBuilder.cpp (original) +++ llvm/trunk/lib/VMCore/IRBuilder.cpp Wed Feb 10 10:03:48 2010 @@ -19,7 +19,7 @@ using namespace llvm; /// CreateGlobalString - Make a new global variable with an initializer that -/// has array of i8 type filled in the the nul terminated string value +/// has array of i8 type filled in the nul terminated string value /// specified. If Name is specified, it is the name of the global variable /// created. Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) { From daniel at zuster.org Wed Feb 10 11:08:27 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 09:08:27 -0800 Subject: [llvm-commits] [llvm] r95781 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/MC/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ lib/Analysis/ lib/Analysis/IPA/ lib/C Message-ID: <6a8523d61002100908s5a477855ude0ad6bb7064354e@mail.gmail.com> Maybe we need -Wcomment-grammar in clang? - Daniel On Wed, Feb 10, 2010 at 8:03 AM, Dan Gohman wrote: > Author: djg > Date: Wed Feb 10 10:03:48 2010 > New Revision: 95781 > > URL: http://llvm.org/viewvc/llvm-project?rev=95781&view=rev > Log: > Fix "the the" and similar typos. > > Modified: > ? ?llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h > ? ?llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h > ? ?llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h > ? ?llvm/trunk/include/llvm/CodeGen/LiveInterval.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineFunction.h > ? ?llvm/trunk/include/llvm/CodeGen/MachineInstr.h > ? ?llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h > ? ?llvm/trunk/include/llvm/GlobalValue.h > ? ?llvm/trunk/include/llvm/InlineAsm.h > ? ?llvm/trunk/include/llvm/Instruction.h > ? ?llvm/trunk/include/llvm/Linker.h > ? ?llvm/trunk/include/llvm/MC/MCSymbol.h > ? ?llvm/trunk/include/llvm/PassManagers.h > ? ?llvm/trunk/include/llvm/Support/IRBuilder.h > ? ?llvm/trunk/include/llvm/System/DynamicLibrary.h > ? ?llvm/trunk/include/llvm/System/Path.h > ? ?llvm/trunk/include/llvm/Target/Target.td > ? ?llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > ? ?llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp > ? ?llvm/trunk/lib/Analysis/LiveValues.cpp > ? ?llvm/trunk/lib/Analysis/MemoryBuiltins.cpp > ? ?llvm/trunk/lib/Analysis/ScalarEvolution.cpp > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h > ? ?llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp > ? ?llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp > ? ?llvm/trunk/lib/CodeGen/MachineFunction.cpp > ? ?llvm/trunk/lib/CodeGen/MachineInstr.cpp > ? ?llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > ? ?llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp > ? ?llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > ? ?llvm/trunk/lib/CodeGen/SlotIndexes.cpp > ? ?llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp > ? ?llvm/trunk/lib/CodeGen/VirtRegMap.cpp > ? ?llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp > ? ?llvm/trunk/lib/Support/APInt.cpp > ? ?llvm/trunk/lib/Target/CBackend/CBackend.cpp > ? ?llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp > ? ?llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp > ? ?llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp > ? ?llvm/trunk/lib/Target/SubtargetFeature.cpp > ? ?llvm/trunk/lib/Target/X86/README-SSE.txt > ? ?llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > ? ?llvm/trunk/lib/Target/X86/X86InstrInfo.td > ? ?llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td > ? ?llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp > ? ?llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp > ? ?llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp > ? ?llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp > ? ?llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp > ? ?llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp > ? ?llvm/trunk/lib/VMCore/IRBuilder.cpp > > Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h (original) > +++ llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h Wed Feb 10 10:03:48 2010 > @@ -72,7 +72,7 @@ > ?// ?free Call Utility Functions. > ?// > > -/// isFreeCall - Returns true if the the value is a call to the builtin free() > +/// isFreeCall - Returns true if the value is a call to the builtin free() > ?bool isFreeCall(const Value *I); > > ?} // End llvm namespace > > Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original) > +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Wed Feb 10 10:03:48 2010 > @@ -291,7 +291,7 @@ > ? /// EmitRecordWithAbbrevImpl - This is the core implementation of the record > ? /// emission code. ?If BlobData is non-null, then it specifies an array of > ? /// data that should be emitted as part of the Blob or Array operand that is > - ?/// known to exist at the end of the the record. > + ?/// known to exist at the end of the record. > ? template > ? void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl &Vals, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? StringRef Blob) { > > Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h Wed Feb 10 10:03:48 2010 > @@ -146,7 +146,7 @@ > ? ? } > ? } > > - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified > + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified > ? /// alignment (saturated to BufferEnd of course). > ? void emitAlignment(unsigned Alignment) { > ? ? if (Alignment == 0) Alignment = 1; > > Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) > +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 10 10:03:48 2010 > @@ -320,7 +320,7 @@ > ? ? /// advanceTo - Advance the specified iterator to point to the LiveRange > ? ? /// containing the specified position, or end() if the position is past the > ? ? /// end of the interval. ?If no LiveRange contains this position, but the > - ? ?/// position is in a hole, this method returns an iterator pointing the the > + ? ?/// position is in a hole, this method returns an iterator pointing the > ? ? /// LiveRange immediately after the hole. > ? ? iterator advanceTo(iterator I, SlotIndex Pos) { > ? ? ? if (Pos >= endIndex()) > > Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Wed Feb 10 10:03:48 2010 > @@ -155,7 +155,7 @@ > ? ? } > ? } > > - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified > + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified > ? /// alignment (saturated to BufferEnd of course). > ? void emitAlignment(unsigned Alignment) { > ? ? if (Alignment == 0) Alignment = 1; > > Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h Wed Feb 10 10:03:48 2010 > @@ -136,7 +136,7 @@ > ? ? : TD(td), PoolAlignment(1) {} > ? ~MachineConstantPool(); > > - ?/// getConstantPoolAlignment - Return the the alignment required by > + ?/// getConstantPoolAlignment - Return the alignment required by > ? /// the whole constant pool, of which the first element must be aligned. > ? unsigned getConstantPoolAlignment() const { return PoolAlignment; } > > > Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Feb 10 10:03:48 2010 > @@ -330,7 +330,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool NoImp = false); > > ? /// CloneMachineInstr - Create a new MachineInstr which is a copy of the > - ?/// 'Orig' instruction, identical in all ways except the the instruction > + ?/// 'Orig' instruction, identical in all ways except the instruction > ? /// has no parent, prev, or next. > ? /// > ? /// See also TargetInstrInfo::duplicate() for target-specific fixes to cloned > > Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Wed Feb 10 10:03:48 2010 > @@ -347,7 +347,7 @@ > > ? /// isInvariantLoad - Return true if this instruction is loading from a > ? /// location whose value is invariant across the function. ?For example, > - ?/// loading a value from the constant pool or from from the argument area of > + ?/// loading a value from the constant pool or from the argument area of > ? /// a function if it does not change. ?This should only return true of *all* > ? /// loads the instruction does are invariant (if it does multiple loads). > ? bool isInvariantLoad(AliasAnalysis *AA) const; > > Modified: llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h (original) > +++ llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h Wed Feb 10 10:03:48 2010 > @@ -81,7 +81,7 @@ > ? /// written to the data stream in big-endian format. > ? void emitDWordBE(uint64_t W); > > - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified > + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified > ? /// alignment (saturated to BufferEnd of course). > ? void emitAlignment(unsigned Alignment = 0, uint8_t fill = 0); > > > Modified: llvm/trunk/include/llvm/GlobalValue.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/GlobalValue.h (original) > +++ llvm/trunk/include/llvm/GlobalValue.h Wed Feb 10 10:03:48 2010 > @@ -92,7 +92,7 @@ > ? void setSection(StringRef S) { Section = S; } > > ? /// If the usage is empty (except transitively dead constants), then this > - ?/// global value can can be safely deleted since the destructor will > + ?/// global value can be safely deleted since the destructor will > ? /// delete the dead constants as well. > ? /// @brief Determine if the usage of this global value is empty except > ? /// for transitively dead constants. > > Modified: llvm/trunk/include/llvm/InlineAsm.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/InlineAsm.h (original) > +++ llvm/trunk/include/llvm/InlineAsm.h Wed Feb 10 10:03:48 2010 > @@ -39,7 +39,7 @@ > ? virtual ~InlineAsm(); > ?public: > > - ?/// InlineAsm::get - Return the the specified uniqued inline asm string. > + ?/// InlineAsm::get - Return the specified uniqued inline asm string. > ? /// > ? static InlineAsm *get(const FunctionType *Ty, StringRef AsmString, > ? ? ? ? ? ? ? ? ? ? ? ? StringRef Constraints, bool hasSideEffects, > > Modified: llvm/trunk/include/llvm/Instruction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Instruction.h (original) > +++ llvm/trunk/include/llvm/Instruction.h Wed Feb 10 10:03:48 2010 > @@ -148,7 +148,7 @@ > ? ? ? getAllMetadataImpl(MDs); > ? } > > - ?/// setMetadata - Set the metadata of of the specified kind to the specified > + ?/// setMetadata - Set the metadata of the specified kind to the specified > ? /// node. ?This updates/replaces metadata if already present, or removes it if > ? /// Node is null. > ? void setMetadata(unsigned KindID, MDNode *Node); > > Modified: llvm/trunk/include/llvm/Linker.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Linker.h (original) > +++ llvm/trunk/include/llvm/Linker.h Wed Feb 10 10:03:48 2010 > @@ -223,7 +223,7 @@ > ? ? /// the archive that resolve outstanding symbols will be linked in. The > ? ? /// library is searched repeatedly until no more modules that resolve > ? ? /// symbols can be found. If an error occurs, the error string is ?set. > - ? ?/// To speed up this function, ensure the the archive has been processed > + ? ?/// To speed up this function, ensure the archive has been processed > ? ? /// llvm-ranlib or the S option was given to llvm-ar when the archive was > ? ? /// created. These tools add a symbol table to the archive which makes the > ? ? /// search for undefined symbols much faster. > > Modified: llvm/trunk/include/llvm/MC/MCSymbol.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) > +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Feb 10 10:03:48 2010 > @@ -89,7 +89,7 @@ > ? ? ? return !isDefined(); > ? ? } > > - ? ?/// isAbsolute - Check if this this is an absolute symbol. > + ? ?/// isAbsolute - Check if this is an absolute symbol. > ? ? bool isAbsolute() const { > ? ? ? return Section == AbsolutePseudoSection; > ? ? } > > Modified: llvm/trunk/include/llvm/PassManagers.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/PassManagers.h (original) > +++ llvm/trunk/include/llvm/PassManagers.h Wed Feb 10 10:03:48 2010 > @@ -394,8 +394,8 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ?const AnalysisUsage::VectorType &Set) const; > > ? // Set of available Analysis. This information is used while scheduling > - ?// pass. If a pass requires an analysis which is not not available then > - ?// equired analysis pass is scheduled to run before the pass itself is > + ?// pass. If a pass requires an analysis which is not available then > + ?// the required analysis pass is scheduled to run before the pass itself is > ? // scheduled to run. > ? std::map AvailableAnalysis; > > > Modified: llvm/trunk/include/llvm/Support/IRBuilder.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) > +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Feb 10 10:03:48 2010 > @@ -94,7 +94,7 @@ > ? //===--------------------------------------------------------------------===// > > ? /// CreateGlobalString - Make a new global variable with an initializer that > - ?/// has array of i8 type filled in the the nul terminated string value > + ?/// has array of i8 type filled in the nul terminated string value > ? /// specified. ?If Name is specified, it is the name of the global variable > ? /// created. > ? Value *CreateGlobalString(const char *Str = "", const Twine &Name = ""); > > Modified: llvm/trunk/include/llvm/System/DynamicLibrary.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/DynamicLibrary.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/System/DynamicLibrary.h (original) > +++ llvm/trunk/include/llvm/System/DynamicLibrary.h Wed Feb 10 10:03:48 2010 > @@ -23,7 +23,7 @@ > ? /// might be known as shared libraries, shared objects, dynamic shared > ? /// objects, or dynamic link libraries. Regardless of the terminology or the > ? /// operating system interface, this class provides a portable interface that > - ?/// allows dynamic libraries to be loaded and and searched for externally > + ?/// allows dynamic libraries to be loaded and searched for externally > ? /// defined symbols. This is typically used to provide "plug-in" support. > ? /// It also allows for symbols to be defined which don't live in any library, > ? /// but rather the main program itself, useful on Windows where the main > > Modified: llvm/trunk/include/llvm/System/Path.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/System/Path.h (original) > +++ llvm/trunk/include/llvm/System/Path.h Wed Feb 10 10:03:48 2010 > @@ -28,7 +28,7 @@ > ? /// platform independent and eliminates many of the unix-specific fields. > ? /// However, to support llvm-ar, the mode, user, and group fields are > ? /// retained. These pertain to unix security and may not have a meaningful > - ?/// value on non-Unix platforms. However, the other fields fields should > + ?/// value on non-Unix platforms. However, the other fields should > ? /// always be applicable on all platforms. ?The structure is filled in by > ? /// the PathWithStatus class. > ? /// @brief File status structure > > Modified: llvm/trunk/include/llvm/Target/Target.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Target/Target.td (original) > +++ llvm/trunk/include/llvm/Target/Target.td Wed Feb 10 10:03:48 2010 > @@ -376,7 +376,7 @@ > > > ?// InstrInfo - This class should only be instantiated once to provide parameters > -// which are global to the the target machine. > +// which are global to the target machine. > ?// > ?class InstrInfo { > ? // If the target wants to associate some target-specific information with each > > Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Wed Feb 10 10:03:48 2010 > @@ -169,7 +169,7 @@ > ? ? return I; > ? } > > - ?/// hasSubClass - return true if the the specified TargetRegisterClass > + ?/// hasSubClass - return true if the specified TargetRegisterClass > ? /// is a proper subset of this TargetRegisterClass. > ? bool hasSubClass(const TargetRegisterClass *cs) const { > ? ? for (int i = 0; SubClasses[i] != NULL; ++i) > > Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) > +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Wed Feb 10 10:03:48 2010 > @@ -486,7 +486,7 @@ > ? ? if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = 0; > ? ? if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = 0; > > - ? ?// If the the two pointers are derived from two different non-addr-taken > + ? ?// If the two pointers are derived from two different non-addr-taken > ? ? // globals, or if one is and the other isn't, we know these can't alias. > ? ? if ((GV1 || GV2) && GV1 != GV2) > ? ? ? return NoAlias; > > Modified: llvm/trunk/lib/Analysis/LiveValues.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LiveValues.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/LiveValues.cpp (original) > +++ llvm/trunk/lib/Analysis/LiveValues.cpp Wed Feb 10 10:03:48 2010 > @@ -184,7 +184,7 @@ > ? ? } > ? } > > - ?// If the value was never used outside the the block in which it was > + ?// If the value was never used outside the block in which it was > ? // defined, it's killed in that block. > ? if (!LiveOutOfDefBB) > ? ? M.Killed.insert(DefBB); > > Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original) > +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Wed Feb 10 10:03:48 2010 > @@ -24,7 +24,7 @@ > ?// ?malloc Call Utility Functions. > ?// > > -/// isMalloc - Returns true if the the value is either a malloc call or a > +/// isMalloc - Returns true if the value is either a malloc call or a > ?/// bitcast of the result of a malloc call. > ?bool llvm::isMalloc(const Value *I) { > ? return extractMallocCall(I) || extractMallocCallFromBitCast(I); > @@ -183,7 +183,7 @@ > ?// ?free Call Utility Functions. > ?// > > -/// isFreeCall - Returns true if the the value is a call to the builtin free() > +/// isFreeCall - Returns true if the value is a call to the builtin free() > ?bool llvm::isFreeCall(const Value *I) { > ? const CallInst *CI = dyn_cast(I); > ? if (!CI) > > Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) > +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Feb 10 10:03:48 2010 > @@ -5032,7 +5032,7 @@ > ? ? if (Step->isOne()) { > ? ? ? // With unit stride, the iteration never steps past the limit value. > ? ? } else if (isKnownPositive(Step)) { > - ? ? ?// Test whether a positive iteration iteration can step past the limit > + ? ? ?// Test whether a positive iteration can step past the limit > ? ? ? // value and past the maximum value for its type in a single step. > ? ? ? // Note that it's not sufficient to check NoWrap here, because even > ? ? ? // though the value after a wrap is undefined, it's not undefined > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Feb 10 10:03:48 2010 > @@ -302,7 +302,7 @@ > ? ? OutStreamer.GetCommentOS() << '\n'; > ? } > > - ?// Emit the CurrentFnSym. ?This is is a virtual function to allow targets to > + ?// Emit the CurrentFnSym. ?This is a virtual function to allow targets to > ? // do their wild and crazy things as required. > ? EmitFunctionEntryLabel(); > > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 10 10:03:48 2010 > @@ -618,7 +618,7 @@ > > ? ?1). ?Add the offset of the forwarding field. > > - ? 2). ?Follow that pointer to get the the real __Block_byref_x_VarName > + ? 2). ?Follow that pointer to get the real __Block_byref_x_VarName > ? ?struct to use (the real one may have been copied onto the heap). > > ? ?3). ?Add the offset for the field VarName, to find the actual variable. > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 10 10:03:48 2010 > @@ -103,7 +103,7 @@ > ? /// > ? SmallVector, 8> SourceIds; > > - ?/// Lines - List of of source line correspondence. > + ?/// Lines - List of source line correspondence. > ? std::vector Lines; > > ? /// DIEValues - A list of all the unique values in use. > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Wed Feb 10 10:03:48 2010 > @@ -103,7 +103,7 @@ > ? /// ? ? exception. ?If it matches then the exception and type id are passed > ? /// ? ? on to the landing pad. ?Otherwise the next action is looked up. ?This > ? /// ? ? chain is terminated with a next action of zero. ?If no type id is > - ?/// ? ? found the the frame is unwound and handling continues. > + ?/// ? ? found the frame is unwound and handling continues. > ? /// ?3. Type id table contains references to all the C++ typeinfo for all > ? /// ? ? catches in the function. ?This tables is reversed indexed base 1. > > > Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) > +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Wed Feb 10 10:03:48 2010 > @@ -115,7 +115,7 @@ > ? // Ask the target's AnalyzeBranch if it can handle this block. > ? MachineBasicBlock *TBB = 0, *FBB = 0; > ? SmallVector Cond; > - ?// Make the the terminator is understood. > + ?// Make the terminator is understood. > ? if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond)) > ? ? return false; > ? // Make sure we have the option of reversing the condition. > > Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) > +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Wed Feb 10 10:03:48 2010 > @@ -7,7 +7,7 @@ > ?// > ?//===----------------------------------------------------------------------===// > ?// > -// This implements a a hazard recognizer using the instructions itineraries > +// This implements a hazard recognizer using the instructions itineraries > ?// defined for the current target. > ?// > ?//===----------------------------------------------------------------------===// > > Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Feb 10 10:03:48 2010 > @@ -187,7 +187,7 @@ > ?} > > ?/// CloneMachineInstr - Create a new MachineInstr which is a copy of the > -/// 'Orig' instruction, identical in all ways except the the instruction > +/// 'Orig' instruction, identical in all ways except the instruction > ?/// has no parent, prev, or next. > ?/// > ?MachineInstr * > > Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Feb 10 10:03:48 2010 > @@ -1034,7 +1034,7 @@ > > ?/// isInvariantLoad - Return true if this instruction is loading from a > ?/// location whose value is invariant across the function. ?For example, > -/// loading a value from the constant pool or from from the argument area > +/// loading a value from the constant pool or from the argument area > ?/// of a function if it does not change. ?This should only return true of > ?/// *all* loads the instruction does are invariant (if it does multiple loads). > ?bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const { > > Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original) > +++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Wed Feb 10 10:03:48 2010 > @@ -9,7 +9,7 @@ > ?// > ?// Heuristic PBQP solver. This solver is able to perform optimal reductions for > ?// nodes of degree 0, 1 or 2. For nodes of degree >2 a plugable heuristic is > -// used to to select a node for reduction. > +// used to select a node for reduction. > ?// > ?//===----------------------------------------------------------------------===// > > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 10 10:03:48 2010 > @@ -2640,7 +2640,7 @@ > > ? ? ? // If the shift is not a no-op (in which case this should be just a sign > ? ? ? // extend already), the truncated to type is legal, sign_extend is legal > - ? ? ?// on that type, and the the truncate to that type is both legal and free, > + ? ? ?// on that type, and the truncate to that type is both legal and free, > ? ? ? // perform the transform. > ? ? ? if ((ShiftAmt > 0) && > ? ? ? ? ? TLI.isOperationLegalOrCustom(ISD::SIGN_EXTEND, TruncVT) && > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 10 10:03:48 2010 > @@ -2767,7 +2767,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(1)); > ? ? } else { > ? ? ? // FIXME: We should be able to fall back to a libcall with an illegal > - ? ? ?// type in some cases cases. > + ? ? ?// type in some cases. > ? ? ? // Also, we can fall back to a division in some cases, but that's a big > ? ? ? // performance hit in the general case. > ? ? ? llvm_unreachable("Don't know how to expand this operation yet!"); > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 10:03:48 2010 > @@ -1349,7 +1349,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getConstant(JTH.First, VT)); > > ? // The SDNode we just created, which holds the value being switched on minus > - ?// the the smallest case value, needs to be copied to a virtual register so it > + ?// the smallest case value, needs to be copied to a virtual register so it > ? // can be used as an index into the jump table in a subsequent basic block. > ? // This value may be smaller or larger than the target's pointer type, and > ? // therefore require extension or truncating. > @@ -4865,7 +4865,7 @@ > ? ? EVT ThisVT = MVT::Other; > > ? ? const TargetRegisterClass *RC = *RCI; > - ? ?// If none of the the value types for this register class are valid, we > + ? ?// If none of the value types for this register class are valid, we > ? ? // can't use it. ?For example, 64-bit reg classes on 32-bit targets. > ? ? for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); > ? ? ? ? ?I != E; ++I) { > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Feb 10 10:03:48 2010 > @@ -2366,7 +2366,7 @@ > ? ? ? ?E = RI->regclass_end(); RCI != E; ++RCI) { > ? ? const TargetRegisterClass *RC = *RCI; > > - ? ?// If none of the the value types for this register class are valid, we > + ? ?// If none of the value types for this register class are valid, we > ? ? // can't use it. ?For example, 64-bit reg classes on 32-bit targets. > ? ? bool isLegal = false; > ? ? for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); > > Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) > +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Feb 10 10:03:48 2010 > @@ -197,7 +197,7 @@ > > ? SlotIndex FillerStart = ValLR->end, FillerEnd = BLR->start; > ? // We are about to delete CopyMI, so need to remove it as the 'instruction > - ?// that defines this value #'. Update the the valnum with the new defining > + ?// that defines this value #'. Update the valnum with the new defining > ? // instruction #. > ? BValNo->def ?= FillerStart; > ? BValNo->setCopy(0); > > Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) > +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Wed Feb 10 10:03:48 2010 > @@ -95,7 +95,7 @@ > > ? push_back(createEntry(0, index)); > > - ?// Iterate over the the function. > + ?// Iterate over the function. > ? for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end(); > ? ? ? ?mbbItr != mbbEnd; ++mbbItr) { > ? ? MachineBasicBlock *mbb = &*mbbItr; > > Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) > +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Feb 10 10:03:48 2010 > @@ -49,7 +49,7 @@ > ? ? std::map > Stacks; > > ? ? // Registers in UsedByAnother are PHI nodes that are themselves > - ? ?// used as operands to another another PHI node > + ? ?// used as operands to another PHI node > ? ? std::set UsedByAnother; > > ? ? // RenameSets are the is a map from a PHI-defined register > > Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) > +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Wed Feb 10 10:03:48 2010 > @@ -9,7 +9,7 @@ > ?// > ?// This file implements the VirtRegMap class. > ?// > -// It also contains implementations of the the Spiller interface, which, given a > +// It also contains implementations of the Spiller interface, which, given a > ?// virtual register map and a machine function, eliminates all virtual > ?// references by replacing them with physical register references - adding spill > ?// code as necessary. > > Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) > +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Feb 10 10:03:48 2010 > @@ -171,7 +171,7 @@ > ? ob->encoding.i = 0; > ? ob->encoding.b.encoding = llvm::dwarf::DW_EH_PE_omit; > > - ?// Put the info on both places, as libgcc uses the first or the the second > + ?// Put the info on both places, as libgcc uses the first or the second > ? // field. Note that we rely on having two pointers here. If fde_end was a > ? // char, things would get complicated. > ? ob->fde_end = (char*)LOI->unseenObjects; > > Modified: llvm/trunk/lib/Support/APInt.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Support/APInt.cpp (original) > +++ llvm/trunk/lib/Support/APInt.cpp Wed Feb 10 10:03:48 2010 > @@ -273,7 +273,7 @@ > ? return clearUnusedBits(); > ?} > > -/// Multiplies an integer array, x by a a uint64_t integer and places the result > +/// Multiplies an integer array, x, by a uint64_t integer and places the result > ?/// into dest. > ?/// @returns the carry out of the multiplication. > ?/// @brief Multiply a multi-digit APInt by a single digit (64-bit) integer. > @@ -1766,7 +1766,7 @@ > > ? // First, compose the values into an array of 32-bit words instead of > ? // 64-bit words. This is a necessity of both the "short division" algorithm > - ?// and the the Knuth "classical algorithm" which requires there to be native > + ?// and the Knuth "classical algorithm" which requires there to be native > ? // operations for +, -, and * on an m bit value with an m*2 bit result. We > ? // can't use 64-bit operands here because we don't have native results of > ? // 128-bits. Furthermore, casting the 64-bit values to 32-bit values won't > > Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) > +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Feb 10 10:03:48 2010 > @@ -1841,7 +1841,7 @@ > ? ? ? return GlobalDtors; > ? } > > - ?// Otherwise, it it is other metadata, don't print it. ?This catches things > + ?// Otherwise, if it is other metadata, don't print it. ?This catches things > ? // like debug information. > ? if (GV->getSection() == "llvm.metadata") > ? ? return NotPrinted; > @@ -3113,7 +3113,7 @@ > ?} > > ?/// visitBuiltinCall - Handle the call to the specified builtin. ?Returns true > -/// if the entire call is handled, return false it it wasn't handled, and > +/// if the entire call is handled, return false if it wasn't handled, and > ?/// optionally set 'WroteCallee' if the callee has already been printed out. > ?bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool &WroteCallee) { > > Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original) > +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Wed Feb 10 10:03:48 2010 > @@ -68,7 +68,7 @@ > ? ? ? TypeNo = TypeNo << PIC16Dbg::S_DERIVED; > ? } > > - ?// We also need to encode the the information about the base type of > + ?// We also need to encode the information about the base type of > ? // pointer in TypeNo. > ? DIType BaseType = DIDerivedType(Ty.getNode()).getTypeDerivedFrom(); > ? PopulateDebugInfo(BaseType, TypeNo, HasAux, Aux, TagName); > > Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp Wed Feb 10 10:03:48 2010 > @@ -118,7 +118,7 @@ > ?} > > ?/// getHazardType - We return hazard for any non-branch instruction that would > -/// terminate terminate the dispatch group. ?We turn NoopHazard for any > +/// terminate the dispatch group. ?We turn NoopHazard for any > ?/// instructions that wouldn't terminate the dispatch group that would cause a > ?/// pipeline flush. > ?ScheduleHazardRecognizer::HazardType PPCHazardRecognizer970:: > > Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Wed Feb 10 10:03:48 2010 > @@ -199,7 +199,7 @@ > ? // Check to see if this function uses vector registers, which means we have to > ? // save and restore the VRSAVE register and update it with the regs we use. > ? // > - ?// In this case, there will be virtual registers of vector type type created > + ?// In this case, there will be virtual registers of vector type created > ? // by the scheduler. ?Detect them now. > ? bool HasVectorVReg = false; > ? for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, > > Modified: llvm/trunk/lib/Target/SubtargetFeature.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SubtargetFeature.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/SubtargetFeature.cpp (original) > +++ llvm/trunk/lib/Target/SubtargetFeature.cpp Wed Feb 10 10:03:48 2010 > @@ -67,7 +67,7 @@ > ? while (true) { > ? ? // Find the next comma > ? ? size_t Comma = S.find(',', Pos); > - ? ?// If no comma found then the the rest of the string is used > + ? ?// If no comma found then the rest of the string is used > ? ? if (Comma == std::string::npos) { > ? ? ? // Add string to vector > ? ? ? V.push_back(S.substr(Pos)); > > Modified: llvm/trunk/lib/Target/X86/README-SSE.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) > +++ llvm/trunk/lib/Target/X86/README-SSE.txt Wed Feb 10 10:03:48 2010 > @@ -376,7 +376,7 @@ > ?... saving two instructions. > > ?The basic idea is that a reload from a spill slot, can, if only one 4-byte > -chunk is used, bring in 3 zeros the the one element instead of 4 elements. > +chunk is used, bring in 3 zeros the one element instead of 4 elements. > ?This can be used to simplify a variety of shuffle operations, where the > ?elements are fixed zeros. > > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 10 10:03:48 2010 > @@ -2172,7 +2172,7 @@ > ? if (IsCalleePop(isVarArg, CallConv)) > ? ? NumBytesForCalleeToPush = NumBytes; ? ?// Callee pops everything > ? else if (!Is64Bit && CallConv != CallingConv::Fast && IsStructRet) > - ? ?// If this is is a call to a struct-return function, the callee > + ? ?// If this is a call to a struct-return function, the callee > ? ? // pops the hidden struct pointer, so we have to push it back. > ? ? // This is common for Darwin/X86, Linux & Mingw32 targets. > ? ? NumBytesForCalleeToPush = 4; > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Feb 10 10:03:48 2010 > @@ -3704,7 +3704,7 @@ > ? ? ? ? ? ? ? ? ? ?"movz{wl|x}\t{$src, $dst|$dst, $src}", > ? ? ? ? ? ? ? ? ? ?[(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; > > -// These are the same as the regular regular MOVZX32rr8 and MOVZX32rm8 > +// These are the same as the regular MOVZX32rr8 and MOVZX32rm8 > ?// except that they use GR32_NOREX for the output operand register class > ?// instead of GR32. This allows them to operate on h registers on x86-64. > ?def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg, > > Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) > +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 10 10:03:48 2010 > @@ -686,7 +686,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? [(set R11, (pcrelwrapper tblockaddress:$addr))]>; > > ?let isCall=1, > -// All calls clobber the the link register and the non-callee-saved registers: > +// All calls clobber the link register and the non-callee-saved registers: > ?Defs = [R0, R1, R2, R3, R11, LR] in { > ?def BL_u10 : _FU10< > ? ? ? ? ? ? ? ? ? (outs), > @@ -779,7 +779,7 @@ > ? ? ? ? ? ? ? ? ?[]>; > > ?let isCall=1, > -// All calls clobber the the link register and the non-callee-saved registers: > +// All calls clobber the link register and the non-callee-saved registers: > ?Defs = [R0, R1, R2, R3, R11, LR] in { > ?def BLA_1r : _F1R<(outs), (ins GRRegs:$addr, variable_ops), > ? ? ? ? ? ? ? ? ?"bla $addr", > > Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Feb 10 10:03:48 2010 > @@ -247,7 +247,7 @@ > ? ? return Low != Set.end() && IsPrefix(*Low, Indices); > ?} > > -/// Mark the given indices (ToMark) as safe in the the given set of indices > +/// Mark the given indices (ToMark) as safe in the given set of indices > ?/// (Safe). Marking safe usually means adding ToMark to Safe. However, if there > ?/// is already a prefix of Indices in Safe, Indices are implicitely marked safe > ?/// already. Furthermore, any indices that Indices is itself a prefix of, are > > Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Wed Feb 10 10:03:48 2010 > @@ -117,7 +117,7 @@ > ? DominatorTree DT; > ? DT.runOnFunction(*duplicateFunction); > > - ?// Extract the body of the the if. > + ?// Extract the body of the if. > ? Function* extractedFunction = ExtractCodeRegion(DT, toExtract); > > ? // Inline the top-level if test into all callers. > > Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) > +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Wed Feb 10 10:03:48 2010 > @@ -546,7 +546,7 @@ > ? ? std::swap(LHSCC, RHSCC); > ? } > > - ?// At this point, we know we have have two icmp instructions > + ?// At this point, we know we have two icmp instructions > ? // comparing a value against two constants and and'ing the result > ? // together. ?Because of the above check, we know that we only have > ? // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know > @@ -1226,7 +1226,7 @@ > ? ? std::swap(LHSCC, RHSCC); > ? } > > - ?// At this point, we know we have have two icmp instructions > + ?// At this point, we know we have two icmp instructions > ? // comparing a value against two constants and or'ing the result > ? // together. ?Because of the above check, we know that we only have > ? // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the > > Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Feb 10 10:03:48 2010 > @@ -380,7 +380,7 @@ > ? ? ? NeedCannIV = true; > ? } > > - ?// Now that we know the largest of of the induction variable expressions > + ?// Now that we know the largest of the induction variable expressions > ? // in this loop, insert a canonical induction variable of the largest size. > ? Value *IndVar = 0; > ? if (NeedCannIV) { > > Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Feb 10 10:03:48 2010 > @@ -249,7 +249,7 @@ > > ?/// LinearizeExprTree - Given an associative binary expression tree, traverse > ?/// all of the uses putting it into canonical form. ?This forces a left-linear > -/// form of the the expression (((a+b)+c)+d), and collects information about the > +/// form of the expression (((a+b)+c)+d), and collects information about the > ?/// rank of the non-tree operands. > ?/// > ?/// NOTE: These intentionally destroys the expression tree operands (turning > @@ -299,7 +299,7 @@ > ? ? Success = false; > ? ? MadeChange = true; > ? } else if (RHSBO) { > - ? ?// Turn (A+B)+(C+D) -> (((A+B)+C)+D). ?This guarantees the the RHS is not > + ? ?// Turn (A+B)+(C+D) -> (((A+B)+C)+D). ?This guarantees the RHS is not > ? ? // part of the expression tree. > ? ? LinearizeExpr(I); > ? ? LHS = LHSBO = cast(I->getOperand(0)); > > Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp Wed Feb 10 10:03:48 2010 > @@ -68,7 +68,7 @@ > ? ? Function *Callee = Call->getCalledFunction(); > > ? ? // Minimally sanity-check the CFG of half_powr to ensure that it contains > - ? ?// the the kind of code we expect. ?If we're running this pass, we have > + ? ?// the kind of code we expect. ?If we're running this pass, we have > ? ? // reason to believe it will be what we expect. > ? ? Function::iterator I = Callee->begin(); > ? ? BasicBlock *Prologue = I++; > > Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff > > ============================================================================== > --- llvm/trunk/lib/VMCore/IRBuilder.cpp (original) > +++ llvm/trunk/lib/VMCore/IRBuilder.cpp Wed Feb 10 10:03:48 2010 > @@ -19,7 +19,7 @@ > ?using namespace llvm; > > ?/// CreateGlobalString - Make a new global variable with an initializer that > -/// has array of i8 type filled in the the nul terminated string value > +/// has array of i8 type filled in the nul terminated string value > ?/// specified. ?If Name is specified, it is the name of the global variable > ?/// created. > ?Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jyasskin at gmail.com Wed Feb 10 11:11:59 2010 From: jyasskin at gmail.com (Jeffrey Yasskin) Date: Wed, 10 Feb 2010 09:11:59 -0800 Subject: [llvm-commits] [llvm] r95781 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/MC/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ lib/Analysis/ lib/Analysis/IPA/ lib/C In-Reply-To: <6a8523d61002100908s5a477855ude0ad6bb7064354e@mail.gmail.com> References: <6a8523d61002100908s5a477855ude0ad6bb7064354e@mail.gmail.com> Message-ID: <5d44f72f1002100911j1c08e81bna6f80ff9a294fdbc@mail.gmail.com> Some of these "the the"s were supposed to be "to the"s instead of "the"s. Can we teach clang to tell the difference? ;) On Wed, Feb 10, 2010 at 9:08 AM, Daniel Dunbar wrote: > Maybe we need -Wcomment-grammar in clang? > > ?- Daniel > > On Wed, Feb 10, 2010 at 8:03 AM, Dan Gohman wrote: >> Author: djg >> Date: Wed Feb 10 10:03:48 2010 >> New Revision: 95781 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95781&view=rev >> Log: >> Fix "the the" and similar typos. >> >> Modified: >> ? ?llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h >> ? ?llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h >> ? ?llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h >> ? ?llvm/trunk/include/llvm/CodeGen/LiveInterval.h >> ? ?llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h >> ? ?llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h >> ? ?llvm/trunk/include/llvm/CodeGen/MachineFunction.h >> ? ?llvm/trunk/include/llvm/CodeGen/MachineInstr.h >> ? ?llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h >> ? ?llvm/trunk/include/llvm/GlobalValue.h >> ? ?llvm/trunk/include/llvm/InlineAsm.h >> ? ?llvm/trunk/include/llvm/Instruction.h >> ? ?llvm/trunk/include/llvm/Linker.h >> ? ?llvm/trunk/include/llvm/MC/MCSymbol.h >> ? ?llvm/trunk/include/llvm/PassManagers.h >> ? ?llvm/trunk/include/llvm/Support/IRBuilder.h >> ? ?llvm/trunk/include/llvm/System/DynamicLibrary.h >> ? ?llvm/trunk/include/llvm/System/Path.h >> ? ?llvm/trunk/include/llvm/Target/Target.td >> ? ?llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >> ? ?llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp >> ? ?llvm/trunk/lib/Analysis/LiveValues.cpp >> ? ?llvm/trunk/lib/Analysis/MemoryBuiltins.cpp >> ? ?llvm/trunk/lib/Analysis/ScalarEvolution.cpp >> ? ?llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp >> ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h >> ? ?llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp >> ? ?llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp >> ? ?llvm/trunk/lib/CodeGen/MachineFunction.cpp >> ? ?llvm/trunk/lib/CodeGen/MachineInstr.cpp >> ? ?llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp >> ? ?llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> ? ?llvm/trunk/lib/CodeGen/SlotIndexes.cpp >> ? ?llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp >> ? ?llvm/trunk/lib/CodeGen/VirtRegMap.cpp >> ? ?llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp >> ? ?llvm/trunk/lib/Support/APInt.cpp >> ? ?llvm/trunk/lib/Target/CBackend/CBackend.cpp >> ? ?llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp >> ? ?llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp >> ? ?llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp >> ? ?llvm/trunk/lib/Target/SubtargetFeature.cpp >> ? ?llvm/trunk/lib/Target/X86/README-SSE.txt >> ? ?llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> ? ?llvm/trunk/lib/Target/X86/X86InstrInfo.td >> ? ?llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td >> ? ?llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp >> ? ?llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp >> ? ?llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp >> ? ?llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp >> ? ?llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp >> ? ?llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp >> ? ?llvm/trunk/lib/VMCore/IRBuilder.cpp >> >> Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h (original) >> +++ llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h Wed Feb 10 10:03:48 2010 >> @@ -72,7 +72,7 @@ >> ?// ?free Call Utility Functions. >> ?// >> >> -/// isFreeCall - Returns true if the the value is a call to the builtin free() >> +/// isFreeCall - Returns true if the value is a call to the builtin free() >> ?bool isFreeCall(const Value *I); >> >> ?} // End llvm namespace >> >> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original) >> +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Wed Feb 10 10:03:48 2010 >> @@ -291,7 +291,7 @@ >> ? /// EmitRecordWithAbbrevImpl - This is the core implementation of the record >> ? /// emission code. ?If BlobData is non-null, then it specifies an array of >> ? /// data that should be emitted as part of the Blob or Array operand that is >> - ?/// known to exist at the end of the the record. >> + ?/// known to exist at the end of the record. >> ? template >> ? void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl &Vals, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? StringRef Blob) { >> >> Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h Wed Feb 10 10:03:48 2010 >> @@ -146,7 +146,7 @@ >> ? ? } >> ? } >> >> - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified >> + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified >> ? /// alignment (saturated to BufferEnd of course). >> ? void emitAlignment(unsigned Alignment) { >> ? ? if (Alignment == 0) Alignment = 1; >> >> Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 10 10:03:48 2010 >> @@ -320,7 +320,7 @@ >> ? ? /// advanceTo - Advance the specified iterator to point to the LiveRange >> ? ? /// containing the specified position, or end() if the position is past the >> ? ? /// end of the interval. ?If no LiveRange contains this position, but the >> - ? ?/// position is in a hole, this method returns an iterator pointing the the >> + ? ?/// position is in a hole, this method returns an iterator pointing the >> ? ? /// LiveRange immediately after the hole. >> ? ? iterator advanceTo(iterator I, SlotIndex Pos) { >> ? ? ? if (Pos >= endIndex()) >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Wed Feb 10 10:03:48 2010 >> @@ -155,7 +155,7 @@ >> ? ? } >> ? } >> >> - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified >> + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified >> ? /// alignment (saturated to BufferEnd of course). >> ? void emitAlignment(unsigned Alignment) { >> ? ? if (Alignment == 0) Alignment = 1; >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h Wed Feb 10 10:03:48 2010 >> @@ -136,7 +136,7 @@ >> ? ? : TD(td), PoolAlignment(1) {} >> ? ~MachineConstantPool(); >> >> - ?/// getConstantPoolAlignment - Return the the alignment required by >> + ?/// getConstantPoolAlignment - Return the alignment required by >> ? /// the whole constant pool, of which the first element must be aligned. >> ? unsigned getConstantPoolAlignment() const { return PoolAlignment; } >> >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Feb 10 10:03:48 2010 >> @@ -330,7 +330,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool NoImp = false); >> >> ? /// CloneMachineInstr - Create a new MachineInstr which is a copy of the >> - ?/// 'Orig' instruction, identical in all ways except the the instruction >> + ?/// 'Orig' instruction, identical in all ways except the instruction >> ? /// has no parent, prev, or next. >> ? /// >> ? /// See also TargetInstrInfo::duplicate() for target-specific fixes to cloned >> >> Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Wed Feb 10 10:03:48 2010 >> @@ -347,7 +347,7 @@ >> >> ? /// isInvariantLoad - Return true if this instruction is loading from a >> ? /// location whose value is invariant across the function. ?For example, >> - ?/// loading a value from the constant pool or from from the argument area of >> + ?/// loading a value from the constant pool or from the argument area of >> ? /// a function if it does not change. ?This should only return true of *all* >> ? /// loads the instruction does are invariant (if it does multiple loads). >> ? bool isInvariantLoad(AliasAnalysis *AA) const; >> >> Modified: llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h Wed Feb 10 10:03:48 2010 >> @@ -81,7 +81,7 @@ >> ? /// written to the data stream in big-endian format. >> ? void emitDWordBE(uint64_t W); >> >> - ?/// emitAlignment - Move the CurBufferPtr pointer up the the specified >> + ?/// emitAlignment - Move the CurBufferPtr pointer up the specified >> ? /// alignment (saturated to BufferEnd of course). >> ? void emitAlignment(unsigned Alignment = 0, uint8_t fill = 0); >> >> >> Modified: llvm/trunk/include/llvm/GlobalValue.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/GlobalValue.h (original) >> +++ llvm/trunk/include/llvm/GlobalValue.h Wed Feb 10 10:03:48 2010 >> @@ -92,7 +92,7 @@ >> ? void setSection(StringRef S) { Section = S; } >> >> ? /// If the usage is empty (except transitively dead constants), then this >> - ?/// global value can can be safely deleted since the destructor will >> + ?/// global value can be safely deleted since the destructor will >> ? /// delete the dead constants as well. >> ? /// @brief Determine if the usage of this global value is empty except >> ? /// for transitively dead constants. >> >> Modified: llvm/trunk/include/llvm/InlineAsm.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InlineAsm.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/InlineAsm.h (original) >> +++ llvm/trunk/include/llvm/InlineAsm.h Wed Feb 10 10:03:48 2010 >> @@ -39,7 +39,7 @@ >> ? virtual ~InlineAsm(); >> ?public: >> >> - ?/// InlineAsm::get - Return the the specified uniqued inline asm string. >> + ?/// InlineAsm::get - Return the specified uniqued inline asm string. >> ? /// >> ? static InlineAsm *get(const FunctionType *Ty, StringRef AsmString, >> ? ? ? ? ? ? ? ? ? ? ? ? StringRef Constraints, bool hasSideEffects, >> >> Modified: llvm/trunk/include/llvm/Instruction.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Instruction.h (original) >> +++ llvm/trunk/include/llvm/Instruction.h Wed Feb 10 10:03:48 2010 >> @@ -148,7 +148,7 @@ >> ? ? ? getAllMetadataImpl(MDs); >> ? } >> >> - ?/// setMetadata - Set the metadata of of the specified kind to the specified >> + ?/// setMetadata - Set the metadata of the specified kind to the specified >> ? /// node. ?This updates/replaces metadata if already present, or removes it if >> ? /// Node is null. >> ? void setMetadata(unsigned KindID, MDNode *Node); >> >> Modified: llvm/trunk/include/llvm/Linker.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Linker.h (original) >> +++ llvm/trunk/include/llvm/Linker.h Wed Feb 10 10:03:48 2010 >> @@ -223,7 +223,7 @@ >> ? ? /// the archive that resolve outstanding symbols will be linked in. The >> ? ? /// library is searched repeatedly until no more modules that resolve >> ? ? /// symbols can be found. If an error occurs, the error string is ?set. >> - ? ?/// To speed up this function, ensure the the archive has been processed >> + ? ?/// To speed up this function, ensure the archive has been processed >> ? ? /// llvm-ranlib or the S option was given to llvm-ar when the archive was >> ? ? /// created. These tools add a symbol table to the archive which makes the >> ? ? /// search for undefined symbols much faster. >> >> Modified: llvm/trunk/include/llvm/MC/MCSymbol.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/MC/MCSymbol.h (original) >> +++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Feb 10 10:03:48 2010 >> @@ -89,7 +89,7 @@ >> ? ? ? return !isDefined(); >> ? ? } >> >> - ? ?/// isAbsolute - Check if this this is an absolute symbol. >> + ? ?/// isAbsolute - Check if this is an absolute symbol. >> ? ? bool isAbsolute() const { >> ? ? ? return Section == AbsolutePseudoSection; >> ? ? } >> >> Modified: llvm/trunk/include/llvm/PassManagers.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/PassManagers.h (original) >> +++ llvm/trunk/include/llvm/PassManagers.h Wed Feb 10 10:03:48 2010 >> @@ -394,8 +394,8 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ?const AnalysisUsage::VectorType &Set) const; >> >> ? // Set of available Analysis. This information is used while scheduling >> - ?// pass. If a pass requires an analysis which is not not available then >> - ?// equired analysis pass is scheduled to run before the pass itself is >> + ?// pass. If a pass requires an analysis which is not available then >> + ?// the required analysis pass is scheduled to run before the pass itself is >> ? // scheduled to run. >> ? std::map AvailableAnalysis; >> >> >> Modified: llvm/trunk/include/llvm/Support/IRBuilder.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) >> +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Feb 10 10:03:48 2010 >> @@ -94,7 +94,7 @@ >> ? //===--------------------------------------------------------------------===// >> >> ? /// CreateGlobalString - Make a new global variable with an initializer that >> - ?/// has array of i8 type filled in the the nul terminated string value >> + ?/// has array of i8 type filled in the nul terminated string value >> ? /// specified. ?If Name is specified, it is the name of the global variable >> ? /// created. >> ? Value *CreateGlobalString(const char *Str = "", const Twine &Name = ""); >> >> Modified: llvm/trunk/include/llvm/System/DynamicLibrary.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/DynamicLibrary.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/System/DynamicLibrary.h (original) >> +++ llvm/trunk/include/llvm/System/DynamicLibrary.h Wed Feb 10 10:03:48 2010 >> @@ -23,7 +23,7 @@ >> ? /// might be known as shared libraries, shared objects, dynamic shared >> ? /// objects, or dynamic link libraries. Regardless of the terminology or the >> ? /// operating system interface, this class provides a portable interface that >> - ?/// allows dynamic libraries to be loaded and and searched for externally >> + ?/// allows dynamic libraries to be loaded and searched for externally >> ? /// defined symbols. This is typically used to provide "plug-in" support. >> ? /// It also allows for symbols to be defined which don't live in any library, >> ? /// but rather the main program itself, useful on Windows where the main >> >> Modified: llvm/trunk/include/llvm/System/Path.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/System/Path.h (original) >> +++ llvm/trunk/include/llvm/System/Path.h Wed Feb 10 10:03:48 2010 >> @@ -28,7 +28,7 @@ >> ? /// platform independent and eliminates many of the unix-specific fields. >> ? /// However, to support llvm-ar, the mode, user, and group fields are >> ? /// retained. These pertain to unix security and may not have a meaningful >> - ?/// value on non-Unix platforms. However, the other fields fields should >> + ?/// value on non-Unix platforms. However, the other fields should >> ? /// always be applicable on all platforms. ?The structure is filled in by >> ? /// the PathWithStatus class. >> ? /// @brief File status structure >> >> Modified: llvm/trunk/include/llvm/Target/Target.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Target/Target.td (original) >> +++ llvm/trunk/include/llvm/Target/Target.td Wed Feb 10 10:03:48 2010 >> @@ -376,7 +376,7 @@ >> >> >> ?// InstrInfo - This class should only be instantiated once to provide parameters >> -// which are global to the the target machine. >> +// which are global to the target machine. >> ?// >> ?class InstrInfo { >> ? // If the target wants to associate some target-specific information with each >> >> Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) >> +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Wed Feb 10 10:03:48 2010 >> @@ -169,7 +169,7 @@ >> ? ? return I; >> ? } >> >> - ?/// hasSubClass - return true if the the specified TargetRegisterClass >> + ?/// hasSubClass - return true if the specified TargetRegisterClass >> ? /// is a proper subset of this TargetRegisterClass. >> ? bool hasSubClass(const TargetRegisterClass *cs) const { >> ? ? for (int i = 0; SubClasses[i] != NULL; ++i) >> >> Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) >> +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Wed Feb 10 10:03:48 2010 >> @@ -486,7 +486,7 @@ >> ? ? if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = 0; >> ? ? if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = 0; >> >> - ? ?// If the the two pointers are derived from two different non-addr-taken >> + ? ?// If the two pointers are derived from two different non-addr-taken >> ? ? // globals, or if one is and the other isn't, we know these can't alias. >> ? ? if ((GV1 || GV2) && GV1 != GV2) >> ? ? ? return NoAlias; >> >> Modified: llvm/trunk/lib/Analysis/LiveValues.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LiveValues.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Analysis/LiveValues.cpp (original) >> +++ llvm/trunk/lib/Analysis/LiveValues.cpp Wed Feb 10 10:03:48 2010 >> @@ -184,7 +184,7 @@ >> ? ? } >> ? } >> >> - ?// If the value was never used outside the the block in which it was >> + ?// If the value was never used outside the block in which it was >> ? // defined, it's killed in that block. >> ? if (!LiveOutOfDefBB) >> ? ? M.Killed.insert(DefBB); >> >> Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original) >> +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Wed Feb 10 10:03:48 2010 >> @@ -24,7 +24,7 @@ >> ?// ?malloc Call Utility Functions. >> ?// >> >> -/// isMalloc - Returns true if the the value is either a malloc call or a >> +/// isMalloc - Returns true if the value is either a malloc call or a >> ?/// bitcast of the result of a malloc call. >> ?bool llvm::isMalloc(const Value *I) { >> ? return extractMallocCall(I) || extractMallocCallFromBitCast(I); >> @@ -183,7 +183,7 @@ >> ?// ?free Call Utility Functions. >> ?// >> >> -/// isFreeCall - Returns true if the the value is a call to the builtin free() >> +/// isFreeCall - Returns true if the value is a call to the builtin free() >> ?bool llvm::isFreeCall(const Value *I) { >> ? const CallInst *CI = dyn_cast(I); >> ? if (!CI) >> >> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) >> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Feb 10 10:03:48 2010 >> @@ -5032,7 +5032,7 @@ >> ? ? if (Step->isOne()) { >> ? ? ? // With unit stride, the iteration never steps past the limit value. >> ? ? } else if (isKnownPositive(Step)) { >> - ? ? ?// Test whether a positive iteration iteration can step past the limit >> + ? ? ?// Test whether a positive iteration can step past the limit >> ? ? ? // value and past the maximum value for its type in a single step. >> ? ? ? // Note that it's not sufficient to check NoWrap here, because even >> ? ? ? // though the value after a wrap is undefined, it's not undefined >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Feb 10 10:03:48 2010 >> @@ -302,7 +302,7 @@ >> ? ? OutStreamer.GetCommentOS() << '\n'; >> ? } >> >> - ?// Emit the CurrentFnSym. ?This is is a virtual function to allow targets to >> + ?// Emit the CurrentFnSym. ?This is a virtual function to allow targets to >> ? // do their wild and crazy things as required. >> ? EmitFunctionEntryLabel(); >> >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 10 10:03:48 2010 >> @@ -618,7 +618,7 @@ >> >> ? ?1). ?Add the offset of the forwarding field. >> >> - ? 2). ?Follow that pointer to get the the real __Block_byref_x_VarName >> + ? 2). ?Follow that pointer to get the real __Block_byref_x_VarName >> ? ?struct to use (the real one may have been copied onto the heap). >> >> ? ?3). ?Add the offset for the field VarName, to find the actual variable. >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 10 10:03:48 2010 >> @@ -103,7 +103,7 @@ >> ? /// >> ? SmallVector, 8> SourceIds; >> >> - ?/// Lines - List of of source line correspondence. >> + ?/// Lines - List of source line correspondence. >> ? std::vector Lines; >> >> ? /// DIEValues - A list of all the unique values in use. >> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Wed Feb 10 10:03:48 2010 >> @@ -103,7 +103,7 @@ >> ? /// ? ? exception. ?If it matches then the exception and type id are passed >> ? /// ? ? on to the landing pad. ?Otherwise the next action is looked up. ?This >> ? /// ? ? chain is terminated with a next action of zero. ?If no type id is >> - ?/// ? ? found the the frame is unwound and handling continues. >> + ?/// ? ? found the frame is unwound and handling continues. >> ? /// ?3. Type id table contains references to all the C++ typeinfo for all >> ? /// ? ? catches in the function. ?This tables is reversed indexed base 1. >> >> >> Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) >> +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Wed Feb 10 10:03:48 2010 >> @@ -115,7 +115,7 @@ >> ? // Ask the target's AnalyzeBranch if it can handle this block. >> ? MachineBasicBlock *TBB = 0, *FBB = 0; >> ? SmallVector Cond; >> - ?// Make the the terminator is understood. >> + ?// Make the terminator is understood. >> ? if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond)) >> ? ? return false; >> ? // Make sure we have the option of reversing the condition. >> >> Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) >> +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Wed Feb 10 10:03:48 2010 >> @@ -7,7 +7,7 @@ >> ?// >> ?//===----------------------------------------------------------------------===// >> ?// >> -// This implements a a hazard recognizer using the instructions itineraries >> +// This implements a hazard recognizer using the instructions itineraries >> ?// defined for the current target. >> ?// >> ?//===----------------------------------------------------------------------===// >> >> Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) >> +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Feb 10 10:03:48 2010 >> @@ -187,7 +187,7 @@ >> ?} >> >> ?/// CloneMachineInstr - Create a new MachineInstr which is a copy of the >> -/// 'Orig' instruction, identical in all ways except the the instruction >> +/// 'Orig' instruction, identical in all ways except the instruction >> ?/// has no parent, prev, or next. >> ?/// >> ?MachineInstr * >> >> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) >> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Feb 10 10:03:48 2010 >> @@ -1034,7 +1034,7 @@ >> >> ?/// isInvariantLoad - Return true if this instruction is loading from a >> ?/// location whose value is invariant across the function. ?For example, >> -/// loading a value from the constant pool or from from the argument area >> +/// loading a value from the constant pool or from the argument area >> ?/// of a function if it does not change. ?This should only return true of >> ?/// *all* loads the instruction does are invariant (if it does multiple loads). >> ?bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const { >> >> Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original) >> +++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Wed Feb 10 10:03:48 2010 >> @@ -9,7 +9,7 @@ >> ?// >> ?// Heuristic PBQP solver. This solver is able to perform optimal reductions for >> ?// nodes of degree 0, 1 or 2. For nodes of degree >2 a plugable heuristic is >> -// used to to select a node for reduction. >> +// used to select a node for reduction. >> ?// >> ?//===----------------------------------------------------------------------===// >> >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 10 10:03:48 2010 >> @@ -2640,7 +2640,7 @@ >> >> ? ? ? // If the shift is not a no-op (in which case this should be just a sign >> ? ? ? // extend already), the truncated to type is legal, sign_extend is legal >> - ? ? ?// on that type, and the the truncate to that type is both legal and free, >> + ? ? ?// on that type, and the truncate to that type is both legal and free, >> ? ? ? // perform the transform. >> ? ? ? if ((ShiftAmt > 0) && >> ? ? ? ? ? TLI.isOperationLegalOrCustom(ISD::SIGN_EXTEND, TruncVT) && >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 10 10:03:48 2010 >> @@ -2767,7 +2767,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getIntPtrConstant(1)); >> ? ? } else { >> ? ? ? // FIXME: We should be able to fall back to a libcall with an illegal >> - ? ? ?// type in some cases cases. >> + ? ? ?// type in some cases. >> ? ? ? // Also, we can fall back to a division in some cases, but that's a big >> ? ? ? // performance hit in the general case. >> ? ? ? llvm_unreachable("Don't know how to expand this operation yet!"); >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 10:03:48 2010 >> @@ -1349,7 +1349,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? DAG.getConstant(JTH.First, VT)); >> >> ? // The SDNode we just created, which holds the value being switched on minus >> - ?// the the smallest case value, needs to be copied to a virtual register so it >> + ?// the smallest case value, needs to be copied to a virtual register so it >> ? // can be used as an index into the jump table in a subsequent basic block. >> ? // This value may be smaller or larger than the target's pointer type, and >> ? // therefore require extension or truncating. >> @@ -4865,7 +4865,7 @@ >> ? ? EVT ThisVT = MVT::Other; >> >> ? ? const TargetRegisterClass *RC = *RCI; >> - ? ?// If none of the the value types for this register class are valid, we >> + ? ?// If none of the value types for this register class are valid, we >> ? ? // can't use it. ?For example, 64-bit reg classes on 32-bit targets. >> ? ? for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); >> ? ? ? ? ?I != E; ++I) { >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Feb 10 10:03:48 2010 >> @@ -2366,7 +2366,7 @@ >> ? ? ? ?E = RI->regclass_end(); RCI != E; ++RCI) { >> ? ? const TargetRegisterClass *RC = *RCI; >> >> - ? ?// If none of the the value types for this register class are valid, we >> + ? ?// If none of the value types for this register class are valid, we >> ? ? // can't use it. ?For example, 64-bit reg classes on 32-bit targets. >> ? ? bool isLegal = false; >> ? ? for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end(); >> >> Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Feb 10 10:03:48 2010 >> @@ -197,7 +197,7 @@ >> >> ? SlotIndex FillerStart = ValLR->end, FillerEnd = BLR->start; >> ? // We are about to delete CopyMI, so need to remove it as the 'instruction >> - ?// that defines this value #'. Update the the valnum with the new defining >> + ?// that defines this value #'. Update the valnum with the new defining >> ? // instruction #. >> ? BValNo->def ?= FillerStart; >> ? BValNo->setCopy(0); >> >> Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Wed Feb 10 10:03:48 2010 >> @@ -95,7 +95,7 @@ >> >> ? push_back(createEntry(0, index)); >> >> - ?// Iterate over the the function. >> + ?// Iterate over the function. >> ? for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end(); >> ? ? ? ?mbbItr != mbbEnd; ++mbbItr) { >> ? ? MachineBasicBlock *mbb = &*mbbItr; >> >> Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) >> +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Feb 10 10:03:48 2010 >> @@ -49,7 +49,7 @@ >> ? ? std::map > Stacks; >> >> ? ? // Registers in UsedByAnother are PHI nodes that are themselves >> - ? ?// used as operands to another another PHI node >> + ? ?// used as operands to another PHI node >> ? ? std::set UsedByAnother; >> >> ? ? // RenameSets are the is a map from a PHI-defined register >> >> Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) >> +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Wed Feb 10 10:03:48 2010 >> @@ -9,7 +9,7 @@ >> ?// >> ?// This file implements the VirtRegMap class. >> ?// >> -// It also contains implementations of the the Spiller interface, which, given a >> +// It also contains implementations of the Spiller interface, which, given a >> ?// virtual register map and a machine function, eliminates all virtual >> ?// references by replacing them with physical register references - adding spill >> ?// code as necessary. >> >> Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) >> +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Feb 10 10:03:48 2010 >> @@ -171,7 +171,7 @@ >> ? ob->encoding.i = 0; >> ? ob->encoding.b.encoding = llvm::dwarf::DW_EH_PE_omit; >> >> - ?// Put the info on both places, as libgcc uses the first or the the second >> + ?// Put the info on both places, as libgcc uses the first or the second >> ? // field. Note that we rely on having two pointers here. If fde_end was a >> ? // char, things would get complicated. >> ? ob->fde_end = (char*)LOI->unseenObjects; >> >> Modified: llvm/trunk/lib/Support/APInt.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Support/APInt.cpp (original) >> +++ llvm/trunk/lib/Support/APInt.cpp Wed Feb 10 10:03:48 2010 >> @@ -273,7 +273,7 @@ >> ? return clearUnusedBits(); >> ?} >> >> -/// Multiplies an integer array, x by a a uint64_t integer and places the result >> +/// Multiplies an integer array, x, by a uint64_t integer and places the result >> ?/// into dest. >> ?/// @returns the carry out of the multiplication. >> ?/// @brief Multiply a multi-digit APInt by a single digit (64-bit) integer. >> @@ -1766,7 +1766,7 @@ >> >> ? // First, compose the values into an array of 32-bit words instead of >> ? // 64-bit words. This is a necessity of both the "short division" algorithm >> - ?// and the the Knuth "classical algorithm" which requires there to be native >> + ?// and the Knuth "classical algorithm" which requires there to be native >> ? // operations for +, -, and * on an m bit value with an m*2 bit result. We >> ? // can't use 64-bit operands here because we don't have native results of >> ? // 128-bits. Furthermore, casting the 64-bit values to 32-bit values won't >> >> Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) >> +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Feb 10 10:03:48 2010 >> @@ -1841,7 +1841,7 @@ >> ? ? ? return GlobalDtors; >> ? } >> >> - ?// Otherwise, it it is other metadata, don't print it. ?This catches things >> + ?// Otherwise, if it is other metadata, don't print it. ?This catches things >> ? // like debug information. >> ? if (GV->getSection() == "llvm.metadata") >> ? ? return NotPrinted; >> @@ -3113,7 +3113,7 @@ >> ?} >> >> ?/// visitBuiltinCall - Handle the call to the specified builtin. ?Returns true >> -/// if the entire call is handled, return false it it wasn't handled, and >> +/// if the entire call is handled, return false if it wasn't handled, and >> ?/// optionally set 'WroteCallee' if the callee has already been printed out. >> ?bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bool &WroteCallee) { >> >> Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original) >> +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Wed Feb 10 10:03:48 2010 >> @@ -68,7 +68,7 @@ >> ? ? ? TypeNo = TypeNo << PIC16Dbg::S_DERIVED; >> ? } >> >> - ?// We also need to encode the the information about the base type of >> + ?// We also need to encode the information about the base type of >> ? // pointer in TypeNo. >> ? DIType BaseType = DIDerivedType(Ty.getNode()).getTypeDerivedFrom(); >> ? PopulateDebugInfo(BaseType, TypeNo, HasAux, Aux, TagName); >> >> Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp (original) >> +++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp Wed Feb 10 10:03:48 2010 >> @@ -118,7 +118,7 @@ >> ?} >> >> ?/// getHazardType - We return hazard for any non-branch instruction that would >> -/// terminate terminate the dispatch group. ?We turn NoopHazard for any >> +/// terminate the dispatch group. ?We turn NoopHazard for any >> ?/// instructions that wouldn't terminate the dispatch group that would cause a >> ?/// pipeline flush. >> ?ScheduleHazardRecognizer::HazardType PPCHazardRecognizer970:: >> >> Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) >> +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Wed Feb 10 10:03:48 2010 >> @@ -199,7 +199,7 @@ >> ? // Check to see if this function uses vector registers, which means we have to >> ? // save and restore the VRSAVE register and update it with the regs we use. >> ? // >> - ?// In this case, there will be virtual registers of vector type type created >> + ?// In this case, there will be virtual registers of vector type created >> ? // by the scheduler. ?Detect them now. >> ? bool HasVectorVReg = false; >> ? for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, >> >> Modified: llvm/trunk/lib/Target/SubtargetFeature.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SubtargetFeature.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/SubtargetFeature.cpp (original) >> +++ llvm/trunk/lib/Target/SubtargetFeature.cpp Wed Feb 10 10:03:48 2010 >> @@ -67,7 +67,7 @@ >> ? while (true) { >> ? ? // Find the next comma >> ? ? size_t Comma = S.find(',', Pos); >> - ? ?// If no comma found then the the rest of the string is used >> + ? ?// If no comma found then the rest of the string is used >> ? ? if (Comma == std::string::npos) { >> ? ? ? // Add string to vector >> ? ? ? V.push_back(S.substr(Pos)); >> >> Modified: llvm/trunk/lib/Target/X86/README-SSE.txt >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) >> +++ llvm/trunk/lib/Target/X86/README-SSE.txt Wed Feb 10 10:03:48 2010 >> @@ -376,7 +376,7 @@ >> ?... saving two instructions. >> >> ?The basic idea is that a reload from a spill slot, can, if only one 4-byte >> -chunk is used, bring in 3 zeros the the one element instead of 4 elements. >> +chunk is used, bring in 3 zeros the one element instead of 4 elements. >> ?This can be used to simplify a variety of shuffle operations, where the >> ?elements are fixed zeros. >> >> >> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 10 10:03:48 2010 >> @@ -2172,7 +2172,7 @@ >> ? if (IsCalleePop(isVarArg, CallConv)) >> ? ? NumBytesForCalleeToPush = NumBytes; ? ?// Callee pops everything >> ? else if (!Is64Bit && CallConv != CallingConv::Fast && IsStructRet) >> - ? ?// If this is is a call to a struct-return function, the callee >> + ? ?// If this is a call to a struct-return function, the callee >> ? ? // pops the hidden struct pointer, so we have to push it back. >> ? ? // This is common for Darwin/X86, Linux & Mingw32 targets. >> ? ? NumBytesForCalleeToPush = 4; >> >> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) >> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Feb 10 10:03:48 2010 >> @@ -3704,7 +3704,7 @@ >> ? ? ? ? ? ? ? ? ? ?"movz{wl|x}\t{$src, $dst|$dst, $src}", >> ? ? ? ? ? ? ? ? ? ?[(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; >> >> -// These are the same as the regular regular MOVZX32rr8 and MOVZX32rm8 >> +// These are the same as the regular MOVZX32rr8 and MOVZX32rm8 >> ?// except that they use GR32_NOREX for the output operand register class >> ?// instead of GR32. This allows them to operate on h registers on x86-64. >> ?def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg, >> >> Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original) >> +++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Feb 10 10:03:48 2010 >> @@ -686,7 +686,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? [(set R11, (pcrelwrapper tblockaddress:$addr))]>; >> >> ?let isCall=1, >> -// All calls clobber the the link register and the non-callee-saved registers: >> +// All calls clobber the link register and the non-callee-saved registers: >> ?Defs = [R0, R1, R2, R3, R11, LR] in { >> ?def BL_u10 : _FU10< >> ? ? ? ? ? ? ? ? ? (outs), >> @@ -779,7 +779,7 @@ >> ? ? ? ? ? ? ? ? ?[]>; >> >> ?let isCall=1, >> -// All calls clobber the the link register and the non-callee-saved registers: >> +// All calls clobber the link register and the non-callee-saved registers: >> ?Defs = [R0, R1, R2, R3, R11, LR] in { >> ?def BLA_1r : _F1R<(outs), (ins GRRegs:$addr, variable_ops), >> ? ? ? ? ? ? ? ? ?"bla $addr", >> >> Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Feb 10 10:03:48 2010 >> @@ -247,7 +247,7 @@ >> ? ? return Low != Set.end() && IsPrefix(*Low, Indices); >> ?} >> >> -/// Mark the given indices (ToMark) as safe in the the given set of indices >> +/// Mark the given indices (ToMark) as safe in the given set of indices >> ?/// (Safe). Marking safe usually means adding ToMark to Safe. However, if there >> ?/// is already a prefix of Indices in Safe, Indices are implicitely marked safe >> ?/// already. Furthermore, any indices that Indices is itself a prefix of, are >> >> Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original) >> +++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Wed Feb 10 10:03:48 2010 >> @@ -117,7 +117,7 @@ >> ? DominatorTree DT; >> ? DT.runOnFunction(*duplicateFunction); >> >> - ?// Extract the body of the the if. >> + ?// Extract the body of the if. >> ? Function* extractedFunction = ExtractCodeRegion(DT, toExtract); >> >> ? // Inline the top-level if test into all callers. >> >> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) >> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Wed Feb 10 10:03:48 2010 >> @@ -546,7 +546,7 @@ >> ? ? std::swap(LHSCC, RHSCC); >> ? } >> >> - ?// At this point, we know we have have two icmp instructions >> + ?// At this point, we know we have two icmp instructions >> ? // comparing a value against two constants and and'ing the result >> ? // together. ?Because of the above check, we know that we only have >> ? // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know >> @@ -1226,7 +1226,7 @@ >> ? ? std::swap(LHSCC, RHSCC); >> ? } >> >> - ?// At this point, we know we have have two icmp instructions >> + ?// At this point, we know we have two icmp instructions >> ? // comparing a value against two constants and or'ing the result >> ? // together. ?Because of the above check, we know that we only have >> ? // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the >> >> Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) >> +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Feb 10 10:03:48 2010 >> @@ -380,7 +380,7 @@ >> ? ? ? NeedCannIV = true; >> ? } >> >> - ?// Now that we know the largest of of the induction variable expressions >> + ?// Now that we know the largest of the induction variable expressions >> ? // in this loop, insert a canonical induction variable of the largest size. >> ? Value *IndVar = 0; >> ? if (NeedCannIV) { >> >> Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) >> +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Feb 10 10:03:48 2010 >> @@ -249,7 +249,7 @@ >> >> ?/// LinearizeExprTree - Given an associative binary expression tree, traverse >> ?/// all of the uses putting it into canonical form. ?This forces a left-linear >> -/// form of the the expression (((a+b)+c)+d), and collects information about the >> +/// form of the expression (((a+b)+c)+d), and collects information about the >> ?/// rank of the non-tree operands. >> ?/// >> ?/// NOTE: These intentionally destroys the expression tree operands (turning >> @@ -299,7 +299,7 @@ >> ? ? Success = false; >> ? ? MadeChange = true; >> ? } else if (RHSBO) { >> - ? ?// Turn (A+B)+(C+D) -> (((A+B)+C)+D). ?This guarantees the the RHS is not >> + ? ?// Turn (A+B)+(C+D) -> (((A+B)+C)+D). ?This guarantees the RHS is not >> ? ? // part of the expression tree. >> ? ? LinearizeExpr(I); >> ? ? LHS = LHSBO = cast(I->getOperand(0)); >> >> Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp (original) >> +++ llvm/trunk/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp Wed Feb 10 10:03:48 2010 >> @@ -68,7 +68,7 @@ >> ? ? Function *Callee = Call->getCalledFunction(); >> >> ? ? // Minimally sanity-check the CFG of half_powr to ensure that it contains >> - ? ?// the the kind of code we expect. ?If we're running this pass, we have >> + ? ?// the kind of code we expect. ?If we're running this pass, we have >> ? ? // reason to believe it will be what we expect. >> ? ? Function::iterator I = Callee->begin(); >> ? ? BasicBlock *Prologue = I++; >> >> Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=95781&r1=95780&r2=95781&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/VMCore/IRBuilder.cpp (original) >> +++ llvm/trunk/lib/VMCore/IRBuilder.cpp Wed Feb 10 10:03:48 2010 >> @@ -19,7 +19,7 @@ >> ?using namespace llvm; >> >> ?/// CreateGlobalString - Make a new global variable with an initializer that >> -/// has array of i8 type filled in the the nul terminated string value >> +/// has array of i8 type filled in the nul terminated string value >> ?/// specified. ?If Name is specified, it is the name of the global variable >> ?/// created. >> ?Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) { >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> From johnny.chen at apple.com Wed Feb 10 12:02:25 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 10 Feb 2010 18:02:25 -0000 Subject: [llvm-commits] [llvm] r95784 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <201002101802.o1AI2P1H006642@zion.cs.uiuc.edu> Author: johnny Date: Wed Feb 10 12:02:25 2010 New Revision: 95784 URL: http://llvm.org/viewvc/llvm-project?rev=95784&view=rev Log: Added NOP, DBG, SVC to the instruction table for disassembly purpose. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95784&r1=95783&r2=95784&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Feb 10 12:02:25 2010 @@ -605,6 +605,20 @@ [(ARMcallseq_start timm:$amt)]>; } +def NOP : AI<(outs), (ins), Pseudo, NoItinerary, "nop", "", + [/* For disassembly only; pattern left blank */]>, + Requires<[IsARM, HasV6T2]> { + let Inst{27-16} = 0b001100100000; + let Inst{7-0} = 0b00000000; +} + +def DBG : AI<(outs), (ins i32imm:$opt), Pseudo, NoItinerary, "dbg", "\t$opt", + [/* For disassembly only; pattern left blank */]>, + Requires<[IsARM, HasV7]> { + let Inst{27-16} = 0b001100100000; + let Inst{7-4} = 0b1111; +} + // Address computation and loads and stores in PIC mode. let isNotDuplicable = 1 in { def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), @@ -827,6 +841,12 @@ [/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>; } +// Supervisor call (software interrupt) -- for disassembly only +let isCall = 1 in { +def SVC : ABI<0b1111, (outs), (ins i32imm:$svc), IIC_Br, "svc", "\t$svc", + [/* For disassembly only; pattern left blank */]>; +} + //===----------------------------------------------------------------------===// // Load / store Instructions. // From dalej at apple.com Wed Feb 10 12:42:07 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 10:42:07 -0800 Subject: [llvm-commits] [llvm] r95749 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: References: <201002100131.o1A1VQ5S011223@zion.cs.uiuc.edu> Message-ID: <299E9F33-80D9-4D42-8B4B-138C01FFAA35@apple.com> On Feb 9, 2010, at 6:02 PMPST, Chris Lattner wrote: > > On Feb 9, 2010, at 5:31 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Tue Feb 9 19:31:26 2010 >> New Revision: 95749 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95749&view=rev >> Log: >> Rewrite loop to suit Chris' preference. > > The second !mi->isDebugValue() you added is now dead. That is needed for the case where a block ends with DEBUG_VALUE. Without that check baseIndex would point too far ahead after the loop. > -Chris > >> >> >> Modified: >> llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp >> >> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95749&r1=95748&r2=95749&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) >> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Feb 9 >> 19:31:26 2010 >> @@ -611,23 +611,26 @@ >> >> MachineBasicBlock::iterator E = MBB->end(); >> while (mi != E) { >> - if (!mi->isDebugValue()) { >> - if (mi->killsRegister(interval.reg, tri_)) { >> - DEBUG(dbgs() << " killed"); >> - end = baseIndex.getDefIndex(); >> - SeenDefUse = true; >> - break; >> - } else if (mi->modifiesRegister(interval.reg, tri_)) { >> - // Another instruction redefines the register before it is >> ever read. >> - // Then the register is essentially dead at the >> instruction that defines >> - // it. Hence its interval is: >> - // [defSlot(def), defSlot(def)+1) >> - DEBUG(dbgs() << " dead"); >> - end = start.getStoreIndex(); >> - SeenDefUse = true; >> - break; >> - } >> + if (mi->isDebugValue()) { >> + ++mi; >> + continue; >> } >> + if (mi->killsRegister(interval.reg, tri_)) { >> + DEBUG(dbgs() << " killed"); >> + end = baseIndex.getDefIndex(); >> + SeenDefUse = true; >> + break; >> + } else if (mi->modifiesRegister(interval.reg, tri_)) { >> + // Another instruction redefines the register before it is >> ever read. >> + // Then the register is essentially dead at the instruction >> that defines >> + // it. Hence its interval is: >> + // [defSlot(def), defSlot(def)+1) >> + DEBUG(dbgs() << " dead"); >> + end = start.getStoreIndex(); >> + SeenDefUse = true; >> + break; >> + } >> + >> ++mi; >> if (mi != E && !mi->isDebugValue()) { >> baseIndex = indexes_->getNextNonNullIndex(baseIndex); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From enderby at apple.com Wed Feb 10 13:13:57 2010 From: enderby at apple.com (Kevin Enderby) Date: Wed, 10 Feb 2010 19:13:57 -0000 Subject: [llvm-commits] [llvm] r95791 - /llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Message-ID: <201002101913.o1AJDvIg010105@zion.cs.uiuc.edu> Author: enderby Date: Wed Feb 10 13:13:56 2010 New Revision: 95791 URL: http://llvm.org/viewvc/llvm-project?rev=95791&view=rev Log: Replace this file containing 4 tests of x86 32-bit encodings with a file containing the subset of the full auto generated test case that currently encodes correctly. Again it is useful as we bring up the the new encoder to make sure currently working stuff stays working. Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=95791&r1=95790&r2=95791&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Wed Feb 10 13:13:56 2010 @@ -1,13 +1,9861 @@ -// RUN: llvm-mc -triple i386-unknown-unknown %s -show-encoding | FileCheck %s +// RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s -fisttpl 3735928559(%ebx,%ecx,8) -# CHECK: encoding: [0xdb,0x8c,0xcb,0xef,0xbe,0xad,0xde] +// CHECK: movb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc6,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] + movb $0x7f,0xdeadbeef(%ebx,%ecx,8) -sbbb $0xfe,0xdeadbeef(%ebx,%ecx,8) -# CHECK: encoding: [0x80,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xfe] +// CHECK: movb $127, 69 +// CHECK: encoding: [0xc6,0x05,0x45,0x00,0x00,0x00,0x7f] + movb $0x7f,0x45 -psllw 69, %mm3 -# CHECK: encoding: [0x0f,0xf1,0x1d,0x45,0x00,0x00,0x00] +// CHECK: movb $127, 32493 +// CHECK: encoding: [0xc6,0x05,0xed,0x7e,0x00,0x00,0x7f] + movb $0x7f,0x7eed -movntdqa 0xdeadbeef(%ebx,%ecx,8),%xmm5 -# CHECK: encoding: [0x66,0x0f,0x38,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] +// CHECK: movb $127, 3133065982 +// CHECK: encoding: [0xc6,0x05,0xfe,0xca,0xbe,0xba,0x7f] + movb $0x7f,0xbabecafe + +// CHECK: movb $127, 305419896 +// CHECK: encoding: [0xc6,0x05,0x78,0x56,0x34,0x12,0x7f] + movb $0x7f,0x12345678 + +// CHECK: movw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0xc7,0x84,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + movw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movw $31438, 69 +// CHECK: encoding: [0x66,0xc7,0x05,0x45,0x00,0x00,0x00,0xce,0x7a] + movw $0x7ace,0x45 + +// CHECK: movw $31438, 32493 +// CHECK: encoding: [0x66,0xc7,0x05,0xed,0x7e,0x00,0x00,0xce,0x7a] + movw $0x7ace,0x7eed + +// CHECK: movw $31438, 3133065982 +// CHECK: encoding: [0x66,0xc7,0x05,0xfe,0xca,0xbe,0xba,0xce,0x7a] + movw $0x7ace,0xbabecafe + +// CHECK: movw $31438, 305419896 +// CHECK: encoding: [0x66,0xc7,0x05,0x78,0x56,0x34,0x12,0xce,0x7a] + movw $0x7ace,0x12345678 + +// CHECK: movl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc7,0x84,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + movl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movl $2063514302, 69 +// CHECK: encoding: [0xc7,0x05,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + movl $0x7afebabe,0x45 + +// CHECK: movl $2063514302, 32493 +// CHECK: encoding: [0xc7,0x05,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + movl $0x7afebabe,0x7eed + +// CHECK: movl $2063514302, 3133065982 +// CHECK: encoding: [0xc7,0x05,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + movl $0x7afebabe,0xbabecafe + +// CHECK: movl $2063514302, 305419896 +// CHECK: encoding: [0xc7,0x05,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + movl $0x7afebabe,0x12345678 + +// CHECK: movl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc7,0x84,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + movl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movl $324478056, 69 +// CHECK: encoding: [0xc7,0x05,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + movl $0x13572468,0x45 + +// CHECK: movl $324478056, 32493 +// CHECK: encoding: [0xc7,0x05,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + movl $0x13572468,0x7eed + +// CHECK: movl $324478056, 3133065982 +// CHECK: encoding: [0xc7,0x05,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + movl $0x13572468,0xbabecafe + +// CHECK: movl $324478056, 305419896 +// CHECK: encoding: [0xc7,0x05,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + movl $0x13572468,0x12345678 + +// CHECK: movsbl 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0x0f,0xbe,0x8c,0xcb,0xef,0xbe,0xad,0xde] + movsbl 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: movsbl 69, %ecx +// CHECK: encoding: [0x0f,0xbe,0x0d,0x45,0x00,0x00,0x00] + movsbl 0x45,%ecx + +// CHECK: movsbl 32493, %ecx +// CHECK: encoding: [0x0f,0xbe,0x0d,0xed,0x7e,0x00,0x00] + movsbl 0x7eed,%ecx + +// CHECK: movsbl 3133065982, %ecx +// CHECK: encoding: [0x0f,0xbe,0x0d,0xfe,0xca,0xbe,0xba] + movsbl 0xbabecafe,%ecx + +// CHECK: movsbl 305419896, %ecx +// CHECK: encoding: [0x0f,0xbe,0x0d,0x78,0x56,0x34,0x12] + movsbl 0x12345678,%ecx + +// CHECK: movsbw 3735928559(%ebx,%ecx,8), %bx +// CHECK: encoding: [0x66,0x0f,0xbe,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movsbw 0xdeadbeef(%ebx,%ecx,8),%bx + +// CHECK: movsbw 69, %bx +// CHECK: encoding: [0x66,0x0f,0xbe,0x1d,0x45,0x00,0x00,0x00] + movsbw 0x45,%bx + +// CHECK: movsbw 32493, %bx +// CHECK: encoding: [0x66,0x0f,0xbe,0x1d,0xed,0x7e,0x00,0x00] + movsbw 0x7eed,%bx + +// CHECK: movsbw 3133065982, %bx +// CHECK: encoding: [0x66,0x0f,0xbe,0x1d,0xfe,0xca,0xbe,0xba] + movsbw 0xbabecafe,%bx + +// CHECK: movsbw 305419896, %bx +// CHECK: encoding: [0x66,0x0f,0xbe,0x1d,0x78,0x56,0x34,0x12] + movsbw 0x12345678,%bx + +// CHECK: movswl 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0x0f,0xbf,0x8c,0xcb,0xef,0xbe,0xad,0xde] + movswl 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: movswl 69, %ecx +// CHECK: encoding: [0x0f,0xbf,0x0d,0x45,0x00,0x00,0x00] + movswl 0x45,%ecx + +// CHECK: movswl 32493, %ecx +// CHECK: encoding: [0x0f,0xbf,0x0d,0xed,0x7e,0x00,0x00] + movswl 0x7eed,%ecx + +// CHECK: movswl 3133065982, %ecx +// CHECK: encoding: [0x0f,0xbf,0x0d,0xfe,0xca,0xbe,0xba] + movswl 0xbabecafe,%ecx + +// CHECK: movswl 305419896, %ecx +// CHECK: encoding: [0x0f,0xbf,0x0d,0x78,0x56,0x34,0x12] + movswl 0x12345678,%ecx + +// CHECK: movzbl 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0x0f,0xb6,0x8c,0xcb,0xef,0xbe,0xad,0xde] + movzbl 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: movzbl 69, %ecx +// CHECK: encoding: [0x0f,0xb6,0x0d,0x45,0x00,0x00,0x00] + movzbl 0x45,%ecx + +// CHECK: movzbl 32493, %ecx +// CHECK: encoding: [0x0f,0xb6,0x0d,0xed,0x7e,0x00,0x00] + movzbl 0x7eed,%ecx + +// CHECK: movzbl 3133065982, %ecx +// CHECK: encoding: [0x0f,0xb6,0x0d,0xfe,0xca,0xbe,0xba] + movzbl 0xbabecafe,%ecx + +// CHECK: movzbl 305419896, %ecx +// CHECK: encoding: [0x0f,0xb6,0x0d,0x78,0x56,0x34,0x12] + movzbl 0x12345678,%ecx + +// CHECK: movzbw 3735928559(%ebx,%ecx,8), %bx +// CHECK: encoding: [0x66,0x0f,0xb6,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movzbw 0xdeadbeef(%ebx,%ecx,8),%bx + +// CHECK: movzbw 69, %bx +// CHECK: encoding: [0x66,0x0f,0xb6,0x1d,0x45,0x00,0x00,0x00] + movzbw 0x45,%bx + +// CHECK: movzbw 32493, %bx +// CHECK: encoding: [0x66,0x0f,0xb6,0x1d,0xed,0x7e,0x00,0x00] + movzbw 0x7eed,%bx + +// CHECK: movzbw 3133065982, %bx +// CHECK: encoding: [0x66,0x0f,0xb6,0x1d,0xfe,0xca,0xbe,0xba] + movzbw 0xbabecafe,%bx + +// CHECK: movzbw 305419896, %bx +// CHECK: encoding: [0x66,0x0f,0xb6,0x1d,0x78,0x56,0x34,0x12] + movzbw 0x12345678,%bx + +// CHECK: movzwl 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0x0f,0xb7,0x8c,0xcb,0xef,0xbe,0xad,0xde] + movzwl 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: movzwl 69, %ecx +// CHECK: encoding: [0x0f,0xb7,0x0d,0x45,0x00,0x00,0x00] + movzwl 0x45,%ecx + +// CHECK: movzwl 32493, %ecx +// CHECK: encoding: [0x0f,0xb7,0x0d,0xed,0x7e,0x00,0x00] + movzwl 0x7eed,%ecx + +// CHECK: movzwl 3133065982, %ecx +// CHECK: encoding: [0x0f,0xb7,0x0d,0xfe,0xca,0xbe,0xba] + movzwl 0xbabecafe,%ecx + +// CHECK: movzwl 305419896, %ecx +// CHECK: encoding: [0x0f,0xb7,0x0d,0x78,0x56,0x34,0x12] + movzwl 0x12345678,%ecx + +// CHECK: pushl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0xb4,0xcb,0xef,0xbe,0xad,0xde] + pushl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: pushw 32493 +// CHECK: encoding: [0x66,0xff,0x35,0xed,0x7e,0x00,0x00] + pushw 0x7eed + +// CHECK: pushl 3133065982 +// CHECK: encoding: [0xff,0x35,0xfe,0xca,0xbe,0xba] + pushl 0xbabecafe + +// CHECK: pushl 305419896 +// CHECK: encoding: [0xff,0x35,0x78,0x56,0x34,0x12] + pushl 0x12345678 + +// CHECK: popl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x8f,0x84,0xcb,0xef,0xbe,0xad,0xde] + popl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: popw 32493 +// CHECK: encoding: [0x66,0x8f,0x05,0xed,0x7e,0x00,0x00] + popw 0x7eed + +// CHECK: popl 3133065982 +// CHECK: encoding: [0x8f,0x05,0xfe,0xca,0xbe,0xba] + popl 0xbabecafe + +// CHECK: popl 305419896 +// CHECK: encoding: [0x8f,0x05,0x78,0x56,0x34,0x12] + popl 0x12345678 + +// CHECK: clc +// CHECK: encoding: [0xf8] + clc + +// CHECK: cld +// CHECK: encoding: [0xfc] + cld + +// CHECK: cli +// CHECK: encoding: [0xfa] + cli + +// CHECK: clts +// CHECK: encoding: [0x0f,0x06] + clts + +// CHECK: cmc +// CHECK: encoding: [0xf5] + cmc + +// CHECK: lahf +// CHECK: encoding: [0x9f] + lahf + +// CHECK: sahf +// CHECK: encoding: [0x9e] + sahf + +// CHECK: stc +// CHECK: encoding: [0xf9] + stc + +// CHECK: std +// CHECK: encoding: [0xfd] + std + +// CHECK: sti +// CHECK: encoding: [0xfb] + sti + +// CHECK: addb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x84,0xcb,0xef,0xbe,0xad,0xde,0xfe] + addb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: addb $254, 69 +// CHECK: encoding: [0x80,0x05,0x45,0x00,0x00,0x00,0xfe] + addb $0xfe,0x45 + +// CHECK: addb $254, 32493 +// CHECK: encoding: [0x80,0x05,0xed,0x7e,0x00,0x00,0xfe] + addb $0xfe,0x7eed + +// CHECK: addb $254, 3133065982 +// CHECK: encoding: [0x80,0x05,0xfe,0xca,0xbe,0xba,0xfe] + addb $0xfe,0xbabecafe + +// CHECK: addb $254, 305419896 +// CHECK: encoding: [0x80,0x05,0x78,0x56,0x34,0x12,0xfe] + addb $0xfe,0x12345678 + +// CHECK: addb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] + addb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: addb $127, 69 +// CHECK: encoding: [0x80,0x05,0x45,0x00,0x00,0x00,0x7f] + addb $0x7f,0x45 + +// CHECK: addb $127, 32493 +// CHECK: encoding: [0x80,0x05,0xed,0x7e,0x00,0x00,0x7f] + addb $0x7f,0x7eed + +// CHECK: addb $127, 3133065982 +// CHECK: encoding: [0x80,0x05,0xfe,0xca,0xbe,0xba,0x7f] + addb $0x7f,0xbabecafe + +// CHECK: addb $127, 305419896 +// CHECK: encoding: [0x80,0x05,0x78,0x56,0x34,0x12,0x7f] + addb $0x7f,0x12345678 + +// CHECK: addw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0x84,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + addw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: addw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x05,0x45,0x00,0x00,0x00,0xce,0x7a] + addw $0x7ace,0x45 + +// CHECK: addw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x05,0xed,0x7e,0x00,0x00,0xce,0x7a] + addw $0x7ace,0x7eed + +// CHECK: addw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x05,0xfe,0xca,0xbe,0xba,0xce,0x7a] + addw $0x7ace,0xbabecafe + +// CHECK: addw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x05,0x78,0x56,0x34,0x12,0xce,0x7a] + addw $0x7ace,0x12345678 + +// CHECK: addl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x84,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + addl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: addl $2063514302, 69 +// CHECK: encoding: [0x81,0x05,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + addl $0x7afebabe,0x45 + +// CHECK: addl $2063514302, 32493 +// CHECK: encoding: [0x81,0x05,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + addl $0x7afebabe,0x7eed + +// CHECK: addl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x05,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + addl $0x7afebabe,0xbabecafe + +// CHECK: addl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x05,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + addl $0x7afebabe,0x12345678 + +// CHECK: addl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x84,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + addl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: addl $324478056, 69 +// CHECK: encoding: [0x81,0x05,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + addl $0x13572468,0x45 + +// CHECK: addl $324478056, 32493 +// CHECK: encoding: [0x81,0x05,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + addl $0x13572468,0x7eed + +// CHECK: addl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x05,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + addl $0x13572468,0xbabecafe + +// CHECK: addl $324478056, 305419896 +// CHECK: encoding: [0x81,0x05,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + addl $0x13572468,0x12345678 + +// CHECK: incl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0x84,0xcb,0xef,0xbe,0xad,0xde] + incl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: incw 32493 +// CHECK: encoding: [0x66,0xff,0x05,0xed,0x7e,0x00,0x00] + incw 0x7eed + +// CHECK: incl 3133065982 +// CHECK: encoding: [0xff,0x05,0xfe,0xca,0xbe,0xba] + incl 0xbabecafe + +// CHECK: incl 305419896 +// CHECK: encoding: [0xff,0x05,0x78,0x56,0x34,0x12] + incl 0x12345678 + +// CHECK: subb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xac,0xcb,0xef,0xbe,0xad,0xde,0xfe] + subb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: subb $254, 69 +// CHECK: encoding: [0x80,0x2d,0x45,0x00,0x00,0x00,0xfe] + subb $0xfe,0x45 + +// CHECK: subb $254, 32493 +// CHECK: encoding: [0x80,0x2d,0xed,0x7e,0x00,0x00,0xfe] + subb $0xfe,0x7eed + +// CHECK: subb $254, 3133065982 +// CHECK: encoding: [0x80,0x2d,0xfe,0xca,0xbe,0xba,0xfe] + subb $0xfe,0xbabecafe + +// CHECK: subb $254, 305419896 +// CHECK: encoding: [0x80,0x2d,0x78,0x56,0x34,0x12,0xfe] + subb $0xfe,0x12345678 + +// CHECK: subb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xac,0xcb,0xef,0xbe,0xad,0xde,0x7f] + subb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: subb $127, 69 +// CHECK: encoding: [0x80,0x2d,0x45,0x00,0x00,0x00,0x7f] + subb $0x7f,0x45 + +// CHECK: subb $127, 32493 +// CHECK: encoding: [0x80,0x2d,0xed,0x7e,0x00,0x00,0x7f] + subb $0x7f,0x7eed + +// CHECK: subb $127, 3133065982 +// CHECK: encoding: [0x80,0x2d,0xfe,0xca,0xbe,0xba,0x7f] + subb $0x7f,0xbabecafe + +// CHECK: subb $127, 305419896 +// CHECK: encoding: [0x80,0x2d,0x78,0x56,0x34,0x12,0x7f] + subb $0x7f,0x12345678 + +// CHECK: subw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0xac,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + subw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: subw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x2d,0x45,0x00,0x00,0x00,0xce,0x7a] + subw $0x7ace,0x45 + +// CHECK: subw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x2d,0xed,0x7e,0x00,0x00,0xce,0x7a] + subw $0x7ace,0x7eed + +// CHECK: subw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x2d,0xfe,0xca,0xbe,0xba,0xce,0x7a] + subw $0x7ace,0xbabecafe + +// CHECK: subw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x2d,0x78,0x56,0x34,0x12,0xce,0x7a] + subw $0x7ace,0x12345678 + +// CHECK: subl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xac,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + subl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: subl $2063514302, 69 +// CHECK: encoding: [0x81,0x2d,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + subl $0x7afebabe,0x45 + +// CHECK: subl $2063514302, 32493 +// CHECK: encoding: [0x81,0x2d,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + subl $0x7afebabe,0x7eed + +// CHECK: subl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x2d,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + subl $0x7afebabe,0xbabecafe + +// CHECK: subl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x2d,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + subl $0x7afebabe,0x12345678 + +// CHECK: subl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xac,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + subl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: subl $324478056, 69 +// CHECK: encoding: [0x81,0x2d,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + subl $0x13572468,0x45 + +// CHECK: subl $324478056, 32493 +// CHECK: encoding: [0x81,0x2d,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + subl $0x13572468,0x7eed + +// CHECK: subl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x2d,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + subl $0x13572468,0xbabecafe + +// CHECK: subl $324478056, 305419896 +// CHECK: encoding: [0x81,0x2d,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + subl $0x13572468,0x12345678 + +// CHECK: decl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0x8c,0xcb,0xef,0xbe,0xad,0xde] + decl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: decw 32493 +// CHECK: encoding: [0x66,0xff,0x0d,0xed,0x7e,0x00,0x00] + decw 0x7eed + +// CHECK: decl 3133065982 +// CHECK: encoding: [0xff,0x0d,0xfe,0xca,0xbe,0xba] + decl 0xbabecafe + +// CHECK: decl 305419896 +// CHECK: encoding: [0xff,0x0d,0x78,0x56,0x34,0x12] + decl 0x12345678 + +// CHECK: sbbb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xfe] + sbbb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sbbb $254, 69 +// CHECK: encoding: [0x80,0x1d,0x45,0x00,0x00,0x00,0xfe] + sbbb $0xfe,0x45 + +// CHECK: sbbb $254, 32493 +// CHECK: encoding: [0x80,0x1d,0xed,0x7e,0x00,0x00,0xfe] + sbbb $0xfe,0x7eed + +// CHECK: sbbb $254, 3133065982 +// CHECK: encoding: [0x80,0x1d,0xfe,0xca,0xbe,0xba,0xfe] + sbbb $0xfe,0xbabecafe + +// CHECK: sbbb $254, 305419896 +// CHECK: encoding: [0x80,0x1d,0x78,0x56,0x34,0x12,0xfe] + sbbb $0xfe,0x12345678 + +// CHECK: sbbb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x9c,0xcb,0xef,0xbe,0xad,0xde,0x7f] + sbbb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sbbb $127, 69 +// CHECK: encoding: [0x80,0x1d,0x45,0x00,0x00,0x00,0x7f] + sbbb $0x7f,0x45 + +// CHECK: sbbb $127, 32493 +// CHECK: encoding: [0x80,0x1d,0xed,0x7e,0x00,0x00,0x7f] + sbbb $0x7f,0x7eed + +// CHECK: sbbb $127, 3133065982 +// CHECK: encoding: [0x80,0x1d,0xfe,0xca,0xbe,0xba,0x7f] + sbbb $0x7f,0xbabecafe + +// CHECK: sbbb $127, 305419896 +// CHECK: encoding: [0x80,0x1d,0x78,0x56,0x34,0x12,0x7f] + sbbb $0x7f,0x12345678 + +// CHECK: sbbw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + sbbw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sbbw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x1d,0x45,0x00,0x00,0x00,0xce,0x7a] + sbbw $0x7ace,0x45 + +// CHECK: sbbw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x1d,0xed,0x7e,0x00,0x00,0xce,0x7a] + sbbw $0x7ace,0x7eed + +// CHECK: sbbw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x1d,0xfe,0xca,0xbe,0xba,0xce,0x7a] + sbbw $0x7ace,0xbabecafe + +// CHECK: sbbw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x1d,0x78,0x56,0x34,0x12,0xce,0x7a] + sbbw $0x7ace,0x12345678 + +// CHECK: sbbl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x9c,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + sbbl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sbbl $2063514302, 69 +// CHECK: encoding: [0x81,0x1d,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + sbbl $0x7afebabe,0x45 + +// CHECK: sbbl $2063514302, 32493 +// CHECK: encoding: [0x81,0x1d,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + sbbl $0x7afebabe,0x7eed + +// CHECK: sbbl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x1d,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + sbbl $0x7afebabe,0xbabecafe + +// CHECK: sbbl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x1d,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + sbbl $0x7afebabe,0x12345678 + +// CHECK: sbbl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x9c,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + sbbl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sbbl $324478056, 69 +// CHECK: encoding: [0x81,0x1d,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + sbbl $0x13572468,0x45 + +// CHECK: sbbl $324478056, 32493 +// CHECK: encoding: [0x81,0x1d,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + sbbl $0x13572468,0x7eed + +// CHECK: sbbl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x1d,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + sbbl $0x13572468,0xbabecafe + +// CHECK: sbbl $324478056, 305419896 +// CHECK: encoding: [0x81,0x1d,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + sbbl $0x13572468,0x12345678 + +// CHECK: cmpb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xbc,0xcb,0xef,0xbe,0xad,0xde,0xfe] + cmpb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpb $254, 69 +// CHECK: encoding: [0x80,0x3d,0x45,0x00,0x00,0x00,0xfe] + cmpb $0xfe,0x45 + +// CHECK: cmpb $254, 32493 +// CHECK: encoding: [0x80,0x3d,0xed,0x7e,0x00,0x00,0xfe] + cmpb $0xfe,0x7eed + +// CHECK: cmpb $254, 3133065982 +// CHECK: encoding: [0x80,0x3d,0xfe,0xca,0xbe,0xba,0xfe] + cmpb $0xfe,0xbabecafe + +// CHECK: cmpb $254, 305419896 +// CHECK: encoding: [0x80,0x3d,0x78,0x56,0x34,0x12,0xfe] + cmpb $0xfe,0x12345678 + +// CHECK: cmpb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xbc,0xcb,0xef,0xbe,0xad,0xde,0x7f] + cmpb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpb $127, 69 +// CHECK: encoding: [0x80,0x3d,0x45,0x00,0x00,0x00,0x7f] + cmpb $0x7f,0x45 + +// CHECK: cmpb $127, 32493 +// CHECK: encoding: [0x80,0x3d,0xed,0x7e,0x00,0x00,0x7f] + cmpb $0x7f,0x7eed + +// CHECK: cmpb $127, 3133065982 +// CHECK: encoding: [0x80,0x3d,0xfe,0xca,0xbe,0xba,0x7f] + cmpb $0x7f,0xbabecafe + +// CHECK: cmpb $127, 305419896 +// CHECK: encoding: [0x80,0x3d,0x78,0x56,0x34,0x12,0x7f] + cmpb $0x7f,0x12345678 + +// CHECK: cmpw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0xbc,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + cmpw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x3d,0x45,0x00,0x00,0x00,0xce,0x7a] + cmpw $0x7ace,0x45 + +// CHECK: cmpw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x3d,0xed,0x7e,0x00,0x00,0xce,0x7a] + cmpw $0x7ace,0x7eed + +// CHECK: cmpw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x3d,0xfe,0xca,0xbe,0xba,0xce,0x7a] + cmpw $0x7ace,0xbabecafe + +// CHECK: cmpw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x3d,0x78,0x56,0x34,0x12,0xce,0x7a] + cmpw $0x7ace,0x12345678 + +// CHECK: cmpl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xbc,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + cmpl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpl $2063514302, 69 +// CHECK: encoding: [0x81,0x3d,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + cmpl $0x7afebabe,0x45 + +// CHECK: cmpl $2063514302, 32493 +// CHECK: encoding: [0x81,0x3d,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + cmpl $0x7afebabe,0x7eed + +// CHECK: cmpl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x3d,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + cmpl $0x7afebabe,0xbabecafe + +// CHECK: cmpl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x3d,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + cmpl $0x7afebabe,0x12345678 + +// CHECK: cmpl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xbc,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + cmpl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpl $324478056, 69 +// CHECK: encoding: [0x81,0x3d,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + cmpl $0x13572468,0x45 + +// CHECK: cmpl $324478056, 32493 +// CHECK: encoding: [0x81,0x3d,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + cmpl $0x13572468,0x7eed + +// CHECK: cmpl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x3d,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + cmpl $0x13572468,0xbabecafe + +// CHECK: cmpl $324478056, 305419896 +// CHECK: encoding: [0x81,0x3d,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + cmpl $0x13572468,0x12345678 + +// CHECK: testb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf6,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] + testb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: testb $127, 69 +// CHECK: encoding: [0xf6,0x05,0x45,0x00,0x00,0x00,0x7f] + testb $0x7f,0x45 + +// CHECK: testb $127, 32493 +// CHECK: encoding: [0xf6,0x05,0xed,0x7e,0x00,0x00,0x7f] + testb $0x7f,0x7eed + +// CHECK: testb $127, 3133065982 +// CHECK: encoding: [0xf6,0x05,0xfe,0xca,0xbe,0xba,0x7f] + testb $0x7f,0xbabecafe + +// CHECK: testb $127, 305419896 +// CHECK: encoding: [0xf6,0x05,0x78,0x56,0x34,0x12,0x7f] + testb $0x7f,0x12345678 + +// CHECK: testw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0xf7,0x84,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + testw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: testw $31438, 69 +// CHECK: encoding: [0x66,0xf7,0x05,0x45,0x00,0x00,0x00,0xce,0x7a] + testw $0x7ace,0x45 + +// CHECK: testw $31438, 32493 +// CHECK: encoding: [0x66,0xf7,0x05,0xed,0x7e,0x00,0x00,0xce,0x7a] + testw $0x7ace,0x7eed + +// CHECK: testw $31438, 3133065982 +// CHECK: encoding: [0x66,0xf7,0x05,0xfe,0xca,0xbe,0xba,0xce,0x7a] + testw $0x7ace,0xbabecafe + +// CHECK: testw $31438, 305419896 +// CHECK: encoding: [0x66,0xf7,0x05,0x78,0x56,0x34,0x12,0xce,0x7a] + testw $0x7ace,0x12345678 + +// CHECK: testl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0x84,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + testl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: testl $2063514302, 69 +// CHECK: encoding: [0xf7,0x05,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + testl $0x7afebabe,0x45 + +// CHECK: testl $2063514302, 32493 +// CHECK: encoding: [0xf7,0x05,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + testl $0x7afebabe,0x7eed + +// CHECK: testl $2063514302, 3133065982 +// CHECK: encoding: [0xf7,0x05,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + testl $0x7afebabe,0xbabecafe + +// CHECK: testl $2063514302, 305419896 +// CHECK: encoding: [0xf7,0x05,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + testl $0x7afebabe,0x12345678 + +// CHECK: testl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0x84,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + testl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: testl $324478056, 69 +// CHECK: encoding: [0xf7,0x05,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + testl $0x13572468,0x45 + +// CHECK: testl $324478056, 32493 +// CHECK: encoding: [0xf7,0x05,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + testl $0x13572468,0x7eed + +// CHECK: testl $324478056, 3133065982 +// CHECK: encoding: [0xf7,0x05,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + testl $0x13572468,0xbabecafe + +// CHECK: testl $324478056, 305419896 +// CHECK: encoding: [0xf7,0x05,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + testl $0x13572468,0x12345678 + +// CHECK: andb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xa4,0xcb,0xef,0xbe,0xad,0xde,0xfe] + andb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: andb $254, 69 +// CHECK: encoding: [0x80,0x25,0x45,0x00,0x00,0x00,0xfe] + andb $0xfe,0x45 + +// CHECK: andb $254, 32493 +// CHECK: encoding: [0x80,0x25,0xed,0x7e,0x00,0x00,0xfe] + andb $0xfe,0x7eed + +// CHECK: andb $254, 3133065982 +// CHECK: encoding: [0x80,0x25,0xfe,0xca,0xbe,0xba,0xfe] + andb $0xfe,0xbabecafe + +// CHECK: andb $254, 305419896 +// CHECK: encoding: [0x80,0x25,0x78,0x56,0x34,0x12,0xfe] + andb $0xfe,0x12345678 + +// CHECK: andb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x7f] + andb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: andb $127, 69 +// CHECK: encoding: [0x80,0x25,0x45,0x00,0x00,0x00,0x7f] + andb $0x7f,0x45 + +// CHECK: andb $127, 32493 +// CHECK: encoding: [0x80,0x25,0xed,0x7e,0x00,0x00,0x7f] + andb $0x7f,0x7eed + +// CHECK: andb $127, 3133065982 +// CHECK: encoding: [0x80,0x25,0xfe,0xca,0xbe,0xba,0x7f] + andb $0x7f,0xbabecafe + +// CHECK: andb $127, 305419896 +// CHECK: encoding: [0x80,0x25,0x78,0x56,0x34,0x12,0x7f] + andb $0x7f,0x12345678 + +// CHECK: andw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0xa4,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + andw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: andw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x25,0x45,0x00,0x00,0x00,0xce,0x7a] + andw $0x7ace,0x45 + +// CHECK: andw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x25,0xed,0x7e,0x00,0x00,0xce,0x7a] + andw $0x7ace,0x7eed + +// CHECK: andw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x25,0xfe,0xca,0xbe,0xba,0xce,0x7a] + andw $0x7ace,0xbabecafe + +// CHECK: andw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x25,0x78,0x56,0x34,0x12,0xce,0x7a] + andw $0x7ace,0x12345678 + +// CHECK: andl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xa4,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + andl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: andl $2063514302, 69 +// CHECK: encoding: [0x81,0x25,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + andl $0x7afebabe,0x45 + +// CHECK: andl $2063514302, 32493 +// CHECK: encoding: [0x81,0x25,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + andl $0x7afebabe,0x7eed + +// CHECK: andl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x25,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + andl $0x7afebabe,0xbabecafe + +// CHECK: andl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x25,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + andl $0x7afebabe,0x12345678 + +// CHECK: andl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + andl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: andl $324478056, 69 +// CHECK: encoding: [0x81,0x25,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + andl $0x13572468,0x45 + +// CHECK: andl $324478056, 32493 +// CHECK: encoding: [0x81,0x25,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + andl $0x13572468,0x7eed + +// CHECK: andl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x25,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + andl $0x13572468,0xbabecafe + +// CHECK: andl $324478056, 305419896 +// CHECK: encoding: [0x81,0x25,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + andl $0x13572468,0x12345678 + +// CHECK: orb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x8c,0xcb,0xef,0xbe,0xad,0xde,0xfe] + orb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: orb $254, 69 +// CHECK: encoding: [0x80,0x0d,0x45,0x00,0x00,0x00,0xfe] + orb $0xfe,0x45 + +// CHECK: orb $254, 32493 +// CHECK: encoding: [0x80,0x0d,0xed,0x7e,0x00,0x00,0xfe] + orb $0xfe,0x7eed + +// CHECK: orb $254, 3133065982 +// CHECK: encoding: [0x80,0x0d,0xfe,0xca,0xbe,0xba,0xfe] + orb $0xfe,0xbabecafe + +// CHECK: orb $254, 305419896 +// CHECK: encoding: [0x80,0x0d,0x78,0x56,0x34,0x12,0xfe] + orb $0xfe,0x12345678 + +// CHECK: orb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x8c,0xcb,0xef,0xbe,0xad,0xde,0x7f] + orb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: orb $127, 69 +// CHECK: encoding: [0x80,0x0d,0x45,0x00,0x00,0x00,0x7f] + orb $0x7f,0x45 + +// CHECK: orb $127, 32493 +// CHECK: encoding: [0x80,0x0d,0xed,0x7e,0x00,0x00,0x7f] + orb $0x7f,0x7eed + +// CHECK: orb $127, 3133065982 +// CHECK: encoding: [0x80,0x0d,0xfe,0xca,0xbe,0xba,0x7f] + orb $0x7f,0xbabecafe + +// CHECK: orb $127, 305419896 +// CHECK: encoding: [0x80,0x0d,0x78,0x56,0x34,0x12,0x7f] + orb $0x7f,0x12345678 + +// CHECK: orw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0x8c,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + orw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: orw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x0d,0x45,0x00,0x00,0x00,0xce,0x7a] + orw $0x7ace,0x45 + +// CHECK: orw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x0d,0xed,0x7e,0x00,0x00,0xce,0x7a] + orw $0x7ace,0x7eed + +// CHECK: orw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x0d,0xfe,0xca,0xbe,0xba,0xce,0x7a] + orw $0x7ace,0xbabecafe + +// CHECK: orw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x0d,0x78,0x56,0x34,0x12,0xce,0x7a] + orw $0x7ace,0x12345678 + +// CHECK: orl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x8c,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + orl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: orl $2063514302, 69 +// CHECK: encoding: [0x81,0x0d,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + orl $0x7afebabe,0x45 + +// CHECK: orl $2063514302, 32493 +// CHECK: encoding: [0x81,0x0d,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + orl $0x7afebabe,0x7eed + +// CHECK: orl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x0d,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + orl $0x7afebabe,0xbabecafe + +// CHECK: orl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x0d,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + orl $0x7afebabe,0x12345678 + +// CHECK: orl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x8c,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + orl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: orl $324478056, 69 +// CHECK: encoding: [0x81,0x0d,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + orl $0x13572468,0x45 + +// CHECK: orl $324478056, 32493 +// CHECK: encoding: [0x81,0x0d,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + orl $0x13572468,0x7eed + +// CHECK: orl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x0d,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + orl $0x13572468,0xbabecafe + +// CHECK: orl $324478056, 305419896 +// CHECK: encoding: [0x81,0x0d,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + orl $0x13572468,0x12345678 + +// CHECK: xorb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xb4,0xcb,0xef,0xbe,0xad,0xde,0xfe] + xorb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: xorb $254, 69 +// CHECK: encoding: [0x80,0x35,0x45,0x00,0x00,0x00,0xfe] + xorb $0xfe,0x45 + +// CHECK: xorb $254, 32493 +// CHECK: encoding: [0x80,0x35,0xed,0x7e,0x00,0x00,0xfe] + xorb $0xfe,0x7eed + +// CHECK: xorb $254, 3133065982 +// CHECK: encoding: [0x80,0x35,0xfe,0xca,0xbe,0xba,0xfe] + xorb $0xfe,0xbabecafe + +// CHECK: xorb $254, 305419896 +// CHECK: encoding: [0x80,0x35,0x78,0x56,0x34,0x12,0xfe] + xorb $0xfe,0x12345678 + +// CHECK: xorb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0xb4,0xcb,0xef,0xbe,0xad,0xde,0x7f] + xorb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: xorb $127, 69 +// CHECK: encoding: [0x80,0x35,0x45,0x00,0x00,0x00,0x7f] + xorb $0x7f,0x45 + +// CHECK: xorb $127, 32493 +// CHECK: encoding: [0x80,0x35,0xed,0x7e,0x00,0x00,0x7f] + xorb $0x7f,0x7eed + +// CHECK: xorb $127, 3133065982 +// CHECK: encoding: [0x80,0x35,0xfe,0xca,0xbe,0xba,0x7f] + xorb $0x7f,0xbabecafe + +// CHECK: xorb $127, 305419896 +// CHECK: encoding: [0x80,0x35,0x78,0x56,0x34,0x12,0x7f] + xorb $0x7f,0x12345678 + +// CHECK: xorw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0xb4,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + xorw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: xorw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x35,0x45,0x00,0x00,0x00,0xce,0x7a] + xorw $0x7ace,0x45 + +// CHECK: xorw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x35,0xed,0x7e,0x00,0x00,0xce,0x7a] + xorw $0x7ace,0x7eed + +// CHECK: xorw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x35,0xfe,0xca,0xbe,0xba,0xce,0x7a] + xorw $0x7ace,0xbabecafe + +// CHECK: xorw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x35,0x78,0x56,0x34,0x12,0xce,0x7a] + xorw $0x7ace,0x12345678 + +// CHECK: xorl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xb4,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + xorl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: xorl $2063514302, 69 +// CHECK: encoding: [0x81,0x35,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + xorl $0x7afebabe,0x45 + +// CHECK: xorl $2063514302, 32493 +// CHECK: encoding: [0x81,0x35,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + xorl $0x7afebabe,0x7eed + +// CHECK: xorl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x35,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + xorl $0x7afebabe,0xbabecafe + +// CHECK: xorl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x35,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + xorl $0x7afebabe,0x12345678 + +// CHECK: xorl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0xb4,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + xorl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: xorl $324478056, 69 +// CHECK: encoding: [0x81,0x35,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + xorl $0x13572468,0x45 + +// CHECK: xorl $324478056, 32493 +// CHECK: encoding: [0x81,0x35,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + xorl $0x13572468,0x7eed + +// CHECK: xorl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x35,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + xorl $0x13572468,0xbabecafe + +// CHECK: xorl $324478056, 305419896 +// CHECK: encoding: [0x81,0x35,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + xorl $0x13572468,0x12345678 + +// CHECK: adcb $254, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x94,0xcb,0xef,0xbe,0xad,0xde,0xfe] + adcb $0xfe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: adcb $254, 69 +// CHECK: encoding: [0x80,0x15,0x45,0x00,0x00,0x00,0xfe] + adcb $0xfe,0x45 + +// CHECK: adcb $254, 32493 +// CHECK: encoding: [0x80,0x15,0xed,0x7e,0x00,0x00,0xfe] + adcb $0xfe,0x7eed + +// CHECK: adcb $254, 3133065982 +// CHECK: encoding: [0x80,0x15,0xfe,0xca,0xbe,0xba,0xfe] + adcb $0xfe,0xbabecafe + +// CHECK: adcb $254, 305419896 +// CHECK: encoding: [0x80,0x15,0x78,0x56,0x34,0x12,0xfe] + adcb $0xfe,0x12345678 + +// CHECK: adcb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x80,0x94,0xcb,0xef,0xbe,0xad,0xde,0x7f] + adcb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: adcb $127, 69 +// CHECK: encoding: [0x80,0x15,0x45,0x00,0x00,0x00,0x7f] + adcb $0x7f,0x45 + +// CHECK: adcb $127, 32493 +// CHECK: encoding: [0x80,0x15,0xed,0x7e,0x00,0x00,0x7f] + adcb $0x7f,0x7eed + +// CHECK: adcb $127, 3133065982 +// CHECK: encoding: [0x80,0x15,0xfe,0xca,0xbe,0xba,0x7f] + adcb $0x7f,0xbabecafe + +// CHECK: adcb $127, 305419896 +// CHECK: encoding: [0x80,0x15,0x78,0x56,0x34,0x12,0x7f] + adcb $0x7f,0x12345678 + +// CHECK: adcw $31438, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x81,0x94,0xcb,0xef,0xbe,0xad,0xde,0xce,0x7a] + adcw $0x7ace,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: adcw $31438, 69 +// CHECK: encoding: [0x66,0x81,0x15,0x45,0x00,0x00,0x00,0xce,0x7a] + adcw $0x7ace,0x45 + +// CHECK: adcw $31438, 32493 +// CHECK: encoding: [0x66,0x81,0x15,0xed,0x7e,0x00,0x00,0xce,0x7a] + adcw $0x7ace,0x7eed + +// CHECK: adcw $31438, 3133065982 +// CHECK: encoding: [0x66,0x81,0x15,0xfe,0xca,0xbe,0xba,0xce,0x7a] + adcw $0x7ace,0xbabecafe + +// CHECK: adcw $31438, 305419896 +// CHECK: encoding: [0x66,0x81,0x15,0x78,0x56,0x34,0x12,0xce,0x7a] + adcw $0x7ace,0x12345678 + +// CHECK: adcl $2063514302, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x94,0xcb,0xef,0xbe,0xad,0xde,0xbe,0xba,0xfe,0x7a] + adcl $0x7afebabe,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: adcl $2063514302, 69 +// CHECK: encoding: [0x81,0x15,0x45,0x00,0x00,0x00,0xbe,0xba,0xfe,0x7a] + adcl $0x7afebabe,0x45 + +// CHECK: adcl $2063514302, 32493 +// CHECK: encoding: [0x81,0x15,0xed,0x7e,0x00,0x00,0xbe,0xba,0xfe,0x7a] + adcl $0x7afebabe,0x7eed + +// CHECK: adcl $2063514302, 3133065982 +// CHECK: encoding: [0x81,0x15,0xfe,0xca,0xbe,0xba,0xbe,0xba,0xfe,0x7a] + adcl $0x7afebabe,0xbabecafe + +// CHECK: adcl $2063514302, 305419896 +// CHECK: encoding: [0x81,0x15,0x78,0x56,0x34,0x12,0xbe,0xba,0xfe,0x7a] + adcl $0x7afebabe,0x12345678 + +// CHECK: adcl $324478056, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x81,0x94,0xcb,0xef,0xbe,0xad,0xde,0x68,0x24,0x57,0x13] + adcl $0x13572468,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: adcl $324478056, 69 +// CHECK: encoding: [0x81,0x15,0x45,0x00,0x00,0x00,0x68,0x24,0x57,0x13] + adcl $0x13572468,0x45 + +// CHECK: adcl $324478056, 32493 +// CHECK: encoding: [0x81,0x15,0xed,0x7e,0x00,0x00,0x68,0x24,0x57,0x13] + adcl $0x13572468,0x7eed + +// CHECK: adcl $324478056, 3133065982 +// CHECK: encoding: [0x81,0x15,0xfe,0xca,0xbe,0xba,0x68,0x24,0x57,0x13] + adcl $0x13572468,0xbabecafe + +// CHECK: adcl $324478056, 305419896 +// CHECK: encoding: [0x81,0x15,0x78,0x56,0x34,0x12,0x68,0x24,0x57,0x13] + adcl $0x13572468,0x12345678 + +// CHECK: negl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0x9c,0xcb,0xef,0xbe,0xad,0xde] + negl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: negw 32493 +// CHECK: encoding: [0x66,0xf7,0x1d,0xed,0x7e,0x00,0x00] + negw 0x7eed + +// CHECK: negl 3133065982 +// CHECK: encoding: [0xf7,0x1d,0xfe,0xca,0xbe,0xba] + negl 0xbabecafe + +// CHECK: negl 305419896 +// CHECK: encoding: [0xf7,0x1d,0x78,0x56,0x34,0x12] + negl 0x12345678 + +// CHECK: notl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0x94,0xcb,0xef,0xbe,0xad,0xde] + notl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: notw 32493 +// CHECK: encoding: [0x66,0xf7,0x15,0xed,0x7e,0x00,0x00] + notw 0x7eed + +// CHECK: notl 3133065982 +// CHECK: encoding: [0xf7,0x15,0xfe,0xca,0xbe,0xba] + notl 0xbabecafe + +// CHECK: notl 305419896 +// CHECK: encoding: [0xf7,0x15,0x78,0x56,0x34,0x12] + notl 0x12345678 + +// CHECK: cbtw +// CHECK: encoding: [0x66,0x98] + cbtw + +// CHECK: cwtl +// CHECK: encoding: [0x98] + cwtl + +// CHECK: cwtd +// CHECK: encoding: [0x66,0x99] + cwtd + +// CHECK: cltd +// CHECK: encoding: [0x99] + cltd + +// CHECK: mull 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0xa4,0xcb,0xef,0xbe,0xad,0xde] + mull 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: mulw 32493 +// CHECK: encoding: [0x66,0xf7,0x25,0xed,0x7e,0x00,0x00] + mulw 0x7eed + +// CHECK: mull 3133065982 +// CHECK: encoding: [0xf7,0x25,0xfe,0xca,0xbe,0xba] + mull 0xbabecafe + +// CHECK: mull 305419896 +// CHECK: encoding: [0xf7,0x25,0x78,0x56,0x34,0x12] + mull 0x12345678 + +// CHECK: imull 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0xac,0xcb,0xef,0xbe,0xad,0xde] + imull 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: imulw 32493 +// CHECK: encoding: [0x66,0xf7,0x2d,0xed,0x7e,0x00,0x00] + imulw 0x7eed + +// CHECK: imull 3133065982 +// CHECK: encoding: [0xf7,0x2d,0xfe,0xca,0xbe,0xba] + imull 0xbabecafe + +// CHECK: imull 305419896 +// CHECK: encoding: [0xf7,0x2d,0x78,0x56,0x34,0x12] + imull 0x12345678 + +// CHECK: divl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0xb4,0xcb,0xef,0xbe,0xad,0xde] + divl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: divw 32493 +// CHECK: encoding: [0x66,0xf7,0x35,0xed,0x7e,0x00,0x00] + divw 0x7eed + +// CHECK: divl 3133065982 +// CHECK: encoding: [0xf7,0x35,0xfe,0xca,0xbe,0xba] + divl 0xbabecafe + +// CHECK: divl 305419896 +// CHECK: encoding: [0xf7,0x35,0x78,0x56,0x34,0x12] + divl 0x12345678 + +// CHECK: idivl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf7,0xbc,0xcb,0xef,0xbe,0xad,0xde] + idivl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: idivw 32493 +// CHECK: encoding: [0x66,0xf7,0x3d,0xed,0x7e,0x00,0x00] + idivw 0x7eed + +// CHECK: idivl 3133065982 +// CHECK: encoding: [0xf7,0x3d,0xfe,0xca,0xbe,0xba] + idivl 0xbabecafe + +// CHECK: idivl 305419896 +// CHECK: encoding: [0xf7,0x3d,0x78,0x56,0x34,0x12] + idivl 0x12345678 + +// CHECK: roll $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0x84,0xcb,0xef,0xbe,0xad,0xde,0x00] + roll $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: roll $0, 69 +// CHECK: encoding: [0xc1,0x05,0x45,0x00,0x00,0x00,0x00] + roll $0,0x45 + +// CHECK: roll $0, 32493 +// CHECK: encoding: [0xc1,0x05,0xed,0x7e,0x00,0x00,0x00] + roll $0,0x7eed + +// CHECK: roll $0, 3133065982 +// CHECK: encoding: [0xc1,0x05,0xfe,0xca,0xbe,0xba,0x00] + roll $0,0xbabecafe + +// CHECK: roll $0, 305419896 +// CHECK: encoding: [0xc1,0x05,0x78,0x56,0x34,0x12,0x00] + roll $0,0x12345678 + +// CHECK: rolb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] + rolb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: rolb $127, 69 +// CHECK: encoding: [0xc0,0x05,0x45,0x00,0x00,0x00,0x7f] + rolb $0x7f,0x45 + +// CHECK: rolb $127, 32493 +// CHECK: encoding: [0xc0,0x05,0xed,0x7e,0x00,0x00,0x7f] + rolb $0x7f,0x7eed + +// CHECK: rolb $127, 3133065982 +// CHECK: encoding: [0xc0,0x05,0xfe,0xca,0xbe,0xba,0x7f] + rolb $0x7f,0xbabecafe + +// CHECK: rolb $127, 305419896 +// CHECK: encoding: [0xc0,0x05,0x78,0x56,0x34,0x12,0x7f] + rolb $0x7f,0x12345678 + +// CHECK: roll 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0x84,0xcb,0xef,0xbe,0xad,0xde] + roll 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: rolw 32493 +// CHECK: encoding: [0x66,0xd1,0x05,0xed,0x7e,0x00,0x00] + rolw 0x7eed + +// CHECK: roll 3133065982 +// CHECK: encoding: [0xd1,0x05,0xfe,0xca,0xbe,0xba] + roll 0xbabecafe + +// CHECK: roll 305419896 +// CHECK: encoding: [0xd1,0x05,0x78,0x56,0x34,0x12] + roll 0x12345678 + +// CHECK: rorl $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0x8c,0xcb,0xef,0xbe,0xad,0xde,0x00] + rorl $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: rorl $0, 69 +// CHECK: encoding: [0xc1,0x0d,0x45,0x00,0x00,0x00,0x00] + rorl $0,0x45 + +// CHECK: rorl $0, 32493 +// CHECK: encoding: [0xc1,0x0d,0xed,0x7e,0x00,0x00,0x00] + rorl $0,0x7eed + +// CHECK: rorl $0, 3133065982 +// CHECK: encoding: [0xc1,0x0d,0xfe,0xca,0xbe,0xba,0x00] + rorl $0,0xbabecafe + +// CHECK: rorl $0, 305419896 +// CHECK: encoding: [0xc1,0x0d,0x78,0x56,0x34,0x12,0x00] + rorl $0,0x12345678 + +// CHECK: rorb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0x8c,0xcb,0xef,0xbe,0xad,0xde,0x7f] + rorb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: rorb $127, 69 +// CHECK: encoding: [0xc0,0x0d,0x45,0x00,0x00,0x00,0x7f] + rorb $0x7f,0x45 + +// CHECK: rorb $127, 32493 +// CHECK: encoding: [0xc0,0x0d,0xed,0x7e,0x00,0x00,0x7f] + rorb $0x7f,0x7eed + +// CHECK: rorb $127, 3133065982 +// CHECK: encoding: [0xc0,0x0d,0xfe,0xca,0xbe,0xba,0x7f] + rorb $0x7f,0xbabecafe + +// CHECK: rorb $127, 305419896 +// CHECK: encoding: [0xc0,0x0d,0x78,0x56,0x34,0x12,0x7f] + rorb $0x7f,0x12345678 + +// CHECK: rorl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0x8c,0xcb,0xef,0xbe,0xad,0xde] + rorl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: rorw 32493 +// CHECK: encoding: [0x66,0xd1,0x0d,0xed,0x7e,0x00,0x00] + rorw 0x7eed + +// CHECK: rorl 3133065982 +// CHECK: encoding: [0xd1,0x0d,0xfe,0xca,0xbe,0xba] + rorl 0xbabecafe + +// CHECK: rorl 305419896 +// CHECK: encoding: [0xd1,0x0d,0x78,0x56,0x34,0x12] + rorl 0x12345678 + +// CHECK: shll $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x00] + sall $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shll $0, 69 +// CHECK: encoding: [0xc1,0x25,0x45,0x00,0x00,0x00,0x00] + sall $0,0x45 + +// CHECK: shll $0, 32493 +// CHECK: encoding: [0xc1,0x25,0xed,0x7e,0x00,0x00,0x00] + sall $0,0x7eed + +// CHECK: shll $0, 3133065982 +// CHECK: encoding: [0xc1,0x25,0xfe,0xca,0xbe,0xba,0x00] + sall $0,0xbabecafe + +// CHECK: shll $0, 305419896 +// CHECK: encoding: [0xc1,0x25,0x78,0x56,0x34,0x12,0x00] + sall $0,0x12345678 + +// CHECK: shlb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x7f] + salb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlb $127, 69 +// CHECK: encoding: [0xc0,0x25,0x45,0x00,0x00,0x00,0x7f] + salb $0x7f,0x45 + +// CHECK: shlb $127, 32493 +// CHECK: encoding: [0xc0,0x25,0xed,0x7e,0x00,0x00,0x7f] + salb $0x7f,0x7eed + +// CHECK: shlb $127, 3133065982 +// CHECK: encoding: [0xc0,0x25,0xfe,0xca,0xbe,0xba,0x7f] + salb $0x7f,0xbabecafe + +// CHECK: shlb $127, 305419896 +// CHECK: encoding: [0xc0,0x25,0x78,0x56,0x34,0x12,0x7f] + salb $0x7f,0x12345678 + +// CHECK: shll 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0xa4,0xcb,0xef,0xbe,0xad,0xde] + sall 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlw 32493 +// CHECK: encoding: [0x66,0xd1,0x25,0xed,0x7e,0x00,0x00] + salw 0x7eed + +// CHECK: shll 3133065982 +// CHECK: encoding: [0xd1,0x25,0xfe,0xca,0xbe,0xba] + sall 0xbabecafe + +// CHECK: shll 305419896 +// CHECK: encoding: [0xd1,0x25,0x78,0x56,0x34,0x12] + sall 0x12345678 + +// CHECK: shll $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x00] + shll $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shll $0, 69 +// CHECK: encoding: [0xc1,0x25,0x45,0x00,0x00,0x00,0x00] + shll $0,0x45 + +// CHECK: shll $0, 32493 +// CHECK: encoding: [0xc1,0x25,0xed,0x7e,0x00,0x00,0x00] + shll $0,0x7eed + +// CHECK: shll $0, 3133065982 +// CHECK: encoding: [0xc1,0x25,0xfe,0xca,0xbe,0xba,0x00] + shll $0,0xbabecafe + +// CHECK: shll $0, 305419896 +// CHECK: encoding: [0xc1,0x25,0x78,0x56,0x34,0x12,0x00] + shll $0,0x12345678 + +// CHECK: shlb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0xa4,0xcb,0xef,0xbe,0xad,0xde,0x7f] + shlb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlb $127, 69 +// CHECK: encoding: [0xc0,0x25,0x45,0x00,0x00,0x00,0x7f] + shlb $0x7f,0x45 + +// CHECK: shlb $127, 32493 +// CHECK: encoding: [0xc0,0x25,0xed,0x7e,0x00,0x00,0x7f] + shlb $0x7f,0x7eed + +// CHECK: shlb $127, 3133065982 +// CHECK: encoding: [0xc0,0x25,0xfe,0xca,0xbe,0xba,0x7f] + shlb $0x7f,0xbabecafe + +// CHECK: shlb $127, 305419896 +// CHECK: encoding: [0xc0,0x25,0x78,0x56,0x34,0x12,0x7f] + shlb $0x7f,0x12345678 + +// CHECK: shll 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0xa4,0xcb,0xef,0xbe,0xad,0xde] + shll 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlw 32493 +// CHECK: encoding: [0x66,0xd1,0x25,0xed,0x7e,0x00,0x00] + shlw 0x7eed + +// CHECK: shll 3133065982 +// CHECK: encoding: [0xd1,0x25,0xfe,0xca,0xbe,0xba] + shll 0xbabecafe + +// CHECK: shll 305419896 +// CHECK: encoding: [0xd1,0x25,0x78,0x56,0x34,0x12] + shll 0x12345678 + +// CHECK: shrl $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0xac,0xcb,0xef,0xbe,0xad,0xde,0x00] + shrl $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shrl $0, 69 +// CHECK: encoding: [0xc1,0x2d,0x45,0x00,0x00,0x00,0x00] + shrl $0,0x45 + +// CHECK: shrl $0, 32493 +// CHECK: encoding: [0xc1,0x2d,0xed,0x7e,0x00,0x00,0x00] + shrl $0,0x7eed + +// CHECK: shrl $0, 3133065982 +// CHECK: encoding: [0xc1,0x2d,0xfe,0xca,0xbe,0xba,0x00] + shrl $0,0xbabecafe + +// CHECK: shrl $0, 305419896 +// CHECK: encoding: [0xc1,0x2d,0x78,0x56,0x34,0x12,0x00] + shrl $0,0x12345678 + +// CHECK: shrb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0xac,0xcb,0xef,0xbe,0xad,0xde,0x7f] + shrb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shrb $127, 69 +// CHECK: encoding: [0xc0,0x2d,0x45,0x00,0x00,0x00,0x7f] + shrb $0x7f,0x45 + +// CHECK: shrb $127, 32493 +// CHECK: encoding: [0xc0,0x2d,0xed,0x7e,0x00,0x00,0x7f] + shrb $0x7f,0x7eed + +// CHECK: shrb $127, 3133065982 +// CHECK: encoding: [0xc0,0x2d,0xfe,0xca,0xbe,0xba,0x7f] + shrb $0x7f,0xbabecafe + +// CHECK: shrb $127, 305419896 +// CHECK: encoding: [0xc0,0x2d,0x78,0x56,0x34,0x12,0x7f] + shrb $0x7f,0x12345678 + +// CHECK: shrl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0xac,0xcb,0xef,0xbe,0xad,0xde] + shrl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shrw 32493 +// CHECK: encoding: [0x66,0xd1,0x2d,0xed,0x7e,0x00,0x00] + shrw 0x7eed + +// CHECK: shrl 3133065982 +// CHECK: encoding: [0xd1,0x2d,0xfe,0xca,0xbe,0xba] + shrl 0xbabecafe + +// CHECK: shrl 305419896 +// CHECK: encoding: [0xd1,0x2d,0x78,0x56,0x34,0x12] + shrl 0x12345678 + +// CHECK: sarl $0, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc1,0xbc,0xcb,0xef,0xbe,0xad,0xde,0x00] + sarl $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sarl $0, 69 +// CHECK: encoding: [0xc1,0x3d,0x45,0x00,0x00,0x00,0x00] + sarl $0,0x45 + +// CHECK: sarl $0, 32493 +// CHECK: encoding: [0xc1,0x3d,0xed,0x7e,0x00,0x00,0x00] + sarl $0,0x7eed + +// CHECK: sarl $0, 3133065982 +// CHECK: encoding: [0xc1,0x3d,0xfe,0xca,0xbe,0xba,0x00] + sarl $0,0xbabecafe + +// CHECK: sarl $0, 305419896 +// CHECK: encoding: [0xc1,0x3d,0x78,0x56,0x34,0x12,0x00] + sarl $0,0x12345678 + +// CHECK: sarb $127, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xc0,0xbc,0xcb,0xef,0xbe,0xad,0xde,0x7f] + sarb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sarb $127, 69 +// CHECK: encoding: [0xc0,0x3d,0x45,0x00,0x00,0x00,0x7f] + sarb $0x7f,0x45 + +// CHECK: sarb $127, 32493 +// CHECK: encoding: [0xc0,0x3d,0xed,0x7e,0x00,0x00,0x7f] + sarb $0x7f,0x7eed + +// CHECK: sarb $127, 3133065982 +// CHECK: encoding: [0xc0,0x3d,0xfe,0xca,0xbe,0xba,0x7f] + sarb $0x7f,0xbabecafe + +// CHECK: sarb $127, 305419896 +// CHECK: encoding: [0xc0,0x3d,0x78,0x56,0x34,0x12,0x7f] + sarb $0x7f,0x12345678 + +// CHECK: sarl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd1,0xbc,0xcb,0xef,0xbe,0xad,0xde] + sarl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sarw 32493 +// CHECK: encoding: [0x66,0xd1,0x3d,0xed,0x7e,0x00,0x00] + sarw 0x7eed + +// CHECK: sarl 3133065982 +// CHECK: encoding: [0xd1,0x3d,0xfe,0xca,0xbe,0xba] + sarl 0xbabecafe + +// CHECK: sarl 305419896 +// CHECK: encoding: [0xd1,0x3d,0x78,0x56,0x34,0x12] + sarl 0x12345678 + +// CHECK: call *%ecx +// CHECK: encoding: [0xff,0xd1] + call *%ecx + +// CHECK: call *3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0x94,0xcb,0xef,0xbe,0xad,0xde] + call *0xdeadbeef(%ebx,%ecx,8) + +// CHECK: call *3135175374 +// CHECK: encoding: [0xff,0x15,0xce,0xfa,0xde,0xba] + call *0xbadeface + +// CHECK: call *3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0x94,0xcb,0xef,0xbe,0xad,0xde] + call *0xdeadbeef(%ebx,%ecx,8) + +// CHECK: call *3135175374 +// CHECK: encoding: [0xff,0x15,0xce,0xfa,0xde,0xba] + call *0xbadeface + +// CHECK: lcallw *32493 +// CHECK: encoding: [0x66,0xff,0x1d,0xed,0x7e,0x00,0x00] + lcallw *0x7eed + +// CHECK: jmp *3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0xa4,0xcb,0xef,0xbe,0xad,0xde] + jmp *0xdeadbeef(%ebx,%ecx,8) + +// CHECK: jmp *3135175374 +// CHECK: encoding: [0xff,0x25,0xce,0xfa,0xde,0xba] + jmp *0xbadeface + +// CHECK: jmp *3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0xa4,0xcb,0xef,0xbe,0xad,0xde] + jmp *0xdeadbeef(%ebx,%ecx,8) + +// CHECK: jmp *3135175374 +// CHECK: encoding: [0xff,0x25,0xce,0xfa,0xde,0xba] + jmp *0xbadeface + +// CHECK: ljmpl *3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xff,0xac,0xcb,0xef,0xbe,0xad,0xde] + ljmpl *0xdeadbeef(%ebx,%ecx,8) + +// CHECK: ljmpw *32493 +// CHECK: encoding: [0x66,0xff,0x2d,0xed,0x7e,0x00,0x00] + ljmpw *0x7eed + +// CHECK: ljmpl *3133065982 +// CHECK: encoding: [0xff,0x2d,0xfe,0xca,0xbe,0xba] + ljmpl *0xbabecafe + +// CHECK: ljmpl *305419896 +// CHECK: encoding: [0xff,0x2d,0x78,0x56,0x34,0x12] + ljmpl *0x12345678 + +// CHECK: ret +// CHECK: encoding: [0xc3] + ret + +// CHECK: lret +// CHECK: encoding: [0xcb] + lret + +// CHECK: leave +// CHECK: encoding: [0xc9] + leave + +// CHECK: seto %bl +// CHECK: encoding: [0x0f,0x90,0xc3] + seto %bl + +// CHECK: seto 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x90,0x84,0xcb,0xef,0xbe,0xad,0xde] + seto 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: seto 32493 +// CHECK: encoding: [0x0f,0x90,0x05,0xed,0x7e,0x00,0x00] + seto 0x7eed + +// CHECK: seto 3133065982 +// CHECK: encoding: [0x0f,0x90,0x05,0xfe,0xca,0xbe,0xba] + seto 0xbabecafe + +// CHECK: seto 305419896 +// CHECK: encoding: [0x0f,0x90,0x05,0x78,0x56,0x34,0x12] + seto 0x12345678 + +// CHECK: setno %bl +// CHECK: encoding: [0x0f,0x91,0xc3] + setno %bl + +// CHECK: setno 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x91,0x84,0xcb,0xef,0xbe,0xad,0xde] + setno 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setno 32493 +// CHECK: encoding: [0x0f,0x91,0x05,0xed,0x7e,0x00,0x00] + setno 0x7eed + +// CHECK: setno 3133065982 +// CHECK: encoding: [0x0f,0x91,0x05,0xfe,0xca,0xbe,0xba] + setno 0xbabecafe + +// CHECK: setno 305419896 +// CHECK: encoding: [0x0f,0x91,0x05,0x78,0x56,0x34,0x12] + setno 0x12345678 + +// CHECK: setb %bl +// CHECK: encoding: [0x0f,0x92,0xc3] + setb %bl + +// CHECK: setb 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x92,0x84,0xcb,0xef,0xbe,0xad,0xde] + setb 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setb 32493 +// CHECK: encoding: [0x0f,0x92,0x05,0xed,0x7e,0x00,0x00] + setb 0x7eed + +// CHECK: setb 3133065982 +// CHECK: encoding: [0x0f,0x92,0x05,0xfe,0xca,0xbe,0xba] + setb 0xbabecafe + +// CHECK: setb 305419896 +// CHECK: encoding: [0x0f,0x92,0x05,0x78,0x56,0x34,0x12] + setb 0x12345678 + +// CHECK: setae %bl +// CHECK: encoding: [0x0f,0x93,0xc3] + setae %bl + +// CHECK: setae 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x93,0x84,0xcb,0xef,0xbe,0xad,0xde] + setae 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setae 32493 +// CHECK: encoding: [0x0f,0x93,0x05,0xed,0x7e,0x00,0x00] + setae 0x7eed + +// CHECK: setae 3133065982 +// CHECK: encoding: [0x0f,0x93,0x05,0xfe,0xca,0xbe,0xba] + setae 0xbabecafe + +// CHECK: setae 305419896 +// CHECK: encoding: [0x0f,0x93,0x05,0x78,0x56,0x34,0x12] + setae 0x12345678 + +// CHECK: sete %bl +// CHECK: encoding: [0x0f,0x94,0xc3] + sete %bl + +// CHECK: sete 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x94,0x84,0xcb,0xef,0xbe,0xad,0xde] + sete 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sete 32493 +// CHECK: encoding: [0x0f,0x94,0x05,0xed,0x7e,0x00,0x00] + sete 0x7eed + +// CHECK: sete 3133065982 +// CHECK: encoding: [0x0f,0x94,0x05,0xfe,0xca,0xbe,0xba] + sete 0xbabecafe + +// CHECK: sete 305419896 +// CHECK: encoding: [0x0f,0x94,0x05,0x78,0x56,0x34,0x12] + sete 0x12345678 + +// CHECK: setne %bl +// CHECK: encoding: [0x0f,0x95,0xc3] + setne %bl + +// CHECK: setne 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x95,0x84,0xcb,0xef,0xbe,0xad,0xde] + setne 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setne 32493 +// CHECK: encoding: [0x0f,0x95,0x05,0xed,0x7e,0x00,0x00] + setne 0x7eed + +// CHECK: setne 3133065982 +// CHECK: encoding: [0x0f,0x95,0x05,0xfe,0xca,0xbe,0xba] + setne 0xbabecafe + +// CHECK: setne 305419896 +// CHECK: encoding: [0x0f,0x95,0x05,0x78,0x56,0x34,0x12] + setne 0x12345678 + +// CHECK: setbe %bl +// CHECK: encoding: [0x0f,0x96,0xc3] + setbe %bl + +// CHECK: setbe 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x96,0x84,0xcb,0xef,0xbe,0xad,0xde] + setbe 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setbe 32493 +// CHECK: encoding: [0x0f,0x96,0x05,0xed,0x7e,0x00,0x00] + setbe 0x7eed + +// CHECK: setbe 3133065982 +// CHECK: encoding: [0x0f,0x96,0x05,0xfe,0xca,0xbe,0xba] + setbe 0xbabecafe + +// CHECK: setbe 305419896 +// CHECK: encoding: [0x0f,0x96,0x05,0x78,0x56,0x34,0x12] + setbe 0x12345678 + +// CHECK: seta %bl +// CHECK: encoding: [0x0f,0x97,0xc3] + seta %bl + +// CHECK: seta 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x97,0x84,0xcb,0xef,0xbe,0xad,0xde] + seta 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: seta 32493 +// CHECK: encoding: [0x0f,0x97,0x05,0xed,0x7e,0x00,0x00] + seta 0x7eed + +// CHECK: seta 3133065982 +// CHECK: encoding: [0x0f,0x97,0x05,0xfe,0xca,0xbe,0xba] + seta 0xbabecafe + +// CHECK: seta 305419896 +// CHECK: encoding: [0x0f,0x97,0x05,0x78,0x56,0x34,0x12] + seta 0x12345678 + +// CHECK: sets %bl +// CHECK: encoding: [0x0f,0x98,0xc3] + sets %bl + +// CHECK: sets 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x98,0x84,0xcb,0xef,0xbe,0xad,0xde] + sets 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: sets 32493 +// CHECK: encoding: [0x0f,0x98,0x05,0xed,0x7e,0x00,0x00] + sets 0x7eed + +// CHECK: sets 3133065982 +// CHECK: encoding: [0x0f,0x98,0x05,0xfe,0xca,0xbe,0xba] + sets 0xbabecafe + +// CHECK: sets 305419896 +// CHECK: encoding: [0x0f,0x98,0x05,0x78,0x56,0x34,0x12] + sets 0x12345678 + +// CHECK: setns %bl +// CHECK: encoding: [0x0f,0x99,0xc3] + setns %bl + +// CHECK: setns 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x99,0x84,0xcb,0xef,0xbe,0xad,0xde] + setns 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setns 32493 +// CHECK: encoding: [0x0f,0x99,0x05,0xed,0x7e,0x00,0x00] + setns 0x7eed + +// CHECK: setns 3133065982 +// CHECK: encoding: [0x0f,0x99,0x05,0xfe,0xca,0xbe,0xba] + setns 0xbabecafe + +// CHECK: setns 305419896 +// CHECK: encoding: [0x0f,0x99,0x05,0x78,0x56,0x34,0x12] + setns 0x12345678 + +// CHECK: setp %bl +// CHECK: encoding: [0x0f,0x9a,0xc3] + setp %bl + +// CHECK: setp 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9a,0x84,0xcb,0xef,0xbe,0xad,0xde] + setp 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setp 32493 +// CHECK: encoding: [0x0f,0x9a,0x05,0xed,0x7e,0x00,0x00] + setp 0x7eed + +// CHECK: setp 3133065982 +// CHECK: encoding: [0x0f,0x9a,0x05,0xfe,0xca,0xbe,0xba] + setp 0xbabecafe + +// CHECK: setp 305419896 +// CHECK: encoding: [0x0f,0x9a,0x05,0x78,0x56,0x34,0x12] + setp 0x12345678 + +// CHECK: setnp %bl +// CHECK: encoding: [0x0f,0x9b,0xc3] + setnp %bl + +// CHECK: setnp 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9b,0x84,0xcb,0xef,0xbe,0xad,0xde] + setnp 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setnp 32493 +// CHECK: encoding: [0x0f,0x9b,0x05,0xed,0x7e,0x00,0x00] + setnp 0x7eed + +// CHECK: setnp 3133065982 +// CHECK: encoding: [0x0f,0x9b,0x05,0xfe,0xca,0xbe,0xba] + setnp 0xbabecafe + +// CHECK: setnp 305419896 +// CHECK: encoding: [0x0f,0x9b,0x05,0x78,0x56,0x34,0x12] + setnp 0x12345678 + +// CHECK: setl %bl +// CHECK: encoding: [0x0f,0x9c,0xc3] + setl %bl + +// CHECK: setl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9c,0x84,0xcb,0xef,0xbe,0xad,0xde] + setl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setl 32493 +// CHECK: encoding: [0x0f,0x9c,0x05,0xed,0x7e,0x00,0x00] + setl 0x7eed + +// CHECK: setl 3133065982 +// CHECK: encoding: [0x0f,0x9c,0x05,0xfe,0xca,0xbe,0xba] + setl 0xbabecafe + +// CHECK: setl 305419896 +// CHECK: encoding: [0x0f,0x9c,0x05,0x78,0x56,0x34,0x12] + setl 0x12345678 + +// CHECK: setge %bl +// CHECK: encoding: [0x0f,0x9d,0xc3] + setge %bl + +// CHECK: setge 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9d,0x84,0xcb,0xef,0xbe,0xad,0xde] + setge 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setge 32493 +// CHECK: encoding: [0x0f,0x9d,0x05,0xed,0x7e,0x00,0x00] + setge 0x7eed + +// CHECK: setge 3133065982 +// CHECK: encoding: [0x0f,0x9d,0x05,0xfe,0xca,0xbe,0xba] + setge 0xbabecafe + +// CHECK: setge 305419896 +// CHECK: encoding: [0x0f,0x9d,0x05,0x78,0x56,0x34,0x12] + setge 0x12345678 + +// CHECK: setle %bl +// CHECK: encoding: [0x0f,0x9e,0xc3] + setle %bl + +// CHECK: setle 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9e,0x84,0xcb,0xef,0xbe,0xad,0xde] + setle 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setle 32493 +// CHECK: encoding: [0x0f,0x9e,0x05,0xed,0x7e,0x00,0x00] + setle 0x7eed + +// CHECK: setle 3133065982 +// CHECK: encoding: [0x0f,0x9e,0x05,0xfe,0xca,0xbe,0xba] + setle 0xbabecafe + +// CHECK: setle 305419896 +// CHECK: encoding: [0x0f,0x9e,0x05,0x78,0x56,0x34,0x12] + setle 0x12345678 + +// CHECK: setg %bl +// CHECK: encoding: [0x0f,0x9f,0xc3] + setg %bl + +// CHECK: setg 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x9f,0x84,0xcb,0xef,0xbe,0xad,0xde] + setg 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: setg 32493 +// CHECK: encoding: [0x0f,0x9f,0x05,0xed,0x7e,0x00,0x00] + setg 0x7eed + +// CHECK: setg 3133065982 +// CHECK: encoding: [0x0f,0x9f,0x05,0xfe,0xca,0xbe,0xba] + setg 0xbabecafe + +// CHECK: setg 305419896 +// CHECK: encoding: [0x0f,0x9f,0x05,0x78,0x56,0x34,0x12] + setg 0x12345678 + +// CHECK: rsm +// CHECK: encoding: [0x0f,0xaa] + rsm + +// CHECK: hlt +// CHECK: encoding: [0xf4] + hlt + +// CHECK: nopl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x1f,0x84,0xcb,0xef,0xbe,0xad,0xde] + nopl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: nopw 32493 +// CHECK: encoding: [0x66,0x0f,0x1f,0x05,0xed,0x7e,0x00,0x00] + nopw 0x7eed + +// CHECK: nopl 3133065982 +// CHECK: encoding: [0x0f,0x1f,0x05,0xfe,0xca,0xbe,0xba] + nopl 0xbabecafe + +// CHECK: nopl 305419896 +// CHECK: encoding: [0x0f,0x1f,0x05,0x78,0x56,0x34,0x12] + nopl 0x12345678 + +// CHECK: nop +// CHECK: encoding: [0x90] + nop + +// CHECK: lldtw 32493 +// CHECK: encoding: [0x0f,0x00,0x15,0xed,0x7e,0x00,0x00] + lldtw 0x7eed + +// CHECK: lmsww 32493 +// CHECK: encoding: [0x0f,0x01,0x35,0xed,0x7e,0x00,0x00] + lmsww 0x7eed + +// CHECK: ltrw 32493 +// CHECK: encoding: [0x0f,0x00,0x1d,0xed,0x7e,0x00,0x00] + ltrw 0x7eed + +// CHECK: sldtw 32493 +// CHECK: encoding: [0x0f,0x00,0x05,0xed,0x7e,0x00,0x00] + sldtw 0x7eed + +// CHECK: smsww 32493 +// CHECK: encoding: [0x0f,0x01,0x25,0xed,0x7e,0x00,0x00] + smsww 0x7eed + +// CHECK: strw 32493 +// CHECK: encoding: [0x0f,0x00,0x0d,0xed,0x7e,0x00,0x00] + strw 0x7eed + +// CHECK: verr %bx +// CHECK: encoding: [0x0f,0x00,0xe3] + verr %bx + +// CHECK: verr 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x00,0xa4,0xcb,0xef,0xbe,0xad,0xde] + verr 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: verr 3133065982 +// CHECK: encoding: [0x0f,0x00,0x25,0xfe,0xca,0xbe,0xba] + verr 0xbabecafe + +// CHECK: verr 305419896 +// CHECK: encoding: [0x0f,0x00,0x25,0x78,0x56,0x34,0x12] + verr 0x12345678 + +// CHECK: verw %bx +// CHECK: encoding: [0x0f,0x00,0xeb] + verw %bx + +// CHECK: verw 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x00,0xac,0xcb,0xef,0xbe,0xad,0xde] + verw 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: verw 3133065982 +// CHECK: encoding: [0x0f,0x00,0x2d,0xfe,0xca,0xbe,0xba] + verw 0xbabecafe + +// CHECK: verw 305419896 +// CHECK: encoding: [0x0f,0x00,0x2d,0x78,0x56,0x34,0x12] + verw 0x12345678 + +// CHECK: fld %st(2) +// CHECK: encoding: [0xd9,0xc2] + fld %st(2) + +// CHECK: fldl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdd,0x84,0xcb,0xef,0xbe,0xad,0xde] + fldl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fldl 3133065982 +// CHECK: encoding: [0xdd,0x05,0xfe,0xca,0xbe,0xba] + fldl 0xbabecafe + +// CHECK: fldl 305419896 +// CHECK: encoding: [0xdd,0x05,0x78,0x56,0x34,0x12] + fldl 0x12345678 + +// CHECK: fld %st(2) +// CHECK: encoding: [0xd9,0xc2] + fld %st(2) + +// CHECK: fildl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0x84,0xcb,0xef,0xbe,0xad,0xde] + fildl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fildl 3133065982 +// CHECK: encoding: [0xdb,0x05,0xfe,0xca,0xbe,0xba] + fildl 0xbabecafe + +// CHECK: fildl 305419896 +// CHECK: encoding: [0xdb,0x05,0x78,0x56,0x34,0x12] + fildl 0x12345678 + +// CHECK: fildll 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdf,0xac,0xcb,0xef,0xbe,0xad,0xde] + fildll 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fildll 32493 +// CHECK: encoding: [0xdf,0x2d,0xed,0x7e,0x00,0x00] + fildll 0x7eed + +// CHECK: fildll 3133065982 +// CHECK: encoding: [0xdf,0x2d,0xfe,0xca,0xbe,0xba] + fildll 0xbabecafe + +// CHECK: fildll 305419896 +// CHECK: encoding: [0xdf,0x2d,0x78,0x56,0x34,0x12] + fildll 0x12345678 + +// CHECK: fldt 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0xac,0xcb,0xef,0xbe,0xad,0xde] + fldt 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fldt 32493 +// CHECK: encoding: [0xdb,0x2d,0xed,0x7e,0x00,0x00] + fldt 0x7eed + +// CHECK: fldt 3133065982 +// CHECK: encoding: [0xdb,0x2d,0xfe,0xca,0xbe,0xba] + fldt 0xbabecafe + +// CHECK: fldt 305419896 +// CHECK: encoding: [0xdb,0x2d,0x78,0x56,0x34,0x12] + fldt 0x12345678 + +// CHECK: fbld 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdf,0xa4,0xcb,0xef,0xbe,0xad,0xde] + fbld 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fbld 32493 +// CHECK: encoding: [0xdf,0x25,0xed,0x7e,0x00,0x00] + fbld 0x7eed + +// CHECK: fbld 3133065982 +// CHECK: encoding: [0xdf,0x25,0xfe,0xca,0xbe,0xba] + fbld 0xbabecafe + +// CHECK: fbld 305419896 +// CHECK: encoding: [0xdf,0x25,0x78,0x56,0x34,0x12] + fbld 0x12345678 + +// CHECK: fst %st(2) +// CHECK: encoding: [0xdd,0xd2] + fst %st(2) + +// CHECK: fstl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdd,0x94,0xcb,0xef,0xbe,0xad,0xde] + fstl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fstl 3133065982 +// CHECK: encoding: [0xdd,0x15,0xfe,0xca,0xbe,0xba] + fstl 0xbabecafe + +// CHECK: fstl 305419896 +// CHECK: encoding: [0xdd,0x15,0x78,0x56,0x34,0x12] + fstl 0x12345678 + +// CHECK: fst %st(2) +// CHECK: encoding: [0xdd,0xd2] + fst %st(2) + +// CHECK: fistl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0x94,0xcb,0xef,0xbe,0xad,0xde] + fistl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fistl 3133065982 +// CHECK: encoding: [0xdb,0x15,0xfe,0xca,0xbe,0xba] + fistl 0xbabecafe + +// CHECK: fistl 305419896 +// CHECK: encoding: [0xdb,0x15,0x78,0x56,0x34,0x12] + fistl 0x12345678 + +// CHECK: fstp %st(2) +// CHECK: encoding: [0xdd,0xda] + fstp %st(2) + +// CHECK: fstpl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdd,0x9c,0xcb,0xef,0xbe,0xad,0xde] + fstpl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fstpl 3133065982 +// CHECK: encoding: [0xdd,0x1d,0xfe,0xca,0xbe,0xba] + fstpl 0xbabecafe + +// CHECK: fstpl 305419896 +// CHECK: encoding: [0xdd,0x1d,0x78,0x56,0x34,0x12] + fstpl 0x12345678 + +// CHECK: fstp %st(2) +// CHECK: encoding: [0xdd,0xda] + fstp %st(2) + +// CHECK: fistpl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0x9c,0xcb,0xef,0xbe,0xad,0xde] + fistpl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fistpl 3133065982 +// CHECK: encoding: [0xdb,0x1d,0xfe,0xca,0xbe,0xba] + fistpl 0xbabecafe + +// CHECK: fistpl 305419896 +// CHECK: encoding: [0xdb,0x1d,0x78,0x56,0x34,0x12] + fistpl 0x12345678 + +// CHECK: fistpll 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdf,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fistpll 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fistpll 32493 +// CHECK: encoding: [0xdf,0x3d,0xed,0x7e,0x00,0x00] + fistpll 0x7eed + +// CHECK: fistpll 3133065982 +// CHECK: encoding: [0xdf,0x3d,0xfe,0xca,0xbe,0xba] + fistpll 0xbabecafe + +// CHECK: fistpll 305419896 +// CHECK: encoding: [0xdf,0x3d,0x78,0x56,0x34,0x12] + fistpll 0x12345678 + +// CHECK: fstpt 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fstpt 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fstpt 32493 +// CHECK: encoding: [0xdb,0x3d,0xed,0x7e,0x00,0x00] + fstpt 0x7eed + +// CHECK: fstpt 3133065982 +// CHECK: encoding: [0xdb,0x3d,0xfe,0xca,0xbe,0xba] + fstpt 0xbabecafe + +// CHECK: fstpt 305419896 +// CHECK: encoding: [0xdb,0x3d,0x78,0x56,0x34,0x12] + fstpt 0x12345678 + +// CHECK: fbstp 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdf,0xb4,0xcb,0xef,0xbe,0xad,0xde] + fbstp 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fbstp 32493 +// CHECK: encoding: [0xdf,0x35,0xed,0x7e,0x00,0x00] + fbstp 0x7eed + +// CHECK: fbstp 3133065982 +// CHECK: encoding: [0xdf,0x35,0xfe,0xca,0xbe,0xba] + fbstp 0xbabecafe + +// CHECK: fbstp 305419896 +// CHECK: encoding: [0xdf,0x35,0x78,0x56,0x34,0x12] + fbstp 0x12345678 + +// CHECK: fxch %st(2) +// CHECK: encoding: [0xd9,0xca] + fxch %st(2) + +// CHECK: fcom %st(2) +// CHECK: encoding: [0xd8,0xd2] + fcom %st(2) + +// CHECK: fcom %st(2) +// CHECK: encoding: [0xd8,0xd2] + fcom %st(2) + +// CHECK: ficoml 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0x94,0xcb,0xef,0xbe,0xad,0xde] + ficoml 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: ficoml 3133065982 +// CHECK: encoding: [0xda,0x15,0xfe,0xca,0xbe,0xba] + ficoml 0xbabecafe + +// CHECK: ficoml 305419896 +// CHECK: encoding: [0xda,0x15,0x78,0x56,0x34,0x12] + ficoml 0x12345678 + +// CHECK: fcomp %st(2) +// CHECK: encoding: [0xd8,0xda] + fcomp %st(2) + +// CHECK: fcomp %st(2) +// CHECK: encoding: [0xd8,0xda] + fcomp %st(2) + +// CHECK: ficompl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0x9c,0xcb,0xef,0xbe,0xad,0xde] + ficompl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: ficompl 3133065982 +// CHECK: encoding: [0xda,0x1d,0xfe,0xca,0xbe,0xba] + ficompl 0xbabecafe + +// CHECK: ficompl 305419896 +// CHECK: encoding: [0xda,0x1d,0x78,0x56,0x34,0x12] + ficompl 0x12345678 + +// CHECK: fcompp +// CHECK: encoding: [0xde,0xd9] + fcompp + +// CHECK: fucom %st(2) +// CHECK: encoding: [0xdd,0xe2] + fucom %st(2) + +// CHECK: fucomp %st(2) +// CHECK: encoding: [0xdd,0xea] + fucomp %st(2) + +// CHECK: fucompp +// CHECK: encoding: [0xda,0xe9] + fucompp + +// CHECK: ftst +// CHECK: encoding: [0xd9,0xe4] + ftst + +// CHECK: fxam +// CHECK: encoding: [0xd9,0xe5] + fxam + +// CHECK: fld1 +// CHECK: encoding: [0xd9,0xe8] + fld1 + +// CHECK: fldl2t +// CHECK: encoding: [0xd9,0xe9] + fldl2t + +// CHECK: fldl2e +// CHECK: encoding: [0xd9,0xea] + fldl2e + +// CHECK: fldpi +// CHECK: encoding: [0xd9,0xeb] + fldpi + +// CHECK: fldlg2 +// CHECK: encoding: [0xd9,0xec] + fldlg2 + +// CHECK: fldln2 +// CHECK: encoding: [0xd9,0xed] + fldln2 + +// CHECK: fldz +// CHECK: encoding: [0xd9,0xee] + fldz + +// CHECK: fadd %st(2) +// CHECK: encoding: [0xd8,0xc2] + fadd %st(2) + +// CHECK: faddl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0x84,0xcb,0xef,0xbe,0xad,0xde] + faddl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: faddl 3133065982 +// CHECK: encoding: [0xdc,0x05,0xfe,0xca,0xbe,0xba] + faddl 0xbabecafe + +// CHECK: faddl 305419896 +// CHECK: encoding: [0xdc,0x05,0x78,0x56,0x34,0x12] + faddl 0x12345678 + +// CHECK: fiaddl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0x84,0xcb,0xef,0xbe,0xad,0xde] + fiaddl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fiaddl 3133065982 +// CHECK: encoding: [0xda,0x05,0xfe,0xca,0xbe,0xba] + fiaddl 0xbabecafe + +// CHECK: fiaddl 305419896 +// CHECK: encoding: [0xda,0x05,0x78,0x56,0x34,0x12] + fiaddl 0x12345678 + +// CHECK: faddp %st(2) +// CHECK: encoding: [0xde,0xc2] + faddp %st(2) + +// CHECK: fsub %st(2) +// CHECK: encoding: [0xd8,0xe2] + fsub %st(2) + +// CHECK: fsubl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0xa4,0xcb,0xef,0xbe,0xad,0xde] + fsubl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fsubl 3133065982 +// CHECK: encoding: [0xdc,0x25,0xfe,0xca,0xbe,0xba] + fsubl 0xbabecafe + +// CHECK: fsubl 305419896 +// CHECK: encoding: [0xdc,0x25,0x78,0x56,0x34,0x12] + fsubl 0x12345678 + +// CHECK: fisubl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0xa4,0xcb,0xef,0xbe,0xad,0xde] + fisubl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fisubl 3133065982 +// CHECK: encoding: [0xda,0x25,0xfe,0xca,0xbe,0xba] + fisubl 0xbabecafe + +// CHECK: fisubl 305419896 +// CHECK: encoding: [0xda,0x25,0x78,0x56,0x34,0x12] + fisubl 0x12345678 + +// CHECK: fsubp %st(2) +// CHECK: encoding: [0xde,0xe2] + fsubp %st(2) + +// CHECK: fsubr %st(2) +// CHECK: encoding: [0xd8,0xea] + fsubr %st(2) + +// CHECK: fsubrl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0xac,0xcb,0xef,0xbe,0xad,0xde] + fsubrl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fsubrl 3133065982 +// CHECK: encoding: [0xdc,0x2d,0xfe,0xca,0xbe,0xba] + fsubrl 0xbabecafe + +// CHECK: fsubrl 305419896 +// CHECK: encoding: [0xdc,0x2d,0x78,0x56,0x34,0x12] + fsubrl 0x12345678 + +// CHECK: fisubrl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0xac,0xcb,0xef,0xbe,0xad,0xde] + fisubrl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fisubrl 3133065982 +// CHECK: encoding: [0xda,0x2d,0xfe,0xca,0xbe,0xba] + fisubrl 0xbabecafe + +// CHECK: fisubrl 305419896 +// CHECK: encoding: [0xda,0x2d,0x78,0x56,0x34,0x12] + fisubrl 0x12345678 + +// CHECK: fsubrp %st(2) +// CHECK: encoding: [0xde,0xea] + fsubrp %st(2) + +// CHECK: fmul %st(2) +// CHECK: encoding: [0xd8,0xca] + fmul %st(2) + +// CHECK: fmull 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0x8c,0xcb,0xef,0xbe,0xad,0xde] + fmull 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fmull 3133065982 +// CHECK: encoding: [0xdc,0x0d,0xfe,0xca,0xbe,0xba] + fmull 0xbabecafe + +// CHECK: fmull 305419896 +// CHECK: encoding: [0xdc,0x0d,0x78,0x56,0x34,0x12] + fmull 0x12345678 + +// CHECK: fimull 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0x8c,0xcb,0xef,0xbe,0xad,0xde] + fimull 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fimull 3133065982 +// CHECK: encoding: [0xda,0x0d,0xfe,0xca,0xbe,0xba] + fimull 0xbabecafe + +// CHECK: fimull 305419896 +// CHECK: encoding: [0xda,0x0d,0x78,0x56,0x34,0x12] + fimull 0x12345678 + +// CHECK: fmulp %st(2) +// CHECK: encoding: [0xde,0xca] + fmulp %st(2) + +// CHECK: fdiv %st(2) +// CHECK: encoding: [0xd8,0xf2] + fdiv %st(2) + +// CHECK: fdivl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0xb4,0xcb,0xef,0xbe,0xad,0xde] + fdivl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fdivl 3133065982 +// CHECK: encoding: [0xdc,0x35,0xfe,0xca,0xbe,0xba] + fdivl 0xbabecafe + +// CHECK: fdivl 305419896 +// CHECK: encoding: [0xdc,0x35,0x78,0x56,0x34,0x12] + fdivl 0x12345678 + +// CHECK: fidivl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0xb4,0xcb,0xef,0xbe,0xad,0xde] + fidivl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fidivl 3133065982 +// CHECK: encoding: [0xda,0x35,0xfe,0xca,0xbe,0xba] + fidivl 0xbabecafe + +// CHECK: fidivl 305419896 +// CHECK: encoding: [0xda,0x35,0x78,0x56,0x34,0x12] + fidivl 0x12345678 + +// CHECK: fdivp %st(2) +// CHECK: encoding: [0xde,0xf2] + fdivp %st(2) + +// CHECK: fdivr %st(2) +// CHECK: encoding: [0xd8,0xfa] + fdivr %st(2) + +// CHECK: fdivrl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdc,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fdivrl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fdivrl 3133065982 +// CHECK: encoding: [0xdc,0x3d,0xfe,0xca,0xbe,0xba] + fdivrl 0xbabecafe + +// CHECK: fdivrl 305419896 +// CHECK: encoding: [0xdc,0x3d,0x78,0x56,0x34,0x12] + fdivrl 0x12345678 + +// CHECK: fidivrl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xda,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fidivrl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fidivrl 3133065982 +// CHECK: encoding: [0xda,0x3d,0xfe,0xca,0xbe,0xba] + fidivrl 0xbabecafe + +// CHECK: fidivrl 305419896 +// CHECK: encoding: [0xda,0x3d,0x78,0x56,0x34,0x12] + fidivrl 0x12345678 + +// CHECK: fdivrp %st(2) +// CHECK: encoding: [0xde,0xfa] + fdivrp %st(2) + +// CHECK: f2xm1 +// CHECK: encoding: [0xd9,0xf0] + f2xm1 + +// CHECK: fyl2x +// CHECK: encoding: [0xd9,0xf1] + fyl2x + +// CHECK: fptan +// CHECK: encoding: [0xd9,0xf2] + fptan + +// CHECK: fpatan +// CHECK: encoding: [0xd9,0xf3] + fpatan + +// CHECK: fxtract +// CHECK: encoding: [0xd9,0xf4] + fxtract + +// CHECK: fprem1 +// CHECK: encoding: [0xd9,0xf5] + fprem1 + +// CHECK: fdecstp +// CHECK: encoding: [0xd9,0xf6] + fdecstp + +// CHECK: fincstp +// CHECK: encoding: [0xd9,0xf7] + fincstp + +// CHECK: fprem +// CHECK: encoding: [0xd9,0xf8] + fprem + +// CHECK: fyl2xp1 +// CHECK: encoding: [0xd9,0xf9] + fyl2xp1 + +// CHECK: fsqrt +// CHECK: encoding: [0xd9,0xfa] + fsqrt + +// CHECK: fsincos +// CHECK: encoding: [0xd9,0xfb] + fsincos + +// CHECK: frndint +// CHECK: encoding: [0xd9,0xfc] + frndint + +// CHECK: fscale +// CHECK: encoding: [0xd9,0xfd] + fscale + +// CHECK: fsin +// CHECK: encoding: [0xd9,0xfe] + fsin + +// CHECK: fcos +// CHECK: encoding: [0xd9,0xff] + fcos + +// CHECK: fchs +// CHECK: encoding: [0xd9,0xe0] + fchs + +// CHECK: fabs +// CHECK: encoding: [0xd9,0xe1] + fabs + +// CHECK: fninit +// CHECK: encoding: [0xdb,0xe3] + fninit + +// CHECK: fldcw 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd9,0xac,0xcb,0xef,0xbe,0xad,0xde] + fldcw 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fldcw 3133065982 +// CHECK: encoding: [0xd9,0x2d,0xfe,0xca,0xbe,0xba] + fldcw 0xbabecafe + +// CHECK: fldcw 305419896 +// CHECK: encoding: [0xd9,0x2d,0x78,0x56,0x34,0x12] + fldcw 0x12345678 + +// CHECK: fnstcw 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xd9,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fnstcw 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fnstcw 3133065982 +// CHECK: encoding: [0xd9,0x3d,0xfe,0xca,0xbe,0xba] + fnstcw 0xbabecafe + +// CHECK: fnstcw 305419896 +// CHECK: encoding: [0xd9,0x3d,0x78,0x56,0x34,0x12] + fnstcw 0x12345678 + +// CHECK: fnstsw 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdd,0xbc,0xcb,0xef,0xbe,0xad,0xde] + fnstsw 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fnstsw 3133065982 +// CHECK: encoding: [0xdd,0x3d,0xfe,0xca,0xbe,0xba] + fnstsw 0xbabecafe + +// CHECK: fnstsw 305419896 +// CHECK: encoding: [0xdd,0x3d,0x78,0x56,0x34,0x12] + fnstsw 0x12345678 + +// CHECK: fnclex +// CHECK: encoding: [0xdb,0xe2] + fnclex + +// CHECK: fnstenv 32493 +// CHECK: encoding: [0xd9,0x35,0xed,0x7e,0x00,0x00] + fnstenv 0x7eed + +// CHECK: fldenv 32493 +// CHECK: encoding: [0xd9,0x25,0xed,0x7e,0x00,0x00] + fldenv 0x7eed + +// CHECK: fnsave 32493 +// CHECK: encoding: [0xdd,0x35,0xed,0x7e,0x00,0x00] + fnsave 0x7eed + +// CHECK: frstor 32493 +// CHECK: encoding: [0xdd,0x25,0xed,0x7e,0x00,0x00] + frstor 0x7eed + +// CHECK: ffree %st(2) +// CHECK: encoding: [0xdd,0xc2] + ffree %st(2) + +// CHECK: fnop +// CHECK: encoding: [0xd9,0xd0] + fnop + +// CHECK: invd +// CHECK: encoding: [0x0f,0x08] + invd + +// CHECK: wbinvd +// CHECK: encoding: [0x0f,0x09] + wbinvd + +// CHECK: cpuid +// CHECK: encoding: [0x0f,0xa2] + cpuid + +// CHECK: wrmsr +// CHECK: encoding: [0x0f,0x30] + wrmsr + +// CHECK: rdtsc +// CHECK: encoding: [0x0f,0x31] + rdtsc + +// CHECK: rdmsr +// CHECK: encoding: [0x0f,0x32] + rdmsr + +// CHECK: cmpxchg8b 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xc7,0x8c,0xcb,0xef,0xbe,0xad,0xde] + cmpxchg8b 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: cmpxchg8b 32493 +// CHECK: encoding: [0x0f,0xc7,0x0d,0xed,0x7e,0x00,0x00] + cmpxchg8b 0x7eed + +// CHECK: cmpxchg8b 3133065982 +// CHECK: encoding: [0x0f,0xc7,0x0d,0xfe,0xca,0xbe,0xba] + cmpxchg8b 0xbabecafe + +// CHECK: cmpxchg8b 305419896 +// CHECK: encoding: [0x0f,0xc7,0x0d,0x78,0x56,0x34,0x12] + cmpxchg8b 0x12345678 + +// CHECK: sysenter +// CHECK: encoding: [0x0f,0x34] + sysenter + +// CHECK: sysexit +// CHECK: encoding: [0x0f,0x35] + sysexit + +// CHECK: fxsave 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xae,0x84,0xcb,0xef,0xbe,0xad,0xde] + fxsave 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fxsave 32493 +// CHECK: encoding: [0x0f,0xae,0x05,0xed,0x7e,0x00,0x00] + fxsave 0x7eed + +// CHECK: fxsave 3133065982 +// CHECK: encoding: [0x0f,0xae,0x05,0xfe,0xca,0xbe,0xba] + fxsave 0xbabecafe + +// CHECK: fxsave 305419896 +// CHECK: encoding: [0x0f,0xae,0x05,0x78,0x56,0x34,0x12] + fxsave 0x12345678 + +// CHECK: fxrstor 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xae,0x8c,0xcb,0xef,0xbe,0xad,0xde] + fxrstor 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fxrstor 32493 +// CHECK: encoding: [0x0f,0xae,0x0d,0xed,0x7e,0x00,0x00] + fxrstor 0x7eed + +// CHECK: fxrstor 3133065982 +// CHECK: encoding: [0x0f,0xae,0x0d,0xfe,0xca,0xbe,0xba] + fxrstor 0xbabecafe + +// CHECK: fxrstor 305419896 +// CHECK: encoding: [0x0f,0xae,0x0d,0x78,0x56,0x34,0x12] + fxrstor 0x12345678 + +// CHECK: rdpmc +// CHECK: encoding: [0x0f,0x33] + rdpmc + +// CHECK: ud2 +// CHECK: encoding: [0x0f,0x0b] + ud2 + +// CHECK: fcmovb %st(2), %st(0) +// CHECK: encoding: [0xda,0xc2] + fcmovb %st(2),%st + +// CHECK: fcmove %st(2), %st(0) +// CHECK: encoding: [0xda,0xca] + fcmove %st(2),%st + +// CHECK: fcmovbe %st(2), %st(0) +// CHECK: encoding: [0xda,0xd2] + fcmovbe %st(2),%st + +// CHECK: fcmovu %st(2), %st(0) +// CHECK: encoding: [0xda,0xda] + fcmovu %st(2),%st + +// CHECK: fcmovnb %st(2), %st(0) +// CHECK: encoding: [0xdb,0xc2] + fcmovnb %st(2),%st + +// CHECK: fcmovne %st(2), %st(0) +// CHECK: encoding: [0xdb,0xca] + fcmovne %st(2),%st + +// CHECK: fcmovnbe %st(2), %st(0) +// CHECK: encoding: [0xdb,0xd2] + fcmovnbe %st(2),%st + +// CHECK: fcmovnu %st(2), %st(0) +// CHECK: encoding: [0xdb,0xda] + fcmovnu %st(2),%st + +// CHECK: fcomi %st(2), %st(0) +// CHECK: encoding: [0xdb,0xf2] + fcomi %st(2),%st + +// CHECK: fucomi %st(2), %st(0) +// CHECK: encoding: [0xdb,0xea] + fucomi %st(2),%st + +// CHECK: fcomip %st(2), %st(0) +// CHECK: encoding: [0xdf,0xf2] + fcomip %st(2),%st + +// CHECK: fucomip %st(2), %st(0) +// CHECK: encoding: [0xdf,0xea] + fucomip %st(2),%st + +// CHECK: movnti %ecx, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xc3,0x8c,0xcb,0xef,0xbe,0xad,0xde] + movnti %ecx,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movnti %ecx, 69 +// CHECK: encoding: [0x0f,0xc3,0x0d,0x45,0x00,0x00,0x00] + movnti %ecx,0x45 + +// CHECK: movnti %ecx, 32493 +// CHECK: encoding: [0x0f,0xc3,0x0d,0xed,0x7e,0x00,0x00] + movnti %ecx,0x7eed + +// CHECK: movnti %ecx, 3133065982 +// CHECK: encoding: [0x0f,0xc3,0x0d,0xfe,0xca,0xbe,0xba] + movnti %ecx,0xbabecafe + +// CHECK: movnti %ecx, 305419896 +// CHECK: encoding: [0x0f,0xc3,0x0d,0x78,0x56,0x34,0x12] + movnti %ecx,0x12345678 + +// CHECK: clflush 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xae,0xbc,0xcb,0xef,0xbe,0xad,0xde] + clflush 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: clflush 32493 +// CHECK: encoding: [0x0f,0xae,0x3d,0xed,0x7e,0x00,0x00] + clflush 0x7eed + +// CHECK: clflush 3133065982 +// CHECK: encoding: [0x0f,0xae,0x3d,0xfe,0xca,0xbe,0xba] + clflush 0xbabecafe + +// CHECK: clflush 305419896 +// CHECK: encoding: [0x0f,0xae,0x3d,0x78,0x56,0x34,0x12] + clflush 0x12345678 + +// CHECK: emms +// CHECK: encoding: [0x0f,0x77] + emms + +// CHECK: movd %ecx, %mm3 +// CHECK: encoding: [0x0f,0x6e,0xd9] + movd %ecx,%mm3 + +// CHECK: movd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x6e,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: movd 69, %mm3 +// CHECK: encoding: [0x0f,0x6e,0x1d,0x45,0x00,0x00,0x00] + movd 0x45,%mm3 + +// CHECK: movd 32493, %mm3 +// CHECK: encoding: [0x0f,0x6e,0x1d,0xed,0x7e,0x00,0x00] + movd 0x7eed,%mm3 + +// CHECK: movd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x6e,0x1d,0xfe,0xca,0xbe,0xba] + movd 0xbabecafe,%mm3 + +// CHECK: movd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x6e,0x1d,0x78,0x56,0x34,0x12] + movd 0x12345678,%mm3 + +// CHECK: movd %mm3, %ecx +// CHECK: encoding: [0x0f,0x7e,0xd9] + movd %mm3,%ecx + +// CHECK: movd %mm3, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x7e,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movd %mm3,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movd %mm3, 69 +// CHECK: encoding: [0x0f,0x7e,0x1d,0x45,0x00,0x00,0x00] + movd %mm3,0x45 + +// CHECK: movd %mm3, 32493 +// CHECK: encoding: [0x0f,0x7e,0x1d,0xed,0x7e,0x00,0x00] + movd %mm3,0x7eed + +// CHECK: movd %mm3, 3133065982 +// CHECK: encoding: [0x0f,0x7e,0x1d,0xfe,0xca,0xbe,0xba] + movd %mm3,0xbabecafe + +// CHECK: movd %mm3, 305419896 +// CHECK: encoding: [0x0f,0x7e,0x1d,0x78,0x56,0x34,0x12] + movd %mm3,0x12345678 + +// CHECK: movd %ecx, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0xe9] + movd %ecx,%xmm5 + +// CHECK: movd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0xac,0xcb,0xef,0xbe,0xad,0xde] + movd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0x2d,0x45,0x00,0x00,0x00] + movd 0x45,%xmm5 + +// CHECK: movd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0x2d,0xed,0x7e,0x00,0x00] + movd 0x7eed,%xmm5 + +// CHECK: movd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0x2d,0xfe,0xca,0xbe,0xba] + movd 0xbabecafe,%xmm5 + +// CHECK: movd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6e,0x2d,0x78,0x56,0x34,0x12] + movd 0x12345678,%xmm5 + +// CHECK: movd %xmm5, %ecx +// CHECK: encoding: [0x66,0x0f,0x7e,0xe9] + movd %xmm5,%ecx + +// CHECK: movd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x7e,0xac,0xcb,0xef,0xbe,0xad,0xde] + movd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x7e,0x2d,0x45,0x00,0x00,0x00] + movd %xmm5,0x45 + +// CHECK: movd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x7e,0x2d,0xed,0x7e,0x00,0x00] + movd %xmm5,0x7eed + +// CHECK: movd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x7e,0x2d,0xfe,0xca,0xbe,0xba] + movd %xmm5,0xbabecafe + +// CHECK: movd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x7e,0x2d,0x78,0x56,0x34,0x12] + movd %xmm5,0x12345678 + +// CHECK: movq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x6f,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: movq 69, %mm3 +// CHECK: encoding: [0x0f,0x6f,0x1d,0x45,0x00,0x00,0x00] + movq 0x45,%mm3 + +// CHECK: movq 32493, %mm3 +// CHECK: encoding: [0x0f,0x6f,0x1d,0xed,0x7e,0x00,0x00] + movq 0x7eed,%mm3 + +// CHECK: movq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x6f,0x1d,0xfe,0xca,0xbe,0xba] + movq 0xbabecafe,%mm3 + +// CHECK: movq 305419896, %mm3 +// CHECK: encoding: [0x0f,0x6f,0x1d,0x78,0x56,0x34,0x12] + movq 0x12345678,%mm3 + +// CHECK: movq %mm3, %mm3 +// CHECK: encoding: [0x0f,0x6f,0xdb] + movq %mm3,%mm3 + +// CHECK: movq %mm3, %mm3 +// CHECK: encoding: [0x0f,0x6f,0xdb] + movq %mm3,%mm3 + +// CHECK: movq %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x7e,0xed] + movq %xmm5,%xmm5 + +// CHECK: movq %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0xd6,0xac,0xcb,0xef,0xbe,0xad,0xde] + movq %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movq %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0xd6,0x2d,0x45,0x00,0x00,0x00] + movq %xmm5,0x45 + +// CHECK: movq %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0xd6,0x2d,0xed,0x7e,0x00,0x00] + movq %xmm5,0x7eed + +// CHECK: movq %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0xd6,0x2d,0xfe,0xca,0xbe,0xba] + movq %xmm5,0xbabecafe + +// CHECK: movq %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0xd6,0x2d,0x78,0x56,0x34,0x12] + movq %xmm5,0x12345678 + +// CHECK: movq %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x7e,0xed] + movq %xmm5,%xmm5 + +// CHECK: packssdw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x6b,0x9c,0xcb,0xef,0xbe,0xad,0xde] + packssdw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: packssdw 69, %mm3 +// CHECK: encoding: [0x0f,0x6b,0x1d,0x45,0x00,0x00,0x00] + packssdw 0x45,%mm3 + +// CHECK: packssdw 32493, %mm3 +// CHECK: encoding: [0x0f,0x6b,0x1d,0xed,0x7e,0x00,0x00] + packssdw 0x7eed,%mm3 + +// CHECK: packssdw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x6b,0x1d,0xfe,0xca,0xbe,0xba] + packssdw 0xbabecafe,%mm3 + +// CHECK: packssdw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x6b,0x1d,0x78,0x56,0x34,0x12] + packssdw 0x12345678,%mm3 + +// CHECK: packssdw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x6b,0xdb] + packssdw %mm3,%mm3 + +// CHECK: packssdw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0xac,0xcb,0xef,0xbe,0xad,0xde] + packssdw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: packssdw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0x2d,0x45,0x00,0x00,0x00] + packssdw 0x45,%xmm5 + +// CHECK: packssdw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0x2d,0xed,0x7e,0x00,0x00] + packssdw 0x7eed,%xmm5 + +// CHECK: packssdw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0x2d,0xfe,0xca,0xbe,0xba] + packssdw 0xbabecafe,%xmm5 + +// CHECK: packssdw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0x2d,0x78,0x56,0x34,0x12] + packssdw 0x12345678,%xmm5 + +// CHECK: packssdw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6b,0xed] + packssdw %xmm5,%xmm5 + +// CHECK: packsswb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x63,0x9c,0xcb,0xef,0xbe,0xad,0xde] + packsswb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: packsswb 69, %mm3 +// CHECK: encoding: [0x0f,0x63,0x1d,0x45,0x00,0x00,0x00] + packsswb 0x45,%mm3 + +// CHECK: packsswb 32493, %mm3 +// CHECK: encoding: [0x0f,0x63,0x1d,0xed,0x7e,0x00,0x00] + packsswb 0x7eed,%mm3 + +// CHECK: packsswb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x63,0x1d,0xfe,0xca,0xbe,0xba] + packsswb 0xbabecafe,%mm3 + +// CHECK: packsswb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x63,0x1d,0x78,0x56,0x34,0x12] + packsswb 0x12345678,%mm3 + +// CHECK: packsswb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x63,0xdb] + packsswb %mm3,%mm3 + +// CHECK: packsswb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0xac,0xcb,0xef,0xbe,0xad,0xde] + packsswb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: packsswb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0x2d,0x45,0x00,0x00,0x00] + packsswb 0x45,%xmm5 + +// CHECK: packsswb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0x2d,0xed,0x7e,0x00,0x00] + packsswb 0x7eed,%xmm5 + +// CHECK: packsswb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0x2d,0xfe,0xca,0xbe,0xba] + packsswb 0xbabecafe,%xmm5 + +// CHECK: packsswb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0x2d,0x78,0x56,0x34,0x12] + packsswb 0x12345678,%xmm5 + +// CHECK: packsswb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x63,0xed] + packsswb %xmm5,%xmm5 + +// CHECK: packuswb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x67,0x9c,0xcb,0xef,0xbe,0xad,0xde] + packuswb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: packuswb 69, %mm3 +// CHECK: encoding: [0x0f,0x67,0x1d,0x45,0x00,0x00,0x00] + packuswb 0x45,%mm3 + +// CHECK: packuswb 32493, %mm3 +// CHECK: encoding: [0x0f,0x67,0x1d,0xed,0x7e,0x00,0x00] + packuswb 0x7eed,%mm3 + +// CHECK: packuswb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x67,0x1d,0xfe,0xca,0xbe,0xba] + packuswb 0xbabecafe,%mm3 + +// CHECK: packuswb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x67,0x1d,0x78,0x56,0x34,0x12] + packuswb 0x12345678,%mm3 + +// CHECK: packuswb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x67,0xdb] + packuswb %mm3,%mm3 + +// CHECK: packuswb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0xac,0xcb,0xef,0xbe,0xad,0xde] + packuswb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: packuswb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0x2d,0x45,0x00,0x00,0x00] + packuswb 0x45,%xmm5 + +// CHECK: packuswb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0x2d,0xed,0x7e,0x00,0x00] + packuswb 0x7eed,%xmm5 + +// CHECK: packuswb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0x2d,0xfe,0xca,0xbe,0xba] + packuswb 0xbabecafe,%xmm5 + +// CHECK: packuswb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0x2d,0x78,0x56,0x34,0x12] + packuswb 0x12345678,%xmm5 + +// CHECK: packuswb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x67,0xed] + packuswb %xmm5,%xmm5 + +// CHECK: paddb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xfc,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddb 69, %mm3 +// CHECK: encoding: [0x0f,0xfc,0x1d,0x45,0x00,0x00,0x00] + paddb 0x45,%mm3 + +// CHECK: paddb 32493, %mm3 +// CHECK: encoding: [0x0f,0xfc,0x1d,0xed,0x7e,0x00,0x00] + paddb 0x7eed,%mm3 + +// CHECK: paddb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xfc,0x1d,0xfe,0xca,0xbe,0xba] + paddb 0xbabecafe,%mm3 + +// CHECK: paddb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xfc,0x1d,0x78,0x56,0x34,0x12] + paddb 0x12345678,%mm3 + +// CHECK: paddb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xfc,0xdb] + paddb %mm3,%mm3 + +// CHECK: paddb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0x2d,0x45,0x00,0x00,0x00] + paddb 0x45,%xmm5 + +// CHECK: paddb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0x2d,0xed,0x7e,0x00,0x00] + paddb 0x7eed,%xmm5 + +// CHECK: paddb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0x2d,0xfe,0xca,0xbe,0xba] + paddb 0xbabecafe,%xmm5 + +// CHECK: paddb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0x2d,0x78,0x56,0x34,0x12] + paddb 0x12345678,%xmm5 + +// CHECK: paddb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfc,0xed] + paddb %xmm5,%xmm5 + +// CHECK: paddw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xfd,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddw 69, %mm3 +// CHECK: encoding: [0x0f,0xfd,0x1d,0x45,0x00,0x00,0x00] + paddw 0x45,%mm3 + +// CHECK: paddw 32493, %mm3 +// CHECK: encoding: [0x0f,0xfd,0x1d,0xed,0x7e,0x00,0x00] + paddw 0x7eed,%mm3 + +// CHECK: paddw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xfd,0x1d,0xfe,0xca,0xbe,0xba] + paddw 0xbabecafe,%mm3 + +// CHECK: paddw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xfd,0x1d,0x78,0x56,0x34,0x12] + paddw 0x12345678,%mm3 + +// CHECK: paddw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xfd,0xdb] + paddw %mm3,%mm3 + +// CHECK: paddw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0x2d,0x45,0x00,0x00,0x00] + paddw 0x45,%xmm5 + +// CHECK: paddw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0x2d,0xed,0x7e,0x00,0x00] + paddw 0x7eed,%xmm5 + +// CHECK: paddw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0x2d,0xfe,0xca,0xbe,0xba] + paddw 0xbabecafe,%xmm5 + +// CHECK: paddw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0x2d,0x78,0x56,0x34,0x12] + paddw 0x12345678,%xmm5 + +// CHECK: paddw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfd,0xed] + paddw %xmm5,%xmm5 + +// CHECK: paddd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xfe,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddd 69, %mm3 +// CHECK: encoding: [0x0f,0xfe,0x1d,0x45,0x00,0x00,0x00] + paddd 0x45,%mm3 + +// CHECK: paddd 32493, %mm3 +// CHECK: encoding: [0x0f,0xfe,0x1d,0xed,0x7e,0x00,0x00] + paddd 0x7eed,%mm3 + +// CHECK: paddd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xfe,0x1d,0xfe,0xca,0xbe,0xba] + paddd 0xbabecafe,%mm3 + +// CHECK: paddd 305419896, %mm3 +// CHECK: encoding: [0x0f,0xfe,0x1d,0x78,0x56,0x34,0x12] + paddd 0x12345678,%mm3 + +// CHECK: paddd %mm3, %mm3 +// CHECK: encoding: [0x0f,0xfe,0xdb] + paddd %mm3,%mm3 + +// CHECK: paddd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0x2d,0x45,0x00,0x00,0x00] + paddd 0x45,%xmm5 + +// CHECK: paddd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0x2d,0xed,0x7e,0x00,0x00] + paddd 0x7eed,%xmm5 + +// CHECK: paddd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0x2d,0xfe,0xca,0xbe,0xba] + paddd 0xbabecafe,%xmm5 + +// CHECK: paddd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0x2d,0x78,0x56,0x34,0x12] + paddd 0x12345678,%xmm5 + +// CHECK: paddd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfe,0xed] + paddd %xmm5,%xmm5 + +// CHECK: paddq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd4,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddq 69, %mm3 +// CHECK: encoding: [0x0f,0xd4,0x1d,0x45,0x00,0x00,0x00] + paddq 0x45,%mm3 + +// CHECK: paddq 32493, %mm3 +// CHECK: encoding: [0x0f,0xd4,0x1d,0xed,0x7e,0x00,0x00] + paddq 0x7eed,%mm3 + +// CHECK: paddq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd4,0x1d,0xfe,0xca,0xbe,0xba] + paddq 0xbabecafe,%mm3 + +// CHECK: paddq 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd4,0x1d,0x78,0x56,0x34,0x12] + paddq 0x12345678,%mm3 + +// CHECK: paddq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd4,0xdb] + paddq %mm3,%mm3 + +// CHECK: paddq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0x2d,0x45,0x00,0x00,0x00] + paddq 0x45,%xmm5 + +// CHECK: paddq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0x2d,0xed,0x7e,0x00,0x00] + paddq 0x7eed,%xmm5 + +// CHECK: paddq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0x2d,0xfe,0xca,0xbe,0xba] + paddq 0xbabecafe,%xmm5 + +// CHECK: paddq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0x2d,0x78,0x56,0x34,0x12] + paddq 0x12345678,%xmm5 + +// CHECK: paddq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd4,0xed] + paddq %xmm5,%xmm5 + +// CHECK: paddsb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xec,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddsb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddsb 69, %mm3 +// CHECK: encoding: [0x0f,0xec,0x1d,0x45,0x00,0x00,0x00] + paddsb 0x45,%mm3 + +// CHECK: paddsb 32493, %mm3 +// CHECK: encoding: [0x0f,0xec,0x1d,0xed,0x7e,0x00,0x00] + paddsb 0x7eed,%mm3 + +// CHECK: paddsb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xec,0x1d,0xfe,0xca,0xbe,0xba] + paddsb 0xbabecafe,%mm3 + +// CHECK: paddsb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xec,0x1d,0x78,0x56,0x34,0x12] + paddsb 0x12345678,%mm3 + +// CHECK: paddsb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xec,0xdb] + paddsb %mm3,%mm3 + +// CHECK: paddsb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddsb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddsb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0x2d,0x45,0x00,0x00,0x00] + paddsb 0x45,%xmm5 + +// CHECK: paddsb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0x2d,0xed,0x7e,0x00,0x00] + paddsb 0x7eed,%xmm5 + +// CHECK: paddsb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0x2d,0xfe,0xca,0xbe,0xba] + paddsb 0xbabecafe,%xmm5 + +// CHECK: paddsb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0x2d,0x78,0x56,0x34,0x12] + paddsb 0x12345678,%xmm5 + +// CHECK: paddsb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xec,0xed] + paddsb %xmm5,%xmm5 + +// CHECK: paddsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xed,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddsw 69, %mm3 +// CHECK: encoding: [0x0f,0xed,0x1d,0x45,0x00,0x00,0x00] + paddsw 0x45,%mm3 + +// CHECK: paddsw 32493, %mm3 +// CHECK: encoding: [0x0f,0xed,0x1d,0xed,0x7e,0x00,0x00] + paddsw 0x7eed,%mm3 + +// CHECK: paddsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xed,0x1d,0xfe,0xca,0xbe,0xba] + paddsw 0xbabecafe,%mm3 + +// CHECK: paddsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xed,0x1d,0x78,0x56,0x34,0x12] + paddsw 0x12345678,%mm3 + +// CHECK: paddsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xed,0xdb] + paddsw %mm3,%mm3 + +// CHECK: paddsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0x2d,0x45,0x00,0x00,0x00] + paddsw 0x45,%xmm5 + +// CHECK: paddsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0x2d,0xed,0x7e,0x00,0x00] + paddsw 0x7eed,%xmm5 + +// CHECK: paddsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0x2d,0xfe,0xca,0xbe,0xba] + paddsw 0xbabecafe,%xmm5 + +// CHECK: paddsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0x2d,0x78,0x56,0x34,0x12] + paddsw 0x12345678,%xmm5 + +// CHECK: paddsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xed,0xed] + paddsw %xmm5,%xmm5 + +// CHECK: paddusb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xdc,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddusb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddusb 69, %mm3 +// CHECK: encoding: [0x0f,0xdc,0x1d,0x45,0x00,0x00,0x00] + paddusb 0x45,%mm3 + +// CHECK: paddusb 32493, %mm3 +// CHECK: encoding: [0x0f,0xdc,0x1d,0xed,0x7e,0x00,0x00] + paddusb 0x7eed,%mm3 + +// CHECK: paddusb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xdc,0x1d,0xfe,0xca,0xbe,0xba] + paddusb 0xbabecafe,%mm3 + +// CHECK: paddusb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xdc,0x1d,0x78,0x56,0x34,0x12] + paddusb 0x12345678,%mm3 + +// CHECK: paddusb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xdc,0xdb] + paddusb %mm3,%mm3 + +// CHECK: paddusb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddusb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddusb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0x2d,0x45,0x00,0x00,0x00] + paddusb 0x45,%xmm5 + +// CHECK: paddusb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0x2d,0xed,0x7e,0x00,0x00] + paddusb 0x7eed,%xmm5 + +// CHECK: paddusb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0x2d,0xfe,0xca,0xbe,0xba] + paddusb 0xbabecafe,%xmm5 + +// CHECK: paddusb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0x2d,0x78,0x56,0x34,0x12] + paddusb 0x12345678,%xmm5 + +// CHECK: paddusb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdc,0xed] + paddusb %xmm5,%xmm5 + +// CHECK: paddusw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xdd,0x9c,0xcb,0xef,0xbe,0xad,0xde] + paddusw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: paddusw 69, %mm3 +// CHECK: encoding: [0x0f,0xdd,0x1d,0x45,0x00,0x00,0x00] + paddusw 0x45,%mm3 + +// CHECK: paddusw 32493, %mm3 +// CHECK: encoding: [0x0f,0xdd,0x1d,0xed,0x7e,0x00,0x00] + paddusw 0x7eed,%mm3 + +// CHECK: paddusw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xdd,0x1d,0xfe,0xca,0xbe,0xba] + paddusw 0xbabecafe,%mm3 + +// CHECK: paddusw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xdd,0x1d,0x78,0x56,0x34,0x12] + paddusw 0x12345678,%mm3 + +// CHECK: paddusw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xdd,0xdb] + paddusw %mm3,%mm3 + +// CHECK: paddusw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0xac,0xcb,0xef,0xbe,0xad,0xde] + paddusw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: paddusw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0x2d,0x45,0x00,0x00,0x00] + paddusw 0x45,%xmm5 + +// CHECK: paddusw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0x2d,0xed,0x7e,0x00,0x00] + paddusw 0x7eed,%xmm5 + +// CHECK: paddusw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0x2d,0xfe,0xca,0xbe,0xba] + paddusw 0xbabecafe,%xmm5 + +// CHECK: paddusw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0x2d,0x78,0x56,0x34,0x12] + paddusw 0x12345678,%xmm5 + +// CHECK: paddusw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdd,0xed] + paddusw %xmm5,%xmm5 + +// CHECK: pand 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xdb,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pand 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pand 69, %mm3 +// CHECK: encoding: [0x0f,0xdb,0x1d,0x45,0x00,0x00,0x00] + pand 0x45,%mm3 + +// CHECK: pand 32493, %mm3 +// CHECK: encoding: [0x0f,0xdb,0x1d,0xed,0x7e,0x00,0x00] + pand 0x7eed,%mm3 + +// CHECK: pand 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xdb,0x1d,0xfe,0xca,0xbe,0xba] + pand 0xbabecafe,%mm3 + +// CHECK: pand 305419896, %mm3 +// CHECK: encoding: [0x0f,0xdb,0x1d,0x78,0x56,0x34,0x12] + pand 0x12345678,%mm3 + +// CHECK: pand %mm3, %mm3 +// CHECK: encoding: [0x0f,0xdb,0xdb] + pand %mm3,%mm3 + +// CHECK: pand 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0xac,0xcb,0xef,0xbe,0xad,0xde] + pand 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pand 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0x2d,0x45,0x00,0x00,0x00] + pand 0x45,%xmm5 + +// CHECK: pand 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0x2d,0xed,0x7e,0x00,0x00] + pand 0x7eed,%xmm5 + +// CHECK: pand 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0x2d,0xfe,0xca,0xbe,0xba] + pand 0xbabecafe,%xmm5 + +// CHECK: pand 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0x2d,0x78,0x56,0x34,0x12] + pand 0x12345678,%xmm5 + +// CHECK: pand %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdb,0xed] + pand %xmm5,%xmm5 + +// CHECK: pandn 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xdf,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pandn 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pandn 69, %mm3 +// CHECK: encoding: [0x0f,0xdf,0x1d,0x45,0x00,0x00,0x00] + pandn 0x45,%mm3 + +// CHECK: pandn 32493, %mm3 +// CHECK: encoding: [0x0f,0xdf,0x1d,0xed,0x7e,0x00,0x00] + pandn 0x7eed,%mm3 + +// CHECK: pandn 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xdf,0x1d,0xfe,0xca,0xbe,0xba] + pandn 0xbabecafe,%mm3 + +// CHECK: pandn 305419896, %mm3 +// CHECK: encoding: [0x0f,0xdf,0x1d,0x78,0x56,0x34,0x12] + pandn 0x12345678,%mm3 + +// CHECK: pandn %mm3, %mm3 +// CHECK: encoding: [0x0f,0xdf,0xdb] + pandn %mm3,%mm3 + +// CHECK: pandn 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0xac,0xcb,0xef,0xbe,0xad,0xde] + pandn 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pandn 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0x2d,0x45,0x00,0x00,0x00] + pandn 0x45,%xmm5 + +// CHECK: pandn 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0x2d,0xed,0x7e,0x00,0x00] + pandn 0x7eed,%xmm5 + +// CHECK: pandn 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0x2d,0xfe,0xca,0xbe,0xba] + pandn 0xbabecafe,%xmm5 + +// CHECK: pandn 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0x2d,0x78,0x56,0x34,0x12] + pandn 0x12345678,%xmm5 + +// CHECK: pandn %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xdf,0xed] + pandn %xmm5,%xmm5 + +// CHECK: pcmpeqb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x74,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpeqb 69, %mm3 +// CHECK: encoding: [0x0f,0x74,0x1d,0x45,0x00,0x00,0x00] + pcmpeqb 0x45,%mm3 + +// CHECK: pcmpeqb 32493, %mm3 +// CHECK: encoding: [0x0f,0x74,0x1d,0xed,0x7e,0x00,0x00] + pcmpeqb 0x7eed,%mm3 + +// CHECK: pcmpeqb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x74,0x1d,0xfe,0xca,0xbe,0xba] + pcmpeqb 0xbabecafe,%mm3 + +// CHECK: pcmpeqb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x74,0x1d,0x78,0x56,0x34,0x12] + pcmpeqb 0x12345678,%mm3 + +// CHECK: pcmpeqb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x74,0xdb] + pcmpeqb %mm3,%mm3 + +// CHECK: pcmpeqb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpeqb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0x2d,0x45,0x00,0x00,0x00] + pcmpeqb 0x45,%xmm5 + +// CHECK: pcmpeqb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0x2d,0xed,0x7e,0x00,0x00] + pcmpeqb 0x7eed,%xmm5 + +// CHECK: pcmpeqb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0x2d,0xfe,0xca,0xbe,0xba] + pcmpeqb 0xbabecafe,%xmm5 + +// CHECK: pcmpeqb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0x2d,0x78,0x56,0x34,0x12] + pcmpeqb 0x12345678,%xmm5 + +// CHECK: pcmpeqb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x74,0xed] + pcmpeqb %xmm5,%xmm5 + +// CHECK: pcmpeqw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x75,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpeqw 69, %mm3 +// CHECK: encoding: [0x0f,0x75,0x1d,0x45,0x00,0x00,0x00] + pcmpeqw 0x45,%mm3 + +// CHECK: pcmpeqw 32493, %mm3 +// CHECK: encoding: [0x0f,0x75,0x1d,0xed,0x7e,0x00,0x00] + pcmpeqw 0x7eed,%mm3 + +// CHECK: pcmpeqw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x75,0x1d,0xfe,0xca,0xbe,0xba] + pcmpeqw 0xbabecafe,%mm3 + +// CHECK: pcmpeqw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x75,0x1d,0x78,0x56,0x34,0x12] + pcmpeqw 0x12345678,%mm3 + +// CHECK: pcmpeqw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x75,0xdb] + pcmpeqw %mm3,%mm3 + +// CHECK: pcmpeqw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpeqw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0x2d,0x45,0x00,0x00,0x00] + pcmpeqw 0x45,%xmm5 + +// CHECK: pcmpeqw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0x2d,0xed,0x7e,0x00,0x00] + pcmpeqw 0x7eed,%xmm5 + +// CHECK: pcmpeqw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0x2d,0xfe,0xca,0xbe,0xba] + pcmpeqw 0xbabecafe,%xmm5 + +// CHECK: pcmpeqw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0x2d,0x78,0x56,0x34,0x12] + pcmpeqw 0x12345678,%xmm5 + +// CHECK: pcmpeqw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x75,0xed] + pcmpeqw %xmm5,%xmm5 + +// CHECK: pcmpeqd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x76,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpeqd 69, %mm3 +// CHECK: encoding: [0x0f,0x76,0x1d,0x45,0x00,0x00,0x00] + pcmpeqd 0x45,%mm3 + +// CHECK: pcmpeqd 32493, %mm3 +// CHECK: encoding: [0x0f,0x76,0x1d,0xed,0x7e,0x00,0x00] + pcmpeqd 0x7eed,%mm3 + +// CHECK: pcmpeqd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x76,0x1d,0xfe,0xca,0xbe,0xba] + pcmpeqd 0xbabecafe,%mm3 + +// CHECK: pcmpeqd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x76,0x1d,0x78,0x56,0x34,0x12] + pcmpeqd 0x12345678,%mm3 + +// CHECK: pcmpeqd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x76,0xdb] + pcmpeqd %mm3,%mm3 + +// CHECK: pcmpeqd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpeqd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0x2d,0x45,0x00,0x00,0x00] + pcmpeqd 0x45,%xmm5 + +// CHECK: pcmpeqd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0x2d,0xed,0x7e,0x00,0x00] + pcmpeqd 0x7eed,%xmm5 + +// CHECK: pcmpeqd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0x2d,0xfe,0xca,0xbe,0xba] + pcmpeqd 0xbabecafe,%xmm5 + +// CHECK: pcmpeqd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0x2d,0x78,0x56,0x34,0x12] + pcmpeqd 0x12345678,%xmm5 + +// CHECK: pcmpeqd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x76,0xed] + pcmpeqd %xmm5,%xmm5 + +// CHECK: pcmpgtb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x64,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpgtb 69, %mm3 +// CHECK: encoding: [0x0f,0x64,0x1d,0x45,0x00,0x00,0x00] + pcmpgtb 0x45,%mm3 + +// CHECK: pcmpgtb 32493, %mm3 +// CHECK: encoding: [0x0f,0x64,0x1d,0xed,0x7e,0x00,0x00] + pcmpgtb 0x7eed,%mm3 + +// CHECK: pcmpgtb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x64,0x1d,0xfe,0xca,0xbe,0xba] + pcmpgtb 0xbabecafe,%mm3 + +// CHECK: pcmpgtb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x64,0x1d,0x78,0x56,0x34,0x12] + pcmpgtb 0x12345678,%mm3 + +// CHECK: pcmpgtb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x64,0xdb] + pcmpgtb %mm3,%mm3 + +// CHECK: pcmpgtb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpgtb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0x2d,0x45,0x00,0x00,0x00] + pcmpgtb 0x45,%xmm5 + +// CHECK: pcmpgtb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0x2d,0xed,0x7e,0x00,0x00] + pcmpgtb 0x7eed,%xmm5 + +// CHECK: pcmpgtb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0x2d,0xfe,0xca,0xbe,0xba] + pcmpgtb 0xbabecafe,%xmm5 + +// CHECK: pcmpgtb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0x2d,0x78,0x56,0x34,0x12] + pcmpgtb 0x12345678,%xmm5 + +// CHECK: pcmpgtb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x64,0xed] + pcmpgtb %xmm5,%xmm5 + +// CHECK: pcmpgtw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x65,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpgtw 69, %mm3 +// CHECK: encoding: [0x0f,0x65,0x1d,0x45,0x00,0x00,0x00] + pcmpgtw 0x45,%mm3 + +// CHECK: pcmpgtw 32493, %mm3 +// CHECK: encoding: [0x0f,0x65,0x1d,0xed,0x7e,0x00,0x00] + pcmpgtw 0x7eed,%mm3 + +// CHECK: pcmpgtw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x65,0x1d,0xfe,0xca,0xbe,0xba] + pcmpgtw 0xbabecafe,%mm3 + +// CHECK: pcmpgtw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x65,0x1d,0x78,0x56,0x34,0x12] + pcmpgtw 0x12345678,%mm3 + +// CHECK: pcmpgtw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x65,0xdb] + pcmpgtw %mm3,%mm3 + +// CHECK: pcmpgtw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpgtw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0x2d,0x45,0x00,0x00,0x00] + pcmpgtw 0x45,%xmm5 + +// CHECK: pcmpgtw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0x2d,0xed,0x7e,0x00,0x00] + pcmpgtw 0x7eed,%xmm5 + +// CHECK: pcmpgtw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0x2d,0xfe,0xca,0xbe,0xba] + pcmpgtw 0xbabecafe,%xmm5 + +// CHECK: pcmpgtw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0x2d,0x78,0x56,0x34,0x12] + pcmpgtw 0x12345678,%xmm5 + +// CHECK: pcmpgtw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x65,0xed] + pcmpgtw %xmm5,%xmm5 + +// CHECK: pcmpgtd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x66,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pcmpgtd 69, %mm3 +// CHECK: encoding: [0x0f,0x66,0x1d,0x45,0x00,0x00,0x00] + pcmpgtd 0x45,%mm3 + +// CHECK: pcmpgtd 32493, %mm3 +// CHECK: encoding: [0x0f,0x66,0x1d,0xed,0x7e,0x00,0x00] + pcmpgtd 0x7eed,%mm3 + +// CHECK: pcmpgtd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x66,0x1d,0xfe,0xca,0xbe,0xba] + pcmpgtd 0xbabecafe,%mm3 + +// CHECK: pcmpgtd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x66,0x1d,0x78,0x56,0x34,0x12] + pcmpgtd 0x12345678,%mm3 + +// CHECK: pcmpgtd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x66,0xdb] + pcmpgtd %mm3,%mm3 + +// CHECK: pcmpgtd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpgtd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0x2d,0x45,0x00,0x00,0x00] + pcmpgtd 0x45,%xmm5 + +// CHECK: pcmpgtd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0x2d,0xed,0x7e,0x00,0x00] + pcmpgtd 0x7eed,%xmm5 + +// CHECK: pcmpgtd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0x2d,0xfe,0xca,0xbe,0xba] + pcmpgtd 0xbabecafe,%xmm5 + +// CHECK: pcmpgtd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0x2d,0x78,0x56,0x34,0x12] + pcmpgtd 0x12345678,%xmm5 + +// CHECK: pcmpgtd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x66,0xed] + pcmpgtd %xmm5,%xmm5 + +// CHECK: pmaddwd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf5,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmaddwd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmaddwd 69, %mm3 +// CHECK: encoding: [0x0f,0xf5,0x1d,0x45,0x00,0x00,0x00] + pmaddwd 0x45,%mm3 + +// CHECK: pmaddwd 32493, %mm3 +// CHECK: encoding: [0x0f,0xf5,0x1d,0xed,0x7e,0x00,0x00] + pmaddwd 0x7eed,%mm3 + +// CHECK: pmaddwd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf5,0x1d,0xfe,0xca,0xbe,0xba] + pmaddwd 0xbabecafe,%mm3 + +// CHECK: pmaddwd 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf5,0x1d,0x78,0x56,0x34,0x12] + pmaddwd 0x12345678,%mm3 + +// CHECK: pmaddwd %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf5,0xdb] + pmaddwd %mm3,%mm3 + +// CHECK: pmaddwd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaddwd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaddwd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0x2d,0x45,0x00,0x00,0x00] + pmaddwd 0x45,%xmm5 + +// CHECK: pmaddwd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0x2d,0xed,0x7e,0x00,0x00] + pmaddwd 0x7eed,%xmm5 + +// CHECK: pmaddwd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0x2d,0xfe,0xca,0xbe,0xba] + pmaddwd 0xbabecafe,%xmm5 + +// CHECK: pmaddwd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0x2d,0x78,0x56,0x34,0x12] + pmaddwd 0x12345678,%xmm5 + +// CHECK: pmaddwd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf5,0xed] + pmaddwd %xmm5,%xmm5 + +// CHECK: pmulhw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe5,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmulhw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmulhw 69, %mm3 +// CHECK: encoding: [0x0f,0xe5,0x1d,0x45,0x00,0x00,0x00] + pmulhw 0x45,%mm3 + +// CHECK: pmulhw 32493, %mm3 +// CHECK: encoding: [0x0f,0xe5,0x1d,0xed,0x7e,0x00,0x00] + pmulhw 0x7eed,%mm3 + +// CHECK: pmulhw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe5,0x1d,0xfe,0xca,0xbe,0xba] + pmulhw 0xbabecafe,%mm3 + +// CHECK: pmulhw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe5,0x1d,0x78,0x56,0x34,0x12] + pmulhw 0x12345678,%mm3 + +// CHECK: pmulhw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe5,0xdb] + pmulhw %mm3,%mm3 + +// CHECK: pmulhw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmulhw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmulhw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0x2d,0x45,0x00,0x00,0x00] + pmulhw 0x45,%xmm5 + +// CHECK: pmulhw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0x2d,0xed,0x7e,0x00,0x00] + pmulhw 0x7eed,%xmm5 + +// CHECK: pmulhw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0x2d,0xfe,0xca,0xbe,0xba] + pmulhw 0xbabecafe,%xmm5 + +// CHECK: pmulhw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0x2d,0x78,0x56,0x34,0x12] + pmulhw 0x12345678,%xmm5 + +// CHECK: pmulhw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe5,0xed] + pmulhw %xmm5,%xmm5 + +// CHECK: pmullw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd5,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmullw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmullw 69, %mm3 +// CHECK: encoding: [0x0f,0xd5,0x1d,0x45,0x00,0x00,0x00] + pmullw 0x45,%mm3 + +// CHECK: pmullw 32493, %mm3 +// CHECK: encoding: [0x0f,0xd5,0x1d,0xed,0x7e,0x00,0x00] + pmullw 0x7eed,%mm3 + +// CHECK: pmullw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd5,0x1d,0xfe,0xca,0xbe,0xba] + pmullw 0xbabecafe,%mm3 + +// CHECK: pmullw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd5,0x1d,0x78,0x56,0x34,0x12] + pmullw 0x12345678,%mm3 + +// CHECK: pmullw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd5,0xdb] + pmullw %mm3,%mm3 + +// CHECK: pmullw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmullw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmullw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0x2d,0x45,0x00,0x00,0x00] + pmullw 0x45,%xmm5 + +// CHECK: pmullw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0x2d,0xed,0x7e,0x00,0x00] + pmullw 0x7eed,%xmm5 + +// CHECK: pmullw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0x2d,0xfe,0xca,0xbe,0xba] + pmullw 0xbabecafe,%xmm5 + +// CHECK: pmullw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0x2d,0x78,0x56,0x34,0x12] + pmullw 0x12345678,%xmm5 + +// CHECK: pmullw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd5,0xed] + pmullw %xmm5,%xmm5 + +// CHECK: por 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xeb,0x9c,0xcb,0xef,0xbe,0xad,0xde] + por 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: por 69, %mm3 +// CHECK: encoding: [0x0f,0xeb,0x1d,0x45,0x00,0x00,0x00] + por 0x45,%mm3 + +// CHECK: por 32493, %mm3 +// CHECK: encoding: [0x0f,0xeb,0x1d,0xed,0x7e,0x00,0x00] + por 0x7eed,%mm3 + +// CHECK: por 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xeb,0x1d,0xfe,0xca,0xbe,0xba] + por 0xbabecafe,%mm3 + +// CHECK: por 305419896, %mm3 +// CHECK: encoding: [0x0f,0xeb,0x1d,0x78,0x56,0x34,0x12] + por 0x12345678,%mm3 + +// CHECK: por %mm3, %mm3 +// CHECK: encoding: [0x0f,0xeb,0xdb] + por %mm3,%mm3 + +// CHECK: por 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0xac,0xcb,0xef,0xbe,0xad,0xde] + por 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: por 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0x2d,0x45,0x00,0x00,0x00] + por 0x45,%xmm5 + +// CHECK: por 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0x2d,0xed,0x7e,0x00,0x00] + por 0x7eed,%xmm5 + +// CHECK: por 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0x2d,0xfe,0xca,0xbe,0xba] + por 0xbabecafe,%xmm5 + +// CHECK: por 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0x2d,0x78,0x56,0x34,0x12] + por 0x12345678,%xmm5 + +// CHECK: por %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xeb,0xed] + por %xmm5,%xmm5 + +// CHECK: psllw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf1,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psllw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psllw 69, %mm3 +// CHECK: encoding: [0x0f,0xf1,0x1d,0x45,0x00,0x00,0x00] + psllw 0x45,%mm3 + +// CHECK: psllw 32493, %mm3 +// CHECK: encoding: [0x0f,0xf1,0x1d,0xed,0x7e,0x00,0x00] + psllw 0x7eed,%mm3 + +// CHECK: psllw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf1,0x1d,0xfe,0xca,0xbe,0xba] + psllw 0xbabecafe,%mm3 + +// CHECK: psllw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf1,0x1d,0x78,0x56,0x34,0x12] + psllw 0x12345678,%mm3 + +// CHECK: psllw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf1,0xdb] + psllw %mm3,%mm3 + +// CHECK: psllw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0xac,0xcb,0xef,0xbe,0xad,0xde] + psllw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psllw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0x2d,0x45,0x00,0x00,0x00] + psllw 0x45,%xmm5 + +// CHECK: psllw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0x2d,0xed,0x7e,0x00,0x00] + psllw 0x7eed,%xmm5 + +// CHECK: psllw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0x2d,0xfe,0xca,0xbe,0xba] + psllw 0xbabecafe,%xmm5 + +// CHECK: psllw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0x2d,0x78,0x56,0x34,0x12] + psllw 0x12345678,%xmm5 + +// CHECK: psllw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf1,0xed] + psllw %xmm5,%xmm5 + +// CHECK: psllw $127, %mm3 +// CHECK: encoding: [0x0f,0x71,0xf3,0x7f] + psllw $0x7f,%mm3 + +// CHECK: psllw $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x71,0xf5,0x7f] + psllw $0x7f,%xmm5 + +// CHECK: pslld 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf2,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pslld 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pslld 69, %mm3 +// CHECK: encoding: [0x0f,0xf2,0x1d,0x45,0x00,0x00,0x00] + pslld 0x45,%mm3 + +// CHECK: pslld 32493, %mm3 +// CHECK: encoding: [0x0f,0xf2,0x1d,0xed,0x7e,0x00,0x00] + pslld 0x7eed,%mm3 + +// CHECK: pslld 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf2,0x1d,0xfe,0xca,0xbe,0xba] + pslld 0xbabecafe,%mm3 + +// CHECK: pslld 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf2,0x1d,0x78,0x56,0x34,0x12] + pslld 0x12345678,%mm3 + +// CHECK: pslld %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf2,0xdb] + pslld %mm3,%mm3 + +// CHECK: pslld 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0xac,0xcb,0xef,0xbe,0xad,0xde] + pslld 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pslld 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0x2d,0x45,0x00,0x00,0x00] + pslld 0x45,%xmm5 + +// CHECK: pslld 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0x2d,0xed,0x7e,0x00,0x00] + pslld 0x7eed,%xmm5 + +// CHECK: pslld 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0x2d,0xfe,0xca,0xbe,0xba] + pslld 0xbabecafe,%xmm5 + +// CHECK: pslld 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0x2d,0x78,0x56,0x34,0x12] + pslld 0x12345678,%xmm5 + +// CHECK: pslld %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf2,0xed] + pslld %xmm5,%xmm5 + +// CHECK: pslld $127, %mm3 +// CHECK: encoding: [0x0f,0x72,0xf3,0x7f] + pslld $0x7f,%mm3 + +// CHECK: pslld $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x72,0xf5,0x7f] + pslld $0x7f,%xmm5 + +// CHECK: psllq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf3,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psllq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psllq 69, %mm3 +// CHECK: encoding: [0x0f,0xf3,0x1d,0x45,0x00,0x00,0x00] + psllq 0x45,%mm3 + +// CHECK: psllq 32493, %mm3 +// CHECK: encoding: [0x0f,0xf3,0x1d,0xed,0x7e,0x00,0x00] + psllq 0x7eed,%mm3 + +// CHECK: psllq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf3,0x1d,0xfe,0xca,0xbe,0xba] + psllq 0xbabecafe,%mm3 + +// CHECK: psllq 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf3,0x1d,0x78,0x56,0x34,0x12] + psllq 0x12345678,%mm3 + +// CHECK: psllq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf3,0xdb] + psllq %mm3,%mm3 + +// CHECK: psllq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0xac,0xcb,0xef,0xbe,0xad,0xde] + psllq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psllq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0x2d,0x45,0x00,0x00,0x00] + psllq 0x45,%xmm5 + +// CHECK: psllq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0x2d,0xed,0x7e,0x00,0x00] + psllq 0x7eed,%xmm5 + +// CHECK: psllq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0x2d,0xfe,0xca,0xbe,0xba] + psllq 0xbabecafe,%xmm5 + +// CHECK: psllq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0x2d,0x78,0x56,0x34,0x12] + psllq 0x12345678,%xmm5 + +// CHECK: psllq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf3,0xed] + psllq %xmm5,%xmm5 + +// CHECK: psllq $127, %mm3 +// CHECK: encoding: [0x0f,0x73,0xf3,0x7f] + psllq $0x7f,%mm3 + +// CHECK: psllq $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x73,0xf5,0x7f] + psllq $0x7f,%xmm5 + +// CHECK: psraw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe1,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psraw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psraw 69, %mm3 +// CHECK: encoding: [0x0f,0xe1,0x1d,0x45,0x00,0x00,0x00] + psraw 0x45,%mm3 + +// CHECK: psraw 32493, %mm3 +// CHECK: encoding: [0x0f,0xe1,0x1d,0xed,0x7e,0x00,0x00] + psraw 0x7eed,%mm3 + +// CHECK: psraw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe1,0x1d,0xfe,0xca,0xbe,0xba] + psraw 0xbabecafe,%mm3 + +// CHECK: psraw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe1,0x1d,0x78,0x56,0x34,0x12] + psraw 0x12345678,%mm3 + +// CHECK: psraw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe1,0xdb] + psraw %mm3,%mm3 + +// CHECK: psraw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0xac,0xcb,0xef,0xbe,0xad,0xde] + psraw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psraw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0x2d,0x45,0x00,0x00,0x00] + psraw 0x45,%xmm5 + +// CHECK: psraw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0x2d,0xed,0x7e,0x00,0x00] + psraw 0x7eed,%xmm5 + +// CHECK: psraw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0x2d,0xfe,0xca,0xbe,0xba] + psraw 0xbabecafe,%xmm5 + +// CHECK: psraw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0x2d,0x78,0x56,0x34,0x12] + psraw 0x12345678,%xmm5 + +// CHECK: psraw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe1,0xed] + psraw %xmm5,%xmm5 + +// CHECK: psraw $127, %mm3 +// CHECK: encoding: [0x0f,0x71,0xe3,0x7f] + psraw $0x7f,%mm3 + +// CHECK: psraw $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x71,0xe5,0x7f] + psraw $0x7f,%xmm5 + +// CHECK: psrad 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe2,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psrad 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psrad 69, %mm3 +// CHECK: encoding: [0x0f,0xe2,0x1d,0x45,0x00,0x00,0x00] + psrad 0x45,%mm3 + +// CHECK: psrad 32493, %mm3 +// CHECK: encoding: [0x0f,0xe2,0x1d,0xed,0x7e,0x00,0x00] + psrad 0x7eed,%mm3 + +// CHECK: psrad 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe2,0x1d,0xfe,0xca,0xbe,0xba] + psrad 0xbabecafe,%mm3 + +// CHECK: psrad 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe2,0x1d,0x78,0x56,0x34,0x12] + psrad 0x12345678,%mm3 + +// CHECK: psrad %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe2,0xdb] + psrad %mm3,%mm3 + +// CHECK: psrad 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0xac,0xcb,0xef,0xbe,0xad,0xde] + psrad 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psrad 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0x2d,0x45,0x00,0x00,0x00] + psrad 0x45,%xmm5 + +// CHECK: psrad 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0x2d,0xed,0x7e,0x00,0x00] + psrad 0x7eed,%xmm5 + +// CHECK: psrad 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0x2d,0xfe,0xca,0xbe,0xba] + psrad 0xbabecafe,%xmm5 + +// CHECK: psrad 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0x2d,0x78,0x56,0x34,0x12] + psrad 0x12345678,%xmm5 + +// CHECK: psrad %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe2,0xed] + psrad %xmm5,%xmm5 + +// CHECK: psrad $127, %mm3 +// CHECK: encoding: [0x0f,0x72,0xe3,0x7f] + psrad $0x7f,%mm3 + +// CHECK: psrad $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x72,0xe5,0x7f] + psrad $0x7f,%xmm5 + +// CHECK: psrlw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd1,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psrlw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psrlw 69, %mm3 +// CHECK: encoding: [0x0f,0xd1,0x1d,0x45,0x00,0x00,0x00] + psrlw 0x45,%mm3 + +// CHECK: psrlw 32493, %mm3 +// CHECK: encoding: [0x0f,0xd1,0x1d,0xed,0x7e,0x00,0x00] + psrlw 0x7eed,%mm3 + +// CHECK: psrlw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd1,0x1d,0xfe,0xca,0xbe,0xba] + psrlw 0xbabecafe,%mm3 + +// CHECK: psrlw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd1,0x1d,0x78,0x56,0x34,0x12] + psrlw 0x12345678,%mm3 + +// CHECK: psrlw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd1,0xdb] + psrlw %mm3,%mm3 + +// CHECK: psrlw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0xac,0xcb,0xef,0xbe,0xad,0xde] + psrlw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psrlw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0x2d,0x45,0x00,0x00,0x00] + psrlw 0x45,%xmm5 + +// CHECK: psrlw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0x2d,0xed,0x7e,0x00,0x00] + psrlw 0x7eed,%xmm5 + +// CHECK: psrlw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0x2d,0xfe,0xca,0xbe,0xba] + psrlw 0xbabecafe,%xmm5 + +// CHECK: psrlw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0x2d,0x78,0x56,0x34,0x12] + psrlw 0x12345678,%xmm5 + +// CHECK: psrlw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd1,0xed] + psrlw %xmm5,%xmm5 + +// CHECK: psrlw $127, %mm3 +// CHECK: encoding: [0x0f,0x71,0xd3,0x7f] + psrlw $0x7f,%mm3 + +// CHECK: psrlw $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x71,0xd5,0x7f] + psrlw $0x7f,%xmm5 + +// CHECK: psrld 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd2,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psrld 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psrld 69, %mm3 +// CHECK: encoding: [0x0f,0xd2,0x1d,0x45,0x00,0x00,0x00] + psrld 0x45,%mm3 + +// CHECK: psrld 32493, %mm3 +// CHECK: encoding: [0x0f,0xd2,0x1d,0xed,0x7e,0x00,0x00] + psrld 0x7eed,%mm3 + +// CHECK: psrld 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd2,0x1d,0xfe,0xca,0xbe,0xba] + psrld 0xbabecafe,%mm3 + +// CHECK: psrld 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd2,0x1d,0x78,0x56,0x34,0x12] + psrld 0x12345678,%mm3 + +// CHECK: psrld %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd2,0xdb] + psrld %mm3,%mm3 + +// CHECK: psrld 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0xac,0xcb,0xef,0xbe,0xad,0xde] + psrld 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psrld 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0x2d,0x45,0x00,0x00,0x00] + psrld 0x45,%xmm5 + +// CHECK: psrld 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0x2d,0xed,0x7e,0x00,0x00] + psrld 0x7eed,%xmm5 + +// CHECK: psrld 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0x2d,0xfe,0xca,0xbe,0xba] + psrld 0xbabecafe,%xmm5 + +// CHECK: psrld 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0x2d,0x78,0x56,0x34,0x12] + psrld 0x12345678,%xmm5 + +// CHECK: psrld %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd2,0xed] + psrld %xmm5,%xmm5 + +// CHECK: psrld $127, %mm3 +// CHECK: encoding: [0x0f,0x72,0xd3,0x7f] + psrld $0x7f,%mm3 + +// CHECK: psrld $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x72,0xd5,0x7f] + psrld $0x7f,%xmm5 + +// CHECK: psrlq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd3,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psrlq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psrlq 69, %mm3 +// CHECK: encoding: [0x0f,0xd3,0x1d,0x45,0x00,0x00,0x00] + psrlq 0x45,%mm3 + +// CHECK: psrlq 32493, %mm3 +// CHECK: encoding: [0x0f,0xd3,0x1d,0xed,0x7e,0x00,0x00] + psrlq 0x7eed,%mm3 + +// CHECK: psrlq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd3,0x1d,0xfe,0xca,0xbe,0xba] + psrlq 0xbabecafe,%mm3 + +// CHECK: psrlq 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd3,0x1d,0x78,0x56,0x34,0x12] + psrlq 0x12345678,%mm3 + +// CHECK: psrlq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd3,0xdb] + psrlq %mm3,%mm3 + +// CHECK: psrlq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0xac,0xcb,0xef,0xbe,0xad,0xde] + psrlq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psrlq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0x2d,0x45,0x00,0x00,0x00] + psrlq 0x45,%xmm5 + +// CHECK: psrlq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0x2d,0xed,0x7e,0x00,0x00] + psrlq 0x7eed,%xmm5 + +// CHECK: psrlq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0x2d,0xfe,0xca,0xbe,0xba] + psrlq 0xbabecafe,%xmm5 + +// CHECK: psrlq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0x2d,0x78,0x56,0x34,0x12] + psrlq 0x12345678,%xmm5 + +// CHECK: psrlq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd3,0xed] + psrlq %xmm5,%xmm5 + +// CHECK: psrlq $127, %mm3 +// CHECK: encoding: [0x0f,0x73,0xd3,0x7f] + psrlq $0x7f,%mm3 + +// CHECK: psrlq $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x73,0xd5,0x7f] + psrlq $0x7f,%xmm5 + +// CHECK: psubb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf8,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubb 69, %mm3 +// CHECK: encoding: [0x0f,0xf8,0x1d,0x45,0x00,0x00,0x00] + psubb 0x45,%mm3 + +// CHECK: psubb 32493, %mm3 +// CHECK: encoding: [0x0f,0xf8,0x1d,0xed,0x7e,0x00,0x00] + psubb 0x7eed,%mm3 + +// CHECK: psubb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf8,0x1d,0xfe,0xca,0xbe,0xba] + psubb 0xbabecafe,%mm3 + +// CHECK: psubb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf8,0x1d,0x78,0x56,0x34,0x12] + psubb 0x12345678,%mm3 + +// CHECK: psubb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf8,0xdb] + psubb %mm3,%mm3 + +// CHECK: psubb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0x2d,0x45,0x00,0x00,0x00] + psubb 0x45,%xmm5 + +// CHECK: psubb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0x2d,0xed,0x7e,0x00,0x00] + psubb 0x7eed,%xmm5 + +// CHECK: psubb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0x2d,0xfe,0xca,0xbe,0xba] + psubb 0xbabecafe,%xmm5 + +// CHECK: psubb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0x2d,0x78,0x56,0x34,0x12] + psubb 0x12345678,%xmm5 + +// CHECK: psubb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf8,0xed] + psubb %xmm5,%xmm5 + +// CHECK: psubw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf9,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubw 69, %mm3 +// CHECK: encoding: [0x0f,0xf9,0x1d,0x45,0x00,0x00,0x00] + psubw 0x45,%mm3 + +// CHECK: psubw 32493, %mm3 +// CHECK: encoding: [0x0f,0xf9,0x1d,0xed,0x7e,0x00,0x00] + psubw 0x7eed,%mm3 + +// CHECK: psubw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf9,0x1d,0xfe,0xca,0xbe,0xba] + psubw 0xbabecafe,%mm3 + +// CHECK: psubw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf9,0x1d,0x78,0x56,0x34,0x12] + psubw 0x12345678,%mm3 + +// CHECK: psubw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf9,0xdb] + psubw %mm3,%mm3 + +// CHECK: psubw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0x2d,0x45,0x00,0x00,0x00] + psubw 0x45,%xmm5 + +// CHECK: psubw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0x2d,0xed,0x7e,0x00,0x00] + psubw 0x7eed,%xmm5 + +// CHECK: psubw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0x2d,0xfe,0xca,0xbe,0xba] + psubw 0xbabecafe,%xmm5 + +// CHECK: psubw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0x2d,0x78,0x56,0x34,0x12] + psubw 0x12345678,%xmm5 + +// CHECK: psubw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf9,0xed] + psubw %xmm5,%xmm5 + +// CHECK: psubd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xfa,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubd 69, %mm3 +// CHECK: encoding: [0x0f,0xfa,0x1d,0x45,0x00,0x00,0x00] + psubd 0x45,%mm3 + +// CHECK: psubd 32493, %mm3 +// CHECK: encoding: [0x0f,0xfa,0x1d,0xed,0x7e,0x00,0x00] + psubd 0x7eed,%mm3 + +// CHECK: psubd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xfa,0x1d,0xfe,0xca,0xbe,0xba] + psubd 0xbabecafe,%mm3 + +// CHECK: psubd 305419896, %mm3 +// CHECK: encoding: [0x0f,0xfa,0x1d,0x78,0x56,0x34,0x12] + psubd 0x12345678,%mm3 + +// CHECK: psubd %mm3, %mm3 +// CHECK: encoding: [0x0f,0xfa,0xdb] + psubd %mm3,%mm3 + +// CHECK: psubd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0x2d,0x45,0x00,0x00,0x00] + psubd 0x45,%xmm5 + +// CHECK: psubd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0x2d,0xed,0x7e,0x00,0x00] + psubd 0x7eed,%xmm5 + +// CHECK: psubd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0x2d,0xfe,0xca,0xbe,0xba] + psubd 0xbabecafe,%xmm5 + +// CHECK: psubd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0x2d,0x78,0x56,0x34,0x12] + psubd 0x12345678,%xmm5 + +// CHECK: psubd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfa,0xed] + psubd %xmm5,%xmm5 + +// CHECK: psubq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xfb,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubq 69, %mm3 +// CHECK: encoding: [0x0f,0xfb,0x1d,0x45,0x00,0x00,0x00] + psubq 0x45,%mm3 + +// CHECK: psubq 32493, %mm3 +// CHECK: encoding: [0x0f,0xfb,0x1d,0xed,0x7e,0x00,0x00] + psubq 0x7eed,%mm3 + +// CHECK: psubq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xfb,0x1d,0xfe,0xca,0xbe,0xba] + psubq 0xbabecafe,%mm3 + +// CHECK: psubq 305419896, %mm3 +// CHECK: encoding: [0x0f,0xfb,0x1d,0x78,0x56,0x34,0x12] + psubq 0x12345678,%mm3 + +// CHECK: psubq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xfb,0xdb] + psubq %mm3,%mm3 + +// CHECK: psubq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0x2d,0x45,0x00,0x00,0x00] + psubq 0x45,%xmm5 + +// CHECK: psubq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0x2d,0xed,0x7e,0x00,0x00] + psubq 0x7eed,%xmm5 + +// CHECK: psubq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0x2d,0xfe,0xca,0xbe,0xba] + psubq 0xbabecafe,%xmm5 + +// CHECK: psubq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0x2d,0x78,0x56,0x34,0x12] + psubq 0x12345678,%xmm5 + +// CHECK: psubq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xfb,0xed] + psubq %xmm5,%xmm5 + +// CHECK: psubsb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe8,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubsb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubsb 69, %mm3 +// CHECK: encoding: [0x0f,0xe8,0x1d,0x45,0x00,0x00,0x00] + psubsb 0x45,%mm3 + +// CHECK: psubsb 32493, %mm3 +// CHECK: encoding: [0x0f,0xe8,0x1d,0xed,0x7e,0x00,0x00] + psubsb 0x7eed,%mm3 + +// CHECK: psubsb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe8,0x1d,0xfe,0xca,0xbe,0xba] + psubsb 0xbabecafe,%mm3 + +// CHECK: psubsb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe8,0x1d,0x78,0x56,0x34,0x12] + psubsb 0x12345678,%mm3 + +// CHECK: psubsb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe8,0xdb] + psubsb %mm3,%mm3 + +// CHECK: psubsb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubsb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubsb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0x2d,0x45,0x00,0x00,0x00] + psubsb 0x45,%xmm5 + +// CHECK: psubsb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0x2d,0xed,0x7e,0x00,0x00] + psubsb 0x7eed,%xmm5 + +// CHECK: psubsb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0x2d,0xfe,0xca,0xbe,0xba] + psubsb 0xbabecafe,%xmm5 + +// CHECK: psubsb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0x2d,0x78,0x56,0x34,0x12] + psubsb 0x12345678,%xmm5 + +// CHECK: psubsb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe8,0xed] + psubsb %xmm5,%xmm5 + +// CHECK: psubsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe9,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubsw 69, %mm3 +// CHECK: encoding: [0x0f,0xe9,0x1d,0x45,0x00,0x00,0x00] + psubsw 0x45,%mm3 + +// CHECK: psubsw 32493, %mm3 +// CHECK: encoding: [0x0f,0xe9,0x1d,0xed,0x7e,0x00,0x00] + psubsw 0x7eed,%mm3 + +// CHECK: psubsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe9,0x1d,0xfe,0xca,0xbe,0xba] + psubsw 0xbabecafe,%mm3 + +// CHECK: psubsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe9,0x1d,0x78,0x56,0x34,0x12] + psubsw 0x12345678,%mm3 + +// CHECK: psubsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe9,0xdb] + psubsw %mm3,%mm3 + +// CHECK: psubsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0x2d,0x45,0x00,0x00,0x00] + psubsw 0x45,%xmm5 + +// CHECK: psubsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0x2d,0xed,0x7e,0x00,0x00] + psubsw 0x7eed,%xmm5 + +// CHECK: psubsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0x2d,0xfe,0xca,0xbe,0xba] + psubsw 0xbabecafe,%xmm5 + +// CHECK: psubsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0x2d,0x78,0x56,0x34,0x12] + psubsw 0x12345678,%xmm5 + +// CHECK: psubsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe9,0xed] + psubsw %xmm5,%xmm5 + +// CHECK: psubusb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd8,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubusb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubusb 69, %mm3 +// CHECK: encoding: [0x0f,0xd8,0x1d,0x45,0x00,0x00,0x00] + psubusb 0x45,%mm3 + +// CHECK: psubusb 32493, %mm3 +// CHECK: encoding: [0x0f,0xd8,0x1d,0xed,0x7e,0x00,0x00] + psubusb 0x7eed,%mm3 + +// CHECK: psubusb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd8,0x1d,0xfe,0xca,0xbe,0xba] + psubusb 0xbabecafe,%mm3 + +// CHECK: psubusb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd8,0x1d,0x78,0x56,0x34,0x12] + psubusb 0x12345678,%mm3 + +// CHECK: psubusb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd8,0xdb] + psubusb %mm3,%mm3 + +// CHECK: psubusb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubusb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubusb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0x2d,0x45,0x00,0x00,0x00] + psubusb 0x45,%xmm5 + +// CHECK: psubusb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0x2d,0xed,0x7e,0x00,0x00] + psubusb 0x7eed,%xmm5 + +// CHECK: psubusb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0x2d,0xfe,0xca,0xbe,0xba] + psubusb 0xbabecafe,%xmm5 + +// CHECK: psubusb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0x2d,0x78,0x56,0x34,0x12] + psubusb 0x12345678,%xmm5 + +// CHECK: psubusb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd8,0xed] + psubusb %xmm5,%xmm5 + +// CHECK: psubusw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xd9,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psubusw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psubusw 69, %mm3 +// CHECK: encoding: [0x0f,0xd9,0x1d,0x45,0x00,0x00,0x00] + psubusw 0x45,%mm3 + +// CHECK: psubusw 32493, %mm3 +// CHECK: encoding: [0x0f,0xd9,0x1d,0xed,0x7e,0x00,0x00] + psubusw 0x7eed,%mm3 + +// CHECK: psubusw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xd9,0x1d,0xfe,0xca,0xbe,0xba] + psubusw 0xbabecafe,%mm3 + +// CHECK: psubusw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xd9,0x1d,0x78,0x56,0x34,0x12] + psubusw 0x12345678,%mm3 + +// CHECK: psubusw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xd9,0xdb] + psubusw %mm3,%mm3 + +// CHECK: psubusw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0xac,0xcb,0xef,0xbe,0xad,0xde] + psubusw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psubusw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0x2d,0x45,0x00,0x00,0x00] + psubusw 0x45,%xmm5 + +// CHECK: psubusw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0x2d,0xed,0x7e,0x00,0x00] + psubusw 0x7eed,%xmm5 + +// CHECK: psubusw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0x2d,0xfe,0xca,0xbe,0xba] + psubusw 0xbabecafe,%xmm5 + +// CHECK: psubusw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0x2d,0x78,0x56,0x34,0x12] + psubusw 0x12345678,%xmm5 + +// CHECK: psubusw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd9,0xed] + psubusw %xmm5,%xmm5 + +// CHECK: punpckhbw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x68,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpckhbw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpckhbw 69, %mm3 +// CHECK: encoding: [0x0f,0x68,0x1d,0x45,0x00,0x00,0x00] + punpckhbw 0x45,%mm3 + +// CHECK: punpckhbw 32493, %mm3 +// CHECK: encoding: [0x0f,0x68,0x1d,0xed,0x7e,0x00,0x00] + punpckhbw 0x7eed,%mm3 + +// CHECK: punpckhbw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x68,0x1d,0xfe,0xca,0xbe,0xba] + punpckhbw 0xbabecafe,%mm3 + +// CHECK: punpckhbw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x68,0x1d,0x78,0x56,0x34,0x12] + punpckhbw 0x12345678,%mm3 + +// CHECK: punpckhbw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x68,0xdb] + punpckhbw %mm3,%mm3 + +// CHECK: punpckhbw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpckhbw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpckhbw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0x2d,0x45,0x00,0x00,0x00] + punpckhbw 0x45,%xmm5 + +// CHECK: punpckhbw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0x2d,0xed,0x7e,0x00,0x00] + punpckhbw 0x7eed,%xmm5 + +// CHECK: punpckhbw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0x2d,0xfe,0xca,0xbe,0xba] + punpckhbw 0xbabecafe,%xmm5 + +// CHECK: punpckhbw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0x2d,0x78,0x56,0x34,0x12] + punpckhbw 0x12345678,%xmm5 + +// CHECK: punpckhbw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x68,0xed] + punpckhbw %xmm5,%xmm5 + +// CHECK: punpckhwd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x69,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpckhwd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpckhwd 69, %mm3 +// CHECK: encoding: [0x0f,0x69,0x1d,0x45,0x00,0x00,0x00] + punpckhwd 0x45,%mm3 + +// CHECK: punpckhwd 32493, %mm3 +// CHECK: encoding: [0x0f,0x69,0x1d,0xed,0x7e,0x00,0x00] + punpckhwd 0x7eed,%mm3 + +// CHECK: punpckhwd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x69,0x1d,0xfe,0xca,0xbe,0xba] + punpckhwd 0xbabecafe,%mm3 + +// CHECK: punpckhwd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x69,0x1d,0x78,0x56,0x34,0x12] + punpckhwd 0x12345678,%mm3 + +// CHECK: punpckhwd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x69,0xdb] + punpckhwd %mm3,%mm3 + +// CHECK: punpckhwd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpckhwd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpckhwd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0x2d,0x45,0x00,0x00,0x00] + punpckhwd 0x45,%xmm5 + +// CHECK: punpckhwd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0x2d,0xed,0x7e,0x00,0x00] + punpckhwd 0x7eed,%xmm5 + +// CHECK: punpckhwd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0x2d,0xfe,0xca,0xbe,0xba] + punpckhwd 0xbabecafe,%xmm5 + +// CHECK: punpckhwd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0x2d,0x78,0x56,0x34,0x12] + punpckhwd 0x12345678,%xmm5 + +// CHECK: punpckhwd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x69,0xed] + punpckhwd %xmm5,%xmm5 + +// CHECK: punpckhdq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x6a,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpckhdq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpckhdq 69, %mm3 +// CHECK: encoding: [0x0f,0x6a,0x1d,0x45,0x00,0x00,0x00] + punpckhdq 0x45,%mm3 + +// CHECK: punpckhdq 32493, %mm3 +// CHECK: encoding: [0x0f,0x6a,0x1d,0xed,0x7e,0x00,0x00] + punpckhdq 0x7eed,%mm3 + +// CHECK: punpckhdq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x6a,0x1d,0xfe,0xca,0xbe,0xba] + punpckhdq 0xbabecafe,%mm3 + +// CHECK: punpckhdq 305419896, %mm3 +// CHECK: encoding: [0x0f,0x6a,0x1d,0x78,0x56,0x34,0x12] + punpckhdq 0x12345678,%mm3 + +// CHECK: punpckhdq %mm3, %mm3 +// CHECK: encoding: [0x0f,0x6a,0xdb] + punpckhdq %mm3,%mm3 + +// CHECK: punpckhdq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpckhdq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpckhdq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0x2d,0x45,0x00,0x00,0x00] + punpckhdq 0x45,%xmm5 + +// CHECK: punpckhdq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0x2d,0xed,0x7e,0x00,0x00] + punpckhdq 0x7eed,%xmm5 + +// CHECK: punpckhdq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0x2d,0xfe,0xca,0xbe,0xba] + punpckhdq 0xbabecafe,%xmm5 + +// CHECK: punpckhdq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0x2d,0x78,0x56,0x34,0x12] + punpckhdq 0x12345678,%xmm5 + +// CHECK: punpckhdq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6a,0xed] + punpckhdq %xmm5,%xmm5 + +// CHECK: punpcklbw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x60,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpcklbw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpcklbw 69, %mm3 +// CHECK: encoding: [0x0f,0x60,0x1d,0x45,0x00,0x00,0x00] + punpcklbw 0x45,%mm3 + +// CHECK: punpcklbw 32493, %mm3 +// CHECK: encoding: [0x0f,0x60,0x1d,0xed,0x7e,0x00,0x00] + punpcklbw 0x7eed,%mm3 + +// CHECK: punpcklbw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x60,0x1d,0xfe,0xca,0xbe,0xba] + punpcklbw 0xbabecafe,%mm3 + +// CHECK: punpcklbw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x60,0x1d,0x78,0x56,0x34,0x12] + punpcklbw 0x12345678,%mm3 + +// CHECK: punpcklbw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x60,0xdb] + punpcklbw %mm3,%mm3 + +// CHECK: punpcklbw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpcklbw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpcklbw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0x2d,0x45,0x00,0x00,0x00] + punpcklbw 0x45,%xmm5 + +// CHECK: punpcklbw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0x2d,0xed,0x7e,0x00,0x00] + punpcklbw 0x7eed,%xmm5 + +// CHECK: punpcklbw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0x2d,0xfe,0xca,0xbe,0xba] + punpcklbw 0xbabecafe,%xmm5 + +// CHECK: punpcklbw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0x2d,0x78,0x56,0x34,0x12] + punpcklbw 0x12345678,%xmm5 + +// CHECK: punpcklbw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x60,0xed] + punpcklbw %xmm5,%xmm5 + +// CHECK: punpcklwd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x61,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpcklwd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpcklwd 69, %mm3 +// CHECK: encoding: [0x0f,0x61,0x1d,0x45,0x00,0x00,0x00] + punpcklwd 0x45,%mm3 + +// CHECK: punpcklwd 32493, %mm3 +// CHECK: encoding: [0x0f,0x61,0x1d,0xed,0x7e,0x00,0x00] + punpcklwd 0x7eed,%mm3 + +// CHECK: punpcklwd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x61,0x1d,0xfe,0xca,0xbe,0xba] + punpcklwd 0xbabecafe,%mm3 + +// CHECK: punpcklwd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x61,0x1d,0x78,0x56,0x34,0x12] + punpcklwd 0x12345678,%mm3 + +// CHECK: punpcklwd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x61,0xdb] + punpcklwd %mm3,%mm3 + +// CHECK: punpcklwd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpcklwd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpcklwd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0x2d,0x45,0x00,0x00,0x00] + punpcklwd 0x45,%xmm5 + +// CHECK: punpcklwd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0x2d,0xed,0x7e,0x00,0x00] + punpcklwd 0x7eed,%xmm5 + +// CHECK: punpcklwd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0x2d,0xfe,0xca,0xbe,0xba] + punpcklwd 0xbabecafe,%xmm5 + +// CHECK: punpcklwd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0x2d,0x78,0x56,0x34,0x12] + punpcklwd 0x12345678,%xmm5 + +// CHECK: punpcklwd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x61,0xed] + punpcklwd %xmm5,%xmm5 + +// CHECK: punpckldq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x62,0x9c,0xcb,0xef,0xbe,0xad,0xde] + punpckldq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: punpckldq 69, %mm3 +// CHECK: encoding: [0x0f,0x62,0x1d,0x45,0x00,0x00,0x00] + punpckldq 0x45,%mm3 + +// CHECK: punpckldq 32493, %mm3 +// CHECK: encoding: [0x0f,0x62,0x1d,0xed,0x7e,0x00,0x00] + punpckldq 0x7eed,%mm3 + +// CHECK: punpckldq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x62,0x1d,0xfe,0xca,0xbe,0xba] + punpckldq 0xbabecafe,%mm3 + +// CHECK: punpckldq 305419896, %mm3 +// CHECK: encoding: [0x0f,0x62,0x1d,0x78,0x56,0x34,0x12] + punpckldq 0x12345678,%mm3 + +// CHECK: punpckldq %mm3, %mm3 +// CHECK: encoding: [0x0f,0x62,0xdb] + punpckldq %mm3,%mm3 + +// CHECK: punpckldq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpckldq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpckldq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0x2d,0x45,0x00,0x00,0x00] + punpckldq 0x45,%xmm5 + +// CHECK: punpckldq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0x2d,0xed,0x7e,0x00,0x00] + punpckldq 0x7eed,%xmm5 + +// CHECK: punpckldq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0x2d,0xfe,0xca,0xbe,0xba] + punpckldq 0xbabecafe,%xmm5 + +// CHECK: punpckldq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0x2d,0x78,0x56,0x34,0x12] + punpckldq 0x12345678,%xmm5 + +// CHECK: punpckldq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x62,0xed] + punpckldq %xmm5,%xmm5 + +// CHECK: pxor 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xef,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pxor 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pxor 69, %mm3 +// CHECK: encoding: [0x0f,0xef,0x1d,0x45,0x00,0x00,0x00] + pxor 0x45,%mm3 + +// CHECK: pxor 32493, %mm3 +// CHECK: encoding: [0x0f,0xef,0x1d,0xed,0x7e,0x00,0x00] + pxor 0x7eed,%mm3 + +// CHECK: pxor 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xef,0x1d,0xfe,0xca,0xbe,0xba] + pxor 0xbabecafe,%mm3 + +// CHECK: pxor 305419896, %mm3 +// CHECK: encoding: [0x0f,0xef,0x1d,0x78,0x56,0x34,0x12] + pxor 0x12345678,%mm3 + +// CHECK: pxor %mm3, %mm3 +// CHECK: encoding: [0x0f,0xef,0xdb] + pxor %mm3,%mm3 + +// CHECK: pxor 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0xac,0xcb,0xef,0xbe,0xad,0xde] + pxor 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pxor 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0x2d,0x45,0x00,0x00,0x00] + pxor 0x45,%xmm5 + +// CHECK: pxor 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0x2d,0xed,0x7e,0x00,0x00] + pxor 0x7eed,%xmm5 + +// CHECK: pxor 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0x2d,0xfe,0xca,0xbe,0xba] + pxor 0xbabecafe,%xmm5 + +// CHECK: pxor 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0x2d,0x78,0x56,0x34,0x12] + pxor 0x12345678,%xmm5 + +// CHECK: pxor %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xef,0xed] + pxor %xmm5,%xmm5 + +// CHECK: addps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x58,0xac,0xcb,0xef,0xbe,0xad,0xde] + addps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addps 69, %xmm5 +// CHECK: encoding: [0x0f,0x58,0x2d,0x45,0x00,0x00,0x00] + addps 0x45,%xmm5 + +// CHECK: addps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x58,0x2d,0xed,0x7e,0x00,0x00] + addps 0x7eed,%xmm5 + +// CHECK: addps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x58,0x2d,0xfe,0xca,0xbe,0xba] + addps 0xbabecafe,%xmm5 + +// CHECK: addps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x58,0x2d,0x78,0x56,0x34,0x12] + addps 0x12345678,%xmm5 + +// CHECK: addps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x58,0xed] + addps %xmm5,%xmm5 + +// CHECK: addss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0xac,0xcb,0xef,0xbe,0xad,0xde] + addss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0x2d,0x45,0x00,0x00,0x00] + addss 0x45,%xmm5 + +// CHECK: addss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0x2d,0xed,0x7e,0x00,0x00] + addss 0x7eed,%xmm5 + +// CHECK: addss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0x2d,0xfe,0xca,0xbe,0xba] + addss 0xbabecafe,%xmm5 + +// CHECK: addss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0x2d,0x78,0x56,0x34,0x12] + addss 0x12345678,%xmm5 + +// CHECK: addss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x58,0xed] + addss %xmm5,%xmm5 + +// CHECK: andnps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x55,0xac,0xcb,0xef,0xbe,0xad,0xde] + andnps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: andnps 69, %xmm5 +// CHECK: encoding: [0x0f,0x55,0x2d,0x45,0x00,0x00,0x00] + andnps 0x45,%xmm5 + +// CHECK: andnps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x55,0x2d,0xed,0x7e,0x00,0x00] + andnps 0x7eed,%xmm5 + +// CHECK: andnps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x55,0x2d,0xfe,0xca,0xbe,0xba] + andnps 0xbabecafe,%xmm5 + +// CHECK: andnps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x55,0x2d,0x78,0x56,0x34,0x12] + andnps 0x12345678,%xmm5 + +// CHECK: andnps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x55,0xed] + andnps %xmm5,%xmm5 + +// CHECK: andps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x54,0xac,0xcb,0xef,0xbe,0xad,0xde] + andps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: andps 69, %xmm5 +// CHECK: encoding: [0x0f,0x54,0x2d,0x45,0x00,0x00,0x00] + andps 0x45,%xmm5 + +// CHECK: andps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x54,0x2d,0xed,0x7e,0x00,0x00] + andps 0x7eed,%xmm5 + +// CHECK: andps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x54,0x2d,0xfe,0xca,0xbe,0xba] + andps 0xbabecafe,%xmm5 + +// CHECK: andps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x54,0x2d,0x78,0x56,0x34,0x12] + andps 0x12345678,%xmm5 + +// CHECK: andps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x54,0xed] + andps %xmm5,%xmm5 + +// CHECK: comiss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x2f,0xac,0xcb,0xef,0xbe,0xad,0xde] + comiss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: comiss 69, %xmm5 +// CHECK: encoding: [0x0f,0x2f,0x2d,0x45,0x00,0x00,0x00] + comiss 0x45,%xmm5 + +// CHECK: comiss 32493, %xmm5 +// CHECK: encoding: [0x0f,0x2f,0x2d,0xed,0x7e,0x00,0x00] + comiss 0x7eed,%xmm5 + +// CHECK: comiss 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x2f,0x2d,0xfe,0xca,0xbe,0xba] + comiss 0xbabecafe,%xmm5 + +// CHECK: comiss 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x2f,0x2d,0x78,0x56,0x34,0x12] + comiss 0x12345678,%xmm5 + +// CHECK: comiss %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x2f,0xed] + comiss %xmm5,%xmm5 + +// CHECK: cvtpi2ps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtpi2ps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtpi2ps 69, %xmm5 +// CHECK: encoding: [0x0f,0x2a,0x2d,0x45,0x00,0x00,0x00] + cvtpi2ps 0x45,%xmm5 + +// CHECK: cvtpi2ps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x2a,0x2d,0xed,0x7e,0x00,0x00] + cvtpi2ps 0x7eed,%xmm5 + +// CHECK: cvtpi2ps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x2a,0x2d,0xfe,0xca,0xbe,0xba] + cvtpi2ps 0xbabecafe,%xmm5 + +// CHECK: cvtpi2ps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x2a,0x2d,0x78,0x56,0x34,0x12] + cvtpi2ps 0x12345678,%xmm5 + +// CHECK: cvtpi2ps %mm3, %xmm5 +// CHECK: encoding: [0x0f,0x2a,0xeb] + cvtpi2ps %mm3,%xmm5 + +// CHECK: cvtps2pi 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x2d,0x9c,0xcb,0xef,0xbe,0xad,0xde] + cvtps2pi 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: cvtps2pi 69, %mm3 +// CHECK: encoding: [0x0f,0x2d,0x1d,0x45,0x00,0x00,0x00] + cvtps2pi 0x45,%mm3 + +// CHECK: cvtps2pi 32493, %mm3 +// CHECK: encoding: [0x0f,0x2d,0x1d,0xed,0x7e,0x00,0x00] + cvtps2pi 0x7eed,%mm3 + +// CHECK: cvtps2pi 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x2d,0x1d,0xfe,0xca,0xbe,0xba] + cvtps2pi 0xbabecafe,%mm3 + +// CHECK: cvtps2pi 305419896, %mm3 +// CHECK: encoding: [0x0f,0x2d,0x1d,0x78,0x56,0x34,0x12] + cvtps2pi 0x12345678,%mm3 + +// CHECK: cvtps2pi %xmm5, %mm3 +// CHECK: encoding: [0x0f,0x2d,0xdd] + cvtps2pi %xmm5,%mm3 + +// CHECK: cvtsi2ss %ecx, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0xe9] + cvtsi2ss %ecx,%xmm5 + +// CHECK: cvtsi2ss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtsi2ss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtsi2ss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0x2d,0x45,0x00,0x00,0x00] + cvtsi2ss 0x45,%xmm5 + +// CHECK: cvtsi2ss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0x2d,0xed,0x7e,0x00,0x00] + cvtsi2ss 0x7eed,%xmm5 + +// CHECK: cvtsi2ss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0x2d,0xfe,0xca,0xbe,0xba] + cvtsi2ss 0xbabecafe,%xmm5 + +// CHECK: cvtsi2ss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x2a,0x2d,0x78,0x56,0x34,0x12] + cvtsi2ss 0x12345678,%xmm5 + +// CHECK: cvttps2pi 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x2c,0x9c,0xcb,0xef,0xbe,0xad,0xde] + cvttps2pi 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: cvttps2pi 69, %mm3 +// CHECK: encoding: [0x0f,0x2c,0x1d,0x45,0x00,0x00,0x00] + cvttps2pi 0x45,%mm3 + +// CHECK: cvttps2pi 32493, %mm3 +// CHECK: encoding: [0x0f,0x2c,0x1d,0xed,0x7e,0x00,0x00] + cvttps2pi 0x7eed,%mm3 + +// CHECK: cvttps2pi 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x2c,0x1d,0xfe,0xca,0xbe,0xba] + cvttps2pi 0xbabecafe,%mm3 + +// CHECK: cvttps2pi 305419896, %mm3 +// CHECK: encoding: [0x0f,0x2c,0x1d,0x78,0x56,0x34,0x12] + cvttps2pi 0x12345678,%mm3 + +// CHECK: cvttps2pi %xmm5, %mm3 +// CHECK: encoding: [0x0f,0x2c,0xdd] + cvttps2pi %xmm5,%mm3 + +// CHECK: cvttss2si 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0x8c,0xcb,0xef,0xbe,0xad,0xde] + cvttss2si 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: cvttss2si 69, %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0x0d,0x45,0x00,0x00,0x00] + cvttss2si 0x45,%ecx + +// CHECK: cvttss2si 32493, %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0x0d,0xed,0x7e,0x00,0x00] + cvttss2si 0x7eed,%ecx + +// CHECK: cvttss2si 3133065982, %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0x0d,0xfe,0xca,0xbe,0xba] + cvttss2si 0xbabecafe,%ecx + +// CHECK: cvttss2si 305419896, %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0x0d,0x78,0x56,0x34,0x12] + cvttss2si 0x12345678,%ecx + +// CHECK: cvttss2si %xmm5, %ecx +// CHECK: encoding: [0xf3,0x0f,0x2c,0xcd] + cvttss2si %xmm5,%ecx + +// CHECK: divps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5e,0xac,0xcb,0xef,0xbe,0xad,0xde] + divps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: divps 69, %xmm5 +// CHECK: encoding: [0x0f,0x5e,0x2d,0x45,0x00,0x00,0x00] + divps 0x45,%xmm5 + +// CHECK: divps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5e,0x2d,0xed,0x7e,0x00,0x00] + divps 0x7eed,%xmm5 + +// CHECK: divps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5e,0x2d,0xfe,0xca,0xbe,0xba] + divps 0xbabecafe,%xmm5 + +// CHECK: divps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5e,0x2d,0x78,0x56,0x34,0x12] + divps 0x12345678,%xmm5 + +// CHECK: divps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5e,0xed] + divps %xmm5,%xmm5 + +// CHECK: divss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0xac,0xcb,0xef,0xbe,0xad,0xde] + divss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: divss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0x2d,0x45,0x00,0x00,0x00] + divss 0x45,%xmm5 + +// CHECK: divss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0x2d,0xed,0x7e,0x00,0x00] + divss 0x7eed,%xmm5 + +// CHECK: divss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0x2d,0xfe,0xca,0xbe,0xba] + divss 0xbabecafe,%xmm5 + +// CHECK: divss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0x2d,0x78,0x56,0x34,0x12] + divss 0x12345678,%xmm5 + +// CHECK: divss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5e,0xed] + divss %xmm5,%xmm5 + +// CHECK: ldmxcsr 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xae,0x94,0xcb,0xef,0xbe,0xad,0xde] + ldmxcsr 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: ldmxcsr 32493 +// CHECK: encoding: [0x0f,0xae,0x15,0xed,0x7e,0x00,0x00] + ldmxcsr 0x7eed + +// CHECK: ldmxcsr 3133065982 +// CHECK: encoding: [0x0f,0xae,0x15,0xfe,0xca,0xbe,0xba] + ldmxcsr 0xbabecafe + +// CHECK: ldmxcsr 305419896 +// CHECK: encoding: [0x0f,0xae,0x15,0x78,0x56,0x34,0x12] + ldmxcsr 0x12345678 + +// CHECK: maskmovq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf7,0xdb] + maskmovq %mm3,%mm3 + +// CHECK: maxps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5f,0xac,0xcb,0xef,0xbe,0xad,0xde] + maxps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: maxps 69, %xmm5 +// CHECK: encoding: [0x0f,0x5f,0x2d,0x45,0x00,0x00,0x00] + maxps 0x45,%xmm5 + +// CHECK: maxps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5f,0x2d,0xed,0x7e,0x00,0x00] + maxps 0x7eed,%xmm5 + +// CHECK: maxps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5f,0x2d,0xfe,0xca,0xbe,0xba] + maxps 0xbabecafe,%xmm5 + +// CHECK: maxps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5f,0x2d,0x78,0x56,0x34,0x12] + maxps 0x12345678,%xmm5 + +// CHECK: maxps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5f,0xed] + maxps %xmm5,%xmm5 + +// CHECK: maxss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0xac,0xcb,0xef,0xbe,0xad,0xde] + maxss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: maxss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0x2d,0x45,0x00,0x00,0x00] + maxss 0x45,%xmm5 + +// CHECK: maxss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0x2d,0xed,0x7e,0x00,0x00] + maxss 0x7eed,%xmm5 + +// CHECK: maxss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0x2d,0xfe,0xca,0xbe,0xba] + maxss 0xbabecafe,%xmm5 + +// CHECK: maxss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0x2d,0x78,0x56,0x34,0x12] + maxss 0x12345678,%xmm5 + +// CHECK: maxss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5f,0xed] + maxss %xmm5,%xmm5 + +// CHECK: minps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5d,0xac,0xcb,0xef,0xbe,0xad,0xde] + minps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: minps 69, %xmm5 +// CHECK: encoding: [0x0f,0x5d,0x2d,0x45,0x00,0x00,0x00] + minps 0x45,%xmm5 + +// CHECK: minps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5d,0x2d,0xed,0x7e,0x00,0x00] + minps 0x7eed,%xmm5 + +// CHECK: minps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5d,0x2d,0xfe,0xca,0xbe,0xba] + minps 0xbabecafe,%xmm5 + +// CHECK: minps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5d,0x2d,0x78,0x56,0x34,0x12] + minps 0x12345678,%xmm5 + +// CHECK: minps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5d,0xed] + minps %xmm5,%xmm5 + +// CHECK: minss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0xac,0xcb,0xef,0xbe,0xad,0xde] + minss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: minss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0x2d,0x45,0x00,0x00,0x00] + minss 0x45,%xmm5 + +// CHECK: minss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0x2d,0xed,0x7e,0x00,0x00] + minss 0x7eed,%xmm5 + +// CHECK: minss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0x2d,0xfe,0xca,0xbe,0xba] + minss 0xbabecafe,%xmm5 + +// CHECK: minss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0x2d,0x78,0x56,0x34,0x12] + minss 0x12345678,%xmm5 + +// CHECK: minss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5d,0xed] + minss %xmm5,%xmm5 + +// CHECK: movaps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x28,0xac,0xcb,0xef,0xbe,0xad,0xde] + movaps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movaps 69, %xmm5 +// CHECK: encoding: [0x0f,0x28,0x2d,0x45,0x00,0x00,0x00] + movaps 0x45,%xmm5 + +// CHECK: movaps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x28,0x2d,0xed,0x7e,0x00,0x00] + movaps 0x7eed,%xmm5 + +// CHECK: movaps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x28,0x2d,0xfe,0xca,0xbe,0xba] + movaps 0xbabecafe,%xmm5 + +// CHECK: movaps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x28,0x2d,0x78,0x56,0x34,0x12] + movaps 0x12345678,%xmm5 + +// CHECK: movaps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x28,0xed] + movaps %xmm5,%xmm5 + +// CHECK: movaps %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x29,0xac,0xcb,0xef,0xbe,0xad,0xde] + movaps %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movaps %xmm5, 69 +// CHECK: encoding: [0x0f,0x29,0x2d,0x45,0x00,0x00,0x00] + movaps %xmm5,0x45 + +// CHECK: movaps %xmm5, 32493 +// CHECK: encoding: [0x0f,0x29,0x2d,0xed,0x7e,0x00,0x00] + movaps %xmm5,0x7eed + +// CHECK: movaps %xmm5, 3133065982 +// CHECK: encoding: [0x0f,0x29,0x2d,0xfe,0xca,0xbe,0xba] + movaps %xmm5,0xbabecafe + +// CHECK: movaps %xmm5, 305419896 +// CHECK: encoding: [0x0f,0x29,0x2d,0x78,0x56,0x34,0x12] + movaps %xmm5,0x12345678 + +// CHECK: movaps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x28,0xed] + movaps %xmm5,%xmm5 + +// CHECK: movhlps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x12,0xed] + movhlps %xmm5,%xmm5 + +// CHECK: movhps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x16,0xac,0xcb,0xef,0xbe,0xad,0xde] + movhps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movhps 69, %xmm5 +// CHECK: encoding: [0x0f,0x16,0x2d,0x45,0x00,0x00,0x00] + movhps 0x45,%xmm5 + +// CHECK: movhps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x16,0x2d,0xed,0x7e,0x00,0x00] + movhps 0x7eed,%xmm5 + +// CHECK: movhps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x16,0x2d,0xfe,0xca,0xbe,0xba] + movhps 0xbabecafe,%xmm5 + +// CHECK: movhps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x16,0x2d,0x78,0x56,0x34,0x12] + movhps 0x12345678,%xmm5 + +// CHECK: movhps %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x17,0xac,0xcb,0xef,0xbe,0xad,0xde] + movhps %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movhps %xmm5, 69 +// CHECK: encoding: [0x0f,0x17,0x2d,0x45,0x00,0x00,0x00] + movhps %xmm5,0x45 + +// CHECK: movhps %xmm5, 32493 +// CHECK: encoding: [0x0f,0x17,0x2d,0xed,0x7e,0x00,0x00] + movhps %xmm5,0x7eed + +// CHECK: movhps %xmm5, 3133065982 +// CHECK: encoding: [0x0f,0x17,0x2d,0xfe,0xca,0xbe,0xba] + movhps %xmm5,0xbabecafe + +// CHECK: movhps %xmm5, 305419896 +// CHECK: encoding: [0x0f,0x17,0x2d,0x78,0x56,0x34,0x12] + movhps %xmm5,0x12345678 + +// CHECK: movlhps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x16,0xed] + movlhps %xmm5,%xmm5 + +// CHECK: movlps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x12,0xac,0xcb,0xef,0xbe,0xad,0xde] + movlps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movlps 69, %xmm5 +// CHECK: encoding: [0x0f,0x12,0x2d,0x45,0x00,0x00,0x00] + movlps 0x45,%xmm5 + +// CHECK: movlps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x12,0x2d,0xed,0x7e,0x00,0x00] + movlps 0x7eed,%xmm5 + +// CHECK: movlps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x12,0x2d,0xfe,0xca,0xbe,0xba] + movlps 0xbabecafe,%xmm5 + +// CHECK: movlps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x12,0x2d,0x78,0x56,0x34,0x12] + movlps 0x12345678,%xmm5 + +// CHECK: movlps %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x13,0xac,0xcb,0xef,0xbe,0xad,0xde] + movlps %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movlps %xmm5, 69 +// CHECK: encoding: [0x0f,0x13,0x2d,0x45,0x00,0x00,0x00] + movlps %xmm5,0x45 + +// CHECK: movlps %xmm5, 32493 +// CHECK: encoding: [0x0f,0x13,0x2d,0xed,0x7e,0x00,0x00] + movlps %xmm5,0x7eed + +// CHECK: movlps %xmm5, 3133065982 +// CHECK: encoding: [0x0f,0x13,0x2d,0xfe,0xca,0xbe,0xba] + movlps %xmm5,0xbabecafe + +// CHECK: movlps %xmm5, 305419896 +// CHECK: encoding: [0x0f,0x13,0x2d,0x78,0x56,0x34,0x12] + movlps %xmm5,0x12345678 + +// CHECK: movmskps %xmm5, %ecx +// CHECK: encoding: [0x0f,0x50,0xcd] + movmskps %xmm5,%ecx + +// CHECK: movntps %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x2b,0xac,0xcb,0xef,0xbe,0xad,0xde] + movntps %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movntps %xmm5, 69 +// CHECK: encoding: [0x0f,0x2b,0x2d,0x45,0x00,0x00,0x00] + movntps %xmm5,0x45 + +// CHECK: movntps %xmm5, 32493 +// CHECK: encoding: [0x0f,0x2b,0x2d,0xed,0x7e,0x00,0x00] + movntps %xmm5,0x7eed + +// CHECK: movntps %xmm5, 3133065982 +// CHECK: encoding: [0x0f,0x2b,0x2d,0xfe,0xca,0xbe,0xba] + movntps %xmm5,0xbabecafe + +// CHECK: movntps %xmm5, 305419896 +// CHECK: encoding: [0x0f,0x2b,0x2d,0x78,0x56,0x34,0x12] + movntps %xmm5,0x12345678 + +// CHECK: movntq %mm3, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xe7,0x9c,0xcb,0xef,0xbe,0xad,0xde] + movntq %mm3,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movntq %mm3, 69 +// CHECK: encoding: [0x0f,0xe7,0x1d,0x45,0x00,0x00,0x00] + movntq %mm3,0x45 + +// CHECK: movntq %mm3, 32493 +// CHECK: encoding: [0x0f,0xe7,0x1d,0xed,0x7e,0x00,0x00] + movntq %mm3,0x7eed + +// CHECK: movntq %mm3, 3133065982 +// CHECK: encoding: [0x0f,0xe7,0x1d,0xfe,0xca,0xbe,0xba] + movntq %mm3,0xbabecafe + +// CHECK: movntq %mm3, 305419896 +// CHECK: encoding: [0x0f,0xe7,0x1d,0x78,0x56,0x34,0x12] + movntq %mm3,0x12345678 + +// CHECK: movntdq %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0xe7,0xac,0xcb,0xef,0xbe,0xad,0xde] + movntdq %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movntdq %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0xe7,0x2d,0x45,0x00,0x00,0x00] + movntdq %xmm5,0x45 + +// CHECK: movntdq %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0xe7,0x2d,0xed,0x7e,0x00,0x00] + movntdq %xmm5,0x7eed + +// CHECK: movntdq %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0xe7,0x2d,0xfe,0xca,0xbe,0xba] + movntdq %xmm5,0xbabecafe + +// CHECK: movntdq %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0xe7,0x2d,0x78,0x56,0x34,0x12] + movntdq %xmm5,0x12345678 + +// CHECK: movss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0xac,0xcb,0xef,0xbe,0xad,0xde] + movss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0x2d,0x45,0x00,0x00,0x00] + movss 0x45,%xmm5 + +// CHECK: movss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0x2d,0xed,0x7e,0x00,0x00] + movss 0x7eed,%xmm5 + +// CHECK: movss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0x2d,0xfe,0xca,0xbe,0xba] + movss 0xbabecafe,%xmm5 + +// CHECK: movss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0x2d,0x78,0x56,0x34,0x12] + movss 0x12345678,%xmm5 + +// CHECK: movss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0xed] + movss %xmm5,%xmm5 + +// CHECK: movss %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf3,0x0f,0x11,0xac,0xcb,0xef,0xbe,0xad,0xde] + movss %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movss %xmm5, 69 +// CHECK: encoding: [0xf3,0x0f,0x11,0x2d,0x45,0x00,0x00,0x00] + movss %xmm5,0x45 + +// CHECK: movss %xmm5, 32493 +// CHECK: encoding: [0xf3,0x0f,0x11,0x2d,0xed,0x7e,0x00,0x00] + movss %xmm5,0x7eed + +// CHECK: movss %xmm5, 3133065982 +// CHECK: encoding: [0xf3,0x0f,0x11,0x2d,0xfe,0xca,0xbe,0xba] + movss %xmm5,0xbabecafe + +// CHECK: movss %xmm5, 305419896 +// CHECK: encoding: [0xf3,0x0f,0x11,0x2d,0x78,0x56,0x34,0x12] + movss %xmm5,0x12345678 + +// CHECK: movss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x10,0xed] + movss %xmm5,%xmm5 + +// CHECK: movups 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x10,0xac,0xcb,0xef,0xbe,0xad,0xde] + movups 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movups 69, %xmm5 +// CHECK: encoding: [0x0f,0x10,0x2d,0x45,0x00,0x00,0x00] + movups 0x45,%xmm5 + +// CHECK: movups 32493, %xmm5 +// CHECK: encoding: [0x0f,0x10,0x2d,0xed,0x7e,0x00,0x00] + movups 0x7eed,%xmm5 + +// CHECK: movups 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x10,0x2d,0xfe,0xca,0xbe,0xba] + movups 0xbabecafe,%xmm5 + +// CHECK: movups 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x10,0x2d,0x78,0x56,0x34,0x12] + movups 0x12345678,%xmm5 + +// CHECK: movups %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x10,0xed] + movups %xmm5,%xmm5 + +// CHECK: movups %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x11,0xac,0xcb,0xef,0xbe,0xad,0xde] + movups %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movups %xmm5, 69 +// CHECK: encoding: [0x0f,0x11,0x2d,0x45,0x00,0x00,0x00] + movups %xmm5,0x45 + +// CHECK: movups %xmm5, 32493 +// CHECK: encoding: [0x0f,0x11,0x2d,0xed,0x7e,0x00,0x00] + movups %xmm5,0x7eed + +// CHECK: movups %xmm5, 3133065982 +// CHECK: encoding: [0x0f,0x11,0x2d,0xfe,0xca,0xbe,0xba] + movups %xmm5,0xbabecafe + +// CHECK: movups %xmm5, 305419896 +// CHECK: encoding: [0x0f,0x11,0x2d,0x78,0x56,0x34,0x12] + movups %xmm5,0x12345678 + +// CHECK: movups %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x10,0xed] + movups %xmm5,%xmm5 + +// CHECK: mulps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x59,0xac,0xcb,0xef,0xbe,0xad,0xde] + mulps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: mulps 69, %xmm5 +// CHECK: encoding: [0x0f,0x59,0x2d,0x45,0x00,0x00,0x00] + mulps 0x45,%xmm5 + +// CHECK: mulps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x59,0x2d,0xed,0x7e,0x00,0x00] + mulps 0x7eed,%xmm5 + +// CHECK: mulps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x59,0x2d,0xfe,0xca,0xbe,0xba] + mulps 0xbabecafe,%xmm5 + +// CHECK: mulps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x59,0x2d,0x78,0x56,0x34,0x12] + mulps 0x12345678,%xmm5 + +// CHECK: mulps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x59,0xed] + mulps %xmm5,%xmm5 + +// CHECK: mulss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0xac,0xcb,0xef,0xbe,0xad,0xde] + mulss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: mulss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0x2d,0x45,0x00,0x00,0x00] + mulss 0x45,%xmm5 + +// CHECK: mulss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0x2d,0xed,0x7e,0x00,0x00] + mulss 0x7eed,%xmm5 + +// CHECK: mulss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0x2d,0xfe,0xca,0xbe,0xba] + mulss 0xbabecafe,%xmm5 + +// CHECK: mulss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0x2d,0x78,0x56,0x34,0x12] + mulss 0x12345678,%xmm5 + +// CHECK: mulss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x59,0xed] + mulss %xmm5,%xmm5 + +// CHECK: orps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x56,0xac,0xcb,0xef,0xbe,0xad,0xde] + orps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: orps 69, %xmm5 +// CHECK: encoding: [0x0f,0x56,0x2d,0x45,0x00,0x00,0x00] + orps 0x45,%xmm5 + +// CHECK: orps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x56,0x2d,0xed,0x7e,0x00,0x00] + orps 0x7eed,%xmm5 + +// CHECK: orps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x56,0x2d,0xfe,0xca,0xbe,0xba] + orps 0xbabecafe,%xmm5 + +// CHECK: orps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x56,0x2d,0x78,0x56,0x34,0x12] + orps 0x12345678,%xmm5 + +// CHECK: orps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x56,0xed] + orps %xmm5,%xmm5 + +// CHECK: pavgb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe0,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pavgb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pavgb 69, %mm3 +// CHECK: encoding: [0x0f,0xe0,0x1d,0x45,0x00,0x00,0x00] + pavgb 0x45,%mm3 + +// CHECK: pavgb 32493, %mm3 +// CHECK: encoding: [0x0f,0xe0,0x1d,0xed,0x7e,0x00,0x00] + pavgb 0x7eed,%mm3 + +// CHECK: pavgb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe0,0x1d,0xfe,0xca,0xbe,0xba] + pavgb 0xbabecafe,%mm3 + +// CHECK: pavgb 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe0,0x1d,0x78,0x56,0x34,0x12] + pavgb 0x12345678,%mm3 + +// CHECK: pavgb %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe0,0xdb] + pavgb %mm3,%mm3 + +// CHECK: pavgb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0xac,0xcb,0xef,0xbe,0xad,0xde] + pavgb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pavgb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0x2d,0x45,0x00,0x00,0x00] + pavgb 0x45,%xmm5 + +// CHECK: pavgb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0x2d,0xed,0x7e,0x00,0x00] + pavgb 0x7eed,%xmm5 + +// CHECK: pavgb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0x2d,0xfe,0xca,0xbe,0xba] + pavgb 0xbabecafe,%xmm5 + +// CHECK: pavgb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0x2d,0x78,0x56,0x34,0x12] + pavgb 0x12345678,%xmm5 + +// CHECK: pavgb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe0,0xed] + pavgb %xmm5,%xmm5 + +// CHECK: pavgw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe3,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pavgw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pavgw 69, %mm3 +// CHECK: encoding: [0x0f,0xe3,0x1d,0x45,0x00,0x00,0x00] + pavgw 0x45,%mm3 + +// CHECK: pavgw 32493, %mm3 +// CHECK: encoding: [0x0f,0xe3,0x1d,0xed,0x7e,0x00,0x00] + pavgw 0x7eed,%mm3 + +// CHECK: pavgw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe3,0x1d,0xfe,0xca,0xbe,0xba] + pavgw 0xbabecafe,%mm3 + +// CHECK: pavgw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe3,0x1d,0x78,0x56,0x34,0x12] + pavgw 0x12345678,%mm3 + +// CHECK: pavgw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe3,0xdb] + pavgw %mm3,%mm3 + +// CHECK: pavgw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0xac,0xcb,0xef,0xbe,0xad,0xde] + pavgw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pavgw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0x2d,0x45,0x00,0x00,0x00] + pavgw 0x45,%xmm5 + +// CHECK: pavgw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0x2d,0xed,0x7e,0x00,0x00] + pavgw 0x7eed,%xmm5 + +// CHECK: pavgw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0x2d,0xfe,0xca,0xbe,0xba] + pavgw 0xbabecafe,%xmm5 + +// CHECK: pavgw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0x2d,0x78,0x56,0x34,0x12] + pavgw 0x12345678,%xmm5 + +// CHECK: pavgw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe3,0xed] + pavgw %xmm5,%xmm5 + +// CHECK: pmaxsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xee,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmaxsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmaxsw 69, %mm3 +// CHECK: encoding: [0x0f,0xee,0x1d,0x45,0x00,0x00,0x00] + pmaxsw 0x45,%mm3 + +// CHECK: pmaxsw 32493, %mm3 +// CHECK: encoding: [0x0f,0xee,0x1d,0xed,0x7e,0x00,0x00] + pmaxsw 0x7eed,%mm3 + +// CHECK: pmaxsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xee,0x1d,0xfe,0xca,0xbe,0xba] + pmaxsw 0xbabecafe,%mm3 + +// CHECK: pmaxsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xee,0x1d,0x78,0x56,0x34,0x12] + pmaxsw 0x12345678,%mm3 + +// CHECK: pmaxsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xee,0xdb] + pmaxsw %mm3,%mm3 + +// CHECK: pmaxsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0x2d,0x45,0x00,0x00,0x00] + pmaxsw 0x45,%xmm5 + +// CHECK: pmaxsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0x2d,0xed,0x7e,0x00,0x00] + pmaxsw 0x7eed,%xmm5 + +// CHECK: pmaxsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0x2d,0xfe,0xca,0xbe,0xba] + pmaxsw 0xbabecafe,%xmm5 + +// CHECK: pmaxsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0x2d,0x78,0x56,0x34,0x12] + pmaxsw 0x12345678,%xmm5 + +// CHECK: pmaxsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xee,0xed] + pmaxsw %xmm5,%xmm5 + +// CHECK: pmaxub 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xde,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmaxub 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmaxub 69, %mm3 +// CHECK: encoding: [0x0f,0xde,0x1d,0x45,0x00,0x00,0x00] + pmaxub 0x45,%mm3 + +// CHECK: pmaxub 32493, %mm3 +// CHECK: encoding: [0x0f,0xde,0x1d,0xed,0x7e,0x00,0x00] + pmaxub 0x7eed,%mm3 + +// CHECK: pmaxub 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xde,0x1d,0xfe,0xca,0xbe,0xba] + pmaxub 0xbabecafe,%mm3 + +// CHECK: pmaxub 305419896, %mm3 +// CHECK: encoding: [0x0f,0xde,0x1d,0x78,0x56,0x34,0x12] + pmaxub 0x12345678,%mm3 + +// CHECK: pmaxub %mm3, %mm3 +// CHECK: encoding: [0x0f,0xde,0xdb] + pmaxub %mm3,%mm3 + +// CHECK: pmaxub 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxub 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxub 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0x2d,0x45,0x00,0x00,0x00] + pmaxub 0x45,%xmm5 + +// CHECK: pmaxub 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0x2d,0xed,0x7e,0x00,0x00] + pmaxub 0x7eed,%xmm5 + +// CHECK: pmaxub 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0x2d,0xfe,0xca,0xbe,0xba] + pmaxub 0xbabecafe,%xmm5 + +// CHECK: pmaxub 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0x2d,0x78,0x56,0x34,0x12] + pmaxub 0x12345678,%xmm5 + +// CHECK: pmaxub %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xde,0xed] + pmaxub %xmm5,%xmm5 + +// CHECK: pminsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xea,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pminsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pminsw 69, %mm3 +// CHECK: encoding: [0x0f,0xea,0x1d,0x45,0x00,0x00,0x00] + pminsw 0x45,%mm3 + +// CHECK: pminsw 32493, %mm3 +// CHECK: encoding: [0x0f,0xea,0x1d,0xed,0x7e,0x00,0x00] + pminsw 0x7eed,%mm3 + +// CHECK: pminsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xea,0x1d,0xfe,0xca,0xbe,0xba] + pminsw 0xbabecafe,%mm3 + +// CHECK: pminsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xea,0x1d,0x78,0x56,0x34,0x12] + pminsw 0x12345678,%mm3 + +// CHECK: pminsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xea,0xdb] + pminsw %mm3,%mm3 + +// CHECK: pminsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0x2d,0x45,0x00,0x00,0x00] + pminsw 0x45,%xmm5 + +// CHECK: pminsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0x2d,0xed,0x7e,0x00,0x00] + pminsw 0x7eed,%xmm5 + +// CHECK: pminsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0x2d,0xfe,0xca,0xbe,0xba] + pminsw 0xbabecafe,%xmm5 + +// CHECK: pminsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0x2d,0x78,0x56,0x34,0x12] + pminsw 0x12345678,%xmm5 + +// CHECK: pminsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xea,0xed] + pminsw %xmm5,%xmm5 + +// CHECK: pminub 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xda,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pminub 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pminub 69, %mm3 +// CHECK: encoding: [0x0f,0xda,0x1d,0x45,0x00,0x00,0x00] + pminub 0x45,%mm3 + +// CHECK: pminub 32493, %mm3 +// CHECK: encoding: [0x0f,0xda,0x1d,0xed,0x7e,0x00,0x00] + pminub 0x7eed,%mm3 + +// CHECK: pminub 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xda,0x1d,0xfe,0xca,0xbe,0xba] + pminub 0xbabecafe,%mm3 + +// CHECK: pminub 305419896, %mm3 +// CHECK: encoding: [0x0f,0xda,0x1d,0x78,0x56,0x34,0x12] + pminub 0x12345678,%mm3 + +// CHECK: pminub %mm3, %mm3 +// CHECK: encoding: [0x0f,0xda,0xdb] + pminub %mm3,%mm3 + +// CHECK: pminub 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminub 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminub 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0x2d,0x45,0x00,0x00,0x00] + pminub 0x45,%xmm5 + +// CHECK: pminub 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0x2d,0xed,0x7e,0x00,0x00] + pminub 0x7eed,%xmm5 + +// CHECK: pminub 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0x2d,0xfe,0xca,0xbe,0xba] + pminub 0xbabecafe,%xmm5 + +// CHECK: pminub 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0x2d,0x78,0x56,0x34,0x12] + pminub 0x12345678,%xmm5 + +// CHECK: pminub %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xda,0xed] + pminub %xmm5,%xmm5 + +// CHECK: pmovmskb %mm3, %ecx +// CHECK: encoding: [0x0f,0xd7,0xcb] + pmovmskb %mm3,%ecx + +// CHECK: pmovmskb %xmm5, %ecx +// CHECK: encoding: [0x66,0x0f,0xd7,0xcd] + pmovmskb %xmm5,%ecx + +// CHECK: pmulhuw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xe4,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmulhuw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmulhuw 69, %mm3 +// CHECK: encoding: [0x0f,0xe4,0x1d,0x45,0x00,0x00,0x00] + pmulhuw 0x45,%mm3 + +// CHECK: pmulhuw 32493, %mm3 +// CHECK: encoding: [0x0f,0xe4,0x1d,0xed,0x7e,0x00,0x00] + pmulhuw 0x7eed,%mm3 + +// CHECK: pmulhuw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xe4,0x1d,0xfe,0xca,0xbe,0xba] + pmulhuw 0xbabecafe,%mm3 + +// CHECK: pmulhuw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xe4,0x1d,0x78,0x56,0x34,0x12] + pmulhuw 0x12345678,%mm3 + +// CHECK: pmulhuw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xe4,0xdb] + pmulhuw %mm3,%mm3 + +// CHECK: pmulhuw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmulhuw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmulhuw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0x2d,0x45,0x00,0x00,0x00] + pmulhuw 0x45,%xmm5 + +// CHECK: pmulhuw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0x2d,0xed,0x7e,0x00,0x00] + pmulhuw 0x7eed,%xmm5 + +// CHECK: pmulhuw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0x2d,0xfe,0xca,0xbe,0xba] + pmulhuw 0xbabecafe,%xmm5 + +// CHECK: pmulhuw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0x2d,0x78,0x56,0x34,0x12] + pmulhuw 0x12345678,%xmm5 + +// CHECK: pmulhuw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xe4,0xed] + pmulhuw %xmm5,%xmm5 + +// CHECK: prefetchnta 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x18,0x84,0xcb,0xef,0xbe,0xad,0xde] + prefetchnta 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: prefetchnta 32493 +// CHECK: encoding: [0x0f,0x18,0x05,0xed,0x7e,0x00,0x00] + prefetchnta 0x7eed + +// CHECK: prefetchnta 3133065982 +// CHECK: encoding: [0x0f,0x18,0x05,0xfe,0xca,0xbe,0xba] + prefetchnta 0xbabecafe + +// CHECK: prefetchnta 305419896 +// CHECK: encoding: [0x0f,0x18,0x05,0x78,0x56,0x34,0x12] + prefetchnta 0x12345678 + +// CHECK: prefetcht0 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x18,0x8c,0xcb,0xef,0xbe,0xad,0xde] + prefetcht0 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: prefetcht0 32493 +// CHECK: encoding: [0x0f,0x18,0x0d,0xed,0x7e,0x00,0x00] + prefetcht0 0x7eed + +// CHECK: prefetcht0 3133065982 +// CHECK: encoding: [0x0f,0x18,0x0d,0xfe,0xca,0xbe,0xba] + prefetcht0 0xbabecafe + +// CHECK: prefetcht0 305419896 +// CHECK: encoding: [0x0f,0x18,0x0d,0x78,0x56,0x34,0x12] + prefetcht0 0x12345678 + +// CHECK: prefetcht1 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x18,0x94,0xcb,0xef,0xbe,0xad,0xde] + prefetcht1 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: prefetcht1 32493 +// CHECK: encoding: [0x0f,0x18,0x15,0xed,0x7e,0x00,0x00] + prefetcht1 0x7eed + +// CHECK: prefetcht1 3133065982 +// CHECK: encoding: [0x0f,0x18,0x15,0xfe,0xca,0xbe,0xba] + prefetcht1 0xbabecafe + +// CHECK: prefetcht1 305419896 +// CHECK: encoding: [0x0f,0x18,0x15,0x78,0x56,0x34,0x12] + prefetcht1 0x12345678 + +// CHECK: prefetcht2 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0x18,0x9c,0xcb,0xef,0xbe,0xad,0xde] + prefetcht2 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: prefetcht2 32493 +// CHECK: encoding: [0x0f,0x18,0x1d,0xed,0x7e,0x00,0x00] + prefetcht2 0x7eed + +// CHECK: prefetcht2 3133065982 +// CHECK: encoding: [0x0f,0x18,0x1d,0xfe,0xca,0xbe,0xba] + prefetcht2 0xbabecafe + +// CHECK: prefetcht2 305419896 +// CHECK: encoding: [0x0f,0x18,0x1d,0x78,0x56,0x34,0x12] + prefetcht2 0x12345678 + +// CHECK: psadbw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf6,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psadbw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psadbw 69, %mm3 +// CHECK: encoding: [0x0f,0xf6,0x1d,0x45,0x00,0x00,0x00] + psadbw 0x45,%mm3 + +// CHECK: psadbw 32493, %mm3 +// CHECK: encoding: [0x0f,0xf6,0x1d,0xed,0x7e,0x00,0x00] + psadbw 0x7eed,%mm3 + +// CHECK: psadbw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf6,0x1d,0xfe,0xca,0xbe,0xba] + psadbw 0xbabecafe,%mm3 + +// CHECK: psadbw 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf6,0x1d,0x78,0x56,0x34,0x12] + psadbw 0x12345678,%mm3 + +// CHECK: psadbw %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf6,0xdb] + psadbw %mm3,%mm3 + +// CHECK: psadbw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0xac,0xcb,0xef,0xbe,0xad,0xde] + psadbw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psadbw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0x2d,0x45,0x00,0x00,0x00] + psadbw 0x45,%xmm5 + +// CHECK: psadbw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0x2d,0xed,0x7e,0x00,0x00] + psadbw 0x7eed,%xmm5 + +// CHECK: psadbw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0x2d,0xfe,0xca,0xbe,0xba] + psadbw 0xbabecafe,%xmm5 + +// CHECK: psadbw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0x2d,0x78,0x56,0x34,0x12] + psadbw 0x12345678,%xmm5 + +// CHECK: psadbw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf6,0xed] + psadbw %xmm5,%xmm5 + +// CHECK: rcpps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x53,0xac,0xcb,0xef,0xbe,0xad,0xde] + rcpps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: rcpps 69, %xmm5 +// CHECK: encoding: [0x0f,0x53,0x2d,0x45,0x00,0x00,0x00] + rcpps 0x45,%xmm5 + +// CHECK: rcpps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x53,0x2d,0xed,0x7e,0x00,0x00] + rcpps 0x7eed,%xmm5 + +// CHECK: rcpps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x53,0x2d,0xfe,0xca,0xbe,0xba] + rcpps 0xbabecafe,%xmm5 + +// CHECK: rcpps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x53,0x2d,0x78,0x56,0x34,0x12] + rcpps 0x12345678,%xmm5 + +// CHECK: rcpps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x53,0xed] + rcpps %xmm5,%xmm5 + +// CHECK: rcpss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0xac,0xcb,0xef,0xbe,0xad,0xde] + rcpss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: rcpss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0x2d,0x45,0x00,0x00,0x00] + rcpss 0x45,%xmm5 + +// CHECK: rcpss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0x2d,0xed,0x7e,0x00,0x00] + rcpss 0x7eed,%xmm5 + +// CHECK: rcpss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0x2d,0xfe,0xca,0xbe,0xba] + rcpss 0xbabecafe,%xmm5 + +// CHECK: rcpss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0x2d,0x78,0x56,0x34,0x12] + rcpss 0x12345678,%xmm5 + +// CHECK: rcpss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x53,0xed] + rcpss %xmm5,%xmm5 + +// CHECK: rsqrtps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x52,0xac,0xcb,0xef,0xbe,0xad,0xde] + rsqrtps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: rsqrtps 69, %xmm5 +// CHECK: encoding: [0x0f,0x52,0x2d,0x45,0x00,0x00,0x00] + rsqrtps 0x45,%xmm5 + +// CHECK: rsqrtps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x52,0x2d,0xed,0x7e,0x00,0x00] + rsqrtps 0x7eed,%xmm5 + +// CHECK: rsqrtps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x52,0x2d,0xfe,0xca,0xbe,0xba] + rsqrtps 0xbabecafe,%xmm5 + +// CHECK: rsqrtps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x52,0x2d,0x78,0x56,0x34,0x12] + rsqrtps 0x12345678,%xmm5 + +// CHECK: rsqrtps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x52,0xed] + rsqrtps %xmm5,%xmm5 + +// CHECK: rsqrtss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0xac,0xcb,0xef,0xbe,0xad,0xde] + rsqrtss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: rsqrtss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0x2d,0x45,0x00,0x00,0x00] + rsqrtss 0x45,%xmm5 + +// CHECK: rsqrtss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0x2d,0xed,0x7e,0x00,0x00] + rsqrtss 0x7eed,%xmm5 + +// CHECK: rsqrtss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0x2d,0xfe,0xca,0xbe,0xba] + rsqrtss 0xbabecafe,%xmm5 + +// CHECK: rsqrtss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0x2d,0x78,0x56,0x34,0x12] + rsqrtss 0x12345678,%xmm5 + +// CHECK: rsqrtss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x52,0xed] + rsqrtss %xmm5,%xmm5 + +// CHECK: sqrtps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x51,0xac,0xcb,0xef,0xbe,0xad,0xde] + sqrtps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: sqrtps 69, %xmm5 +// CHECK: encoding: [0x0f,0x51,0x2d,0x45,0x00,0x00,0x00] + sqrtps 0x45,%xmm5 + +// CHECK: sqrtps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x51,0x2d,0xed,0x7e,0x00,0x00] + sqrtps 0x7eed,%xmm5 + +// CHECK: sqrtps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x51,0x2d,0xfe,0xca,0xbe,0xba] + sqrtps 0xbabecafe,%xmm5 + +// CHECK: sqrtps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x51,0x2d,0x78,0x56,0x34,0x12] + sqrtps 0x12345678,%xmm5 + +// CHECK: sqrtps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x51,0xed] + sqrtps %xmm5,%xmm5 + +// CHECK: sqrtss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0xac,0xcb,0xef,0xbe,0xad,0xde] + sqrtss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: sqrtss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0x2d,0x45,0x00,0x00,0x00] + sqrtss 0x45,%xmm5 + +// CHECK: sqrtss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0x2d,0xed,0x7e,0x00,0x00] + sqrtss 0x7eed,%xmm5 + +// CHECK: sqrtss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0x2d,0xfe,0xca,0xbe,0xba] + sqrtss 0xbabecafe,%xmm5 + +// CHECK: sqrtss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0x2d,0x78,0x56,0x34,0x12] + sqrtss 0x12345678,%xmm5 + +// CHECK: sqrtss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x51,0xed] + sqrtss %xmm5,%xmm5 + +// CHECK: stmxcsr 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xae,0x9c,0xcb,0xef,0xbe,0xad,0xde] + stmxcsr 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: stmxcsr 32493 +// CHECK: encoding: [0x0f,0xae,0x1d,0xed,0x7e,0x00,0x00] + stmxcsr 0x7eed + +// CHECK: stmxcsr 3133065982 +// CHECK: encoding: [0x0f,0xae,0x1d,0xfe,0xca,0xbe,0xba] + stmxcsr 0xbabecafe + +// CHECK: stmxcsr 305419896 +// CHECK: encoding: [0x0f,0xae,0x1d,0x78,0x56,0x34,0x12] + stmxcsr 0x12345678 + +// CHECK: subps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5c,0xac,0xcb,0xef,0xbe,0xad,0xde] + subps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: subps 69, %xmm5 +// CHECK: encoding: [0x0f,0x5c,0x2d,0x45,0x00,0x00,0x00] + subps 0x45,%xmm5 + +// CHECK: subps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5c,0x2d,0xed,0x7e,0x00,0x00] + subps 0x7eed,%xmm5 + +// CHECK: subps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5c,0x2d,0xfe,0xca,0xbe,0xba] + subps 0xbabecafe,%xmm5 + +// CHECK: subps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5c,0x2d,0x78,0x56,0x34,0x12] + subps 0x12345678,%xmm5 + +// CHECK: subps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5c,0xed] + subps %xmm5,%xmm5 + +// CHECK: subss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0xac,0xcb,0xef,0xbe,0xad,0xde] + subss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: subss 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0x2d,0x45,0x00,0x00,0x00] + subss 0x45,%xmm5 + +// CHECK: subss 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0x2d,0xed,0x7e,0x00,0x00] + subss 0x7eed,%xmm5 + +// CHECK: subss 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0x2d,0xfe,0xca,0xbe,0xba] + subss 0xbabecafe,%xmm5 + +// CHECK: subss 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0x2d,0x78,0x56,0x34,0x12] + subss 0x12345678,%xmm5 + +// CHECK: subss %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5c,0xed] + subss %xmm5,%xmm5 + +// CHECK: ucomiss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x2e,0xac,0xcb,0xef,0xbe,0xad,0xde] + ucomiss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: ucomiss 69, %xmm5 +// CHECK: encoding: [0x0f,0x2e,0x2d,0x45,0x00,0x00,0x00] + ucomiss 0x45,%xmm5 + +// CHECK: ucomiss 32493, %xmm5 +// CHECK: encoding: [0x0f,0x2e,0x2d,0xed,0x7e,0x00,0x00] + ucomiss 0x7eed,%xmm5 + +// CHECK: ucomiss 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x2e,0x2d,0xfe,0xca,0xbe,0xba] + ucomiss 0xbabecafe,%xmm5 + +// CHECK: ucomiss 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x2e,0x2d,0x78,0x56,0x34,0x12] + ucomiss 0x12345678,%xmm5 + +// CHECK: ucomiss %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x2e,0xed] + ucomiss %xmm5,%xmm5 + +// CHECK: unpckhps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x15,0xac,0xcb,0xef,0xbe,0xad,0xde] + unpckhps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: unpckhps 69, %xmm5 +// CHECK: encoding: [0x0f,0x15,0x2d,0x45,0x00,0x00,0x00] + unpckhps 0x45,%xmm5 + +// CHECK: unpckhps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x15,0x2d,0xed,0x7e,0x00,0x00] + unpckhps 0x7eed,%xmm5 + +// CHECK: unpckhps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x15,0x2d,0xfe,0xca,0xbe,0xba] + unpckhps 0xbabecafe,%xmm5 + +// CHECK: unpckhps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x15,0x2d,0x78,0x56,0x34,0x12] + unpckhps 0x12345678,%xmm5 + +// CHECK: unpckhps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x15,0xed] + unpckhps %xmm5,%xmm5 + +// CHECK: unpcklps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x14,0xac,0xcb,0xef,0xbe,0xad,0xde] + unpcklps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: unpcklps 69, %xmm5 +// CHECK: encoding: [0x0f,0x14,0x2d,0x45,0x00,0x00,0x00] + unpcklps 0x45,%xmm5 + +// CHECK: unpcklps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x14,0x2d,0xed,0x7e,0x00,0x00] + unpcklps 0x7eed,%xmm5 + +// CHECK: unpcklps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x14,0x2d,0xfe,0xca,0xbe,0xba] + unpcklps 0xbabecafe,%xmm5 + +// CHECK: unpcklps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x14,0x2d,0x78,0x56,0x34,0x12] + unpcklps 0x12345678,%xmm5 + +// CHECK: unpcklps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x14,0xed] + unpcklps %xmm5,%xmm5 + +// CHECK: xorps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x57,0xac,0xcb,0xef,0xbe,0xad,0xde] + xorps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: xorps 69, %xmm5 +// CHECK: encoding: [0x0f,0x57,0x2d,0x45,0x00,0x00,0x00] + xorps 0x45,%xmm5 + +// CHECK: xorps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x57,0x2d,0xed,0x7e,0x00,0x00] + xorps 0x7eed,%xmm5 + +// CHECK: xorps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x57,0x2d,0xfe,0xca,0xbe,0xba] + xorps 0xbabecafe,%xmm5 + +// CHECK: xorps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x57,0x2d,0x78,0x56,0x34,0x12] + xorps 0x12345678,%xmm5 + +// CHECK: xorps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x57,0xed] + xorps %xmm5,%xmm5 + +// CHECK: addpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0xac,0xcb,0xef,0xbe,0xad,0xde] + addpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0x2d,0x45,0x00,0x00,0x00] + addpd 0x45,%xmm5 + +// CHECK: addpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0x2d,0xed,0x7e,0x00,0x00] + addpd 0x7eed,%xmm5 + +// CHECK: addpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0x2d,0xfe,0xca,0xbe,0xba] + addpd 0xbabecafe,%xmm5 + +// CHECK: addpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0x2d,0x78,0x56,0x34,0x12] + addpd 0x12345678,%xmm5 + +// CHECK: addpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x58,0xed] + addpd %xmm5,%xmm5 + +// CHECK: addsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0xac,0xcb,0xef,0xbe,0xad,0xde] + addsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0x2d,0x45,0x00,0x00,0x00] + addsd 0x45,%xmm5 + +// CHECK: addsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0x2d,0xed,0x7e,0x00,0x00] + addsd 0x7eed,%xmm5 + +// CHECK: addsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0x2d,0xfe,0xca,0xbe,0xba] + addsd 0xbabecafe,%xmm5 + +// CHECK: addsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0x2d,0x78,0x56,0x34,0x12] + addsd 0x12345678,%xmm5 + +// CHECK: addsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x58,0xed] + addsd %xmm5,%xmm5 + +// CHECK: andnpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0xac,0xcb,0xef,0xbe,0xad,0xde] + andnpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: andnpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0x2d,0x45,0x00,0x00,0x00] + andnpd 0x45,%xmm5 + +// CHECK: andnpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0x2d,0xed,0x7e,0x00,0x00] + andnpd 0x7eed,%xmm5 + +// CHECK: andnpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0x2d,0xfe,0xca,0xbe,0xba] + andnpd 0xbabecafe,%xmm5 + +// CHECK: andnpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0x2d,0x78,0x56,0x34,0x12] + andnpd 0x12345678,%xmm5 + +// CHECK: andnpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x55,0xed] + andnpd %xmm5,%xmm5 + +// CHECK: andpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0xac,0xcb,0xef,0xbe,0xad,0xde] + andpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: andpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0x2d,0x45,0x00,0x00,0x00] + andpd 0x45,%xmm5 + +// CHECK: andpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0x2d,0xed,0x7e,0x00,0x00] + andpd 0x7eed,%xmm5 + +// CHECK: andpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0x2d,0xfe,0xca,0xbe,0xba] + andpd 0xbabecafe,%xmm5 + +// CHECK: andpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0x2d,0x78,0x56,0x34,0x12] + andpd 0x12345678,%xmm5 + +// CHECK: andpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x54,0xed] + andpd %xmm5,%xmm5 + +// CHECK: comisd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0xac,0xcb,0xef,0xbe,0xad,0xde] + comisd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: comisd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0x2d,0x45,0x00,0x00,0x00] + comisd 0x45,%xmm5 + +// CHECK: comisd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0x2d,0xed,0x7e,0x00,0x00] + comisd 0x7eed,%xmm5 + +// CHECK: comisd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0x2d,0xfe,0xca,0xbe,0xba] + comisd 0xbabecafe,%xmm5 + +// CHECK: comisd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0x2d,0x78,0x56,0x34,0x12] + comisd 0x12345678,%xmm5 + +// CHECK: comisd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2f,0xed] + comisd %xmm5,%xmm5 + +// CHECK: cvtpi2pd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtpi2pd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtpi2pd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0x2d,0x45,0x00,0x00,0x00] + cvtpi2pd 0x45,%xmm5 + +// CHECK: cvtpi2pd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0x2d,0xed,0x7e,0x00,0x00] + cvtpi2pd 0x7eed,%xmm5 + +// CHECK: cvtpi2pd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0x2d,0xfe,0xca,0xbe,0xba] + cvtpi2pd 0xbabecafe,%xmm5 + +// CHECK: cvtpi2pd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0x2d,0x78,0x56,0x34,0x12] + cvtpi2pd 0x12345678,%xmm5 + +// CHECK: cvtpi2pd %mm3, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2a,0xeb] + cvtpi2pd %mm3,%xmm5 + +// CHECK: cvtsi2sd %ecx, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0xe9] + cvtsi2sd %ecx,%xmm5 + +// CHECK: cvtsi2sd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtsi2sd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtsi2sd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0x2d,0x45,0x00,0x00,0x00] + cvtsi2sd 0x45,%xmm5 + +// CHECK: cvtsi2sd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0x2d,0xed,0x7e,0x00,0x00] + cvtsi2sd 0x7eed,%xmm5 + +// CHECK: cvtsi2sd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0x2d,0xfe,0xca,0xbe,0xba] + cvtsi2sd 0xbabecafe,%xmm5 + +// CHECK: cvtsi2sd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x2a,0x2d,0x78,0x56,0x34,0x12] + cvtsi2sd 0x12345678,%xmm5 + +// CHECK: divpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0xac,0xcb,0xef,0xbe,0xad,0xde] + divpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: divpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0x2d,0x45,0x00,0x00,0x00] + divpd 0x45,%xmm5 + +// CHECK: divpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0x2d,0xed,0x7e,0x00,0x00] + divpd 0x7eed,%xmm5 + +// CHECK: divpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0x2d,0xfe,0xca,0xbe,0xba] + divpd 0xbabecafe,%xmm5 + +// CHECK: divpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0x2d,0x78,0x56,0x34,0x12] + divpd 0x12345678,%xmm5 + +// CHECK: divpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5e,0xed] + divpd %xmm5,%xmm5 + +// CHECK: divsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0xac,0xcb,0xef,0xbe,0xad,0xde] + divsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: divsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0x2d,0x45,0x00,0x00,0x00] + divsd 0x45,%xmm5 + +// CHECK: divsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0x2d,0xed,0x7e,0x00,0x00] + divsd 0x7eed,%xmm5 + +// CHECK: divsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0x2d,0xfe,0xca,0xbe,0xba] + divsd 0xbabecafe,%xmm5 + +// CHECK: divsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0x2d,0x78,0x56,0x34,0x12] + divsd 0x12345678,%xmm5 + +// CHECK: divsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5e,0xed] + divsd %xmm5,%xmm5 + +// CHECK: maxpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0xac,0xcb,0xef,0xbe,0xad,0xde] + maxpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: maxpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0x2d,0x45,0x00,0x00,0x00] + maxpd 0x45,%xmm5 + +// CHECK: maxpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0x2d,0xed,0x7e,0x00,0x00] + maxpd 0x7eed,%xmm5 + +// CHECK: maxpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0x2d,0xfe,0xca,0xbe,0xba] + maxpd 0xbabecafe,%xmm5 + +// CHECK: maxpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0x2d,0x78,0x56,0x34,0x12] + maxpd 0x12345678,%xmm5 + +// CHECK: maxpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5f,0xed] + maxpd %xmm5,%xmm5 + +// CHECK: maxsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0xac,0xcb,0xef,0xbe,0xad,0xde] + maxsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: maxsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0x2d,0x45,0x00,0x00,0x00] + maxsd 0x45,%xmm5 + +// CHECK: maxsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0x2d,0xed,0x7e,0x00,0x00] + maxsd 0x7eed,%xmm5 + +// CHECK: maxsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0x2d,0xfe,0xca,0xbe,0xba] + maxsd 0xbabecafe,%xmm5 + +// CHECK: maxsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0x2d,0x78,0x56,0x34,0x12] + maxsd 0x12345678,%xmm5 + +// CHECK: maxsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5f,0xed] + maxsd %xmm5,%xmm5 + +// CHECK: minpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0xac,0xcb,0xef,0xbe,0xad,0xde] + minpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: minpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0x2d,0x45,0x00,0x00,0x00] + minpd 0x45,%xmm5 + +// CHECK: minpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0x2d,0xed,0x7e,0x00,0x00] + minpd 0x7eed,%xmm5 + +// CHECK: minpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0x2d,0xfe,0xca,0xbe,0xba] + minpd 0xbabecafe,%xmm5 + +// CHECK: minpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0x2d,0x78,0x56,0x34,0x12] + minpd 0x12345678,%xmm5 + +// CHECK: minpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5d,0xed] + minpd %xmm5,%xmm5 + +// CHECK: minsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0xac,0xcb,0xef,0xbe,0xad,0xde] + minsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: minsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0x2d,0x45,0x00,0x00,0x00] + minsd 0x45,%xmm5 + +// CHECK: minsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0x2d,0xed,0x7e,0x00,0x00] + minsd 0x7eed,%xmm5 + +// CHECK: minsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0x2d,0xfe,0xca,0xbe,0xba] + minsd 0xbabecafe,%xmm5 + +// CHECK: minsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0x2d,0x78,0x56,0x34,0x12] + minsd 0x12345678,%xmm5 + +// CHECK: minsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5d,0xed] + minsd %xmm5,%xmm5 + +// CHECK: movapd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0xac,0xcb,0xef,0xbe,0xad,0xde] + movapd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movapd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0x2d,0x45,0x00,0x00,0x00] + movapd 0x45,%xmm5 + +// CHECK: movapd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0x2d,0xed,0x7e,0x00,0x00] + movapd 0x7eed,%xmm5 + +// CHECK: movapd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0x2d,0xfe,0xca,0xbe,0xba] + movapd 0xbabecafe,%xmm5 + +// CHECK: movapd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0x2d,0x78,0x56,0x34,0x12] + movapd 0x12345678,%xmm5 + +// CHECK: movapd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0xed] + movapd %xmm5,%xmm5 + +// CHECK: movapd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x29,0xac,0xcb,0xef,0xbe,0xad,0xde] + movapd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movapd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x29,0x2d,0x45,0x00,0x00,0x00] + movapd %xmm5,0x45 + +// CHECK: movapd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x29,0x2d,0xed,0x7e,0x00,0x00] + movapd %xmm5,0x7eed + +// CHECK: movapd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x29,0x2d,0xfe,0xca,0xbe,0xba] + movapd %xmm5,0xbabecafe + +// CHECK: movapd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x29,0x2d,0x78,0x56,0x34,0x12] + movapd %xmm5,0x12345678 + +// CHECK: movapd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x28,0xed] + movapd %xmm5,%xmm5 + +// CHECK: movhpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x16,0xac,0xcb,0xef,0xbe,0xad,0xde] + movhpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movhpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x16,0x2d,0x45,0x00,0x00,0x00] + movhpd 0x45,%xmm5 + +// CHECK: movhpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x16,0x2d,0xed,0x7e,0x00,0x00] + movhpd 0x7eed,%xmm5 + +// CHECK: movhpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x16,0x2d,0xfe,0xca,0xbe,0xba] + movhpd 0xbabecafe,%xmm5 + +// CHECK: movhpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x16,0x2d,0x78,0x56,0x34,0x12] + movhpd 0x12345678,%xmm5 + +// CHECK: movhpd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x17,0xac,0xcb,0xef,0xbe,0xad,0xde] + movhpd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movhpd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x17,0x2d,0x45,0x00,0x00,0x00] + movhpd %xmm5,0x45 + +// CHECK: movhpd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x17,0x2d,0xed,0x7e,0x00,0x00] + movhpd %xmm5,0x7eed + +// CHECK: movhpd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x17,0x2d,0xfe,0xca,0xbe,0xba] + movhpd %xmm5,0xbabecafe + +// CHECK: movhpd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x17,0x2d,0x78,0x56,0x34,0x12] + movhpd %xmm5,0x12345678 + +// CHECK: movlpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x12,0xac,0xcb,0xef,0xbe,0xad,0xde] + movlpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movlpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x12,0x2d,0x45,0x00,0x00,0x00] + movlpd 0x45,%xmm5 + +// CHECK: movlpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x12,0x2d,0xed,0x7e,0x00,0x00] + movlpd 0x7eed,%xmm5 + +// CHECK: movlpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x12,0x2d,0xfe,0xca,0xbe,0xba] + movlpd 0xbabecafe,%xmm5 + +// CHECK: movlpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x12,0x2d,0x78,0x56,0x34,0x12] + movlpd 0x12345678,%xmm5 + +// CHECK: movlpd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x13,0xac,0xcb,0xef,0xbe,0xad,0xde] + movlpd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movlpd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x13,0x2d,0x45,0x00,0x00,0x00] + movlpd %xmm5,0x45 + +// CHECK: movlpd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x13,0x2d,0xed,0x7e,0x00,0x00] + movlpd %xmm5,0x7eed + +// CHECK: movlpd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x13,0x2d,0xfe,0xca,0xbe,0xba] + movlpd %xmm5,0xbabecafe + +// CHECK: movlpd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x13,0x2d,0x78,0x56,0x34,0x12] + movlpd %xmm5,0x12345678 + +// CHECK: movmskpd %xmm5, %ecx +// CHECK: encoding: [0x66,0x0f,0x50,0xcd] + movmskpd %xmm5,%ecx + +// CHECK: movntpd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x2b,0xac,0xcb,0xef,0xbe,0xad,0xde] + movntpd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movntpd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x2b,0x2d,0x45,0x00,0x00,0x00] + movntpd %xmm5,0x45 + +// CHECK: movntpd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x2b,0x2d,0xed,0x7e,0x00,0x00] + movntpd %xmm5,0x7eed + +// CHECK: movntpd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x2b,0x2d,0xfe,0xca,0xbe,0xba] + movntpd %xmm5,0xbabecafe + +// CHECK: movntpd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x2b,0x2d,0x78,0x56,0x34,0x12] + movntpd %xmm5,0x12345678 + +// CHECK: movsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0xac,0xcb,0xef,0xbe,0xad,0xde] + movsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0x2d,0x45,0x00,0x00,0x00] + movsd 0x45,%xmm5 + +// CHECK: movsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0x2d,0xed,0x7e,0x00,0x00] + movsd 0x7eed,%xmm5 + +// CHECK: movsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0x2d,0xfe,0xca,0xbe,0xba] + movsd 0xbabecafe,%xmm5 + +// CHECK: movsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0x2d,0x78,0x56,0x34,0x12] + movsd 0x12345678,%xmm5 + +// CHECK: movsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0xed] + movsd %xmm5,%xmm5 + +// CHECK: movsd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf2,0x0f,0x11,0xac,0xcb,0xef,0xbe,0xad,0xde] + movsd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movsd %xmm5, 69 +// CHECK: encoding: [0xf2,0x0f,0x11,0x2d,0x45,0x00,0x00,0x00] + movsd %xmm5,0x45 + +// CHECK: movsd %xmm5, 32493 +// CHECK: encoding: [0xf2,0x0f,0x11,0x2d,0xed,0x7e,0x00,0x00] + movsd %xmm5,0x7eed + +// CHECK: movsd %xmm5, 3133065982 +// CHECK: encoding: [0xf2,0x0f,0x11,0x2d,0xfe,0xca,0xbe,0xba] + movsd %xmm5,0xbabecafe + +// CHECK: movsd %xmm5, 305419896 +// CHECK: encoding: [0xf2,0x0f,0x11,0x2d,0x78,0x56,0x34,0x12] + movsd %xmm5,0x12345678 + +// CHECK: movsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x10,0xed] + movsd %xmm5,%xmm5 + +// CHECK: movupd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0xac,0xcb,0xef,0xbe,0xad,0xde] + movupd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movupd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0x2d,0x45,0x00,0x00,0x00] + movupd 0x45,%xmm5 + +// CHECK: movupd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0x2d,0xed,0x7e,0x00,0x00] + movupd 0x7eed,%xmm5 + +// CHECK: movupd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0x2d,0xfe,0xca,0xbe,0xba] + movupd 0xbabecafe,%xmm5 + +// CHECK: movupd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0x2d,0x78,0x56,0x34,0x12] + movupd 0x12345678,%xmm5 + +// CHECK: movupd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0xed] + movupd %xmm5,%xmm5 + +// CHECK: movupd %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x11,0xac,0xcb,0xef,0xbe,0xad,0xde] + movupd %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movupd %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x11,0x2d,0x45,0x00,0x00,0x00] + movupd %xmm5,0x45 + +// CHECK: movupd %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x11,0x2d,0xed,0x7e,0x00,0x00] + movupd %xmm5,0x7eed + +// CHECK: movupd %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x11,0x2d,0xfe,0xca,0xbe,0xba] + movupd %xmm5,0xbabecafe + +// CHECK: movupd %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x11,0x2d,0x78,0x56,0x34,0x12] + movupd %xmm5,0x12345678 + +// CHECK: movupd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x10,0xed] + movupd %xmm5,%xmm5 + +// CHECK: mulpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0xac,0xcb,0xef,0xbe,0xad,0xde] + mulpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: mulpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0x2d,0x45,0x00,0x00,0x00] + mulpd 0x45,%xmm5 + +// CHECK: mulpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0x2d,0xed,0x7e,0x00,0x00] + mulpd 0x7eed,%xmm5 + +// CHECK: mulpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0x2d,0xfe,0xca,0xbe,0xba] + mulpd 0xbabecafe,%xmm5 + +// CHECK: mulpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0x2d,0x78,0x56,0x34,0x12] + mulpd 0x12345678,%xmm5 + +// CHECK: mulpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x59,0xed] + mulpd %xmm5,%xmm5 + +// CHECK: mulsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0xac,0xcb,0xef,0xbe,0xad,0xde] + mulsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: mulsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0x2d,0x45,0x00,0x00,0x00] + mulsd 0x45,%xmm5 + +// CHECK: mulsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0x2d,0xed,0x7e,0x00,0x00] + mulsd 0x7eed,%xmm5 + +// CHECK: mulsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0x2d,0xfe,0xca,0xbe,0xba] + mulsd 0xbabecafe,%xmm5 + +// CHECK: mulsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0x2d,0x78,0x56,0x34,0x12] + mulsd 0x12345678,%xmm5 + +// CHECK: mulsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x59,0xed] + mulsd %xmm5,%xmm5 + +// CHECK: orpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0xac,0xcb,0xef,0xbe,0xad,0xde] + orpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: orpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0x2d,0x45,0x00,0x00,0x00] + orpd 0x45,%xmm5 + +// CHECK: orpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0x2d,0xed,0x7e,0x00,0x00] + orpd 0x7eed,%xmm5 + +// CHECK: orpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0x2d,0xfe,0xca,0xbe,0xba] + orpd 0xbabecafe,%xmm5 + +// CHECK: orpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0x2d,0x78,0x56,0x34,0x12] + orpd 0x12345678,%xmm5 + +// CHECK: orpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x56,0xed] + orpd %xmm5,%xmm5 + +// CHECK: sqrtpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0xac,0xcb,0xef,0xbe,0xad,0xde] + sqrtpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: sqrtpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0x2d,0x45,0x00,0x00,0x00] + sqrtpd 0x45,%xmm5 + +// CHECK: sqrtpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0x2d,0xed,0x7e,0x00,0x00] + sqrtpd 0x7eed,%xmm5 + +// CHECK: sqrtpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0x2d,0xfe,0xca,0xbe,0xba] + sqrtpd 0xbabecafe,%xmm5 + +// CHECK: sqrtpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0x2d,0x78,0x56,0x34,0x12] + sqrtpd 0x12345678,%xmm5 + +// CHECK: sqrtpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x51,0xed] + sqrtpd %xmm5,%xmm5 + +// CHECK: sqrtsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0xac,0xcb,0xef,0xbe,0xad,0xde] + sqrtsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: sqrtsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0x2d,0x45,0x00,0x00,0x00] + sqrtsd 0x45,%xmm5 + +// CHECK: sqrtsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0x2d,0xed,0x7e,0x00,0x00] + sqrtsd 0x7eed,%xmm5 + +// CHECK: sqrtsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0x2d,0xfe,0xca,0xbe,0xba] + sqrtsd 0xbabecafe,%xmm5 + +// CHECK: sqrtsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0x2d,0x78,0x56,0x34,0x12] + sqrtsd 0x12345678,%xmm5 + +// CHECK: sqrtsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x51,0xed] + sqrtsd %xmm5,%xmm5 + +// CHECK: subpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0xac,0xcb,0xef,0xbe,0xad,0xde] + subpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: subpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0x2d,0x45,0x00,0x00,0x00] + subpd 0x45,%xmm5 + +// CHECK: subpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0x2d,0xed,0x7e,0x00,0x00] + subpd 0x7eed,%xmm5 + +// CHECK: subpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0x2d,0xfe,0xca,0xbe,0xba] + subpd 0xbabecafe,%xmm5 + +// CHECK: subpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0x2d,0x78,0x56,0x34,0x12] + subpd 0x12345678,%xmm5 + +// CHECK: subpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5c,0xed] + subpd %xmm5,%xmm5 + +// CHECK: subsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0xac,0xcb,0xef,0xbe,0xad,0xde] + subsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: subsd 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0x2d,0x45,0x00,0x00,0x00] + subsd 0x45,%xmm5 + +// CHECK: subsd 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0x2d,0xed,0x7e,0x00,0x00] + subsd 0x7eed,%xmm5 + +// CHECK: subsd 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0x2d,0xfe,0xca,0xbe,0xba] + subsd 0xbabecafe,%xmm5 + +// CHECK: subsd 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0x2d,0x78,0x56,0x34,0x12] + subsd 0x12345678,%xmm5 + +// CHECK: subsd %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5c,0xed] + subsd %xmm5,%xmm5 + +// CHECK: ucomisd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0xac,0xcb,0xef,0xbe,0xad,0xde] + ucomisd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: ucomisd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0x2d,0x45,0x00,0x00,0x00] + ucomisd 0x45,%xmm5 + +// CHECK: ucomisd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0x2d,0xed,0x7e,0x00,0x00] + ucomisd 0x7eed,%xmm5 + +// CHECK: ucomisd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0x2d,0xfe,0xca,0xbe,0xba] + ucomisd 0xbabecafe,%xmm5 + +// CHECK: ucomisd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0x2d,0x78,0x56,0x34,0x12] + ucomisd 0x12345678,%xmm5 + +// CHECK: ucomisd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x2e,0xed] + ucomisd %xmm5,%xmm5 + +// CHECK: unpckhpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0xac,0xcb,0xef,0xbe,0xad,0xde] + unpckhpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: unpckhpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0x2d,0x45,0x00,0x00,0x00] + unpckhpd 0x45,%xmm5 + +// CHECK: unpckhpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0x2d,0xed,0x7e,0x00,0x00] + unpckhpd 0x7eed,%xmm5 + +// CHECK: unpckhpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0x2d,0xfe,0xca,0xbe,0xba] + unpckhpd 0xbabecafe,%xmm5 + +// CHECK: unpckhpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0x2d,0x78,0x56,0x34,0x12] + unpckhpd 0x12345678,%xmm5 + +// CHECK: unpckhpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x15,0xed] + unpckhpd %xmm5,%xmm5 + +// CHECK: unpcklpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0xac,0xcb,0xef,0xbe,0xad,0xde] + unpcklpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: unpcklpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0x2d,0x45,0x00,0x00,0x00] + unpcklpd 0x45,%xmm5 + +// CHECK: unpcklpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0x2d,0xed,0x7e,0x00,0x00] + unpcklpd 0x7eed,%xmm5 + +// CHECK: unpcklpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0x2d,0xfe,0xca,0xbe,0xba] + unpcklpd 0xbabecafe,%xmm5 + +// CHECK: unpcklpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0x2d,0x78,0x56,0x34,0x12] + unpcklpd 0x12345678,%xmm5 + +// CHECK: unpcklpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x14,0xed] + unpcklpd %xmm5,%xmm5 + +// CHECK: xorpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0xac,0xcb,0xef,0xbe,0xad,0xde] + xorpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: xorpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0x2d,0x45,0x00,0x00,0x00] + xorpd 0x45,%xmm5 + +// CHECK: xorpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0x2d,0xed,0x7e,0x00,0x00] + xorpd 0x7eed,%xmm5 + +// CHECK: xorpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0x2d,0xfe,0xca,0xbe,0xba] + xorpd 0xbabecafe,%xmm5 + +// CHECK: xorpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0x2d,0x78,0x56,0x34,0x12] + xorpd 0x12345678,%xmm5 + +// CHECK: xorpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x57,0xed] + xorpd %xmm5,%xmm5 + +// CHECK: cvtdq2pd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtdq2pd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtdq2pd 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0x2d,0x45,0x00,0x00,0x00] + cvtdq2pd 0x45,%xmm5 + +// CHECK: cvtdq2pd 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0x2d,0xed,0x7e,0x00,0x00] + cvtdq2pd 0x7eed,%xmm5 + +// CHECK: cvtdq2pd 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0x2d,0xfe,0xca,0xbe,0xba] + cvtdq2pd 0xbabecafe,%xmm5 + +// CHECK: cvtdq2pd 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0x2d,0x78,0x56,0x34,0x12] + cvtdq2pd 0x12345678,%xmm5 + +// CHECK: cvtdq2pd %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xe6,0xed] + cvtdq2pd %xmm5,%xmm5 + +// CHECK: cvtpd2dq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtpd2dq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtpd2dq 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0x2d,0x45,0x00,0x00,0x00] + cvtpd2dq 0x45,%xmm5 + +// CHECK: cvtpd2dq 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0x2d,0xed,0x7e,0x00,0x00] + cvtpd2dq 0x7eed,%xmm5 + +// CHECK: cvtpd2dq 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0x2d,0xfe,0xca,0xbe,0xba] + cvtpd2dq 0xbabecafe,%xmm5 + +// CHECK: cvtpd2dq 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0x2d,0x78,0x56,0x34,0x12] + cvtpd2dq 0x12345678,%xmm5 + +// CHECK: cvtpd2dq %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xe6,0xed] + cvtpd2dq %xmm5,%xmm5 + +// CHECK: cvtdq2ps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5b,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtdq2ps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtdq2ps 69, %xmm5 +// CHECK: encoding: [0x0f,0x5b,0x2d,0x45,0x00,0x00,0x00] + cvtdq2ps 0x45,%xmm5 + +// CHECK: cvtdq2ps 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5b,0x2d,0xed,0x7e,0x00,0x00] + cvtdq2ps 0x7eed,%xmm5 + +// CHECK: cvtdq2ps 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5b,0x2d,0xfe,0xca,0xbe,0xba] + cvtdq2ps 0xbabecafe,%xmm5 + +// CHECK: cvtdq2ps 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5b,0x2d,0x78,0x56,0x34,0x12] + cvtdq2ps 0x12345678,%xmm5 + +// CHECK: cvtdq2ps %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5b,0xed] + cvtdq2ps %xmm5,%xmm5 + +// CHECK: cvtpd2pi 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0x9c,0xcb,0xef,0xbe,0xad,0xde] + cvtpd2pi 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: cvtpd2pi 69, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0x1d,0x45,0x00,0x00,0x00] + cvtpd2pi 0x45,%mm3 + +// CHECK: cvtpd2pi 32493, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0x1d,0xed,0x7e,0x00,0x00] + cvtpd2pi 0x7eed,%mm3 + +// CHECK: cvtpd2pi 3133065982, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0x1d,0xfe,0xca,0xbe,0xba] + cvtpd2pi 0xbabecafe,%mm3 + +// CHECK: cvtpd2pi 305419896, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0x1d,0x78,0x56,0x34,0x12] + cvtpd2pi 0x12345678,%mm3 + +// CHECK: cvtpd2pi %xmm5, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2d,0xdd] + cvtpd2pi %xmm5,%mm3 + +// CHECK: cvtpd2ps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtpd2ps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtpd2ps 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0x2d,0x45,0x00,0x00,0x00] + cvtpd2ps 0x45,%xmm5 + +// CHECK: cvtpd2ps 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0x2d,0xed,0x7e,0x00,0x00] + cvtpd2ps 0x7eed,%xmm5 + +// CHECK: cvtpd2ps 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0x2d,0xfe,0xca,0xbe,0xba] + cvtpd2ps 0xbabecafe,%xmm5 + +// CHECK: cvtpd2ps 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0x2d,0x78,0x56,0x34,0x12] + cvtpd2ps 0x12345678,%xmm5 + +// CHECK: cvtpd2ps %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5a,0xed] + cvtpd2ps %xmm5,%xmm5 + +// CHECK: cvtps2pd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x0f,0x5a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtps2pd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtps2pd 69, %xmm5 +// CHECK: encoding: [0x0f,0x5a,0x2d,0x45,0x00,0x00,0x00] + cvtps2pd 0x45,%xmm5 + +// CHECK: cvtps2pd 32493, %xmm5 +// CHECK: encoding: [0x0f,0x5a,0x2d,0xed,0x7e,0x00,0x00] + cvtps2pd 0x7eed,%xmm5 + +// CHECK: cvtps2pd 3133065982, %xmm5 +// CHECK: encoding: [0x0f,0x5a,0x2d,0xfe,0xca,0xbe,0xba] + cvtps2pd 0xbabecafe,%xmm5 + +// CHECK: cvtps2pd 305419896, %xmm5 +// CHECK: encoding: [0x0f,0x5a,0x2d,0x78,0x56,0x34,0x12] + cvtps2pd 0x12345678,%xmm5 + +// CHECK: cvtps2pd %xmm5, %xmm5 +// CHECK: encoding: [0x0f,0x5a,0xed] + cvtps2pd %xmm5,%xmm5 + +// CHECK: cvtps2dq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtps2dq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtps2dq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0x2d,0x45,0x00,0x00,0x00] + cvtps2dq 0x45,%xmm5 + +// CHECK: cvtps2dq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0x2d,0xed,0x7e,0x00,0x00] + cvtps2dq 0x7eed,%xmm5 + +// CHECK: cvtps2dq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0x2d,0xfe,0xca,0xbe,0xba] + cvtps2dq 0xbabecafe,%xmm5 + +// CHECK: cvtps2dq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0x2d,0x78,0x56,0x34,0x12] + cvtps2dq 0x12345678,%xmm5 + +// CHECK: cvtps2dq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x5b,0xed] + cvtps2dq %xmm5,%xmm5 + +// CHECK: cvtsd2ss 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtsd2ss 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtsd2ss 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0x2d,0x45,0x00,0x00,0x00] + cvtsd2ss 0x45,%xmm5 + +// CHECK: cvtsd2ss 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0x2d,0xed,0x7e,0x00,0x00] + cvtsd2ss 0x7eed,%xmm5 + +// CHECK: cvtsd2ss 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0x2d,0xfe,0xca,0xbe,0xba] + cvtsd2ss 0xbabecafe,%xmm5 + +// CHECK: cvtsd2ss 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0x2d,0x78,0x56,0x34,0x12] + cvtsd2ss 0x12345678,%xmm5 + +// CHECK: cvtsd2ss %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x5a,0xed] + cvtsd2ss %xmm5,%xmm5 + +// CHECK: cvtss2sd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvtss2sd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvtss2sd 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0x2d,0x45,0x00,0x00,0x00] + cvtss2sd 0x45,%xmm5 + +// CHECK: cvtss2sd 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0x2d,0xed,0x7e,0x00,0x00] + cvtss2sd 0x7eed,%xmm5 + +// CHECK: cvtss2sd 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0x2d,0xfe,0xca,0xbe,0xba] + cvtss2sd 0xbabecafe,%xmm5 + +// CHECK: cvtss2sd 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0x2d,0x78,0x56,0x34,0x12] + cvtss2sd 0x12345678,%xmm5 + +// CHECK: cvtss2sd %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5a,0xed] + cvtss2sd %xmm5,%xmm5 + +// CHECK: cvttpd2pi 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0x9c,0xcb,0xef,0xbe,0xad,0xde] + cvttpd2pi 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: cvttpd2pi 69, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0x1d,0x45,0x00,0x00,0x00] + cvttpd2pi 0x45,%mm3 + +// CHECK: cvttpd2pi 32493, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0x1d,0xed,0x7e,0x00,0x00] + cvttpd2pi 0x7eed,%mm3 + +// CHECK: cvttpd2pi 3133065982, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0x1d,0xfe,0xca,0xbe,0xba] + cvttpd2pi 0xbabecafe,%mm3 + +// CHECK: cvttpd2pi 305419896, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0x1d,0x78,0x56,0x34,0x12] + cvttpd2pi 0x12345678,%mm3 + +// CHECK: cvttpd2pi %xmm5, %mm3 +// CHECK: encoding: [0x66,0x0f,0x2c,0xdd] + cvttpd2pi %xmm5,%mm3 + +// CHECK: cvttsd2si 3735928559(%ebx,%ecx,8), %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0x8c,0xcb,0xef,0xbe,0xad,0xde] + cvttsd2si 0xdeadbeef(%ebx,%ecx,8),%ecx + +// CHECK: cvttsd2si 69, %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0x0d,0x45,0x00,0x00,0x00] + cvttsd2si 0x45,%ecx + +// CHECK: cvttsd2si 32493, %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0x0d,0xed,0x7e,0x00,0x00] + cvttsd2si 0x7eed,%ecx + +// CHECK: cvttsd2si 3133065982, %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0x0d,0xfe,0xca,0xbe,0xba] + cvttsd2si 0xbabecafe,%ecx + +// CHECK: cvttsd2si 305419896, %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0x0d,0x78,0x56,0x34,0x12] + cvttsd2si 0x12345678,%ecx + +// CHECK: cvttsd2si %xmm5, %ecx +// CHECK: encoding: [0xf2,0x0f,0x2c,0xcd] + cvttsd2si %xmm5,%ecx + +// CHECK: cvttps2dq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0xac,0xcb,0xef,0xbe,0xad,0xde] + cvttps2dq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: cvttps2dq 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0x2d,0x45,0x00,0x00,0x00] + cvttps2dq 0x45,%xmm5 + +// CHECK: cvttps2dq 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0x2d,0xed,0x7e,0x00,0x00] + cvttps2dq 0x7eed,%xmm5 + +// CHECK: cvttps2dq 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0x2d,0xfe,0xca,0xbe,0xba] + cvttps2dq 0xbabecafe,%xmm5 + +// CHECK: cvttps2dq 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0x2d,0x78,0x56,0x34,0x12] + cvttps2dq 0x12345678,%xmm5 + +// CHECK: cvttps2dq %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x5b,0xed] + cvttps2dq %xmm5,%xmm5 + +// CHECK: maskmovdqu %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf7,0xed] + maskmovdqu %xmm5,%xmm5 + +// CHECK: movdqa 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0xac,0xcb,0xef,0xbe,0xad,0xde] + movdqa 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movdqa 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0x2d,0x45,0x00,0x00,0x00] + movdqa 0x45,%xmm5 + +// CHECK: movdqa 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0x2d,0xed,0x7e,0x00,0x00] + movdqa 0x7eed,%xmm5 + +// CHECK: movdqa 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0x2d,0xfe,0xca,0xbe,0xba] + movdqa 0xbabecafe,%xmm5 + +// CHECK: movdqa 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0x2d,0x78,0x56,0x34,0x12] + movdqa 0x12345678,%xmm5 + +// CHECK: movdqa %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0xed] + movdqa %xmm5,%xmm5 + +// CHECK: movdqa %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0x7f,0xac,0xcb,0xef,0xbe,0xad,0xde] + movdqa %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movdqa %xmm5, 69 +// CHECK: encoding: [0x66,0x0f,0x7f,0x2d,0x45,0x00,0x00,0x00] + movdqa %xmm5,0x45 + +// CHECK: movdqa %xmm5, 32493 +// CHECK: encoding: [0x66,0x0f,0x7f,0x2d,0xed,0x7e,0x00,0x00] + movdqa %xmm5,0x7eed + +// CHECK: movdqa %xmm5, 3133065982 +// CHECK: encoding: [0x66,0x0f,0x7f,0x2d,0xfe,0xca,0xbe,0xba] + movdqa %xmm5,0xbabecafe + +// CHECK: movdqa %xmm5, 305419896 +// CHECK: encoding: [0x66,0x0f,0x7f,0x2d,0x78,0x56,0x34,0x12] + movdqa %xmm5,0x12345678 + +// CHECK: movdqa %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6f,0xed] + movdqa %xmm5,%xmm5 + +// CHECK: movdqu 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x6f,0xac,0xcb,0xef,0xbe,0xad,0xde] + movdqu 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movdqu 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x6f,0x2d,0x45,0x00,0x00,0x00] + movdqu 0x45,%xmm5 + +// CHECK: movdqu 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x6f,0x2d,0xed,0x7e,0x00,0x00] + movdqu 0x7eed,%xmm5 + +// CHECK: movdqu 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x6f,0x2d,0xfe,0xca,0xbe,0xba] + movdqu 0xbabecafe,%xmm5 + +// CHECK: movdqu 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x6f,0x2d,0x78,0x56,0x34,0x12] + movdqu 0x12345678,%xmm5 + +// CHECK: movdqu %xmm5, 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xf3,0x0f,0x7f,0xac,0xcb,0xef,0xbe,0xad,0xde] + movdqu %xmm5,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: movdqu %xmm5, 69 +// CHECK: encoding: [0xf3,0x0f,0x7f,0x2d,0x45,0x00,0x00,0x00] + movdqu %xmm5,0x45 + +// CHECK: movdqu %xmm5, 32493 +// CHECK: encoding: [0xf3,0x0f,0x7f,0x2d,0xed,0x7e,0x00,0x00] + movdqu %xmm5,0x7eed + +// CHECK: movdqu %xmm5, 3133065982 +// CHECK: encoding: [0xf3,0x0f,0x7f,0x2d,0xfe,0xca,0xbe,0xba] + movdqu %xmm5,0xbabecafe + +// CHECK: movdqu %xmm5, 305419896 +// CHECK: encoding: [0xf3,0x0f,0x7f,0x2d,0x78,0x56,0x34,0x12] + movdqu %xmm5,0x12345678 + +// CHECK: movdq2q %xmm5, %mm3 +// CHECK: encoding: [0xf2,0x0f,0xd6,0xdd] + movdq2q %xmm5,%mm3 + +// CHECK: movq2dq %mm3, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0xd6,0xeb] + movq2dq %mm3,%xmm5 + +// CHECK: pmuludq 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0xf4,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmuludq 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmuludq 69, %mm3 +// CHECK: encoding: [0x0f,0xf4,0x1d,0x45,0x00,0x00,0x00] + pmuludq 0x45,%mm3 + +// CHECK: pmuludq 32493, %mm3 +// CHECK: encoding: [0x0f,0xf4,0x1d,0xed,0x7e,0x00,0x00] + pmuludq 0x7eed,%mm3 + +// CHECK: pmuludq 3133065982, %mm3 +// CHECK: encoding: [0x0f,0xf4,0x1d,0xfe,0xca,0xbe,0xba] + pmuludq 0xbabecafe,%mm3 + +// CHECK: pmuludq 305419896, %mm3 +// CHECK: encoding: [0x0f,0xf4,0x1d,0x78,0x56,0x34,0x12] + pmuludq 0x12345678,%mm3 + +// CHECK: pmuludq %mm3, %mm3 +// CHECK: encoding: [0x0f,0xf4,0xdb] + pmuludq %mm3,%mm3 + +// CHECK: pmuludq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmuludq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmuludq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0x2d,0x45,0x00,0x00,0x00] + pmuludq 0x45,%xmm5 + +// CHECK: pmuludq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0x2d,0xed,0x7e,0x00,0x00] + pmuludq 0x7eed,%xmm5 + +// CHECK: pmuludq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0x2d,0xfe,0xca,0xbe,0xba] + pmuludq 0xbabecafe,%xmm5 + +// CHECK: pmuludq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0x2d,0x78,0x56,0x34,0x12] + pmuludq 0x12345678,%xmm5 + +// CHECK: pmuludq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xf4,0xed] + pmuludq %xmm5,%xmm5 + +// CHECK: pslldq $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x73,0xfd,0x7f] + pslldq $0x7f,%xmm5 + +// CHECK: psrldq $127, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x73,0xdd,0x7f] + psrldq $0x7f,%xmm5 + +// CHECK: punpckhqdq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpckhqdq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpckhqdq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0x2d,0x45,0x00,0x00,0x00] + punpckhqdq 0x45,%xmm5 + +// CHECK: punpckhqdq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0x2d,0xed,0x7e,0x00,0x00] + punpckhqdq 0x7eed,%xmm5 + +// CHECK: punpckhqdq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0x2d,0xfe,0xca,0xbe,0xba] + punpckhqdq 0xbabecafe,%xmm5 + +// CHECK: punpckhqdq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0x2d,0x78,0x56,0x34,0x12] + punpckhqdq 0x12345678,%xmm5 + +// CHECK: punpckhqdq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6d,0xed] + punpckhqdq %xmm5,%xmm5 + +// CHECK: punpcklqdq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0xac,0xcb,0xef,0xbe,0xad,0xde] + punpcklqdq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: punpcklqdq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0x2d,0x45,0x00,0x00,0x00] + punpcklqdq 0x45,%xmm5 + +// CHECK: punpcklqdq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0x2d,0xed,0x7e,0x00,0x00] + punpcklqdq 0x7eed,%xmm5 + +// CHECK: punpcklqdq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0x2d,0xfe,0xca,0xbe,0xba] + punpcklqdq 0xbabecafe,%xmm5 + +// CHECK: punpcklqdq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0x2d,0x78,0x56,0x34,0x12] + punpcklqdq 0x12345678,%xmm5 + +// CHECK: punpcklqdq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x6c,0xed] + punpcklqdq %xmm5,%xmm5 + +// CHECK: addsubpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0xac,0xcb,0xef,0xbe,0xad,0xde] + addsubpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addsubpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0x2d,0x45,0x00,0x00,0x00] + addsubpd 0x45,%xmm5 + +// CHECK: addsubpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0x2d,0xed,0x7e,0x00,0x00] + addsubpd 0x7eed,%xmm5 + +// CHECK: addsubpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0x2d,0xfe,0xca,0xbe,0xba] + addsubpd 0xbabecafe,%xmm5 + +// CHECK: addsubpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0x2d,0x78,0x56,0x34,0x12] + addsubpd 0x12345678,%xmm5 + +// CHECK: addsubpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0xd0,0xed] + addsubpd %xmm5,%xmm5 + +// CHECK: addsubps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0xac,0xcb,0xef,0xbe,0xad,0xde] + addsubps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: addsubps 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0x2d,0x45,0x00,0x00,0x00] + addsubps 0x45,%xmm5 + +// CHECK: addsubps 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0x2d,0xed,0x7e,0x00,0x00] + addsubps 0x7eed,%xmm5 + +// CHECK: addsubps 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0x2d,0xfe,0xca,0xbe,0xba] + addsubps 0xbabecafe,%xmm5 + +// CHECK: addsubps 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0x2d,0x78,0x56,0x34,0x12] + addsubps 0x12345678,%xmm5 + +// CHECK: addsubps %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xd0,0xed] + addsubps %xmm5,%xmm5 + +// CHECK: fisttpl 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0xdb,0x8c,0xcb,0xef,0xbe,0xad,0xde] + fisttpl 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: fisttpl 3133065982 +// CHECK: encoding: [0xdb,0x0d,0xfe,0xca,0xbe,0xba] + fisttpl 0xbabecafe + +// CHECK: fisttpl 305419896 +// CHECK: encoding: [0xdb,0x0d,0x78,0x56,0x34,0x12] + fisttpl 0x12345678 + +// CHECK: haddpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0xac,0xcb,0xef,0xbe,0xad,0xde] + haddpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: haddpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0x2d,0x45,0x00,0x00,0x00] + haddpd 0x45,%xmm5 + +// CHECK: haddpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0x2d,0xed,0x7e,0x00,0x00] + haddpd 0x7eed,%xmm5 + +// CHECK: haddpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0x2d,0xfe,0xca,0xbe,0xba] + haddpd 0xbabecafe,%xmm5 + +// CHECK: haddpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0x2d,0x78,0x56,0x34,0x12] + haddpd 0x12345678,%xmm5 + +// CHECK: haddpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7c,0xed] + haddpd %xmm5,%xmm5 + +// CHECK: haddps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0xac,0xcb,0xef,0xbe,0xad,0xde] + haddps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: haddps 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0x2d,0x45,0x00,0x00,0x00] + haddps 0x45,%xmm5 + +// CHECK: haddps 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0x2d,0xed,0x7e,0x00,0x00] + haddps 0x7eed,%xmm5 + +// CHECK: haddps 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0x2d,0xfe,0xca,0xbe,0xba] + haddps 0xbabecafe,%xmm5 + +// CHECK: haddps 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0x2d,0x78,0x56,0x34,0x12] + haddps 0x12345678,%xmm5 + +// CHECK: haddps %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7c,0xed] + haddps %xmm5,%xmm5 + +// CHECK: hsubpd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0xac,0xcb,0xef,0xbe,0xad,0xde] + hsubpd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: hsubpd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0x2d,0x45,0x00,0x00,0x00] + hsubpd 0x45,%xmm5 + +// CHECK: hsubpd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0x2d,0xed,0x7e,0x00,0x00] + hsubpd 0x7eed,%xmm5 + +// CHECK: hsubpd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0x2d,0xfe,0xca,0xbe,0xba] + hsubpd 0xbabecafe,%xmm5 + +// CHECK: hsubpd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0x2d,0x78,0x56,0x34,0x12] + hsubpd 0x12345678,%xmm5 + +// CHECK: hsubpd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x7d,0xed] + hsubpd %xmm5,%xmm5 + +// CHECK: hsubps 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0xac,0xcb,0xef,0xbe,0xad,0xde] + hsubps 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: hsubps 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0x2d,0x45,0x00,0x00,0x00] + hsubps 0x45,%xmm5 + +// CHECK: hsubps 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0x2d,0xed,0x7e,0x00,0x00] + hsubps 0x7eed,%xmm5 + +// CHECK: hsubps 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0x2d,0xfe,0xca,0xbe,0xba] + hsubps 0xbabecafe,%xmm5 + +// CHECK: hsubps 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0x2d,0x78,0x56,0x34,0x12] + hsubps 0x12345678,%xmm5 + +// CHECK: hsubps %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x7d,0xed] + hsubps %xmm5,%xmm5 + +// CHECK: lddqu 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xf0,0xac,0xcb,0xef,0xbe,0xad,0xde] + lddqu 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: lddqu 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xf0,0x2d,0x45,0x00,0x00,0x00] + lddqu 0x45,%xmm5 + +// CHECK: lddqu 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xf0,0x2d,0xed,0x7e,0x00,0x00] + lddqu 0x7eed,%xmm5 + +// CHECK: lddqu 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xf0,0x2d,0xfe,0xca,0xbe,0xba] + lddqu 0xbabecafe,%xmm5 + +// CHECK: lddqu 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0xf0,0x2d,0x78,0x56,0x34,0x12] + lddqu 0x12345678,%xmm5 + +// CHECK: movddup 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0xac,0xcb,0xef,0xbe,0xad,0xde] + movddup 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movddup 69, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0x2d,0x45,0x00,0x00,0x00] + movddup 0x45,%xmm5 + +// CHECK: movddup 32493, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0x2d,0xed,0x7e,0x00,0x00] + movddup 0x7eed,%xmm5 + +// CHECK: movddup 3133065982, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0x2d,0xfe,0xca,0xbe,0xba] + movddup 0xbabecafe,%xmm5 + +// CHECK: movddup 305419896, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0x2d,0x78,0x56,0x34,0x12] + movddup 0x12345678,%xmm5 + +// CHECK: movddup %xmm5, %xmm5 +// CHECK: encoding: [0xf2,0x0f,0x12,0xed] + movddup %xmm5,%xmm5 + +// CHECK: movshdup 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0xac,0xcb,0xef,0xbe,0xad,0xde] + movshdup 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movshdup 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0x2d,0x45,0x00,0x00,0x00] + movshdup 0x45,%xmm5 + +// CHECK: movshdup 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0x2d,0xed,0x7e,0x00,0x00] + movshdup 0x7eed,%xmm5 + +// CHECK: movshdup 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0x2d,0xfe,0xca,0xbe,0xba] + movshdup 0xbabecafe,%xmm5 + +// CHECK: movshdup 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0x2d,0x78,0x56,0x34,0x12] + movshdup 0x12345678,%xmm5 + +// CHECK: movshdup %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x16,0xed] + movshdup %xmm5,%xmm5 + +// CHECK: movsldup 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0xac,0xcb,0xef,0xbe,0xad,0xde] + movsldup 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movsldup 69, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0x2d,0x45,0x00,0x00,0x00] + movsldup 0x45,%xmm5 + +// CHECK: movsldup 32493, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0x2d,0xed,0x7e,0x00,0x00] + movsldup 0x7eed,%xmm5 + +// CHECK: movsldup 3133065982, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0x2d,0xfe,0xca,0xbe,0xba] + movsldup 0xbabecafe,%xmm5 + +// CHECK: movsldup 305419896, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0x2d,0x78,0x56,0x34,0x12] + movsldup 0x12345678,%xmm5 + +// CHECK: movsldup %xmm5, %xmm5 +// CHECK: encoding: [0xf3,0x0f,0x12,0xed] + movsldup %xmm5,%xmm5 + +// CHECK: vmclear 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x66,0x0f,0xc7,0xb4,0xcb,0xef,0xbe,0xad,0xde] + vmclear 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: vmclear 32493 +// CHECK: encoding: [0x66,0x0f,0xc7,0x35,0xed,0x7e,0x00,0x00] + vmclear 0x7eed + +// CHECK: vmclear 3133065982 +// CHECK: encoding: [0x66,0x0f,0xc7,0x35,0xfe,0xca,0xbe,0xba] + vmclear 0xbabecafe + +// CHECK: vmclear 305419896 +// CHECK: encoding: [0x66,0x0f,0xc7,0x35,0x78,0x56,0x34,0x12] + vmclear 0x12345678 + +// CHECK: vmptrld 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xc7,0xb4,0xcb,0xef,0xbe,0xad,0xde] + vmptrld 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: vmptrld 32493 +// CHECK: encoding: [0x0f,0xc7,0x35,0xed,0x7e,0x00,0x00] + vmptrld 0x7eed + +// CHECK: vmptrld 3133065982 +// CHECK: encoding: [0x0f,0xc7,0x35,0xfe,0xca,0xbe,0xba] + vmptrld 0xbabecafe + +// CHECK: vmptrld 305419896 +// CHECK: encoding: [0x0f,0xc7,0x35,0x78,0x56,0x34,0x12] + vmptrld 0x12345678 + +// CHECK: vmptrst 3735928559(%ebx,%ecx,8) +// CHECK: encoding: [0x0f,0xc7,0xbc,0xcb,0xef,0xbe,0xad,0xde] + vmptrst 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: vmptrst 32493 +// CHECK: encoding: [0x0f,0xc7,0x3d,0xed,0x7e,0x00,0x00] + vmptrst 0x7eed + +// CHECK: vmptrst 3133065982 +// CHECK: encoding: [0x0f,0xc7,0x3d,0xfe,0xca,0xbe,0xba] + vmptrst 0xbabecafe + +// CHECK: vmptrst 305419896 +// CHECK: encoding: [0x0f,0xc7,0x3d,0x78,0x56,0x34,0x12] + vmptrst 0x12345678 + +// CHECK: phaddw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phaddw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phaddw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0x1d,0x45,0x00,0x00,0x00] + phaddw 0x45,%mm3 + +// CHECK: phaddw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0x1d,0xed,0x7e,0x00,0x00] + phaddw 0x7eed,%mm3 + +// CHECK: phaddw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0x1d,0xfe,0xca,0xbe,0xba] + phaddw 0xbabecafe,%mm3 + +// CHECK: phaddw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0x1d,0x78,0x56,0x34,0x12] + phaddw 0x12345678,%mm3 + +// CHECK: phaddw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x01,0xdb] + phaddw %mm3,%mm3 + +// CHECK: phaddw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0xac,0xcb,0xef,0xbe,0xad,0xde] + phaddw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phaddw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0x2d,0x45,0x00,0x00,0x00] + phaddw 0x45,%xmm5 + +// CHECK: phaddw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0x2d,0xed,0x7e,0x00,0x00] + phaddw 0x7eed,%xmm5 + +// CHECK: phaddw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0x2d,0xfe,0xca,0xbe,0xba] + phaddw 0xbabecafe,%xmm5 + +// CHECK: phaddw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0x2d,0x78,0x56,0x34,0x12] + phaddw 0x12345678,%xmm5 + +// CHECK: phaddw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x01,0xed] + phaddw %xmm5,%xmm5 + +// CHECK: phaddd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phaddd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phaddd 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0x1d,0x45,0x00,0x00,0x00] + phaddd 0x45,%mm3 + +// CHECK: phaddd 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0x1d,0xed,0x7e,0x00,0x00] + phaddd 0x7eed,%mm3 + +// CHECK: phaddd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0x1d,0xfe,0xca,0xbe,0xba] + phaddd 0xbabecafe,%mm3 + +// CHECK: phaddd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0x1d,0x78,0x56,0x34,0x12] + phaddd 0x12345678,%mm3 + +// CHECK: phaddd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x02,0xdb] + phaddd %mm3,%mm3 + +// CHECK: phaddd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0xac,0xcb,0xef,0xbe,0xad,0xde] + phaddd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phaddd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0x2d,0x45,0x00,0x00,0x00] + phaddd 0x45,%xmm5 + +// CHECK: phaddd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0x2d,0xed,0x7e,0x00,0x00] + phaddd 0x7eed,%xmm5 + +// CHECK: phaddd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0x2d,0xfe,0xca,0xbe,0xba] + phaddd 0xbabecafe,%xmm5 + +// CHECK: phaddd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0x2d,0x78,0x56,0x34,0x12] + phaddd 0x12345678,%xmm5 + +// CHECK: phaddd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x02,0xed] + phaddd %xmm5,%xmm5 + +// CHECK: phaddsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phaddsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phaddsw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0x1d,0x45,0x00,0x00,0x00] + phaddsw 0x45,%mm3 + +// CHECK: phaddsw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0x1d,0xed,0x7e,0x00,0x00] + phaddsw 0x7eed,%mm3 + +// CHECK: phaddsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0x1d,0xfe,0xca,0xbe,0xba] + phaddsw 0xbabecafe,%mm3 + +// CHECK: phaddsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0x1d,0x78,0x56,0x34,0x12] + phaddsw 0x12345678,%mm3 + +// CHECK: phaddsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x03,0xdb] + phaddsw %mm3,%mm3 + +// CHECK: phaddsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0xac,0xcb,0xef,0xbe,0xad,0xde] + phaddsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phaddsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0x2d,0x45,0x00,0x00,0x00] + phaddsw 0x45,%xmm5 + +// CHECK: phaddsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0x2d,0xed,0x7e,0x00,0x00] + phaddsw 0x7eed,%xmm5 + +// CHECK: phaddsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0x2d,0xfe,0xca,0xbe,0xba] + phaddsw 0xbabecafe,%xmm5 + +// CHECK: phaddsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0x2d,0x78,0x56,0x34,0x12] + phaddsw 0x12345678,%xmm5 + +// CHECK: phaddsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x03,0xed] + phaddsw %xmm5,%xmm5 + +// CHECK: phsubw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phsubw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phsubw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0x1d,0x45,0x00,0x00,0x00] + phsubw 0x45,%mm3 + +// CHECK: phsubw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0x1d,0xed,0x7e,0x00,0x00] + phsubw 0x7eed,%mm3 + +// CHECK: phsubw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0x1d,0xfe,0xca,0xbe,0xba] + phsubw 0xbabecafe,%mm3 + +// CHECK: phsubw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0x1d,0x78,0x56,0x34,0x12] + phsubw 0x12345678,%mm3 + +// CHECK: phsubw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x05,0xdb] + phsubw %mm3,%mm3 + +// CHECK: phsubw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0xac,0xcb,0xef,0xbe,0xad,0xde] + phsubw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phsubw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0x2d,0x45,0x00,0x00,0x00] + phsubw 0x45,%xmm5 + +// CHECK: phsubw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0x2d,0xed,0x7e,0x00,0x00] + phsubw 0x7eed,%xmm5 + +// CHECK: phsubw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0x2d,0xfe,0xca,0xbe,0xba] + phsubw 0xbabecafe,%xmm5 + +// CHECK: phsubw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0x2d,0x78,0x56,0x34,0x12] + phsubw 0x12345678,%xmm5 + +// CHECK: phsubw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x05,0xed] + phsubw %xmm5,%xmm5 + +// CHECK: phsubd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phsubd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phsubd 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0x1d,0x45,0x00,0x00,0x00] + phsubd 0x45,%mm3 + +// CHECK: phsubd 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0x1d,0xed,0x7e,0x00,0x00] + phsubd 0x7eed,%mm3 + +// CHECK: phsubd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0x1d,0xfe,0xca,0xbe,0xba] + phsubd 0xbabecafe,%mm3 + +// CHECK: phsubd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0x1d,0x78,0x56,0x34,0x12] + phsubd 0x12345678,%mm3 + +// CHECK: phsubd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x06,0xdb] + phsubd %mm3,%mm3 + +// CHECK: phsubd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0xac,0xcb,0xef,0xbe,0xad,0xde] + phsubd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phsubd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0x2d,0x45,0x00,0x00,0x00] + phsubd 0x45,%xmm5 + +// CHECK: phsubd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0x2d,0xed,0x7e,0x00,0x00] + phsubd 0x7eed,%xmm5 + +// CHECK: phsubd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0x2d,0xfe,0xca,0xbe,0xba] + phsubd 0xbabecafe,%xmm5 + +// CHECK: phsubd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0x2d,0x78,0x56,0x34,0x12] + phsubd 0x12345678,%xmm5 + +// CHECK: phsubd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x06,0xed] + phsubd %xmm5,%xmm5 + +// CHECK: phsubsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0x9c,0xcb,0xef,0xbe,0xad,0xde] + phsubsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: phsubsw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0x1d,0x45,0x00,0x00,0x00] + phsubsw 0x45,%mm3 + +// CHECK: phsubsw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0x1d,0xed,0x7e,0x00,0x00] + phsubsw 0x7eed,%mm3 + +// CHECK: phsubsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0x1d,0xfe,0xca,0xbe,0xba] + phsubsw 0xbabecafe,%mm3 + +// CHECK: phsubsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0x1d,0x78,0x56,0x34,0x12] + phsubsw 0x12345678,%mm3 + +// CHECK: phsubsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x07,0xdb] + phsubsw %mm3,%mm3 + +// CHECK: phsubsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0xac,0xcb,0xef,0xbe,0xad,0xde] + phsubsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phsubsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0x2d,0x45,0x00,0x00,0x00] + phsubsw 0x45,%xmm5 + +// CHECK: phsubsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0x2d,0xed,0x7e,0x00,0x00] + phsubsw 0x7eed,%xmm5 + +// CHECK: phsubsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0x2d,0xfe,0xca,0xbe,0xba] + phsubsw 0xbabecafe,%xmm5 + +// CHECK: phsubsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0x2d,0x78,0x56,0x34,0x12] + phsubsw 0x12345678,%xmm5 + +// CHECK: phsubsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x07,0xed] + phsubsw %xmm5,%xmm5 + +// CHECK: pmaddubsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmaddubsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmaddubsw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0x1d,0x45,0x00,0x00,0x00] + pmaddubsw 0x45,%mm3 + +// CHECK: pmaddubsw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0x1d,0xed,0x7e,0x00,0x00] + pmaddubsw 0x7eed,%mm3 + +// CHECK: pmaddubsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0x1d,0xfe,0xca,0xbe,0xba] + pmaddubsw 0xbabecafe,%mm3 + +// CHECK: pmaddubsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0x1d,0x78,0x56,0x34,0x12] + pmaddubsw 0x12345678,%mm3 + +// CHECK: pmaddubsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x04,0xdb] + pmaddubsw %mm3,%mm3 + +// CHECK: pmaddubsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaddubsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaddubsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0x2d,0x45,0x00,0x00,0x00] + pmaddubsw 0x45,%xmm5 + +// CHECK: pmaddubsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0x2d,0xed,0x7e,0x00,0x00] + pmaddubsw 0x7eed,%xmm5 + +// CHECK: pmaddubsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0x2d,0xfe,0xca,0xbe,0xba] + pmaddubsw 0xbabecafe,%xmm5 + +// CHECK: pmaddubsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0x2d,0x78,0x56,0x34,0x12] + pmaddubsw 0x12345678,%xmm5 + +// CHECK: pmaddubsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x04,0xed] + pmaddubsw %xmm5,%xmm5 + +// CHECK: pmulhrsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pmulhrsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pmulhrsw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0x1d,0x45,0x00,0x00,0x00] + pmulhrsw 0x45,%mm3 + +// CHECK: pmulhrsw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0x1d,0xed,0x7e,0x00,0x00] + pmulhrsw 0x7eed,%mm3 + +// CHECK: pmulhrsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0x1d,0xfe,0xca,0xbe,0xba] + pmulhrsw 0xbabecafe,%mm3 + +// CHECK: pmulhrsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0x1d,0x78,0x56,0x34,0x12] + pmulhrsw 0x12345678,%mm3 + +// CHECK: pmulhrsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0b,0xdb] + pmulhrsw %mm3,%mm3 + +// CHECK: pmulhrsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmulhrsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmulhrsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0x2d,0x45,0x00,0x00,0x00] + pmulhrsw 0x45,%xmm5 + +// CHECK: pmulhrsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0x2d,0xed,0x7e,0x00,0x00] + pmulhrsw 0x7eed,%xmm5 + +// CHECK: pmulhrsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0x2d,0xfe,0xca,0xbe,0xba] + pmulhrsw 0xbabecafe,%xmm5 + +// CHECK: pmulhrsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0x2d,0x78,0x56,0x34,0x12] + pmulhrsw 0x12345678,%xmm5 + +// CHECK: pmulhrsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0b,0xed] + pmulhrsw %xmm5,%xmm5 + +// CHECK: pshufb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pshufb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pshufb 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0x1d,0x45,0x00,0x00,0x00] + pshufb 0x45,%mm3 + +// CHECK: pshufb 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0x1d,0xed,0x7e,0x00,0x00] + pshufb 0x7eed,%mm3 + +// CHECK: pshufb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0x1d,0xfe,0xca,0xbe,0xba] + pshufb 0xbabecafe,%mm3 + +// CHECK: pshufb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0x1d,0x78,0x56,0x34,0x12] + pshufb 0x12345678,%mm3 + +// CHECK: pshufb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x00,0xdb] + pshufb %mm3,%mm3 + +// CHECK: pshufb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0xac,0xcb,0xef,0xbe,0xad,0xde] + pshufb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pshufb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0x2d,0x45,0x00,0x00,0x00] + pshufb 0x45,%xmm5 + +// CHECK: pshufb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0x2d,0xed,0x7e,0x00,0x00] + pshufb 0x7eed,%xmm5 + +// CHECK: pshufb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0x2d,0xfe,0xca,0xbe,0xba] + pshufb 0xbabecafe,%xmm5 + +// CHECK: pshufb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0x2d,0x78,0x56,0x34,0x12] + pshufb 0x12345678,%xmm5 + +// CHECK: pshufb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x00,0xed] + pshufb %xmm5,%xmm5 + +// CHECK: psignb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psignb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psignb 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0x1d,0x45,0x00,0x00,0x00] + psignb 0x45,%mm3 + +// CHECK: psignb 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0x1d,0xed,0x7e,0x00,0x00] + psignb 0x7eed,%mm3 + +// CHECK: psignb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0x1d,0xfe,0xca,0xbe,0xba] + psignb 0xbabecafe,%mm3 + +// CHECK: psignb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0x1d,0x78,0x56,0x34,0x12] + psignb 0x12345678,%mm3 + +// CHECK: psignb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x08,0xdb] + psignb %mm3,%mm3 + +// CHECK: psignb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0xac,0xcb,0xef,0xbe,0xad,0xde] + psignb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psignb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0x2d,0x45,0x00,0x00,0x00] + psignb 0x45,%xmm5 + +// CHECK: psignb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0x2d,0xed,0x7e,0x00,0x00] + psignb 0x7eed,%xmm5 + +// CHECK: psignb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0x2d,0xfe,0xca,0xbe,0xba] + psignb 0xbabecafe,%xmm5 + +// CHECK: psignb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0x2d,0x78,0x56,0x34,0x12] + psignb 0x12345678,%xmm5 + +// CHECK: psignb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x08,0xed] + psignb %xmm5,%xmm5 + +// CHECK: psignw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psignw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psignw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0x1d,0x45,0x00,0x00,0x00] + psignw 0x45,%mm3 + +// CHECK: psignw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0x1d,0xed,0x7e,0x00,0x00] + psignw 0x7eed,%mm3 + +// CHECK: psignw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0x1d,0xfe,0xca,0xbe,0xba] + psignw 0xbabecafe,%mm3 + +// CHECK: psignw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0x1d,0x78,0x56,0x34,0x12] + psignw 0x12345678,%mm3 + +// CHECK: psignw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x09,0xdb] + psignw %mm3,%mm3 + +// CHECK: psignw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0xac,0xcb,0xef,0xbe,0xad,0xde] + psignw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psignw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0x2d,0x45,0x00,0x00,0x00] + psignw 0x45,%xmm5 + +// CHECK: psignw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0x2d,0xed,0x7e,0x00,0x00] + psignw 0x7eed,%xmm5 + +// CHECK: psignw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0x2d,0xfe,0xca,0xbe,0xba] + psignw 0xbabecafe,%xmm5 + +// CHECK: psignw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0x2d,0x78,0x56,0x34,0x12] + psignw 0x12345678,%xmm5 + +// CHECK: psignw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x09,0xed] + psignw %xmm5,%xmm5 + +// CHECK: psignd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0x9c,0xcb,0xef,0xbe,0xad,0xde] + psignd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: psignd 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0x1d,0x45,0x00,0x00,0x00] + psignd 0x45,%mm3 + +// CHECK: psignd 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0x1d,0xed,0x7e,0x00,0x00] + psignd 0x7eed,%mm3 + +// CHECK: psignd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0x1d,0xfe,0xca,0xbe,0xba] + psignd 0xbabecafe,%mm3 + +// CHECK: psignd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0x1d,0x78,0x56,0x34,0x12] + psignd 0x12345678,%mm3 + +// CHECK: psignd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x0a,0xdb] + psignd %mm3,%mm3 + +// CHECK: psignd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0xac,0xcb,0xef,0xbe,0xad,0xde] + psignd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: psignd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0x2d,0x45,0x00,0x00,0x00] + psignd 0x45,%xmm5 + +// CHECK: psignd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0x2d,0xed,0x7e,0x00,0x00] + psignd 0x7eed,%xmm5 + +// CHECK: psignd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0x2d,0xfe,0xca,0xbe,0xba] + psignd 0xbabecafe,%xmm5 + +// CHECK: psignd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0x2d,0x78,0x56,0x34,0x12] + psignd 0x12345678,%xmm5 + +// CHECK: psignd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x0a,0xed] + psignd %xmm5,%xmm5 + +// CHECK: pabsb 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pabsb 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pabsb 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0x1d,0x45,0x00,0x00,0x00] + pabsb 0x45,%mm3 + +// CHECK: pabsb 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0x1d,0xed,0x7e,0x00,0x00] + pabsb 0x7eed,%mm3 + +// CHECK: pabsb 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0x1d,0xfe,0xca,0xbe,0xba] + pabsb 0xbabecafe,%mm3 + +// CHECK: pabsb 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0x1d,0x78,0x56,0x34,0x12] + pabsb 0x12345678,%mm3 + +// CHECK: pabsb %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1c,0xdb] + pabsb %mm3,%mm3 + +// CHECK: pabsb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0xac,0xcb,0xef,0xbe,0xad,0xde] + pabsb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pabsb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0x2d,0x45,0x00,0x00,0x00] + pabsb 0x45,%xmm5 + +// CHECK: pabsb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0x2d,0xed,0x7e,0x00,0x00] + pabsb 0x7eed,%xmm5 + +// CHECK: pabsb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0x2d,0xfe,0xca,0xbe,0xba] + pabsb 0xbabecafe,%xmm5 + +// CHECK: pabsb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0x2d,0x78,0x56,0x34,0x12] + pabsb 0x12345678,%xmm5 + +// CHECK: pabsb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1c,0xed] + pabsb %xmm5,%xmm5 + +// CHECK: pabsw 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pabsw 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pabsw 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0x1d,0x45,0x00,0x00,0x00] + pabsw 0x45,%mm3 + +// CHECK: pabsw 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0x1d,0xed,0x7e,0x00,0x00] + pabsw 0x7eed,%mm3 + +// CHECK: pabsw 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0x1d,0xfe,0xca,0xbe,0xba] + pabsw 0xbabecafe,%mm3 + +// CHECK: pabsw 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0x1d,0x78,0x56,0x34,0x12] + pabsw 0x12345678,%mm3 + +// CHECK: pabsw %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1d,0xdb] + pabsw %mm3,%mm3 + +// CHECK: pabsw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0xac,0xcb,0xef,0xbe,0xad,0xde] + pabsw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pabsw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0x2d,0x45,0x00,0x00,0x00] + pabsw 0x45,%xmm5 + +// CHECK: pabsw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0x2d,0xed,0x7e,0x00,0x00] + pabsw 0x7eed,%xmm5 + +// CHECK: pabsw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0x2d,0xfe,0xca,0xbe,0xba] + pabsw 0xbabecafe,%xmm5 + +// CHECK: pabsw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0x2d,0x78,0x56,0x34,0x12] + pabsw 0x12345678,%xmm5 + +// CHECK: pabsw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1d,0xed] + pabsw %xmm5,%xmm5 + +// CHECK: pabsd 3735928559(%ebx,%ecx,8), %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0x9c,0xcb,0xef,0xbe,0xad,0xde] + pabsd 0xdeadbeef(%ebx,%ecx,8),%mm3 + +// CHECK: pabsd 69, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0x1d,0x45,0x00,0x00,0x00] + pabsd 0x45,%mm3 + +// CHECK: pabsd 32493, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0x1d,0xed,0x7e,0x00,0x00] + pabsd 0x7eed,%mm3 + +// CHECK: pabsd 3133065982, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0x1d,0xfe,0xca,0xbe,0xba] + pabsd 0xbabecafe,%mm3 + +// CHECK: pabsd 305419896, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0x1d,0x78,0x56,0x34,0x12] + pabsd 0x12345678,%mm3 + +// CHECK: pabsd %mm3, %mm3 +// CHECK: encoding: [0x0f,0x38,0x1e,0xdb] + pabsd %mm3,%mm3 + +// CHECK: pabsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0xac,0xcb,0xef,0xbe,0xad,0xde] + pabsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pabsd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0x2d,0x45,0x00,0x00,0x00] + pabsd 0x45,%xmm5 + +// CHECK: pabsd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0x2d,0xed,0x7e,0x00,0x00] + pabsd 0x7eed,%xmm5 + +// CHECK: pabsd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0x2d,0xfe,0xca,0xbe,0xba] + pabsd 0xbabecafe,%xmm5 + +// CHECK: pabsd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0x2d,0x78,0x56,0x34,0x12] + pabsd 0x12345678,%xmm5 + +// CHECK: pabsd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x1e,0xed] + pabsd %xmm5,%xmm5 + +// CHECK: femms +// CHECK: encoding: [0x0f,0x0e] + femms + +// CHECK: movntdqa 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2a,0xac,0xcb,0xef,0xbe,0xad,0xde] + movntdqa 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: movntdqa 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2a,0x2d,0x45,0x00,0x00,0x00] + movntdqa 0x45,%xmm5 + +// CHECK: movntdqa 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2a,0x2d,0xed,0x7e,0x00,0x00] + movntdqa 0x7eed,%xmm5 + +// CHECK: movntdqa 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2a,0x2d,0xfe,0xca,0xbe,0xba] + movntdqa 0xbabecafe,%xmm5 + +// CHECK: movntdqa 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2a,0x2d,0x78,0x56,0x34,0x12] + movntdqa 0x12345678,%xmm5 + +// CHECK: packusdw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0xac,0xcb,0xef,0xbe,0xad,0xde] + packusdw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: packusdw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0x2d,0x45,0x00,0x00,0x00] + packusdw 0x45,%xmm5 + +// CHECK: packusdw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0x2d,0xed,0x7e,0x00,0x00] + packusdw 0x7eed,%xmm5 + +// CHECK: packusdw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0x2d,0xfe,0xca,0xbe,0xba] + packusdw 0xbabecafe,%xmm5 + +// CHECK: packusdw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0x2d,0x78,0x56,0x34,0x12] + packusdw 0x12345678,%xmm5 + +// CHECK: packusdw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x2b,0xed] + packusdw %xmm5,%xmm5 + +// CHECK: pcmpeqq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpeqq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpeqq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0x2d,0x45,0x00,0x00,0x00] + pcmpeqq 0x45,%xmm5 + +// CHECK: pcmpeqq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0x2d,0xed,0x7e,0x00,0x00] + pcmpeqq 0x7eed,%xmm5 + +// CHECK: pcmpeqq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0x2d,0xfe,0xca,0xbe,0xba] + pcmpeqq 0xbabecafe,%xmm5 + +// CHECK: pcmpeqq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0x2d,0x78,0x56,0x34,0x12] + pcmpeqq 0x12345678,%xmm5 + +// CHECK: pcmpeqq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x29,0xed] + pcmpeqq %xmm5,%xmm5 + +// CHECK: phminposuw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0xac,0xcb,0xef,0xbe,0xad,0xde] + phminposuw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: phminposuw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0x2d,0x45,0x00,0x00,0x00] + phminposuw 0x45,%xmm5 + +// CHECK: phminposuw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0x2d,0xed,0x7e,0x00,0x00] + phminposuw 0x7eed,%xmm5 + +// CHECK: phminposuw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0x2d,0xfe,0xca,0xbe,0xba] + phminposuw 0xbabecafe,%xmm5 + +// CHECK: phminposuw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0x2d,0x78,0x56,0x34,0x12] + phminposuw 0x12345678,%xmm5 + +// CHECK: phminposuw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x41,0xed] + phminposuw %xmm5,%xmm5 + +// CHECK: pmaxsb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxsb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxsb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0x2d,0x45,0x00,0x00,0x00] + pmaxsb 0x45,%xmm5 + +// CHECK: pmaxsb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0x2d,0xed,0x7e,0x00,0x00] + pmaxsb 0x7eed,%xmm5 + +// CHECK: pmaxsb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0x2d,0xfe,0xca,0xbe,0xba] + pmaxsb 0xbabecafe,%xmm5 + +// CHECK: pmaxsb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0x2d,0x78,0x56,0x34,0x12] + pmaxsb 0x12345678,%xmm5 + +// CHECK: pmaxsb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3c,0xed] + pmaxsb %xmm5,%xmm5 + +// CHECK: pmaxsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxsd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0x2d,0x45,0x00,0x00,0x00] + pmaxsd 0x45,%xmm5 + +// CHECK: pmaxsd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0x2d,0xed,0x7e,0x00,0x00] + pmaxsd 0x7eed,%xmm5 + +// CHECK: pmaxsd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0x2d,0xfe,0xca,0xbe,0xba] + pmaxsd 0xbabecafe,%xmm5 + +// CHECK: pmaxsd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0x2d,0x78,0x56,0x34,0x12] + pmaxsd 0x12345678,%xmm5 + +// CHECK: pmaxsd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3d,0xed] + pmaxsd %xmm5,%xmm5 + +// CHECK: pmaxud 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxud 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxud 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0x2d,0x45,0x00,0x00,0x00] + pmaxud 0x45,%xmm5 + +// CHECK: pmaxud 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0x2d,0xed,0x7e,0x00,0x00] + pmaxud 0x7eed,%xmm5 + +// CHECK: pmaxud 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0x2d,0xfe,0xca,0xbe,0xba] + pmaxud 0xbabecafe,%xmm5 + +// CHECK: pmaxud 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0x2d,0x78,0x56,0x34,0x12] + pmaxud 0x12345678,%xmm5 + +// CHECK: pmaxud %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3f,0xed] + pmaxud %xmm5,%xmm5 + +// CHECK: pmaxuw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmaxuw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmaxuw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0x2d,0x45,0x00,0x00,0x00] + pmaxuw 0x45,%xmm5 + +// CHECK: pmaxuw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0x2d,0xed,0x7e,0x00,0x00] + pmaxuw 0x7eed,%xmm5 + +// CHECK: pmaxuw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0x2d,0xfe,0xca,0xbe,0xba] + pmaxuw 0xbabecafe,%xmm5 + +// CHECK: pmaxuw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0x2d,0x78,0x56,0x34,0x12] + pmaxuw 0x12345678,%xmm5 + +// CHECK: pmaxuw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3e,0xed] + pmaxuw %xmm5,%xmm5 + +// CHECK: pminsb 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminsb 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminsb 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0x2d,0x45,0x00,0x00,0x00] + pminsb 0x45,%xmm5 + +// CHECK: pminsb 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0x2d,0xed,0x7e,0x00,0x00] + pminsb 0x7eed,%xmm5 + +// CHECK: pminsb 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0x2d,0xfe,0xca,0xbe,0xba] + pminsb 0xbabecafe,%xmm5 + +// CHECK: pminsb 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0x2d,0x78,0x56,0x34,0x12] + pminsb 0x12345678,%xmm5 + +// CHECK: pminsb %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x38,0xed] + pminsb %xmm5,%xmm5 + +// CHECK: pminsd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminsd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminsd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0x2d,0x45,0x00,0x00,0x00] + pminsd 0x45,%xmm5 + +// CHECK: pminsd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0x2d,0xed,0x7e,0x00,0x00] + pminsd 0x7eed,%xmm5 + +// CHECK: pminsd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0x2d,0xfe,0xca,0xbe,0xba] + pminsd 0xbabecafe,%xmm5 + +// CHECK: pminsd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0x2d,0x78,0x56,0x34,0x12] + pminsd 0x12345678,%xmm5 + +// CHECK: pminsd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x39,0xed] + pminsd %xmm5,%xmm5 + +// CHECK: pminud 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminud 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminud 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0x2d,0x45,0x00,0x00,0x00] + pminud 0x45,%xmm5 + +// CHECK: pminud 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0x2d,0xed,0x7e,0x00,0x00] + pminud 0x7eed,%xmm5 + +// CHECK: pminud 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0x2d,0xfe,0xca,0xbe,0xba] + pminud 0xbabecafe,%xmm5 + +// CHECK: pminud 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0x2d,0x78,0x56,0x34,0x12] + pminud 0x12345678,%xmm5 + +// CHECK: pminud %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3b,0xed] + pminud %xmm5,%xmm5 + +// CHECK: pminuw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0xac,0xcb,0xef,0xbe,0xad,0xde] + pminuw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pminuw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0x2d,0x45,0x00,0x00,0x00] + pminuw 0x45,%xmm5 + +// CHECK: pminuw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0x2d,0xed,0x7e,0x00,0x00] + pminuw 0x7eed,%xmm5 + +// CHECK: pminuw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0x2d,0xfe,0xca,0xbe,0xba] + pminuw 0xbabecafe,%xmm5 + +// CHECK: pminuw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0x2d,0x78,0x56,0x34,0x12] + pminuw 0x12345678,%xmm5 + +// CHECK: pminuw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x3a,0xed] + pminuw %xmm5,%xmm5 + +// CHECK: pmovsxbw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxbw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxbw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0x2d,0x45,0x00,0x00,0x00] + pmovsxbw 0x45,%xmm5 + +// CHECK: pmovsxbw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0x2d,0xed,0x7e,0x00,0x00] + pmovsxbw 0x7eed,%xmm5 + +// CHECK: pmovsxbw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxbw 0xbabecafe,%xmm5 + +// CHECK: pmovsxbw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0x2d,0x78,0x56,0x34,0x12] + pmovsxbw 0x12345678,%xmm5 + +// CHECK: pmovsxbw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x20,0xed] + pmovsxbw %xmm5,%xmm5 + +// CHECK: pmovsxbd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxbd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxbd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0x2d,0x45,0x00,0x00,0x00] + pmovsxbd 0x45,%xmm5 + +// CHECK: pmovsxbd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0x2d,0xed,0x7e,0x00,0x00] + pmovsxbd 0x7eed,%xmm5 + +// CHECK: pmovsxbd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxbd 0xbabecafe,%xmm5 + +// CHECK: pmovsxbd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0x2d,0x78,0x56,0x34,0x12] + pmovsxbd 0x12345678,%xmm5 + +// CHECK: pmovsxbd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x21,0xed] + pmovsxbd %xmm5,%xmm5 + +// CHECK: pmovsxbq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxbq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxbq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0x2d,0x45,0x00,0x00,0x00] + pmovsxbq 0x45,%xmm5 + +// CHECK: pmovsxbq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0x2d,0xed,0x7e,0x00,0x00] + pmovsxbq 0x7eed,%xmm5 + +// CHECK: pmovsxbq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxbq 0xbabecafe,%xmm5 + +// CHECK: pmovsxbq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0x2d,0x78,0x56,0x34,0x12] + pmovsxbq 0x12345678,%xmm5 + +// CHECK: pmovsxbq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x22,0xed] + pmovsxbq %xmm5,%xmm5 + +// CHECK: pmovsxwd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxwd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxwd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0x2d,0x45,0x00,0x00,0x00] + pmovsxwd 0x45,%xmm5 + +// CHECK: pmovsxwd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0x2d,0xed,0x7e,0x00,0x00] + pmovsxwd 0x7eed,%xmm5 + +// CHECK: pmovsxwd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxwd 0xbabecafe,%xmm5 + +// CHECK: pmovsxwd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0x2d,0x78,0x56,0x34,0x12] + pmovsxwd 0x12345678,%xmm5 + +// CHECK: pmovsxwd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x23,0xed] + pmovsxwd %xmm5,%xmm5 + +// CHECK: pmovsxwq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxwq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxwq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0x2d,0x45,0x00,0x00,0x00] + pmovsxwq 0x45,%xmm5 + +// CHECK: pmovsxwq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0x2d,0xed,0x7e,0x00,0x00] + pmovsxwq 0x7eed,%xmm5 + +// CHECK: pmovsxwq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxwq 0xbabecafe,%xmm5 + +// CHECK: pmovsxwq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0x2d,0x78,0x56,0x34,0x12] + pmovsxwq 0x12345678,%xmm5 + +// CHECK: pmovsxwq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x24,0xed] + pmovsxwq %xmm5,%xmm5 + +// CHECK: pmovsxdq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovsxdq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovsxdq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0x2d,0x45,0x00,0x00,0x00] + pmovsxdq 0x45,%xmm5 + +// CHECK: pmovsxdq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0x2d,0xed,0x7e,0x00,0x00] + pmovsxdq 0x7eed,%xmm5 + +// CHECK: pmovsxdq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0x2d,0xfe,0xca,0xbe,0xba] + pmovsxdq 0xbabecafe,%xmm5 + +// CHECK: pmovsxdq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0x2d,0x78,0x56,0x34,0x12] + pmovsxdq 0x12345678,%xmm5 + +// CHECK: pmovsxdq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x25,0xed] + pmovsxdq %xmm5,%xmm5 + +// CHECK: pmovzxbw 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxbw 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxbw 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0x2d,0x45,0x00,0x00,0x00] + pmovzxbw 0x45,%xmm5 + +// CHECK: pmovzxbw 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0x2d,0xed,0x7e,0x00,0x00] + pmovzxbw 0x7eed,%xmm5 + +// CHECK: pmovzxbw 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxbw 0xbabecafe,%xmm5 + +// CHECK: pmovzxbw 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0x2d,0x78,0x56,0x34,0x12] + pmovzxbw 0x12345678,%xmm5 + +// CHECK: pmovzxbw %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x30,0xed] + pmovzxbw %xmm5,%xmm5 + +// CHECK: pmovzxbd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxbd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxbd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0x2d,0x45,0x00,0x00,0x00] + pmovzxbd 0x45,%xmm5 + +// CHECK: pmovzxbd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0x2d,0xed,0x7e,0x00,0x00] + pmovzxbd 0x7eed,%xmm5 + +// CHECK: pmovzxbd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxbd 0xbabecafe,%xmm5 + +// CHECK: pmovzxbd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0x2d,0x78,0x56,0x34,0x12] + pmovzxbd 0x12345678,%xmm5 + +// CHECK: pmovzxbd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x31,0xed] + pmovzxbd %xmm5,%xmm5 + +// CHECK: pmovzxbq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxbq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxbq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0x2d,0x45,0x00,0x00,0x00] + pmovzxbq 0x45,%xmm5 + +// CHECK: pmovzxbq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0x2d,0xed,0x7e,0x00,0x00] + pmovzxbq 0x7eed,%xmm5 + +// CHECK: pmovzxbq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxbq 0xbabecafe,%xmm5 + +// CHECK: pmovzxbq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0x2d,0x78,0x56,0x34,0x12] + pmovzxbq 0x12345678,%xmm5 + +// CHECK: pmovzxbq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x32,0xed] + pmovzxbq %xmm5,%xmm5 + +// CHECK: pmovzxwd 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxwd 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxwd 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0x2d,0x45,0x00,0x00,0x00] + pmovzxwd 0x45,%xmm5 + +// CHECK: pmovzxwd 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0x2d,0xed,0x7e,0x00,0x00] + pmovzxwd 0x7eed,%xmm5 + +// CHECK: pmovzxwd 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxwd 0xbabecafe,%xmm5 + +// CHECK: pmovzxwd 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0x2d,0x78,0x56,0x34,0x12] + pmovzxwd 0x12345678,%xmm5 + +// CHECK: pmovzxwd %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x33,0xed] + pmovzxwd %xmm5,%xmm5 + +// CHECK: pmovzxwq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxwq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxwq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0x2d,0x45,0x00,0x00,0x00] + pmovzxwq 0x45,%xmm5 + +// CHECK: pmovzxwq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0x2d,0xed,0x7e,0x00,0x00] + pmovzxwq 0x7eed,%xmm5 + +// CHECK: pmovzxwq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxwq 0xbabecafe,%xmm5 + +// CHECK: pmovzxwq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0x2d,0x78,0x56,0x34,0x12] + pmovzxwq 0x12345678,%xmm5 + +// CHECK: pmovzxwq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x34,0xed] + pmovzxwq %xmm5,%xmm5 + +// CHECK: pmovzxdq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmovzxdq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmovzxdq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0x2d,0x45,0x00,0x00,0x00] + pmovzxdq 0x45,%xmm5 + +// CHECK: pmovzxdq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0x2d,0xed,0x7e,0x00,0x00] + pmovzxdq 0x7eed,%xmm5 + +// CHECK: pmovzxdq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0x2d,0xfe,0xca,0xbe,0xba] + pmovzxdq 0xbabecafe,%xmm5 + +// CHECK: pmovzxdq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0x2d,0x78,0x56,0x34,0x12] + pmovzxdq 0x12345678,%xmm5 + +// CHECK: pmovzxdq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x35,0xed] + pmovzxdq %xmm5,%xmm5 + +// CHECK: pmuldq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmuldq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmuldq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0x2d,0x45,0x00,0x00,0x00] + pmuldq 0x45,%xmm5 + +// CHECK: pmuldq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0x2d,0xed,0x7e,0x00,0x00] + pmuldq 0x7eed,%xmm5 + +// CHECK: pmuldq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0x2d,0xfe,0xca,0xbe,0xba] + pmuldq 0xbabecafe,%xmm5 + +// CHECK: pmuldq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0x2d,0x78,0x56,0x34,0x12] + pmuldq 0x12345678,%xmm5 + +// CHECK: pmuldq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x28,0xed] + pmuldq %xmm5,%xmm5 + +// CHECK: pmulld 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0xac,0xcb,0xef,0xbe,0xad,0xde] + pmulld 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pmulld 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0x2d,0x45,0x00,0x00,0x00] + pmulld 0x45,%xmm5 + +// CHECK: pmulld 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0x2d,0xed,0x7e,0x00,0x00] + pmulld 0x7eed,%xmm5 + +// CHECK: pmulld 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0x2d,0xfe,0xca,0xbe,0xba] + pmulld 0xbabecafe,%xmm5 + +// CHECK: pmulld 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0x2d,0x78,0x56,0x34,0x12] + pmulld 0x12345678,%xmm5 + +// CHECK: pmulld %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x40,0xed] + pmulld %xmm5,%xmm5 + +// CHECK: ptest 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0xac,0xcb,0xef,0xbe,0xad,0xde] + ptest 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: ptest 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0x2d,0x45,0x00,0x00,0x00] + ptest 0x45,%xmm5 + +// CHECK: ptest 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0x2d,0xed,0x7e,0x00,0x00] + ptest 0x7eed,%xmm5 + +// CHECK: ptest 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0x2d,0xfe,0xca,0xbe,0xba] + ptest 0xbabecafe,%xmm5 + +// CHECK: ptest 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0x2d,0x78,0x56,0x34,0x12] + ptest 0x12345678,%xmm5 + +// CHECK: ptest %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x17,0xed] + ptest %xmm5,%xmm5 + +// CHECK: pcmpgtq 3735928559(%ebx,%ecx,8), %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0xac,0xcb,0xef,0xbe,0xad,0xde] + pcmpgtq 0xdeadbeef(%ebx,%ecx,8),%xmm5 + +// CHECK: pcmpgtq 69, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0x2d,0x45,0x00,0x00,0x00] + pcmpgtq 0x45,%xmm5 + +// CHECK: pcmpgtq 32493, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0x2d,0xed,0x7e,0x00,0x00] + pcmpgtq 0x7eed,%xmm5 + +// CHECK: pcmpgtq 3133065982, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0x2d,0xfe,0xca,0xbe,0xba] + pcmpgtq 0xbabecafe,%xmm5 + +// CHECK: pcmpgtq 305419896, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0x2d,0x78,0x56,0x34,0x12] + pcmpgtq 0x12345678,%xmm5 + +// CHECK: pcmpgtq %xmm5, %xmm5 +// CHECK: encoding: [0x66,0x0f,0x38,0x37,0xed] + pcmpgtq %xmm5,%xmm5 From clattner at apple.com Wed Feb 10 13:16:22 2010 From: clattner at apple.com (Chris Lattner) Date: Wed, 10 Feb 2010 11:16:22 -0800 Subject: [llvm-commits] [llvm] r95749 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: <299E9F33-80D9-4D42-8B4B-138C01FFAA35@apple.com> References: <201002100131.o1A1VQ5S011223@zion.cs.uiuc.edu> <299E9F33-80D9-4D42-8B4B-138C01FFAA35@apple.com> Message-ID: <0182E047-00FA-4D1C-9B7A-E24A4343AA24@apple.com> On Feb 10, 2010, at 10:42 AM, Dale Johannesen wrote: > > On Feb 9, 2010, at 6:02 PMPST, Chris Lattner wrote: > >> >> On Feb 9, 2010, at 5:31 PM, Dale Johannesen wrote: >> >>> Author: johannes >>> Date: Tue Feb 9 19:31:26 2010 >>> New Revision: 95749 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=95749&view=rev >>> Log: >>> Rewrite loop to suit Chris' preference. >> >> The second !mi->isDebugValue() you added is now dead. > > That is needed for the case where a block ends with DEBUG_VALUE. Without that check baseIndex would point too far ahead after the loop. Ok, thanks for checking! -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100210/3e80f055/attachment.html From bob.wilson at apple.com Wed Feb 10 13:25:45 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 10 Feb 2010 19:25:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95792 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <201002101925.o1AJPjUY010745@zion.cs.uiuc.edu> Author: bwilson Date: Wed Feb 10 13:25:45 2010 New Revision: 95792 URL: http://llvm.org/viewvc/llvm-project?rev=95792&view=rev Log: Check for special llvmgcc42_Embedded project name when using ARM_SDK. Radar 7633495. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=95792&r1=95791&r2=95792&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Wed Feb 10 13:25:45 2010 @@ -142,12 +142,6 @@ ARM_SYSROOT=$ARM_PLATFORM/Developer/SDKs/$ARM_IPHONE_SDK ARM_TOOLROOT=$ARM_PLATFORM/Developer - # If it's being built for iPhoneOS, assume the llvmCore bits are under - # iPhoneOS platform directory. - if [ "x$RC_ProjectName" = "xllvmgcc42_Embedded" ]; then - LLVMCORE_PATH="${ARM_PLATFORM}${LLVMCORE_PATH}" - DEST_ROOT="${ARM_PLATFORM}${DEST_ROOT}" - fi else # Use bootstrap SDK if it is available. @@ -156,11 +150,19 @@ else ARM_SYSROOT=/ fi + ARM_PLATFORM=/ ARM_TOOLROOT=/ fi ARM_CONFIGFLAGS="$ARM_CONFIGFLAGS --with-build-sysroot=\"$ARM_SYSROOT\"" +# If it's being built for iPhoneOS, assume the llvmCore bits are under +# iPhoneOS platform directory. +if [ "x$RC_ProjectName" = "xllvmgcc42_Embedded" ]; then + LLVMCORE_PATH="${ARM_PLATFORM}${LLVMCORE_PATH}" + DEST_ROOT="${ARM_PLATFORM}${DEST_ROOT}" +fi + # If building an ARM target, check that the required directories exist # and query the libSystem arm slices to determine which multilibs we should # build. From gohman at apple.com Wed Feb 10 14:04:20 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 20:04:20 -0000 Subject: [llvm-commits] [llvm] r95795 - in /llvm/trunk: include/llvm/CodeGen/JITCodeEmitter.h include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/MachineCodeEmitter.h include/llvm/CodeGen/ObjectCodeEmitter.h include/llvm/Support/IRBuilder.h lib/CodeGen/CodePlacementOpt.cpp lib/VMCore/IRBuilder.cpp Message-ID: <201002102004.o1AK4Kji012630@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 14:04:19 2010 New Revision: 95795 URL: http://llvm.org/viewvc/llvm-project?rev=95795&view=rev Log: Fix several comments which had previously been "the the" where a different word was intended. Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h llvm/trunk/include/llvm/Support/IRBuilder.h llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp llvm/trunk/lib/VMCore/IRBuilder.cpp Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h Wed Feb 10 14:04:19 2010 @@ -146,7 +146,7 @@ } } - /// emitAlignment - Move the CurBufferPtr pointer up the specified + /// emitAlignment - Move the CurBufferPtr pointer up to the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment) { if (Alignment == 0) Alignment = 1; Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Feb 10 14:04:19 2010 @@ -320,7 +320,7 @@ /// advanceTo - Advance the specified iterator to point to the LiveRange /// containing the specified position, or end() if the position is past the /// end of the interval. If no LiveRange contains this position, but the - /// position is in a hole, this method returns an iterator pointing the + /// position is in a hole, this method returns an iterator pointing to the /// LiveRange immediately after the hole. iterator advanceTo(iterator I, SlotIndex Pos) { if (Pos >= endIndex()) Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Wed Feb 10 14:04:19 2010 @@ -155,7 +155,7 @@ } } - /// emitAlignment - Move the CurBufferPtr pointer up the specified + /// emitAlignment - Move the CurBufferPtr pointer up to the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment) { if (Alignment == 0) Alignment = 1; Modified: llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/ObjectCodeEmitter.h Wed Feb 10 14:04:19 2010 @@ -81,7 +81,7 @@ /// written to the data stream in big-endian format. void emitDWordBE(uint64_t W); - /// emitAlignment - Move the CurBufferPtr pointer up the specified + /// emitAlignment - Move the CurBufferPtr pointer up to the specified /// alignment (saturated to BufferEnd of course). void emitAlignment(unsigned Alignment = 0, uint8_t fill = 0); Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Feb 10 14:04:19 2010 @@ -94,7 +94,7 @@ //===--------------------------------------------------------------------===// /// CreateGlobalString - Make a new global variable with an initializer that - /// has array of i8 type filled in the nul terminated string value + /// has array of i8 type filled in with the nul terminated string value /// specified. If Name is specified, it is the name of the global variable /// created. Value *CreateGlobalString(const char *Str = "", const Twine &Name = ""); Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Wed Feb 10 14:04:19 2010 @@ -115,7 +115,7 @@ // Ask the target's AnalyzeBranch if it can handle this block. MachineBasicBlock *TBB = 0, *FBB = 0; SmallVector Cond; - // Make the terminator is understood. + // Make sure the terminator is understood. if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond)) return false; // Make sure we have the option of reversing the condition. Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=95795&r1=95794&r2=95795&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IRBuilder.cpp (original) +++ llvm/trunk/lib/VMCore/IRBuilder.cpp Wed Feb 10 14:04:19 2010 @@ -19,7 +19,7 @@ using namespace llvm; /// CreateGlobalString - Make a new global variable with an initializer that -/// has array of i8 type filled in the nul terminated string value +/// has array of i8 type filled in with the nul terminated string value /// specified. If Name is specified, it is the name of the global variable /// created. Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) { From gohman at apple.com Wed Feb 10 14:23:33 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 20:23:33 -0000 Subject: [llvm-commits] [llvm] r95797 - /llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Message-ID: <201002102023.o1AKNXTT013627@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 14:23:33 2010 New Revision: 95797 URL: http://llvm.org/viewvc/llvm-project?rev=95797&view=rev Log: Use doxygen comment syntax. Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h?rev=95797&r1=95796&r2=95797&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h (original) +++ llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Wed Feb 10 14:23:33 2010 @@ -29,22 +29,22 @@ virtual ~AssemblyAnnotationWriter(); - // emitFunctionAnnot - This may be implemented to emit a string right before - // the start of a function. + /// emitFunctionAnnot - This may be implemented to emit a string right before + /// the start of a function. virtual void emitFunctionAnnot(const Function *F, raw_ostream &OS) {} - // emitBasicBlockStartAnnot - This may be implemented to emit a string right - // after the basic block label, but before the first instruction in the block. + /// emitBasicBlockStartAnnot - This may be implemented to emit a string right + /// after the basic block label, but before the first instruction in the block. virtual void emitBasicBlockStartAnnot(const BasicBlock *BB, raw_ostream &OS){ } - // emitBasicBlockEndAnnot - This may be implemented to emit a string right - // after the basic block. + /// emitBasicBlockEndAnnot - This may be implemented to emit a string right + /// after the basic block. virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, raw_ostream &OS){ } - // emitInstructionAnnot - This may be implemented to emit a string right - // before an instruction is emitted. + /// emitInstructionAnnot - This may be implemented to emit a string right + /// before an instruction is emitted. virtual void emitInstructionAnnot(const Instruction *I, raw_ostream &OS) {} }; From gohman at apple.com Wed Feb 10 14:41:47 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 20:41:47 -0000 Subject: [llvm-commits] [llvm] r95798 - in /llvm/trunk: include/llvm/Assembly/AsmAnnotationWriter.h lib/VMCore/AsmWriter.cpp Message-ID: <201002102041.o1AKfl6x014656@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 14:41:46 2010 New Revision: 95798 URL: http://llvm.org/viewvc/llvm-project?rev=95798&view=rev Log: Add a hook to AssemblyAnnotationWriter to allow custom info comments to be printed, in place of the familiar "uses=" comments. Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h?rev=95798&r1=95797&r2=95798&view=diff ============================================================================== --- llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h (original) +++ llvm/trunk/include/llvm/Assembly/AsmAnnotationWriter.h Wed Feb 10 14:41:46 2010 @@ -23,6 +23,7 @@ class BasicBlock; class Instruction; class raw_ostream; +class formatted_raw_ostream; class AssemblyAnnotationWriter { public: @@ -46,6 +47,10 @@ /// emitInstructionAnnot - This may be implemented to emit a string right /// before an instruction is emitted. virtual void emitInstructionAnnot(const Instruction *I, raw_ostream &OS) {} + + /// printInfoComment - This may be implemented to emit a comment to the + /// right of an instruction or global value. + virtual void printInfoComment(const Value &V, formatted_raw_ostream &OS) {} }; } // End llvm namespace Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=95798&r1=95797&r2=95798&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Feb 10 14:41:46 2010 @@ -1694,6 +1694,11 @@ /// which slot it occupies. /// void AssemblyWriter::printInfoComment(const Value &V) { + if (AnnotationWriter) { + AnnotationWriter->printInfoComment(V, Out); + return; + } + if (V.getType()->isVoidTy()) return; Out.PadToColumn(50); From gohman at apple.com Wed Feb 10 14:42:38 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 20:42:38 -0000 Subject: [llvm-commits] [llvm] r95799 - /llvm/trunk/lib/Analysis/IVUsers.cpp Message-ID: <201002102042.o1AKgcmF014749@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 14:42:37 2010 New Revision: 95799 URL: http://llvm.org/viewvc/llvm-project?rev=95799&view=rev Log: Use an AssemblyAnnotatorWriter to clean up IVUsers' debug output. The "uses=" comments are just clutter in this context. Modified: llvm/trunk/lib/Analysis/IVUsers.cpp Modified: llvm/trunk/lib/Analysis/IVUsers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=95799&r1=95798&r2=95799&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IVUsers.cpp (original) +++ llvm/trunk/lib/Analysis/IVUsers.cpp Wed Feb 10 14:42:37 2010 @@ -21,6 +21,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" +#include "llvm/Assembly/AsmAnnotationWriter.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -340,6 +341,13 @@ return RetVal; } +namespace { + +// Suppress extraneous comments. +class IVUsersAsmAnnotator : public AssemblyAnnotationWriter {}; + +} + void IVUsers::print(raw_ostream &OS, const Module *M) const { OS << "IV Users for loop "; WriteAsOperand(OS, L->getHeader(), false); @@ -349,6 +357,7 @@ } OS << ":\n"; + IVUsersAsmAnnotator Annotator; for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; ++Stride) { std::map::const_iterator SI = IVUsesByStride.find(StrideOrder[Stride]); @@ -364,7 +373,7 @@ if (UI->isUseOfPostIncrementedValue()) OS << " (post-inc)"; OS << " in "; - UI->getUser()->print(OS); + UI->getUser()->print(OS, &Annotator); OS << '\n'; } } From gohman at apple.com Wed Feb 10 14:42:57 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 20:42:57 -0000 Subject: [llvm-commits] [llvm] r95801 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <201002102042.o1AKgv90014787@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 14:42:57 2010 New Revision: 95801 URL: http://llvm.org/viewvc/llvm-project?rev=95801&view=rev Log: Minor whitespace cleanups. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=95801&r1=95800&r2=95801&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Feb 10 14:42:57 2010 @@ -1252,15 +1252,14 @@ void printArgument(const Argument *FA, Attributes Attrs); void printBasicBlock(const BasicBlock *BB); void printInstruction(const Instruction &I); -private: +private: // printInfoComment - Print a little comment after the instruction indicating // which slot it occupies. void printInfoComment(const Value &V); }; } // end of anonymous namespace - void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) { if (Operand == 0) { Out << ""; @@ -1689,7 +1688,6 @@ if (AnnotationWriter) AnnotationWriter->emitBasicBlockEndAnnot(BB, Out); } - /// printInfoComment - Print a little comment after the instruction indicating /// which slot it occupies. /// From daniel at zuster.org Wed Feb 10 15:00:47 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 21:00:47 -0000 Subject: [llvm-commits] [llvm] r95802 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <201002102100.o1AL0llO015768@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Feb 10 15:00:47 2010 New Revision: 95802 URL: http://llvm.org/viewvc/llvm-project?rev=95802&view=rev Log: MC/AsmMatcher: Tweak conversion function name. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=95802&r1=95801&r2=95802&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Wed Feb 10 15:00:47 2010 @@ -1081,7 +1081,7 @@ // Add any trailing implicit operands. for (; CurIndex != NumMIOperands; ++CurIndex) - Signature += "Imp"; + Signature += "__Imp"; II.ConversionFnKind = Signature; From daniel at zuster.org Wed Feb 10 15:00:55 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 21:00:55 -0000 Subject: [llvm-commits] [llvm] r95803 - /llvm/trunk/utils/lit/lit/TestFormats.py Message-ID: <201002102100.o1AL0ulk015786@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Feb 10 15:00:55 2010 New Revision: 95803 URL: http://llvm.org/viewvc/llvm-project?rev=95803&view=rev Log: lit: Ignore dot files when scanning for tests (e.g., editor temprary files, etc.) Modified: llvm/trunk/utils/lit/lit/TestFormats.py Modified: llvm/trunk/utils/lit/lit/TestFormats.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestFormats.py?rev=95803&r1=95802&r2=95803&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/TestFormats.py (original) +++ llvm/trunk/utils/lit/lit/TestFormats.py Wed Feb 10 15:00:55 2010 @@ -87,6 +87,10 @@ litConfig, localConfig): source_path = testSuite.getSourcePath(path_in_suite) for filename in os.listdir(source_path): + # Ignore dot files. + if filename.startswith('.'): + continue + filepath = os.path.join(source_path, filename) if not os.path.isdir(filepath): base,ext = os.path.splitext(filename) @@ -137,7 +141,8 @@ d not in localConfig.excludes)] for filename in filenames: - if (not self.pattern.match(filename) or + if (filename.startswith('.') or + not self.pattern.match(filename) or filename in localConfig.excludes): continue From daniel at zuster.org Wed Feb 10 15:01:04 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 21:01:04 -0000 Subject: [llvm-commits] [llvm] r95804 - /llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Message-ID: <201002102101.o1AL14EE015807@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Feb 10 15:01:04 2010 New Revision: 95804 URL: http://llvm.org/viewvc/llvm-project?rev=95804&view=rev Log: XFAIL this on linux until I figure out what is happening. Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=95804&r1=95803&r2=95804&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Wed Feb 10 15:01:04 2010 @@ -1,5 +1,9 @@ // RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s +// FIXME: This is failing to match on linux currently, with some kind of match +// failure. I am investigating. - ddunbar +// XFAIL: linux + // CHECK: movb $127, 3735928559(%ebx,%ecx,8) // CHECK: encoding: [0xc6,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] movb $0x7f,0xdeadbeef(%ebx,%ecx,8) From daniel at zuster.org Wed Feb 10 15:19:29 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 10 Feb 2010 21:19:29 -0000 Subject: [llvm-commits] [llvm] r95806 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/X86/x86_32-encoding.s Message-ID: <201002102119.o1ALJTOC016631@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Feb 10 15:19:28 2010 New Revision: 95806 URL: http://llvm.org/viewvc/llvm-project?rev=95806&view=rev Log: MC/X86 AsmMatcher: Fix a use after free spotted by d0k, and de-XFAIL x86_32-encoding.s in on expectation of it passing. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=95806&r1=95805&r2=95806&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Feb 10 15:19:28 2010 @@ -10,6 +10,7 @@ #include "llvm/Target/TargetAsmParser.h" #include "X86.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCExpr.h" @@ -492,24 +493,20 @@ bool X86ATTAsmParser:: ParseInstruction(const StringRef &Name, SMLoc NameLoc, SmallVectorImpl &Operands) { - // FIXME: Hack to recognize "sal..." for now. We need a way to represent - // alternative syntaxes in the .td file, without requiring instruction - // duplication. - if (Name.startswith("sal")) { - std::string Tmp = "shl" + Name.substr(3).str(); - Operands.push_back(X86Operand::CreateToken(Tmp, NameLoc)); - } else { - // FIXME: This is a hack. We eventually want to add a general pattern - // mechanism to be used in the table gen file for these assembly names that - // use the same opcodes. Also we should only allow the "alternate names" - // for rep and repne with the instructions they can only appear with. - StringRef PatchedName = Name; - if (Name == "repe" || Name == "repz") - PatchedName = "rep"; - else if (Name == "repnz") - PatchedName = "repne"; - Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc)); - } + // FIXME: Hack to recognize "sal..." and "rep..." for now. We need a way to + // represent alternative syntaxes in the .td file, without requiring + // instruction duplication. + StringRef PatchedName = StringSwitch(Name) + .Case("sal", "shl") + .Case("salb", "shlb") + .Case("sall", "shll") + .Case("salq", "shlq") + .Case("salw", "shlw") + .Case("repe", "rep") + .Case("repz", "rep") + .Case("repnz", "repne") + .Default(Name); + Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc)); if (getLexer().isNot(AsmToken::EndOfStatement)) { Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=95806&r1=95805&r2=95806&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Wed Feb 10 15:19:28 2010 @@ -1,9 +1,5 @@ // RUN: llvm-mc -triple i386-unknown-unknown --show-encoding %s | FileCheck %s -// FIXME: This is failing to match on linux currently, with some kind of match -// failure. I am investigating. - ddunbar -// XFAIL: linux - // CHECK: movb $127, 3735928559(%ebx,%ecx,8) // CHECK: encoding: [0xc6,0x84,0xcb,0xef,0xbe,0xad,0xde,0x7f] movb $0x7f,0xdeadbeef(%ebx,%ecx,8) From dpatel at apple.com Wed Feb 10 15:19:56 2010 From: dpatel at apple.com (Devang Patel) Date: Wed, 10 Feb 2010 21:19:56 -0000 Subject: [llvm-commits] [llvm] r95807 - /llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Message-ID: <201002102119.o1ALJvqg016665@zion.cs.uiuc.edu> Author: dpatel Date: Wed Feb 10 15:19:56 2010 New Revision: 95807 URL: http://llvm.org/viewvc/llvm-project?rev=95807&view=rev Log: Strip new llvm.dbg.value intrinsic. Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=95807&r1=95806&r2=95807&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Wed Feb 10 15:19:56 2010 @@ -214,6 +214,15 @@ Changed = true; } + if (Function *DbgVal = M.getFunction("llvm.dbg.value")) { + while (!DbgVal->use_empty()) { + CallInst *CI = cast(DbgVal->use_back()); + CI->eraseFromParent(); + } + DbgVal->eraseFromParent(); + Changed = true; + } + NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv"); if (NMD) { Changed = true; From sabre at nondot.org Wed Feb 10 15:22:51 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 21:22:51 -0000 Subject: [llvm-commits] [llvm] r95808 - /llvm/trunk/utils/TableGen/CodeGenInstruction.h Message-ID: <201002102122.o1ALMqcY016864@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 15:22:51 2010 New Revision: 95808 URL: http://llvm.org/viewvc/llvm-project?rev=95808&view=rev Log: work around a gcc bug with -Wuninitialized. Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=95808&r1=95807&r2=95808&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Wed Feb 10 15:22:51 2010 @@ -41,6 +41,7 @@ static ConstraintInfo getEarlyClobber() { ConstraintInfo I; I.Kind = EarlyClobber; + I.OtherTiedOperand = 0; return I; } From eli.friedman at gmail.com Wed Feb 10 15:26:04 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 10 Feb 2010 21:26:04 -0000 Subject: [llvm-commits] [llvm] r95809 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <201002102126.o1ALQ4DI017044@zion.cs.uiuc.edu> Author: efriedma Date: Wed Feb 10 15:26:04 2010 New Revision: 95809 URL: http://llvm.org/viewvc/llvm-project?rev=95809&view=rev Log: A few missed optimizations; the last one could have a significant impact on code with lots of bitfields. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=95809&r1=95808&r2=95809&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Wed Feb 10 15:26:04 2010 @@ -1868,3 +1868,69 @@ information to add the "lock" prefix. //===---------------------------------------------------------------------===// + +_Bool bar(int *x) { return *x & 1; } + +define zeroext i1 @bar(i32* nocapture %x) nounwind readonly { +entry: + %tmp1 = load i32* %x ; [#uses=1] + %and = and i32 %tmp1, 1 ; [#uses=1] + %tobool = icmp ne i32 %and, 0 ; [#uses=1] + ret i1 %tobool +} + +bar: # @bar +# BB#0: # %entry + movl 4(%esp), %eax + movb (%eax), %al + andb $1, %al + movzbl %al, %eax + ret + +Missed optimization: should be movl+andl. + +//===---------------------------------------------------------------------===// + +Consider the following two functions compiled with clang: +_Bool foo(int *x) { return !(*x & 4); } +unsigned bar(int *x) { return !(*x & 4); } + +foo: + movl 4(%esp), %eax + testb $4, (%eax) + sete %al + movzbl %al, %eax + ret + +bar: + movl 4(%esp), %eax + movl (%eax), %eax + shrl $2, %eax + andl $1, %eax + xorl $1, %eax + ret + +The second function generates more code even though the two functions are +are functionally identical. + +//===---------------------------------------------------------------------===// + +Take the following C code: +int x(int y) { return (y & 63) << 14; } + +Code produced by gcc: + andl $63, %edi + sall $14, %edi + movl %edi, %eax + ret + +Code produced by clang: + shll $14, %edi + movl %edi, %eax + andl $1032192, %eax + ret + +The code produced by gcc is 3 bytes shorter. This sort of construct often +shows up with bitfields. + +//===---------------------------------------------------------------------===// From sabre at nondot.org Wed Feb 10 15:37:31 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 10 Feb 2010 21:37:31 -0000 Subject: [llvm-commits] [llvm] r95810 - /llvm/trunk/include/llvm/MC/MCExpr.h Message-ID: <201002102137.o1ALbVd4017580@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 15:37:31 2010 New Revision: 95810 URL: http://llvm.org/viewvc/llvm-project?rev=95810&view=rev Log: add a virtual dtor to MCTargetExpr, hopefully silencing some warnings. Modified: llvm/trunk/include/llvm/MC/MCExpr.h Modified: llvm/trunk/include/llvm/MC/MCExpr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=95810&r1=95809&r2=95810&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCExpr.h (original) +++ llvm/trunk/include/llvm/MC/MCExpr.h Wed Feb 10 15:37:31 2010 @@ -340,7 +340,7 @@ virtual void Anchor(); protected: MCTargetExpr() : MCExpr(Target) {} - + virtual ~MCTargetExpr() {} public: virtual void PrintImpl(raw_ostream &OS) const = 0; From dalej at apple.com Wed Feb 10 15:41:41 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 21:41:41 -0000 Subject: [llvm-commits] [llvm] r95811 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <201002102141.o1ALffdL017755@zion.cs.uiuc.edu> Author: johannes Date: Wed Feb 10 15:41:41 2010 New Revision: 95811 URL: http://llvm.org/viewvc/llvm-project?rev=95811&view=rev Log: When I rewrote this loop per Chris' preference I changed its behavior. Oops. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=95811&r1=95810&r2=95811&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Feb 10 15:41:41 2010 @@ -613,6 +613,9 @@ while (mi != E) { if (mi->isDebugValue()) { ++mi; + if (mi != E && !mi->isDebugValue()) { + baseIndex = indexes_->getNextNonNullIndex(baseIndex); + } continue; } if (mi->killsRegister(interval.reg, tri_)) { From isanbard at gmail.com Wed Feb 10 15:41:57 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 10 Feb 2010 21:41:57 -0000 Subject: [llvm-commits] [llvm] r95813 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfException.cpp DwarfException.h Message-ID: <201002102141.o1ALfvH0017794@zion.cs.uiuc.edu> Author: void Date: Wed Feb 10 15:41:57 2010 New Revision: 95813 URL: http://llvm.org/viewvc/llvm-project?rev=95813&view=rev Log: Use an index instead of pointers into the vector. If the vector resizes, then the pointer values could be invalid. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=95813&r1=95812&r2=95813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Wed Feb 10 15:41:57 2010 @@ -407,20 +407,22 @@ if (NumShared < TypeIds.size()) { unsigned SizeAction = 0; - ActionEntry *PrevAction = 0; + unsigned PrevAction = (unsigned)-1; if (NumShared) { const unsigned SizePrevIds = PrevLPI->TypeIds.size(); assert(Actions.size()); - PrevAction = &Actions.back(); - SizeAction = MCAsmInfo::getSLEB128Size(PrevAction->NextAction) + - MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); + PrevAction = Actions.size() - 1; + SizeAction = + MCAsmInfo::getSLEB128Size(Actions[PrevAction].NextAction) + + MCAsmInfo::getSLEB128Size(Actions[PrevAction].ValueForTypeID); for (unsigned j = NumShared; j != SizePrevIds; ++j) { + assert(PrevAction != (unsigned)-1 && "PrevAction is invalid!"); SizeAction -= - MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); - SizeAction += -PrevAction->NextAction; - PrevAction = PrevAction->Previous; + MCAsmInfo::getSLEB128Size(Actions[PrevAction].ValueForTypeID); + SizeAction += -Actions[PrevAction].NextAction; + PrevAction = Actions[PrevAction].Previous; } } @@ -437,7 +439,7 @@ ActionEntry Action = { ValueForTypeID, NextAction, PrevAction }; Actions.push_back(Action); - PrevAction = &Actions.back(); + PrevAction = Actions.size() - 1; } // Record the first action of the landing pad site. @@ -447,7 +449,7 @@ // Information used when created the call-site table. The action record // field of the call site record is the offset of the first associated // action record, relative to the start of the actions table. This value is - // biased by 1 (1 in dicating the start of the actions table), and 0 + // biased by 1 (1 indicating the start of the actions table), and 0 // indicates that there are no actions. FirstActions.push_back(FirstAction); @@ -648,8 +650,7 @@ // landing pad site. SmallVector Actions; SmallVector FirstActions; - unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, - FirstActions); + unsigned SizeActions=ComputeActionsTable(LandingPads, Actions, FirstActions); // Invokes and nounwind calls have entries in PadMap (due to being bracketed // by try-range labels when lowered). Ordinary calls do not, so appropriate Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=95813&r1=95812&r2=95813&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Wed Feb 10 15:41:57 2010 @@ -135,7 +135,7 @@ struct ActionEntry { int ValueForTypeID; // The value to write - may not be equal to the type id. int NextAction; - struct ActionEntry *Previous; + unsigned Previous; }; /// CallSiteEntry - Structure describing an entry in the call-site table. From dalej at apple.com Wed Feb 10 15:47:48 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 21:47:48 -0000 Subject: [llvm-commits] [llvm] r95814 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <201002102147.o1ALlmkI018122@zion.cs.uiuc.edu> Author: johannes Date: Wed Feb 10 15:47:48 2010 New Revision: 95814 URL: http://llvm.org/viewvc/llvm-project?rev=95814&view=rev Log: Skip debug info in a couple of places. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=95814&r1=95813&r2=95814&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Feb 10 15:47:48 2010 @@ -451,11 +451,11 @@ const TargetInstrInfo *TII, bool &IsCopy, unsigned &DstReg, bool &IsDstPhys) { - MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg); - if (UI == MRI->use_end()) + MachineRegisterInfo::use_nodbg_iterator UI = MRI->use_nodbg_begin(Reg); + if (UI == MRI->use_nodbg_end()) return 0; MachineInstr &UseMI = *UI; - if (++UI != MRI->use_end()) + if (++UI != MRI->use_nodbg_end()) // More than one use. return 0; if (UseMI.getParent() != MBB) @@ -923,6 +923,10 @@ for (MachineBasicBlock::iterator mi = mbbi->begin(), me = mbbi->end(); mi != me; ) { MachineBasicBlock::iterator nmi = llvm::next(mi); + if (mi->isDebugValue()) { + mi = nmi; + continue; + } const TargetInstrDesc &TID = mi->getDesc(); bool FirstTied = true; From bob.wilson at apple.com Wed Feb 10 16:58:58 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Wed, 10 Feb 2010 22:58:58 -0000 Subject: [llvm-commits] [llvm] r95816 - in /llvm/trunk: lib/CodeGen/DeadMachineInstructionElim.cpp test/CodeGen/ARM/remat.ll test/CodeGen/X86/2007-10-05-3AddrConvert.ll Message-ID: <201002102258.o1AMwwMo021626@zion.cs.uiuc.edu> Author: bwilson Date: Wed Feb 10 16:58:57 2010 New Revision: 95816 URL: http://llvm.org/viewvc/llvm-project?rev=95816&view=rev Log: Delete dead PHI machine instructions. These can be created due to type legalization even when the IR-level optimizer has removed dead phis, such as when the high half of an i64 value is unused on a 32-bit target. I had to adjust a few test cases that had dead phis. This is a partial fix for Radar 7627077. Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp llvm/trunk/test/CodeGen/ARM/remat.ll llvm/trunk/test/CodeGen/X86/2007-10-05-3AddrConvert.ll Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95816&r1=95815&r2=95816&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Wed Feb 10 16:58:57 2010 @@ -55,7 +55,7 @@ bool DeadMachineInstructionElim::isDead(const MachineInstr *MI) const { // Don't delete instructions with side effects. bool SawStore = false; - if (!MI->isSafeToMove(TII, SawStore, 0)) + if (!MI->isSafeToMove(TII, SawStore, 0) && !MI->isPHI()) return false; // Examine each operand. Modified: llvm/trunk/test/CodeGen/ARM/remat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat.ll?rev=95816&r1=95815&r2=95816&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/remat.ll (original) +++ llvm/trunk/test/CodeGen/ARM/remat.ll Wed Feb 10 16:58:57 2010 @@ -32,16 +32,16 @@ br label %phi1.exit phi1.exit: ; preds = %bb.i35, %bb142 - %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=0] + %.pn = phi double [ %6, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] %9 = phi double [ %8, %bb.i35 ], [ 0.000000e+00, %bb142 ] ; [#uses=1] - %10 = fmul double undef, %9 ; [#uses=0] + %10 = fmul double %.pn, %9 ; [#uses=1] br i1 %14, label %phi0.exit, label %bb.i bb.i: ; preds = %phi1.exit unreachable phi0.exit: ; preds = %phi1.exit - %11 = fsub double %4, undef ; [#uses=1] + %11 = fsub double %4, %10 ; [#uses=1] %12 = fadd double 0.000000e+00, %11 ; [#uses=1] store double %12, double* undef, align 4 br label %bb142 Modified: llvm/trunk/test/CodeGen/X86/2007-10-05-3AddrConvert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-05-3AddrConvert.ll?rev=95816&r1=95815&r2=95816&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-05-3AddrConvert.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-10-05-3AddrConvert.ll Wed Feb 10 16:58:57 2010 @@ -36,7 +36,9 @@ bb107.i.i: ; preds = %bb107.i.i, %bb.i6.i %q_addr.0.i.i.in = phi %struct.bnode** [ null, %bb107.i.i ], [ %4, %bb.i6.i ] ; <%struct.bnode**> [#uses=1] - %q_addr.0.i.i = load %struct.bnode** %q_addr.0.i.i.in ; <%struct.bnode*> [#uses=0] + %q_addr.0.i.i = load %struct.bnode** %q_addr.0.i.i.in ; <%struct.bnode*> [#uses=1] + %q_addr.1 = getelementptr %struct.anon* %0, i32 0, i32 4, i32 1 + store %struct.bnode* %q_addr.0.i.i, %struct.bnode** %q_addr.1, align 4 br label %bb107.i.i bb47.loopexit.i: ; preds = %bb32.i From dalej at apple.com Wed Feb 10 17:03:21 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 23:03:21 -0000 Subject: [llvm-commits] [llvm] r95818 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <201002102303.o1AN3LFJ021869@zion.cs.uiuc.edu> Author: johannes Date: Wed Feb 10 17:03:20 2010 New Revision: 95818 URL: http://llvm.org/viewvc/llvm-project?rev=95818&view=rev Log: Allow isDebug inquiry on any MO. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=95818&r1=95817&r2=95818&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Feb 10 17:03:20 2010 @@ -220,7 +220,6 @@ bool isDebug() const { assert(isReg() && "Wrong MachineOperand accessor"); - assert(!isDef() && "Wrong MachineOperand accessor"); return IsDebug; } From dalej at apple.com Wed Feb 10 17:04:10 2010 From: dalej at apple.com (Dale Johannesen) Date: Wed, 10 Feb 2010 23:04:10 -0000 Subject: [llvm-commits] [llvm] r95819 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <201002102304.o1AN4BcZ021932@zion.cs.uiuc.edu> Author: johannes Date: Wed Feb 10 17:04:09 2010 New Revision: 95819 URL: http://llvm.org/viewvc/llvm-project?rev=95819&view=rev Log: Ignore debug info one more place during coalescing. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95819&r1=95818&r2=95819&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Feb 10 17:04:09 2010 @@ -1173,6 +1173,8 @@ for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(VirtReg), E = mri_->reg_end(); I != E; ++I) { MachineOperand &O = I.getOperand(); + if (O.isDebug()) + continue; MachineInstr *MI = &*I; if (MI == CopyMI || JoinedCopies.count(MI)) continue; From wangmp at apple.com Wed Feb 10 17:37:45 2010 From: wangmp at apple.com (Mon P Wang) Date: Wed, 10 Feb 2010 23:37:45 -0000 Subject: [llvm-commits] [llvm] r95823 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/scalar_widen_div.ll Message-ID: <201002102337.o1ANbkou023569@zion.cs.uiuc.edu> Author: wangmp Date: Wed Feb 10 17:37:45 2010 New Revision: 95823 URL: http://llvm.org/viewvc/llvm-project?rev=95823&view=rev Log: The previous fix of widening divides that trap was too fragile as it depends on custom lowering and requires that certain types exist in ValueTypes.h. Modified widening to check if an op can trap and if so, the widening algorithm will apply only the op on the defined elements. It is safer to do this in widening because the optimizer can't guarantee removing unused ops in some cases. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/scalar_widen_div.ll Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=95823&r1=95822&r2=95823&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Feb 10 17:37:45 2010 @@ -346,6 +346,11 @@ return true; } + /// canOpTrap - Returns true if the operation can trap for the value type. + /// VT must be a legal type. By default, we optimistically assume most + /// operations don't trap except for divide and remainder. + virtual bool canOpTrap(unsigned Op, EVT VT) const; + /// isVectorClearMaskLegal - Similar to isShuffleMaskLegal. This is /// used by Targets can use this to indicate if there is a suitable /// VECTOR_SHUFFLE that can be used to replace a VAND with a constant Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=95823&r1=95822&r2=95823&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Wed Feb 10 17:37:45 2010 @@ -1242,10 +1242,96 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) { // Binary op widening. + unsigned Opcode = N->getOpcode(); + DebugLoc dl = N->getDebugLoc(); EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); - SDValue InOp1 = GetWidenedVector(N->getOperand(0)); - SDValue InOp2 = GetWidenedVector(N->getOperand(1)); - return DAG.getNode(N->getOpcode(), N->getDebugLoc(), WidenVT, InOp1, InOp2); + EVT WidenEltVT = WidenVT.getVectorElementType(); + EVT VT = WidenVT; + unsigned NumElts = VT.getVectorNumElements(); + while (!TLI.isTypeLegal(VT) && NumElts != 1) { + NumElts = NumElts / 2; + VT = EVT::getVectorVT(*DAG.getContext(), WidenEltVT, NumElts); + } + + if (NumElts != 1 && !TLI.canOpTrap(N->getOpcode(), VT)) { + // Operation doesn't trap so just widen as normal. + SDValue InOp1 = GetWidenedVector(N->getOperand(0)); + SDValue InOp2 = GetWidenedVector(N->getOperand(1)); + return DAG.getNode(N->getOpcode(), dl, WidenVT, InOp1, InOp2); + } else if (NumElts == 1) { + // No legal vector version so unroll the vector operation and then widen. + return DAG.UnrollVectorOp(N, WidenVT.getVectorNumElements()); + } else { + // Since the operation can trap, apply operation on the original vector. + SDValue InOp1 = GetWidenedVector(N->getOperand(0)); + SDValue InOp2 = GetWidenedVector(N->getOperand(1)); + unsigned CurNumElts = N->getValueType(0).getVectorNumElements(); + + SmallVector ConcatOps(CurNumElts); + unsigned ConcatEnd = 0; // Current ConcatOps index. + unsigned Idx = 0; // Current Idx into input vectors. + while (CurNumElts != 0) { + while (CurNumElts >= NumElts) { + SDValue EOp1 = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, InOp1, + DAG.getIntPtrConstant(Idx)); + SDValue EOp2 = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, InOp2, + DAG.getIntPtrConstant(Idx)); + ConcatOps[ConcatEnd++] = DAG.getNode(Opcode, dl, VT, EOp1, EOp2); + Idx += NumElts; + CurNumElts -= NumElts; + } + EVT PrevVecVT = VT; + do { + NumElts = NumElts / 2; + VT = EVT::getVectorVT(*DAG.getContext(), WidenEltVT, NumElts); + } while (!TLI.isTypeLegal(VT) && NumElts != 1); + + if (NumElts == 1) { + // Since we are using concat vector, build a vector from the scalar ops. + SDValue VecOp = DAG.getUNDEF(PrevVecVT); + for (unsigned i = 0; i != CurNumElts; ++i, ++Idx) { + SDValue EOp1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, WidenEltVT, + InOp1, DAG.getIntPtrConstant(Idx)); + SDValue EOp2 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, WidenEltVT, + InOp2, DAG.getIntPtrConstant(Idx)); + VecOp = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, PrevVecVT, VecOp, + DAG.getNode(Opcode, dl, WidenEltVT, EOp1, EOp2), + DAG.getIntPtrConstant(i)); + } + CurNumElts = 0; + ConcatOps[ConcatEnd++] = VecOp; + } + } + + // Check to see if we have a single operation with the widen type. + if (ConcatEnd == 1) { + VT = ConcatOps[0].getValueType(); + if (VT == WidenVT) + return ConcatOps[0]; + } + + // Rebuild vector to one with the widen type + Idx = ConcatEnd - 1; + while (Idx != 0) { + VT = ConcatOps[Idx--].getValueType(); + while (Idx != 0 && ConcatOps[Idx].getValueType() == VT) + --Idx; + if (Idx != 0) { + VT = ConcatOps[Idx].getValueType(); + ConcatOps[Idx+1] = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, + &ConcatOps[Idx+1], ConcatEnd - Idx - 1); + ConcatEnd = Idx + 2; + } + } + + unsigned NumOps = WidenVT.getVectorNumElements()/VT.getVectorNumElements(); + if (NumOps != ConcatEnd ) { + SDValue UndefVal = DAG.getUNDEF(VT); + for (unsigned j = ConcatEnd; j < NumOps; ++j) + ConcatOps[j] = UndefVal; + } + return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT, &ConcatOps[0], NumOps); + } } SDValue DAGTypeLegalizer::WidenVecRes_Convert(SDNode *N) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=95823&r1=95822&r2=95823&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Feb 10 17:37:45 2010 @@ -540,6 +540,24 @@ delete &TLOF; } +/// canOpTrap - Returns true if the operation can trap for the value type. +/// VT must be a legal type. +bool TargetLowering::canOpTrap(unsigned Op, EVT VT) const { + assert(isTypeLegal(VT)); + switch (Op) { + default: + return false; + case ISD::FDIV: + case ISD::FREM: + case ISD::SDIV: + case ISD::UDIV: + case ISD::SREM: + case ISD::UREM: + return true; + } +} + + static unsigned getVectorTypeBreakdownMVT(MVT VT, MVT &IntermediateVT, unsigned &NumIntermediates, EVT &RegisterVT, Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95823&r1=95822&r2=95823&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 10 17:37:45 2010 @@ -1001,19 +1001,6 @@ computeRegisterProperties(); - // Divide and reminder operations have no vector equivalent and can - // trap. Do a custom widening for these operations in which we never - // generate more divides/remainder than the original vector width. - for (unsigned VT = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; - VT <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++VT) { - if (!isTypeLegal((MVT::SimpleValueType)VT)) { - setOperationAction(ISD::SDIV, (MVT::SimpleValueType) VT, Custom); - setOperationAction(ISD::UDIV, (MVT::SimpleValueType) VT, Custom); - setOperationAction(ISD::SREM, (MVT::SimpleValueType) VT, Custom); - setOperationAction(ISD::UREM, (MVT::SimpleValueType) VT, Custom); - } - } - // FIXME: These should be based on subtarget info. Plus, the values should // be smaller when we are in optimizing for size mode. maxStoresPerMemset = 16; // For @llvm.memset -> sequence of stores @@ -7572,14 +7559,6 @@ Results.push_back(edx.getValue(1)); return; } - case ISD::SDIV: - case ISD::UDIV: - case ISD::SREM: - case ISD::UREM: { - EVT WidenVT = getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); - Results.push_back(DAG.UnrollVectorOp(N, WidenVT.getVectorNumElements())); - return; - } case ISD::ATOMIC_CMP_SWAP: { EVT T = N->getValueType(0); assert (T == MVT::i64 && "Only know how to expand i64 Cmp and Swap"); Modified: llvm/trunk/test/CodeGen/X86/scalar_widen_div.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/scalar_widen_div.ll?rev=95823&r1=95822&r2=95823&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/scalar_widen_div.ll (original) +++ llvm/trunk/test/CodeGen/X86/scalar_widen_div.ll Wed Feb 10 17:37:45 2010 @@ -152,3 +152,32 @@ %rem.r = urem <5 x i64> %num, %rem ret <5 x i64> %rem.r } + +define void @test_int_div(<3 x i32>* %dest, <3 x i32>* %old, i32 %n) { +; CHECK: idivl +; CHECK: idivl +; CHECK: idivl +; CHECK-NOT: idivl +; CHECK: ret +entry: + %cmp13 = icmp sgt i32 %n, 0 + br i1 %cmp13, label %bb.nph, label %for.end + +bb.nph: + br label %for.body + +for.body: + %i.014 = phi i32 [ 0, %bb.nph ], [ %inc, %for.body ] + %arrayidx11 = getelementptr <3 x i32>* %dest, i32 %i.014 + %tmp4 = load <3 x i32>* %arrayidx11 ; <<3 x i32>> [#uses=1] + %arrayidx7 = getelementptr inbounds <3 x i32>* %old, i32 %i.014 + %tmp8 = load <3 x i32>* %arrayidx7 ; <<3 x i32>> [#uses=1] + %div = sdiv <3 x i32> %tmp4, %tmp8 + store <3 x i32> %div, <3 x i32>* %arrayidx11 + %inc = add nsw i32 %i.014, 1 + %exitcond = icmp eq i32 %inc, %n + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body, %entry + ret void +} From gohman at apple.com Wed Feb 10 17:58:53 2010 From: gohman at apple.com (Dan Gohman) Date: Wed, 10 Feb 2010 23:58:53 -0000 Subject: [llvm-commits] [llvm] r95825 - in /llvm/trunk: docs/CommandGuide/llvm-extract.pod tools/llvm-extract/llvm-extract.cpp Message-ID: <201002102358.o1ANwr5Q024637@zion.cs.uiuc.edu> Author: djg Date: Wed Feb 10 17:58:53 2010 New Revision: 95825 URL: http://llvm.org/viewvc/llvm-project?rev=95825&view=rev Log: Add support to llvm-extract for extracting multiple functions and/or multiple global variables at a time. Modified: llvm/trunk/docs/CommandGuide/llvm-extract.pod llvm/trunk/tools/llvm-extract/llvm-extract.cpp Modified: llvm/trunk/docs/CommandGuide/llvm-extract.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-extract.pod?rev=95825&r1=95824&r2=95825&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/llvm-extract.pod (original) +++ llvm/trunk/docs/CommandGuide/llvm-extract.pod Wed Feb 10 17:58:53 2010 @@ -34,7 +34,13 @@ =item B<--func> I -Extract the function named I from the LLVM bitcode. +Extract the function named I from the LLVM bitcode. May be +specified multiple times to extract multiple functions at once. + +=item B<--glob> I + +Extract the global variable named I from the LLVM bitcode. May be +specified multiple times to extract multiple global variables at once. =item B<--help> Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=95825&r1=95824&r2=95825&view=diff ============================================================================== --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original) +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Wed Feb 10 17:58:53 2010 @@ -49,15 +49,15 @@ Relink("relink", cl::desc("Turn external linkage for callees of function to delete")); -// ExtractFunc - The function to extract from the module... -static cl::opt -ExtractFunc("func", cl::desc("Specify function to extract"), cl::init(""), - cl::value_desc("function")); - -// ExtractGlobal - The global to extract from the module... -static cl::opt -ExtractGlobal("glob", cl::desc("Specify global to extract"), cl::init(""), - cl::value_desc("global")); +// ExtractFuncs - The functions to extract from the module... +static cl::list +ExtractFuncs("func", cl::desc("Specify function to extract"), + cl::ZeroOrMore, cl::value_desc("function")); + +// ExtractGlobals - The globals to extract from the module... +static cl::list +ExtractGlobals("glob", cl::desc("Specify global to extract"), + cl::ZeroOrMore, cl::value_desc("global")); static cl::opt OutputAssembly("S", @@ -81,28 +81,34 @@ return 1; } - // Figure out which function we should extract - GlobalVariable *G = !ExtractGlobal.empty() ? - M.get()->getNamedGlobal(ExtractGlobal) : 0; - - // Figure out which function we should extract - if (ExtractFunc.empty() && ExtractGlobal.empty()) ExtractFunc = "main"; - Function *F = M.get()->getFunction(ExtractFunc); - - if (F == 0 && G == 0) { - errs() << argv[0] << ": program doesn't contain function named '" - << ExtractFunc << "' or a global named '" << ExtractGlobal << "'!\n"; - return 1; + std::vector GVs; + + // Figure out which globals we should extract. + for (size_t i = 0, e = ExtractGlobals.size(); i != e; ++i) { + GlobalValue *GV = M.get()->getNamedGlobal(ExtractGlobals[i]); + if (!GV) { + errs() << argv[0] << ": program doesn't contain global named '" + << ExtractGlobals[i] << "'!\n"; + return 1; + } + GVs.push_back(GV); + } + + // Figure out which functions we should extract. + for (size_t i = 0, e = ExtractFuncs.size(); i != e; ++i) { + GlobalValue *GV = M.get()->getFunction(ExtractFuncs[i]); + if (!GV) { + errs() << argv[0] << ": program doesn't contain function named '" + << ExtractFuncs[i] << "'!\n"; + return 1; + } + GVs.push_back(GV); } // In addition to deleting all other functions, we also want to spiff it // up a little bit. Do this now. PassManager Passes; Passes.add(new TargetData(M.get())); // Use correct TargetData - // Either isolate the function or delete it from the Module - std::vector GVs; - if (F) GVs.push_back(F); - if (G) GVs.push_back(G); Passes.add(createGVExtractionPass(GVs, DeleteFn, Relink)); if (!DeleteFn) From enderby at apple.com Wed Feb 10 18:13:43 2010 From: enderby at apple.com (Kevin Enderby) Date: Thu, 11 Feb 2010 00:13:43 -0000 Subject: [llvm-commits] [llvm] r95826 - /llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Message-ID: <201002110013.o1B0DiQe025362@zion.cs.uiuc.edu> Author: enderby Date: Wed Feb 10 18:13:43 2010 New Revision: 95826 URL: http://llvm.org/viewvc/llvm-project?rev=95826&view=rev Log: Update the X86 assembler matcher test case now that a few more things match with some of the recent changes that have gone into llvm-mc. Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s?rev=95826&r1=95825&r2=95826&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Wed Feb 10 18:13:43 2010 @@ -1,7 +1,7 @@ // This is the current set of tests that can pass though llvm-mc as it were a // logical cat(1) and then reassemble to the same instruction. All of these // will not yet encode correctly. The subset that will encode correctly are in -// the file x86_32-bit.s . +// the file x86_32-encoding.s (and other tests that encode are in x86_32-bit.s). // RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s @@ -1104,6 +1104,48 @@ rcrb $0x7f,0x12345678 // CHECK: shll $0, 3735928559(%ebx,%ecx,8) + sall $0,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shll $0, 69 + sall $0,0x45 + +// CHECK: shll $0, 32493 + sall $0,0x7eed + +// CHECK: shll $0, 3133065982 + sall $0,0xbabecafe + +// CHECK: shll $0, 305419896 + sall $0,0x12345678 + +// CHECK: shlb $127, 3735928559(%ebx,%ecx,8) + salb $0x7f,0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlb $127, 69 + salb $0x7f,0x45 + +// CHECK: shlb $127, 32493 + salb $0x7f,0x7eed + +// CHECK: shlb $127, 3133065982 + salb $0x7f,0xbabecafe + +// CHECK: shlb $127, 305419896 + salb $0x7f,0x12345678 + +// CHECK: shll 3735928559(%ebx,%ecx,8) + sall 0xdeadbeef(%ebx,%ecx,8) + +// CHECK: shlw 32493 + salw 0x7eed + +// CHECK: shll 3133065982 + sall 0xbabecafe + +// CHECK: shll 305419896 + sall 0x12345678 + +// CHECK: shll $0, 3735928559(%ebx,%ecx,8) shll $0,0xdeadbeef(%ebx,%ecx,8) // CHECK: shll $0, 69 @@ -1274,7 +1316,7 @@ // CHECK: jmp -77129852792157442 jmp 0xfeedfacebabecafe -// CHECK: jmp *3735928559(%ebx,%ecx,8) +// CHECK: jmp *3735928559(%ebx,%ecx,8) # TAILCALL jmp *0xdeadbeef(%ebx,%ecx,8) // CHECK: jmp 32493 @@ -1286,10 +1328,10 @@ // CHECK: jmp 305419896 jmp 0x12345678 -// CHECK: jmp *3135175374 +// CHECK: jmp *3135175374 # TAILCALL jmp *0xbadeface -// CHECK: jmp *3735928559(%ebx,%ecx,8) +// CHECK: jmp *3735928559(%ebx,%ecx,8) # TAILCALL jmp *0xdeadbeef(%ebx,%ecx,8) // CHECK: jmp 32493 @@ -1301,7 +1343,7 @@ // CHECK: jmp 305419896 jmp 0x12345678 -// CHECK: jmp *3135175374 +// CHECK: jmp *3135175374 # TAILCALL jmp *0xbadeface // CHECK: ljmpl *3735928559(%ebx,%ecx,8) @@ -1826,6 +1868,9 @@ // CHECK: verw 305419896 verw 0x12345678 +// CHECK: fld %st(2) + fld %st(2) + // CHECK: fldl 3735928559(%ebx,%ecx,8) fldl 0xdeadbeef(%ebx,%ecx,8) @@ -1835,6 +1880,9 @@ // CHECK: fldl 305419896 fldl 0x12345678 +// CHECK: fld %st(2) + fld %st(2) + // CHECK: fildl 3735928559(%ebx,%ecx,8) fildl 0xdeadbeef(%ebx,%ecx,8) @@ -1880,6 +1928,9 @@ // CHECK: fbld 305419896 fbld 0x12345678 +// CHECK: fst %st(2) + fst %st(2) + // CHECK: fstl 3735928559(%ebx,%ecx,8) fstl 0xdeadbeef(%ebx,%ecx,8) @@ -1889,6 +1940,9 @@ // CHECK: fstl 305419896 fstl 0x12345678 +// CHECK: fst %st(2) + fst %st(2) + // CHECK: fistl 3735928559(%ebx,%ecx,8) fistl 0xdeadbeef(%ebx,%ecx,8) @@ -1898,6 +1952,9 @@ // CHECK: fistl 305419896 fistl 0x12345678 +// CHECK: fstp %st(2) + fstp %st(2) + // CHECK: fstpl 3735928559(%ebx,%ecx,8) fstpl 0xdeadbeef(%ebx,%ecx,8) @@ -1907,6 +1964,9 @@ // CHECK: fstpl 305419896 fstpl 0x12345678 +// CHECK: fstp %st(2) + fstp %st(2) + // CHECK: fistpl 3735928559(%ebx,%ecx,8) fistpl 0xdeadbeef(%ebx,%ecx,8) @@ -1952,6 +2012,12 @@ // CHECK: fbstp 305419896 fbstp 0x12345678 +// CHECK: fxch %st(2) + fxch %st(2) + +// CHECK: fcom %st(2) + fcom %st(2) + // CHECK: fcoml 3735928559(%ebx,%ecx,8) fcoml 0xdeadbeef(%ebx,%ecx,8) @@ -1961,6 +2027,9 @@ // CHECK: fcoml 305419896 fcoml 0x12345678 +// CHECK: fcom %st(2) + fcom %st(2) + // CHECK: ficoml 3735928559(%ebx,%ecx,8) ficoml 0xdeadbeef(%ebx,%ecx,8) @@ -1970,6 +2039,9 @@ // CHECK: ficoml 305419896 ficoml 0x12345678 +// CHECK: fcomp %st(2) + fcomp %st(2) + // CHECK: fcompl 3735928559(%ebx,%ecx,8) fcompl 0xdeadbeef(%ebx,%ecx,8) @@ -1979,6 +2051,9 @@ // CHECK: fcompl 305419896 fcompl 0x12345678 +// CHECK: fcomp %st(2) + fcomp %st(2) + // CHECK: ficompl 3735928559(%ebx,%ecx,8) ficompl 0xdeadbeef(%ebx,%ecx,8) @@ -1991,6 +2066,12 @@ // CHECK: fcompp fcompp +// CHECK: fucom %st(2) + fucom %st(2) + +// CHECK: fucomp %st(2) + fucomp %st(2) + // CHECK: fucompp fucompp @@ -2021,6 +2102,9 @@ // CHECK: fldz fldz +// CHECK: fadd %st(2) + fadd %st(2) + // CHECK: faddl 3735928559(%ebx,%ecx,8) faddl 0xdeadbeef(%ebx,%ecx,8) @@ -2039,6 +2123,12 @@ // CHECK: fiaddl 305419896 fiaddl 0x12345678 +// CHECK: faddp %st(2) + faddp %st(2) + +// CHECK: fsub %st(2) + fsub %st(2) + // CHECK: fsubl 3735928559(%ebx,%ecx,8) fsubl 0xdeadbeef(%ebx,%ecx,8) @@ -2057,6 +2147,12 @@ // CHECK: fisubl 305419896 fisubl 0x12345678 +// CHECK: fsubp %st(2) + fsubp %st(2) + +// CHECK: fsubr %st(2) + fsubr %st(2) + // CHECK: fsubrl 3735928559(%ebx,%ecx,8) fsubrl 0xdeadbeef(%ebx,%ecx,8) @@ -2075,6 +2171,12 @@ // CHECK: fisubrl 305419896 fisubrl 0x12345678 +// CHECK: fsubrp %st(2) + fsubrp %st(2) + +// CHECK: fmul %st(2) + fmul %st(2) + // CHECK: fmull 3735928559(%ebx,%ecx,8) fmull 0xdeadbeef(%ebx,%ecx,8) @@ -2093,6 +2195,12 @@ // CHECK: fimull 305419896 fimull 0x12345678 +// CHECK: fmulp %st(2) + fmulp %st(2) + +// CHECK: fdiv %st(2) + fdiv %st(2) + // CHECK: fdivl 3735928559(%ebx,%ecx,8) fdivl 0xdeadbeef(%ebx,%ecx,8) @@ -2111,6 +2219,12 @@ // CHECK: fidivl 305419896 fidivl 0x12345678 +// CHECK: fdivp %st(2) + fdivp %st(2) + +// CHECK: fdivr %st(2) + fdivr %st(2) + // CHECK: fdivrl 3735928559(%ebx,%ecx,8) fdivrl 0xdeadbeef(%ebx,%ecx,8) @@ -2129,6 +2243,9 @@ // CHECK: fidivrl 305419896 fidivrl 0x12345678 +// CHECK: fdivrp %st(2) + fdivrp %st(2) + // CHECK: f2xm1 f2xm1 @@ -2228,6 +2345,9 @@ // CHECK: frstor 32493 frstor 0x7eed +// CHECK: ffree %st(2) + ffree %st(2) + // CHECK: fnop fnop @@ -2297,6 +2417,42 @@ // CHECK: ud2 ud2 +// CHECK: fcmovb %st(2), %st(0) + fcmovb %st(2),%st + +// CHECK: fcmove %st(2), %st(0) + fcmove %st(2),%st + +// CHECK: fcmovbe %st(2), %st(0) + fcmovbe %st(2),%st + +// CHECK: fcmovu %st(2), %st(0) + fcmovu %st(2),%st + +// CHECK: fcmovnb %st(2), %st(0) + fcmovnb %st(2),%st + +// CHECK: fcmovne %st(2), %st(0) + fcmovne %st(2),%st + +// CHECK: fcmovnbe %st(2), %st(0) + fcmovnbe %st(2),%st + +// CHECK: fcmovnu %st(2), %st(0) + fcmovnu %st(2),%st + +// CHECK: fcomi %st(2), %st(0) + fcomi %st(2),%st + +// CHECK: fucomi %st(2), %st(0) + fucomi %st(2),%st + +// CHECK: fcomip %st(2), %st(0) + fcomip %st(2),%st + +// CHECK: fucomip %st(2), %st(0) + fucomip %st(2),%st + // CHECK: movnti %ecx, 3735928559(%ebx,%ecx,8) movnti %ecx,0xdeadbeef(%ebx,%ecx,8) From enderby at apple.com Wed Feb 10 18:18:12 2010 From: enderby at apple.com (Kevin Enderby) Date: Thu, 11 Feb 2010 00:18:12 -0000 Subject: [llvm-commits] [llvm] r95827 - /llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Message-ID: <201002110018.o1B0ICrA025531@zion.cs.uiuc.edu> Author: enderby Date: Wed Feb 10 18:18:12 2010 New Revision: 95827 URL: http://llvm.org/viewvc/llvm-project?rev=95827&view=rev Log: Remove the few # TAILCALL comments that snuck in. As they may fail on linux. Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s?rev=95827&r1=95826&r2=95827&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-bit_cat.s Wed Feb 10 18:18:12 2010 @@ -1316,7 +1316,7 @@ // CHECK: jmp -77129852792157442 jmp 0xfeedfacebabecafe -// CHECK: jmp *3735928559(%ebx,%ecx,8) # TAILCALL +// CHECK: jmp *3735928559(%ebx,%ecx,8) jmp *0xdeadbeef(%ebx,%ecx,8) // CHECK: jmp 32493 @@ -1328,10 +1328,10 @@ // CHECK: jmp 305419896 jmp 0x12345678 -// CHECK: jmp *3135175374 # TAILCALL +// CHECK: jmp *3135175374 jmp *0xbadeface -// CHECK: jmp *3735928559(%ebx,%ecx,8) # TAILCALL +// CHECK: jmp *3735928559(%ebx,%ecx,8) jmp *0xdeadbeef(%ebx,%ecx,8) // CHECK: jmp 32493 @@ -1343,7 +1343,7 @@ // CHECK: jmp 305419896 jmp 0x12345678 -// CHECK: jmp *3135175374 # TAILCALL +// CHECK: jmp *3135175374 jmp *0xbadeface // CHECK: ljmpl *3735928559(%ebx,%ecx,8) From dpatel at apple.com Wed Feb 10 18:20:49 2010 From: dpatel at apple.com (Devang Patel) Date: Thu, 11 Feb 2010 00:20:49 -0000 Subject: [llvm-commits] [llvm] r95828 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <201002110020.o1B0Kn6Y025660@zion.cs.uiuc.edu> Author: dpatel Date: Wed Feb 10 18:20:49 2010 New Revision: 95828 URL: http://llvm.org/viewvc/llvm-project?rev=95828&view=rev Log: Ignore dbg info intrinsics. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=95828&r1=95827&r2=95828&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Feb 10 18:20:49 2010 @@ -1891,6 +1891,10 @@ /// by inserting it into the appropriate sets bool GVN::processInstruction(Instruction *I, SmallVectorImpl &toErase) { + // Ignore dbg info intrinsics. + if (isa(I)) + return false; + if (LoadInst *LI = dyn_cast(I)) { bool Changed = processLoad(LI, toErase); From stoklund at 2pi.dk Wed Feb 10 18:34:20 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 11 Feb 2010 00:34:20 -0000 Subject: [llvm-commits] [llvm] r95831 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <201002110034.o1B0YLVi026370@zion.cs.uiuc.edu> Author: stoklund Date: Wed Feb 10 18:34:18 2010 New Revision: 95831 URL: http://llvm.org/viewvc/llvm-project?rev=95831&view=rev Log: Remove duplicate successors from indirectbr instructions before building the machine CFG. This makes early tail duplication run 60 times faster when compiling the Firefox JavaScript interpreter, see PR6186. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95831&r1=95830&r2=95831&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 18:34:18 2010 @@ -2062,9 +2062,15 @@ } void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) { - // Update machine-CFG edges. + // Update machine-CFG edges with unique successors. + std::vector succs; + succs.reserve(I.getNumSuccessors()); for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i) - CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]); + succs.push_back(I.getSuccessor(i)); + std::sort(succs.begin(), succs.end()); + succs.erase(std::unique(succs.begin(), succs.end()), succs.end()); + for (unsigned i = 0, e = succs.size(); i != e; ++i) + CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]); DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(), MVT::Other, getControlRoot(), From stoklund at 2pi.dk Wed Feb 10 18:34:34 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 11 Feb 2010 00:34:34 -0000 Subject: [llvm-commits] [llvm] r95832 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp Message-ID: <201002110034.o1B0YYwj026391@zion.cs.uiuc.edu> Author: stoklund Date: Wed Feb 10 18:34:33 2010 New Revision: 95832 URL: http://llvm.org/viewvc/llvm-project?rev=95832&view=rev Log: Reuse operand location when updating PHI instructions. Calling RemoveOperand is very expensive on huge PHI instructions. This makes early tail duplication run twice as fast on the Firefox JavaScript interpreter. Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=95832&r1=95831&r2=95832&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original) +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Wed Feb 10 18:34:33 2010 @@ -403,26 +403,45 @@ II->RemoveOperand(i); } } - II->RemoveOperand(Idx+1); - II->RemoveOperand(Idx); - } + } else + Idx = 0; + + // If Idx is set, the operands at Idx and Idx+1 must be removed. + // We reuse the location to avoid expensive RemoveOperand calls. + DenseMap::iterator LI=SSAUpdateVals.find(Reg); if (LI != SSAUpdateVals.end()) { // This register is defined in the tail block. for (unsigned j = 0, ee = LI->second.size(); j != ee; ++j) { MachineBasicBlock *SrcBB = LI->second[j].first; unsigned SrcReg = LI->second[j].second; - II->addOperand(MachineOperand::CreateReg(SrcReg, false)); - II->addOperand(MachineOperand::CreateMBB(SrcBB)); + if (Idx != 0) { + II->getOperand(Idx).setReg(SrcReg); + II->getOperand(Idx+1).setMBB(SrcBB); + Idx = 0; + } else { + II->addOperand(MachineOperand::CreateReg(SrcReg, false)); + II->addOperand(MachineOperand::CreateMBB(SrcBB)); + } } } else { // Live in tail block, must also be live in predecessors. for (unsigned j = 0, ee = TDBBs.size(); j != ee; ++j) { MachineBasicBlock *SrcBB = TDBBs[j]; - II->addOperand(MachineOperand::CreateReg(Reg, false)); - II->addOperand(MachineOperand::CreateMBB(SrcBB)); + if (Idx != 0) { + II->getOperand(Idx).setReg(Reg); + II->getOperand(Idx+1).setMBB(SrcBB); + Idx = 0; + } else { + II->addOperand(MachineOperand::CreateReg(Reg, false)); + II->addOperand(MachineOperand::CreateMBB(SrcBB)); + } } } + if (Idx != 0) { + II->RemoveOperand(Idx+1); + II->RemoveOperand(Idx); + } } } } From clattner at apple.com Wed Feb 10 18:48:45 2010 From: clattner at apple.com (Chris Lattner) Date: Wed, 10 Feb 2010 16:48:45 -0800 Subject: [llvm-commits] [llvm] r95831 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp In-Reply-To: <201002110034.o1B0YLVi026370@zion.cs.uiuc.edu> References: <201002110034.o1B0YLVi026370@zion.cs.uiuc.edu> Message-ID: On Feb 10, 2010, at 4:34 PM, Jakob Stoklund Olesen wrote: > Author: stoklund > Date: Wed Feb 10 18:34:18 2010 > New Revision: 95831 > > URL: http://llvm.org/viewvc/llvm-project?rev=95831&view=rev > Log: > Remove duplicate successors from indirectbr instructions before building the machine CFG. > > This makes early tail duplication run 60 times faster when compiling the Firefox > JavaScript interpreter, see PR6186. Nice speedup! Please use SmallVector and array_pod_sort instead of vector and sort, -Chris > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95831&r1=95830&r2=95831&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 18:34:18 2010 > @@ -2062,9 +2062,15 @@ > } > > void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) { > - // Update machine-CFG edges. > + // Update machine-CFG edges with unique successors. > + std::vector succs; > + succs.reserve(I.getNumSuccessors()); > for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i) > - CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]); > + succs.push_back(I.getSuccessor(i)); > + std::sort(succs.begin(), succs.end()); > + succs.erase(std::unique(succs.begin(), succs.end()), succs.end()); > + for (unsigned i = 0, e = succs.size(); i != e; ++i) > + CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]); > > DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(), > MVT::Other, getControlRoot(), > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jyasskin at google.com Wed Feb 10 19:07:39 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Thu, 11 Feb 2010 01:07:39 -0000 Subject: [llvm-commits] [llvm] r95837 - in /llvm/trunk: docs/ReleaseNotes.html lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/MultiJITTest.cpp Message-ID: <201002110107.o1B17ejG028192@zion.cs.uiuc.edu> Author: jyasskin Date: Wed Feb 10 19:07:39 2010 New Revision: 95837 URL: http://llvm.org/viewvc/llvm-project?rev=95837&view=rev Log: Make it possible to create multiple JIT instances at the same time, by removing the global TheJIT and TheJITResolver variables. Lazy compilation is supported by a global map from a stub address to the JITResolver that knows how to compile it. Patch by Olivier Meurant! Added: llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp Modified: llvm/trunk/docs/ReleaseNotes.html llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.h llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=95837&r1=95836&r2=95837&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Wed Feb 10 19:07:39 2010 @@ -467,6 +467,10 @@ to compiling eagerly to avoid a race condition in the lazy JIT. Clients that still want the lazy JIT can switch it on by calling ExecutionEngine::DisableLazyCompilation(false). +
  • It is now possible to create more than one JIT instance in the same process. +These JITs can generate machine code in parallel, +although you +still have to obey the other threading restrictions.
  • Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=95837&r1=95836&r2=95837&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Feb 10 19:07:39 2010 @@ -18,6 +18,7 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/Instructions.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/JITCodeEmitter.h" #include "llvm/CodeGen/MachineCodeInfo.h" #include "llvm/ExecutionEngine/GenericValue.h" @@ -27,6 +28,7 @@ #include "llvm/Target/TargetJITInfo.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MutexGuard.h" #include "llvm/System/DynamicLibrary.h" #include "llvm/Config/config.h" @@ -237,9 +239,53 @@ } } +namespace { +/// This class supports the global getPointerToNamedFunction(), which allows +/// bugpoint or gdb users to search for a function by name without any context. +class JitPool { + SmallPtrSet JITs; // Optimize for process containing just 1 JIT. + mutable sys::Mutex Lock; +public: + void Add(JIT *jit) { + MutexGuard guard(Lock); + JITs.insert(jit); + } + void Remove(JIT *jit) { + MutexGuard guard(Lock); + JITs.erase(jit); + } + void *getPointerToNamedFunction(const char *Name) const { + MutexGuard guard(Lock); + assert(JITs.size() != 0 && "No Jit registered"); + //search function in every instance of JIT + for (SmallPtrSet::const_iterator Jit = JITs.begin(), + end = JITs.end(); + Jit != end; ++Jit) { + if (Function *F = (*Jit)->FindFunctionNamed(Name)) + return (*Jit)->getPointerToFunction(F); + } + // The function is not available : fallback on the first created (will + // search in symbol of the current program/library) + return (*JITs.begin())->getPointerToNamedFunction(Name); + } +}; +ManagedStatic AllJits; +} +extern "C" { + // getPointerToNamedFunction - This function is used as a global wrapper to + // JIT::getPointerToNamedFunction for the purpose of resolving symbols when + // bugpoint is debugging the JIT. In that scenario, we are loading an .so and + // need to resolve function(s) that are being mis-codegenerated, so we need to + // resolve their addresses at runtime, and this is the way to do it. + void *getPointerToNamedFunction(const char *Name) { + return AllJits->getPointerToNamedFunction(Name); + } +} + JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, JITMemoryManager *JMM, CodeGenOpt::Level OptLevel, bool GVsWithCode) - : ExecutionEngine(M), TM(tm), TJI(tji), AllocateGVsWithCode(GVsWithCode) { + : ExecutionEngine(M), TM(tm), TJI(tji), AllocateGVsWithCode(GVsWithCode), + isAlreadyCodeGenerating(false) { setTargetData(TM.getTargetData()); jitstate = new JITState(M); @@ -247,6 +293,9 @@ // Initialize JCE JCE = createEmitter(*this, JMM, TM); + // Register in global list of all JITs. + AllJits->Add(this); + // Add target data MutexGuard locked(lock); FunctionPassManager &PM = jitstate->getPM(locked); @@ -281,6 +330,7 @@ } JIT::~JIT() { + AllJits->Remove(this); delete jitstate; delete JCE; delete &TM; @@ -570,7 +620,6 @@ } void JIT::runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked) { - static bool isAlreadyCodeGenerating = false; assert(!isAlreadyCodeGenerating && "Error: Recursive compilation detected!"); // JIT the function Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.h?rev=95837&r1=95836&r2=95837&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.h (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Wed Feb 10 19:07:39 2010 @@ -61,6 +61,10 @@ /// should be set to true. Doing so breaks freeMachineCodeForFunction. bool AllocateGVsWithCode; + /// True while the JIT is generating code. Used to assert against recursive + /// entry. + bool isAlreadyCodeGenerating; + JITState *jitstate; JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=95837&r1=95836&r2=95837&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Feb 10 19:07:39 2010 @@ -37,6 +37,7 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MutexGuard.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" @@ -57,7 +58,6 @@ STATISTIC(NumBytes, "Number of bytes of machine code compiled"); STATISTIC(NumRelos, "Number of relocations applied"); STATISTIC(NumRetries, "Number of retries with more memory"); -static JIT *TheJIT = 0; // A declaration may stop being a declaration once it's fully read from bitcode. @@ -109,9 +109,13 @@ /// particular GlobalVariable so that we can reuse them if necessary. GlobalToIndirectSymMapTy GlobalToIndirectSymMap; + /// Instance of the JIT this ResolverState serves. + JIT *TheJIT; + public: - JITResolverState() : FunctionToLazyStubMap(this), - FunctionToCallSitesMap(this) {} + JITResolverState(JIT *jit) : FunctionToLazyStubMap(this), + FunctionToCallSitesMap(this), + TheJIT(jit) {} FunctionToLazyStubMapTy& getFunctionToLazyStubMap( const MutexGuard& locked) { @@ -227,18 +231,13 @@ JITEmitter &JE; - static JITResolver *TheJITResolver; - public: - explicit JITResolver(JIT &jit, JITEmitter &je) : nextGOTIndex(0), JE(je) { - TheJIT = &jit; + /// Instance of JIT corresponding to this Resolver. + JIT *TheJIT; + public: + explicit JITResolver(JIT &jit, JITEmitter &je) + : state(&jit), nextGOTIndex(0), JE(je), TheJIT(&jit) { LazyResolverFn = jit.getJITInfo().getLazyResolverFunction(JITCompilerFn); - assert(TheJITResolver == 0 && "Multiple JIT resolvers?"); - TheJITResolver = this; - } - - ~JITResolver() { - TheJITResolver = 0; } /// getLazyFunctionStubIfAvailable - This returns a pointer to a function's @@ -273,6 +272,44 @@ static void *JITCompilerFn(void *Stub); }; + class StubToResolverMapTy { + /// Map a stub address to a specific instance of a JITResolver so that + /// lazily-compiled functions can find the right resolver to use. + /// + /// Guarded by Lock. + std::map Map; + + /// Guards Map from concurrent accesses. + mutable sys::Mutex Lock; + + public: + /// Registers a Stub to be resolved by Resolver. + void RegisterStubResolver(void *Stub, JITResolver *Resolver) { + MutexGuard guard(Lock); + Map.insert(std::make_pair(Stub, Resolver)); + } + /// Unregisters the Stub when it's invalidated. + void UnregisterStubResolver(void *Stub) { + MutexGuard guard(Lock); + Map.erase(Stub); + } + /// Returns the JITResolver instance that owns the Stub. + JITResolver *getResolverFromStub(void *Stub) const { + MutexGuard guard(Lock); + // The address given to us for the stub may not be exactly right, it might + // be a little bit after the stub. As such, use upper_bound to find it. + // This is the same trick as in LookupFunctionFromCallSite from + // JITResolverState. + std::map::const_iterator I = Map.upper_bound(Stub); + assert(I != Map.begin() && "This is not a known stub!"); + --I; + return I->second; + } + }; + /// This needs to be static so that a lazy call stub can access it with no + /// context except the address of the stub. + ManagedStatic StubToResolverMap; + /// JITEmitter - The JIT implementation of the MachineCodeEmitter, which is /// used to output functions to memory for execution. class JITEmitter : public JITCodeEmitter { @@ -371,10 +408,13 @@ DILocation PrevDLT; + /// Instance of the JIT + JIT *TheJIT; + public: JITEmitter(JIT &jit, JITMemoryManager *JMM, TargetMachine &TM) : SizeEstimate(0), Resolver(jit, *this), MMI(0), CurFn(0), - EmittedFunctions(this), PrevDLT(NULL) { + EmittedFunctions(this), PrevDLT(NULL), TheJIT(&jit) { MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager(); if (jit.getJITInfo().needsGOT()) { MemMgr->AllocateGOT(); @@ -495,8 +535,6 @@ }; } -JITResolver *JITResolver::TheJITResolver = 0; - void CallSiteValueMapConfig::onDelete(JITResolverState *JRS, Function *F) { JRS->EraseAllCallSitesPrelocked(F); } @@ -551,6 +589,10 @@ DEBUG(dbgs() << "JIT: Lazy stub emitted at [" << Stub << "] for function '" << F->getName() << "'\n"); + // Register this JITResolver as the one corresponding to this call site so + // JITCompilerFn will be able to find it. + StubToResolverMap->RegisterStubResolver(Stub, this); + // Finally, keep track of the stub-to-Function mapping so that the // JITCompilerFn knows which function to compile! state.AddCallSite(locked, Stub, F); @@ -637,6 +679,9 @@ GlobalValue *JITResolver::invalidateStub(void *Stub) { MutexGuard locked(TheJIT->lock); + // Remove the stub from the StubToResolverMap. + StubToResolverMap->UnregisterStubResolver(Stub); + GlobalToIndirectSymMapTy &GM = state.getGlobalToIndirectSymMap(locked); // Look up the cheap way first, to see if it's a function stub we are @@ -671,7 +716,8 @@ /// been entered. It looks up which function this stub corresponds to, compiles /// it if necessary, then returns the resultant function pointer. void *JITResolver::JITCompilerFn(void *Stub) { - JITResolver &JR = *TheJITResolver; + JITResolver *JR = StubToResolverMap->getResolverFromStub(Stub); + assert(JR && "Unable to find the corresponding JITResolver to the call site"); Function* F = 0; void* ActualPtr = 0; @@ -680,24 +726,24 @@ // Only lock for getting the Function. The call getPointerToFunction made // in this function might trigger function materializing, which requires // JIT lock to be unlocked. - MutexGuard locked(TheJIT->lock); + MutexGuard locked(JR->TheJIT->lock); // The address given to us for the stub may not be exactly right, it might // be a little bit after the stub. As such, use upper_bound to find it. pair I = - JR.state.LookupFunctionFromCallSite(locked, Stub); + JR->state.LookupFunctionFromCallSite(locked, Stub); F = I.second; ActualPtr = I.first; } // If we have already code generated the function, just return the address. - void *Result = TheJIT->getPointerToGlobalIfAvailable(F); + void *Result = JR->TheJIT->getPointerToGlobalIfAvailable(F); if (!Result) { // Otherwise we don't have it, do lazy compilation now. // If lazy compilation is disabled, emit a useful error message and abort. - if (!TheJIT->isCompilingLazily()) { + if (!JR->TheJIT->isCompilingLazily()) { llvm_report_error("LLVM JIT requested to do lazy compilation of function '" + F->getName() + "' when lazy compiles are disabled!"); } @@ -706,11 +752,11 @@ << "' In stub ptr = " << Stub << " actual ptr = " << ActualPtr << "\n"); - Result = TheJIT->getPointerToFunction(F); + Result = JR->TheJIT->getPointerToFunction(F); } // Reacquire the lock to update the GOT map. - MutexGuard locked(TheJIT->lock); + MutexGuard locked(JR->TheJIT->lock); // We might like to remove the call site from the CallSiteToFunction map, but // we can't do that! Multiple threads could be stuck, waiting to acquire the @@ -725,8 +771,8 @@ // if they see it still using the stub address. // Note: this is done so the Resolver doesn't have to manage GOT memory // Do this without allocating map space if the target isn't using a GOT - if(JR.revGOTMap.find(Stub) != JR.revGOTMap.end()) - JR.revGOTMap[Result] = JR.revGOTMap[Stub]; + if(JR->revGOTMap.find(Stub) != JR->revGOTMap.end()) + JR->revGOTMap[Result] = JR->revGOTMap[Stub]; return Result; } @@ -839,7 +885,7 @@ return Size; } -static unsigned GetJumpTableSizeInBytes(MachineJumpTableInfo *MJTI) { +static unsigned GetJumpTableSizeInBytes(MachineJumpTableInfo *MJTI, JIT *jit) { const std::vector &JT = MJTI->getJumpTables(); if (JT.empty()) return 0; @@ -847,7 +893,7 @@ for (unsigned i = 0, e = JT.size(); i != e; ++i) NumEntries += JT[i].MBBs.size(); - return NumEntries * MJTI->getEntrySize(*TheJIT->getTargetData()); + return NumEntries * MJTI->getEntrySize(*jit->getTargetData()); } static uintptr_t RoundUpToAlign(uintptr_t Size, unsigned Alignment) { @@ -1032,7 +1078,7 @@ MJTI->getEntryAlignment(*TheJIT->getTargetData())); // Add the jump table size - ActualSize += GetJumpTableSizeInBytes(MJTI); + ActualSize += GetJumpTableSizeInBytes(MJTI, TheJIT); } // Add the alignment for the function @@ -1552,19 +1598,6 @@ return new JITEmitter(jit, JMM, tm); } -// getPointerToNamedFunction - This function is used as a global wrapper to -// JIT::getPointerToNamedFunction for the purpose of resolving symbols when -// bugpoint is debugging the JIT. In that scenario, we are loading an .so and -// need to resolve function(s) that are being mis-codegenerated, so we need to -// resolve their addresses at runtime, and this is the way to do it. -extern "C" { - void *getPointerToNamedFunction(const char *Name) { - if (Function *F = TheJIT->FindFunctionNamed(Name)) - return TheJIT->getPointerToFunction(F); - return TheJIT->getPointerToNamedFunction(Name); - } -} - // getPointerToFunctionOrStub - If the specified function has been // code-gen'd, return a pointer to the function. If not, compile it, or use // a stub to implement lazy compilation if available. Added: llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp?rev=95837&view=auto ============================================================================== --- llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp (added) +++ llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp Wed Feb 10 19:07:39 2010 @@ -0,0 +1,164 @@ +//===- MultiJITTest.cpp - Unit tests for instantiating multiple JITs ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/Assembly/Parser.h" +#include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/Support/SourceMgr.h" +#include + +using namespace llvm; + +namespace { + +bool LoadAssemblyInto(Module *M, const char *assembly) { + SMDiagnostic Error; + bool success = + NULL != ParseAssemblyString(assembly, M, Error, M->getContext()); + std::string errMsg; + raw_string_ostream os(errMsg); + Error.Print("", os); + EXPECT_TRUE(success) << os.str(); + return success; +} + +void createModule1(LLVMContext &Context1, Module *&M1, Function *&FooF1) { + M1 = new Module("test1", Context1); + LoadAssemblyInto(M1, + "define i32 @add1(i32 %ArgX1) { " + "entry: " + " %addresult = add i32 1, %ArgX1 " + " ret i32 %addresult " + "} " + " " + "define i32 @foo1() { " + "entry: " + " %add1 = call i32 @add1(i32 10) " + " ret i32 %add1 " + "} "); + FooF1 = M1->getFunction("foo1"); +} + +void createModule2(LLVMContext &Context2, Module *&M2, Function *&FooF2) { + M2 = new Module("test2", Context2); + LoadAssemblyInto(M2, + "define i32 @add2(i32 %ArgX2) { " + "entry: " + " %addresult = add i32 2, %ArgX2 " + " ret i32 %addresult " + "} " + " " + "define i32 @foo2() { " + "entry: " + " %add2 = call i32 @add2(i32 10) " + " ret i32 %add2 " + "} "); + FooF2 = M2->getFunction("foo2"); +} + +TEST(MultiJitTest, EagerMode) { + LLVMContext Context1; + Module *M1 = 0; + Function *FooF1 = 0; + createModule1(Context1, M1, FooF1); + + LLVMContext Context2; + Module *M2 = 0; + Function *FooF2 = 0; + createModule2(Context2, M2, FooF2); + + // Now we create the JIT in eager mode + OwningPtr EE1(EngineBuilder(M1).create()); + EE1->DisableLazyCompilation(true); + OwningPtr EE2(EngineBuilder(M2).create()); + EE2->DisableLazyCompilation(true); + + // Call the `foo' function with no arguments: + std::vector noargs; + GenericValue gv1 = EE1->runFunction(FooF1, noargs); + GenericValue gv2 = EE2->runFunction(FooF2, noargs); + + // Import result of execution: + EXPECT_EQ(gv1.IntVal, 11); + EXPECT_EQ(gv2.IntVal, 12); + + EE1->freeMachineCodeForFunction(FooF1); + EE2->freeMachineCodeForFunction(FooF2); +} + +TEST(MultiJitTest, LazyMode) { + LLVMContext Context1; + Module *M1 = 0; + Function *FooF1 = 0; + createModule1(Context1, M1, FooF1); + + LLVMContext Context2; + Module *M2 = 0; + Function *FooF2 = 0; + createModule2(Context2, M2, FooF2); + + // Now we create the JIT in lazy mode + OwningPtr EE1(EngineBuilder(M1).create()); + EE1->DisableLazyCompilation(false); + OwningPtr EE2(EngineBuilder(M2).create()); + EE2->DisableLazyCompilation(false); + + // Call the `foo' function with no arguments: + std::vector noargs; + GenericValue gv1 = EE1->runFunction(FooF1, noargs); + GenericValue gv2 = EE2->runFunction(FooF2, noargs); + + // Import result of execution: + EXPECT_EQ(gv1.IntVal, 11); + EXPECT_EQ(gv2.IntVal, 12); + + EE1->freeMachineCodeForFunction(FooF1); + EE2->freeMachineCodeForFunction(FooF2); +} + +extern "C" { + extern void *getPointerToNamedFunction(const char *Name); +} + +TEST(MultiJitTest, JitPool) { + LLVMContext Context1; + Module *M1 = 0; + Function *FooF1 = 0; + createModule1(Context1, M1, FooF1); + + LLVMContext Context2; + Module *M2 = 0; + Function *FooF2 = 0; + createModule2(Context2, M2, FooF2); + + // Now we create two JITs + OwningPtr EE1(EngineBuilder(M1).create()); + OwningPtr EE2(EngineBuilder(M2).create()); + + Function *F1 = EE1->FindFunctionNamed("foo1"); + void *foo1 = EE1->getPointerToFunction(F1); + + Function *F2 = EE2->FindFunctionNamed("foo2"); + void *foo2 = EE2->getPointerToFunction(F2); + + // Function in M1 + EXPECT_EQ(getPointerToNamedFunction("foo1"), foo1); + + // Function in M2 + EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2); + + // Symbol search + EXPECT_EQ((intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"), + (intptr_t)&getPointerToNamedFunction); +} + +} // anonymous namespace From stoklund at 2pi.dk Wed Feb 10 19:10:13 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 10 Feb 2010 17:10:13 -0800 Subject: [llvm-commits] [llvm] r95831 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp In-Reply-To: References: <201002110034.o1B0YLVi026370@zion.cs.uiuc.edu> Message-ID: <3CE8C225-EBBF-4A44-80FB-F5287214358C@2pi.dk> On Feb 10, 2010, at 4:48 PM, Chris Lattner wrote: > > On Feb 10, 2010, at 4:34 PM, Jakob Stoklund Olesen wrote: > >> Author: stoklund >> Date: Wed Feb 10 18:34:18 2010 >> New Revision: 95831 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=95831&view=rev >> Log: >> Remove duplicate successors from indirectbr instructions before building the machine CFG. >> >> This makes early tail duplication run 60 times faster when compiling the Firefox >> JavaScript interpreter, see PR6186. > > Nice speedup! Please use SmallVector Why SmallVector? The number of successors on an indirectbr varies a lot - I don't expect most of them to be less than some small integer size. > and array_pod_sort Will do. > > -Chris > >> >> Modified: >> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95831&r1=95830&r2=95831&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 18:34:18 2010 >> @@ -2062,9 +2062,15 @@ >> } >> >> void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) { >> - // Update machine-CFG edges. >> + // Update machine-CFG edges with unique successors. >> + std::vector succs; >> + succs.reserve(I.getNumSuccessors()); >> for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i) >> - CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]); >> + succs.push_back(I.getSuccessor(i)); >> + std::sort(succs.begin(), succs.end()); >> + succs.erase(std::unique(succs.begin(), succs.end()), succs.end()); >> + for (unsigned i = 0, e = succs.size(); i != e; ++i) >> + CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]); >> >> DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(), >> MVT::Other, getControlRoot(), >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From isanbard at gmail.com Wed Feb 10 19:13:03 2010 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Feb 2010 01:13:03 -0000 Subject: [llvm-commits] [llvm] r95839 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DIE.cpp DwarfPrinter.cpp Message-ID: <201002110113.o1B1D3Zp028474@zion.cs.uiuc.edu> Author: void Date: Wed Feb 10 19:13:02 2010 New Revision: 95839 URL: http://llvm.org/viewvc/llvm-project?rev=95839&view=rev Log: Don't print out a default newline when emitting the section offset. There are almost always comments afterwards that need printing. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=95839&r1=95838&r2=95839&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed Feb 10 19:13:02 2010 @@ -313,6 +313,7 @@ D->EmitSectionOffset(Label.getTag(), Section.getTag(), Label.getNumber(), Section.getNumber(), IsSmall, IsEH, UseSet); + EOL(""); // FIXME: Necesssary? } /// SizeOf - Determine size of delta value in bytes. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=95839&r1=95838&r2=95839&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Wed Feb 10 19:13:02 2010 @@ -248,7 +248,6 @@ PrintRelDirective(IsSmall); PrintLabelName("set", SetCounter, Flavor); ++SetCounter; - O << "\n"; } else { PrintRelDirective(IsSmall, true); PrintLabelName(Label, LabelNumber); @@ -257,7 +256,6 @@ O << "-"; PrintLabelName(Section, SectionNumber); } - O << "\n"; } } From isanbard at gmail.com Wed Feb 10 19:15:27 2010 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Feb 2010 01:15:27 -0000 Subject: [llvm-commits] [llvm] r95840 - /llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Message-ID: <201002110115.o1B1FSJx028580@zion.cs.uiuc.edu> Author: void Date: Wed Feb 10 19:15:27 2010 New Revision: 95840 URL: http://llvm.org/viewvc/llvm-project?rev=95840&view=rev Log: Fix to get it to compile. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=95840&r1=95839&r2=95840&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed Feb 10 19:15:27 2010 @@ -313,7 +313,7 @@ D->EmitSectionOffset(Label.getTag(), Section.getTag(), Label.getNumber(), Section.getNumber(), IsSmall, IsEH, UseSet); - EOL(""); // FIXME: Necesssary? + D->getAsm()->O << '\n'; // FIXME: Necesssary? } /// SizeOf - Determine size of delta value in bytes. From dpatel at apple.com Wed Feb 10 19:30:22 2010 From: dpatel at apple.com (Devang Patel) Date: Thu, 11 Feb 2010 01:30:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95842 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <201002110130.o1B1UM95029274@zion.cs.uiuc.edu> Author: dpatel Date: Wed Feb 10 19:30:22 2010 New Revision: 95842 URL: http://llvm.org/viewvc/llvm-project?rev=95842&view=rev Log: Pointers do not need a name. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=95842&r1=95841&r2=95842&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Feb 10 19:30:22 2010 @@ -700,7 +700,9 @@ StringRef PName = FromTy.getName(); DIType PTy = - DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)), PName, + DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)), + Tag == DW_TAG_pointer_type ? + StringRef() : PName, getOrCreateCompileUnit(NULL), 0 /*line no*/, NodeSizeInBits(type), From dpatel at apple.com Wed Feb 10 19:31:01 2010 From: dpatel at apple.com (Devang Patel) Date: Thu, 11 Feb 2010 01:31:01 -0000 Subject: [llvm-commits] [llvm] r95844 - /llvm/trunk/test/FrontendC/2010-02-10-PointerName.c Message-ID: <201002110131.o1B1V1pS029334@zion.cs.uiuc.edu> Author: dpatel Date: Wed Feb 10 19:31:01 2010 New Revision: 95844 URL: http://llvm.org/viewvc/llvm-project?rev=95844&view=rev Log: test case for r95842. Added: llvm/trunk/test/FrontendC/2010-02-10-PointerName.c Added: llvm/trunk/test/FrontendC/2010-02-10-PointerName.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2010-02-10-PointerName.c?rev=95844&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2010-02-10-PointerName.c (added) +++ llvm/trunk/test/FrontendC/2010-02-10-PointerName.c Wed Feb 10 19:31:01 2010 @@ -0,0 +1,7 @@ +// RUN: %llvmgcc %s -S -g -o - | grep DW_TAG_pointer_type | grep -v char + +char i = 1; +void foo() { + char *cp = &i; +} + From echristo at apple.com Wed Feb 10 19:48:54 2010 From: echristo at apple.com (Eric Christopher) Date: Thu, 11 Feb 2010 01:48:54 -0000 Subject: [llvm-commits] [llvm] r95846 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll Message-ID: <201002110148.o1B1msxV030178@zion.cs.uiuc.edu> Author: echristo Date: Wed Feb 10 19:48:54 2010 New Revision: 95846 URL: http://llvm.org/viewvc/llvm-project?rev=95846&view=rev Log: Add ConstantExpr handling to Intrinsic::objectsize lowering. Update testcase accordingly now that we can optimize another section. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/trunk/test/Transforms/InstCombine/objsize.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=95846&r1=95845&r2=95846&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Wed Feb 10 19:48:54 2010 @@ -308,9 +308,14 @@ Value *Op1 = II->getOperand(1); bool Min = (cast(II->getOperand(2))->getZExtValue() == 1); + // We need target data for just about everything so depend on it. if (!TD) break; + + // Get to the real allocated thing and offset as fast as possible. Op1 = Op1->stripPointerCasts(); + // If we've stripped down to a single global variable that we + // can know the size of then just return that. if (GlobalVariable *GV = dyn_cast(Op1)) { if (GV->hasDefinitiveInitializer()) { Constant *C = GV->getInitializer(); @@ -320,7 +325,27 @@ Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL); return ReplaceInstUsesWith(CI, RetVal); } - } + } else if (ConstantExpr *CE = dyn_cast(Op1)) { + + // Only handle constant GEPs here. + if (CE->getOpcode() != Instruction::GetElementPtr) break; + GEPOperator *GEP = cast(CE); + + // Get what we're pointing to and its size. + const PointerType *PT = + cast(GEP->getPointerOperand()->getType()); + size_t Size = TD->getTypeAllocSize(PT->getElementType()); + + // Get the current byte offset into the thing. + SmallVector Ops(CE->op_begin()+1, CE->op_end()); + size_t Offset = TD->getIndexedOffset(PT, &Ops[0], Ops.size()); + + assert(Size >= Offset); + + Constant *RetVal = ConstantInt::get(ReturnTy, Size-Offset); + return ReplaceInstUsesWith(CI, RetVal); + + } } case Intrinsic::bswap: // bswap(bswap(x)) -> x Modified: llvm/trunk/test/Transforms/InstCombine/objsize.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=95846&r1=95845&r2=95846&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll Wed Feb 10 19:48:54 2010 @@ -31,10 +31,9 @@ ret i8* %2; } -; FIXME: Should be ret i32 0 define i32 @f() nounwind { ; CHECK: @f -; CHECK-NEXT: llvm.objectsize.i32 +; CHECK-NEXT: ret i32 0 %1 = call i32 @llvm.objectsize.i32(i8* getelementptr ([60 x i8]* @a, i32 1, i32 0), i1 false) ret i32 %1 } From stoklund at 2pi.dk Wed Feb 10 21:06:39 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 10 Feb 2010 19:06:39 -0800 Subject: [llvm-commits] [llvm] r95831 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp In-Reply-To: <3CE8C225-EBBF-4A44-80FB-F5287214358C@2pi.dk> References: <201002110034.o1B0YLVi026370@zion.cs.uiuc.edu> <3CE8C225-EBBF-4A44-80FB-F5287214358C@2pi.dk> Message-ID: On Feb 10, 2010, at 5:10 PM, Jakob Stoklund Olesen wrote: > > On Feb 10, 2010, at 4:48 PM, Chris Lattner wrote: > >> >> On Feb 10, 2010, at 4:34 PM, Jakob Stoklund Olesen wrote: >> >>> Author: stoklund >>> Date: Wed Feb 10 18:34:18 2010 >>> New Revision: 95831 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=95831&view=rev >>> Log: >>> Remove duplicate successors from indirectbr instructions before building the machine CFG. >>> >>> This makes early tail duplication run 60 times faster when compiling the Firefox >>> JavaScript interpreter, see PR6186. >> >> Nice speedup! Please use SmallVector > > Why SmallVector? The number of successors on an indirectbr varies a lot - I don't expect most of them to be less than some small integer size. Because when using reserve() there is no overhead to SmallVector except a bit of stack space. I'll change it. /jakob From cdavis at mymail.mines.edu Wed Feb 10 18:15:09 2010 From: cdavis at mymail.mines.edu (Charles Davis) Date: Wed, 10 Feb 2010 17:15:09 -0700 Subject: [llvm-commits] [PATCH] Add the alignstack function attribute Message-ID: <4B734C0D.1030608@mymail.mines.edu> If you're subscribed to cfe-commits, you may have seen my patch to add the force_align_arg_pointer attribute to the list that clang supports. Now I'm continuing the work I began there, with this new function attribute. This attribute, which reuses the 'alignstack' keyword, is intended to force backends (primarily the x86 backend) to align stacks for generated functions to 16 bytes. It is not implemented in any backend yet; I would like to get this patch into LLVM before proceeding. Comments welcome. Chip -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: faap-support-2.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100210/472008d2/attachment.pl From clattner at apple.com Wed Feb 10 21:11:41 2010 From: clattner at apple.com (Chris Lattner) Date: Wed, 10 Feb 2010 19:11:41 -0800 Subject: [llvm-commits] [llvm] r95837 - in /llvm/trunk: docs/ReleaseNotes.html lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/MultiJITTest.cpp In-Reply-To: <201002110107.o1B17ejG028192@zion.cs.uiuc.edu> References: <201002110107.o1B17ejG028192@zion.cs.uiuc.edu> Message-ID: <9E19D3A4-065B-4875-959D-1AFA4F5F759B@apple.com> On Feb 10, 2010, at 5:07 PM, Jeffrey Yasskin wrote: > Author: jyasskin > Date: Wed Feb 10 19:07:39 2010 > New Revision: 95837 > > URL: http://llvm.org/viewvc/llvm-project?rev=95837&view=rev > Log: > Make it possible to create multiple JIT instances at the same time, by removing > the global TheJIT and TheJITResolver variables. Lazy compilation is supported > by a global map from a stub address to the JITResolver that knows how to > compile it. > > Patch by Olivier Meurant! Nice! From sabre at nondot.org Wed Feb 10 22:40:45 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 04:40:45 -0000 Subject: [llvm-commits] [llvm] r95850 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/or-undef.ll Message-ID: <201002110440.o1B4ekC4006524@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 22:40:44 2010 New Revision: 95850 URL: http://llvm.org/viewvc/llvm-project?rev=95850&view=rev Log: Make jump threading honor x|undef -> true and x&undef -> false, instead of considering x|undef -> x, which may not be true. Added: llvm/trunk/test/Transforms/JumpThreading/or-undef.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=95850&r1=95849&r2=95850&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Feb 10 22:40:44 2010 @@ -336,13 +336,18 @@ else InterestingVal = ConstantInt::getFalse(I->getContext()); - // Scan for the sentinel. + // Scan for the sentinel. If we find an undef, force it to the + // interesting value: x|undef -> true and x&undef -> false. for (unsigned i = 0, e = LHSVals.size(); i != e; ++i) - if (LHSVals[i].first == InterestingVal || LHSVals[i].first == 0) + if (LHSVals[i].first == InterestingVal || LHSVals[i].first == 0) { Result.push_back(LHSVals[i]); + Result.back().first = InterestingVal; + } for (unsigned i = 0, e = RHSVals.size(); i != e; ++i) - if (RHSVals[i].first == InterestingVal || RHSVals[i].first == 0) + if (RHSVals[i].first == InterestingVal || RHSVals[i].first == 0) { Result.push_back(RHSVals[i]); + Result.back().first = InterestingVal; + } return !Result.empty(); } Added: llvm/trunk/test/Transforms/JumpThreading/or-undef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/or-undef.ll?rev=95850&view=auto ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/or-undef.ll (added) +++ llvm/trunk/test/Transforms/JumpThreading/or-undef.ll Wed Feb 10 22:40:44 2010 @@ -0,0 +1,69 @@ +; RUN: opt -jump-threading -S %s | FileCheck %s +; rdar://7620633 + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin11.0" + +define void @test1(i8* %args, i32 %from_tty) nounwind optsize ssp { +entry: + %tmp = call i8* @f3(void (i8*)* null, i8* null) nounwind ; [#uses=1] + %tmp1 = icmp eq i8* %args, null ; [#uses=1] + br i1 %tmp1, label %bb2, label %bb + +; CHECK: entry: +; CHECK-NEXT: %tmp = call i8* @f3 +; CHECK-NEXT: %tmp1 = icmp eq i8* %args, null +; CHECK-NEXT: br i1 %tmp1, label %bb7, label %bb + +bb: ; preds = %entry + %tmp2 = call noalias i8** @buildargv(i8* %args) nounwind ; [#uses=4] + %tmp3 = icmp eq i8** %tmp2, null ; [#uses=1] + br i1 %tmp3, label %bb2, label %bb1 + +bb1: ; preds = %bb + call void @f2(i8** %tmp2) nounwind + br label %bb2 + +bb2: ; preds = %bb1, %bb, %entry + %argv.0 = phi i8** [ %tmp2, %bb1 ], [ %tmp2, %bb ], [ undef, %entry ] ; [#uses=4] + %tmp5 = icmp eq i8* %args, null ; [#uses=1] + %tmp6 = icmp eq i8** %argv.0, null ; [#uses=1] + %tmp7 = or i1 %tmp5, %tmp6 ; [#uses=1] + br i1 %tmp7, label %bb7, label %bb5 + +bb5: ; preds = %bb2 + %tmp8 = load i8** %argv.0, align 8 ; [#uses=1] + %tmp9 = icmp eq i8* %tmp8, null ; [#uses=1] + br i1 %tmp9, label %bb7, label %bb6 + +bb6: ; preds = %bb5 + %tmp10 = load i8** %argv.0, align 8 ; [#uses=1] + %tmp11 = load i8* %tmp10, align 1 ; [#uses=1] + %tmp12 = icmp eq i8 %tmp11, 0 ; [#uses=1] + br i1 %tmp12, label %bb7, label %bb8 + +bb7: ; preds = %bb6, %bb5, %bb2 + call void @f1() nounwind optsize ssp + br label %bb9 + +bb8: ; preds = %bb6 + %tmp13 = load i8** %argv.0, align 8 ; [#uses=1] + %tmp14 = call i64 @f5(i8* %tmp13) nounwind ; [#uses=0] + br label %bb9 + +bb9: ; preds = %bb8, %bb7 + call void @f4(i8* %tmp) nounwind + ret void +} + +declare noalias i8** @buildargv(i8*) + +declare void @f2(i8**) + +declare void @f4(i8*) + +declare i8* @f3(void (i8*)*, i8*) + +declare void @f1() + +declare i64 @f5(i8*) From sabre at nondot.org Wed Feb 10 23:08:22 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 05:08:22 -0000 Subject: [llvm-commits] [llvm] r95851 - /llvm/trunk/test/Transforms/GVN/crash.ll Message-ID: <201002110508.o1B58Oap008987@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 23:08:05 2010 New Revision: 95851 URL: http://llvm.org/viewvc/llvm-project?rev=95851&view=rev Log: a testcase that doesn't crash GVN but could someday. Modified: llvm/trunk/test/Transforms/GVN/crash.ll Modified: llvm/trunk/test/Transforms/GVN/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/crash.ll?rev=95851&r1=95850&r2=95851&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/crash.ll (original) +++ llvm/trunk/test/Transforms/GVN/crash.ll Wed Feb 10 23:08:05 2010 @@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-darwin10.0" -define i32* @peel_to_type(i8* %name, i32 %namelen, i32* %o, i32 %expected_type) nounwind ssp { +define i32* @test1(i8* %name, i32 %namelen, i32* %o, i32 %expected_type) nounwind ssp { entry: br i1 undef, label %if.end13, label %while.body.preheader @@ -69,7 +69,7 @@ @attribute_tables = external global [4 x %struct.attribute_spec*] ; <[4 x %struct.attribute_spec*]*> [#uses=2] -define void @decl_attributes() nounwind { +define void @test2() nounwind { entry: br label %bb69.i @@ -99,7 +99,7 @@ @g = external global i64, align 8 -define i32* @foo() { +define i32* @test3() { do.end17.i: %tmp18.i = load i7** undef %tmp1 = bitcast i7* %tmp18.i to i8* @@ -135,3 +135,19 @@ declare i32 @foo2() + + +define i32 @test4() { +entry: + ret i32 0 + +dead: + %P2 = getelementptr i32 *%P2, i32 52 + %Q2 = getelementptr i32 *%Q2, i32 52 + store i32 4, i32* %P2 + %A = load i32* %Q2 + br i1 true, label %dead, label %dead2 + +dead2: + ret i32 %A +} From sabre at nondot.org Wed Feb 10 23:12:02 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 05:12:02 -0000 Subject: [llvm-commits] [llvm] r95852 - in /llvm/trunk: lib/Transforms/Scalar/DeadStoreElimination.cpp test/Transforms/DeadStoreElimination/crash.ll Message-ID: <201002110512.o1B5C66I009302@zion.cs.uiuc.edu> Author: lattner Date: Wed Feb 10 23:11:54 2010 New Revision: 95852 URL: http://llvm.org/viewvc/llvm-project?rev=95852&view=rev Log: Make DSE only scan blocks that are reachable from the entry block. Other blocks may have pointer cycles that will crash basicaa and other alias analyses. In any case, there is no point wasting cycles optimizing dead blocks. This fixes rdar://7635088 Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=95852&r1=95851&r2=95852&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Wed Feb 10 23:11:54 2010 @@ -44,8 +44,14 @@ virtual bool runOnFunction(Function &F) { bool Changed = false; + + DominatorTree &DT = getAnalysis(); + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - Changed |= runOnBasicBlock(*I); + // Only check non-dead blocks. Dead blocks may have strange pointer + // cycles that will confuse alias analysis. + if (DT.isReachableFromEntry(I)) + Changed |= runOnBasicBlock(*I); return Changed; } Modified: llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll?rev=95852&r1=95851&r2=95852&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll (original) +++ llvm/trunk/test/Transforms/DeadStoreElimination/crash.ll Wed Feb 10 23:11:54 2010 @@ -41,3 +41,17 @@ } declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind + + +; rdar://7635088 +define i32 @test3() { +entry: + ret i32 0 + +dead: + %P2 = getelementptr i32 *%P2, i32 52 + %Q2 = getelementptr i32 *%Q2, i32 52 + store i32 4, i32* %P2 + store i32 4, i32* %Q2 + br label %dead +} \ No newline at end of file From sabre at nondot.org Thu Feb 11 00:24:37 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 06:24:37 -0000 Subject: [llvm-commits] [llvm] r95854 - /llvm/trunk/test/Transforms/InstCombine/and2.ll Message-ID: <201002110624.o1B6ObFq013238@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 00:24:37 2010 New Revision: 95854 URL: http://llvm.org/viewvc/llvm-project?rev=95854&view=rev Log: convert to filecheck. Modified: llvm/trunk/test/Transforms/InstCombine/and2.ll Modified: llvm/trunk/test/Transforms/InstCombine/and2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and2.ll?rev=95854&r1=95853&r2=95854&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/and2.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/and2.ll Thu Feb 11 00:24:37 2010 @@ -1,5 +1,4 @@ -; RUN: opt < %s -instcombine -S | not grep and - +; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1738 define i1 @test1(double %X, double %Y) { @@ -7,6 +6,5 @@ %tmp13 = fcmp ord double %Y, 0.000000e+00 %bothcond = and i1 %tmp13, %tmp9 ret i1 %bothcond +; CHECK: fcmp ord double %Y, %X } - - From sabre at nondot.org Thu Feb 11 00:26:34 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 06:26:34 -0000 Subject: [llvm-commits] [llvm] r95855 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombine.h lib/Transforms/InstCombine/InstCombineAndOrXor.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/vector-casts.ll Message-ID: <201002110626.o1B6QYw0013342@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 00:26:33 2010 New Revision: 95855 URL: http://llvm.org/viewvc/llvm-project?rev=95855&view=rev Log: Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect what it does. Enhance it to return false to optimizing vector sign extensions from vector comparisions, which is the idiom used to get a splatted vector for a vector comparison. Doing this breaks vector-casts.ll, add some compensating transformations to handle the important case they cover without depending on this canonicalization. This fixes rdar://7434900 a serious pessimization of vector compares. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombine.h llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombine.h?rev=95855&r1=95854&r2=95855&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombine.h (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombine.h Thu Feb 11 00:26:33 2010 @@ -199,11 +199,12 @@ SmallVectorImpl &NewIndices); Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI); - /// ValueRequiresCast - Return true if the cast from "V to Ty" actually - /// results in any code being generated. It does not require codegen if V is - /// simple enough or if the cast can be folded into other casts. - bool ValueRequiresCast(Instruction::CastOps opcode,const Value *V, - const Type *Ty); + /// ShouldOptimizeCast - Return true if the cast from "V to Ty" actually + /// results in any code being generated and is interesting to optimize out. If + /// the cast can be eliminated by some other simple transformation, we prefer + /// to do the simplification first. + bool ShouldOptimizeCast(Instruction::CastOps opcode,const Value *V, + const Type *Ty); Instruction *visitCallSite(CallSite CS); bool transformConstExprCastCall(CallSite CS); Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=95855&r1=95854&r2=95855&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Thu Feb 11 00:26:33 2010 @@ -932,24 +932,49 @@ if (ICmpInst *LHS = dyn_cast(Op0)) if (Instruction *Res = FoldAndOfICmps(I, LHS, RHS)) return Res; - + + // If and'ing two fcmp, try combine them into one. + if (FCmpInst *LHS = dyn_cast(I.getOperand(0))) + if (FCmpInst *RHS = dyn_cast(I.getOperand(1))) + if (Instruction *Res = FoldAndOfFCmps(I, LHS, RHS)) + return Res; + + // fold (and (cast A), (cast B)) -> (cast (and A, B)) if (CastInst *Op0C = dyn_cast(Op0)) - if (CastInst *Op1C = dyn_cast(Op1)) - if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind ? - const Type *SrcTy = Op0C->getOperand(0)->getType(); - if (SrcTy == Op1C->getOperand(0)->getType() && - SrcTy->isIntOrIntVector() && - // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), - I.getType()) && - ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), - I.getType())) { - Value *NewOp = Builder->CreateAnd(Op0C->getOperand(0), - Op1C->getOperand(0), I.getName()); + if (CastInst *Op1C = dyn_cast(Op1)) { + const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (Op0C->getOpcode() == Op1C->getOpcode() && // same cast kind ? + SrcTy == Op1C->getOperand(0)->getType() && + SrcTy->isIntOrIntVector()) { + Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0); + + // Only do this if the casts both really cause code to be generated. + if (ShouldOptimizeCast(Op0C->getOpcode(), Op0COp, I.getType()) && + ShouldOptimizeCast(Op1C->getOpcode(), Op1COp, I.getType())) { + Value *NewOp = Builder->CreateAnd(Op0COp, Op1COp, I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); } + + // If this is and(cast(icmp), cast(icmp)), try to fold this even if the + // cast is otherwise not optimizable. This happens for vector sexts. + if (ICmpInst *RHS = dyn_cast(Op1COp)) + if (ICmpInst *LHS = dyn_cast(Op0COp)) + if (Instruction *Res = FoldAndOfICmps(I, LHS, RHS)) { + InsertNewInstBefore(Res, I); + return CastInst::Create(Op0C->getOpcode(), Res, I.getType()); + } + + // If this is and(cast(fcmp), cast(fcmp)), try to fold this even if the + // cast is otherwise not optimizable. This happens for vector sexts. + if (FCmpInst *RHS = dyn_cast(Op1COp)) + if (FCmpInst *LHS = dyn_cast(Op0COp)) + if (Instruction *Res = FoldAndOfFCmps(I, LHS, RHS)) { + InsertNewInstBefore(Res, I); + return CastInst::Create(Op0C->getOpcode(), Res, I.getType()); + } } + } // (X >> Z) & (Y >> Z) -> (X&Y) >> Z for all shifts. if (BinaryOperator *SI1 = dyn_cast(Op1)) { @@ -965,13 +990,6 @@ } } - // If and'ing two fcmp, try combine them into one. - if (FCmpInst *LHS = dyn_cast(I.getOperand(0))) { - if (FCmpInst *RHS = dyn_cast(I.getOperand(1))) - if (Instruction *Res = FoldAndOfFCmps(I, LHS, RHS)) - return Res; - } - return Changed ? &I : 0; } @@ -1669,37 +1687,51 @@ if (Instruction *Res = FoldOrOfICmps(I, LHS, RHS)) return Res; + // (fcmp uno x, c) | (fcmp uno y, c) -> (fcmp uno x, y) + if (FCmpInst *LHS = dyn_cast(I.getOperand(0))) + if (FCmpInst *RHS = dyn_cast(I.getOperand(1))) + if (Instruction *Res = FoldOrOfFCmps(I, LHS, RHS)) + return Res; + // fold (or (cast A), (cast B)) -> (cast (or A, B)) if (CastInst *Op0C = dyn_cast(Op0)) { if (CastInst *Op1C = dyn_cast(Op1)) if (Op0C->getOpcode() == Op1C->getOpcode()) {// same cast kind ? - if (!isa(Op0C->getOperand(0)) || - !isa(Op1C->getOperand(0))) { - const Type *SrcTy = Op0C->getOperand(0)->getType(); - if (SrcTy == Op1C->getOperand(0)->getType() && - SrcTy->isIntOrIntVector() && + const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (SrcTy == Op1C->getOperand(0)->getType() && + SrcTy->isIntOrIntVector()) { + Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0); + + if ((!isa(Op0COp) || !isa(Op1COp)) && // Only do this if the casts both really cause code to be // generated. - ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), - I.getType()) && - ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), - I.getType())) { - Value *NewOp = Builder->CreateOr(Op0C->getOperand(0), - Op1C->getOperand(0), I.getName()); + ShouldOptimizeCast(Op0C->getOpcode(), Op0COp, I.getType()) && + ShouldOptimizeCast(Op1C->getOpcode(), Op1COp, I.getType())) { + Value *NewOp = Builder->CreateOr(Op0COp, Op1COp, I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); } + + // If this is or(cast(icmp), cast(icmp)), try to fold this even if the + // cast is otherwise not optimizable. This happens for vector sexts. + if (ICmpInst *RHS = dyn_cast(Op1COp)) + if (ICmpInst *LHS = dyn_cast(Op0COp)) + if (Instruction *Res = FoldOrOfICmps(I, LHS, RHS)) { + InsertNewInstBefore(Res, I); + return CastInst::Create(Op0C->getOpcode(), Res, I.getType()); + } + + // If this is or(cast(fcmp), cast(fcmp)), try to fold this even if the + // cast is otherwise not optimizable. This happens for vector sexts. + if (FCmpInst *RHS = dyn_cast(Op1COp)) + if (FCmpInst *LHS = dyn_cast(Op0COp)) + if (Instruction *Res = FoldOrOfFCmps(I, LHS, RHS)) { + InsertNewInstBefore(Res, I); + return CastInst::Create(Op0C->getOpcode(), Res, I.getType()); + } } } } - - // (fcmp uno x, c) | (fcmp uno y, c) -> (fcmp uno x, y) - if (FCmpInst *LHS = dyn_cast(I.getOperand(0))) { - if (FCmpInst *RHS = dyn_cast(I.getOperand(1))) - if (Instruction *Res = FoldOrOfFCmps(I, LHS, RHS)) - return Res; - } - return Changed ? &I : 0; } @@ -1986,10 +2018,10 @@ const Type *SrcTy = Op0C->getOperand(0)->getType(); if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isInteger() && // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), - I.getType()) && - ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), - I.getType())) { + ShouldOptimizeCast(Op0C->getOpcode(), Op0C->getOperand(0), + I.getType()) && + ShouldOptimizeCast(Op1C->getOpcode(), Op1C->getOperand(0), + I.getType())) { Value *NewOp = Builder->CreateXor(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=95855&r1=95854&r2=95855&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Thu Feb 11 00:26:33 2010 @@ -255,17 +255,26 @@ return Instruction::CastOps(Res); } -/// ValueRequiresCast - Return true if the cast from "V to Ty" actually results -/// in any code being generated. It does not require codegen if V is simple -/// enough or if the cast can be folded into other casts. -bool InstCombiner::ValueRequiresCast(Instruction::CastOps opcode,const Value *V, - const Type *Ty) { +/// ShouldOptimizeCast - Return true if the cast from "V to Ty" actually +/// results in any code being generated and is interesting to optimize out. If +/// the cast can be eliminated by some other simple transformation, we prefer +/// to do the simplification first. +bool InstCombiner::ShouldOptimizeCast(Instruction::CastOps opc, const Value *V, + const Type *Ty) { + // Noop casts and casts of constants should be eliminated trivially. if (V->getType() == Ty || isa(V)) return false; - // If this is another cast that can be eliminated, it isn't codegen either. + // If this is another cast that can be eliminated, we prefer to have it + // eliminated. if (const CastInst *CI = dyn_cast(V)) - if (isEliminableCastPair(CI, opcode, Ty, TD)) + if (isEliminableCastPair(CI, opc, Ty, TD)) return false; + + // If this is a vector sext from a compare, then we don't want to break the + // idiom where each element of the extended vector is either zero or all ones. + if (opc == Instruction::SExt && isa(V) && isa(Ty)) + return false; + return true; } Modified: llvm/trunk/test/Transforms/InstCombine/vector-casts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vector-casts.ll?rev=95855&r1=95854&r2=95855&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/vector-casts.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Thu Feb 11 00:26:33 2010 @@ -51,6 +51,22 @@ } +; rdar://7434900 +define <2 x i64> @test5(<4 x float> %a, <4 x float> %b) nounwind readnone { +entry: + %cmp = fcmp ult <4 x float> %a, zeroinitializer + %sext = sext <4 x i1> %cmp to <4 x i32> + %cmp4 = fcmp ult <4 x float> %b, zeroinitializer + %sext5 = sext <4 x i1> %cmp4 to <4 x i32> + %and = and <4 x i32> %sext, %sext5 + %conv = bitcast <4 x i32> %and to <2 x i64> + ret <2 x i64> %conv + +; CHECK: @test5 +; CHECK: sext <4 x i1> %cmp to <4 x i32> +; CHECK: sext <4 x i1> %cmp4 to <4 x i32> +} + define void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind { entry: From jyasskin at google.com Thu Feb 11 00:41:30 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Thu, 11 Feb 2010 06:41:30 -0000 Subject: [llvm-commits] [llvm] r95856 - in /llvm/trunk: include/llvm/DerivedTypes.h include/llvm/Support/SourceMgr.h lib/VMCore/LLVMContextImpl.h lib/VMCore/Type.cpp unittests/VMCore/DerivedTypesTest.cpp Message-ID: <201002110641.o1B6fUgb014404@zion.cs.uiuc.edu> Author: jyasskin Date: Thu Feb 11 00:41:30 2010 New Revision: 95856 URL: http://llvm.org/viewvc/llvm-project?rev=95856&view=rev Log: Fix some of the memcheck errors found in the JIT unittests. Modified: llvm/trunk/include/llvm/DerivedTypes.h llvm/trunk/include/llvm/Support/SourceMgr.h llvm/trunk/lib/VMCore/LLVMContextImpl.h llvm/trunk/lib/VMCore/Type.cpp llvm/trunk/unittests/VMCore/DerivedTypesTest.cpp Modified: llvm/trunk/include/llvm/DerivedTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=95856&r1=95855&r2=95856&view=diff ============================================================================== --- llvm/trunk/include/llvm/DerivedTypes.h (original) +++ llvm/trunk/include/llvm/DerivedTypes.h Thu Feb 11 00:41:30 2010 @@ -496,6 +496,7 @@ /// OpaqueType - Class to represent abstract types /// class OpaqueType : public DerivedType { + friend class LLVMContextImpl; OpaqueType(const OpaqueType &); // DO NOT IMPLEMENT const OpaqueType &operator=(const OpaqueType &); // DO NOT IMPLEMENT OpaqueType(LLVMContext &C); Modified: llvm/trunk/include/llvm/Support/SourceMgr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=95856&r1=95855&r2=95856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/SourceMgr.h (original) +++ llvm/trunk/include/llvm/Support/SourceMgr.h Thu Feb 11 00:41:30 2010 @@ -132,7 +132,7 @@ unsigned ShowLine : 1; public: - SMDiagnostic() : LineNo(0), ColumnNo(0) {} + SMDiagnostic() : LineNo(0), ColumnNo(0), ShowLine(0) {} SMDiagnostic(const std::string &FN, int Line, int Col, const std::string &Msg, const std::string &LineStr, bool showline = true) Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=95856&r1=95855&r2=95856&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original) +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Thu Feb 11 00:41:30 2010 @@ -164,7 +164,10 @@ // Opaque types are not structurally uniqued, so don't use TypeMap. typedef SmallPtrSet OpaqueTypesTy; OpaqueTypesTy OpaqueTypes; - + + /// Used as an abstract type that will never be resolved. + OpaqueType *const AlwaysOpaqueTy; + /// ValueHandles - This map keeps track of all of the value handles that are /// watching a Value*. The Value::HasValueHandle bit is used to know @@ -196,7 +199,12 @@ Int8Ty(C, 8), Int16Ty(C, 16), Int32Ty(C, 32), - Int64Ty(C, 64) { } + Int64Ty(C, 64), + AlwaysOpaqueTy(new OpaqueType(C)) { + // Make sure the AlwaysOpaqueTy stays alive as long as the Context. + AlwaysOpaqueTy->addRef(); + OpaqueTypes.insert(AlwaysOpaqueTy); + } ~LLVMContextImpl() { ExprConstants.freeConstants(); @@ -217,6 +225,7 @@ delete I->second; } MDNodeSet.clear(); + AlwaysOpaqueTy->dropRef(); for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end(); I != E; ++I) { (*I)->AbstractTypeUsers.clear(); Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=95856&r1=95855&r2=95856&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Thu Feb 11 00:41:30 2010 @@ -507,30 +507,7 @@ if (NumContainedTys != 0) { // The type must stay abstract. To do this, we insert a pointer to a type // that will never get resolved, thus will always be abstract. - static Type *AlwaysOpaqueTy = 0; - static PATypeHolder* Holder = 0; - Type *tmp = AlwaysOpaqueTy; - if (llvm_is_multithreaded()) { - sys::MemoryFence(); - if (!tmp) { - llvm_acquire_global_lock(); - tmp = AlwaysOpaqueTy; - if (!tmp) { - tmp = OpaqueType::get(getContext()); - PATypeHolder* tmp2 = new PATypeHolder(tmp); - sys::MemoryFence(); - AlwaysOpaqueTy = tmp; - Holder = tmp2; - } - - llvm_release_global_lock(); - } - } else if (!AlwaysOpaqueTy) { - AlwaysOpaqueTy = OpaqueType::get(getContext()); - Holder = new PATypeHolder(AlwaysOpaqueTy); - } - - ContainedTys[0] = AlwaysOpaqueTy; + ContainedTys[0] = getContext().pImpl->AlwaysOpaqueTy; // Change the rest of the types to be Int32Ty's. It doesn't matter what we // pick so long as it doesn't point back to this type. We choose something Modified: llvm/trunk/unittests/VMCore/DerivedTypesTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/DerivedTypesTest.cpp?rev=95856&r1=95855&r2=95856&view=diff ============================================================================== --- llvm/trunk/unittests/VMCore/DerivedTypesTest.cpp (original) +++ llvm/trunk/unittests/VMCore/DerivedTypesTest.cpp Thu Feb 11 00:41:30 2010 @@ -18,14 +18,16 @@ TEST(OpaqueTypeTest, RegisterWithContext) { LLVMContext C; - LLVMContextImpl *pImpl = C.pImpl; + LLVMContextImpl *pImpl = C.pImpl; - EXPECT_EQ(0u, pImpl->OpaqueTypes.size()); + // 1 refers to the AlwaysOpaqueTy allocated in the Context's constructor and + // destroyed in the destructor. + EXPECT_EQ(1u, pImpl->OpaqueTypes.size()); { PATypeHolder Type = OpaqueType::get(C); - EXPECT_EQ(1u, pImpl->OpaqueTypes.size()); + EXPECT_EQ(2u, pImpl->OpaqueTypes.size()); } - EXPECT_EQ(0u, pImpl->OpaqueTypes.size()); + EXPECT_EQ(1u, pImpl->OpaqueTypes.size()); } } // namespace From sabre at nondot.org Thu Feb 11 00:49:52 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 06:49:52 -0000 Subject: [llvm-commits] [llvm] r95857 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002110649.o1B6nqxj014780@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 00:49:52 2010 New Revision: 95857 URL: http://llvm.org/viewvc/llvm-project?rev=95857&view=rev Log: eliminate the dead "PCAdj" logic. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95857&r1=95856&r2=95857&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 00:49:52 2010 @@ -83,7 +83,7 @@ } } - void EmitDisplacementField(const MCOperand &Disp, int64_t Adj, bool IsPCRel, + void EmitDisplacementField(const MCOperand &Disp, bool IsPCRel, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const; @@ -106,7 +106,7 @@ void EmitMemModRMByte(const MCInst &MI, unsigned Op, - unsigned RegOpcodeField, intptr_t PCAdj, + unsigned RegOpcodeField, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const; @@ -136,7 +136,7 @@ } void X86MCCodeEmitter:: -EmitDisplacementField(const MCOperand &DispOp, int64_t Adj, bool IsPCRel, +EmitDisplacementField(const MCOperand &DispOp, bool IsPCRel, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const { // If this is a simple integer displacement that doesn't require a relocation, @@ -163,7 +163,6 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, - intptr_t PCAdj, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const{ @@ -191,7 +190,7 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); - EmitDisplacementField(Disp, PCAdj, true, CurByte, OS, Fixups); + EmitDisplacementField(Disp, true, CurByte, OS, Fixups); return; } @@ -215,7 +214,7 @@ // Otherwise, emit the most general non-SIB encoding: [REG+disp32] EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), CurByte, OS); - EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS, Fixups); + EmitDisplacementField(Disp, IsPCRel, CurByte, OS, Fixups); return; } @@ -272,7 +271,7 @@ if (ForceDisp8) EmitConstant(Disp.getImm(), 1, CurByte, OS); else if (ForceDisp32 || Disp.getImm() != 0) - EmitDisplacementField(Disp, PCAdj, IsPCRel, CurByte, OS, Fixups); + EmitDisplacementField(Disp, IsPCRel, CurByte, OS, Fixups); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 @@ -523,7 +522,7 @@ EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, GetX86RegNum(MI.getOperand(CurOp + X86AddrNumOperands)), - 0, CurByte, OS, Fixups); + CurByte, OS, Fixups); CurOp += X86AddrNumOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), @@ -551,12 +550,8 @@ else AddrOperands = X86AddrNumOperands; - // FIXME: What is this actually doing? - intptr_t PCAdj = (CurOp + AddrOperands + 1 != NumOps) ? - X86II::getSizeOfImm(TSFlags) : 0; - EmitMemModRMByte(MI, CurOp+1, GetX86RegNum(MI.getOperand(CurOp)), - PCAdj, CurByte, OS, Fixups); + CurByte, OS, Fixups); CurOp += AddrOperands + 1; if (CurOp != NumOps) EmitConstant(MI.getOperand(CurOp++).getImm(), @@ -620,17 +615,9 @@ case X86II::MRM2m: case X86II::MRM3m: case X86II::MRM4m: case X86II::MRM5m: case X86II::MRM6m: case X86II::MRM7m: { - intptr_t PCAdj = 0; - if (CurOp + X86AddrNumOperands != NumOps) { - if (MI.getOperand(CurOp+X86AddrNumOperands).isImm()) - PCAdj = X86II::getSizeOfImm(TSFlags); - else - PCAdj = 4; - } - EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, (TSFlags & X86II::FormMask)-X86II::MRM0m, - PCAdj, CurByte, OS, Fixups); + CurByte, OS, Fixups); CurOp += X86AddrNumOperands; if (CurOp == NumOps) From sabre at nondot.org Thu Feb 11 00:51:36 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 06:51:36 -0000 Subject: [llvm-commits] [llvm] r95858 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002110651.o1B6pai2014867@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 00:51:36 2010 New Revision: 95858 URL: http://llvm.org/viewvc/llvm-project?rev=95858&view=rev Log: eliminate the dead IsPCRel argument. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95858&r1=95857&r2=95858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 00:51:36 2010 @@ -83,8 +83,8 @@ } } - void EmitDisplacementField(const MCOperand &Disp, bool IsPCRel, - unsigned &CurByte, raw_ostream &OS, + void EmitDisplacementField(const MCOperand &Disp, unsigned &CurByte, + raw_ostream &OS, SmallVectorImpl &Fixups) const; inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, @@ -136,7 +136,7 @@ } void X86MCCodeEmitter:: -EmitDisplacementField(const MCOperand &DispOp, bool IsPCRel, +EmitDisplacementField(const MCOperand &DispOp, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const { // If this is a simple integer displacement that doesn't require a relocation, @@ -172,9 +172,6 @@ const MCOperand &IndexReg = MI.getOperand(Op+2); unsigned BaseReg = Base.getReg(); - // FIXME: Eliminate! - bool IsPCRel = false; - // Determine whether a SIB byte is needed. // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table @@ -190,7 +187,7 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); - EmitDisplacementField(Disp, true, CurByte, OS, Fixups); + EmitDisplacementField(Disp, CurByte, OS, Fixups); return; } @@ -214,7 +211,7 @@ // Otherwise, emit the most general non-SIB encoding: [REG+disp32] EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), CurByte, OS); - EmitDisplacementField(Disp, IsPCRel, CurByte, OS, Fixups); + EmitDisplacementField(Disp, CurByte, OS, Fixups); return; } @@ -271,7 +268,7 @@ if (ForceDisp8) EmitConstant(Disp.getImm(), 1, CurByte, OS); else if (ForceDisp32 || Disp.getImm() != 0) - EmitDisplacementField(Disp, IsPCRel, CurByte, OS, Fixups); + EmitDisplacementField(Disp, CurByte, OS, Fixups); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 From sabre at nondot.org Thu Feb 11 00:54:23 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 06:54:23 -0000 Subject: [llvm-commits] [llvm] r95859 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002110654.o1B6sORO015002@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 00:54:23 2010 New Revision: 95859 URL: http://llvm.org/viewvc/llvm-project?rev=95859&view=rev Log: generalize EmitDisplacementField to work with any size and rename it to EmitImmediate. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95859&r1=95858&r2=95859&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 00:54:23 2010 @@ -83,9 +83,9 @@ } } - void EmitDisplacementField(const MCOperand &Disp, unsigned &CurByte, - raw_ostream &OS, - SmallVectorImpl &Fixups) const; + void EmitImmediate(const MCOperand &Disp, unsigned ImmSize, + unsigned &CurByte, raw_ostream &OS, + SmallVectorImpl &Fixups) const; inline static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, unsigned RM) { @@ -136,19 +136,18 @@ } void X86MCCodeEmitter:: -EmitDisplacementField(const MCOperand &DispOp, - unsigned &CurByte, raw_ostream &OS, - SmallVectorImpl &Fixups) const { +EmitImmediate(const MCOperand &DispOp, unsigned Size, + unsigned &CurByte, raw_ostream &OS, + SmallVectorImpl &Fixups) const { // If this is a simple integer displacement that doesn't require a relocation, // emit it now. if (DispOp.isImm()) { - EmitConstant(DispOp.getImm(), 4, CurByte, OS); + EmitConstant(DispOp.getImm(), Size, CurByte, OS); return; } + // FIXME: Pass in the relocation type. #if 0 - // Otherwise, this is something that requires a relocation. Emit it as such - // now. unsigned RelocType = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); @@ -157,7 +156,7 @@ // Emit a symbolic constant as a fixup and 4 zeros. Fixups.push_back(MCFixup::Create(CurByte, DispOp.getExpr(), MCFixupKind(X86::reloc_absolute_word))); - EmitConstant(0, 4, CurByte, OS); + EmitConstant(0, Size, CurByte, OS); } @@ -187,7 +186,7 @@ if (BaseReg == 0 || // [disp32] in X86-32 mode BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); - EmitDisplacementField(Disp, CurByte, OS, Fixups); + EmitImmediate(Disp, 4, CurByte, OS, Fixups); return; } @@ -211,7 +210,7 @@ // Otherwise, emit the most general non-SIB encoding: [REG+disp32] EmitByte(ModRMByte(2, RegOpcodeField, BaseRegNo), CurByte, OS); - EmitDisplacementField(Disp, CurByte, OS, Fixups); + EmitImmediate(Disp, 4, CurByte, OS, Fixups); return; } @@ -266,9 +265,9 @@ // Do we need to output a displacement? if (ForceDisp8) - EmitConstant(Disp.getImm(), 1, CurByte, OS); + EmitImmediate(Disp, 1, CurByte, OS, Fixups); else if (ForceDisp32 || Disp.getImm() != 0) - EmitDisplacementField(Disp, CurByte, OS, Fixups); + EmitImmediate(Disp, 4, CurByte, OS, Fixups); } /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 From sabre at nondot.org Thu Feb 11 01:06:31 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 07:06:31 -0000 Subject: [llvm-commits] [llvm] r95860 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002110706.o1B76VEp015692@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 01:06:31 2010 New Revision: 95860 URL: http://llvm.org/viewvc/llvm-project?rev=95860&view=rev Log: Add and commonize encoder support for all immediates. Stub out some dummy fixups to make things work. We can now emit fixups like this: subl $20, %esp ## encoding: [0x83,0xec,A] ## fixup A - offset: 2, value: 20, kind: fixup_1byte_imm Emitting $20 as a single-byte fixup to be later resolved by the assembler is ridiculous of course (vs just emitting the byte) but this is a failure of the matcher, which should be producing an imm of 20, not an MCExpr of 20. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95860&r1=95859&r2=95860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 01:06:31 2010 @@ -23,11 +23,11 @@ namespace llvm { namespace X86 { enum Fixups { - reloc_pcrel_word = FirstTargetFixupKind, - reloc_picrel_word, - reloc_absolute_word, - reloc_absolute_word_sext, - reloc_absolute_dword + // FIXME: This is just a stub. + fixup_1byte_imm = FirstTargetFixupKind, + fixup_2byte_imm, + fixup_4byte_imm, + fixup_8byte_imm }; } } @@ -48,16 +48,15 @@ ~X86MCCodeEmitter() {} unsigned getNumFixupKinds() const { - return 5; + return 4; } MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { static MCFixupKindInfo Infos[] = { - { "reloc_pcrel_word", 0, 4 * 8 }, - { "reloc_picrel_word", 0, 4 * 8 }, - { "reloc_absolute_word", 0, 4 * 8 }, - { "reloc_absolute_word_sext", 0, 4 * 8 }, - { "reloc_absolute_dword", 0, 8 * 8 } + { "fixup_1byte_imm", 0, 1 * 8 }, + { "fixup_2byte_imm", 0, 2 * 8 }, + { "fixup_4byte_imm", 0, 4 * 8 }, + { "fixup_8byte_imm", 0, 8 * 8 } }; assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind && @@ -146,16 +145,22 @@ return; } - // FIXME: Pass in the relocation type. -#if 0 - unsigned RelocType = Is64BitMode ? - (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); -#endif + // FIXME: Pass in the relocation type, this is just a hack.. + unsigned FixupKind; + if (Size == 1) + FixupKind = X86::fixup_1byte_imm; + else if (Size == 2) + FixupKind = X86::fixup_2byte_imm; + else if (Size == 4) + FixupKind = X86::fixup_4byte_imm; + else { + assert(Size == 8 && "Unknown immediate size"); + FixupKind = X86::fixup_8byte_imm; + } // Emit a symbolic constant as a fixup and 4 zeros. Fixups.push_back(MCFixup::Create(CurByte, DispOp.getExpr(), - MCFixupKind(X86::reloc_absolute_word))); + MCFixupKind(FixupKind))); EmitConstant(0, Size, CurByte, OS); } @@ -204,7 +209,7 @@ // Otherwise, if the displacement fits in a byte, encode as [REG+disp8]. if (Disp.isImm() && isDisp8(Disp.getImm())) { EmitByte(ModRMByte(1, RegOpcodeField, BaseRegNo), CurByte, OS); - EmitConstant(Disp.getImm(), 1, CurByte, OS); + EmitImmediate(Disp, 1, CurByte, OS, Fixups); return; } @@ -477,41 +482,20 @@ case X86II::MRMInitReg: assert(0 && "FIXME: Remove this form when the JIT moves to MCCodeEmitter!"); default: errs() << "FORM: " << (TSFlags & X86II::FormMask) << "\n"; - assert(0 && "Unknown FormMask value in X86MCCodeEmitter!"); - case X86II::RawFrm: { + assert(0 && "Unknown FormMask value in X86MCCodeEmitter!"); + case X86II::RawFrm: EmitByte(BaseOpcode, CurByte, OS); - - if (CurOp == NumOps) - break; - - assert(0 && "Unimpl RawFrm expr"); break; - } - case X86II::AddRegFrm: { + case X86II::AddRegFrm: EmitByte(BaseOpcode + GetX86RegNum(MI.getOperand(CurOp++)), CurByte, OS); - if (CurOp == NumOps) - break; - - const MCOperand &MO1 = MI.getOperand(CurOp++); - if (MO1.isImm()) { - unsigned Size = X86II::getSizeOfImm(TSFlags); - EmitConstant(MO1.getImm(), Size, CurByte, OS); - break; - } - - assert(0 && "Unimpl AddRegFrm expr"); break; - } case X86II::MRMDestReg: EmitByte(BaseOpcode, CurByte, OS); EmitRegModRMByte(MI.getOperand(CurOp), GetX86RegNum(MI.getOperand(CurOp+1)), CurByte, OS); CurOp += 2; - if (CurOp != NumOps) - EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMDestMem: @@ -520,9 +504,6 @@ GetX86RegNum(MI.getOperand(CurOp + X86AddrNumOperands)), CurByte, OS, Fixups); CurOp += X86AddrNumOperands + 1; - if (CurOp != NumOps) - EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMSrcReg: @@ -530,9 +511,6 @@ EmitRegModRMByte(MI.getOperand(CurOp+1), GetX86RegNum(MI.getOperand(CurOp)), CurByte, OS); CurOp += 2; - if (CurOp != NumOps) - EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), CurByte, OS); break; case X86II::MRMSrcMem: { @@ -549,16 +527,13 @@ EmitMemModRMByte(MI, CurOp+1, GetX86RegNum(MI.getOperand(CurOp)), CurByte, OS, Fixups); CurOp += AddrOperands + 1; - if (CurOp != NumOps) - EmitConstant(MI.getOperand(CurOp++).getImm(), - X86II::getSizeOfImm(TSFlags), CurByte, OS); break; } case X86II::MRM0r: case X86II::MRM1r: case X86II::MRM2r: case X86II::MRM3r: case X86II::MRM4r: case X86II::MRM5r: - case X86II::MRM6r: case X86II::MRM7r: { + case X86II::MRM6r: case X86II::MRM7r: EmitByte(BaseOpcode, CurByte, OS); // Special handling of lfence, mfence, monitor, and mwait. @@ -578,73 +553,23 @@ (TSFlags & X86II::FormMask)-X86II::MRM0r, CurByte, OS); } - - if (CurOp == NumOps) - break; - - const MCOperand &MO1 = MI.getOperand(CurOp++); - if (MO1.isImm()) { - EmitConstant(MO1.getImm(), X86II::getSizeOfImm(TSFlags), CurByte, OS); - break; - } - - assert(0 && "relo unimpl"); -#if 0 - unsigned rt = Is64BitMode ? X86::reloc_pcrel_word - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64ri32) - rt = X86::reloc_absolute_word_sext; // FIXME: add X86II flag? - if (MO1.isGlobal()) { - bool Indirect = gvNeedsNonLazyPtr(MO1, TM); - emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0, - Indirect); - } else if (MO1.isSymbol()) - emitExternalSymbolAddress(MO1.getSymbolName(), rt); - else if (MO1.isCPI()) - emitConstPoolAddress(MO1.getIndex(), rt); - else if (MO1.isJTI()) - emitJumpTableAddress(MO1.getIndex(), rt); break; -#endif - } case X86II::MRM0m: case X86II::MRM1m: case X86II::MRM2m: case X86II::MRM3m: case X86II::MRM4m: case X86II::MRM5m: - case X86II::MRM6m: case X86II::MRM7m: { + case X86II::MRM6m: case X86II::MRM7m: EmitByte(BaseOpcode, CurByte, OS); EmitMemModRMByte(MI, CurOp, (TSFlags & X86II::FormMask)-X86II::MRM0m, CurByte, OS, Fixups); CurOp += X86AddrNumOperands; - - if (CurOp == NumOps) - break; - - const MCOperand &MO = MI.getOperand(CurOp++); - if (MO.isImm()) { - EmitConstant(MO.getImm(), X86II::getSizeOfImm(TSFlags), CurByte, OS); - break; - } - - assert(0 && "relo not handled"); -#if 0 - unsigned rt = Is64BitMode ? X86::reloc_pcrel_word - : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64mi32) - rt = X86::reloc_absolute_word_sext; // FIXME: add X86II flag? - if (MO.isGlobal()) { - bool Indirect = gvNeedsNonLazyPtr(MO, TM); - emitGlobalAddress(MO.getGlobal(), rt, MO.getOffset(), 0, - Indirect); - } else if (MO.isSymbol()) - emitExternalSymbolAddress(MO.getSymbolName(), rt); - else if (MO.isCPI()) - emitConstPoolAddress(MO.getIndex(), rt); - else if (MO.isJTI()) - emitJumpTableAddress(MO.getIndex(), rt); -#endif break; } - } + + // If there is a remaining operand, it must be a trailing immediate. Emit it + // according to the right size for the instruction. + if (CurOp != NumOps) + EmitImmediate(MI.getOperand(CurOp++), X86II::getSizeOfImm(TSFlags), + CurByte, OS, Fixups); #ifndef NDEBUG // FIXME: Verify. From jyasskin at google.com Thu Feb 11 01:16:13 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Thu, 11 Feb 2010 07:16:13 -0000 Subject: [llvm-commits] [llvm] r95862 - /llvm/trunk/unittests/ADT/StringMapTest.cpp Message-ID: <201002110716.o1B7GDYf016123@zion.cs.uiuc.edu> Author: jyasskin Date: Thu Feb 11 01:16:13 2010 New Revision: 95862 URL: http://llvm.org/viewvc/llvm-project?rev=95862&view=rev Log: Fix (harmless) memory leak found by memcheck. Modified: llvm/trunk/unittests/ADT/StringMapTest.cpp Modified: llvm/trunk/unittests/ADT/StringMapTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringMapTest.cpp?rev=95862&r1=95861&r2=95862&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/StringMapTest.cpp (original) +++ llvm/trunk/unittests/ADT/StringMapTest.cpp Thu Feb 11 01:16:13 2010 @@ -191,6 +191,7 @@ testKeyFirst, testKeyFirst + testKeyLength, 1u); EXPECT_STREQ(testKey, entry->first()); EXPECT_EQ(1u, entry->second); + free(entry); } // Test insert() method. From baldrick at free.fr Thu Feb 11 02:24:03 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Feb 2010 09:24:03 +0100 Subject: [llvm-commits] [PATCH] Add the alignstack function attribute In-Reply-To: <4B734C0D.1030608@mymail.mines.edu> References: <4B734C0D.1030608@mymail.mines.edu> Message-ID: <4B73BEA3.1070707@free.fr> Hi Charles, > This attribute, which reuses the 'alignstack' keyword, is intended to > force backends (primarily the x86 backend) to align stacks for generated > functions to 16 bytes. It is not implemented in any backend yet; I would > like to get this patch into LLVM before proceeding. it would be nicer to be able to write alignstack(16), rather than hard-coding the magic number 16. I know the attribute infrastructure isn't set up for this right now... Ciao, Duncan. From sabre at nondot.org Thu Feb 11 02:41:25 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 08:41:25 -0000 Subject: [llvm-commits] [llvm] r95866 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86MCCodeEmitter.cpp Message-ID: <201002110841.o1B8fPix023228@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 02:41:21 2010 New Revision: 95866 URL: http://llvm.org/viewvc/llvm-project?rev=95866&view=rev Log: fix a really nasty bug I introduced in r95693: r12 (and r12d, r12b, etc) also encodes to a R/M value of 4, which is just as illegal as ESP/RSP for the non-sib version an address. This fixes x86-64 jit miscompilations of a bunch of programs. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95866&r1=95865&r2=95866&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Thu Feb 11 02:41:21 2010 @@ -387,10 +387,14 @@ // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table // 2-7) and absolute references. + unsigned BaseRegNo = BaseReg != 0 ? getX86RegNum(BaseReg) : -1U; + if (// The SIB byte must be used if there is an index register. IndexReg.getReg() == 0 && - // The SIB byte must be used if the base is ESP/RSP. - BaseReg != X86::ESP && BaseReg != X86::RSP && + // The SIB byte must be used if the base is ESP/RSP/R12, all of which + // encode to an R/M value of 4, which indicates that a SIB byte is + // present. + BaseRegNo != N86::ESP && // If there is no base register and we're in 64-bit mode, we need a SIB // byte to emit an addr that is just 'disp32' (the non-RIP relative form). (!Is64BitMode || BaseReg != 0)) { @@ -401,7 +405,6 @@ return; } - unsigned BaseRegNo = getX86RegNum(BaseReg); // If the base is not EBP/ESP and there is no displacement, use simple // indirect register encoding, this handles addresses like [EAX]. The // encoding for [EBP] with no displacement means [disp32] so we handle it Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95866&r1=95865&r2=95866&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 02:41:21 2010 @@ -175,15 +175,19 @@ const MCOperand &Scale = MI.getOperand(Op+1); const MCOperand &IndexReg = MI.getOperand(Op+2); unsigned BaseReg = Base.getReg(); + unsigned BaseRegNo = BaseReg != 0 ? GetX86RegNum(Base) : -1U; // Determine whether a SIB byte is needed. // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table // 2-7) and absolute references. + if (// The SIB byte must be used if there is an index register. IndexReg.getReg() == 0 && - // The SIB byte must be used if the base is ESP/RSP. - BaseReg != X86::ESP && BaseReg != X86::RSP && + // The SIB byte must be used if the base is ESP/RSP/R12, all of which + // encode to an R/M value of 4, which indicates that a SIB byte is + // present. + BaseRegNo != N86::ESP && // If there is no base register and we're in 64-bit mode, we need a SIB // byte to emit an addr that is just 'disp32' (the non-RIP relative form). (!Is64BitMode || BaseReg != 0)) { @@ -195,8 +199,6 @@ return; } - unsigned BaseRegNo = GetX86RegNum(Base); - // If the base is not EBP/ESP and there is no displacement, use simple // indirect register encoding, this handles addresses like [EAX]. The // encoding for [EBP] with no displacement means [disp32] so we handle it From sabre at nondot.org Thu Feb 11 02:45:57 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 08:45:57 -0000 Subject: [llvm-commits] [llvm] r95867 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86MCCodeEmitter.cpp Message-ID: <201002110845.o1B8jvlE025538@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 02:45:56 2010 New Revision: 95867 URL: http://llvm.org/viewvc/llvm-project?rev=95867&view=rev Log: dont' call getX86RegNum on X86::RIP, it doesn't like that. This fixes the remaining x86-64 jit failures afaik. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95867&r1=95866&r2=95867&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Thu Feb 11 02:45:56 2010 @@ -387,7 +387,9 @@ // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table // 2-7) and absolute references. - unsigned BaseRegNo = BaseReg != 0 ? getX86RegNum(BaseReg) : -1U; + unsigned BaseRegNo = -1U; + if (BaseReg != 0 && BaseReg != X86::RIP) + BaseRegNo = getX86RegNum(BaseReg); if (// The SIB byte must be used if there is an index register. IndexReg.getReg() == 0 && Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95867&r1=95866&r2=95867&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 02:45:56 2010 @@ -175,8 +175,10 @@ const MCOperand &Scale = MI.getOperand(Op+1); const MCOperand &IndexReg = MI.getOperand(Op+2); unsigned BaseReg = Base.getReg(); - unsigned BaseRegNo = BaseReg != 0 ? GetX86RegNum(Base) : -1U; - + unsigned BaseRegNo = -1U; + if (BaseReg != 0 && BaseReg != X86::RIP) + BaseRegNo = GetX86RegNum(Base); + // Determine whether a SIB byte is needed. // If no BaseReg, issue a RIP relative instruction only if the MCE can // resolve addresses on-the-fly, otherwise use SIB (Intel Manual 2A, table From isanbard at gmail.com Thu Feb 11 04:37:57 2010 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Feb 2010 10:37:57 -0000 Subject: [llvm-commits] [llvm] r95871 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Message-ID: <201002111037.o1BAbwm6009122@zion.cs.uiuc.edu> Author: void Date: Thu Feb 11 04:37:57 2010 New Revision: 95871 URL: http://llvm.org/viewvc/llvm-project?rev=95871&view=rev Log: Use .empty() instead of .size(). Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=95871&r1=95870&r2=95871&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Thu Feb 11 04:37:57 2010 @@ -907,7 +907,7 @@ } // Emit the Catch TypeInfos. - if (TypeInfos.size() != 0) EOL("-- Catch TypeInfos --"); + if (!TypeInfos.empty()) EOL("-- Catch TypeInfos --"); for (std::vector::const_reverse_iterator I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) { const GlobalVariable *GV = *I; @@ -923,7 +923,7 @@ } // Emit the Exception Specifications. - if (FilterIds.size() != 0) EOL("-- Filter IDs --"); + if (!FilterIds.empty()) EOL("-- Filter IDs --"); for (std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) { unsigned TypeID = *I; From isanbard at gmail.com Thu Feb 11 04:38:03 2010 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Feb 2010 02:38:03 -0800 Subject: [llvm-commits] [llvm] r95740 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp In-Reply-To: <4B72714E.5000803@free.fr> References: <201002100059.o1A0xlSi009648@zion.cs.uiuc.edu> <4B72714E.5000803@free.fr> Message-ID: <9723AE87-4020-4FC8-A9F4-EEC9DDD481B7@gmail.com> Ah! Good idea. Done. -bw On Feb 10, 2010, at 12:41 AM, Duncan Sands wrote: > Hi Bill, > >> + if (TypeInfos.size() != 0) EOL("-- Catch TypeInfos --"); > > how about: if (!TypeInfos.empty()) ... > >> + if (FilterIds.size() != 0) EOL("-- Filter IDs --"); > > Likewise. > > Ciao, > > Duncan. > From johnny.chen at apple.com Thu Feb 11 11:14:32 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 11 Feb 2010 17:14:32 -0000 Subject: [llvm-commits] [llvm] r95873 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <201002111714.o1BHEWx5027803@zion.cs.uiuc.edu> Author: johnny Date: Thu Feb 11 11:14:31 2010 New Revision: 95873 URL: http://llvm.org/viewvc/llvm-project?rev=95873&view=rev Log: Add pseudo instruction TRAP for disassembly, which is encoded according to A5-21 as the "Permanently UNDEFINED" instruction. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95873&r1=95872&r2=95873&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Thu Feb 11 11:14:31 2010 @@ -619,6 +619,16 @@ let Inst{7-4} = 0b1111; } +// A5.4 Permanently UNDEFINED instructions. +def TRAP : AI<(outs), (ins), Pseudo, NoItinerary, "trap", "", + [/* For disassembly only; pattern left blank */]>, + Requires<[IsARM]> { + let Inst{27-25} = 0b011; + let Inst{24-20} = 0b11111; + let Inst{7-5} = 0b111; + let Inst{4} = 0b1; +} + // Address computation and loads and stores in PIC mode. let isNotDuplicable = 1 in { def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), From baldrick at free.fr Thu Feb 11 11:32:25 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Feb 2010 17:32:25 -0000 Subject: [llvm-commits] [dragonegg] r95875 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <201002111732.o1BHWPRT028752@zion.cs.uiuc.edu> Author: baldrick Date: Thu Feb 11 11:32:25 2010 New Revision: 95875 URL: http://llvm.org/viewvc/llvm-project?rev=95875&view=rev Log: Output static globals marked with the 'used' attribute. With this change dragonegg can successfully do a debug build of LLVM, and all "make check" tests pass except for MultiplePluginPriorities.td, which involves raising and catching an exception (I didn't add support for exception handling yet). Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95875&r1=95874&r2=95875&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Thu Feb 11 11:32:25 2010 @@ -1873,12 +1873,14 @@ LazilyInitializeModule(); // Output all externally visible global variables, whether they are used in - // this compilation unit or not. Global variables that are not externally - // visible are output when their user is, or discarded if unused. + // this compilation unit or not, as well as any internal variables explicitly + // marked with the 'used' attribute. All other internal variables are output + // when their user is, or discarded if unused. struct varpool_node *vnode; FOR_EACH_STATIC_VARIABLE (vnode) { tree var = vnode->decl; - if (TREE_CODE(var) == VAR_DECL && TREE_PUBLIC(var)) + if (TREE_CODE(var) == VAR_DECL && + (TREE_PUBLIC(var) || DECL_PRESERVE_P(var))) emit_global(var); } From echristo at apple.com Thu Feb 11 11:44:04 2010 From: echristo at apple.com (Eric Christopher) Date: Thu, 11 Feb 2010 17:44:04 -0000 Subject: [llvm-commits] [llvm] r95877 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll Message-ID: <201002111744.o1BHi5rH029258@zion.cs.uiuc.edu> Author: echristo Date: Thu Feb 11 11:44:04 2010 New Revision: 95877 URL: http://llvm.org/viewvc/llvm-project?rev=95877&view=rev Log: Make sure that ConstantExpr offsets also aren't off of extern symbols. Thanks to Duncan Sands for the testcase! Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/trunk/test/Transforms/InstCombine/objsize.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=95877&r1=95876&r2=95877&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Feb 11 11:44:04 2010 @@ -331,9 +331,15 @@ if (CE->getOpcode() != Instruction::GetElementPtr) break; GEPOperator *GEP = cast(CE); + // Make sure we're not a constant offset from an external + // global. + Value *Operand = GEP->getPointerOperand(); + if (GlobalVariable *GV = dyn_cast(Operand)) + if (!GV->hasDefinitiveInitializer()) break; + // Get what we're pointing to and its size. const PointerType *PT = - cast(GEP->getPointerOperand()->getType()); + cast(Operand->getType()); size_t Size = TD->getTypeAllocSize(PT->getElementType()); // Get the current byte offset into the thing. @@ -345,7 +351,7 @@ Constant *RetVal = ConstantInt::get(ReturnTy, Size-Offset); return ReplaceInstUsesWith(CI, RetVal); - } + } } case Intrinsic::bswap: // bswap(bswap(x)) -> x Modified: llvm/trunk/test/Transforms/InstCombine/objsize.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=95877&r1=95876&r2=95877&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/objsize.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/objsize.ll Thu Feb 11 11:44:04 2010 @@ -48,4 +48,19 @@ ret i1 %2 } +define void @test1(i8* %q, i32 %x) nounwind noinline { +; CHECK: @test1 +; CHECK: objectsize.i32 +entry: + %0 = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([0 x i8]* @window, i32 0, i32 10), i1 false) ; [#uses=1] + %1 = icmp eq i32 %0, -1 ; [#uses=1] + br i1 %1, label %"47", label %"46" + +"46": ; preds = %entry + unreachable + +"47": ; preds = %entry + unreachable +} + declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly \ No newline at end of file From stoklund at 2pi.dk Thu Feb 11 12:06:56 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 11 Feb 2010 18:06:56 -0000 Subject: [llvm-commits] [llvm] r95879 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Message-ID: <201002111806.o1BI6uGV030485@zion.cs.uiuc.edu> Author: stoklund Date: Thu Feb 11 12:06:56 2010 New Revision: 95879 URL: http://llvm.org/viewvc/llvm-project?rev=95879&view=rev Log: Use array_pod_sort instead of std::sort for improved code size. Use SmallVector instead of std::vector for better speed when indirectbr has few successors. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95879&r1=95878&r2=95879&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 11 12:06:56 2010 @@ -2063,11 +2063,11 @@ void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) { // Update machine-CFG edges with unique successors. - std::vector succs; + SmallVector succs; succs.reserve(I.getNumSuccessors()); for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i) succs.push_back(I.getSuccessor(i)); - std::sort(succs.begin(), succs.end()); + array_pod_sort(succs.begin(), succs.end()); succs.erase(std::unique(succs.begin(), succs.end()), succs.end()); for (unsigned i = 0, e = succs.size(); i != e; ++i) CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]); From johnny.chen at apple.com Thu Feb 11 12:12:30 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 11 Feb 2010 18:12:30 -0000 Subject: [llvm-commits] [llvm] r95884 - in /llvm/trunk/lib/Target/ARM: ARMInstrInfo.td ARMInstrThumb.td Message-ID: <201002111812.o1BICUfO030822@zion.cs.uiuc.edu> Author: johnny Date: Thu Feb 11 12:12:29 2010 New Revision: 95884 URL: http://llvm.org/viewvc/llvm-project?rev=95884&view=rev Log: Added BKPT/tBKPT (breakpoint) to the instruction table for disassembly purpose. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95884&r1=95883&r2=95884&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Thu Feb 11 12:12:29 2010 @@ -612,6 +612,15 @@ let Inst{7-0} = 0b00000000; } +// The i32imm operand $val can be used by a debugger to store more information +// about the breakpoint. +def BKPT : AI<(outs), (ins i32imm:$val), Pseudo, NoItinerary, "bkpt", "\t$val", + [/* For disassembly only; pattern left blank */]>, + Requires<[IsARM]> { + let Inst{27-20} = 0b00010010; + let Inst{7-4} = 0b0111; +} + def DBG : AI<(outs), (ins i32imm:$opt), Pseudo, NoItinerary, "dbg", "\t$opt", [/* For disassembly only; pattern left blank */]>, Requires<[IsARM, HasV7]> { Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=95884&r1=95883&r2=95884&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Thu Feb 11 12:12:29 2010 @@ -132,6 +132,14 @@ [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb1Only]>; } +// The i32imm operand $val can be used by a debugger to store more information +// about the breakpoint. +def tBKPT : T1I<(outs), (ins i32imm:$val), NoItinerary, "bkpt\t$val", + [/* For disassembly only; pattern left blank */]>, + T1Encoding<0b101111> { + let Inst{9-8} = 0b10; +} + // For both thumb1 and thumb2. let isNotDuplicable = 1 in def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALUr, From johnny.chen at apple.com Thu Feb 11 12:17:16 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 11 Feb 2010 18:17:16 -0000 Subject: [llvm-commits] [llvm] r95885 - /llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Message-ID: <201002111817.o1BIHGCN031112@zion.cs.uiuc.edu> Author: johnny Date: Thu Feb 11 12:17:16 2010 New Revision: 95885 URL: http://llvm.org/viewvc/llvm-project?rev=95885&view=rev Log: Added VCVT (between floating-point and fixed-point, VFP) for disassembly. A8.6.297 Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=95885&r1=95884&r2=95885&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Thu Feb 11 12:17:16 2010 @@ -412,6 +412,101 @@ let Inst{7} = 0; // Z bit } +// Convert between floating-point and fixed-point +// Data type for fixed-point naming convention: +// S16 (U=0, sx=0) -> SH +// U16 (U=1, sx=0) -> UH +// S32 (U=0, sx=1) -> SL +// U32 (U=1, sx=1) -> UL + +let Constraints = "$a = $dst" in { + +// FP to Fixed-Point: + +def VTOSHS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 0, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOUHD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 0, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOSLD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 1, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VTOULD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 1, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +// Fixed-Point to FP: + +def VSHTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 0, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1, + (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), + IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VUHTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 0, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VSLTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 1, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +def VULTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 1, + (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), + IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits", + [/* For disassembly only; pattern left blank */]>; + +} // End of 'let Constraints = "$src = $dst" in' + //===----------------------------------------------------------------------===// // FP FMA Operations. // From dalej at apple.com Thu Feb 11 12:22:31 2010 From: dalej at apple.com (Dale Johannesen) Date: Thu, 11 Feb 2010 18:22:31 -0000 Subject: [llvm-commits] [llvm] r95889 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <201002111822.o1BIMV3f031441@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 11 12:22:31 2010 New Revision: 95889 URL: http://llvm.org/viewvc/llvm-project?rev=95889&view=rev Log: Don't allow DBG_VALUE to affect codegen. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=95889&r1=95888&r2=95889&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Thu Feb 11 12:22:31 2010 @@ -213,6 +213,9 @@ unsigned NumVisited = 0; for (MachineBasicBlock::iterator I = llvm::next(OldPos); I != KillPos; ++I) { MachineInstr *OtherMI = I; + // DBG_VALUE cannot be counted against the limit. + if (OtherMI->isDebugValue()) + continue; if (NumVisited > 30) // FIXME: Arbitrary limit to reduce compile time cost. return false; ++NumVisited; From dalej at apple.com Thu Feb 11 12:23:24 2010 From: dalej at apple.com (Dale Johannesen) Date: Thu, 11 Feb 2010 18:23:24 -0000 Subject: [llvm-commits] [llvm] r95890 - /llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Message-ID: <201002111823.o1BINOca031497@zion.cs.uiuc.edu> Author: johannes Date: Thu Feb 11 12:23:23 2010 New Revision: 95890 URL: http://llvm.org/viewvc/llvm-project?rev=95890&view=rev Log: Allow for more than one DBG_VALUE targeting the same dead instruction. Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=95890&r1=95889&r2=95890&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Thu Feb 11 12:23:23 2010 @@ -117,10 +117,10 @@ // the former operand will then be deleted normally. if (MI->getNumOperands()==3 && MI->getOperand(0).isReg()) { unsigned Reg = MI->getOperand(0).getReg(); - MachineRegisterInfo::use_iterator I = MRI->use_begin(Reg); - assert(I != MRI->use_end()); - if (++I == MRI->use_end()) - // only one use, which must be this DBG_VALUE. + MachineRegisterInfo::use_nodbg_iterator I = MRI->use_nodbg_begin(Reg); + if (I == MRI->use_nodbg_end()) + // All uses are DBG_VALUEs. Nullify this one; if we find + // others later we will nullify them then. MI->getOperand(0).setReg(0U); } } From baldrick at free.fr Thu Feb 11 12:46:54 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Feb 2010 18:46:54 -0000 Subject: [llvm-commits] [dragonegg] r95891 - /dragonegg/trunk/www/index.html Message-ID: <201002111846.o1BIksEv032538@zion.cs.uiuc.edu> Author: baldrick Date: Thu Feb 11 12:46:53 2010 New Revision: 95891 URL: http://llvm.org/viewvc/llvm-project?rev=95891&view=rev Log: Dragonegg can do debug and release builds of LLVM (and both work). However it clang and boost are too much for it for the moment. Modified: dragonegg/trunk/www/index.html Modified: dragonegg/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/www/index.html?rev=95891&r1=95890&r2=95891&view=diff ============================================================================== --- dragonegg/trunk/www/index.html (original) +++ dragonegg/trunk/www/index.html Thu Feb 11 12:46:53 2010 @@ -36,11 +36,12 @@
      -
    • C works quite well, for example you can build a working gcc using it
    • +
    • C works well, for example you can build a working gcc using it
    • +
    • C++ works fairly well, for example you can build a working LLVM using it. + On the other hand, DragonEgg crashes + while building clang and boost
    • A lot of Fortran compiles, but the compiled code has not been tested for correctness
    • -
    • It can compile quite a lot of C++, but the compiled code does not always - work right
    • It can compile quite a lot of Ada, but the compiled code may not work right
    • It can compile a small amount of Obj-C and Obj-C++
    • From johnny.chen at apple.com Thu Feb 11 12:47:04 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 11 Feb 2010 18:47:04 -0000 Subject: [llvm-commits] [llvm] r95892 - /llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Message-ID: <201002111847.o1BIl4LL032558@zion.cs.uiuc.edu> Author: johnny Date: Thu Feb 11 12:47:03 2010 New Revision: 95892 URL: http://llvm.org/viewvc/llvm-project?rev=95892&view=rev Log: Forgot to also check in this file for vcvt (floating-point <-> fixed-point, VFP). Sorry! Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=95892&r1=95891&r2=95892&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Thu Feb 11 12:47:03 2010 @@ -1324,6 +1324,15 @@ let Inst{4} = 0; } +// VFP conversion between floating-point and fixed-point +class AVConv1XI op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5, + dag oops, dag iops, InstrItinClass itin, string opc, string asm, + list pattern> + : AVConv1I { + // size (fixed-point number): sx == 0 ? 16 : 32 + let Inst{7} = op5; // sx +} + // VFP conversion instructions, if no NEON class AVConv1In opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4, dag oops, dag iops, InstrItinClass itin, From gohman at apple.com Thu Feb 11 13:07:06 2010 From: gohman at apple.com (Dan Gohman) Date: Thu, 11 Feb 2010 19:07:06 -0000 Subject: [llvm-commits] [llvm] r95895 - /llvm/trunk/test/MC/MachO/Darwin/ Message-ID: <201002111907.o1BJ76DT001018@zion.cs.uiuc.edu> Author: djg Date: Thu Feb 11 13:07:04 2010 New Revision: 95895 URL: http://llvm.org/viewvc/llvm-project?rev=95895&view=rev Log: Add an svn:ignore. Modified: llvm/trunk/test/MC/MachO/Darwin/ (props changed) Propchange: llvm/trunk/test/MC/MachO/Darwin/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Feb 11 13:07:04 2010 @@ -0,0 +1 @@ +Output From jyasskin at google.com Thu Feb 11 13:15:21 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Thu, 11 Feb 2010 19:15:21 -0000 Subject: [llvm-commits] [llvm] r95896 - in /llvm/trunk: docs/tutorial/LangImpl4.html docs/tutorial/LangImpl5.html docs/tutorial/LangImpl6.html docs/tutorial/LangImpl7.html examples/Kaleidoscope/Chapter4/Makefile examples/Kaleidoscope/Chapter4/toy.cpp examples/Kaleidoscope/Chapter5/Makefile examples/Kaleidoscope/Chapter5/toy.cpp examples/Kaleidoscope/Chapter6/Makefile examples/Kaleidoscope/Chapter6/toy.cpp examples/Kaleidoscope/Chapter7/Makefile examples/Kaleidoscope/Chapter7/toy.cpp Message-ID: <201002111915.o1BJFLCS001506@zion.cs.uiuc.edu> Author: jyasskin Date: Thu Feb 11 13:15:20 2010 New Revision: 95896 URL: http://llvm.org/viewvc/llvm-project?rev=95896&view=rev Log: Make Kaleidoscope not link against the interpreter, since that didn't work anyway (Interpreter::getPointerToFunction doesn't return a callable pointer), and improve the error message when an ExecutionEngine can't be created. Modified: llvm/trunk/docs/tutorial/LangImpl4.html llvm/trunk/docs/tutorial/LangImpl5.html llvm/trunk/docs/tutorial/LangImpl6.html llvm/trunk/docs/tutorial/LangImpl7.html llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp Modified: llvm/trunk/docs/tutorial/LangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=95896&r1=95895&r2=95896&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl4.html (original) +++ llvm/trunk/docs/tutorial/LangImpl4.html Thu Feb 11 13:15:20 2010 @@ -485,7 +485,7 @@
          # Compile
      -   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit interpreter native` -O3 -o toy
      +   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
          # Run
          ./toy
       
      @@ -502,7 +502,6 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -1075,7 +1074,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/docs/tutorial/LangImpl5.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/tutorial/LangImpl5.html (original)
      +++ llvm/trunk/docs/tutorial/LangImpl5.html Thu Feb 11 13:15:20 2010
      @@ -902,7 +902,6 @@
       
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -1720,7 +1719,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/docs/tutorial/LangImpl6.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/tutorial/LangImpl6.html (original)
      +++ llvm/trunk/docs/tutorial/LangImpl6.html Thu Feb 11 13:15:20 2010
      @@ -821,7 +821,6 @@
       
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -1757,7 +1756,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/docs/tutorial/LangImpl7.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/tutorial/LangImpl7.html (original)
      +++ llvm/trunk/docs/tutorial/LangImpl7.html Thu Feb 11 13:15:20 2010
      @@ -1004,7 +1004,6 @@
       
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -2105,7 +2104,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile Thu Feb 11 13:15:20 2010
      @@ -10,6 +10,6 @@
       TOOLNAME = Kaleidoscope-Ch4
       EXAMPLE_TOOL = 1
       
      -LINK_COMPONENTS := core jit interpreter native
      +LINK_COMPONENTS := core jit native
       
       include $(LEVEL)/Makefile.common
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp Thu Feb 11 13:15:20 2010
      @@ -1,6 +1,5 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -573,7 +572,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile Thu Feb 11 13:15:20 2010
      @@ -10,6 +10,6 @@
       TOOLNAME = Kaleidoscope-Ch5
       EXAMPLE_TOOL = 1
       
      -LINK_COMPONENTS := core jit interpreter native
      +LINK_COMPONENTS := core jit native
       
       include $(LEVEL)/Makefile.common
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp Thu Feb 11 13:15:20 2010
      @@ -1,6 +1,5 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -818,7 +817,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile Thu Feb 11 13:15:20 2010
      @@ -10,6 +10,6 @@
       TOOLNAME = Kaleidoscope-Ch6
       EXAMPLE_TOOL = 1
       
      -LINK_COMPONENTS := core jit interpreter native
      +LINK_COMPONENTS := core jit native
       
       include $(LEVEL)/Makefile.common
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp Thu Feb 11 13:15:20 2010
      @@ -1,6 +1,5 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -936,7 +935,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile Thu Feb 11 13:15:20 2010
      @@ -11,6 +11,6 @@
       EXAMPLE_TOOL = 1
       REQUIRES_RTTI := 1
       
      -LINK_COMPONENTS := core jit interpreter native
      +LINK_COMPONENTS := core jit native
       
       include $(LEVEL)/Makefile.common
      
      Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp?rev=95896&r1=95895&r2=95896&view=diff
      
      ==============================================================================
      --- llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp (original)
      +++ llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp Thu Feb 11 13:15:20 2010
      @@ -1,6 +1,5 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/ExecutionEngine/ExecutionEngine.h"
      -#include "llvm/ExecutionEngine/Interpreter.h"
       #include "llvm/ExecutionEngine/JIT.h"
       #include "llvm/LLVMContext.h"
       #include "llvm/Module.h"
      @@ -1100,7 +1099,12 @@
         TheModule = new Module("my cool jit", Context);
       
         // Create the JIT.  This takes ownership of the module.
      -  TheExecutionEngine = EngineBuilder(TheModule).create();
      +  std::string ErrStr;
      +  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
      +  if (!TheExecutionEngine) {
      +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
      +    exit(1);
      +  }
       
         FunctionPassManager OurFPM(TheModule);
       
      
      
      
      
      From sabre at nondot.org  Thu Feb 11 13:25:55 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 19:25:55 -0000
      Subject: [llvm-commits] [llvm] r95901 - in /llvm/trunk/lib/Target/X86:
       X86FastISel.cpp X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86InstrInfo.cpp
       X86InstrInfo.td X86MCCodeEmitter.cpp
      Message-ID: <201002111925.o1BJPuce002056@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 13:25:55 2010
      New Revision: 95901
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95901&view=rev
      Log:
      refactor the conditional jump instructions in the .td file to
      use a multipattern that generates both the 1-byte and 4-byte 
      versions from the same defm
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
          llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
          llvm/trunk/lib/Target/X86/X86InstrInfo.td
          llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Feb 11 13:25:55 2010
      @@ -828,30 +828,30 @@
               std::swap(TrueMBB, FalseMBB);
               Predicate = CmpInst::FCMP_UNE;
               // FALL THROUGH
      -      case CmpInst::FCMP_UNE: SwapArgs = false; BranchOpc = X86::JNE; break;
      -      case CmpInst::FCMP_OGT: SwapArgs = false; BranchOpc = X86::JA;  break;
      -      case CmpInst::FCMP_OGE: SwapArgs = false; BranchOpc = X86::JAE; break;
      -      case CmpInst::FCMP_OLT: SwapArgs = true;  BranchOpc = X86::JA;  break;
      -      case CmpInst::FCMP_OLE: SwapArgs = true;  BranchOpc = X86::JAE; break;
      -      case CmpInst::FCMP_ONE: SwapArgs = false; BranchOpc = X86::JNE; break;
      -      case CmpInst::FCMP_ORD: SwapArgs = false; BranchOpc = X86::JNP; break;
      -      case CmpInst::FCMP_UNO: SwapArgs = false; BranchOpc = X86::JP;  break;
      -      case CmpInst::FCMP_UEQ: SwapArgs = false; BranchOpc = X86::JE;  break;
      -      case CmpInst::FCMP_UGT: SwapArgs = true;  BranchOpc = X86::JB;  break;
      -      case CmpInst::FCMP_UGE: SwapArgs = true;  BranchOpc = X86::JBE; break;
      -      case CmpInst::FCMP_ULT: SwapArgs = false; BranchOpc = X86::JB;  break;
      -      case CmpInst::FCMP_ULE: SwapArgs = false; BranchOpc = X86::JBE; break;
      +      case CmpInst::FCMP_UNE: SwapArgs = false; BranchOpc = X86::JNE_4; break;
      +      case CmpInst::FCMP_OGT: SwapArgs = false; BranchOpc = X86::JA_4;  break;
      +      case CmpInst::FCMP_OGE: SwapArgs = false; BranchOpc = X86::JAE_4; break;
      +      case CmpInst::FCMP_OLT: SwapArgs = true;  BranchOpc = X86::JA_4;  break;
      +      case CmpInst::FCMP_OLE: SwapArgs = true;  BranchOpc = X86::JAE_4; break;
      +      case CmpInst::FCMP_ONE: SwapArgs = false; BranchOpc = X86::JNE_4; break;
      +      case CmpInst::FCMP_ORD: SwapArgs = false; BranchOpc = X86::JNP_4; break;
      +      case CmpInst::FCMP_UNO: SwapArgs = false; BranchOpc = X86::JP_4;  break;
      +      case CmpInst::FCMP_UEQ: SwapArgs = false; BranchOpc = X86::JE_4;  break;
      +      case CmpInst::FCMP_UGT: SwapArgs = true;  BranchOpc = X86::JB_4;  break;
      +      case CmpInst::FCMP_UGE: SwapArgs = true;  BranchOpc = X86::JBE_4; break;
      +      case CmpInst::FCMP_ULT: SwapArgs = false; BranchOpc = X86::JB_4;  break;
      +      case CmpInst::FCMP_ULE: SwapArgs = false; BranchOpc = X86::JBE_4; break;
                 
      -      case CmpInst::ICMP_EQ:  SwapArgs = false; BranchOpc = X86::JE;  break;
      -      case CmpInst::ICMP_NE:  SwapArgs = false; BranchOpc = X86::JNE; break;
      -      case CmpInst::ICMP_UGT: SwapArgs = false; BranchOpc = X86::JA;  break;
      -      case CmpInst::ICMP_UGE: SwapArgs = false; BranchOpc = X86::JAE; break;
      -      case CmpInst::ICMP_ULT: SwapArgs = false; BranchOpc = X86::JB;  break;
      -      case CmpInst::ICMP_ULE: SwapArgs = false; BranchOpc = X86::JBE; break;
      -      case CmpInst::ICMP_SGT: SwapArgs = false; BranchOpc = X86::JG;  break;
      -      case CmpInst::ICMP_SGE: SwapArgs = false; BranchOpc = X86::JGE; break;
      -      case CmpInst::ICMP_SLT: SwapArgs = false; BranchOpc = X86::JL;  break;
      -      case CmpInst::ICMP_SLE: SwapArgs = false; BranchOpc = X86::JLE; break;
      +      case CmpInst::ICMP_EQ:  SwapArgs = false; BranchOpc = X86::JE_4;  break;
      +      case CmpInst::ICMP_NE:  SwapArgs = false; BranchOpc = X86::JNE_4; break;
      +      case CmpInst::ICMP_UGT: SwapArgs = false; BranchOpc = X86::JA_4;  break;
      +      case CmpInst::ICMP_UGE: SwapArgs = false; BranchOpc = X86::JAE_4; break;
      +      case CmpInst::ICMP_ULT: SwapArgs = false; BranchOpc = X86::JB_4;  break;
      +      case CmpInst::ICMP_ULE: SwapArgs = false; BranchOpc = X86::JBE_4; break;
      +      case CmpInst::ICMP_SGT: SwapArgs = false; BranchOpc = X86::JG_4;  break;
      +      case CmpInst::ICMP_SGE: SwapArgs = false; BranchOpc = X86::JGE_4; break;
      +      case CmpInst::ICMP_SLT: SwapArgs = false; BranchOpc = X86::JL_4;  break;
      +      case CmpInst::ICMP_SLE: SwapArgs = false; BranchOpc = X86::JLE_4; break;
             default:
               return false;
             }
      @@ -869,7 +869,7 @@
             if (Predicate == CmpInst::FCMP_UNE) {
               // X86 requires a second branch to handle UNE (and OEQ,
               // which is mapped to UNE above).
      -        BuildMI(MBB, DL, TII.get(X86::JP)).addMBB(TrueMBB);
      +        BuildMI(MBB, DL, TII.get(X86::JP_4)).addMBB(TrueMBB);
             }
       
             FastEmitBranch(FalseMBB);
      @@ -923,7 +923,8 @@
                 unsigned OpCode = SetMI->getOpcode();
       
                 if (OpCode == X86::SETOr || OpCode == X86::SETBr) {
      -            BuildMI(MBB, DL, TII.get(OpCode == X86::SETOr ? X86::JO : X86::JB))
      +            BuildMI(MBB, DL, TII.get(OpCode == X86::SETOr ?
      +                                        X86::JO_4 : X86::JB_4))
                     .addMBB(TrueMBB);
                   FastEmitBranch(FalseMBB);
                   MBB->addSuccessor(TrueMBB);
      @@ -939,7 +940,7 @@
         if (OpReg == 0) return false;
       
         BuildMI(MBB, DL, TII.get(X86::TEST8rr)).addReg(OpReg).addReg(OpReg);
      -  BuildMI(MBB, DL, TII.get(X86::JNE)).addMBB(TrueMBB);
      +  BuildMI(MBB, DL, TII.get(X86::JNE_4)).addMBB(TrueMBB);
         FastEmitBranch(FalseMBB);
         MBB->addSuccessor(TrueMBB);
         return true;
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Feb 11 13:25:55 2010
      @@ -1652,8 +1652,8 @@
             case X86::SETEr: case X86::SETNEr: case X86::SETPr: case X86::SETNPr:
             case X86::SETAm: case X86::SETAEm: case X86::SETBm: case X86::SETBEm:
             case X86::SETEm: case X86::SETNEm: case X86::SETPm: case X86::SETNPm:
      -      case X86::JA: case X86::JAE: case X86::JB: case X86::JBE:
      -      case X86::JE: case X86::JNE: case X86::JP: case X86::JNP:
      +      case X86::JA_4: case X86::JAE_4: case X86::JB_4: case X86::JBE_4:
      +      case X86::JE_4: case X86::JNE_4: case X86::JP_4: case X86::JNP_4:
             case X86::CMOVA16rr: case X86::CMOVA16rm:
             case X86::CMOVA32rr: case X86::CMOVA32rm:
             case X86::CMOVA64rr: case X86::CMOVA64rm:
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 11 13:25:55 2010
      @@ -7934,7 +7934,7 @@
         MIB.addReg(EAXreg);
       
         // insert branch
      -  BuildMI(newMBB, dl, TII->get(X86::JNE)).addMBB(newMBB);
      +  BuildMI(newMBB, dl, TII->get(X86::JNE_4)).addMBB(newMBB);
       
         F->DeleteMachineInstr(bInstr);   // The pseudo instruction is gone now.
         return nextMBB;
      @@ -8091,7 +8091,7 @@
         MIB.addReg(X86::EDX);
       
         // insert branch
      -  BuildMI(newMBB, dl, TII->get(X86::JNE)).addMBB(newMBB);
      +  BuildMI(newMBB, dl, TII->get(X86::JNE_4)).addMBB(newMBB);
       
         F->DeleteMachineInstr(bInstr);   // The pseudo instruction is gone now.
         return nextMBB;
      @@ -8194,7 +8194,7 @@
         MIB.addReg(X86::EAX);
       
         // insert branch
      -  BuildMI(newMBB, dl, TII->get(X86::JNE)).addMBB(newMBB);
      +  BuildMI(newMBB, dl, TII->get(X86::JNE_4)).addMBB(newMBB);
       
         F->DeleteMachineInstr(mInstr);   // The pseudo instruction is gone now.
         return nextMBB;
      @@ -8276,7 +8276,7 @@
         if (!Subtarget->isTargetWin64()) {
           // If %al is 0, branch around the XMM save block.
           BuildMI(MBB, DL, TII->get(X86::TEST8rr)).addReg(CountReg).addReg(CountReg);
      -    BuildMI(MBB, DL, TII->get(X86::JE)).addMBB(EndMBB);
      +    BuildMI(MBB, DL, TII->get(X86::JE_4)).addMBB(EndMBB);
           MBB->addSuccessor(EndMBB);
         }
       
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Thu Feb 11 13:25:55 2010
      @@ -1587,44 +1587,44 @@
       static X86::CondCode GetCondFromBranchOpc(unsigned BrOpc) {
         switch (BrOpc) {
         default: return X86::COND_INVALID;
      -  case X86::JE:  return X86::COND_E;
      -  case X86::JNE: return X86::COND_NE;
      -  case X86::JL:  return X86::COND_L;
      -  case X86::JLE: return X86::COND_LE;
      -  case X86::JG:  return X86::COND_G;
      -  case X86::JGE: return X86::COND_GE;
      -  case X86::JB:  return X86::COND_B;
      -  case X86::JBE: return X86::COND_BE;
      -  case X86::JA:  return X86::COND_A;
      -  case X86::JAE: return X86::COND_AE;
      -  case X86::JS:  return X86::COND_S;
      -  case X86::JNS: return X86::COND_NS;
      -  case X86::JP:  return X86::COND_P;
      -  case X86::JNP: return X86::COND_NP;
      -  case X86::JO:  return X86::COND_O;
      -  case X86::JNO: return X86::COND_NO;
      +  case X86::JE_4:  return X86::COND_E;
      +  case X86::JNE_4: return X86::COND_NE;
      +  case X86::JL_4:  return X86::COND_L;
      +  case X86::JLE_4: return X86::COND_LE;
      +  case X86::JG_4:  return X86::COND_G;
      +  case X86::JGE_4: return X86::COND_GE;
      +  case X86::JB_4:  return X86::COND_B;
      +  case X86::JBE_4: return X86::COND_BE;
      +  case X86::JA_4:  return X86::COND_A;
      +  case X86::JAE_4: return X86::COND_AE;
      +  case X86::JS_4:  return X86::COND_S;
      +  case X86::JNS_4: return X86::COND_NS;
      +  case X86::JP_4:  return X86::COND_P;
      +  case X86::JNP_4: return X86::COND_NP;
      +  case X86::JO_4:  return X86::COND_O;
      +  case X86::JNO_4: return X86::COND_NO;
         }
       }
       
       unsigned X86::GetCondBranchFromCond(X86::CondCode CC) {
         switch (CC) {
         default: llvm_unreachable("Illegal condition code!");
      -  case X86::COND_E:  return X86::JE;
      -  case X86::COND_NE: return X86::JNE;
      -  case X86::COND_L:  return X86::JL;
      -  case X86::COND_LE: return X86::JLE;
      -  case X86::COND_G:  return X86::JG;
      -  case X86::COND_GE: return X86::JGE;
      -  case X86::COND_B:  return X86::JB;
      -  case X86::COND_BE: return X86::JBE;
      -  case X86::COND_A:  return X86::JA;
      -  case X86::COND_AE: return X86::JAE;
      -  case X86::COND_S:  return X86::JS;
      -  case X86::COND_NS: return X86::JNS;
      -  case X86::COND_P:  return X86::JP;
      -  case X86::COND_NP: return X86::JNP;
      -  case X86::COND_O:  return X86::JO;
      -  case X86::COND_NO: return X86::JNO;
      +  case X86::COND_E:  return X86::JE_4;
      +  case X86::COND_NE: return X86::JNE_4;
      +  case X86::COND_L:  return X86::JL_4;
      +  case X86::COND_LE: return X86::JLE_4;
      +  case X86::COND_G:  return X86::JG_4;
      +  case X86::COND_GE: return X86::JGE_4;
      +  case X86::COND_B:  return X86::JB_4;
      +  case X86::COND_BE: return X86::JBE_4;
      +  case X86::COND_A:  return X86::JA_4;
      +  case X86::COND_AE: return X86::JAE_4;
      +  case X86::COND_S:  return X86::JS_4;
      +  case X86::COND_NS: return X86::JNS_4;
      +  case X86::COND_P:  return X86::JP_4;
      +  case X86::COND_NP: return X86::JNP_4;
      +  case X86::COND_O:  return X86::JO_4;
      +  case X86::COND_NO: return X86::JNO_4;
         }
       }
       
      @@ -1694,7 +1694,7 @@
             return true;
       
           // Handle unconditional branches.
      -    if (I->getOpcode() == X86::JMP) {
      +    if (I->getOpcode() == X86::JMP_4) {
             if (!AllowModify) {
               TBB = I->getOperand(0).getMBB();
               continue;
      @@ -1778,7 +1778,7 @@
       
         while (I != MBB.begin()) {
           --I;
      -    if (I->getOpcode() != X86::JMP &&
      +    if (I->getOpcode() != X86::JMP_4 &&
               GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
             break;
           // Remove the branch.
      @@ -1804,7 +1804,7 @@
         if (Cond.empty()) {
           // Unconditional branch?
           assert(!FBB && "Unconditional branch with multiple successors!");
      -    BuildMI(&MBB, dl, get(X86::JMP)).addMBB(TBB);
      +    BuildMI(&MBB, dl, get(X86::JMP_4)).addMBB(TBB);
           return 1;
         }
       
      @@ -1814,16 +1814,16 @@
         switch (CC) {
         case X86::COND_NP_OR_E:
           // Synthesize NP_OR_E with two branches.
      -    BuildMI(&MBB, dl, get(X86::JNP)).addMBB(TBB);
      +    BuildMI(&MBB, dl, get(X86::JNP_4)).addMBB(TBB);
           ++Count;
      -    BuildMI(&MBB, dl, get(X86::JE)).addMBB(TBB);
      +    BuildMI(&MBB, dl, get(X86::JE_4)).addMBB(TBB);
           ++Count;
           break;
         case X86::COND_NE_OR_P:
           // Synthesize NE_OR_P with two branches.
      -    BuildMI(&MBB, dl, get(X86::JNE)).addMBB(TBB);
      +    BuildMI(&MBB, dl, get(X86::JNE_4)).addMBB(TBB);
           ++Count;
      -    BuildMI(&MBB, dl, get(X86::JP)).addMBB(TBB);
      +    BuildMI(&MBB, dl, get(X86::JP_4)).addMBB(TBB);
           ++Count;
           break;
         default: {
      @@ -1834,7 +1834,7 @@
         }
         if (FBB) {
           // Two-way Conditional branch. Insert the second branch.
      -    BuildMI(&MBB, dl, get(X86::JMP)).addMBB(FBB);
      +    BuildMI(&MBB, dl, get(X86::JMP_4)).addMBB(FBB);
           ++Count;
         }
         return Count;
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Feb 11 13:25:55 2010
      @@ -596,7 +596,7 @@
                             "", []>;
       
       //===----------------------------------------------------------------------===//
      -//  Control Flow Instructions...
      +//  Control Flow Instructions.
       //
       
       // Return instructions.
      @@ -615,15 +615,47 @@
       }
       
       // All branches are RawFrm, Void, Branch, and Terminators
      +// Unconditional branches.
       let isBranch = 1, isTerminator = 1 in
         class IBr opcode, dag ins, string asm, list pattern> :
               I;
       
      -let isBranch = 1, isBarrier = 1 in {
      -  def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
      -  def JMP8 : IBr<0xEB, (ins brtarget8:$dst), "jmp\t$dst", []>;
      +let isBarrier = 1 in {
      +  def JMP_4 : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
      +  def JMP_1 : IBr<0xEB, (ins brtarget8:$dst), "jmp\t$dst", []>;
       }
       
      +// Conditional Branches.
      +let isBranch = 1, isTerminator = 1, Uses = [EFLAGS] in {
      +  multiclass ICBr opc1, bits<8> opc4, string asm, PatFrag Cond> {
      +    def _1 : I;
      +    def _4 : I, TB;
      +  }
      +}
      +
      +defm JO  : ICBr<0x70, 0x80, "jo\t$dst" , X86_COND_O>;
      +defm JNO : ICBr<0x71, 0x81, "jo\t$dst" , X86_COND_NO>;
      +defm JB  : ICBr<0x72, 0x82, "jb\t$dst" , X86_COND_B>;
      +defm JAE : ICBr<0x73, 0x83, "jae\t$dst", X86_COND_AE>;
      +defm JE  : ICBr<0x74, 0x84, "je\t$dst" , X86_COND_E>;
      +defm JNE : ICBr<0x75, 0x85, "jne\t$dst", X86_COND_NE>;
      +defm JBE : ICBr<0x76, 0x86, "jbe\t$dst", X86_COND_BE>;
      +defm JA  : ICBr<0x77, 0x87, "ja\t$dst" , X86_COND_A>;
      +defm JS  : ICBr<0x78, 0x88, "js\t$dst" , X86_COND_S>;
      +defm JNS : ICBr<0x79, 0x89, "jns\t$dst", X86_COND_NS>;
      +defm JP  : ICBr<0x7A, 0x8A, "jp\t$dst" , X86_COND_P>;
      +defm JNP : ICBr<0x7B, 0x8B, "jnp\t$dst", X86_COND_NP>;
      +defm JL  : ICBr<0x7C, 0x8C, "jl\t$dst" , X86_COND_L>;
      +defm JGE : ICBr<0x7D, 0x8D, "jge\t$dst", X86_COND_GE>;
      +defm JLE : ICBr<0x7E, 0x8E, "jle\t$dst", X86_COND_LE>;
      +defm JG  : ICBr<0x7F, 0x8F, "jg\t$dst" , X86_COND_G>;
      +
      +// FIXME: What about the CX/RCX versions of this instruction?
      +let Uses = [ECX] in
      +  def JCXZ8 : IBr<0xE3, (ins brtarget8:$dst), "jcxz\t$dst", []>;
      +
      +
       // Indirect branches
       let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
         def JMP32r     : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
      @@ -644,63 +676,6 @@
                            "ljmp{l}\t{*}$dst", []>;
       }
       
      -// Conditional branches
      -let Uses = [EFLAGS] in {
      -// Short conditional jumps
      -def JO8   : IBr<0x70, (ins brtarget8:$dst), "jo\t$dst", []>;
      -def JNO8  : IBr<0x71, (ins brtarget8:$dst), "jno\t$dst", []>;
      -def JB8   : IBr<0x72, (ins brtarget8:$dst), "jb\t$dst", []>;
      -def JAE8  : IBr<0x73, (ins brtarget8:$dst), "jae\t$dst", []>;
      -def JE8   : IBr<0x74, (ins brtarget8:$dst), "je\t$dst", []>;
      -def JNE8  : IBr<0x75, (ins brtarget8:$dst), "jne\t$dst", []>;
      -def JBE8  : IBr<0x76, (ins brtarget8:$dst), "jbe\t$dst", []>;
      -def JA8   : IBr<0x77, (ins brtarget8:$dst), "ja\t$dst", []>;
      -def JS8   : IBr<0x78, (ins brtarget8:$dst), "js\t$dst", []>;
      -def JNS8  : IBr<0x79, (ins brtarget8:$dst), "jns\t$dst", []>;
      -def JP8   : IBr<0x7A, (ins brtarget8:$dst), "jp\t$dst", []>;
      -def JNP8  : IBr<0x7B, (ins brtarget8:$dst), "jnp\t$dst", []>;
      -def JL8   : IBr<0x7C, (ins brtarget8:$dst), "jl\t$dst", []>;
      -def JGE8  : IBr<0x7D, (ins brtarget8:$dst), "jge\t$dst", []>;
      -def JLE8  : IBr<0x7E, (ins brtarget8:$dst), "jle\t$dst", []>;
      -def JG8   : IBr<0x7F, (ins brtarget8:$dst), "jg\t$dst", []>;
      -
      -def JCXZ8 : IBr<0xE3, (ins brtarget8:$dst), "jcxz\t$dst", []>;
      -
      -def JE  : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_E, EFLAGS)]>, TB;
      -def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
      -def JL  : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_L, EFLAGS)]>, TB;
      -def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
      -def JG  : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_G, EFLAGS)]>, TB;
      -def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
      -
      -def JB  : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_B, EFLAGS)]>, TB;
      -def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
      -def JA  : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_A, EFLAGS)]>, TB;
      -def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
      -
      -def JS  : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_S, EFLAGS)]>, TB;
      -def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
      -def JP  : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_P, EFLAGS)]>, TB;
      -def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
      -def JO  : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_O, EFLAGS)]>, TB;
      -def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
      -              [(X86brcond bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
      -} // Uses = [EFLAGS]
       
       // Loop instructions
       
      
      Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95901&r1=95900&r2=95901&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 13:25:55 2010
      @@ -571,6 +571,8 @@
         
         // If there is a remaining operand, it must be a trailing immediate.  Emit it
         // according to the right size for the instruction.
      +  // FIXME: This should pass in whether the value is pc relative or not.  This
      +  // information should be aquired from TSFlags as well.
         if (CurOp != NumOps)
           EmitImmediate(MI.getOperand(CurOp++), X86II::getSizeOfImm(TSFlags),
                         CurByte, OS, Fixups);
      
      
      
      
      From sabre at nondot.org  Thu Feb 11 13:31:22 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 19:31:22 -0000
      Subject: [llvm-commits] [llvm] r95902 -
      	/llvm/trunk/include/llvm/Target/Mangler.h
      Message-ID: <201002111931.o1BJVMXo002281@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 13:31:22 2010
      New Revision: 95902
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95902&view=rev
      Log:
      refactor x86 conditional branches to use a multipattern
      that generates the 1-byte and 4-byte immediate versions
      from one definition.
      
      
      Modified:
          llvm/trunk/include/llvm/Target/Mangler.h
      
      Modified: llvm/trunk/include/llvm/Target/Mangler.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Mangler.h?rev=95902&r1=95901&r2=95902&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Target/Mangler.h (original)
      +++ llvm/trunk/include/llvm/Target/Mangler.h Thu Feb 11 13:31:22 2010
      @@ -1,4 +1,4 @@
      -//===-- llvm/Support/Mangler.h - Self-contained name mangler ----*- C++ -*-===//
      +//===-- llvm/Target/Mangler.h - Self-contained name mangler ----*- C++ -*-===//
       //
       //                     The LLVM Compiler Infrastructure
       //
      
      
      
      
      From dpatel at apple.com  Thu Feb 11 13:35:11 2010
      From: dpatel at apple.com (Devang Patel)
      Date: Thu, 11 Feb 2010 19:35:11 -0000
      Subject: [llvm-commits] [llvm] r95903 -
      	/llvm/trunk/lib/VMCore/LLVMContextImpl.h
      Message-ID: <201002111935.o1BJZBZj002472@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Thu Feb 11 13:35:10 2010
      New Revision: 95903
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95903&view=rev
      Log:
      Destroy MDNodes while destructing llvm context.
      
      Modified:
          llvm/trunk/lib/VMCore/LLVMContextImpl.h
      
      Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=95903&r1=95902&r2=95903&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
      +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Thu Feb 11 13:35:10 2010
      @@ -224,7 +224,10 @@
             if (I->second->use_empty())
               delete I->second;
           }
      -    MDNodeSet.clear();
      +    while (!MDNodeSet.empty()) {
      +      MDNode *N = &(*MDNodeSet.begin());
      +      N->destroy();
      +    }
           AlwaysOpaqueTy->dropRef();
           for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();
               I != E; ++I) {
      
      
      
      
      From gohman at apple.com  Thu Feb 11 13:35:26 2010
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 11 Feb 2010 19:35:26 -0000
      Subject: [llvm-commits] [llvm] r95904 -
      	/llvm/trunk/docs/CommandGuide/llvm-db.pod
      Message-ID: <201002111935.o1BJZRje002495@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Thu Feb 11 13:35:26 2010
      New Revision: 95904
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95904&view=rev
      Log:
      llvm-db was removed.
      
      Removed:
          llvm/trunk/docs/CommandGuide/llvm-db.pod
      
      Removed: llvm/trunk/docs/CommandGuide/llvm-db.pod
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-db.pod?rev=95903&view=auto
      
      ==============================================================================
      --- llvm/trunk/docs/CommandGuide/llvm-db.pod (original)
      +++ llvm/trunk/docs/CommandGuide/llvm-db.pod (removed)
      @@ -1,16 +0,0 @@
      -=pod
      -
      -=head1 NAME
      -
      -llvm-db - LLVM debugger (alpha)
      -
      -=head1 SYNOPSIS
      -
      -Details coming soon. Please see 
      -L in the meantime.
      -
      -=head1 AUTHORS
      -
      -Maintained by the LLVM Team (L).
      -
      -=cut
      
      
      
      
      From cdavis at mymail.mines.edu  Thu Feb 11 13:47:12 2010
      From: cdavis at mymail.mines.edu (Charles Davis)
      Date: Thu, 11 Feb 2010 12:47:12 -0700
      Subject: [llvm-commits] [PATCH] Add the alignstack function attribute
      In-Reply-To: <4B73BEA3.1070707@free.fr>
      References: <4B734C0D.1030608@mymail.mines.edu> <4B73BEA3.1070707@free.fr>
      Message-ID: <4B745EC0.9010606@mymail.mines.edu>
      
      Duncan Sands wrote:
      > Hi Charles,
      > 
      >> This attribute, which reuses the 'alignstack' keyword, is intended to
      >> force backends (primarily the x86 backend) to align stacks for generated
      >> functions to 16 bytes. It is not implemented in any backend yet; I would
      >> like to get this patch into LLVM before proceeding.
      > 
      > it would be nicer to be able to write alignstack(16), rather than
      > hard-coding
      > the magic number 16.  I know the attribute infrastructure isn't set up
      > for this
      > right now...
      Done. I also added a test.
      
      New patch attached.
      
      Chip
      
      -------------- next part --------------
      An embedded and charset-unspecified text was scrubbed...
      Name: faap-support-2.patch
      Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100211/01baa5c5/attachment.pl 
      
      From sabre at nondot.org  Thu Feb 11 13:52:11 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 19:52:11 -0000
      Subject: [llvm-commits] [llvm] r95915 -
      	/llvm/trunk/lib/Target/X86/X86InstrInfo.td
      Message-ID: <201002111952.o1BJqBVY003538@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 13:52:11 2010
      New Revision: 95915
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95915&view=rev
      Log:
      unbreak the build.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86InstrInfo.td
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95915&r1=95914&r2=95915&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Feb 11 13:52:11 2010
      @@ -635,7 +635,7 @@
       }
       
       defm JO  : ICBr<0x70, 0x80, "jo\t$dst" , X86_COND_O>;
      -defm JNO : ICBr<0x71, 0x81, "jo\t$dst" , X86_COND_NO>;
      +defm JNO : ICBr<0x71, 0x81, "jno\t$dst" , X86_COND_NO>;
       defm JB  : ICBr<0x72, 0x82, "jb\t$dst" , X86_COND_B>;
       defm JAE : ICBr<0x73, 0x83, "jae\t$dst", X86_COND_AE>;
       defm JE  : ICBr<0x74, 0x84, "je\t$dst" , X86_COND_E>;
      
      
      
      
      From johnny.chen at apple.com  Thu Feb 11 14:31:08 2010
      From: johnny.chen at apple.com (Johnny Chen)
      Date: Thu, 11 Feb 2010 20:31:08 -0000
      Subject: [llvm-commits] [llvm] r95916 -
      	/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
      Message-ID: <201002112031.o1BKV8Ni005776@zion.cs.uiuc.edu>
      
      Author: johnny
      Date: Thu Feb 11 14:31:08 2010
      New Revision: 95916
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95916&view=rev
      Log:
      Added LDRT/LDRBT/STRT/STRBT for disassembly only.
      
      Modified:
          llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
      
      Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95916&r1=95915&r2=95916&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
      +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Thu Feb 11 14:31:08 2010
      @@ -948,6 +948,20 @@
                          "ldrsb", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
       }
       
      +// LDRT and LDRBT are for disassembly only.
      +
      +def LDRT : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
      +                   (ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoadru,
      +                   "ldrt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
      +  let Inst{21} = 1; // overwrite
      +}
      +
      +def LDRBT : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
      +                   (ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoadru,
      +                   "ldrb", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
      +  let Inst{21} = 1; // overwrite
      +}
      +
       // Store
       def STR  : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer,
                      "str", "\t$src, $addr",
      @@ -1011,6 +1025,24 @@
                           [(set GPR:$base_wb, (post_truncsti8 GPR:$src,
                                                GPR:$base, am2offset:$offset))]>;
       
      +// STRT and STRBT are for disassembly only.
      +
      +def STRT : AI2stwpo<(outs GPR:$base_wb),
      +                    (ins GPR:$src, GPR:$base,am2offset:$offset), 
      +                    StFrm, IIC_iStoreru,
      +                    "strt", "\t$src, [$base], $offset", "$base = $base_wb",
      +                    [/* For disassembly only; pattern left blank */]> {
      +  let Inst{21} = 1; // overwrite
      +}
      +
      +def STRBT : AI2stbpo<(outs GPR:$base_wb),
      +                     (ins GPR:$src, GPR:$base,am2offset:$offset), 
      +                     StFrm, IIC_iStoreru,
      +                     "strbt", "\t$src, [$base], $offset", "$base = $base_wb",
      +                     [/* For disassembly only; pattern left blank */]> {
      +  let Inst{21} = 1; // overwrite
      +}
      +
       //===----------------------------------------------------------------------===//
       //  Load / store multiple Instructions.
       //
      
      
      
      
      From stoklund at 2pi.dk  Thu Feb 11 14:58:49 2010
      From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
      Date: Thu, 11 Feb 2010 20:58:49 -0000
      Subject: [llvm-commits] [llvm] r95917 -
      	/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      Message-ID: <201002112058.o1BKwnbs007140@zion.cs.uiuc.edu>
      
      Author: stoklund
      Date: Thu Feb 11 14:58:45 2010
      New Revision: 95917
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95917&view=rev
      Log:
      It is always good to do a cross-class join when the large register has a tiny interval.
      
      Also avoid division by zero.
      
      Modified:
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95917&r1=95916&r2=95917&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Feb 11 14:58:45 2010
      @@ -1148,12 +1148,14 @@
         LiveInterval &SmallInt = li_->getInterval(SmallReg);
         unsigned LargeSize = li_->getApproximateInstructionCount(LargeInt);
         unsigned SmallSize = li_->getApproximateInstructionCount(SmallInt);
      -  if (SmallSize > Threshold || LargeSize > Threshold)
      -    if ((float)std::distance(mri_->use_nodbg_begin(SmallReg),
      -                             mri_->use_nodbg_end()) / SmallSize <
      -        (float)std::distance(mri_->use_nodbg_begin(LargeReg),
      -                             mri_->use_nodbg_end()) / LargeSize)
      +  if (LargeSize > Threshold) {
      +    unsigned SmallUses = std::distance(mri_->use_nodbg_begin(SmallReg),
      +                                       mri_->use_nodbg_end());
      +    unsigned LargeUses = std::distance(mri_->use_nodbg_begin(LargeReg),
      +                                       mri_->use_nodbg_end());
      +    if (SmallUses*LargeSize < LargeUses*SmallSize)
             return false;
      +  }
         return true;
       }
       
      @@ -1561,7 +1563,10 @@
               (isExtSubReg || DstRC->isASubClass()) &&
               !isWinToJoinCrossClass(LargeReg, SmallReg,
                                      allocatableRCRegs_[NewRC].count())) {
      -      DEBUG(dbgs() << "\tSrc/Dest are different register classes.\n");
      +      DEBUG(dbgs() << "\tSrc/Dest are different register classes: "
      +                   << SrcRC->getName() << "/"
      +                   << DstRC->getName() << " -> "
      +                   << NewRC->getName() << ".\n");
             // Allow the coalescer to try again in case either side gets coalesced to
             // a physical register that's compatible with the other side. e.g.
             // r1024 = MOV32to32_ r1025
      
      
      
      
      From dpatel at apple.com  Thu Feb 11 14:58:56 2010
      From: dpatel at apple.com (Devang Patel)
      Date: Thu, 11 Feb 2010 20:58:56 -0000
      Subject: [llvm-commits] [llvm] r95918 -
      	/llvm/trunk/lib/VMCore/LLVMContextImpl.h
      Message-ID: <201002112058.o1BKwu1J007157@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Thu Feb 11 14:58:56 2010
      New Revision: 95918
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95918&view=rev
      Log:
      revert 95903.
      
      Modified:
          llvm/trunk/lib/VMCore/LLVMContextImpl.h
      
      Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=95918&r1=95917&r2=95918&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
      +++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Thu Feb 11 14:58:56 2010
      @@ -224,10 +224,7 @@
             if (I->second->use_empty())
               delete I->second;
           }
      -    while (!MDNodeSet.empty()) {
      -      MDNode *N = &(*MDNodeSet.begin());
      -      N->destroy();
      -    }
      +    MDNodeSet.clear();
           AlwaysOpaqueTy->dropRef();
           for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();
               I != E; ++I) {
      
      
      
      
      From sabre at nondot.org  Thu Feb 11 15:17:55 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 21:17:55 -0000
      Subject: [llvm-commits] [llvm] r95920 -
      	/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      Message-ID: <201002112117.o1BLHtPd008160@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 15:17:54 2010
      New Revision: 95920
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95920&view=rev
      Log:
      switch to target-indep fixups for 1/2/4/8 byte data.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95920&r1=95919&r2=95920&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 15:17:54 2010
      @@ -23,11 +23,8 @@
       namespace llvm {
       namespace X86 {
       enum Fixups {
      -  // FIXME: This is just a stub.
      -  fixup_1byte_imm = FirstTargetFixupKind,
      -  fixup_2byte_imm,
      -  fixup_4byte_imm,
      -  fixup_8byte_imm
      +  reloc_pcrel_4byte = FirstTargetFixupKind,  // 32-bit pcrel, e.g. a branch.
      +  reloc_pcrel_1byte                          // 8-bit pcrel, e.g. branch_1
       };
       }
       }
      @@ -48,15 +45,13 @@
         ~X86MCCodeEmitter() {}
       
         unsigned getNumFixupKinds() const {
      -    return 4;
      +    return 1;
         }
       
         MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
           static MCFixupKindInfo Infos[] = {
      -      { "fixup_1byte_imm", 0, 1 * 8 },
      -      { "fixup_2byte_imm", 0, 2 * 8 },
      -      { "fixup_4byte_imm", 0, 4 * 8 },
      -      { "fixup_8byte_imm", 0, 8 * 8 }
      +      { "reloc_pcrel_4byte", 0, 4 * 8 },
      +      { "reloc_pcrel_1byte", 0, 1 * 8 }
           };
       
           assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind &&
      @@ -148,14 +143,14 @@
         // FIXME: Pass in the relocation type, this is just a hack..
         unsigned FixupKind;
         if (Size == 1)
      -    FixupKind = X86::fixup_1byte_imm;
      +    FixupKind = FK_Data_1;
         else if (Size == 2)
      -    FixupKind = X86::fixup_2byte_imm;
      +    FixupKind = FK_Data_2;
         else if (Size == 4)
      -    FixupKind = X86::fixup_4byte_imm;
      +    FixupKind = FK_Data_4;
         else {
           assert(Size == 8 && "Unknown immediate size");
      -    FixupKind = X86::fixup_8byte_imm;
      +    FixupKind = FK_Data_8;
         }
         
         // Emit a symbolic constant as a fixup and 4 zeros.
      
      
      
      
      From stoklund at 2pi.dk  Thu Feb 11 15:19:44 2010
      From: stoklund at 2pi.dk (Jakob Stoklund Olesen)
      Date: Thu, 11 Feb 2010 21:19:44 -0000
      Subject: [llvm-commits] [llvm] r95921 -
      	/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      Message-ID: <201002112119.o1BLJjUp008254@zion.cs.uiuc.edu>
      
      Author: stoklund
      Date: Thu Feb 11 15:19:44 2010
      New Revision: 95921
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95921&view=rev
      Log:
      Revert functional change. This broke a bunch of tests.
      
      Modified:
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95921&r1=95920&r2=95921&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Feb 11 15:19:44 2010
      @@ -1148,7 +1148,7 @@
         LiveInterval &SmallInt = li_->getInterval(SmallReg);
         unsigned LargeSize = li_->getApproximateInstructionCount(LargeInt);
         unsigned SmallSize = li_->getApproximateInstructionCount(SmallInt);
      -  if (LargeSize > Threshold) {
      +  if (SmallSize > Threshold || LargeSize > Threshold) {
           unsigned SmallUses = std::distance(mri_->use_nodbg_begin(SmallReg),
                                              mri_->use_nodbg_end());
           unsigned LargeUses = std::distance(mri_->use_nodbg_begin(LargeReg),
      
      
      
      
      From sabre at nondot.org  Thu Feb 11 15:27:18 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 21:27:18 -0000
      Subject: [llvm-commits] [llvm] r95924 - in /llvm/trunk:
       include/llvm/MC/MCCodeEmitter.h lib/MC/MCAsmStreamer.cpp
       lib/MC/MCCodeEmitter.cpp lib/Target/X86/X86MCCodeEmitter.cpp
      Message-ID: <201002112127.o1BLRIvL008690@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 15:27:18 2010
      New Revision: 95924
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95924&view=rev
      Log:
      make getFixupKindInfo return a const reference, allowing
      the tables to be const.  Teach MCCodeEmitter to handle
      the target-indep kinds so that we don't crash on them.
      
      Modified:
          llvm/trunk/include/llvm/MC/MCCodeEmitter.h
          llvm/trunk/lib/MC/MCAsmStreamer.cpp
          llvm/trunk/lib/MC/MCCodeEmitter.cpp
          llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      
      Modified: llvm/trunk/include/llvm/MC/MCCodeEmitter.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCCodeEmitter.h?rev=95924&r1=95923&r2=95924&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/MC/MCCodeEmitter.h (original)
      +++ llvm/trunk/include/llvm/MC/MCCodeEmitter.h Thu Feb 11 15:27:18 2010
      @@ -56,7 +56,7 @@
         virtual unsigned getNumFixupKinds() const = 0;
       
         /// getFixupKindInfo - Get information on a fixup kind.
      -  virtual MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const = 0;
      +  virtual const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const;
       
         /// @}
       
      
      Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95924&r1=95923&r2=95924&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
      +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Feb 11 15:27:18 2010
      @@ -552,7 +552,7 @@
       
         for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
           MCFixup &F = Fixups[i];
      -    MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
      +    const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
           for (unsigned j = 0; j != Info.TargetSize; ++j) {
             unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j;
             assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
      @@ -599,7 +599,7 @@
       
         for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
           MCFixup &F = Fixups[i];
      -    MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
      +    const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
           OS << "  fixup " << char('A' + i) << " - " << "offset: " << F.getOffset()
              << ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n";
         }
      
      Modified: llvm/trunk/lib/MC/MCCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCCodeEmitter.cpp?rev=95924&r1=95923&r2=95924&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/MC/MCCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/MC/MCCodeEmitter.cpp Thu Feb 11 15:27:18 2010
      @@ -16,3 +16,15 @@
       
       MCCodeEmitter::~MCCodeEmitter() {
       }
      +
      +const MCFixupKindInfo &MCCodeEmitter::getFixupKindInfo(MCFixupKind Kind) const {
      +  static const MCFixupKindInfo Builtins[] = {
      +    { "FK_Data_1", 0, 8 },
      +    { "FK_Data_2", 0, 16 },
      +    { "FK_Data_4", 0, 32 },
      +    { "FK_Data_8", 0, 64 }
      +  };
      +  
      +  assert(Kind <= 3 && "Unknown fixup kind");
      +  return Builtins[Kind];
      +}
      
      Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95924&r1=95923&r2=95924&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 15:27:18 2010
      @@ -45,16 +45,19 @@
         ~X86MCCodeEmitter() {}
       
         unsigned getNumFixupKinds() const {
      -    return 1;
      +    return 2;
         }
       
      -  MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
      -    static MCFixupKindInfo Infos[] = {
      +  const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const {
      +    const static MCFixupKindInfo Infos[] = {
             { "reloc_pcrel_4byte", 0, 4 * 8 },
             { "reloc_pcrel_1byte", 0, 1 * 8 }
           };
      +    
      +    if (Kind < FirstTargetFixupKind)
      +      return MCCodeEmitter::getFixupKindInfo(Kind);
       
      -    assert(Kind >= FirstTargetFixupKind && Kind < MaxTargetFixupKind &&
      +    assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() &&
                  "Invalid kind!");
           return Infos[Kind - FirstTargetFixupKind];
         }
      
      
      
      
      From daniel at zuster.org  Thu Feb 11 15:29:30 2010
      From: daniel at zuster.org (Daniel Dunbar)
      Date: Thu, 11 Feb 2010 21:29:30 -0000
      Subject: [llvm-commits] [llvm] r95925 - in /llvm/trunk:
       include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp
      Message-ID: <201002112129.o1BLTUCQ008798@zion.cs.uiuc.edu>
      
      Author: ddunbar
      Date: Thu Feb 11 15:29:29 2010
      New Revision: 95925
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95925&view=rev
      Log:
      MC: Move MCSectionData::Fixup out to MCAsmFixup.
      
      Modified:
          llvm/trunk/include/llvm/MC/MCAssembler.h
          llvm/trunk/lib/MC/MCAssembler.cpp
      
      Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=95925&r1=95924&r2=95925&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
      +++ llvm/trunk/include/llvm/MC/MCAssembler.h Thu Feb 11 15:29:29 2010
      @@ -22,10 +22,39 @@
       class MCAssembler;
       class MCContext;
       class MCExpr;
      +class MCFragment;
       class MCSection;
       class MCSectionData;
       class MCSymbol;
       
      +/// MCAsmFixup - Represent a fixed size region of bytes inside some fragment
      +/// which needs to be rewritten. This region will either be rewritten by the
      +/// assembler or cause a relocation entry to be generated.
      +struct MCAsmFixup {
      +  /// Fragment - The fragment containing the fixup.
      +  MCFragment *Fragment;
      +  
      +  /// Offset - The offset inside the fragment which needs to be rewritten.
      +  uint64_t Offset;
      +
      +  /// Value - The expression to eventually write into the fragment.
      +  const MCExpr *Value;
      +
      +  /// Size - The fixup size.
      +  unsigned Size;
      +
      +  /// FixedValue - The value to replace the fix up by.
      +  //
      +  // FIXME: This should not be here.
      +  uint64_t FixedValue;
      +
      +public:
      +  MCAsmFixup(MCFragment &_Fragment, uint64_t _Offset, const MCExpr &_Value,
      +             unsigned _Size) 
      +    : Fragment(&_Fragment), Offset(_Offset), Value(&_Value), Size(_Size),
      +      FixedValue(0) {}
      +};
      +
       class MCFragment : public ilist_node {
         MCFragment(const MCFragment&);     // DO NOT IMPLEMENT
         void operator=(const MCFragment&); // DO NOT IMPLEMENT
      @@ -284,41 +313,14 @@
         void operator=(const MCSectionData&); // DO NOT IMPLEMENT
       
       public:
      -  /// Fixup - Represent a fixed size region of bytes inside some fragment which
      -  /// needs to be rewritten. This region will either be rewritten by the
      -  /// assembler or cause a relocation entry to be generated.
      -  struct Fixup {
      -    /// Fragment - The fragment containing the fixup.
      -    MCFragment *Fragment;
      -    
      -    /// Offset - The offset inside the fragment which needs to be rewritten.
      -    uint64_t Offset;
      -
      -    /// Value - The expression to eventually write into the fragment.
      -    const MCExpr *Value;
      -
      -    /// Size - The fixup size.
      -    unsigned Size;
      -
      -    /// FixedValue - The value to replace the fix up by.
      -    //
      -    // FIXME: This should not be here.
      -    uint64_t FixedValue;
      -
      -  public:
      -    Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCExpr &_Value,
      -          unsigned _Size) 
      -      : Fragment(&_Fragment), Offset(_Offset), Value(&_Value), Size(_Size),
      -        FixedValue(0) {}
      -  };
       
         typedef iplist FragmentListType;
       
         typedef FragmentListType::const_iterator const_iterator;
         typedef FragmentListType::iterator iterator;
       
      -  typedef std::vector::const_iterator const_fixup_iterator;
      -  typedef std::vector::iterator fixup_iterator;
      +  typedef std::vector::const_iterator const_fixup_iterator;
      +  typedef std::vector::iterator fixup_iterator;
       
       private:
         iplist Fragments;
      @@ -347,7 +349,7 @@
         mutable unsigned LastFixupLookup;
       
         /// Fixups - The list of fixups in this section.
      -  std::vector Fixups;
      +  std::vector Fixups;
       
         /// HasInstructions - Whether this section has had instructions emitted into
         /// it.
      @@ -385,7 +387,7 @@
         /// @name Fixup Access
         /// @{
       
      -  std::vector &getFixups() {
      +  std::vector &getFixups() {
           return Fixups;
         }
       
      @@ -413,7 +415,8 @@
         //
         // FIXME: This isn't horribly slow in practice, but there are much nicer
         // solutions to applying the fixups.
      -  const Fixup *LookupFixup(const MCFragment *Fragment, uint64_t Offset) const;
      +  const MCAsmFixup *LookupFixup(const MCFragment *Fragment,
      +                                uint64_t Offset) const;
       
         uint64_t getAddress() const { 
           assert(Address != ~UINT64_C(0) && "Address not set!");
      
      Modified: llvm/trunk/lib/MC/MCAssembler.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=95925&r1=95924&r2=95925&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/MC/MCAssembler.cpp (original)
      +++ llvm/trunk/lib/MC/MCAssembler.cpp Thu Feb 11 15:29:29 2010
      @@ -403,7 +403,7 @@
           uint32_t Word1;
         };
         void ComputeScatteredRelocationInfo(MCAssembler &Asm,
      -                                      MCSectionData::Fixup &Fixup,
      +                                      MCAsmFixup &Fixup,
                                             const MCValue &Target,
                                    DenseMap &SymbolMap,
                                            std::vector &Relocs) {
      @@ -454,7 +454,7 @@
         }
       
         void ComputeRelocationInfo(MCAssembler &Asm,
      -                             MCSectionData::Fixup &Fixup,
      +                             MCAsmFixup &Fixup,
                                    DenseMap &SymbolMap,
                                    std::vector &Relocs) {
           MCValue Target;
      @@ -912,15 +912,15 @@
           A->getSectionList().push_back(this);
       }
       
      -const MCSectionData::Fixup *
      -MCSectionData::LookupFixup(const MCFragment *Fragment, uint64_t Offset) const {
      +const MCAsmFixup *MCSectionData::LookupFixup(const MCFragment *Fragment,
      +                                             uint64_t Offset) const {
         // Use a one level cache to turn the common case of accessing the fixups in
         // order into O(1) instead of O(N).
         unsigned i = LastFixupLookup, Count = Fixups.size(), End = Fixups.size();
         if (i >= End)
           i = 0;
         while (Count--) {
      -    const Fixup &F = Fixups[i];
      +    const MCAsmFixup &F = Fixups[i];
           if (F.Fragment == Fragment && F.Offset == Offset) {
             LastFixupLookup = i;
             return &F;
      @@ -998,8 +998,7 @@
       
             // Otherwise, add fixups for the values.
             for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) {
      -        MCSectionData::Fixup Fix(F, i * FF.getValueSize(),
      -                                 FF.getValue(),FF.getValueSize());
      +        MCAsmFixup Fix(F, i*FF.getValueSize(), FF.getValue(),FF.getValueSize());
               SD.getFixups().push_back(Fix);
             }
             break;
      @@ -1107,7 +1106,7 @@
               // Find the fixup.
               //
               // FIXME: Find a better way to write in the fixes.
      -        const MCSectionData::Fixup *Fixup =
      +        const MCAsmFixup *Fixup =
                 F.getParent()->LookupFixup(&F, i * FF.getValueSize());
               assert(Fixup && "Missing fixup for fill value!");
               Value = Fixup->FixedValue;
      
      
      
      
      From daniel at zuster.org  Thu Feb 11 15:29:46 2010
      From: daniel at zuster.org (Daniel Dunbar)
      Date: Thu, 11 Feb 2010 21:29:46 -0000
      Subject: [llvm-commits] [llvm] r95926 - in /llvm/trunk:
       include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp
      Message-ID: <201002112129.o1BLTkSi008820@zion.cs.uiuc.edu>
      
      Author: ddunbar
      Date: Thu Feb 11 15:29:46 2010
      New Revision: 95926
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95926&view=rev
      Log:
      MC: Move assembler-backend's fixup list into the fragment.
      
      Modified:
          llvm/trunk/include/llvm/MC/MCAssembler.h
          llvm/trunk/lib/MC/MCAssembler.cpp
      
      Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=95926&r1=95925&r2=95926&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
      +++ llvm/trunk/include/llvm/MC/MCAssembler.h Thu Feb 11 15:29:46 2010
      @@ -31,9 +31,6 @@
       /// which needs to be rewritten. This region will either be rewritten by the
       /// assembler or cause a relocation entry to be generated.
       struct MCAsmFixup {
      -  /// Fragment - The fragment containing the fixup.
      -  MCFragment *Fragment;
      -  
         /// Offset - The offset inside the fragment which needs to be rewritten.
         uint64_t Offset;
       
      @@ -49,10 +46,8 @@
         uint64_t FixedValue;
       
       public:
      -  MCAsmFixup(MCFragment &_Fragment, uint64_t _Offset, const MCExpr &_Value,
      -             unsigned _Size) 
      -    : Fragment(&_Fragment), Offset(_Offset), Value(&_Value), Size(_Size),
      -      FixedValue(0) {}
      +  MCAsmFixup(uint64_t _Offset, const MCExpr &_Value, unsigned _Size) 
      +    : Offset(_Offset), Value(&_Value), Size(_Size), FixedValue(0) {}
       };
       
       class MCFragment : public ilist_node {
      @@ -60,6 +55,10 @@
         void operator=(const MCFragment&); // DO NOT IMPLEMENT
       
       public:
      +  typedef std::vector::const_iterator const_fixup_iterator;
      +  typedef std::vector::iterator fixup_iterator;
      +
      +public:
         enum FragmentType {
           FT_Data,
           FT_Align,
      @@ -86,6 +85,11 @@
         /// FileSize - The file size of this section. This is ~0 until initialized.
         uint64_t FileSize;
       
      +  /// Fixups - The list of fixups in this fragment.
      +  //
      +  // FIXME: This should be sunk into MCDataFragment.
      +  std::vector Fixups;
      +
         /// @}
       
       protected:
      @@ -107,6 +111,39 @@
           return 0;
         }
       
      +  /// @name Fixup Access
      +  /// @{
      +
      +  /// LookupFixup - Look up the fixup for the given \arg Fragment and \arg
      +  /// Offset.
      +  ///
      +  /// If multiple fixups exist for the same fragment and offset it is undefined
      +  /// which one is returned.
      +  //
      +  // FIXME: This isn't horribly slow in practice, but there are much nicer
      +  // solutions to applying the fixups. This will be fixed by sinking fixups into
      +  // data fragments exclusively.
      +  const MCAsmFixup *LookupFixup(uint64_t Offset) const {
      +    for (unsigned i = 0, e = Fixups.size(); i != e; ++i)
      +      if (Fixups[i].Offset == Offset)
      +        return &Fixups[i];
      +    return 0;
      +  }
      +
      +  std::vector &getFixups() {
      +    return Fixups;
      +  }
      +
      +  fixup_iterator fixup_begin() {
      +    return Fixups.begin();
      +  }
      +
      +  fixup_iterator fixup_end() {
      +    return Fixups.end();
      +  }
      +
      +  size_t fixup_size() const { return Fixups.size(); }
      +
         /// @name Assembler Backend Support
         /// @{
         //
      @@ -313,14 +350,13 @@
         void operator=(const MCSectionData&); // DO NOT IMPLEMENT
       
       public:
      -
         typedef iplist FragmentListType;
       
         typedef FragmentListType::const_iterator const_iterator;
         typedef FragmentListType::iterator iterator;
       
      -  typedef std::vector::const_iterator const_fixup_iterator;
      -  typedef std::vector::iterator fixup_iterator;
      +  typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
      +  typedef FragmentListType::reverse_iterator reverse_iterator;
       
       private:
         iplist Fragments;
      @@ -345,12 +381,6 @@
         /// initialized.
         uint64_t FileSize;
       
      -  /// LastFixupLookup - Cache for the last looked up fixup.
      -  mutable unsigned LastFixupLookup;
      -
      -  /// Fixups - The list of fixups in this section.
      -  std::vector Fixups;
      -
         /// HasInstructions - Whether this section has had instructions emitted into
         /// it.
         unsigned HasInstructions : 1;
      @@ -379,27 +409,15 @@
         iterator end() { return Fragments.end(); }
         const_iterator end() const { return Fragments.end(); }
       
      -  size_t size() const { return Fragments.size(); }
      -
      -  bool empty() const { return Fragments.empty(); }
      +  reverse_iterator rbegin() { return Fragments.rbegin(); }
      +  const_reverse_iterator rbegin() const { return Fragments.rbegin(); }
       
      -  /// @}
      -  /// @name Fixup Access
      -  /// @{
      +  reverse_iterator rend() { return Fragments.rend(); }
      +  const_reverse_iterator rend() const { return Fragments.rend(); }
       
      -  std::vector &getFixups() {
      -    return Fixups;
      -  }
      -
      -  fixup_iterator fixup_begin() {
      -    return Fixups.begin();
      -  }
      -
      -  fixup_iterator fixup_end() {
      -    return Fixups.end();
      -  }
      +  size_t size() const { return Fragments.size(); }
       
      -  size_t fixup_size() const { return Fixups.size(); }
      +  bool empty() const { return Fragments.empty(); }
       
         /// @}
         /// @name Assembler Backend Support
      @@ -407,17 +425,6 @@
         //
         // FIXME: This could all be kept private to the assembler implementation.
       
      -  /// LookupFixup - Look up the fixup for the given \arg Fragment and \arg
      -  /// Offset.
      -  ///
      -  /// If multiple fixups exist for the same fragment and offset it is undefined
      -  /// which one is returned.
      -  //
      -  // FIXME: This isn't horribly slow in practice, but there are much nicer
      -  // solutions to applying the fixups.
      -  const MCAsmFixup *LookupFixup(const MCFragment *Fragment,
      -                                uint64_t Offset) const;
      -
         uint64_t getAddress() const { 
           assert(Address != ~UINT64_C(0) && "Address not set!");
           return Address;
      
      Modified: llvm/trunk/lib/MC/MCAssembler.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=95926&r1=95925&r2=95926&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/MC/MCAssembler.cpp (original)
      +++ llvm/trunk/lib/MC/MCAssembler.cpp Thu Feb 11 15:29:46 2010
      @@ -402,12 +402,12 @@
           uint32_t Word0;
           uint32_t Word1;
         };
      -  void ComputeScatteredRelocationInfo(MCAssembler &Asm,
      +  void ComputeScatteredRelocationInfo(MCAssembler &Asm, MCFragment &Fragment,
                                             MCAsmFixup &Fixup,
                                             const MCValue &Target,
                                    DenseMap &SymbolMap,
                                            std::vector &Relocs) {
      -    uint32_t Address = Fixup.Fragment->getOffset() + Fixup.Offset;
      +    uint32_t Address = Fragment.getOffset() + Fixup.Offset;
           unsigned IsPCRel = 0;
           unsigned Type = RIT_Vanilla;
       
      @@ -453,7 +453,7 @@
           }
         }
       
      -  void ComputeRelocationInfo(MCAssembler &Asm,
      +  void ComputeRelocationInfo(MCAssembler &Asm, MCFragment &Fragment,
                                    MCAsmFixup &Fixup,
                                    DenseMap &SymbolMap,
                                    std::vector &Relocs) {
      @@ -466,11 +466,11 @@
           if (Target.getSymB() ||
               (Target.getSymA() && !Target.getSymA()->isUndefined() &&
                Target.getConstant()))
      -      return ComputeScatteredRelocationInfo(Asm, Fixup, Target,
      +      return ComputeScatteredRelocationInfo(Asm, Fragment, Fixup, Target,
                                                   SymbolMap, Relocs);
       
           // See .
      -    uint32_t Address = Fixup.Fragment->getOffset() + Fixup.Offset;
      +    uint32_t Address = Fragment.getOffset() + Fixup.Offset;
           uint32_t Value = 0;
           unsigned Index = 0;
           unsigned IsPCRel = 0;
      @@ -766,17 +766,19 @@
           // is written.
           std::vector RelocInfos;
           uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize;
      -    for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie;
      -         ++it) {
      +    for (MCAssembler::iterator it = Asm.begin(),
      +           ie = Asm.end(); it != ie; ++it) {
             MCSectionData &SD = *it;
       
             // The assembler writes relocations in the reverse order they were seen.
             //
             // FIXME: It is probably more complicated than this.
             unsigned NumRelocsStart = RelocInfos.size();
      -      for (unsigned i = 0, e = SD.fixup_size(); i != e; ++i)
      -        ComputeRelocationInfo(Asm, SD.getFixups()[e - i - 1], SymbolMap,
      -                              RelocInfos);
      +      for (MCSectionData::reverse_iterator it2 = SD.rbegin(),
      +             ie2 = SD.rend(); it2 != ie2; ++it2)
      +        for (unsigned i = 0, e = it2->fixup_size(); i != e; ++i)
      +          ComputeRelocationInfo(Asm, *it2, it2->getFixups()[e - i - 1],
      +                                SymbolMap, RelocInfos);
       
             unsigned NumRelocs = RelocInfos.size() - NumRelocsStart;
             uint64_t SectionStart = SectionDataStart + SD.getAddress();
      @@ -905,35 +907,12 @@
           Address(~UINT64_C(0)),
           Size(~UINT64_C(0)),
           FileSize(~UINT64_C(0)),
      -    LastFixupLookup(~0),
           HasInstructions(false)
       {
         if (A)
           A->getSectionList().push_back(this);
       }
       
      -const MCAsmFixup *MCSectionData::LookupFixup(const MCFragment *Fragment,
      -                                             uint64_t Offset) const {
      -  // Use a one level cache to turn the common case of accessing the fixups in
      -  // order into O(1) instead of O(N).
      -  unsigned i = LastFixupLookup, Count = Fixups.size(), End = Fixups.size();
      -  if (i >= End)
      -    i = 0;
      -  while (Count--) {
      -    const MCAsmFixup &F = Fixups[i];
      -    if (F.Fragment == Fragment && F.Offset == Offset) {
      -      LastFixupLookup = i;
      -      return &F;
      -    }
      -
      -    ++i;
      -    if (i == End)
      -      i = 0;
      -  }
      -
      -  return 0;
      -}
      -
       /* *** */
       
       MCSymbolData::MCSymbolData() : Symbol(0) {}
      @@ -997,10 +976,13 @@
               break;
       
             // Otherwise, add fixups for the values.
      -      for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) {
      -        MCAsmFixup Fix(F, i*FF.getValueSize(), FF.getValue(),FF.getValueSize());
      -        SD.getFixups().push_back(Fix);
      -      }
      +      //
      +      // FIXME: What we want to do here is lower this to a data fragment once we
      +      // realize it will need relocations. This means that the only place we
      +      // need to worry about relocations and fixing is on data fragments.
      +      for (uint64_t i = 0, e = FF.getCount(); i != e; ++i)
      +        FF.getFixups().push_back(MCAsmFixup(i*FF.getValueSize(), FF.getValue(),
      +                                            FF.getValueSize()));
             break;
           }
       
      @@ -1105,9 +1087,9 @@
             if (!Target.isAbsolute()) {
               // Find the fixup.
               //
      -        // FIXME: Find a better way to write in the fixes.
      -        const MCAsmFixup *Fixup =
      -          F.getParent()->LookupFixup(&F, i * FF.getValueSize());
      +        // FIXME: Find a better way to write in the fixes (move to
      +        // MCDataFragment).
      +        const MCAsmFixup *Fixup = FF.LookupFixup(i * FF.getValueSize());
               assert(Fixup && "Missing fixup for fill value!");
               Value = Fixup->FixedValue;
             }
      
      
      
      
      From sabre at nondot.org  Thu Feb 11 15:45:47 2010
      From: sabre at nondot.org (Chris Lattner)
      Date: Thu, 11 Feb 2010 21:45:47 -0000
      Subject: [llvm-commits] [llvm] r95927 -
      	/llvm/trunk/lib/Target/X86/X86InstrInfo.td
      Message-ID: <201002112145.o1BLjmum009586@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Thu Feb 11 15:45:31 2010
      New Revision: 95927
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95927&view=rev
      Log:
      improve encoding information for branches.  We now know they have
      8 or 32-bit immediates, which allows the new encoder to handle
      them.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86InstrInfo.td
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95927&r1=95926&r2=95927&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Feb 11 15:45:31 2010
      @@ -614,23 +614,20 @@
                           "lret\t$amt", []>;
       }
       
      -// All branches are RawFrm, Void, Branch, and Terminators
       // Unconditional branches.
      -let isBranch = 1, isTerminator = 1 in
      -  class IBr opcode, dag ins, string asm, list pattern> :
      -        I;
      -
      -let isBarrier = 1 in {
      -  def JMP_4 : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
      -  def JMP_1 : IBr<0xEB, (ins brtarget8:$dst), "jmp\t$dst", []>;
      +let isBarrier = 1, isBranch = 1, isTerminator = 1 in {
      +  def JMP_4 : Ii32<0xE9, RawFrm, (outs), (ins brtarget:$dst),
      +                   "jmp\t$dst", [(br bb:$dst)]>;
      +  def JMP_1 : Ii8 <0xEB, RawFrm, (outs), (ins brtarget8:$dst),
      +                   "jmp\t$dst", []>;
       }
       
       // Conditional Branches.
       let isBranch = 1, isTerminator = 1, Uses = [EFLAGS] in {
         multiclass ICBr opc1, bits<8> opc4, string asm, PatFrag Cond> {
      -    def _1 : I;
      -    def _4 : I, TB;
      +    def _1 : Ii8 ;
      +    def _4 : Ii32, TB;
         }
       }
       
      @@ -652,8 +649,8 @@
       defm JG  : ICBr<0x7F, 0x8F, "jg\t$dst" , X86_COND_G>;
       
       // FIXME: What about the CX/RCX versions of this instruction?
      -let Uses = [ECX] in
      -  def JCXZ8 : IBr<0xE3, (ins brtarget8:$dst), "jcxz\t$dst", []>;
      +let Uses = [ECX], isBranch = 1, isTerminator = 1 in
      +  def JCXZ8 : Ii8<0xE3, RawFrm, (outs), (ins brtarget8:$dst), "jcxz\t$dst", []>;
       
       
       // Indirect branches
      @@ -736,8 +733,10 @@
                        "#TC_RETURN $dst $offset",
                        []>;
       
      -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
      -  def TAILJMPd : IBr<0xE9, (ins i32imm_pcrel:$dst, variable_ops),
      +// FIXME: The should be pseudo instructions that are lowered when going to
      +// mcinst.
      +let isCall = 1, isBranch = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
      +  def TAILJMPd : Ii32<0xE9, RawFrm, (outs),(ins i32imm_pcrel:$dst,variable_ops),
                        "jmp\t$dst  # TAILCALL",
                        []>;
       let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
      
      
      
      
      From asl at math.spbu.ru  Thu Feb 11 15:51:58 2010
      From: asl at math.spbu.ru (Anton Korobeynikov)
      Date: Thu, 11 Feb 2010 21:51:58 -0000
      Subject: [llvm-commits] [llvm] r95928 - /llvm/trunk/docs/GettingStarted.html
      Message-ID: <201002112152.o1BLq0tm009983@zion.cs.uiuc.edu>
      
      Author: asl
      Date: Thu Feb 11 15:51:51 2010
      New Revision: 95928
      
      URL: http://llvm.org/viewvc/llvm-project?rev=95928&view=rev
      Log:
      Document binutils requirements for coff targets (cygwin / mingw32).
      
      Modified:
          llvm/trunk/docs/GettingStarted.html
      
      Modified: llvm/trunk/docs/GettingStarted.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=95928&r1=95927&r2=95928&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/GettingStarted.html (original)
      +++ llvm/trunk/docs/GettingStarted.html Thu Feb 11 15:51:51 2010
      @@ -256,13 +256,13 @@
         Cygwin/Win32
         x861,8,
            11
      -  GCC 3.4.X, binutils 2.15
      +  GCC 3.4.X, binutils 2.20
       
       
         MinGW/Win32
         x861,6,
            8, 10
      -  GCC 3.4.X, binutils 2.15
      +  GCC 3.4.X, binutils 2.20
       
       
       
      @@ -318,12 +318,8 @@
       
    • The GCC-based C/C++ frontend does not build
    • The port is done using the MSYS shell.
    • Native code generation exists but is not complete.
    • -
    • Binutils up to post-2.17 has bug in bfd/cofflink.c - preventing LLVM from building correctly. Several workarounds have been - introduced into LLVM build system, but the bug can occur anytime in the - future. We highly recommend that you rebuild your current binutils with the - patch from - Binutils bugzilla, if it wasn't already applied.
    • +
    • Binutils 2.20 or later is required to build the assembler + generated by LLVM properly.
    • XCode 2.5 and gcc 4.0.1 (Apple Build 5370) will trip internal LLVM assert messages when compiled for Release at optimization levels greater than 0 (i.e., "-O1" and higher). From sabre at nondot.org Thu Feb 11 16:39:11 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 22:39:11 -0000 Subject: [llvm-commits] [llvm] r95929 - in /llvm/trunk: include/llvm/MC/MCInstPrinter.h lib/MC/MCAsmStreamer.cpp lib/MC/MCInstPrinter.cpp lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <201002112239.o1BMdBUd012344@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 16:39:10 2010 New Revision: 95929 URL: http://llvm.org/viewvc/llvm-project?rev=95929&view=rev Log: add a new MCInstPrinter::getOpcodeName interface, when it is implemented, llvm-mc --show-inst now uses it to print the instruction opcode as well as the number. Modified: llvm/trunk/include/llvm/MC/MCInstPrinter.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCInstPrinter.cpp llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/include/llvm/MC/MCInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInstPrinter.h?rev=95929&r1=95928&r2=95929&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCInstPrinter.h (original) +++ llvm/trunk/include/llvm/MC/MCInstPrinter.h Thu Feb 11 16:39:10 2010 @@ -14,8 +14,8 @@ class MCInst; class raw_ostream; class MCAsmInfo; +class StringRef; - /// MCInstPrinter - This is an instance of a target assembly language printer /// that converts an MCInst to valid target assembly syntax. class MCInstPrinter { @@ -40,6 +40,10 @@ /// printInst - Print the specified MCInst to the current raw_ostream. /// virtual void printInst(const MCInst *MI) = 0; + + /// getOpcodeName - Return the name of the specified opcode enum (e.g. + /// "MOV32ri") or empty if we can't resolve it. + virtual StringRef getOpcodeName(unsigned Opcode) const; }; } // namespace llvm Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95929&r1=95928&r2=95929&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Feb 11 16:39:10 2010 @@ -617,6 +617,12 @@ raw_ostream &OS = GetCommentOS(); OS << "getOpcodeName(Inst.getOpcode()); + if (!InstName.empty()) + OS << ' ' << InstName; + for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) { OS << "\n "; Inst.getOperand(i).print(OS, &MAI); Modified: llvm/trunk/lib/MC/MCInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCInstPrinter.cpp?rev=95929&r1=95928&r2=95929&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCInstPrinter.cpp (original) +++ llvm/trunk/lib/MC/MCInstPrinter.cpp Thu Feb 11 16:39:10 2010 @@ -8,7 +8,14 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCInstPrinter.h" +#include "llvm/ADT/StringRef.h" using namespace llvm; MCInstPrinter::~MCInstPrinter() { } + +/// getOpcodeName - Return the name of the specified opcode enum (e.g. +/// "MOV32ri") or empty if we can't resolve it. +StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const { + return ""; +} Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95929&r1=95928&r2=95929&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 16:39:10 2010 @@ -282,11 +282,11 @@ /// size, and 3) use of X86-64 extended registers. static unsigned DetermineREXPrefix(const MCInst &MI, unsigned TSFlags, const TargetInstrDesc &Desc) { - unsigned REX = 0; + // Pseudo instructions shouldn't get here. + assert((TSFlags & X86II::FormMask) != X86II::Pseudo && + "Can't encode pseudo instrs"); - // Pseudo instructions do not need REX prefix byte. - if ((TSFlags & X86II::FormMask) == X86II::Pseudo) - return 0; + unsigned REX = 0; if (TSFlags & X86II::REX_W) REX |= 1 << 3; From tonic at nondot.org Thu Feb 11 16:57:27 2010 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 11 Feb 2010 16:57:27 -0600 Subject: [llvm-commits] CVS: llvm-www/releases/2.6/docs/ReleaseNotes.html Message-ID: <201002112257.o1BMvRRf013507@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/2.6/docs: ReleaseNotes.html updated: 1.2 -> 1.3 --- Log message: Correcting the tutorial. Patch by Jeffrey Yasskin. --- Diffs of the changes: (+8 -4) ReleaseNotes.html | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) Index: llvm-www/releases/2.6/docs/ReleaseNotes.html diff -u llvm-www/releases/2.6/docs/ReleaseNotes.html:1.2 llvm-www/releases/2.6/docs/ReleaseNotes.html:1.3 --- llvm-www/releases/2.6/docs/ReleaseNotes.html:1.2 Fri Oct 23 23:13:14 2009 +++ llvm-www/releases/2.6/docs/ReleaseNotes.html Thu Feb 11 16:54:53 2010 @@ -913,9 +913,13 @@
    • All LLVM tools now default to overwriting their output file, behaving more like standard unix tools. Previously, this only happened with the '-f' option.
    • -
    • LLVM build now builds all libraries as .a files instead of some - libraries as relinked .o files. This requires some APIs like - InitializeAllTargets.h. +
    • LLVM build now builds all libraries as .a files instead of some libraries as + relinked .o files. This requires users to explicitly call functions like + those in + Target/TargetSelect.h + and to include files + like ExecutionEngine/JIT.h + to tell the linker to run the static initializers they need.
    @@ -1348,7 +1352,7 @@ src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2009/10/24 04:13:14 $ + Last modified: $Date: 2010/02/11 22:54:53 $ From tonic at nondot.org Thu Feb 11 16:57:27 2010 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 11 Feb 2010 16:57:27 -0600 Subject: [llvm-commits] CVS: llvm-www/releases/2.6/docs/tutorial/LangImpl4.html LangImpl5.html LangImpl6.html LangImpl7.html Message-ID: <201002112257.o1BMvRb6013506@zion.cs.uiuc.edu> Changes in directory llvm-www/releases/2.6/docs/tutorial: LangImpl4.html updated: 1.2 -> 1.3 LangImpl5.html updated: 1.2 -> 1.3 LangImpl6.html updated: 1.2 -> 1.3 LangImpl7.html updated: 1.2 -> 1.3 --- Log message: Correcting the tutorial. Patch by Jeffrey Yasskin. --- Diffs of the changes: (+82 -32) LangImpl4.html | 35 ++++++++++++++++++++++++++--------- LangImpl5.html | 29 ++++++++++++++++++++--------- LangImpl6.html | 25 ++++++++++++++++++------- LangImpl7.html | 25 ++++++++++++++++++------- 4 files changed, 82 insertions(+), 32 deletions(-) Index: llvm-www/releases/2.6/docs/tutorial/LangImpl4.html diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.3 --- llvm-www/releases/2.6/docs/tutorial/LangImpl4.html:1.2 Fri Oct 23 23:13:19 2009 +++ llvm-www/releases/2.6/docs/tutorial/LangImpl4.html Thu Feb 11 16:55:00 2010 @@ -299,7 +299,13 @@ int main() { .. // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); + std::string ErrStr; + TheExecutionEngine = + EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create(); + if (!TheExecutionEngine) { + fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); + exit(1); + } .. } @@ -512,12 +518,14 @@
     #include "llvm/DerivedTypes.h"
     #include "llvm/ExecutionEngine/ExecutionEngine.h"
    +#include "llvm/ExecutionEngine/JIT.h"
     #include "llvm/LLVMContext.h"
     #include "llvm/Module.h"
     #include "llvm/ModuleProvider.h"
     #include "llvm/PassManager.h"
     #include "llvm/Analysis/Verifier.h"
     #include "llvm/Target/TargetData.h"
    +#include "llvm/Target/TargetSelect.h"
     #include "llvm/Transforms/Scalar.h"
     #include "llvm/Support/IRBuilder.h"
     #include <cstdio>
    @@ -1022,7 +1030,7 @@
           
           // Cast it to the right type (takes no arguments, returns a double) so we
           // can call it as a native function.
    -      double (*FP)() = (double (*)())FPtr;
    +      double (*FP)() = (double (*)())(intptr_t)FPtr;
           fprintf(stderr, "Evaluated to %f\n", FP());
         }
       } else {
    @@ -1063,6 +1071,8 @@
     //===----------------------------------------------------------------------===//
     
     int main() {
    +  InitializeNativeTarget();
    +
       // Install standard binary operators.
       // 1 is lowest precedence.
       BinopPrecedence['<'] = 10;
    @@ -1076,13 +1086,20 @@
     
       // Make the module, which holds all the code.
       TheModule = new Module("my cool jit", getGlobalContext());
    -  
    +  ExistingModuleProvider *OurModuleProvider =
    +      new ExistingModuleProvider(TheModule);
    +
       // Create the JIT.
    -  TheExecutionEngine = EngineBuilder(TheModule).create();
    +  std::string ErrStr;
    +  TheExecutionEngine =
    +      EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
    +  if (!TheExecutionEngine) {
    +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
    +    exit(1);
    +  }
     
       {
    -    ExistingModuleProvider OurModuleProvider(TheModule);
    -    FunctionPassManager OurFPM(&OurModuleProvider);
    +    FunctionPassManager OurFPM(OurModuleProvider);
           
         // Set up the optimizer pipeline.  Start with registering info about how the
         // target lays out data structures.
    @@ -1106,8 +1123,8 @@
         
         // Print out all of the generated code.
         TheModule->dump();
    -  }  // Free module provider (and thus the module) and pass manager.
    -                                   
    +  }  // Free pass manager.
    +  
       return 0;
     }
     
    @@ -1126,7 +1143,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2009/10/24 04:13:19 $ + Last modified: $Date: 2010/02/11 22:55:00 $ Index: llvm-www/releases/2.6/docs/tutorial/LangImpl5.html diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.3 --- llvm-www/releases/2.6/docs/tutorial/LangImpl5.html:1.2 Fri Oct 23 23:13:19 2009 +++ llvm-www/releases/2.6/docs/tutorial/LangImpl5.html Thu Feb 11 16:55:01 2010 @@ -901,12 +901,14 @@
     #include "llvm/DerivedTypes.h"
     #include "llvm/ExecutionEngine/ExecutionEngine.h"
    +#include "llvm/ExecutionEngine/JIT.h"
     #include "llvm/LLVMContext.h"
     #include "llvm/Module.h"
     #include "llvm/ModuleProvider.h"
     #include "llvm/PassManager.h"
     #include "llvm/Analysis/Verifier.h"
     #include "llvm/Target/TargetData.h"
    +#include "llvm/Target/TargetSelect.h"
     #include "llvm/Transforms/Scalar.h"
     #include "llvm/Support/IRBuilder.h"
     #include <cstdio>
    @@ -1545,7 +1547,7 @@
     
       
       // for expr always returns 0.0.
    -  return getGlobalContext().getNullValue(Type::getDoubleTy(getGlobalContext()));
    +  return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
     }
     
     Function *PrototypeAST::Codegen() {
    @@ -1656,7 +1658,7 @@
           
           // Cast it to the right type (takes no arguments, returns a double) so we
           // can call it as a native function.
    -      double (*FP)() = (double (*)())FPtr;
    +      double (*FP)() = (double (*)())(intptr_t)FPtr;
           fprintf(stderr, "Evaluated to %f\n", FP());
         }
       } else {
    @@ -1697,6 +1699,8 @@
     //===----------------------------------------------------------------------===//
     
     int main() {
    +  InitializeNativeTarget();
    +
       // Install standard binary operators.
       // 1 is lowest precedence.
       BinopPrecedence['<'] = 10;
    @@ -1710,13 +1714,20 @@
     
       // Make the module, which holds all the code.
       TheModule = new Module("my cool jit", getGlobalContext());
    -  
    +  ExistingModuleProvider *OurModuleProvider =
    +      new ExistingModuleProvider(TheModule);
    +
       // Create the JIT.
    -  TheExecutionEngine = EngineBuilder(TheModule).create();
    +  std::string ErrStr;
    +  TheExecutionEngine =
    +      EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
    +  if (!TheExecutionEngine) {
    +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
    +    exit(1);
    +  }
     
       {
    -    ExistingModuleProvider OurModuleProvider(TheModule);
    -    FunctionPassManager OurFPM(&OurModuleProvider);
    +    FunctionPassManager OurFPM(OurModuleProvider);
           
         // Set up the optimizer pipeline.  Start with registering info about how the
         // target lays out data structures.
    @@ -1739,8 +1750,8 @@
     
         // Print out all of the generated code.
         TheModule->dump();
    -  }  // Free module provider (and thus the module) and pass manager.
    -                                   
    +  }  // Free pass manager.
    +  
       return 0;
     }
     
    @@ -1759,7 +1770,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2009/10/24 04:13:19 $ + Last modified: $Date: 2010/02/11 22:55:01 $ Index: llvm-www/releases/2.6/docs/tutorial/LangImpl6.html diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.3 --- llvm-www/releases/2.6/docs/tutorial/LangImpl6.html:1.2 Fri Oct 23 23:13:19 2009 +++ llvm-www/releases/2.6/docs/tutorial/LangImpl6.html Thu Feb 11 16:55:01 2010 @@ -821,12 +821,14 @@
     #include "llvm/DerivedTypes.h"
     #include "llvm/ExecutionEngine/ExecutionEngine.h"
    +#include "llvm/ExecutionEngine/JIT.h"
     #include "llvm/LLVMContext.h"
     #include "llvm/Module.h"
     #include "llvm/ModuleProvider.h"
     #include "llvm/PassManager.h"
     #include "llvm/Analysis/Verifier.h"
     #include "llvm/Target/TargetData.h"
    +#include "llvm/Target/TargetSelect.h"
     #include "llvm/Transforms/Scalar.h"
     #include "llvm/Support/IRBuilder.h"
     #include <cstdio>
    @@ -1688,7 +1690,7 @@
           
           // Cast it to the right type (takes no arguments, returns a double) so we
           // can call it as a native function.
    -      double (*FP)() = (double (*)())FPtr;
    +      double (*FP)() = (double (*)())(intptr_t)FPtr;
           fprintf(stderr, "Evaluated to %f\n", FP());
         }
       } else {
    @@ -1736,6 +1738,8 @@
     //===----------------------------------------------------------------------===//
     
     int main() {
    +  InitializeNativeTarget();
    +
       // Install standard binary operators.
       // 1 is lowest precedence.
       BinopPrecedence['<'] = 10;
    @@ -1749,13 +1753,20 @@
     
       // Make the module, which holds all the code.
       TheModule = new Module("my cool jit", getGlobalContext());
    -  
    +  ExistingModuleProvider *OurModuleProvider =
    +      new ExistingModuleProvider(TheModule);
    +
       // Create the JIT.
    -  TheExecutionEngine = EngineBuilder(TheModule).create();
    +  std::string ErrStr;
    +  TheExecutionEngine =
    +      EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
    +  if (!TheExecutionEngine) {
    +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
    +    exit(1);
    +  }
     
       {
    -    ExistingModuleProvider OurModuleProvider(TheModule);
    -    FunctionPassManager OurFPM(&OurModuleProvider);
    +    FunctionPassManager OurFPM(OurModuleProvider);
           
         // Set up the optimizer pipeline.  Start with registering info about how the
         // target lays out data structures.
    @@ -1778,7 +1789,7 @@
         
         // Print out all of the generated code.
         TheModule->dump();
    -  }  // Free module provider (and thus the module) and pass manager.
    +  }  // Free pass manager.
       
       return 0;
     }
    @@ -1798,7 +1809,7 @@
     
       Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2009/10/24 04:13:19 $ + Last modified: $Date: 2010/02/11 22:55:01 $ Index: llvm-www/releases/2.6/docs/tutorial/LangImpl7.html diff -u llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.2 llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.3 --- llvm-www/releases/2.6/docs/tutorial/LangImpl7.html:1.2 Fri Oct 23 23:13:19 2009 +++ llvm-www/releases/2.6/docs/tutorial/LangImpl7.html Thu Feb 11 16:55:01 2010 @@ -1003,12 +1003,14 @@
     #include "llvm/DerivedTypes.h"
     #include "llvm/ExecutionEngine/ExecutionEngine.h"
    +#include "llvm/ExecutionEngine/JIT.h"
     #include "llvm/LLVMContext.h"
     #include "llvm/Module.h"
     #include "llvm/ModuleProvider.h"
     #include "llvm/PassManager.h"
     #include "llvm/Analysis/Verifier.h"
     #include "llvm/Target/TargetData.h"
    +#include "llvm/Target/TargetSelect.h"
     #include "llvm/Transforms/Scalar.h"
     #include "llvm/Support/IRBuilder.h"
     #include <cstdio>
    @@ -2039,7 +2041,7 @@
           
           // Cast it to the right type (takes no arguments, returns a double) so we
           // can call it as a native function.
    -      double (*FP)() = (double (*)())FPtr;
    +      double (*FP)() = (double (*)())(intptr_t)FPtr;
           fprintf(stderr, "Evaluated to %f\n", FP());
         }
       } else {
    @@ -2087,6 +2089,8 @@
     //===----------------------------------------------------------------------===//
     
     int main() {
    +  InitializeNativeTarget();
    +
       // Install standard binary operators.
       // 1 is lowest precedence.
       BinopPrecedence['='] = 2;
    @@ -2101,13 +2105,20 @@
     
       // Make the module, which holds all the code.
       TheModule = new Module("my cool jit", getGlobalContext());
    -  
    +  ExistingModuleProvider *OurModuleProvider =
    +      new ExistingModuleProvider(TheModule);
    +
       // Create the JIT.
    -  TheExecutionEngine = EngineBuilder(TheModule).create();
    +  std::string ErrStr;
    +  TheExecutionEngine =
    +      EngineBuilder(OurModuleProvider).setErrorStr(&ErrStr).create();
    +  if (!TheExecutionEngine) {
    +    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
    +    exit(1);
    +  }
     
       {
    -    ExistingModuleProvider OurModuleProvider(TheModule);
    -    FunctionPassManager OurFPM(&OurModuleProvider);
    +    FunctionPassManager OurFPM(OurModuleProvider);
           
         // Set up the optimizer pipeline.  Start with registering info about how the
         // target lays out data structures.
    @@ -2134,7 +2145,7 @@
         // Print out all of the generated code.
         TheModule->dump();
         
    -  }  // Free module provider (and thus the module) and pass manager.
    +  }  // Free pass manager.
       
       return 0;
     }
    @@ -2154,7 +2165,7 @@
     
       Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2009/10/24 04:13:19 $ + Last modified: $Date: 2010/02/11 22:55:01 $ From sabre at nondot.org Thu Feb 11 16:57:34 2010 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Feb 2010 22:57:34 -0000 Subject: [llvm-commits] [llvm] r95935 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h utils/TableGen/AsmWriterEmitter.cpp utils/TableGen/AsmWriterEmitter.h Message-ID: <201002112257.o1BMvYvg013525@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 16:57:32 2010 New Revision: 95935 URL: http://llvm.org/viewvc/llvm-project?rev=95935&view=rev Log: enhance llvm-mc -show-inst to print the enum of an instruction, like so: testb %al, %al ## ## > jne LBB1_7 ## > Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Thu Feb 11 16:57:32 2010 @@ -25,10 +25,15 @@ // Include the auto-generated portion of the assembly writer. #define MachineInstr MCInst +#define GET_INSTRUCTION_NAME #include "X86GenAsmWriter.inc" #undef MachineInstr void X86ATTInstPrinter::printInst(const MCInst *MI) { printInstruction(MI); } +StringRef X86ATTInstPrinter::getOpcodeName(unsigned Opcode) const { + return getInstructionName(Opcode); +} + void X86ATTInstPrinter::printSSECC(const MCInst *MI, unsigned Op) { switch (MI->getOperand(Op).getImm()) { Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h Thu Feb 11 16:57:32 2010 @@ -26,11 +26,12 @@ virtual void printInst(const MCInst *MI); - + virtual StringRef getOpcodeName(unsigned Opcode) const; + // Autogenerated by tblgen. void printInstruction(const MCInst *MI); static const char *getRegisterName(unsigned RegNo); - + static const char *getInstructionName(unsigned Opcode); void printOperand(const MCInst *MI, unsigned OpNo); void printMemReference(const MCInst *MI, unsigned Op); Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp Thu Feb 11 16:57:32 2010 @@ -24,10 +24,14 @@ // Include the auto-generated portion of the assembly writer. #define MachineInstr MCInst +#define GET_INSTRUCTION_NAME #include "X86GenAsmWriter1.inc" #undef MachineInstr void X86IntelInstPrinter::printInst(const MCInst *MI) { printInstruction(MI); } +StringRef X86IntelInstPrinter::getOpcodeName(unsigned Opcode) const { + return getInstructionName(Opcode); +} void X86IntelInstPrinter::printSSECC(const MCInst *MI, unsigned Op) { switch (MI->getOperand(Op).getImm()) { Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h Thu Feb 11 16:57:32 2010 @@ -26,10 +26,12 @@ : MCInstPrinter(O, MAI) {} virtual void printInst(const MCInst *MI); + virtual StringRef getOpcodeName(unsigned Opcode) const; // Autogenerated by tblgen. void printInstruction(const MCInst *MI); static const char *getRegisterName(unsigned RegNo); + static const char *getInstructionName(unsigned Opcode); void printOperand(const MCInst *MI, unsigned OpNo, Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Thu Feb 11 16:57:32 2010 @@ -494,11 +494,55 @@ << "}\n"; } +void AsmWriterEmitter::EmitGetInstructionName(raw_ostream &O) { + CodeGenTarget Target; + Record *AsmWriter = Target.getAsmWriter(); + std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); + + std::vector NumberedInstructions; + Target.getInstructionsByEnumValue(NumberedInstructions); + + StringToOffsetTable StringTable; + O << +"\n\n#ifdef GET_INSTRUCTION_NAME\n" +"#undef GET_INSTRUCTION_NAME\n\n" +"/// getInstructionName: This method is automatically generated by tblgen\n" +"/// from the instruction set description. This returns the enum name of the\n" +"/// specified instruction.\n" + "const char *" << Target.getName() << ClassName + << "::getInstructionName(unsigned Opcode) {\n" + << " assert(Opcode < " << NumberedInstructions.size() + << " && \"Invalid instruction number!\");\n" + << "\n" + << " static const unsigned InstAsmOffset[] = {"; + for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { + const CodeGenInstruction &Inst = *NumberedInstructions[i]; + + std::string AsmName = Inst.TheDef->getName(); + if ((i % 14) == 0) + O << "\n "; + + O << StringTable.GetOrAddStringOffset(AsmName) << ", "; + } + O << "0\n" + << " };\n" + << "\n"; + + O << " const char *Strs =\n"; + StringTable.EmitString(O); + O << ";\n"; + + O << " return Strs+InstAsmOffset[Opcode];\n" + << "}\n\n#endif\n"; +} + + void AsmWriterEmitter::run(raw_ostream &O) { EmitSourceFileHeader("Assembly Writer Source Fragment", O); EmitPrintInstruction(O); EmitGetRegisterName(O); + EmitGetInstructionName(O); } Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.h?rev=95935&r1=95934&r2=95935&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.h (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.h Thu Feb 11 16:57:32 2010 @@ -37,6 +37,7 @@ private: void EmitPrintInstruction(raw_ostream &o); void EmitGetRegisterName(raw_ostream &o); + void EmitGetInstructionName(raw_ostream &o); AsmWriterInst *getAsmWriterInstByID(unsigned ID) const { assert(ID < NumberedInstructions.size()); From stoklund at 2pi.dk Thu Feb 11 17:55:29 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 11 Feb 2010 23:55:29 -0000 Subject: [llvm-commits] [llvm] r95938 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/Thumb2/cross-rc-coalescing-2.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/pr1505b.ll test/CodeGen/X86/pr3495.ll test/CodeGen/X86/stack-color-with-reg.ll test/CodeGen/X86/twoaddr-coalesce.ll Message-ID: <201002112355.o1BNtU9k016749@zion.cs.uiuc.edu> Author: stoklund Date: Thu Feb 11 17:55:29 2010 New Revision: 95938 URL: http://llvm.org/viewvc/llvm-project?rev=95938&view=rev Log: Reapply coalescer fix for better cross-class coalescing. This time with fixed test cases. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/test/CodeGen/Thumb2/cross-rc-coalescing-2.ll llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll llvm/trunk/test/CodeGen/X86/pr1505b.ll llvm/trunk/test/CodeGen/X86/pr3495.ll llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Feb 11 17:55:29 2010 @@ -1148,7 +1148,7 @@ LiveInterval &SmallInt = li_->getInterval(SmallReg); unsigned LargeSize = li_->getApproximateInstructionCount(LargeInt); unsigned SmallSize = li_->getApproximateInstructionCount(SmallInt); - if (SmallSize > Threshold || LargeSize > Threshold) { + if (LargeSize > Threshold) { unsigned SmallUses = std::distance(mri_->use_nodbg_begin(SmallReg), mri_->use_nodbg_end()); unsigned LargeUses = std::distance(mri_->use_nodbg_begin(LargeReg), Modified: llvm/trunk/test/CodeGen/Thumb2/cross-rc-coalescing-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/cross-rc-coalescing-2.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/cross-rc-coalescing-2.ll (original) +++ llvm/trunk/test/CodeGen/Thumb2/cross-rc-coalescing-2.ll Thu Feb 11 17:55:29 2010 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=thumbv7-apple-darwin9 -mcpu=cortex-a8 | grep vmov.f32 | count 7 +; RUN: llc < %s -mtriple=thumbv7-apple-darwin9 -mcpu=cortex-a8 | grep vmov.f32 | count 3 define arm_apcscc void @fht(float* nocapture %fz, i16 signext %n) nounwind { entry: Modified: llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll Thu Feb 11 17:55:29 2010 @@ -1,9 +1,7 @@ ; RUN: llc < %s -march=x86 -relocation-model=static -disable-fp-elim -post-RA-scheduler=false -asm-verbose=0 | FileCheck %s ; PR2536 - -; CHECK: movw %cx -; CHECK-NEXT: andl $65534, % +; CHECK: andl $65534, % ; CHECK-NEXT: movl % ; CHECK-NEXT: movl $17 Modified: llvm/trunk/test/CodeGen/X86/pr1505b.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr1505b.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr1505b.ll (original) +++ llvm/trunk/test/CodeGen/X86/pr1505b.ll Thu Feb 11 17:55:29 2010 @@ -1,5 +1,5 @@ -; RUN: llc < %s -mcpu=i486 | grep fstpl | count 4 -; RUN: llc < %s -mcpu=i486 | grep fstps | count 3 +; RUN: llc < %s -mcpu=i486 | grep fstpl | count 5 +; RUN: llc < %s -mcpu=i486 | grep fstps | count 2 ; PR1505 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/X86/pr3495.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr3495.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr3495.ll (original) +++ llvm/trunk/test/CodeGen/X86/pr3495.ll Thu Feb 11 17:55:29 2010 @@ -1,6 +1,6 @@ ; RUN: llc < %s -march=x86 -stats |& grep {Number of loads added} | grep 2 ; RUN: llc < %s -march=x86 -stats |& grep {Number of register spills} | grep 1 -; RUN: llc < %s -march=x86 -stats |& grep {Number of machine instrs printed} | grep 38 +; RUN: llc < %s -march=x86 -stats |& grep {Number of machine instrs printed} | grep 37 ; PR3495 ; The loop reversal kicks in once here, resulting in one fewer instruction. Modified: llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll (original) +++ llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll Thu Feb 11 17:55:29 2010 @@ -1,5 +1,5 @@ ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -relocation-model=pic -disable-fp-elim -color-ss-with-regs -stats -info-output-file - > %t -; RUN: grep stackcoloring %t | grep "stack slot refs replaced with reg refs" | grep 14 +; RUN: grep stackcoloring %t | grep "stack slot refs replaced with reg refs" | grep 8 type { [62 x %struct.Bitvec*] } ; type %0 type { i8* } ; type %1 Modified: llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll?rev=95938&r1=95937&r2=95938&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll (original) +++ llvm/trunk/test/CodeGen/X86/twoaddr-coalesce.ll Thu Feb 11 17:55:29 2010 @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86 | grep mov | count 5 +; RUN: llc < %s -march=x86 | grep mov | count 4 ; rdar://6523745 @"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] From anton at korobeynikov.info Thu Feb 11 18:04:31 2010 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Fri, 12 Feb 2010 03:04:31 +0300 Subject: [llvm-commits] [PATCH] Add the alignstack function attribute In-Reply-To: <4B745EC0.9010606@mymail.mines.edu> References: <4B734C0D.1030608@mymail.mines.edu> <4B73BEA3.1070707@free.fr> <4B745EC0.9010606@mymail.mines.edu> Message-ID: Hello, Charles > Done. I also added a test. > > New patch attached. Looks ok, but don't forget about documentation :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sabre at nondot.org Thu Feb 11 18:37:46 2010 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Feb 2010 00:37:46 -0000 Subject: [llvm-commits] [llvm] r95946 - in /llvm/trunk/lib/System/Unix: Program.inc Signals.inc Message-ID: <201002120037.o1C0bkFx019341@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 18:37:46 2010 New Revision: 95946 URL: http://llvm.org/viewvc/llvm-project?rev=95946&view=rev Log: improve support for minix, PR6280, patch by Kees van Reeuwijk! Modified: llvm/trunk/lib/System/Unix/Program.inc llvm/trunk/lib/System/Unix/Signals.inc Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=95946&r1=95945&r2=95946&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Thu Feb 11 18:37:46 2010 @@ -126,7 +126,7 @@ static void SetMemoryLimits (unsigned size) { -#if HAVE_SYS_RESOURCE_H +#if HAVE_SYS_RESOURCE_H && HAVE_GETRLIMIT && HAVE_SETRLIMIT struct rlimit r; __typeof__ (r.rlim_cur) limit = (__typeof__ (r.rlim_cur)) (size) * 1048576; Modified: llvm/trunk/lib/System/Unix/Signals.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Signals.inc?rev=95946&r1=95945&r2=95946&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Signals.inc (original) +++ llvm/trunk/lib/System/Unix/Signals.inc Thu Feb 11 18:37:46 2010 @@ -52,7 +52,16 @@ // KillSigs - Signals that are synchronous with the program that will cause it // to die. static const int KillSigs[] = { - SIGILL, SIGTRAP, SIGABRT, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGXCPU, SIGXFSZ + SIGILL, SIGTRAP, SIGABRT, SIGFPE, SIGBUS, SIGSEGV +#ifdef SIGSYS + , SIGSYS +#endif +#ifdef SIGXCPU + , SIGXCPU +#endif +#ifdef SIGEMT + , SIGXFSZ +#endif #ifdef SIGEMT , SIGEMT #endif From sabre at nondot.org Thu Feb 11 19:06:22 2010 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Feb 2010 01:06:22 -0000 Subject: [llvm-commits] [llvm] r95947 - in /llvm/trunk: lib/Target/X86/X86MCCodeEmitter.cpp test/MC/AsmParser/X86/x86_32-new-encoder.s Message-ID: <201002120106.o1C16MRn020577@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 19:06:22 2010 New Revision: 95947 URL: http://llvm.org/viewvc/llvm-project?rev=95947&view=rev Log: fix the encodings of monitor and mwait, which were completely busted in both encoders. I'm not bothering to fix it in the old one at this point. Added: llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95947&r1=95946&r2=95947&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 19:06:22 2010 @@ -542,14 +542,9 @@ // FIXME: This is terrible, they should get proper encoding bits in TSFlags. if (Opcode == X86::LFENCE || Opcode == X86::MFENCE || Opcode == X86::MONITOR || Opcode == X86::MWAIT) { - EmitByte(ModRMByte(3, (TSFlags & X86II::FormMask)-X86II::MRM0r, 0), + EmitByte(ModRMByte(3, (TSFlags & X86II::FormMask)-X86II::MRM0r, + Opcode == X86::MWAIT), CurByte, OS); - - switch (Opcode) { - default: break; - case X86::MONITOR: EmitByte(0xC8, CurByte, OS); break; - case X86::MWAIT: EmitByte(0xC9, CurByte, OS); break; - } } else { EmitRegModRMByte(MI.getOperand(CurOp++), (TSFlags & X86II::FormMask)-X86II::MRM0r, Added: llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s?rev=95947&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s (added) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-new-encoder.s Thu Feb 11 19:06:22 2010 @@ -0,0 +1,14 @@ +// RUN: llvm-mc -triple i386-unknown-unknown --show-encoding --enable-new-x86-encoder %s | FileCheck %s + + lfence +// CHECK: lfence +// CHECK: encoding: [0x0f,0xae,0xe8] + mfence +// CHECK: mfence +// CHECK: encoding: [0x0f,0xae,0xf0] + monitor +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + mwait +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] \ No newline at end of file From natebegeman at mac.com Thu Feb 11 19:10:45 2010 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 12 Feb 2010 01:10:45 -0000 Subject: [llvm-commits] [llvm] r95948 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <201002120110.o1C1AkGY020765@zion.cs.uiuc.edu> Author: sampo Date: Thu Feb 11 19:10:45 2010 New Revision: 95948 URL: http://llvm.org/viewvc/llvm-project?rev=95948&view=rev Log: Add a missing pattern for movhps so that we get: movq (%ecx,%edx,2), %xmm2 movhps (%ecx,%eax,2), %xmm2 rather than: movq (%eax, %edx, 2), %xmm2 movq (%eax, %ebx, 2), %xmm3 movlhps %xmm3, %xmm2 Testcase forthcoming. Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=95948&r1=95947&r2=95948&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Feb 11 19:10:45 2010 @@ -762,6 +762,9 @@ } // Constraints = "$src1 = $dst" +def : Pat<(movlhps VR128:$src1, (bc_v4i32 (v2i64 (X86vzload addr:$src2)))), + (MOVHPSrm VR128:$src1, addr:$src2)>; + def MOVLPSmr : PSI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), "movlps\t{$src, $dst|$dst, $src}", [(store (f64 (vector_extract (bc_v2f64 (v4f32 VR128:$src)), From sabre at nondot.org Thu Feb 11 19:15:16 2010 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Feb 2010 01:15:16 -0000 Subject: [llvm-commits] [llvm] r95949 - in /llvm/trunk/lib/Target/X86: X86.td X86InstrInfo.h Message-ID: <201002120115.o1C1FGWT020952@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 19:15:16 2010 New Revision: 95949 URL: http://llvm.org/viewvc/llvm-project?rev=95949&view=rev Log: add another bit of space for new kinds of instruction prefixes. Modified: llvm/trunk/lib/Target/X86/X86.td llvm/trunk/lib/Target/X86/X86InstrInfo.h Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=95949&r1=95948&r2=95949&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Thu Feb 11 19:15:16 2010 @@ -168,11 +168,11 @@ 6, 7, 8, - 12, 13, - 16, - 19, + 14, + 17, 20, + 21, 24]; } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=95949&r1=95948&r2=95949&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Feb 11 19:15:16 2010 @@ -291,7 +291,7 @@ // set, there is no prefix byte for obtaining a multibyte opcode. // Op0Shift = 8, - Op0Mask = 0xF << Op0Shift, + Op0Mask = 0x1F << Op0Shift, // TB - TwoByte - Set if this instruction has a two byte opcode, which // starts with a 0x0F byte before the real opcode. @@ -324,13 +324,13 @@ // etc. We only cares about REX.W and REX.R bits and only the former is // statically determined. // - REXShift = 12, + REXShift = 13, REX_W = 1 << REXShift, //===------------------------------------------------------------------===// // This three-bit field describes the size of an immediate operand. Zero is // unused so that we can tell if we forgot to set a value. - ImmShift = 13, + ImmShift = 14, ImmMask = 7 << ImmShift, Imm8 = 1 << ImmShift, Imm16 = 2 << ImmShift, @@ -341,7 +341,7 @@ // FP Instruction Classification... Zero is non-fp instruction. // FPTypeMask - Mask for all of the FP types... - FPTypeShift = 16, + FPTypeShift = 17, FPTypeMask = 7 << FPTypeShift, // NotFP - The default, set for instructions that do not use FP registers. @@ -374,17 +374,17 @@ SpecialFP = 7 << FPTypeShift, // Lock prefix - LOCKShift = 19, + LOCKShift = 20, LOCK = 1 << LOCKShift, // Segment override prefixes. Currently we just need ability to address // stuff in gs and fs segments. - SegOvrShift = 20, + SegOvrShift = 21, SegOvrMask = 3 << SegOvrShift, FS = 1 << SegOvrShift, GS = 2 << SegOvrShift, - // Bits 22 -> 23 are unused + // Bit 23 is unused. OpcodeShift = 24, OpcodeMask = 0xFF << OpcodeShift }; From daniel at zuster.org Thu Feb 11 19:22:03 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 12 Feb 2010 01:22:03 -0000 Subject: [llvm-commits] [llvm] r95950 - in /llvm/trunk/lib/Target/X86: X86Instr64bit.td X86InstrInfo.td Message-ID: <201002120122.o1C1M3RC021260@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Feb 11 19:22:03 2010 New Revision: 95950 URL: http://llvm.org/viewvc/llvm-project?rev=95950&view=rev Log: X86: Fix definition for RCL/RCR.*m? operations -- they were getting represented with "tied memory operands", which is wrong. Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=95950&r1=95949&r2=95950&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Thu Feb 11 19:22:03 2010 @@ -893,35 +893,38 @@ let isTwoAddress = 1 in { def RCL64r1 : RI<0xD1, MRM2r, (outs GR64:$dst), (ins GR64:$src), "rcl{q}\t{1, $dst|$dst, 1}", []>; -def RCL64m1 : RI<0xD1, MRM2m, (outs i64mem:$dst), (ins i64mem:$src), - "rcl{q}\t{1, $dst|$dst, 1}", []>; -let Uses = [CL] in { -def RCL64rCL : RI<0xD3, MRM2r, (outs GR64:$dst), (ins GR64:$src), - "rcl{q}\t{%cl, $dst|$dst, CL}", []>; -def RCL64mCL : RI<0xD3, MRM2m, (outs i64mem:$dst), (ins i64mem:$src), - "rcl{q}\t{%cl, $dst|$dst, CL}", []>; -} def RCL64ri : RIi8<0xC1, MRM2r, (outs GR64:$dst), (ins GR64:$src, i8imm:$cnt), "rcl{q}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCL64mi : RIi8<0xC1, MRM2m, (outs i64mem:$dst), - (ins i64mem:$src, i8imm:$cnt), - "rcl{q}\t{$cnt, $dst|$dst, $cnt}", []>; def RCR64r1 : RI<0xD1, MRM3r, (outs GR64:$dst), (ins GR64:$src), "rcr{q}\t{1, $dst|$dst, 1}", []>; -def RCR64m1 : RI<0xD1, MRM3m, (outs i64mem:$dst), (ins i64mem:$src), - "rcr{q}\t{1, $dst|$dst, 1}", []>; +def RCR64ri : RIi8<0xC1, MRM3r, (outs GR64:$dst), (ins GR64:$src, i8imm:$cnt), + "rcr{q}\t{$cnt, $dst|$dst, $cnt}", []>; + let Uses = [CL] in { +def RCL64rCL : RI<0xD3, MRM2r, (outs GR64:$dst), (ins GR64:$src), + "rcl{q}\t{%cl, $dst|$dst, CL}", []>; def RCR64rCL : RI<0xD3, MRM3r, (outs GR64:$dst), (ins GR64:$src), "rcr{q}\t{%cl, $dst|$dst, CL}", []>; -def RCR64mCL : RI<0xD3, MRM3m, (outs i64mem:$dst), (ins i64mem:$src), - "rcr{q}\t{%cl, $dst|$dst, CL}", []>; } -def RCR64ri : RIi8<0xC1, MRM3r, (outs GR64:$dst), (ins GR64:$src, i8imm:$cnt), - "rcr{q}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCR64mi : RIi8<0xC1, MRM3m, (outs i64mem:$dst), - (ins i64mem:$src, i8imm:$cnt), +} + +let isTwoAddress = 0 in { +def RCL64m1 : RI<0xD1, MRM2m, (outs), (ins i64mem:$dst), + "rcl{q}\t{1, $dst|$dst, 1}", []>; +def RCL64mi : RIi8<0xC1, MRM2m, (outs), (ins i64mem:$dst, i8imm:$cnt), + "rcl{q}\t{$cnt, $dst|$dst, $cnt}", []>; +def RCR64m1 : RI<0xD1, MRM3m, (outs), (ins i64mem:$dst), + "rcr{q}\t{1, $dst|$dst, 1}", []>; +def RCR64mi : RIi8<0xC1, MRM3m, (outs), (ins i64mem:$dst, i8imm:$cnt), "rcr{q}\t{$cnt, $dst|$dst, $cnt}", []>; + +let Uses = [CL] in { +def RCL64mCL : RI<0xD3, MRM2m, (outs), (ins i64mem:$dst), + "rcl{q}\t{%cl, $dst|$dst, CL}", []>; +def RCR64mCL : RI<0xD3, MRM3m, (outs), (ins i64mem:$dst), + "rcr{q}\t{%cl, $dst|$dst, CL}", []>; +} } let isTwoAddress = 1 in { Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=95950&r1=95949&r2=95950&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Feb 11 19:22:03 2010 @@ -2302,98 +2302,100 @@ def RCL8r1 : I<0xD0, MRM2r, (outs GR8:$dst), (ins GR8:$src), "rcl{b}\t{1, $dst|$dst, 1}", []>; -def RCL8m1 : I<0xD0, MRM2m, (outs i8mem:$dst), (ins i8mem:$src), - "rcl{b}\t{1, $dst|$dst, 1}", []>; let Uses = [CL] in { def RCL8rCL : I<0xD2, MRM2r, (outs GR8:$dst), (ins GR8:$src), "rcl{b}\t{%cl, $dst|$dst, CL}", []>; -def RCL8mCL : I<0xD2, MRM2m, (outs i8mem:$dst), (ins i8mem:$src), - "rcl{b}\t{%cl, $dst|$dst, CL}", []>; } def RCL8ri : Ii8<0xC0, MRM2r, (outs GR8:$dst), (ins GR8:$src, i8imm:$cnt), "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCL8mi : Ii8<0xC0, MRM2m, (outs i8mem:$dst), (ins i8mem:$src, i8imm:$cnt), - "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; def RCL16r1 : I<0xD1, MRM2r, (outs GR16:$dst), (ins GR16:$src), "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; -def RCL16m1 : I<0xD1, MRM2m, (outs i16mem:$dst), (ins i16mem:$src), - "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; let Uses = [CL] in { def RCL16rCL : I<0xD3, MRM2r, (outs GR16:$dst), (ins GR16:$src), "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; -def RCL16mCL : I<0xD3, MRM2m, (outs i16mem:$dst), (ins i16mem:$src), - "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; } def RCL16ri : Ii8<0xC1, MRM2r, (outs GR16:$dst), (ins GR16:$src, i8imm:$cnt), "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; -def RCL16mi : Ii8<0xC1, MRM2m, (outs i16mem:$dst), - (ins i16mem:$src, i8imm:$cnt), - "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; def RCL32r1 : I<0xD1, MRM2r, (outs GR32:$dst), (ins GR32:$src), "rcl{l}\t{1, $dst|$dst, 1}", []>; -def RCL32m1 : I<0xD1, MRM2m, (outs i32mem:$dst), (ins i32mem:$src), - "rcl{l}\t{1, $dst|$dst, 1}", []>; let Uses = [CL] in { def RCL32rCL : I<0xD3, MRM2r, (outs GR32:$dst), (ins GR32:$src), "rcl{l}\t{%cl, $dst|$dst, CL}", []>; -def RCL32mCL : I<0xD3, MRM2m, (outs i32mem:$dst), (ins i32mem:$src), - "rcl{l}\t{%cl, $dst|$dst, CL}", []>; } def RCL32ri : Ii8<0xC1, MRM2r, (outs GR32:$dst), (ins GR32:$src, i8imm:$cnt), "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCL32mi : Ii8<0xC1, MRM2m, (outs i32mem:$dst), - (ins i32mem:$src, i8imm:$cnt), - "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; def RCR8r1 : I<0xD0, MRM3r, (outs GR8:$dst), (ins GR8:$src), "rcr{b}\t{1, $dst|$dst, 1}", []>; -def RCR8m1 : I<0xD0, MRM3m, (outs i8mem:$dst), (ins i8mem:$src), - "rcr{b}\t{1, $dst|$dst, 1}", []>; let Uses = [CL] in { def RCR8rCL : I<0xD2, MRM3r, (outs GR8:$dst), (ins GR8:$src), "rcr{b}\t{%cl, $dst|$dst, CL}", []>; -def RCR8mCL : I<0xD2, MRM3m, (outs i8mem:$dst), (ins i8mem:$src), - "rcr{b}\t{%cl, $dst|$dst, CL}", []>; } def RCR8ri : Ii8<0xC0, MRM3r, (outs GR8:$dst), (ins GR8:$src, i8imm:$cnt), "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCR8mi : Ii8<0xC0, MRM3m, (outs i8mem:$dst), (ins i8mem:$src, i8imm:$cnt), - "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; def RCR16r1 : I<0xD1, MRM3r, (outs GR16:$dst), (ins GR16:$src), "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; -def RCR16m1 : I<0xD1, MRM3m, (outs i16mem:$dst), (ins i16mem:$src), - "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; let Uses = [CL] in { def RCR16rCL : I<0xD3, MRM3r, (outs GR16:$dst), (ins GR16:$src), "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; -def RCR16mCL : I<0xD3, MRM3m, (outs i16mem:$dst), (ins i16mem:$src), - "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; } def RCR16ri : Ii8<0xC1, MRM3r, (outs GR16:$dst), (ins GR16:$src, i8imm:$cnt), "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; -def RCR16mi : Ii8<0xC1, MRM3m, (outs i16mem:$dst), - (ins i16mem:$src, i8imm:$cnt), - "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; def RCR32r1 : I<0xD1, MRM3r, (outs GR32:$dst), (ins GR32:$src), "rcr{l}\t{1, $dst|$dst, 1}", []>; -def RCR32m1 : I<0xD1, MRM3m, (outs i32mem:$dst), (ins i32mem:$src), - "rcr{l}\t{1, $dst|$dst, 1}", []>; let Uses = [CL] in { def RCR32rCL : I<0xD3, MRM3r, (outs GR32:$dst), (ins GR32:$src), "rcr{l}\t{%cl, $dst|$dst, CL}", []>; -def RCR32mCL : I<0xD3, MRM3m, (outs i32mem:$dst), (ins i32mem:$src), - "rcr{l}\t{%cl, $dst|$dst, CL}", []>; } def RCR32ri : Ii8<0xC1, MRM3r, (outs GR32:$dst), (ins GR32:$src, i8imm:$cnt), "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; -def RCR32mi : Ii8<0xC1, MRM3m, (outs i32mem:$dst), - (ins i32mem:$src, i8imm:$cnt), + +let isTwoAddress = 0 in { +def RCL8m1 : I<0xD0, MRM2m, (outs), (ins i8mem:$dst), + "rcl{b}\t{1, $dst|$dst, 1}", []>; +def RCL8mi : Ii8<0xC0, MRM2m, (outs), (ins i8mem:$dst, i8imm:$cnt), + "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; +def RCL16m1 : I<0xD1, MRM2m, (outs), (ins i16mem:$dst), + "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; +def RCL16mi : Ii8<0xC1, MRM2m, (outs), (ins i16mem:$dst, i8imm:$cnt), + "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; +def RCL32m1 : I<0xD1, MRM2m, (outs), (ins i32mem:$dst), + "rcl{l}\t{1, $dst|$dst, 1}", []>; +def RCL32mi : Ii8<0xC1, MRM2m, (outs), (ins i32mem:$dst, i8imm:$cnt), + "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; +def RCR8m1 : I<0xD0, MRM3m, (outs), (ins i8mem:$dst), + "rcr{b}\t{1, $dst|$dst, 1}", []>; +def RCR8mi : Ii8<0xC0, MRM3m, (outs), (ins i8mem:$dst, i8imm:$cnt), + "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; +def RCR16m1 : I<0xD1, MRM3m, (outs), (ins i16mem:$dst), + "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; +def RCR16mi : Ii8<0xC1, MRM3m, (outs), (ins i16mem:$dst, i8imm:$cnt), + "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; +def RCR32m1 : I<0xD1, MRM3m, (outs), (ins i32mem:$dst), + "rcr{l}\t{1, $dst|$dst, 1}", []>; +def RCR32mi : Ii8<0xC1, MRM3m, (outs), (ins i32mem:$dst, i8imm:$cnt), "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; +let Uses = [CL] in { +def RCL8mCL : I<0xD2, MRM2m, (outs), (ins i8mem:$dst), + "rcl{b}\t{%cl, $dst|$dst, CL}", []>; +def RCL16mCL : I<0xD3, MRM2m, (outs), (ins i16mem:$dst), + "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; +def RCL32mCL : I<0xD3, MRM2m, (outs), (ins i32mem:$dst), + "rcl{l}\t{%cl, $dst|$dst, CL}", []>; +def RCR8mCL : I<0xD2, MRM3m, (outs), (ins i8mem:$dst), + "rcr{b}\t{%cl, $dst|$dst, CL}", []>; +def RCR16mCL : I<0xD3, MRM3m, (outs), (ins i16mem:$dst), + "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; +def RCR32mCL : I<0xD3, MRM3m, (outs), (ins i32mem:$dst), + "rcr{l}\t{%cl, $dst|$dst, CL}", []>; +} +} + // FIXME: provide shorter instructions when imm8 == 1 let Uses = [CL] in { def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), From bob.wilson at apple.com Thu Feb 11 19:30:21 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 12 Feb 2010 01:30:21 -0000 Subject: [llvm-commits] [llvm] r95951 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/CMakeLists.txt lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/OptimizePHIs.cpp test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll Message-ID: <201002120130.o1C1UL47021646@zion.cs.uiuc.edu> Author: bwilson Date: Thu Feb 11 19:30:21 2010 New Revision: 95951 URL: http://llvm.org/viewvc/llvm-project?rev=95951&view=rev Log: Add a new pass on machine instructions to optimize away PHI cycles that reduce down to a single value. InstCombine already does this transformation but DAG legalization may introduce new opportunities. This has turned out to be important for ARM where 64-bit values are split up during type legalization: InstCombine is not able to remove the PHI cycles on the 64-bit values but the separate 32-bit values can be optimized. I measured the compile time impact of this (running llc on 176.gcc) and it was not significant. Added: llvm/trunk/lib/CodeGen/OptimizePHIs.cpp llvm/trunk/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll Modified: llvm/trunk/include/llvm/CodeGen/Passes.h llvm/trunk/lib/CodeGen/CMakeLists.txt llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/include/llvm/CodeGen/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=95951&r1=95950&r2=95951&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/Passes.h (original) +++ llvm/trunk/include/llvm/CodeGen/Passes.h Thu Feb 11 19:30:21 2010 @@ -174,6 +174,10 @@ /// optimization by increasing uses of extended values. FunctionPass *createOptimizeExtsPass(); + /// createOptimizePHIsPass - This pass optimizes machine instruction PHIs + /// to take advantage of opportunities created during DAG legalization. + FunctionPass *createOptimizePHIsPass(); + /// createStackSlotColoringPass - This pass performs stack slot coloring. FunctionPass *createStackSlotColoringPass(bool); Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=95951&r1=95950&r2=95951&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CMakeLists.txt (original) +++ llvm/trunk/lib/CodeGen/CMakeLists.txt Thu Feb 11 19:30:21 2010 @@ -39,6 +39,7 @@ ObjectCodeEmitter.cpp OcamlGC.cpp OptimizeExts.cpp + OptimizePHIs.cpp PHIElimination.cpp Passes.cpp PostRASchedulerList.cpp Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95951&r1=95950&r2=95951&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Thu Feb 11 19:30:21 2010 @@ -299,6 +299,7 @@ if (OptLevel != CodeGenOpt::None) { PM.add(createOptimizeExtsPass()); + PM.add(createOptimizePHIsPass()); if (!DisableMachineLICM) PM.add(createMachineLICMPass()); if (!DisableMachineSink) Added: llvm/trunk/lib/CodeGen/OptimizePHIs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/OptimizePHIs.cpp?rev=95951&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/OptimizePHIs.cpp (added) +++ llvm/trunk/lib/CodeGen/OptimizePHIs.cpp Thu Feb 11 19:30:21 2010 @@ -0,0 +1,141 @@ +//===-- OptimizePHIs.cpp - Optimize machine instruction PHIs --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass optimizes machine instruction PHIs to take advantage of +// opportunities created during DAG legalization. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "phi-opt" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Function.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/Statistic.h" +using namespace llvm; + +STATISTIC(NumPHICycles, "Number of PHI cycles replaced"); + +namespace { + class OptimizePHIs : public MachineFunctionPass { + MachineRegisterInfo *MRI; + const TargetInstrInfo *TII; + + public: + static char ID; // Pass identification + OptimizePHIs() : MachineFunctionPass(&ID) {} + + virtual bool runOnMachineFunction(MachineFunction &MF); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + MachineFunctionPass::getAnalysisUsage(AU); + } + + private: + bool IsSingleValuePHICycle(const MachineInstr *MI, unsigned &SingleValReg, + SmallSet &RegsInCycle); + bool ReplacePHICycles(MachineBasicBlock &MBB); + }; +} + +char OptimizePHIs::ID = 0; +static RegisterPass +X("opt-phis", "Optimize machine instruction PHIs"); + +FunctionPass *llvm::createOptimizePHIsPass() { return new OptimizePHIs(); } + +bool OptimizePHIs::runOnMachineFunction(MachineFunction &Fn) { + MRI = &Fn.getRegInfo(); + TII = Fn.getTarget().getInstrInfo(); + + // Find PHI cycles that can be replaced by a single value. InstCombine + // does this, but DAG legalization may introduce new opportunities, e.g., + // when i64 values are split up for 32-bit targets. + bool Changed = false; + for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) + Changed |= ReplacePHICycles(*I); + + return Changed; +} + +/// IsSingleValuePHICycle - Check if MI is a PHI where all the source operands +/// are copies of SingleValReg, possibly via copies through other PHIs. If +/// SingleValReg is zero on entry, it is set to the register with the single +/// non-copy value. RegsInCycle is a set used to keep track of the PHIs that +/// have been scanned. +bool OptimizePHIs::IsSingleValuePHICycle(const MachineInstr *MI, + unsigned &SingleValReg, + SmallSet &RegsInCycle) { + assert(MI->isPHI() && "IsSingleValuePHICycle expects a PHI instruction"); + unsigned DstReg = MI->getOperand(0).getReg(); + + // See if we already saw this register. + if (!RegsInCycle.insert(DstReg)) + return true; + + // Don't scan crazily complex things. + if (RegsInCycle.size() == 16) + return false; + + // Scan the PHI operands. + for (unsigned i = 1; i != MI->getNumOperands(); i += 2) { + unsigned SrcReg = MI->getOperand(i).getReg(); + if (SrcReg == DstReg) + continue; + const MachineInstr *SrcMI = MRI->getVRegDef(SrcReg); + + // Skip over register-to-register moves. + unsigned MvSrcReg, MvDstReg, SrcSubIdx, DstSubIdx; + if (SrcMI && + TII->isMoveInstr(*SrcMI, MvSrcReg, MvDstReg, SrcSubIdx, DstSubIdx) && + SrcSubIdx == 0 && DstSubIdx == 0 && + TargetRegisterInfo::isVirtualRegister(MvSrcReg)) + SrcMI = MRI->getVRegDef(MvSrcReg); + if (!SrcMI) + return false; + + if (SrcMI->isPHI()) { + if (!IsSingleValuePHICycle(SrcMI, SingleValReg, RegsInCycle)) + return false; + } else { + // Fail if there is more than one non-phi/non-move register. + if (SingleValReg != 0) + return false; + SingleValReg = SrcReg; + } + } + return true; +} + +/// ReplacePHICycles - Find PHI cycles that can be replaced by a single +/// value and remove them. +bool OptimizePHIs::ReplacePHICycles(MachineBasicBlock &MBB) { + bool Changed = false; + for (MachineBasicBlock::iterator + MII = MBB.begin(), E = MBB.end(); MII != E; ) { + MachineInstr *MI = &*MII++; + if (!MI->isPHI()) + break; + + unsigned SingleValReg = 0; + SmallSet RegsInCycle; + if (IsSingleValuePHICycle(MI, SingleValReg, RegsInCycle) && + SingleValReg != 0) { + MRI->replaceRegWith(MI->getOperand(0).getReg(), SingleValReg); + MI->eraseFromParent(); + ++NumPHICycles; + Changed = true; + } + } + return Changed; +} Added: llvm/trunk/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll?rev=95951&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll (added) +++ llvm/trunk/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll Thu Feb 11 19:30:21 2010 @@ -0,0 +1,34 @@ +; RUN: llc < %s -mtriple=thumbv7-apple-darwin | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32" + +define arm_apcscc i32 @test(i32 %n) nounwind { +; CHECK: test: +; CHECK-NOT: mov +; CHECK: return +entry: + %0 = icmp eq i32 %n, 1 ; [#uses=1] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %tmp = add i32 %n, -1 ; [#uses=1] + br label %bb + +bb: ; preds = %bb.nph, %bb + %indvar = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=1] + %u.05 = phi i64 [ undef, %bb.nph ], [ %ins, %bb ] ; [#uses=1] + %1 = tail call arm_apcscc i32 @f() nounwind ; [#uses=1] + %tmp4 = zext i32 %1 to i64 ; [#uses=1] + %mask = and i64 %u.05, -4294967296 ; [#uses=1] + %ins = or i64 %tmp4, %mask ; [#uses=2] + tail call arm_apcscc void @g(i64 %ins) nounwind + %indvar.next = add i32 %indvar, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %tmp ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret i32 undef +} + +declare arm_apcscc i32 @f() + +declare arm_apcscc void @g(i64) From johnny.chen at apple.com Thu Feb 11 19:44:23 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 12 Feb 2010 01:44:23 -0000 Subject: [llvm-commits] [llvm] r95955 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <201002120144.o1C1iN3v022209@zion.cs.uiuc.edu> Author: johnny Date: Thu Feb 11 19:44:23 2010 New Revision: 95955 URL: http://llvm.org/viewvc/llvm-project?rev=95955&view=rev Log: Added coprocessor Instructions CDP, CDP2, MCR, MCR2, MRC, MRC2, MCRR, MCRR2, MRRC, MRRc2. For disassembly only. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=95955&r1=95954&r2=95955&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Thu Feb 11 19:44:23 2010 @@ -2030,3 +2030,87 @@ // include "ARMInstrNEON.td" + +//===----------------------------------------------------------------------===// +// Coprocessor Instructions. For disassembly only. +// + +def CDP : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + nohash_imm:$CRd, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "cdp", "\tp$cop, $opc1, cr$CRd, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{4} = 0; +} + +def CDP2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + nohash_imm:$CRd, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "cdp2\tp$cop, $opc1, cr$CRd, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{31-28} = 0b1111; + let Inst{4} = 0; +} + +def MCR : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "mcr", "\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{20} = 0; + let Inst{4} = 1; +} + +def MCR2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "mcr2\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{31-28} = 0b1111; + let Inst{20} = 0; + let Inst{4} = 1; +} + +def MRC : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "mrc", "\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{20} = 1; + let Inst{4} = 1; +} + +def MRC2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1, + GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2), + NoItinerary, "mrc2\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2", + [/* For disassembly only; pattern left blank */]> { + let Inst{31-28} = 0b1111; + let Inst{20} = 1; + let Inst{4} = 1; +} + +def MCRR : ABI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc, + GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm), + NoItinerary, "mcrr", "\tp$cop, $opc, $Rt, $Rt2, cr$CRm", + [/* For disassembly only; pattern left blank */]> { + let Inst{23-20} = 0b0100; +} + +def MCRR2 : ABXI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc, + GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm), + NoItinerary, "mcrr2\tp$cop, $opc, $Rt, $Rt2, cr$CRm", + [/* For disassembly only; pattern left blank */]> { + let Inst{31-28} = 0b1111; + let Inst{23-20} = 0b0100; +} + +def MRRC : ABI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc, + GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm), + NoItinerary, "mrrc", "\tp$cop, $opc, $Rt, $Rt2, cr$CRm", + [/* For disassembly only; pattern left blank */]> { + let Inst{23-20} = 0b0101; +} + +def MRRC2 : ABXI<0b1100, (outs), (ins nohash_imm:$cop, i32imm:$opc, + GPR:$Rt, GPR:$Rt2, nohash_imm:$CRm), + NoItinerary, "mrrc2\tp$cop, $opc, $Rt, $Rt2, cr$CRm", + [/* For disassembly only; pattern left blank */]> { + let Inst{31-28} = 0b1111; + let Inst{23-20} = 0b0101; +} + From daniel at zuster.org Thu Feb 11 19:46:55 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 12 Feb 2010 01:46:55 -0000 Subject: [llvm-commits] [llvm] r95956 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <201002120146.o1C1ktRk022336@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Feb 11 19:46:54 2010 New Revision: 95956 URL: http://llvm.org/viewvc/llvm-project?rev=95956&view=rev Log: MC: Fix bug where trailing tied operands were forgotten; the X86 assembler matcher is now free of implicit operands! - Still need to clean up the code now that we don't to worry about implicit operands, and to make it a hard error if an instruction fails to specify all of its operands for some reason. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=95956&r1=95955&r2=95956&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Thu Feb 11 19:46:54 2010 @@ -975,6 +975,16 @@ std::sort(Classes.begin(), Classes.end(), less_ptr()); } +static std::pair * +GetTiedOperandAtIndex(SmallVectorImpl > &List, + unsigned Index) { + for (unsigned i = 0, e = List.size(); i != e; ++i) + if (Index == List[i].first) + return &List[i]; + + return 0; +} + static void EmitConvertToMCInst(CodeGenTarget &Target, std::vector &Infos, raw_ostream &OS) { @@ -1051,15 +1061,12 @@ // // FIXME: This should be removed from the MCInst structure. for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) { - // See if this is a tied operand. - unsigned i, e = TiedOperands.size(); - for (i = 0; i != e; ++i) - if (CurIndex == TiedOperands[i].first) - break; - if (i == e) + std::pair *Tie = GetTiedOperandAtIndex(TiedOperands, + CurIndex); + if (!Tie) Signature += "__Imp"; else - Signature += "__Tie" + utostr(TiedOperands[i].second); + Signature += "__Tie" + utostr(Tie->second); } Signature += "__"; @@ -1080,8 +1087,14 @@ } // Add any trailing implicit operands. - for (; CurIndex != NumMIOperands; ++CurIndex) - Signature += "__Imp"; + for (; CurIndex != NumMIOperands; ++CurIndex) { + std::pair *Tie = GetTiedOperandAtIndex(TiedOperands, + CurIndex); + if (!Tie) + Signature += "__Imp"; + else + Signature += "__Tie" + utostr(Tie->second); + } II.ConversionFnKind = Signature; @@ -1103,21 +1116,18 @@ // Add the implicit operands. for (; CurIndex != Op.OperandInfo->MIOperandNo; ++CurIndex) { // See if this is a tied operand. - unsigned i, e = TiedOperands.size(); - for (i = 0; i != e; ++i) - if (CurIndex == TiedOperands[i].first) - break; + std::pair *Tie = GetTiedOperandAtIndex(TiedOperands, + CurIndex); - if (i == e) { + if (!Tie) { // If not, this is some implicit operand. Just assume it is a register // for now. CvtOS << " Inst.addOperand(MCOperand::CreateReg(0));\n"; } else { // Copy the tied operand. - assert(TiedOperands[i].first > TiedOperands[i].second && - "Tied operand preceeds its target!"); + assert(Tie->first>Tie->second && "Tied operand preceeds its target!"); CvtOS << " Inst.addOperand(Inst.getOperand(" - << TiedOperands[i].second << "));\n"; + << Tie->second << "));\n"; } } @@ -1129,8 +1139,22 @@ } // And add trailing implicit operands. - for (; CurIndex != NumMIOperands; ++CurIndex) - CvtOS << " Inst.addOperand(MCOperand::CreateReg(0));\n"; + for (; CurIndex != NumMIOperands; ++CurIndex) { + std::pair *Tie = GetTiedOperandAtIndex(TiedOperands, + CurIndex); + + if (!Tie) { + // If not, this is some implicit operand. Just assume it is a register + // for now. + CvtOS << " Inst.addOperand(MCOperand::CreateReg(0));\n"; + } else { + // Copy the tied operand. + assert(Tie->first>Tie->second && "Tied operand preceeds its target!"); + CvtOS << " Inst.addOperand(Inst.getOperand(" + << Tie->second << "));\n"; + } + } + CvtOS << " break;\n"; } From sabre at nondot.org Thu Feb 11 19:55:31 2010 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Feb 2010 01:55:31 -0000 Subject: [llvm-commits] [llvm] r95957 - in /llvm/trunk/lib/Target/X86: X86.td X86InstrInfo.h Message-ID: <201002120155.o1C1tV5u022694@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 19:55:31 2010 New Revision: 95957 URL: http://llvm.org/viewvc/llvm-project?rev=95957&view=rev Log: revert r95949, it turns out that adding new prefixes is not a great solution for the disassembler, we'll go with "plan b". Modified: llvm/trunk/lib/Target/X86/X86.td llvm/trunk/lib/Target/X86/X86InstrInfo.h Modified: llvm/trunk/lib/Target/X86/X86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.td?rev=95957&r1=95956&r2=95957&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86.td (original) +++ llvm/trunk/lib/Target/X86/X86.td Thu Feb 11 19:55:31 2010 @@ -168,11 +168,11 @@ 6, 7, 8, + 12, 13, - 14, - 17, + 16, + 19, 20, - 21, 24]; } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=95957&r1=95956&r2=95957&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Feb 11 19:55:31 2010 @@ -291,7 +291,7 @@ // set, there is no prefix byte for obtaining a multibyte opcode. // Op0Shift = 8, - Op0Mask = 0x1F << Op0Shift, + Op0Mask = 0xF << Op0Shift, // TB - TwoByte - Set if this instruction has a two byte opcode, which // starts with a 0x0F byte before the real opcode. @@ -324,13 +324,13 @@ // etc. We only cares about REX.W and REX.R bits and only the former is // statically determined. // - REXShift = 13, + REXShift = 12, REX_W = 1 << REXShift, //===------------------------------------------------------------------===// // This three-bit field describes the size of an immediate operand. Zero is // unused so that we can tell if we forgot to set a value. - ImmShift = 14, + ImmShift = 13, ImmMask = 7 << ImmShift, Imm8 = 1 << ImmShift, Imm16 = 2 << ImmShift, @@ -341,7 +341,7 @@ // FP Instruction Classification... Zero is non-fp instruction. // FPTypeMask - Mask for all of the FP types... - FPTypeShift = 17, + FPTypeShift = 16, FPTypeMask = 7 << FPTypeShift, // NotFP - The default, set for instructions that do not use FP registers. @@ -374,17 +374,17 @@ SpecialFP = 7 << FPTypeShift, // Lock prefix - LOCKShift = 20, + LOCKShift = 19, LOCK = 1 << LOCKShift, // Segment override prefixes. Currently we just need ability to address // stuff in gs and fs segments. - SegOvrShift = 21, + SegOvrShift = 20, SegOvrMask = 3 << SegOvrShift, FS = 1 << SegOvrShift, GS = 2 << SegOvrShift, - // Bit 23 is unused. + // Bits 22 -> 23 are unused OpcodeShift = 24, OpcodeMask = 0xFF << OpcodeShift }; From evan.cheng at apple.com Thu Feb 11 20:01:14 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Feb 2010 02:01:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95958 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <201002120201.o1C21Esu023023@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 11 20:01:14 2010 New Revision: 95958 URL: http://llvm.org/viewvc/llvm-project?rev=95958&view=rev Log: Observe -fconstant-cfstring. When it's set, ignore -fwritable-strings on CFString. This is partial fix for rdar://7634471. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=95958&r1=95957&r2=95958&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 11 20:01:14 2010 @@ -8383,11 +8383,12 @@ Constant *TreeConstantToLLVM::EmitLV_STRING_CST(tree exp) { Constant *Init = TreeConstantToLLVM::ConvertSTRING_CST(exp); - // Support -fwritable-strings. - bool StringIsConstant = !flag_writable_strings; + // Support -fwritable-strings. However, ignores it if exp is a CFString and + // -fconstant-cfstring (default) is set. + bool StringIsConstant = !flag_writable_strings || + darwin_constant_cfstring_p(exp); GlobalVariable **SlotP = 0; - if (StringIsConstant) { // Cache the string constants to avoid making obvious duplicate strings that // have to be folded by the optimizer. From evan.cheng at apple.com Thu Feb 11 20:02:24 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Feb 2010 02:02:24 -0000 Subject: [llvm-commits] [llvm] r95959 - /llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Message-ID: <201002120202.o1C22Orn023078@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 11 20:02:23 2010 New Revision: 95959 URL: http://llvm.org/viewvc/llvm-project?rev=95959&view=rev Log: Test case for 95958. Added: llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Added: llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m?rev=95959&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m (added) +++ llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Thu Feb 11 20:02:23 2010 @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -x objective-c -fwritable-strings -S %s -o - | FileCheck %s +// CHECK: @.str = private constant +// CHECK: @.str1 = private global +// .str1 should have linker_private linkage. It will be fixed next. + +// rdar://7634471 + + at class NSString; + + at interface A +- (void)foo:(NSString*)msg; +- (void)bar:(const char*)msg; + at end + +void func(A *a) { + [a foo:@"Hello world!"]; + [a bar:"Goodbye world!"]; +} From sabre at nondot.org Thu Feb 11 20:06:33 2010 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Feb 2010 02:06:33 -0000 Subject: [llvm-commits] [llvm] r95960 - in /llvm/trunk: lib/Target/X86/X86CodeEmitter.cpp lib/Target/X86/X86InstrFormats.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h lib/Target/X86/X86MCCodeEmitter.cpp utils/TableGen/X86RecognizableInstr.cpp Message-ID: <201002120206.o1C26XLq023342@zion.cs.uiuc.edu> Author: lattner Date: Thu Feb 11 20:06:33 2010 New Revision: 95960 URL: http://llvm.org/viewvc/llvm-project?rev=95960&view=rev Log: add a bunch of mod/rm encoding types for fixed mod/rm bytes. This will work better for the disassembler for modeling things like lfence/monitor/vmcall etc. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Thu Feb 11 20:06:33 2010 @@ -858,6 +858,27 @@ getX86RegNum(MI.getOperand(CurOp).getReg())); ++CurOp; break; + + case X86II::MRM_C1: + MCE.emitByte(BaseOpcode); + MCE.emitByte(0xC1); + break; + case X86II::MRM_C8: + MCE.emitByte(BaseOpcode); + MCE.emitByte(0xC8); + break; + case X86II::MRM_C9: + MCE.emitByte(BaseOpcode); + MCE.emitByte(0xC9); + break; + case X86II::MRM_E8: + MCE.emitByte(BaseOpcode); + MCE.emitByte(0xE8); + break; + case X86II::MRM_F0: + MCE.emitByte(BaseOpcode); + MCE.emitByte(0xF0); + break; } if (!Desc->isVariadic() && CurOp != NumOps) { Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Thu Feb 11 20:06:33 2010 @@ -29,6 +29,11 @@ def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>; def MRM6m : Format<30>; def MRM7m : Format<31>; def MRMInitReg : Format<32>; +def MRM_C1 : Format<33>; +def MRM_C8 : Format<34>; +def MRM_C9 : Format<35>; +def MRM_E8 : Format<36>; +def MRM_F0 : Format<37>; // ImmType - This specifies the immediate type used by an instruction. This is Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Thu Feb 11 20:06:33 2010 @@ -3556,6 +3556,14 @@ } } break; + + case X86II::MRM_C1: + case X86II::MRM_C8: + case X86II::MRM_C9: + case X86II::MRM_E8: + case X86II::MRM_F0: + FinalSize += 2; + break; } case X86II::MRMInitReg: Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Feb 11 20:06:33 2010 @@ -268,6 +268,13 @@ // MRMInitReg - This form is used for instructions whose source and // destinations are the same register. MRMInitReg = 32, + + //// MRM_C1 - A mod/rm byte of exactly 0xC1. + MRM_C1 = 33, + MRM_C8 = 34, + MRM_C9 = 35, + MRM_E8 = 36, + MRM_F0 = 37, FormMask = 63, Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Feb 11 20:06:33 2010 @@ -560,6 +560,26 @@ CurByte, OS, Fixups); CurOp += X86AddrNumOperands; break; + case X86II::MRM_C1: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xC1, CurByte, OS); + break; + case X86II::MRM_C8: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xC8, CurByte, OS); + break; + case X86II::MRM_C9: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xC9, CurByte, OS); + break; + case X86II::MRM_E8: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xE8, CurByte, OS); + break; + case X86II::MRM_F0: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xF0, CurByte, OS); + break; } // If there is a remaining operand, it must be a trailing immediate. Emit it Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=95960&r1=95959&r2=95960&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original) +++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Thu Feb 11 20:06:33 2010 @@ -47,7 +47,8 @@ D8 = 3, D9 = 4, DA = 5, DB = 6, DC = 7, DD = 8, DE = 9, DF = 10, XD = 11, XS = 12, - T8 = 13, TA = 14 + T8 = 13, P_TA = 14, + P_0F_AE = 16, P_0F_01 = 17 }; } @@ -639,7 +640,7 @@ filter = new DumbFilter(); opcodeToSet = Opcode; break; - case X86Local::TA: + case X86Local::P_TA: opcodeType = THREEBYTE_3A; if (needsModRMForDecode(Form)) filter = new ModFilter(isRegFormat(Form)); From evan.cheng at apple.com Thu Feb 11 20:32:56 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Feb 2010 02:32:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r95961 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <201002120232.o1C2Wuqi024512@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 11 20:32:56 2010 New Revision: 95961 URL: http://llvm.org/viewvc/llvm-project?rev=95961&view=rev Log: Give writable literal cstrings (i.e. in data) internal linkage instead of private linkage. This makes sure it has a label which the linker can see so it doesn't get merged into its previous label. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=95961&r1=95960&r2=95961&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 11 20:32:56 2010 @@ -8388,6 +8388,12 @@ bool StringIsConstant = !flag_writable_strings || darwin_constant_cfstring_p(exp); + // Literal cstrings in data section needs a label the linker can + // see to prevent it from being merged into its previous label. + GlobalValue::LinkageTypes Linkage = StringIsConstant + ? GlobalValue::PrivateLinkage + : GlobalValue::InternalLinkage; + GlobalVariable **SlotP = 0; if (StringIsConstant) { // Cache the string constants to avoid making obvious duplicate strings that @@ -8400,8 +8406,7 @@ // Create a new string global. GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), - StringIsConstant, - GlobalVariable::PrivateLinkage, Init, + StringIsConstant, Linkage, Init, ".str"); GV->setAlignment(get_constant_alignment(exp) / 8); From evan.cheng at apple.com Thu Feb 11 20:35:04 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Feb 2010 02:35:04 -0000 Subject: [llvm-commits] [llvm] r95962 - /llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Message-ID: <201002120235.o1C2Z4ov024606@zion.cs.uiuc.edu> Author: evancheng Date: Thu Feb 11 20:35:03 2010 New Revision: 95962 URL: http://llvm.org/viewvc/llvm-project?rev=95962&view=rev Log: Test for 95961. Modified: llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Modified: llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m?rev=95962&r1=95961&r2=95962&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m (original) +++ llvm/trunk/test/FrontendObjC/2010-02-11-fwritable-stringsBug.m Thu Feb 11 20:35:03 2010 @@ -1,7 +1,6 @@ // RUN: %llvmgcc -x objective-c -fwritable-strings -S %s -o - | FileCheck %s // CHECK: @.str = private constant -// CHECK: @.str1 = private global -// .str1 should have linker_private linkage. It will be fixed next. +// CHECK: @.str1 = internal global // rdar://7634471 From cdavis at mines.edu Thu Feb 11 18:31:16 2010 From: cdavis at mines.edu (Charles Davis) Date: Fri, 12 Feb 2010 00:31:16 -0000 Subject: [llvm-commits] [llvm] r95945 - in /llvm/trunk: docs/LangRef.html include/llvm/Attributes.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/VMCore/Attributes.cpp test/Feature/alignment.ll Message-ID: <201002120031.o1C0VGMQ018828@zion.cs.uiuc.edu> Author: cdavis Date: Thu Feb 11 18:31:15 2010 New Revision: 95945 URL: http://llvm.org/viewvc/llvm-project?rev=95945&view=rev Log: Add a new function attribute, 'alignstack'. It will indicate (when the backends implement support for it) that the stack should be forcibly realigned in the prologue (and the process reversed in the epilogue). Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/Attributes.h llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/VMCore/Attributes.cpp llvm/trunk/test/Feature/alignment.ll Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Thu Feb 11 18:31:15 2010 @@ -1078,6 +1078,11 @@
    +
    alignstack(<n>)
    +
    This attribute indicates that, when emitting the prologue and epilogue, + the backend should forcibly align the stack pointer. Specify the + desired alignment, which must be a power of two, in parentheses. +
    alwaysinline
    This attribute indicates that the inliner should attempt to inline this function into callers whenever possible, ignoring any active inlining size Modified: llvm/trunk/include/llvm/Attributes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/include/llvm/Attributes.h (original) +++ llvm/trunk/include/llvm/Attributes.h Thu Feb 11 18:31:15 2010 @@ -60,6 +60,11 @@ const Attributes Naked = 1<<24; ///< Naked function const Attributes InlineHint = 1<<25; ///< source said inlining was ///desirable +const Attributes StackAlignment = 31<<26; ///< Alignment of stack for + ///function (5 bits) stored as log2 + ///of alignment with +1 bias + ///0 means unaligned (different from + ///alignstack(1)) /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; @@ -68,7 +73,7 @@ /// be used on return values or function parameters. const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq | - NoRedZone | NoImplicitFloat | Naked | InlineHint; + NoRedZone | NoImplicitFloat | Naked | InlineHint | StackAlignment; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; @@ -105,6 +110,28 @@ return 1U << ((Align >> 16) - 1); } +/// This turns an int stack alignment (which must be a power of 2) into +/// the form used internally in Attributes. +inline Attributes constructStackAlignmentFromInt(unsigned i) { + // Default alignment, allow the target to define how to align it. + if (i == 0) + return 0; + + assert(isPowerOf2_32(i) && "Alignment must be a power of two."); + assert(i <= 0x40000000 && "Alignment too large."); + return (Log2_32(i)+1) << 26; +} + +/// This returns the stack alignment field of an attribute as a byte alignment +/// value. +inline unsigned getStackAlignmentFromAttrs(Attributes A) { + Attributes StackAlign = A & Attribute::StackAlignment; + if (StackAlign == 0) + return 0; + + return 1U << ((StackAlign >> 26) - 1); +} + /// The set of Attributes set in Attributes is converted to a /// string of equivalent mnemonics. This is, presumably, for writing out Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Feb 11 18:31:15 2010 @@ -956,6 +956,14 @@ case lltok::kw_noimplicitfloat: Attrs |= Attribute::NoImplicitFloat; break; case lltok::kw_naked: Attrs |= Attribute::Naked; break; + case lltok::kw_alignstack: { + unsigned Alignment; + if (ParseOptionalStackAlignment(Alignment)) + return true; + Attrs |= Attribute::constructStackAlignmentFromInt(Alignment); + continue; + } + case lltok::kw_align: { unsigned Alignment; if (ParseOptionalAlignment(Alignment)) @@ -963,6 +971,7 @@ Attrs |= Attribute::constructAlignmentFromInt(Alignment); continue; } + } Lex.Lex(); } @@ -1131,6 +1140,25 @@ return false; } +/// ParseOptionalStackAlignment +/// ::= /* empty */ +/// ::= 'alignstack' '(' 4 ')' +bool LLParser::ParseOptionalStackAlignment(unsigned &Alignment) { + Alignment = 0; + if (!EatIfPresent(lltok::kw_alignstack)) + return false; + LocTy ParenLoc = Lex.getLoc(); + if (!EatIfPresent(lltok::lparen)) + return Error(ParenLoc, "expected '('"); + LocTy AlignLoc = Lex.getLoc(); + if (ParseUInt32(Alignment)) return true; + ParenLoc = Lex.getLoc(); + if (!EatIfPresent(lltok::rparen)) + return Error(ParenLoc, "expected ')'"); + if (!isPowerOf2_32(Alignment)) + return Error(AlignLoc, "stack alignment is not a power of two"); + return false; +} /// ParseIndexList - This parses the index list for an insert/extractvalue /// instruction. This sets AteExtraComma in the case where we eat an extra Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Feb 11 18:31:15 2010 @@ -169,6 +169,7 @@ bool ParseOptionalVisibility(unsigned &Visibility); bool ParseOptionalCallingConv(CallingConv::ID &CC); bool ParseOptionalAlignment(unsigned &Alignment); + bool ParseOptionalStackAlignment(unsigned &Alignment); bool ParseInstructionMetadata(SmallVectorImpl > &); bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma); Modified: llvm/trunk/lib/VMCore/Attributes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Attributes.cpp (original) +++ llvm/trunk/lib/VMCore/Attributes.cpp Thu Feb 11 18:31:15 2010 @@ -70,6 +70,11 @@ Result += "noimplicitfloat "; if (Attrs & Attribute::Naked) Result += "naked "; + if (Attrs & Attribute::StackAlignment) { + Result += "alignstack("; + Result += utostr(Attribute::getStackAlignmentFromAttrs(Attrs)); + Result += ") "; + } if (Attrs & Attribute::Alignment) { Result += "align "; Result += utostr(Attribute::getAlignmentFromAttrs(Attrs)); Modified: llvm/trunk/test/Feature/alignment.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/alignment.ll?rev=95945&r1=95944&r2=95945&view=diff ============================================================================== --- llvm/trunk/test/Feature/alignment.ll (original) +++ llvm/trunk/test/Feature/alignment.ll Thu Feb 11 18:31:15 2010 @@ -19,3 +19,7 @@ ret i32* %X } +define void @test3() alignstack(16) { + ret void +} + From evan.cheng at apple.com Fri Feb 12 01:48:46 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Feb 2010 07:48:46 -0000 Subject: [llvm-commits] [llvm] r95971 - /llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c Message-ID: <201002120748.o1C7mkTo007009@zion.cs.uiuc.edu> Author: evancheng Date: Fri Feb 12 01:48:46 2010 New Revision: 95971 URL: http://llvm.org/viewvc/llvm-project?rev=95971&view=rev Log: Update test to match 95961. Modified: llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c Modified: llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c?rev=95971&r1=95970&r2=95971&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c (original) +++ llvm/trunk/test/FrontendC/2007-02-16-WritableStrings.c Fri Feb 12 01:48:46 2010 @@ -1,7 +1,7 @@ // Test the -fwritable-strings option. // RUN: %llvmgcc -O3 -S -o - -emit-llvm -fwritable-strings %s | \ -// RUN: grep {private global} +// RUN: grep {internal global} // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep {private constant} char *X = "foo"; From lhames at gmail.com Fri Feb 12 03:43:38 2010 From: lhames at gmail.com (Lang Hames) Date: Fri, 12 Feb 2010 09:43:38 -0000 Subject: [llvm-commits] [llvm] r95973 - in /llvm/trunk/lib/CodeGen/PBQP: HeuristicSolver.h Heuristics/Briggs.h Message-ID: <201002120943.o1C9hcva027269@zion.cs.uiuc.edu> Author: lhames Date: Fri Feb 12 03:43:37 2010 New Revision: 95973 URL: http://llvm.org/viewvc/llvm-project?rev=95973&view=rev Log: * Updated the cost matrix normalization proceedure to better handle infinite costs. * Enabled R1/R2 application for nodes with infinite spill costs in the Briggs heuristic (made safe by the changes to the normalization proceedure). * Removed a redundant header. Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h llvm/trunk/lib/CodeGen/PBQP/Heuristics/Briggs.h Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=95973&r1=95972&r2=95973&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original) +++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Fri Feb 12 03:43:37 2010 @@ -18,7 +18,6 @@ #include "Graph.h" #include "Solution.h" -#include "llvm/Support/raw_ostream.h" #include #include @@ -494,14 +493,23 @@ bool tryNormaliseEdgeMatrix(Graph::EdgeItr &eItr) { + const PBQPNum infinity = std::numeric_limits::infinity(); + Matrix &edgeCosts = g.getEdgeCosts(eItr); Vector &uCosts = g.getNodeCosts(g.getEdgeNode1(eItr)), &vCosts = g.getNodeCosts(g.getEdgeNode2(eItr)); for (unsigned r = 0; r < edgeCosts.getRows(); ++r) { - PBQPNum rowMin = edgeCosts.getRowMin(r); + PBQPNum rowMin = infinity; + + for (unsigned c = 0; c < edgeCosts.getCols(); ++c) { + if (vCosts[c] != infinity && edgeCosts[r][c] < rowMin) + rowMin = edgeCosts[r][c]; + } + uCosts[r] += rowMin; - if (rowMin != std::numeric_limits::infinity()) { + + if (rowMin != infinity) { edgeCosts.subFromRow(r, rowMin); } else { @@ -510,9 +518,16 @@ } for (unsigned c = 0; c < edgeCosts.getCols(); ++c) { - PBQPNum colMin = edgeCosts.getColMin(c); + PBQPNum colMin = infinity; + + for (unsigned r = 0; r < edgeCosts.getRows(); ++r) { + if (uCosts[r] != infinity && edgeCosts[r][c] < colMin) + colMin = edgeCosts[r][c]; + } + vCosts[c] += colMin; - if (colMin != std::numeric_limits::infinity()) { + + if (colMin != infinity) { edgeCosts.subFromCol(c, colMin); } else { Modified: llvm/trunk/lib/CodeGen/PBQP/Heuristics/Briggs.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/Heuristics/Briggs.h?rev=95973&r1=95972&r2=95973&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PBQP/Heuristics/Briggs.h (original) +++ llvm/trunk/lib/CodeGen/PBQP/Heuristics/Briggs.h Fri Feb 12 03:43:37 2010 @@ -128,14 +128,7 @@ /// selected for heuristic reduction instead. bool shouldOptimallyReduce(Graph::NodeItr nItr) { if (getSolver().getSolverDegree(nItr) < 3) { - if (getGraph().getNodeCosts(nItr)[0] != - std::numeric_limits::infinity()) { - return true; - } - // Otherwise we have an infinite spill cost node. - initializeNode(nItr); - NodeData &nd = getHeuristicNodeData(nItr); - return nd.isAllocable; + return true; } // else return false; From baldrick at free.fr Fri Feb 12 04:13:35 2010 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Feb 2010 10:13:35 -0000 Subject: [llvm-commits] [dragonegg] r95974 - /dragonegg/trunk/Makefile Message-ID: <201002121013.o1CADbgJ028983@zion.cs.uiuc.edu> Author: baldrick Date: Fri Feb 12 04:13:32 2010 New Revision: 95974 URL: http://llvm.org/viewvc/llvm-project?rev=95974&view=rev Log: If a particular llvm-config is specified in the environment, via the LLVM_CONFIG variable, then use it. Modified: dragonegg/trunk/Makefile Modified: dragonegg/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=95974&r1=95973&r2=95974&view=diff ============================================================================== --- dragonegg/trunk/Makefile (original) +++ dragonegg/trunk/Makefile Fri Feb 12 04:13:32 2010 @@ -2,7 +2,7 @@ GCCSOURCE_DIR=$(shell $(GCC) -print-file-name=plugin) # Point LLVM_CONFIG to the just built llvm-config to use an LLVM build rather # than the installed version of LLVM. -LLVM_CONFIG=llvm-config +LLVM_CONFIG?=llvm-config # Replace with an informative string when doing a release. REVISION:=$(shell svnversion -n .) From gohman at apple.com Fri Feb 12 04:34:32 2010 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Feb 2010 10:34:32 -0000 Subject: [llvm-commits] [llvm] r95975 - in /llvm/trunk: include/llvm/Analysis/ lib/Analysis/ lib/CodeGen/ lib/Transforms/Scalar/ test/CodeGen/ARM/ test/CodeGen/Thumb2/ test/CodeGen/X86/ test/Transforms/IndVarSimplify/ test/Transforms/LoopStrengthReduce/ Message-ID: <201002121034.o1CAYXSw030410@zion.cs.uiuc.edu> Author: djg Date: Fri Feb 12 04:34:29 2010 New Revision: 95975 URL: http://llvm.org/viewvc/llvm-project?rev=95975&view=rev Log: Reapply the new LoopStrengthReduction code, with compile time and bug fixes, and with improved heuristics for analyzing foreign-loop addrecs. This change also flattens IVUsers, eliminating the stride-oriented groupings, which makes it easier to work with. Added: llvm/trunk/test/CodeGen/X86/lsr-reuse.ll - copied, changed from r94122, llvm/trunk/test/CodeGen/X86/lsr-reuse.ll Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h llvm/trunk/lib/Analysis/IVUsers.cpp llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/test/CodeGen/ARM/arm-negative-stride.ll llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll llvm/trunk/test/CodeGen/Thumb2/lsr-deficiency.ll llvm/trunk/test/CodeGen/Thumb2/thumb2-ifcvt1.ll llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll llvm/trunk/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll llvm/trunk/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll llvm/trunk/test/CodeGen/X86/full-lsr.ll llvm/trunk/test/CodeGen/X86/iv-users-in-other-loops.ll llvm/trunk/test/CodeGen/X86/loop-strength-reduce-2.ll llvm/trunk/test/CodeGen/X86/loop-strength-reduce-3.ll llvm/trunk/test/CodeGen/X86/loop-strength-reduce.ll llvm/trunk/test/CodeGen/X86/loop-strength-reduce4.ll llvm/trunk/test/CodeGen/X86/loop-strength-reduce8.ll llvm/trunk/test/CodeGen/X86/masked-iv-safe.ll llvm/trunk/test/CodeGen/X86/pr3495.ll llvm/trunk/test/Transforms/IndVarSimplify/addrec-gep.ll llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll llvm/trunk/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll llvm/trunk/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll llvm/trunk/test/Transforms/LoopStrengthReduce/count-to-zero.ll llvm/trunk/test/Transforms/LoopStrengthReduce/invariant_value_first.ll llvm/trunk/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll llvm/trunk/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll llvm/trunk/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll llvm/trunk/test/Transforms/LoopStrengthReduce/remove_indvar.ll llvm/trunk/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IVUsers.h?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/IVUsers.h (original) +++ llvm/trunk/include/llvm/Analysis/IVUsers.h Fri Feb 12 04:34:29 2010 @@ -16,29 +16,27 @@ #define LLVM_ANALYSIS_IVUSERS_H #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/ADT/SmallVector.h" -#include +#include "llvm/Support/ValueHandle.h" namespace llvm { class DominatorTree; class Instruction; class Value; -struct IVUsersOfOneStride; - -/// IVStrideUse - Keep track of one use of a strided induction variable, where -/// the stride is stored externally. The Offset member keeps track of the -/// offset from the IV, User is the actual user of the operand, and -/// 'OperandValToReplace' is the operand of the User that is the use. +class IVUsers; +class ScalarEvolution; +class SCEV; + +/// IVStrideUse - Keep track of one use of a strided induction variable. +/// The Expr member keeps track of the expression, User is the actual user +/// instruction of the operand, and 'OperandValToReplace' is the operand of +/// the User that is the use. class IVStrideUse : public CallbackVH, public ilist_node { public: - IVStrideUse(IVUsersOfOneStride *parent, - const SCEV *offset, + IVStrideUse(IVUsers *P, const SCEV *S, const SCEV *Off, Instruction* U, Value *O) - : CallbackVH(U), Parent(parent), Offset(offset), - OperandValToReplace(O), - IsUseOfPostIncrementedValue(false) { + : CallbackVH(U), Parent(P), Stride(S), Offset(Off), + OperandValToReplace(O), IsUseOfPostIncrementedValue(false) { } /// getUser - Return the user instruction for this use. @@ -51,9 +49,17 @@ setValPtr(NewUser); } - /// getParent - Return a pointer to the IVUsersOfOneStride that owns + /// getParent - Return a pointer to the IVUsers that owns /// this IVStrideUse. - IVUsersOfOneStride *getParent() const { return Parent; } + IVUsers *getParent() const { return Parent; } + + /// getStride - Return the expression for the stride for the use. + const SCEV *getStride() const { return Stride; } + + /// setStride - Assign a new stride to this use. + void setStride(const SCEV *Val) { + Stride = Val; + } /// getOffset - Return the offset to add to a theoeretical induction /// variable that starts at zero and counts up by the stride to compute @@ -92,8 +98,11 @@ } private: - /// Parent - a pointer to the IVUsersOfOneStride that owns this IVStrideUse. - IVUsersOfOneStride *Parent; + /// Parent - a pointer to the IVUsers that owns this IVStrideUse. + IVUsers *Parent; + + /// Stride - The stride for this use. + const SCEV *Stride; /// Offset - The offset to add to the base induction expression. const SCEV *Offset; @@ -138,42 +147,8 @@ mutable ilist_node Sentinel; }; -/// IVUsersOfOneStride - This structure keeps track of all instructions that -/// have an operand that is based on the trip count multiplied by some stride. -struct IVUsersOfOneStride : public ilist_node { -private: - IVUsersOfOneStride(const IVUsersOfOneStride &I); // do not implement - void operator=(const IVUsersOfOneStride &I); // do not implement - -public: - IVUsersOfOneStride() : Stride(0) {} - - explicit IVUsersOfOneStride(const SCEV *stride) : Stride(stride) {} - - /// Stride - The stride for all the contained IVStrideUses. This is - /// a constant for affine strides. - const SCEV *Stride; - - /// Users - Keep track of all of the users of this stride as well as the - /// initial value and the operand that uses the IV. - ilist Users; - - void addUser(const SCEV *Offset, Instruction *User, Value *Operand) { - Users.push_back(new IVStrideUse(this, Offset, User, Operand)); - } - - void removeUser(IVStrideUse *User) { - Users.erase(User); - } - - void print(raw_ostream &OS) const; - - /// dump - This method is used for debugging. - void dump() const; -}; - class IVUsers : public LoopPass { - friend class IVStrideUserVH; + friend class IVStrideUse; Loop *L; LoopInfo *LI; DominatorTree *DT; @@ -182,19 +157,8 @@ /// IVUses - A list of all tracked IV uses of induction variable expressions /// we are interested in. - ilist IVUses; - -public: - /// IVUsesByStride - A mapping from the strides in StrideOrder to the - /// uses in IVUses. - std::map IVUsesByStride; - - /// StrideOrder - An ordering of the keys in IVUsesByStride that is stable: - /// We use this to iterate over the IVUsesByStride collection without being - /// dependent on random ordering of pointers in the process. - SmallVector StrideOrder; + ilist IVUses; -private: virtual void getAnalysisUsage(AnalysisUsage &AU) const; virtual bool runOnLoop(Loop *L, LPPassManager &LPM); @@ -210,8 +174,8 @@ /// return true. Otherwise, return false. bool AddUsersIfInteresting(Instruction *I); - void AddUser(const SCEV *Stride, const SCEV *Offset, - Instruction *User, Value *Operand); + IVStrideUse &AddUser(const SCEV *Stride, const SCEV *Offset, + Instruction *User, Value *Operand); /// getReplacementExpr - Return a SCEV expression which computes the /// value of the OperandValToReplace of the given IVStrideUse. @@ -222,6 +186,14 @@ /// isUseOfPostIncrementedValue flag. const SCEV *getCanonicalExpr(const IVStrideUse &U) const; + typedef ilist::iterator iterator; + typedef ilist::const_iterator const_iterator; + iterator begin() { return IVUses.begin(); } + iterator end() { return IVUses.end(); } + const_iterator begin() const { return IVUses.begin(); } + const_iterator end() const { return IVUses.end(); } + bool empty() const { return IVUses.empty(); } + void print(raw_ostream &OS, const Module* = 0) const; /// dump - This method is used for debugging. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h Fri Feb 12 04:34:29 2010 @@ -27,10 +27,7 @@ /// and destroy it when finished to allow the release of the associated /// memory. class SCEVExpander : public SCEVVisitor { - public: ScalarEvolution &SE; - - private: std::map, AssertingVH > InsertedExpressions; std::set InsertedValues; Modified: llvm/trunk/lib/Analysis/IVUsers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IVUsers.cpp (original) +++ llvm/trunk/lib/Analysis/IVUsers.cpp Fri Feb 12 04:34:29 2010 @@ -36,42 +36,30 @@ return new IVUsers(); } -/// containsAddRecFromDifferentLoop - Determine whether expression S involves a -/// subexpression that is an AddRec from a loop other than L. An outer loop -/// of L is OK, but not an inner loop nor a disjoint loop. -static bool containsAddRecFromDifferentLoop(const SCEV *S, Loop *L) { - // This is very common, put it first. - if (isa(S)) - return false; - if (const SCEVCommutativeExpr *AE = dyn_cast(S)) { - for (unsigned int i=0; i< AE->getNumOperands(); i++) - if (containsAddRecFromDifferentLoop(AE->getOperand(i), L)) - return true; - return false; - } - if (const SCEVAddRecExpr *AE = dyn_cast(S)) { - if (const Loop *newLoop = AE->getLoop()) { - if (newLoop == L) - return false; - // if newLoop is an outer loop of L, this is OK. - if (newLoop->contains(L)) - return false; +/// CollectSubexprs - Split S into subexpressions which can be pulled out into +/// separate registers. +static void CollectSubexprs(const SCEV *S, + SmallVectorImpl &Ops, + ScalarEvolution &SE) { + if (const SCEVAddExpr *Add = dyn_cast(S)) { + // Break out add operands. + for (SCEVAddExpr::op_iterator I = Add->op_begin(), E = Add->op_end(); + I != E; ++I) + CollectSubexprs(*I, Ops, SE); + return; + } else if (const SCEVAddRecExpr *AR = dyn_cast(S)) { + // Split a non-zero base out of an addrec. + if (!AR->getStart()->isZero()) { + CollectSubexprs(AR->getStart(), Ops, SE); + CollectSubexprs(SE.getAddRecExpr(SE.getIntegerSCEV(0, AR->getType()), + AR->getStepRecurrence(SE), + AR->getLoop()), Ops, SE); + return; } - return true; } - if (const SCEVUDivExpr *DE = dyn_cast(S)) - return containsAddRecFromDifferentLoop(DE->getLHS(), L) || - containsAddRecFromDifferentLoop(DE->getRHS(), L); -#if 0 - // SCEVSDivExpr has been backed out temporarily, but will be back; we'll - // need this when it is. - if (const SCEVSDivExpr *DE = dyn_cast(S)) - return containsAddRecFromDifferentLoop(DE->getLHS(), L) || - containsAddRecFromDifferentLoop(DE->getRHS(), L); -#endif - if (const SCEVCastExpr *CE = dyn_cast(S)) - return containsAddRecFromDifferentLoop(CE->getOperand(), L); - return false; + + // Otherwise use the value itself. + Ops.push_back(S); } /// getSCEVStartAndStride - Compute the start and stride of this expression, @@ -90,35 +78,42 @@ if (const SCEVAddExpr *AE = dyn_cast(SH)) { for (unsigned i = 0, e = AE->getNumOperands(); i != e; ++i) if (const SCEVAddRecExpr *AddRec = - dyn_cast(AE->getOperand(i))) { - if (AddRec->getLoop() == L) - TheAddRec = SE->getAddExpr(AddRec, TheAddRec); - else - return false; // Nested IV of some sort? - } else { + dyn_cast(AE->getOperand(i))) + TheAddRec = SE->getAddExpr(AddRec, TheAddRec); + else Start = SE->getAddExpr(Start, AE->getOperand(i)); - } } else if (isa(SH)) { TheAddRec = SH; } else { return false; // not analyzable. } - const SCEVAddRecExpr *AddRec = dyn_cast(TheAddRec); - if (!AddRec || AddRec->getLoop() != L) return false; + // Break down TheAddRec into its component parts. + SmallVector Subexprs; + CollectSubexprs(TheAddRec, Subexprs, *SE); + + // Look for an addrec on the current loop among the parts. + const SCEV *AddRecStride = 0; + for (SmallVectorImpl::iterator I = Subexprs.begin(), + E = Subexprs.end(); I != E; ++I) { + const SCEV *S = *I; + if (const SCEVAddRecExpr *AR = dyn_cast(S)) + if (AR->getLoop() == L) { + *I = AR->getStart(); + AddRecStride = AR->getStepRecurrence(*SE); + break; + } + } + if (!AddRecStride) + return false; + + // Add up everything else into a start value (which may not be + // loop-invariant). + const SCEV *AddRecStart = SE->getAddExpr(Subexprs); // Use getSCEVAtScope to attempt to simplify other loops out of // the picture. - const SCEV *AddRecStart = AddRec->getStart(); AddRecStart = SE->getSCEVAtScope(AddRecStart, UseLoop); - const SCEV *AddRecStride = AddRec->getStepRecurrence(*SE); - - // FIXME: If Start contains an SCEVAddRecExpr from a different loop, other - // than an outer loop of the current loop, reject it. LSR has no concept of - // operating on more than one loop at a time so don't confuse it with such - // expressions. - if (containsAddRecFromDifferentLoop(AddRecStart, L)) - return false; Start = SE->getAddExpr(Start, AddRecStart); @@ -131,7 +126,7 @@ DEBUG(dbgs() << "["; WriteAsOperand(dbgs(), L->getHeader(), /*PrintType=*/false); - dbgs() << "] Variable stride: " << *AddRec << "\n"); + dbgs() << "] Variable stride: " << *AddRecStride << "\n"); } Stride = AddRecStride; @@ -247,14 +242,6 @@ } if (AddUserToIVUsers) { - IVUsersOfOneStride *StrideUses = IVUsesByStride[Stride]; - if (!StrideUses) { // First occurrence of this stride? - StrideOrder.push_back(Stride); - StrideUses = new IVUsersOfOneStride(Stride); - IVUses.push_back(StrideUses); - IVUsesByStride[Stride] = StrideUses; - } - // Okay, we found a user that we cannot reduce. Analyze the instruction // and decide what to do with it. If we are a use inside of the loop, use // the value before incrementation, otherwise use it after incrementation. @@ -262,27 +249,21 @@ // The value used will be incremented by the stride more than we are // expecting, so subtract this off. const SCEV *NewStart = SE->getMinusSCEV(Start, Stride); - StrideUses->addUser(NewStart, User, I); - StrideUses->Users.back().setIsUseOfPostIncrementedValue(true); + IVUses.push_back(new IVStrideUse(this, Stride, NewStart, User, I)); + IVUses.back().setIsUseOfPostIncrementedValue(true); DEBUG(dbgs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n"); } else { - StrideUses->addUser(Start, User, I); + IVUses.push_back(new IVStrideUse(this, Stride, Start, User, I)); } } } return true; } -void IVUsers::AddUser(const SCEV *Stride, const SCEV *Offset, - Instruction *User, Value *Operand) { - IVUsersOfOneStride *StrideUses = IVUsesByStride[Stride]; - if (!StrideUses) { // First occurrence of this stride? - StrideOrder.push_back(Stride); - StrideUses = new IVUsersOfOneStride(Stride); - IVUses.push_back(StrideUses); - IVUsesByStride[Stride] = StrideUses; - } - IVUsesByStride[Stride]->addUser(Offset, User, Operand); +IVStrideUse &IVUsers::AddUser(const SCEV *Stride, const SCEV *Offset, + Instruction *User, Value *Operand) { + IVUses.push_back(new IVStrideUse(this, Stride, Offset, User, Operand)); + return IVUses.back(); } IVUsers::IVUsers() @@ -316,15 +297,15 @@ /// value of the OperandValToReplace of the given IVStrideUse. const SCEV *IVUsers::getReplacementExpr(const IVStrideUse &U) const { // Start with zero. - const SCEV *RetVal = SE->getIntegerSCEV(0, U.getParent()->Stride->getType()); + const SCEV *RetVal = SE->getIntegerSCEV(0, U.getStride()->getType()); // Create the basic add recurrence. - RetVal = SE->getAddRecExpr(RetVal, U.getParent()->Stride, L); + RetVal = SE->getAddRecExpr(RetVal, U.getStride(), L); // Add the offset in a separate step, because it may be loop-variant. RetVal = SE->getAddExpr(RetVal, U.getOffset()); // For uses of post-incremented values, add an extra stride to compute // the actual replacement value. if (U.isUseOfPostIncrementedValue()) - RetVal = SE->getAddExpr(RetVal, U.getParent()->Stride); + RetVal = SE->getAddExpr(RetVal, U.getStride()); return RetVal; } @@ -333,9 +314,9 @@ /// isUseOfPostIncrementedValue flag. const SCEV *IVUsers::getCanonicalExpr(const IVStrideUse &U) const { // Start with zero. - const SCEV *RetVal = SE->getIntegerSCEV(0, U.getParent()->Stride->getType()); + const SCEV *RetVal = SE->getIntegerSCEV(0, U.getStride()->getType()); // Create the basic add recurrence. - RetVal = SE->getAddRecExpr(RetVal, U.getParent()->Stride, L); + RetVal = SE->getAddRecExpr(RetVal, U.getStride(), L); // Add the offset in a separate step, because it may be loop-variant. RetVal = SE->getAddExpr(RetVal, U.getOffset()); return RetVal; @@ -358,24 +339,17 @@ OS << ":\n"; IVUsersAsmAnnotator Annotator; - for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; ++Stride) { - std::map::const_iterator SI = - IVUsesByStride.find(StrideOrder[Stride]); - assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); - OS << " Stride " << *SI->first->getType() << " " << *SI->first << ":\n"; - - for (ilist::const_iterator UI = SI->second->Users.begin(), - E = SI->second->Users.end(); UI != E; ++UI) { - OS << " "; - WriteAsOperand(OS, UI->getOperandValToReplace(), false); - OS << " = "; - OS << *getReplacementExpr(*UI); - if (UI->isUseOfPostIncrementedValue()) - OS << " (post-inc)"; - OS << " in "; - UI->getUser()->print(OS, &Annotator); - OS << '\n'; - } + for (ilist::const_iterator UI = IVUses.begin(), + E = IVUses.end(); UI != E; ++UI) { + OS << " "; + WriteAsOperand(OS, UI->getOperandValToReplace(), false); + OS << " = " + << *getReplacementExpr(*UI); + if (UI->isUseOfPostIncrementedValue()) + OS << " (post-inc)"; + OS << " in "; + UI->getUser()->print(OS, &Annotator); + OS << '\n'; } } @@ -384,37 +358,12 @@ } void IVUsers::releaseMemory() { - IVUsesByStride.clear(); - StrideOrder.clear(); Processed.clear(); IVUses.clear(); } void IVStrideUse::deleted() { // Remove this user from the list. - Parent->Users.erase(this); + Parent->IVUses.erase(this); // this now dangles! } - -void IVUsersOfOneStride::print(raw_ostream &OS) const { - OS << "IV Users of one stride:\n"; - - if (Stride) - OS << " Stride: " << *Stride << '\n'; - - OS << " Users:\n"; - - unsigned Count = 1; - - for (ilist::const_iterator - I = Users.begin(), E = Users.end(); I != E; ++I) { - const IVStrideUse &SU = *I; - OS << " " << Count++ << '\n'; - OS << " Offset: " << *SU.getOffset() << '\n'; - OS << " Instr: " << *SU << '\n'; - } -} - -void IVUsersOfOneStride::dump() const { - print(dbgs()); -} Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Fri Feb 12 04:34:29 2010 @@ -641,8 +641,24 @@ // Reuse a previously-inserted PHI, if present. for (BasicBlock::iterator I = L->getHeader()->begin(); PHINode *PN = dyn_cast(I); ++I) - if (isInsertedInstruction(PN) && SE.getSCEV(PN) == Normalized) - return PN; + if (SE.isSCEVable(PN->getType()) && + (SE.getEffectiveSCEVType(PN->getType()) == + SE.getEffectiveSCEVType(Normalized->getType())) && + SE.getSCEV(PN) == Normalized) + if (BasicBlock *LatchBlock = L->getLoopLatch()) { + // Remember this PHI, even in post-inc mode. + InsertedValues.insert(PN); + // Remember the increment. + Instruction *IncV = + cast(PN->getIncomingValueForBlock(LatchBlock) + ->stripPointerCasts()); + rememberInstruction(IncV); + // Make sure the increment is where we want it. But don't move it + // down past a potential existing post-inc user. + if (L == IVIncInsertLoop && !SE.DT->dominates(IncV, IVIncInsertPos)) + IncV->moveBefore(IVIncInsertPos); + return PN; + } // Save the original insertion point so we can restore it when we're done. BasicBlock *SaveInsertBB = Builder.GetInsertBlock(); Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Fri Feb 12 04:34:29 2010 @@ -14,6 +14,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/PassManager.h" #include "llvm/Pass.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/Passes.h" @@ -234,6 +235,9 @@ PM.add(createLoopStrengthReducePass(getTargetLowering())); if (PrintLSR) PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs())); +#ifndef NDEBUG + PM.add(createVerifierPass()); +#endif } // Turn exception handling constructs into something the code generators can Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Feb 12 04:34:29 2010 @@ -364,20 +364,14 @@ if (ExitingBlock) NeedCannIV = true; } - for (unsigned i = 0, e = IU->StrideOrder.size(); i != e; ++i) { - const SCEV *Stride = IU->StrideOrder[i]; - const Type *Ty = SE->getEffectiveSCEVType(Stride->getType()); + for (IVUsers::const_iterator I = IU->begin(), E = IU->end(); I != E; ++I) { + const Type *Ty = + SE->getEffectiveSCEVType(I->getOperandValToReplace()->getType()); if (!LargestType || SE->getTypeSizeInBits(Ty) > SE->getTypeSizeInBits(LargestType)) LargestType = Ty; - - std::map::iterator SI = - IU->IVUsesByStride.find(IU->StrideOrder[i]); - assert(SI != IU->IVUsesByStride.end() && "Stride doesn't exist!"); - - if (!SI->second->Users.empty()) - NeedCannIV = true; + NeedCannIV = true; } // Now that we know the largest of the induction variable expressions @@ -455,72 +449,64 @@ // add the offsets to the primary induction variable and cast, avoiding // the need for the code evaluation methods to insert induction variables // of different sizes. - for (unsigned i = 0, e = IU->StrideOrder.size(); i != e; ++i) { - const SCEV *Stride = IU->StrideOrder[i]; - - std::map::iterator SI = - IU->IVUsesByStride.find(IU->StrideOrder[i]); - assert(SI != IU->IVUsesByStride.end() && "Stride doesn't exist!"); - ilist &List = SI->second->Users; - for (ilist::iterator UI = List.begin(), - E = List.end(); UI != E; ++UI) { - Value *Op = UI->getOperandValToReplace(); - const Type *UseTy = Op->getType(); - Instruction *User = UI->getUser(); - - // Compute the final addrec to expand into code. - const SCEV *AR = IU->getReplacementExpr(*UI); - - // Evaluate the expression out of the loop, if possible. - if (!L->contains(UI->getUser())) { - const SCEV *ExitVal = SE->getSCEVAtScope(AR, L->getParentLoop()); - if (ExitVal->isLoopInvariant(L)) - AR = ExitVal; - } + for (IVUsers::iterator UI = IU->begin(), E = IU->end(); UI != E; ++UI) { + const SCEV *Stride = UI->getStride(); + Value *Op = UI->getOperandValToReplace(); + const Type *UseTy = Op->getType(); + Instruction *User = UI->getUser(); + + // Compute the final addrec to expand into code. + const SCEV *AR = IU->getReplacementExpr(*UI); + + // Evaluate the expression out of the loop, if possible. + if (!L->contains(UI->getUser())) { + const SCEV *ExitVal = SE->getSCEVAtScope(AR, L->getParentLoop()); + if (ExitVal->isLoopInvariant(L)) + AR = ExitVal; + } - // FIXME: It is an extremely bad idea to indvar substitute anything more - // complex than affine induction variables. Doing so will put expensive - // polynomial evaluations inside of the loop, and the str reduction pass - // currently can only reduce affine polynomials. For now just disable - // indvar subst on anything more complex than an affine addrec, unless - // it can be expanded to a trivial value. - if (!AR->isLoopInvariant(L) && !Stride->isLoopInvariant(L)) - continue; + // FIXME: It is an extremely bad idea to indvar substitute anything more + // complex than affine induction variables. Doing so will put expensive + // polynomial evaluations inside of the loop, and the str reduction pass + // currently can only reduce affine polynomials. For now just disable + // indvar subst on anything more complex than an affine addrec, unless + // it can be expanded to a trivial value. + if (!AR->isLoopInvariant(L) && !Stride->isLoopInvariant(L)) + continue; - // Determine the insertion point for this user. By default, insert - // immediately before the user. The SCEVExpander class will automatically - // hoist loop invariants out of the loop. For PHI nodes, there may be - // multiple uses, so compute the nearest common dominator for the - // incoming blocks. - Instruction *InsertPt = User; - if (PHINode *PHI = dyn_cast(InsertPt)) - for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) - if (PHI->getIncomingValue(i) == Op) { - if (InsertPt == User) - InsertPt = PHI->getIncomingBlock(i)->getTerminator(); - else - InsertPt = - DT->findNearestCommonDominator(InsertPt->getParent(), - PHI->getIncomingBlock(i)) - ->getTerminator(); - } - - // Now expand it into actual Instructions and patch it into place. - Value *NewVal = Rewriter.expandCodeFor(AR, UseTy, InsertPt); - - // Patch the new value into place. - if (Op->hasName()) - NewVal->takeName(Op); - User->replaceUsesOfWith(Op, NewVal); - UI->setOperandValToReplace(NewVal); - DEBUG(dbgs() << "INDVARS: Rewrote IV '" << *AR << "' " << *Op << '\n' - << " into = " << *NewVal << "\n"); - ++NumRemoved; - Changed = true; + // Determine the insertion point for this user. By default, insert + // immediately before the user. The SCEVExpander class will automatically + // hoist loop invariants out of the loop. For PHI nodes, there may be + // multiple uses, so compute the nearest common dominator for the + // incoming blocks. + Instruction *InsertPt = User; + if (PHINode *PHI = dyn_cast(InsertPt)) + for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) + if (PHI->getIncomingValue(i) == Op) { + if (InsertPt == User) + InsertPt = PHI->getIncomingBlock(i)->getTerminator(); + else + InsertPt = + DT->findNearestCommonDominator(InsertPt->getParent(), + PHI->getIncomingBlock(i)) + ->getTerminator(); + } + + // Now expand it into actual Instructions and patch it into place. + Value *NewVal = Rewriter.expandCodeFor(AR, UseTy, InsertPt); + + // Patch the new value into place. + if (Op->hasName()) + NewVal->takeName(Op); + User->replaceUsesOfWith(Op, NewVal); + UI->setOperandValToReplace(NewVal); + DEBUG(dbgs() << "INDVARS: Rewrote IV '" << *AR << "' " << *Op << '\n' + << " into = " << *NewVal << "\n"); + ++NumRemoved; + Changed = true; - // The old value may be dead now. - DeadInsts.push_back(Op); - } + // The old value may be dead now. + DeadInsts.push_back(Op); } // Clear the rewriter cache, because values that are in the rewriter's cache Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=95975&r1=95974&r2=95975&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Feb 12 04:34:29 2010 @@ -17,6 +17,40 @@ // available on the target, and it performs a variety of other optimizations // related to loop induction variables. // +// Terminology note: this code has a lot of handling for "post-increment" or +// "post-inc" users. This is not talking about post-increment addressing modes; +// it is instead talking about code like this: +// +// %i = phi [ 0, %entry ], [ %i.next, %latch ] +// ... +// %i.next = add %i, 1 +// %c = icmp eq %i.next, %n +// +// The SCEV for %i is {0,+,1}<%L>. The SCEV for %i.next is {1,+,1}<%L>, however +// it's useful to think about these as the same register, with some uses using +// the value of the register before the add and some using // it after. In this +// example, the icmp is a post-increment user, since it uses %i.next, which is +// the value of the induction variable after the increment. The other common +// case of post-increment users is users outside the loop. +// +// TODO: More sophistication in the way Formulae are generated and filtered. +// +// TODO: Handle multiple loops at a time. +// +// TODO: Should TargetLowering::AddrMode::BaseGV be changed to a ConstantExpr +// instead of a GlobalValue? +// +// TODO: When truncation is free, truncate ICmp users' operands to make it a +// smaller encoding (on x86 at least). +// +// TODO: When a negated register is used by an add (such as in a list of +// multiple base registers, or as the increment expression in an addrec), +// we may not actually need both reg and (-1 * reg) in registers; the +// negation can be implemented by using a sub instead of an add. The +// lack of support for taking this into consideration when making +// register pressure decisions is partly worked around by the "Special" +// use kind. +// //===----------------------------------------------------------------------===// #define DEBUG_TYPE "loop-reduce" @@ -26,208 +60,401 @@ #include "llvm/IntrinsicInst.h" #include "llvm/DerivedTypes.h" #include "llvm/Analysis/IVUsers.h" +#include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" -#include "llvm/Transforms/Utils/AddrModeMatcher.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" -#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallBitVector.h" +#include "llvm/ADT/SetVector.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetLowering.h" #include using namespace llvm; -STATISTIC(NumReduced , "Number of IV uses strength reduced"); -STATISTIC(NumInserted, "Number of PHIs inserted"); -STATISTIC(NumVariable, "Number of PHIs with variable strides"); -STATISTIC(NumEliminated, "Number of strides eliminated"); -STATISTIC(NumShadow, "Number of Shadow IVs optimized"); -STATISTIC(NumImmSunk, "Number of common expr immediates sunk into uses"); -STATISTIC(NumLoopCond, "Number of loop terminating conds optimized"); -STATISTIC(NumCountZero, "Number of count iv optimized to count toward zero"); - -static cl::opt EnableFullLSRMode("enable-full-lsr", - cl::init(false), - cl::Hidden); - namespace { - struct BasedUser; +/// RegSortData - This class holds data which is used to order reuse candidates. +class RegSortData { +public: + /// UsedByIndices - This represents the set of LSRUse indices which reference + /// a particular register. + SmallBitVector UsedByIndices; - /// IVInfo - This structure keeps track of one IV expression inserted during - /// StrengthReduceStridedIVUsers. It contains the stride, the common base, as - /// well as the PHI node and increment value created for rewrite. - struct IVExpr { - const SCEV *Stride; - const SCEV *Base; - PHINode *PHI; + RegSortData() {} - IVExpr(const SCEV *const stride, const SCEV *const base, PHINode *phi) - : Stride(stride), Base(base), PHI(phi) {} - }; + void print(raw_ostream &OS) const; + void dump() const; +}; - /// IVsOfOneStride - This structure keeps track of all IV expression inserted - /// during StrengthReduceStridedIVUsers for a particular stride of the IV. - struct IVsOfOneStride { - std::vector IVs; +} - void addIV(const SCEV *const Stride, const SCEV *const Base, PHINode *PHI) { - IVs.push_back(IVExpr(Stride, Base, PHI)); - } - }; +void RegSortData::print(raw_ostream &OS) const { + OS << "[NumUses=" << UsedByIndices.count() << ']'; +} - class LoopStrengthReduce : public LoopPass { - IVUsers *IU; - ScalarEvolution *SE; - bool Changed; - - /// IVsByStride - Keep track of all IVs that have been inserted for a - /// particular stride. - std::map IVsByStride; - - /// DeadInsts - Keep track of instructions we may have made dead, so that - /// we can remove them after we are done working. - SmallVector DeadInsts; - - /// TLI - Keep a pointer of a TargetLowering to consult for determining - /// transformation profitability. - const TargetLowering *TLI; - - public: - static char ID; // Pass ID, replacement for typeid - explicit LoopStrengthReduce(const TargetLowering *tli = NULL) : - LoopPass(&ID), TLI(tli) {} - - bool runOnLoop(Loop *L, LPPassManager &LPM); - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - // We split critical edges, so we change the CFG. However, we do update - // many analyses if they are around. - AU.addPreservedID(LoopSimplifyID); - AU.addPreserved("loops"); - AU.addPreserved("domfrontier"); - AU.addPreserved("domtree"); - - AU.addRequiredID(LoopSimplifyID); - AU.addRequired(); - AU.addPreserved(); - AU.addRequired(); - AU.addPreserved(); - } - - private: - void OptimizeIndvars(Loop *L); - - /// OptimizeLoopTermCond - Change loop terminating condition to use the - /// postinc iv when possible. - void OptimizeLoopTermCond(Loop *L); - - /// OptimizeShadowIV - If IV is used in a int-to-float cast - /// inside the loop then try to eliminate the cast opeation. - void OptimizeShadowIV(Loop *L); - - /// OptimizeMax - Rewrite the loop's terminating condition - /// if it uses a max computation. - ICmpInst *OptimizeMax(Loop *L, ICmpInst *Cond, - IVStrideUse* &CondUse); - - /// OptimizeLoopCountIV - If, after all sharing of IVs, the IV used for - /// deciding when to exit the loop is used only for that purpose, try to - /// rearrange things so it counts down to a test against zero. - bool OptimizeLoopCountIV(Loop *L); - bool OptimizeLoopCountIVOfStride(const SCEV* &Stride, - IVStrideUse* &CondUse, Loop *L); - - /// StrengthReduceIVUsersOfStride - Strength reduce all of the users of a - /// single stride of IV. All of the users may have different starting - /// values, and this may not be the only stride. - void StrengthReduceIVUsersOfStride(const SCEV *Stride, - IVUsersOfOneStride &Uses, - Loop *L); - void StrengthReduceIVUsers(Loop *L); - - ICmpInst *ChangeCompareStride(Loop *L, ICmpInst *Cond, - IVStrideUse* &CondUse, - const SCEV* &CondStride, - bool PostPass = false); - - bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, - const SCEV* &CondStride); - bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); - const SCEV *CheckForIVReuse(bool, bool, bool, const SCEV *, - IVExpr&, const Type*, - const std::vector& UsersToProcess); - bool ValidScale(bool, int64_t, - const std::vector& UsersToProcess); - bool ValidOffset(bool, int64_t, int64_t, - const std::vector& UsersToProcess); - const SCEV *CollectIVUsers(const SCEV *Stride, - IVUsersOfOneStride &Uses, - Loop *L, - bool &AllUsesAreAddresses, - bool &AllUsesAreOutsideLoop, - std::vector &UsersToProcess); - bool StrideMightBeShared(const SCEV *Stride, Loop *L, bool CheckPreInc); - bool ShouldUseFullStrengthReductionMode( - const std::vector &UsersToProcess, - const Loop *L, - bool AllUsesAreAddresses, - const SCEV *Stride); - void PrepareToStrengthReduceFully( - std::vector &UsersToProcess, - const SCEV *Stride, - const SCEV *CommonExprs, - const Loop *L, - SCEVExpander &PreheaderRewriter); - void PrepareToStrengthReduceFromSmallerStride( - std::vector &UsersToProcess, - Value *CommonBaseV, - const IVExpr &ReuseIV, - Instruction *PreInsertPt); - void PrepareToStrengthReduceWithNewPhi( - std::vector &UsersToProcess, - const SCEV *Stride, - const SCEV *CommonExprs, - Value *CommonBaseV, - Instruction *IVIncInsertPt, - const Loop *L, - SCEVExpander &PreheaderRewriter); +void RegSortData::dump() const { + print(errs()); errs() << '\n'; +} + +namespace { + +/// RegUseTracker - Map register candidates to information about how they are +/// used. +class RegUseTracker { + typedef DenseMap RegUsesTy; + + RegUsesTy RegUses; + SmallVector RegSequence; + +public: + void CountRegister(const SCEV *Reg, size_t LUIdx); + + bool isRegUsedByUsesOtherThan(const SCEV *Reg, size_t LUIdx) const; + + const SmallBitVector &getUsedByIndices(const SCEV *Reg) const; + + void clear(); + + typedef SmallVectorImpl::iterator iterator; + typedef SmallVectorImpl::const_iterator const_iterator; + iterator begin() { return RegSequence.begin(); } + iterator end() { return RegSequence.end(); } + const_iterator begin() const { return RegSequence.begin(); } + const_iterator end() const { return RegSequence.end(); } +}; - void DeleteTriviallyDeadInstructions(); - }; } -char LoopStrengthReduce::ID = 0; -static RegisterPass -X("loop-reduce", "Loop Strength Reduction"); +void +RegUseTracker::CountRegister(const SCEV *Reg, size_t LUIdx) { + std::pair Pair = + RegUses.insert(std::make_pair(Reg, RegSortData())); + RegSortData