Re: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td
Hi Bill, presumably you are using alias analysis at the codegen level. I noticed some time ago that in several places code doing multiple stores to successive locations does not set the SVOffset value correctly: it used the same SVOffset for all the stores. Probably the same is true for loads. I think this can result in wrong alias analysis deductions. Probably someone should audit code for this... Ciao, Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44704 - in /llvm/trunk/bindings/ocaml: analysis/analysis_ocaml.c llvm/llvm_ocaml.c
Author: gordon Date: Sat Dec 8 10:55:43 2007 New Revision: 44704 URL: http://llvm.org/viewvc/llvm-project?rev=44704&view=rev Log: Fix bug in constructing Ocaml option types in the bindings. Modified: llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Modified: llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c?rev=44704&r1=44703&r2=44704&view=diff == --- llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c Sat Dec 8 10:55:43 2007 @@ -32,7 +32,7 @@ if (0 == Result) { Option = Val_int(0); } else { -Option = alloc(1, 1); +Option = alloc(1, 0); String = copy_string(Message); Store_field(Option, 0, String); } 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=44704&r1=44703&r2=44704&view=diff == --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Sat Dec 8 10:55:43 2007 @@ -410,7 +410,7 @@ CAMLparam1(Name); LLVMValueRef GlobalVar; if ((GlobalVar = LLVMGetNamedGlobal(M, String_val(Name { -value Option = alloc(1, 1); +value Option = alloc(1, 0); Field(Option, 0) = (value) GlobalVar; CAMLreturn(Option); } @@ -487,7 +487,7 @@ CAMLparam1(Name); LLVMValueRef Fn; if ((Fn = LLVMGetNamedFunction(M, String_val(Name { -value Option = alloc(1, 1); +value Option = alloc(1, 0); Field(Option, 0) = (value) Fn; CAMLreturn(Option); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44705 - in /llvm/trunk: include/llvm/Support/StringPool.h lib/Support/StringPool.cpp
Author: gordon Date: Sat Dec 8 11:07:47 2007 New Revision: 44705 URL: http://llvm.org/viewvc/llvm-project?rev=44705&view=rev Log: Adding a StringPool data structure, which GC will use. Added: llvm/trunk/include/llvm/Support/StringPool.h llvm/trunk/lib/Support/StringPool.cpp Added: llvm/trunk/include/llvm/Support/StringPool.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StringPool.h?rev=44705&view=auto == --- llvm/trunk/include/llvm/Support/StringPool.h (added) +++ llvm/trunk/include/llvm/Support/StringPool.h Sat Dec 8 11:07:47 2007 @@ -0,0 +1,135 @@ +//===-- StringPool.h - Interned string pool ---===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Gordon Henriksen and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--===// +// +// This file declares an interned string pool, which helps reduce the cost of +// strings by using the same storage for identical strings. +// +// To intern a string: +// +// StringPool Pool; +// PooledStringPtr Str = Pool.intern("wakka wakka"); +// +// To use the value of an interned string, use operator bool and operator*: +// +// if (Str) +// cerr << "the string is" << *Str << "\n"; +// +// Pooled strings are immutable, but you can change a PooledStringPtr to point +// to another instance. So that interned strings can eventually be freed, +// strings in the string pool are reference-counted (automatically). +// +//===--===// + +#ifndef LLVM_SUPPORT_STRINGPOOL_H +#define LLVM_SUPPORT_STRINGPOOL_H + +#include +#include +#include + +namespace llvm { + + class PooledStringPtr; + + /// StringPool - An interned string pool. Use the intern method to add a + /// string. Strings are removed automatically as PooledStringPtrs are + /// destroyed. + class StringPool { +struct PooledString { + StringPool *Pool; ///< So the string can remove itself. + unsigned Refcount; ///< Number of referencing PooledStringPtrs. + +public: + PooledString() : Pool(0), Refcount(0) { } +}; + +friend class PooledStringPtr; + +typedef StringMap table_t; +typedef StringMapEntry entry_t; +table_t InternTable; + + public: +StringPool(); +~StringPool(); + +PooledStringPtr intern(const char *Begin, const char *End); +inline PooledStringPtr intern(const char *Str); + }; + + /// PooledStringPtr - A pointer to an interned string. Use operator bool to + /// test whether the pointer is valid, and operator * to get the string if so. + /// This is a lightweight value class with storage requirements equivalent to + /// a single pointer, but it does have reference-counting overhead when + /// copied. + class PooledStringPtr { +typedef StringPool::entry_t entry_t; +entry_t *S; + + public: +PooledStringPtr() : S(0) {} + +explicit PooledStringPtr(entry_t *E) : S(E) { + if (S) ++S->getValue().Refcount; +} + +PooledStringPtr(const PooledStringPtr &That) : S(That.S) { + if (S) ++S->getValue().Refcount; +} + +PooledStringPtr &operator=(const PooledStringPtr &That) { + if (S != That.S) { +clear(); +S = That.S; +if (S) ++S->getValue().Refcount; + } + return *this; +} + +void clear() { + if (!S) +return; + if (--S->getValue().Refcount == 0) { +S->getValue().Pool->InternTable.remove(S); +delete S; + } + S = 0; +} + +~PooledStringPtr() { clear(); } + +inline const char *begin() const { + assert(*this && "Attempt to dereference empty PooledStringPtr!"); + return S->getKeyData(); +} + +inline const char *end() const { + assert(*this && "Attempt to dereference empty PooledStringPtr!"); + return S->getKeyData() + S->getKeyLength(); +} + +inline unsigned size() const { + assert(*this && "Attempt to dereference empty PooledStringPtr!"); + return S->getKeyLength(); +} + +inline const char *operator*() const { return begin(); } +inline operator bool() const { return S != 0; } + +inline bool operator==(const PooledStringPtr &That) { return S == That.S; } +inline bool operator!=(const PooledStringPtr &That) { return S != That.S; } + }; + + PooledStringPtr StringPool::intern(const char *Str) { +return intern(Str, Str + strlen(Str)); + } + +} // End llvm namespace + +#endif Added: llvm/trunk/lib/Support/StringPool.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringPool.cpp?rev=44705&view=auto
[llvm-commits] [llvm] r44706 - /llvm/trunk/lib/Target/CellSPU/
Author: gordon Date: Sat Dec 8 11:53:01 2007 New Revision: 44706 URL: http://llvm.org/viewvc/llvm-project?rev=44706&view=rev Log: Ignoring generated files. Modified: llvm/trunk/lib/Target/CellSPU/ (props changed) Propchange: llvm/trunk/lib/Target/CellSPU/ -- --- svn:ignore (added) +++ svn:ignore Sat Dec 8 11:53:01 2007 @@ -0,0 +1,3 @@ +*.inc +Debug +Release ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44707 - /llvm/trunk/lib/Support/APFloat.cpp
Author: lattner Date: Sat Dec 8 13:00:03 2007 New Revision: 44707 URL: http://llvm.org/viewvc/llvm-project?rev=44707&view=rev Log: proper #include order. Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=44707&r1=44706&r2=44707&view=diff == --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Sat Dec 8 13:00:03 2007 @@ -12,9 +12,9 @@ // //===--===// +#include "llvm/ADT/APFloat.h" #include #include -#include "llvm/ADT/APFloat.h" #include "llvm/Support/MathExtras.h" using namespace llvm; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44708 - /llvm/trunk/include/llvm/ADT/APFloat.h
Author: lattner Date: Sat Dec 8 13:00:38 2007 New Revision: 44708 URL: http://llvm.org/viewvc/llvm-project?rev=44708&view=rev Log: remove dead #include, APInt.h already has the needed forward decls. Modified: llvm/trunk/include/llvm/ADT/APFloat.h Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=44708&r1=44707&r2=44708&view=diff == --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Sat Dec 8 13:00:38 2007 @@ -102,7 +102,6 @@ // APInt contains static functions implementing bignum arithmetic. #include "llvm/ADT/APInt.h" -#include "llvm/Bitcode/SerializationFwd.h" #include "llvm/CodeGen/ValueTypes.h" namespace llvm { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44709 - /llvm/trunk/include/llvm/ADT/APInt.h
Author: lattner Date: Sat Dec 8 13:01:44 2007 New Revision: 44709 URL: http://llvm.org/viewvc/llvm-project?rev=44709&view=rev Log: eliminate dependency on Bitcode headers. Modified: llvm/trunk/include/llvm/ADT/APInt.h Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=44709&r1=44708&r2=44709&view=diff == --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Sat Dec 8 13:01:44 2007 @@ -16,14 +16,15 @@ #define LLVM_APINT_H #include "llvm/Support/DataTypes.h" -#include "llvm/Bitcode/SerializationFwd.h" #include #include #define COMPILE_TIME_ASSERT(cond) extern int CTAssert[(cond) ? 1 : -1] namespace llvm { - + class Serializer; + class Deserializer; + /* An unsigned host type used as a single part of a multi-part bignum. */ typedef uint64_t integerPart; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44710 - /llvm/trunk/lib/AsmParser/LLLexer.cpp
Author: lattner Date: Sat Dec 8 13:03:30 2007 New Revision: 44710 URL: http://llvm.org/viewvc/llvm-project?rev=44710&view=rev Log: add #include Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=44710&r1=44709&r2=44710&view=diff == --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Sat Dec 8 13:03:30 2007 @@ -14,6 +14,7 @@ #include "LLLexer.h" #include "ParserInternals.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/MathExtras.h" #include #include "llvmAsmParser.h" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44711 - /llvm/trunk/include/llvm/ADT/APFloat.h
Author: lattner Date: Sat Dec 8 13:06:21 2007 New Revision: 44711 URL: http://llvm.org/viewvc/llvm-project?rev=44711&view=rev Log: remove dead #include. Modified: llvm/trunk/include/llvm/ADT/APFloat.h Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=44711&r1=44710&r2=44711&view=diff == --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Sat Dec 8 13:06:21 2007 @@ -102,7 +102,6 @@ // APInt contains static functions implementing bignum arithmetic. #include "llvm/ADT/APInt.h" -#include "llvm/CodeGen/ValueTypes.h" namespace llvm { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r44705 - in /llvm/trunk: include/llvm/Support/StringPool.h lib/Support/StringPool.cpp
Hi Gordon, Nice addition. Some minor feedback for you below ... On Sat, 2007-12-08 at 17:07 +, Gordon Henriksen wrote: > Author: gordon > Date: Sat Dec 8 11:07:47 2007 > New Revision: 44705 > > URL: http://llvm.org/viewvc/llvm-project?rev=44705&view=rev > Log: > Adding a StringPool data structure, which GC will use. > > Added: > llvm/trunk/include/llvm/Support/StringPool.h > llvm/trunk/lib/Support/StringPool.cpp > > Added: llvm/trunk/include/llvm/Support/StringPool.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StringPool.h?rev=44705&view=auto > > == > --- llvm/trunk/include/llvm/Support/StringPool.h (added) > +++ llvm/trunk/include/llvm/Support/StringPool.h Sat Dec 8 11:07:47 2007 > @@ -0,0 +1,135 @@ > +//===-- StringPool.h - Interned string pool > ---===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file was developed by Gordon Henriksen and is distributed under the > +// University of Illinois Open Source License. See LICENSE.TXT for details. > +// > +//===--===// > +// > +// This file declares an interned string pool, which helps reduce the cost of > +// strings by using the same storage for identical strings. > +// > +// To intern a string: > +// > +// StringPool Pool; > +// PooledStringPtr Str = Pool.intern("wakka wakka"); > +// > +// To use the value of an interned string, use operator bool and operator*: > +// > +// if (Str) > +// cerr << "the string is" << *Str << "\n"; > +// > +// Pooled strings are immutable, but you can change a PooledStringPtr to > point > +// to another instance. So that interned strings can eventually be freed, > +// strings in the string pool are reference-counted (automatically). > +// > +//===--===// > + > +#ifndef LLVM_SUPPORT_STRINGPOOL_H > +#define LLVM_SUPPORT_STRINGPOOL_H > + > +#include > +#include > +#include > + > +namespace llvm { > + > + class PooledStringPtr; > + > + /// StringPool - An interned string pool. Use the intern method to add a > + /// string. Strings are removed automatically as PooledStringPtrs are > + /// destroyed. > + class StringPool { > +struct PooledString { > + StringPool *Pool; ///< So the string can remove itself. > + unsigned Refcount; ///< Number of referencing PooledStringPtrs. > + > +public: > + PooledString() : Pool(0), Refcount(0) { } > +}; Since you have added doxygen comments for the structure's data members, why not document the structure itself as well? This will lead to less confusing documentation. > + > +friend class PooledStringPtr; > + > +typedef StringMap table_t; > +typedef StringMapEntry entry_t; > +table_t InternTable; > + > + public: > +StringPool(); > +~StringPool(); > + > +PooledStringPtr intern(const char *Begin, const char *End); > +inline PooledStringPtr intern(const char *Str); These two methods are primary interfaces to the StringPool, aren't they? Shouldn't they be documented with doxygen comments? > + }; > + > + /// PooledStringPtr - A pointer to an interned string. Use operator bool to > + /// test whether the pointer is valid, and operator * to get the string if > so. > + /// This is a lightweight value class with storage requirements equivalent > to > + /// a single pointer, but it does have reference-counting overhead when > + /// copied. > + class PooledStringPtr { > +typedef StringPool::entry_t entry_t; > +entry_t *S; > + > + public: > +PooledStringPtr() : S(0) {} > + > +explicit PooledStringPtr(entry_t *E) : S(E) { > + if (S) ++S->getValue().Refcount; > +} > + > +PooledStringPtr(const PooledStringPtr &That) : S(That.S) { > + if (S) ++S->getValue().Refcount; > +} > + > +PooledStringPtr &operator=(const PooledStringPtr &That) { > + if (S != That.S) { > +clear(); > +S = That.S; > +if (S) ++S->getValue().Refcount; > + } > + return *this; > +} > + > +void clear() { > + if (!S) > +return; > + if (--S->getValue().Refcount == 0) { > +S->getValue().Pool->InternTable.remove(S); > +delete S; > + } > + S = 0; > +} > + > +~PooledStringPtr() { clear(); } > + > +inline const char *begin() const { > + assert(*this && "Attempt to dereference empty PooledStringPtr!"); > + return S->getKeyData(); > +} > + > +inline const char *end() const { > + assert(*this && "Attempt to dereference empty PooledStringPtr!"); > + return S->getKeyData() + S->getKeyLength(); > +} > + > +inline unsigned size() const { > + assert(*this && "Attempt to dereference empty PooledStri
Re: [llvm-commits] [llvm] r44705 - in /llvm/trunk: include/llvm/Support/StringPool.h lib/Support/StringPool.cpp
Hi Reid. Nice to hear from you. On 2007-12-08, at 14:43, Reid Spencer wrote: > Hi Gordon, > > Nice addition. Thanks. > Some minor feedback for you below ... > > On Sat, 2007-12-08 at 17:07 +, Gordon Henriksen wrote: > >> +struct PooledString { >> + StringPool *Pool; ///< So the string can remove itself. >> + unsigned Refcount; ///< Number of referencing >> PooledStringPtrs. >> + >> +public: >> + PooledString() : Pool(0), Refcount(0) { } >> +}; > > Since you have added doxygen comments for the structure's data > members, > why not document the structure itself as well? This will lead to less > confusing documentation. Okay. >> + >> +friend class PooledStringPtr; >> + >> +typedef StringMap table_t; >> +typedef StringMapEntry entry_t; >> +table_t InternTable; >> + >> + public: >> +StringPool(); >> +~StringPool(); >> + >> +PooledStringPtr intern(const char *Begin, const char *End); >> +inline PooledStringPtr intern(const char *Str); > > These two methods are primary interfaces to the StringPool, aren't > they? > Shouldn't they be documented with doxygen comments? Okay. >> + PooledStringPtr StringPool::intern(const char *Str) { >> +return intern(Str, Str + strlen(Str)); > > Maybe use strnlen(3) That function is sufficiently nonstandard to not exist on Darwin. > here to guard against Str not being null terminated ? This is a convenience specifically for null-terminated strings, so I'm not sure how defensive programming here is useful. — Gordon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44713 - /llvm/trunk/include/llvm/Support/StringPool.h
Author: gordon Date: Sat Dec 8 14:10:40 2007 New Revision: 44713 URL: http://llvm.org/viewvc/llvm-project?rev=44713&view=rev Log: Incorporating review feedback from Reid. Modified: llvm/trunk/include/llvm/Support/StringPool.h Modified: llvm/trunk/include/llvm/Support/StringPool.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StringPool.h?rev=44713&r1=44712&r2=44713&view=diff == --- llvm/trunk/include/llvm/Support/StringPool.h (original) +++ llvm/trunk/include/llvm/Support/StringPool.h Sat Dec 8 14:10:40 2007 @@ -41,6 +41,8 @@ /// string. Strings are removed automatically as PooledStringPtrs are /// destroyed. class StringPool { +/// PooledString - This is the value of an entry in the pool's interning +/// table. struct PooledString { StringPool *Pool; ///< So the string can remove itself. unsigned Refcount; ///< Number of referencing PooledStringPtrs. @@ -59,7 +61,14 @@ StringPool(); ~StringPool(); +/// intern - Adds a string to the pool and returns a reference-counted +/// pointer to it. No additional memory is allocated if the string already +/// exists in the pool. PooledStringPtr intern(const char *Begin, const char *End); + +/// intern - Adds a null-terminated string to the pool and returns a +/// reference-counted pointer to it. No additional memory is allocated if +/// the string already exists in the pool. inline PooledStringPtr intern(const char *Str); }; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44714 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeDAGTypes.cpp LegalizeTypes.h
Author: lattner Date: Sat Dec 8 14:16:06 2007 New Revision: 44714 URL: http://llvm.org/viewvc/llvm-project?rev=44714&view=rev Log: Split the class definition of DAGTypeLegalizer out into a header. Leave it visibility hidden, but not in an anon namespace. Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=44714&r1=44713&r2=44714&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Sat Dec 8 14:16:06 2007 @@ -12,246 +12,13 @@ // //===--===// -#define DEBUG_TYPE "legalize-types" -#include "llvm/CodeGen/SelectionDAG.h" +#include "LegalizeTypes.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" -#include "llvm/Target/TargetLowering.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" using namespace llvm; -//===--===// -/// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and -/// hacks on it until the target machine can handle it. This involves -/// eliminating value sizes the machine cannot handle (promoting small sizes to -/// large sizes or splitting up large values into small values) as well as -/// eliminating operations the machine cannot handle. -/// -/// This code also does a small amount of optimization and recognition of idioms -/// as part of its processing. For example, if a target does not support a -/// 'setcc' instruction efficiently, but does support 'brcc' instruction, this -/// will attempt merge setcc and brc instructions into brcc's. -/// -namespace { -class VISIBILITY_HIDDEN DAGTypeLegalizer { - TargetLowering &TLI; - SelectionDAG &DAG; - - // NodeIDFlags - This pass uses the NodeID on the SDNodes to hold information - // about the state of the node. The enum has all the values. - enum NodeIDFlags { -/// ReadyToProcess - All operands have been processed, so this node is ready -/// to be handled. -ReadyToProcess = 0, - -/// NewNode - This is a new node that was created in the process of -/// legalizing some other node. -NewNode = -1, - -/// Processed - This is a node that has already been processed. -Processed = -2 - -// 1+ - This is a node which has this many unlegalized operands. - }; - - enum LegalizeAction { -Legal, // The target natively supports this type. -Promote,// This type should be executed in a larger type. -Expand // This type should be split into two types of half the size. - }; - - /// ValueTypeActions - This is a bitvector that contains two bits for each - /// simple value type, where the two bits correspond to the LegalizeAction - /// enum. This can be queried with "getTypeAction(VT)". - TargetLowering::ValueTypeActionImpl ValueTypeActions; - - /// getTypeAction - Return how we should legalize values of this type, either - /// it is already legal or we need to expand it into multiple registers of - /// smaller integer type, or we need to promote it to a larger type. - LegalizeAction getTypeAction(MVT::ValueType VT) const { -return (LegalizeAction)ValueTypeActions.getTypeAction(VT); - } - - /// isTypeLegal - Return true if this type is legal on this target. - /// - bool isTypeLegal(MVT::ValueType VT) const { -return getTypeAction(VT) == Legal; - } - - SDOperand getIntPtrConstant(uint64_t Val) { -return DAG.getConstant(Val, TLI.getPointerTy()); - } - - /// PromotedNodes - For nodes that are below legal width, this map indicates - /// what promoted value to use. - DenseMap PromotedNodes; - - /// ExpandedNodes - For nodes that need to be expanded this map indicates - /// which operands are the expanded version of the input. - DenseMap > ExpandedNodes; - - /// ScalarizedNodes - For nodes that are <1 x ty>, this map indicates the - /// scalar value of type 'ty' to use. - DenseMap ScalarizedNodes; - - /// ReplacedNodes - For nodes that have been replaced with another, - /// indicates the replacement node to use. - DenseMap ReplacedNodes; - - /// Worklist - This defines a worklist of nodes to process. In order to be - /// pushed onto this worklist, all operands of a node must have already been - /// processed. - SmallVector Worklist; - -public: - explicit DAGTypeLegalizer(SelectionDAG &dag) -: TLI(dag.getTargetLoweringInfo()), DAG(dag), -ValueTypeActions(TLI.getValueTypeActions()) { -assert(MVT::LAST_VALUETYPE <= 32 && - "Too many
[llvm-commits] [llvm] r44716 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypesPromote.cpp
Author: lattner Date: Sat Dec 8 14:24:38 2007 New Revision: 44716 URL: http://llvm.org/viewvc/llvm-project?rev=44716&view=rev Log: Split promotion support out to its own file. Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=44716&r1=44715&r2=44716&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sat Dec 8 14:24:38 2007 @@ -1,4 +1,4 @@ -//===-- LegalizeDAGTypes.cpp - Implement SelectionDAG::LegalizeTypes --===// +//===-- LegalizeTypes.cpp - Common code for DAG type legalizer ===// // // The LLVM Compiler Infrastructure // @@ -8,7 +8,8 @@ //===--===// // // This file implements the SelectionDAG::LegalizeTypes method. It transforms -// an arbitrary well-formed SelectionDAG to only consist of legal types. +// an arbitrary well-formed SelectionDAG to only consist of legal types. This +// is common code shared among the LegalizeTypes*.cpp files. // //===--===// @@ -406,252 +407,6 @@ //===--===// -// Result Promotion -//===--===// - -/// PromoteResult - This method is called when a result of a node is found to be -/// in need of promotion to a larger type. At this point, the node may also -/// have invalid operands or may have other results that need expansion, we just -/// know that (at least) one result needs promotion. -void DAGTypeLegalizer::PromoteResult(SDNode *N, unsigned ResNo) { - DEBUG(cerr << "Promote node result: "; N->dump(&DAG); cerr << "\n"); - SDOperand Result = SDOperand(); - - switch (N->getOpcode()) { - default: -#ifndef NDEBUG -cerr << "PromoteResult #" << ResNo << ": "; -N->dump(&DAG); cerr << "\n"; -#endif -assert(0 && "Do not know how to promote this operator!"); -abort(); - case ISD::UNDEF:Result = PromoteResult_UNDEF(N); break; - case ISD::Constant: Result = PromoteResult_Constant(N); break; - - case ISD::TRUNCATE:Result = PromoteResult_TRUNCATE(N); break; - case ISD::SIGN_EXTEND: - case ISD::ZERO_EXTEND: - case ISD::ANY_EXTEND: Result = PromoteResult_INT_EXTEND(N); break; - case ISD::FP_ROUND:Result = PromoteResult_FP_ROUND(N); break; - case ISD::FP_TO_SINT: - case ISD::FP_TO_UINT: Result = PromoteResult_FP_TO_XINT(N); break; - case ISD::SETCC:Result = PromoteResult_SETCC(N); break; - case ISD::LOAD: Result = PromoteResult_LOAD(cast(N)); break; - - case ISD::AND: - case ISD::OR: - case ISD::XOR: - case ISD::ADD: - case ISD::SUB: - case ISD::MUL: Result = PromoteResult_SimpleIntBinOp(N); break; - - case ISD::SDIV: - case ISD::SREM: Result = PromoteResult_SDIV(N); break; - - case ISD::UDIV: - case ISD::UREM: Result = PromoteResult_UDIV(N); break; - - case ISD::SHL: Result = PromoteResult_SHL(N); break; - case ISD::SRA: Result = PromoteResult_SRA(N); break; - case ISD::SRL: Result = PromoteResult_SRL(N); break; - - case ISD::SELECT:Result = PromoteResult_SELECT(N); break; - case ISD::SELECT_CC: Result = PromoteResult_SELECT_CC(N); break; - - } - - // If Result is null, the sub-method took care of registering the result. - if (Result.Val) -SetPromotedOp(SDOperand(N, ResNo), Result); -} - -SDOperand DAGTypeLegalizer::PromoteResult_UNDEF(SDNode *N) { - return DAG.getNode(ISD::UNDEF, TLI.getTypeToTransformTo(N->getValueType(0))); -} - -SDOperand DAGTypeLegalizer::PromoteResult_Constant(SDNode *N) { - MVT::ValueType VT = N->getValueType(0); - // Zero extend things like i1, sign extend everything else. It shouldn't - // matter in theory which one we pick, but this tends to give better code? - unsigned Opc = VT != MVT::i1 ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; - SDOperand Result = DAG.getNode(Opc, TLI.getTypeToTransformTo(VT), - SDOperand(N, 0)); - assert(isa(Result) && "Didn't constant fold ext?"); - return Result; -} - -SDOperand DAGTypeLegalizer::PromoteResult_TRUNCATE(SDNode *N) { - SDOperand Res; - - switch (getTypeAction(N->getOperand(0).getValueType())) { - default: assert(0 && "Unknown type action!"); - case Legal: - case Expand: -Res = N->getOperand(0); -break; - case Promote: -Res = GetPromotedOp(N->getOperand(0)); -break; - } - - MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); - assert(MVT::getSizeInBits(Res.getValueType()) >= MVT::getSize
[llvm-commits] [llvm] r44718 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypesScalarize.cpp
Author: lattner Date: Sat Dec 8 14:30:28 2007 New Revision: 44718 URL: http://llvm.org/viewvc/llvm-project?rev=44718&view=rev Log: split scalarization out to its own file. Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesScalarize.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=44718&r1=44717&r2=44718&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sat Dec 8 14:30:28 2007 @@ -407,189 +407,6 @@ //===--===// -// Result Vector Scalarization: <1 x ty> -> ty. -//===--===// - - -void DAGTypeLegalizer::ScalarizeResult(SDNode *N, unsigned ResNo) { - DEBUG(cerr << "Scalarize node result " << ResNo << ": "; N->dump(&DAG); -cerr << "\n"); - SDOperand R = SDOperand(); - - // FIXME: Custom lowering for scalarization? -#if 0 - // See if the target wants to custom expand this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) { -// If the target wants to, allow it to lower this itself. -if (SDNode *P = TLI.ExpandOperationResult(N, DAG)) { - // Everything that once used N now uses P. We are guaranteed that the - // result value types of N and the result value types of P match. - ReplaceNodeWith(N, P); - return; -} - } -#endif - - switch (N->getOpcode()) { - default: -#ifndef NDEBUG -cerr << "ScalarizeResult #" << ResNo << ": "; -N->dump(&DAG); cerr << "\n"; -#endif -assert(0 && "Do not know how to scalarize the result of this operator!"); -abort(); - - case ISD::UNDEF: R = ScalarizeRes_UNDEF(N); break; - case ISD::LOAD:R = ScalarizeRes_LOAD(cast(N)); break; - case ISD::ADD: - case ISD::FADD: - case ISD::SUB: - case ISD::FSUB: - case ISD::MUL: - case ISD::FMUL: - case ISD::SDIV: - case ISD::UDIV: - case ISD::FDIV: - case ISD::SREM: - case ISD::UREM: - case ISD::FREM: - case ISD::FPOW: - case ISD::AND: - case ISD::OR: - case ISD::XOR: R = ScalarizeRes_BinOp(N); break; - case ISD::FNEG: - case ISD::FABS: - case ISD::FSQRT: - case ISD::FSIN: - case ISD::FCOS: R = ScalarizeRes_UnaryOp(N); break; - case ISD::FPOWI: R = ScalarizeRes_FPOWI(N); break; - case ISD::BUILD_VECTOR: R = N->getOperand(0); break; - case ISD::INSERT_VECTOR_ELT: R = N->getOperand(1); break; - case ISD::VECTOR_SHUFFLE:R = ScalarizeRes_VECTOR_SHUFFLE(N); break; - case ISD::BIT_CONVERT: R = ScalarizeRes_BIT_CONVERT(N); break; - case ISD::SELECT:R = ScalarizeRes_SELECT(N); break; - } - - // If R is null, the sub-method took care of registering the resul. - if (R.Val) -SetScalarizedOp(SDOperand(N, ResNo), R); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_UNDEF(SDNode *N) { - return DAG.getNode(ISD::UNDEF, MVT::getVectorElementType(N->getValueType(0))); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_LOAD(LoadSDNode *N) { - SDOperand Result = DAG.getLoad(MVT::getVectorElementType(N->getValueType(0)), - N->getChain(), N->getBasePtr(), - N->getSrcValue(), N->getSrcValueOffset(), - N->isVolatile(), N->getAlignment()); - - // Legalized the chain result - switch anything that used the old chain to - // use the new one. - ReplaceValueWith(SDOperand(N, 1), Result.getValue(1)); - return Result; -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_BinOp(SDNode *N) { - SDOperand LHS = GetScalarizedOp(N->getOperand(0)); - SDOperand RHS = GetScalarizedOp(N->getOperand(1)); - return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_UnaryOp(SDNode *N) { - SDOperand Op = GetScalarizedOp(N->getOperand(0)); - return DAG.getNode(N->getOpcode(), Op.getValueType(), Op); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_FPOWI(SDNode *N) { - SDOperand Op = GetScalarizedOp(N->getOperand(0)); - return DAG.getNode(ISD::FPOWI, Op.getValueType(), Op, N->getOperand(1)); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_VECTOR_SHUFFLE(SDNode *N) { - // Figure out if the scalar is the LHS or RHS and return it. - SDOperand EltNum = N->getOperand(2).getOperand(0); - unsigned Op = cast(EltNum)->getValue() != 0; - return GetScalarizedOp(N->getOperand(Op)); -} - -SDOperand DAGTypeLegalizer::ScalarizeRes_BIT_CONVERT(SDNode *N) { - MVT::ValueType NewVT = MVT::getVectorElementType(N->getValueType(0)); - return DAG.getNode(ISD::BIT_CONVERT, NewVT, N->getOperand(0)); -} - -SDOperand DAGTypeLegalizer
Re: [llvm-commits] [llvm] r44702 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineLICM.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86
Sorry, I made a mistake. The renaming is a bad idea. Please revert. We should mark instructions that produce side effects. All the others have no side effects. Then those that do not have register operands are candidates for trivial remat. Evan On Dec 7, 2007, at 11:17 PM, Bill Wendling <[EMAIL PROTECTED]> wrote: > Author: void > Date: Sat Dec 8 01:17:56 2007 > New Revision: 44702 > > URL: http://llvm.org/viewvc/llvm-project?rev=44702&view=rev > Log: > Renaming: > > isTriviallyReMaterializable -> hasNoSideEffects > isReallyTriviallyReMaterializable -> isTriviallyReMaterializable > > Modified: >llvm/trunk/include/llvm/Target/TargetInstrInfo.h >llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp >llvm/trunk/lib/CodeGen/MachineLICM.cpp >llvm/trunk/lib/Target/X86/X86InstrInfo.cpp >llvm/trunk/lib/Target/X86/X86InstrInfo.h > > Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=44702&r1=44701&r2=44702&view=diff > > === > === > === > = > --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Sat Dec 8 > 01:17:56 2007 > @@ -288,24 +288,24 @@ > return get(Opcode).Flags & M_HAS_OPTIONAL_DEF; > } > > - /// isTriviallyReMaterializable - Return true if the instruction > is trivially > + /// hasNoSideEffects - Return true if the instruction is trivially > /// rematerializable, meaning it has no side effects and requires > no operands > /// that aren't always available. > - bool isTriviallyReMaterializable(MachineInstr *MI) const { > + bool hasNoSideEffects(MachineInstr *MI) const { > return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) && > - isReallyTriviallyReMaterializable(MI); > + isTriviallyReMaterializable(MI); > } > > protected: > - /// isReallyTriviallyReMaterializable - For instructions with > opcodes for > - /// which the M_REMATERIALIZABLE flag is set, this function tests > whether the > - /// instruction itself is actually trivially rematerializable, > considering > - /// its operands. This is used for targets that have > instructions that are > - /// only trivially rematerializable for specific uses. This > predicate must > - /// return false if the instruction has any side effects other than > - /// producing a value, or if it requres any address registers > that are not > - /// always available. > - virtual bool isReallyTriviallyReMaterializable(MachineInstr *MI) > const { > + /// isTriviallyReMaterializable - For instructions with opcodes > for which the > + /// M_REMATERIALIZABLE flag is set, this function tests whether the > + /// instruction itself is actually trivially rematerializable, > considering its > + /// operands. This is used for targets that have instructions > that are only > + /// trivially rematerializable for specific uses. This predicate > must return > + /// false if the instruction has any side effects other than > producing a > + /// value, or if it requres any address registers that are not > always > + /// available. > + virtual bool isTriviallyReMaterializable(MachineInstr *MI) const { > return true; > } > > > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=44702&r1=44701&r2=44702&view=diff > > === > === > === > = > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Dec 8 > 01:17:56 2007 > @@ -613,7 +613,7 @@ > return false; > > isLoad = false; > - if (tii_->isTriviallyReMaterializable(MI)) { > + if (tii_->hasNoSideEffects(MI)) { > isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; > return true; > } > > Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44702&r1=44701&r2=44702&view=diff > > === > === > === > = > --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Sat Dec 8 01:17:56 2007 > @@ -120,7 +120,7 @@ > if (TID->ImplicitUses || !I.getNumOperands()) return false; > > MachineOpCode Opcode = TID->Opcode; > - return TII->isTriviallyReMaterializable(&I) && > + return TII->hasNoSideEffects(&I) && > // FIXME: Below necessary? > !(TII->isReturn(Opcode) || > TII->isTerminatorInstr(Opcode) || > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=44702&r1=44701&r2=44702&view=diff > > === > === >
[llvm-commits] [llvm] r44719 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Author: lattner Date: Sat Dec 8 15:59:32 2007 New Revision: 44719 URL: http://llvm.org/viewvc/llvm-project?rev=44719&view=rev Log: reorganize header to separate into functional blocks. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44719&r1=44718&r2=44719&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 15:59:32 2007 @@ -125,6 +125,15 @@ void RemapNode(SDOperand &N); + // Common routines. + SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT); + SDOperand HandleMemIntrinsic(SDNode *N); + void SplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + + //======// + // Promotion Support: LegalizeTypesPromote.cpp + //======// + SDOperand GetPromotedOp(SDOperand Op) { SDOperand &PromotedOp = PromotedNodes[Op]; RemapNode(PromotedOp); @@ -132,7 +141,7 @@ return PromotedOp; } void SetPromotedOp(SDOperand Op, SDOperand Result); - + /// GetPromotedZExtOp - Get a promoted operand and zero extend it to the final /// size. SDOperand GetPromotedZExtOp(SDOperand Op) { @@ -140,23 +149,7 @@ Op = GetPromotedOp(Op); return DAG.getZeroExtendInReg(Op, OldVT); } - - void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); - void SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi); - - SDOperand GetScalarizedOp(SDOperand Op) { -SDOperand &ScalarOp = ScalarizedNodes[Op]; -RemapNode(ScalarOp); -assert(ScalarOp.Val && "Operand wasn't scalarized?"); -return ScalarOp; - } - void SetScalarizedOp(SDOperand Op, SDOperand Result); - - // Common routines. - SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT); - SDOperand HandleMemIntrinsic(SDNode *N); - void SplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); - + // Result Promotion. void PromoteResult(SDNode *N, unsigned ResNo); SDOperand PromoteResult_UNDEF(SDNode *N); @@ -176,6 +169,30 @@ SDOperand PromoteResult_SELECT (SDNode *N); SDOperand PromoteResult_SELECT_CC(SDNode *N); + // Operand Promotion. + bool PromoteOperand(SDNode *N, unsigned OperandNo); + SDOperand PromoteOperand_ANY_EXTEND(SDNode *N); + SDOperand PromoteOperand_ZERO_EXTEND(SDNode *N); + SDOperand PromoteOperand_SIGN_EXTEND(SDNode *N); + SDOperand PromoteOperand_TRUNCATE(SDNode *N); + SDOperand PromoteOperand_FP_EXTEND(SDNode *N); + SDOperand PromoteOperand_FP_ROUND(SDNode *N); + SDOperand PromoteOperand_INT_TO_FP(SDNode *N); + SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_BRCOND(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_BR_CC(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_SETCC(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo); + + void PromoteSetCCOperands(SDOperand &LHS,SDOperand &RHS, ISD::CondCode Code); + + //======// + // Expansion Support: LegalizeTypesExpand.cpp + //======// + + void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + void SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi); + // Result Expansion. void ExpandResult(SDNode *N, unsigned ResNo); void ExpandResult_UNDEF (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -203,34 +220,6 @@ SDOperand &Lo, SDOperand &Hi); bool ExpandShiftWithKnownAmountBit(SDNode *N, SDOperand &Lo, SDOperand &Hi); - // Result Vector Scalarization: <1 x ty> -> ty. - void ScalarizeResult(SDNode *N, unsigned OpNo); - SDOperand ScalarizeRes_UNDEF(SDNode *N); - SDOperand ScalarizeRes_LOAD(LoadSDNode *N); - SDOperand ScalarizeRes_BinOp(SDNode *N); - SDOperand ScalarizeRes_UnaryOp(SDNode *N); - SDOperand ScalarizeRes_FPOWI(SDNode *N); - SDOperand ScalarizeRes_VECTOR_SHUFFLE(SDNode *N); - SDOperand ScalarizeRes_BIT_CONVERT(SDNode *N); - SDOperand ScalarizeRes_SELECT(SDNode *N); - - // Operand Promotion. - bool PromoteOperand(SDNode *N, unsigned OperandNo); - SDOperand PromoteOperand_ANY_EXTEND(SDNode *N); - SDOperand PromoteOperand_ZERO_EXTEND(SDNode *N); - SDOperand PromoteOperand_SIGN_EXTEND(SDNode *N); - SDOperand PromoteOperand_TRUNCATE(SDNode *N); - SDOperand PromoteOperand_FP_EXTEND(SDNode *N); - SDOperand PromoteOperand_FP_ROUND(SDNode *N); - SDOperand PromoteOperand_INT_TO_FP(SDNode *N); - SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo); - SDOperand PromoteOperand_BRCON
[llvm-commits] [llvm] r44720 - /llvm/trunk/lib/System/Unix/SUS/
Author: lattner Date: Sat Dec 8 16:17:33 2007 New Revision: 44720 URL: http://llvm.org/viewvc/llvm-project?rev=44720&view=rev Log: Remove dead file and directory. Removed: llvm/trunk/lib/System/Unix/SUS/ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
Hi, It seems that this problem is caused by a copy-paste bug in BasicAliasAnalysis.cpp. The first part of the diff is of a cosmetic nature. The second fixes the bug. -Wojtek Index: lib/Analysis/BasicAliasAnalysis.cpp === --- lib/Analysis/BasicAliasAnalysis.cpp (revision 44660) +++ lib/Analysis/BasicAliasAnalysis.cpp (working copy) @@ -730,8 +730,8 @@ if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *PT = dyn_cast(BasePtr1Ty)) { -if (Op1C->getZExtValue() >= PT->getNumElements()) + } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { +if (Op1C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } @@ -756,10 +756,10 @@ if (Op2) { if (const ConstantInt *Op2C = dyn_cast(Op2)) { // If this is an array index, make sure the array element is in range. - if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { + if (const ArrayType *AT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { + } else if (const VectorType *VT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } Index: test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll === --- test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll(revision 0) +++ test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll(revision 0) @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -gvn -disable-output +; PR1782 + +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" +target triple = "x86_64-unknown-linux-gnu" + %struct.device = type { [20 x i8] } + %struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 } + %struct.usb_bus = type { %struct.device* } + %struct.usb_hcd = type { %struct.usb_bus, [0 x i64] } [EMAIL PROTECTED] = external constant [1 x %struct.pci_device_id] ; <[1 x %struct.pci_device_id]*> [#uses=1] + [EMAIL PROTECTED] = alias [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0] + +define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) { +entry: + %tmp14 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1] + %tmp15 = load %struct.device** %tmp14, align 8 ; <%struct.device*> [#uses=0] + br i1 false, label %bb25, label %return + +bb25: ; preds = %entry + br i1 false, label %cond_true, label %return + +cond_true: ; preds = %bb25 + %tmp601 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951; [#uses=1] + %tmp67 = bitcast i64* %tmp601 to %struct.device** ; <%struct.device**> [#uses=1] + %tmp68 = load %struct.device** %tmp67, align 8 ; <%struct.device*> [#uses=0] + ret i32 undef + +return:; preds = %bb25, %entry + ret i32 undef +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44721 - /llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj
Author: sampo Date: Sat Dec 8 16:29:19 2007 New Revision: 44721 URL: http://llvm.org/viewvc/llvm-project?rev=44721&view=rev Log: Project cleanups Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj?rev=44721&r1=44720&r2=44721&view=diff == --- llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj (original) +++ llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Sat Dec 8 16:29:19 2007 @@ -631,7 +631,6 @@ DE66EE8408ABEE3500323D32 /* Program.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Program.inc; sourceTree = ""; }; DE66EE8508ABEE3500323D32 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = README.txt; sourceTree = ""; }; DE66EE8608ABEE3500323D32 /* Signals.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Signals.inc; sourceTree = ""; }; - DE66EE8808ABEE3500323D32 /* Process.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Process.cpp; sourceTree = ""; }; DE66EE8908ABEE3500323D32 /* TimeValue.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = TimeValue.inc; sourceTree = ""; }; DE66EE8A08ABEE3500323D32 /* Unix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Unix.h; sourceTree = ""; }; DE66EE8C08ABEE3500323D32 /* DynamicLibrary.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = DynamicLibrary.inc; sourceTree = ""; }; @@ -1088,10 +1087,18 @@ DE66F38C08ABF35300323D32 /* CREDITS.TXT */, CFD99AA80AFE827B0068D19C /* LICENSE.TXT */, CFD99AAD0AFE827B0068D19C /* README.txt */, + 721CA1750D0B44D200D5004F /* Products */, ); name = LLVM; sourceTree = ""; }; + 721CA1750D0B44D200D5004F /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; 9F68EB030C77AD2C004AA152 /* lib/Bitcode */ = { isa = PBXGroup; children = ( @@ -1683,21 +1690,12 @@ DE66EE8408ABEE3500323D32 /* Program.inc */, DE66EE8508ABEE3500323D32 /* README.txt */, DE66EE8608ABEE3500323D32 /* Signals.inc */, - DE66EE8708ABEE3500323D32 /* SUS */, DE66EE8908ABEE3500323D32 /* TimeValue.inc */, DE66EE8A08ABEE3500323D32 /* Unix.h */, ); path = Unix; sourceTree = ""; }; - DE66EE8708ABEE3500323D32 /* SUS */ = { - isa = PBXGroup; - children = ( - DE66EE8808ABEE3500323D32 /* Process.cpp */, - ); - path = SUS; - sourceTree = ""; - }; DE66EE8B08ABEE3500323D32 /* Win32 */ = { isa = PBXGroup; children = ( @@ -2735,7 +2733,7 @@ buildPhases = ( ); buildToolPath = /usr/bin/make; - buildWorkingDirectory = /llvm/llvm/utils/TableGen; + buildWorkingDirectory = "${SRCROOT}/../utils/TableGen"; dependencies = ( ); name = "LLVM TableGen"; @@ -2777,7 +2775,7 @@ buildPhases = ( ); buildToolPath = /usr/bin/make; - buildWorkingDirectory = /Volumes/Big2/llvm/llvm; + buildWorkingDirectory = "$(SRCROOT)/../"; dependencies = ( ); name = LLVM; @@ -2793,6 +2791,7 @@ compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* LLVM */; + productRefGroup = 721CA1750D0B44D200D5004F /* Products */; projectDirPath = ""; projectRoot = ""; targ
[llvm-commits] [llvm] r44722 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypes.h LegalizeTypesSplit.cpp
Author: lattner Date: Sat Dec 8 16:37:41 2007 New Revision: 44722 URL: http://llvm.org/viewvc/llvm-project?rev=44722&view=rev Log: add scaffolding for splitting of vectors. Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=44722&r1=44721&r2=44722&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sat Dec 8 16:37:41 2007 @@ -68,8 +68,8 @@ ExpandResult(N, i); else if (MVT::getVectorNumElements(ResultVT) == 1) ScalarizeResult(N, i); // Scalarize the single-element vector. -else // Split the vector in half. - assert(0 && "Vector splitting not implemented"); +else + SplitResult(N, i); // Split the vector in half. goto NodeDone; } else { assert(Action == Legal && "Unknown action!"); @@ -96,8 +96,7 @@ // Scalarize the single-element vector. NeedsRevisit = ScalarizeOperand(N, i); } else { - // Split the vector in half. - assert(0 && "Vector splitting not implemented"); + NeedsRevisit = SplitOperand(N, i); // Split the vector in half. } break; } else { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44722&r1=44721&r2=44722&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 16:37:41 2007 @@ -260,6 +260,19 @@ bool ScalarizeOperand(SDNode *N, unsigned OpNo); SDOperand ScalarizeOp_EXTRACT_VECTOR_ELT(SDNode *N, unsigned OpNo); + //======// + // Vector Splitting Support: LegalizeTypesSplit.cpp + //======// + + void GetSplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + void SetSplitOp(SDOperand Op, SDOperand Lo, SDOperand Hi); + + // Result Vector Splitting: <128 x ty> -> 2 x <64 x ty>. + void SplitResult(SDNode *N, unsigned OpNo); + + // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. + bool SplitOperand(SDNode *N, unsigned OpNo); + }; } // end namespace llvm. Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp?rev=44722&view=auto == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp (added) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Sat Dec 8 16:37:41 2007 @@ -0,0 +1,122 @@ +//===-- LegalizeTypesSplit.cpp - Vector Splitting for LegalizeTypes ---===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Chris Lattner and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--===// +// +// This file implements vector splitting support for LegalizeTypes. Vector +// splitting is the act of changing a computation in an invalid vector type to +// be a computation in multiple vectors of a smaller type. For example, +// implementing <128 x f32> operations in terms of two <64 x f32> operations. +// +//===--===// + +#include "LegalizeTypes.h" +using namespace llvm; + +//===--===// +// Result Vector Splitting +//===--===// + +/// SplitResult - This method is called when the specified result of the +/// specified node is found to need vector splitting. At this point, the node +/// may also have invalid operands or may have other results that need +/// legalization, we just know that (at least) one result needs vector +/// splitting. +void DAGTypeLegalizer::SplitResult(SDNode *N, unsigned ResNo) { + DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n"); + SDOperand Lo, Hi; + Lo = Hi = SDOperand(); + +#if 0 + // See if the target wants to custom expand this node. + if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == + TargetLowering::Custom) { +// If the target wants to, al
[llvm-commits] [llvm] r44723 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypes.h
Author: lattner Date: Sat Dec 8 16:40:18 2007 New Revision: 44723 URL: http://llvm.org/viewvc/llvm-project?rev=44723&view=rev Log: implement some methods. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=44723&r1=44722&r2=44723&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sat Dec 8 16:40:18 2007 @@ -320,8 +320,7 @@ Hi = Entry.second; } -void DAGTypeLegalizer::SetExpandedOp(SDOperand Op, SDOperand Lo, - SDOperand Hi) { +void DAGTypeLegalizer::SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi) { // Remember that this is the result of the node. std::pair &Entry = ExpandedNodes[Op]; assert(Entry.first.Val == 0 && "Node already expanded"); @@ -335,6 +334,30 @@ MarkNewNodes(Hi.Val); } +void DAGTypeLegalizer::GetSplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi) { + std::pair &Entry = SplitNodes[Op]; + RemapNode(Entry.first); + RemapNode(Entry.second); + assert(Entry.first.Val && "Operand isn't split"); + Lo = Entry.first; + Hi = Entry.second; +} + +void DAGTypeLegalizer::SetSplitOp(SDOperand Op, SDOperand Lo, SDOperand Hi) { + // Remember that this is the result of the node. + std::pair &Entry = SplitNodes[Op]; + assert(Entry.first.Val == 0 && "Node already split"); + Entry.first = Lo; + Entry.second = Hi; + + // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. + if (Lo.Val->getNodeId() == NewNode) +MarkNewNodes(Lo.Val); + if (Hi.Val->getNodeId() == NewNode) +MarkNewNodes(Hi.Val); +} + + SDOperand DAGTypeLegalizer::CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT) { // Create the stack frame object. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44723&r1=44722&r2=44723&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 16:40:18 2007 @@ -97,6 +97,10 @@ /// ScalarizedNodes - For nodes that are <1 x ty>, this map indicates the /// scalar value of type 'ty' to use. DenseMap ScalarizedNodes; + + /// SplitNodes - For nodes that need to be split this map indicates + /// which operands are the expanded version of the input. + DenseMap > SplitNodes; /// ReplacedNodes - For nodes that have been replaced with another, /// indicates the replacement node to use. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44724 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.h LegalizeTypesSplit.cpp
Author: lattner Date: Sat Dec 8 17:08:49 2007 New Revision: 44724 URL: http://llvm.org/viewvc/llvm-project?rev=44724&view=rev Log: implement vector splitting of load, undef, and binops. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44724&r1=44723&r2=44724&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 17:08:49 2007 @@ -273,6 +273,10 @@ // Result Vector Splitting: <128 x ty> -> 2 x <64 x ty>. void SplitResult(SDNode *N, unsigned OpNo); + + void SplitRes_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_BinOp(SDNode *N, SDOperand &Lo, SDOperand &Hi); // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp?rev=44724&r1=44723&r2=44724&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Sat Dec 8 17:08:49 2007 @@ -17,6 +17,24 @@ #include "LegalizeTypes.h" using namespace llvm; +/// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a vector +/// type that needs to be split. This handles non-power of two vectors. +static void GetSplitDestVTs(MVT::ValueType InVT, +MVT::ValueType &Lo, MVT::ValueType &Hi) { + MVT::ValueType NewEltVT = MVT::getVectorElementType(InVT); + unsigned NumElements = MVT::getVectorNumElements(InVT); + if ((NumElements & (NumElements-1)) == 0) { // Simple power of two vector. +NumElements >>= 1; +Lo = Hi = MVT::getVectorType(NewEltVT, NumElements); + } else { // Non-power-of-two vectors. +unsigned NewNumElts_Lo = 1 << Log2_32(NumElements-1); +unsigned NewNumElts_Hi = NumElements - NewNumElts_Lo; +Lo = MVT::getVectorType(NewEltVT, NewNumElts_Lo); +Hi = MVT::getVectorType(NewEltVT, NewNumElts_Hi); + } +} + + //===--===// // Result Vector Splitting //===--===// @@ -29,7 +47,6 @@ void DAGTypeLegalizer::SplitResult(SDNode *N, unsigned ResNo) { DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Lo, Hi; - Lo = Hi = SDOperand(); #if 0 // See if the target wants to custom expand this node. @@ -54,9 +71,24 @@ assert(0 && "Do not know how to split the result of this operator!"); abort(); -#if 0 - case ISD::UNDEF: SplitResult_UNDEF(N, Lo, Hi); break; -#endif + case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break; + case ISD::LOAD:SplitRes_LOAD(cast(N), Lo, Hi); break; + case ISD::ADD: + case ISD::SUB: + case ISD::MUL: + case ISD::FADD: + case ISD::FSUB: + case ISD::FMUL: + case ISD::SDIV: + case ISD::UDIV: + case ISD::FDIV: + case ISD::FPOW: + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::UREM: + case ISD::SREM: + case ISD::FREM:SplitRes_BinOp(N, Lo, Hi); break; } // If Lo/Hi is null, the sub-method took care of registering results etc. @@ -64,6 +96,54 @@ SetSplitOp(SDOperand(N, ResNo), Lo, Hi); } +void DAGTypeLegalizer::SplitRes_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType LoVT, HiVT; + GetSplitDestVTs(N->getValueType(0), LoVT, HiVT); + + Lo = DAG.getNode(ISD::UNDEF, LoVT); + Hi = DAG.getNode(ISD::UNDEF, HiVT); +} + +void DAGTypeLegalizer::SplitRes_LOAD(LoadSDNode *LD, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType LoVT, HiVT; + GetSplitDestVTs(LD->getValueType(0), LoVT, HiVT); + + SDOperand Ch = LD->getChain(); + SDOperand Ptr = LD->getBasePtr(); + const Value *SV = LD->getSrcValue(); + int SVOffset = LD->getSrcValueOffset(); + unsigned Alignment = LD->getAlignment(); + bool isVolatile = LD->isVolatile(); + + Lo = DAG.getLoad(LoVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); + unsigned IncrementSize = MVT::getSizeInBits(LoVT)/8; + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, +getIntPtrConstant(IncrementSize)); + SVOffset += IncrementSize; + Alignment = MinAlign(Alignment, IncrementSize); + Hi = DAG.getLoad(HiVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); + + // Build a factor node to reme
[llvm-commits] [llvm] r44725 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.h LegalizeTypesSplit.cpp
Author: lattner Date: Sat Dec 8 17:24:26 2007 New Revision: 44725 URL: http://llvm.org/viewvc/llvm-project?rev=44725&view=rev Log: Implement splitting support for store, allowing us to compile: %f8 = type <8 x float> define void @test_f8(%f8* %P, %f8* %Q, %f8* %S) { %p = load %f8* %P ; <%f8> [#uses=1] %q = load %f8* %Q ; <%f8> [#uses=1] %R = add %f8 %p, %q ; <%f8> [#uses=1] store %f8 %R, %f8* %S ret void } into: _test_f8: movaps 16(%rdi), %xmm0 addps 16(%rsi), %xmm0 movaps (%rdi), %xmm1 addps (%rsi), %xmm1 movaps %xmm0, 16(%rdx) movaps %xmm1, (%rdx) ret Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44725&r1=44724&r2=44725&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 17:24:26 2007 @@ -281,6 +281,7 @@ // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); + SDOperand SplitOperand_STORE(StoreSDNode *N, unsigned OpNo); }; } // end namespace llvm. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp?rev=44725&r1=44724&r2=44725&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Sat Dec 8 17:24:26 2007 @@ -172,11 +172,9 @@ #endif assert(0 && "Do not know how to split this operator's operand!"); abort(); -#if 0 case ISD::STORE: - Res = ExpandOperand_STORE(cast(N), OpNo); + Res = SplitOperand_STORE(cast(N), OpNo); break; -#endif } } @@ -200,3 +198,28 @@ ReplaceValueWith(SDOperand(N, 0), Res); return false; } + +SDOperand DAGTypeLegalizer::SplitOperand_STORE(StoreSDNode *N, unsigned OpNo) { + assert(OpNo == 1 && "Can only split the stored value"); + + SDOperand Ch = N->getChain(); + SDOperand Ptr = N->getBasePtr(); + int SVOffset = N->getSrcValueOffset(); + unsigned Alignment = N->getAlignment(); + bool isVol = N->isVolatile(); + SDOperand Lo, Hi; + GetSplitOp(N->getOperand(1), Lo, Hi); + + unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; + + Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, isVol, Alignment); + + // Increment the pointer to the other half. + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, +getIntPtrConstant(IncrementSize)); + + Hi = DAG.getStore(Ch, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, +isVol, MinAlign(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); +} + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44726 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.h LegalizeTypesSplit.cpp
Author: lattner Date: Sat Dec 8 17:58:27 2007 New Revision: 44726 URL: http://llvm.org/viewvc/llvm-project?rev=44726&view=rev Log: add many new cases to SplitResult. SplitResult now handles all the cases that LegalizeDAG does. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44726&r1=44725&r2=44726&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 17:58:27 2007 @@ -276,7 +276,17 @@ void SplitRes_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitRes_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_BUILD_PAIR(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_INSERT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_VECTOR_SHUFFLE(SDNode *N, SDOperand &Lo, SDOperand &Hi); + + void SplitRes_BUILD_VECTOR(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_CONCAT_VECTORS(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_UnOp(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitRes_BinOp(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void SplitRes_SELECT(SDNode *N, SDOperand &Lo, SDOperand &Hi); // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp?rev=44726&r1=44725&r2=44726&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Sat Dec 8 17:58:27 2007 @@ -71,8 +71,26 @@ assert(0 && "Do not know how to split the result of this operator!"); abort(); - case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break; - case ISD::LOAD:SplitRes_LOAD(cast(N), Lo, Hi); break; + case ISD::UNDEF:SplitRes_UNDEF(N, Lo, Hi); break; + case ISD::LOAD: SplitRes_LOAD(cast(N), Lo, Hi); break; + case ISD::BUILD_PAIR: SplitRes_BUILD_PAIR(N, Lo, Hi); break; + case ISD::INSERT_VECTOR_ELT:SplitRes_INSERT_VECTOR_ELT(N, Lo, Hi); break; + case ISD::VECTOR_SHUFFLE: SplitRes_VECTOR_SHUFFLE(N, Lo, Hi); break; + case ISD::BUILD_VECTOR: SplitRes_BUILD_VECTOR(N, Lo, Hi); break; + case ISD::CONCAT_VECTORS: SplitRes_CONCAT_VECTORS(N, Lo, Hi); break; + case ISD::BIT_CONVERT: SplitRes_BIT_CONVERT(N, Lo, Hi); break; + case ISD::CTTZ: + case ISD::CTLZ: + case ISD::CTPOP: + case ISD::FNEG: + case ISD::FABS: + case ISD::FSQRT: + case ISD::FSIN: + case ISD::FCOS: + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: SplitRes_UnOp(N, Lo, Hi); break; case ISD::ADD: case ISD::SUB: case ISD::MUL: @@ -88,7 +106,9 @@ case ISD::XOR: case ISD::UREM: case ISD::SREM: - case ISD::FREM:SplitRes_BinOp(N, Lo, Hi); break; + case ISD::FREM: SplitRes_BinOp(N, Lo, Hi); break; + case ISD::FPOWI:SplitRes_FPOWI(N, Lo, Hi); break; + case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break; } // If Lo/Hi is null, the sub-method took care of registering results etc. @@ -134,6 +154,124 @@ ReplaceValueWith(SDOperand(LD, 1), TF); } +void DAGTypeLegalizer::SplitRes_BUILD_PAIR(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + Lo = N->getOperand(0); + Hi = N->getOperand(1); +} + +void DAGTypeLegalizer::SplitRes_INSERT_VECTOR_ELT(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + GetSplitOp(N->getOperand(0), Lo, Hi); + unsigned Index = cast(N->getOperand(2))->getValue(); + SDOperand ScalarOp = N->getOperand(1); + unsigned LoNumElts = MVT::getVectorNumElements(Lo.getValueType()); + if (Index < LoNumElts) +Lo = DAG.getNode(ISD::INSERT_VECTOR_ELT, Lo.getValueType(), Lo, ScalarOp, + N->getOperand(2)); + else +Hi = DAG.getNode(ISD::INSERT_VECTOR_ELT, Hi.getValueType(), Hi, ScalarOp, + DAG.getConstant(Index - LoNumElts, TLI.getPointerTy())); + +} + +void DAGTypeLegalizer::SplitRes_VECTOR_SHUFFLE(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + // Build the low part. + SDOperand Mask = N->getOperand(2); + SmallVector Ops; + MVT::ValueType PtrVT = TLI.getPointerTy(); + + MVT
[llvm-commits] [llvm] r44727 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineLICM.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86
Author: void Date: Sat Dec 8 17:58:46 2007 New Revision: 44727 URL: http://llvm.org/viewvc/llvm-project?rev=44727&view=rev Log: Reverting 44702. It wasn't correct to rename them. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineLICM.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/tools/Makefile llvm/trunk/utils/emacs/tablegen-mode.el Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=44727&r1=44726&r2=44727&view=diff == --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Sat Dec 8 17:58:46 2007 @@ -288,24 +288,24 @@ return get(Opcode).Flags & M_HAS_OPTIONAL_DEF; } - /// hasNoSideEffects - Return true if the instruction is trivially + /// isTriviallyReMaterializable - Return true if the instruction is trivially /// rematerializable, meaning it has no side effects and requires no operands /// that aren't always available. - bool hasNoSideEffects(MachineInstr *MI) const { + bool isTriviallyReMaterializable(MachineInstr *MI) const { return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) && - isTriviallyReMaterializable(MI); + isReallyTriviallyReMaterializable(MI); } protected: - /// isTriviallyReMaterializable - For instructions with opcodes for which the - /// M_REMATERIALIZABLE flag is set, this function tests whether the - /// instruction itself is actually trivially rematerializable, considering its - /// operands. This is used for targets that have instructions that are only - /// trivially rematerializable for specific uses. This predicate must return - /// false if the instruction has any side effects other than producing a - /// value, or if it requres any address registers that are not always - /// available. - virtual bool isTriviallyReMaterializable(MachineInstr *MI) const { + /// isReallyTriviallyReMaterializable - For instructions with opcodes for + /// which the M_REMATERIALIZABLE flag is set, this function tests whether the + /// instruction itself is actually trivially rematerializable, considering + /// its operands. This is used for targets that have instructions that are + /// only trivially rematerializable for specific uses. This predicate must + /// return false if the instruction has any side effects other than + /// producing a value, or if it requres any address registers that are not + /// always available. + virtual bool isReallyTriviallyReMaterializable(MachineInstr *MI) const { return true; } Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=44727&r1=44726&r2=44727&view=diff == --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Dec 8 17:58:46 2007 @@ -613,7 +613,7 @@ return false; isLoad = false; - if (tii_->hasNoSideEffects(MI)) { + if (tii_->isTriviallyReMaterializable(MI)) { isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; return true; } Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44727&r1=44726&r2=44727&view=diff == --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Sat Dec 8 17:58:46 2007 @@ -39,7 +39,7 @@ cl::desc("Perform loop-invariant code motion on machine code")); } -STATISTIC(NumHoisted, "Number of machine instructions hoisted out of loop"); +STATISTIC(NumHoisted, "Number of machine instructions hoisted out of loops"); namespace { class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass { @@ -93,11 +93,11 @@ /// void MapVirtualRegisterDefs(const MachineFunction &MF); -/// isInSubLoop - A little predicate that returns true if the specified +/// IsInSubLoop - A little predicate that returns true if the specified /// basic block is in a subloop of the current one, not the current one /// itself. /// -bool isInSubLoop(MachineBasicBlock *BB) { +bool IsInSubLoop(MachineBasicBlock *BB) { assert(CurLoop->contains(BB) && "Only valid if BB is IN the loop"); for (MachineLoop::iterator @@ -120,7 +120,7 @@ if (TID->ImplicitUses || !I.getNumOperands()) return false; MachineOpCode Opcode = TID->Opcode; - return TII->hasNoSideEffects(&I) && + return TII->isTriviallyReMaterializable(&I)
[llvm-commits] [llvm] r44728 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.h LegalizeTypesExpand.cpp LegalizeTypesSplit.cpp
Author: lattner Date: Sat Dec 8 18:06:19 2007 New Revision: 44728 URL: http://llvm.org/viewvc/llvm-project?rev=44728&view=rev Log: Add support for splitting the operand of a return instruction. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=44728&r1=44727&r2=44728&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat Dec 8 18:06:19 2007 @@ -291,7 +291,8 @@ // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); - SDOperand SplitOperand_STORE(StoreSDNode *N, unsigned OpNo); + SDOperand SplitOp_STORE(StoreSDNode *N, unsigned OpNo); + SDOperand SplitOp_RET(SDNode *N, unsigned OpNo); }; } // end namespace llvm. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp?rev=44728&r1=44727&r2=44728&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp Sat Dec 8 18:06:19 2007 @@ -1043,59 +1043,15 @@ if (!N->isTruncatingStore()) { unsigned IncrementSize = 0; +GetExpandedOp(N->getValue(), Lo, Hi); +IncrementSize = MVT::getSizeInBits(Hi.getValueType())/8; -// If this is a vector type, then we have to calculate the increment as -// the product of the element size in bytes, and the number of elements -// in the high half of the vector. -if (MVT::isVector(N->getValue().getValueType())) { - assert(0 && "Vectors not supported yet"); - #if 0 - SDNode *InVal = ST->getValue().Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); - - // Figure out if there is a simple type corresponding to this Vector - // type. If so, convert to the vector type. - MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems); - if (TLI.isTypeLegal(TVT)) { -// Turn this into a normal store of the vector type. -Tmp3 = LegalizeOp(Node->getOperand(1)); -Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); -Result = LegalizeOp(Result); -break; - } else if (NumElems == 1) { -// Turn this into a normal store of the scalar type. -Tmp3 = ScalarizeVectorOp(Node->getOperand(1)); -Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); -// The scalarized value type may not be legal, e.g. it might require -// promotion or expansion. Relegalize the scalar store. -return LegalizeOp(Result); - } else { -SplitVectorOp(Node->getOperand(1), Lo, Hi); -IncrementSize = NumElems/2 * MVT::getSizeInBits(EVT)/8; - } - #endif -} else { - GetExpandedOp(N->getValue(), Lo, Hi); - IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; - - if (!TLI.isLittleEndian()) -std::swap(Lo, Hi); -} +if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, isVolatile, Alignment); -assert(Hi.Val && "FIXME: int <-> float should be handled with promote!"); - #if 0 -if (Hi.Val == NULL) { - // Must be int <-> float one-to-one expansion. - return Lo; -} - #endif - Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, getIntPtrConstant(IncrementSize)); assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!"); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp?rev=44728&r1=44727&r2=44728&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp Sat Dec 8 18:06:19 2007 @@ -337,9 +337,8 @@ #endif assert(0 && "Do not know how to split this operator's operand!"); abort(); -case ISD::STORE: - Res = SplitOperand_STORE(cast(N), OpNo); - break; +case ISD::STORE: Res = SplitOp_STORE(cast(N), OpNo); break; +case ISD::RET: Res = SplitOp_RE
Re: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
On Dec 8, 2007, at 2:35 PM, Wojciech Matyjewicz wrote: > Hi, > > It seems that this problem is caused by a copy-paste bug in > BasicAliasAnalysis.cpp. The first part of the diff is of a cosmetic > nature. The second fixes the bug. This patch looks excellent, thanks! Unfortunately though, the patch does not apply. Can you please attach it instead of including it inline in the email? Thanks, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r44705 - in /llvm/trunk: include/llvm/Support/StringPool.h lib/Support/StringPool.cpp
On Dec 8, 2007, at 9:07 AM, Gordon Henriksen wrote: > Author: gordon > Date: Sat Dec 8 11:07:47 2007 > New Revision: 44705 > > URL: http://llvm.org/viewvc/llvm-project?rev=44705&view=rev > Log: > Adding a StringPool data structure, which GC will use. Looks great Gordon, one other nit-pick: > +#include Please #include LLVM headers with ""'s when in the llvm source base, thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-www/ProjectsWithLLVM/index.html
Changes in directory llvm-www/ProjectsWithLLVM: index.html updated: 1.39 -> 1.40 --- Log message: add puzzle solving project. --- Diffs of the changes: (+36 -0) index.html | 36 1 files changed, 36 insertions(+) Index: llvm-www/ProjectsWithLLVM/index.html diff -u llvm-www/ProjectsWithLLVM/index.html:1.39 llvm-www/ProjectsWithLLVM/index.html:1.40 --- llvm-www/ProjectsWithLLVM/index.html:1.39 Tue Jul 31 19:03:33 2007 +++ llvm-www/ProjectsWithLLVM/index.htmlSat Dec 8 18:26:42 2007 @@ -35,6 +35,7 @@ +Register Allocation by Puzzle Solving Faust Real-Time Signal Processing System Adobe "Hydra" Language Calysto Static Checker @@ -59,6 +60,41 @@ + +Register Allocation by Puzzle Solving + + + +By Fernando Pereira and Jens Palsberg, UCLA. + + + + +In this project, we have shown that register allocation can be viewed +as solving a collection of puzzles. +We model the register file as a puzzle board and +the program variables as puzzle pieces; +pre-coloring and register aliasing fit in naturally. +For architectures such as x86, SPARC V8, and StrongARM, +we can solve the puzzles in polynomial time, and we have augmented +the puzzle solver with a simple heuristic for spilling. +For SPEC CPU2000, our implementation is as fast as +the extended version of linear scan used by LLVM. +Our implementation produces Pentium code that is of similar quality to the +code produced by the slower, state-of-the-art iterated register coalescing +algorithm of George and Appel augmented with extensions by Smith, Ramsey, and +Holloway. + + + +http://compilers.cs.ucla.edu/fernando/projects/puzzles/";>Project + page with a link to a tool that verifies the output of LLVM's register + allocator. + + + + + Faust Real-Time Signal Processing System ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44729 - /llvm/trunk/tools/Makefile
Author: lattner Date: Sat Dec 8 18:27:38 2007 New Revision: 44729 URL: http://llvm.org/viewvc/llvm-project?rev=44729&view=rev Log: Fix accidental commit by Bill. Modified: llvm/trunk/tools/Makefile Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=44729&r1=44728&r2=44729&view=diff == --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Sat Dec 8 18:27:38 2007 @@ -16,7 +16,7 @@ llc llvm-ranlib llvm-ar llvm-nm \ llvm-ld llvmc llvm-prof llvm-link \ lli gccas gccld llvm-extract llvm-db llvm2cpp \ -bugpoint llvm-bcanalyzer llvm-stub cfe +bugpoint llvm-bcanalyzer llvm-stub include $(LEVEL)/Makefile.config ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
Chris Lattner wrote: > > Unfortunately though, the patch > does not apply. Can you please attach it instead of including it > inline in the email? Chris, could you check my previous post one more time, please. The patch should be attached to it. At least, I have received this post with an attachment from listserv. I have just tried to apply the patch (patch -p0 < PR1782.diff from llvm source root dir) and it worked. -Wojtek ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44732 - /llvm/trunk/include/llvm/Support/StringPool.h
Author: gordon Date: Sat Dec 8 19:12:08 2007 New Revision: 44732 URL: http://llvm.org/viewvc/llvm-project?rev=44732&view=rev Log: Fix a very silly typo. Modified: llvm/trunk/include/llvm/Support/StringPool.h Modified: llvm/trunk/include/llvm/Support/StringPool.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StringPool.h?rev=44732&r1=44731&r2=44732&view=diff == --- llvm/trunk/include/llvm/Support/StringPool.h (original) +++ llvm/trunk/include/llvm/Support/StringPool.h Sat Dec 8 19:12:08 2007 @@ -29,7 +29,7 @@ #ifndef LLVM_SUPPORT_STRINGPOOL_H #define LLVM_SUPPORT_STRINGPOOL_H -#include +#include "llvm/ADT/StringMap.h" #include #include ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
On 2007-12-08, at 19:58, Wojciech Matyjewicz wrote: Chris Lattner wrote: Unfortunately though, the patch does not apply. Can you please attach it instead of including it inline in the email? Chris, could you check my previous post one more time, please. The patch should be attached to it. At least, I have received this post with an attachment from listserv. I have just tried to apply the patch (patch -p0 < PR1782.diff from llvm source root dir) and it worked. Thunderbird sent the attachment with the MIME header Content- Disposition: inline, which Apple Mail always expands and displays inline (i.e., not as an attachment). The original attachment is in the listserv archives. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056082.html Wojtek, you might try (a.) using ".patch" in the hopes of eliciting Content-Type: application/octet-stream which will always appear as an attachment, (b.) compressing the attachment, or (c.) looking for a setting in Thunderbird to use Content-Disposition: attachment for attachments. — Gordon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r44705 - in /llvm/trunk: include/llvm/Support/StringPool.h lib/Support/StringPool.cpp
On 2007-12-08, at 19:24, Chris Lattner wrote: > On Dec 8, 2007, at 9:07 AM, Gordon Henriksen wrote: > >> +#include > > Please #include LLVM headers with ""'s when in the llvm source base, > thanks! Indubitably. Fixed. — Gordon ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
Gordon Henriksen wrote: > Wojtek, you might try /(a.)/ using ".patch" in the hopes of eliciting > Content-Type: application/octet-stream which will always appear as an > attachment, /(b.)/ compressing the attachment, or /(c.)/ looking for a > setting in Thunderbird to use Content-Disposition: attachment for > attachments. Thanks, Gordon! I've applied the (c.) approach. Hope, everyone can see the attachment now. -Wojtek Index: lib/Analysis/BasicAliasAnalysis.cpp === --- lib/Analysis/BasicAliasAnalysis.cpp (revision 44660) +++ lib/Analysis/BasicAliasAnalysis.cpp (working copy) @@ -730,8 +730,8 @@ if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *PT = dyn_cast(BasePtr1Ty)) { -if (Op1C->getZExtValue() >= PT->getNumElements()) + } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { +if (Op1C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } @@ -756,10 +756,10 @@ if (Op2) { if (const ConstantInt *Op2C = dyn_cast(Op2)) { // If this is an array index, make sure the array element is in range. - if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { + if (const ArrayType *AT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { + } else if (const VectorType *VT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } Index: test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll === --- test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll(revision 0) +++ test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll(revision 0) @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -gvn -disable-output +; PR1782 + +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" +target triple = "x86_64-unknown-linux-gnu" + %struct.device = type { [20 x i8] } + %struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 } + %struct.usb_bus = type { %struct.device* } + %struct.usb_hcd = type { %struct.usb_bus, [0 x i64] } [EMAIL PROTECTED] = external constant [1 x %struct.pci_device_id] ; <[1 x %struct.pci_device_id]*> [#uses=1] + [EMAIL PROTECTED] = alias [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0] + +define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) { +entry: + %tmp14 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1] + %tmp15 = load %struct.device** %tmp14, align 8 ; <%struct.device*> [#uses=0] + br i1 false, label %bb25, label %return + +bb25: ; preds = %entry + br i1 false, label %cond_true, label %return + +cond_true: ; preds = %bb25 + %tmp601 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951; [#uses=1] + %tmp67 = bitcast i64* %tmp601 to %struct.device** ; <%struct.device**> [#uses=1] + %tmp68 = load %struct.device** %tmp67, align 8 ; <%struct.device*> [#uses=0] + ret i32 undef + +return:; preds = %bb25, %entry + ret i32 undef +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r44733 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll
Author: lattner Date: Sun Dec 9 01:35:13 2007 New Revision: 44733 URL: http://llvm.org/viewvc/llvm-project?rev=44733&view=rev Log: Fix PR1782, patch by Wojtek Matyjewicz! Added: llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=44733&r1=44732&r2=44733&view=diff == --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Dec 9 01:35:13 2007 @@ -730,8 +730,8 @@ if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *PT = dyn_cast(BasePtr1Ty)) { -if (Op1C->getZExtValue() >= PT->getNumElements()) + } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { +if (Op1C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } @@ -756,10 +756,10 @@ if (Op2) { if (const ConstantInt *Op2C = dyn_cast(Op2)) { // If this is an array index, make sure the array element is in range. - if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) { + if (const ArrayType *AT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - } else if (const VectorType *VT = dyn_cast(BasePtr1Ty)) { + } else if (const VectorType *VT = dyn_cast(BasePtr2Ty)) { if (Op2C->getZExtValue() >= VT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } Added: llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll?rev=44733&view=auto == --- llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll (added) +++ llvm/trunk/test/Analysis/BasicAA/2007-12-08-OutOfBoundsCrash.ll Sun Dec 9 01:35:13 2007 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -gvn -disable-output +; PR1782 + +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" +target triple = "x86_64-unknown-linux-gnu" + %struct.device = type { [20 x i8] } + %struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i64 } + %struct.usb_bus = type { %struct.device* } + %struct.usb_hcd = type { %struct.usb_bus, [0 x i64] } [EMAIL PROTECTED] = external constant [1 x %struct.pci_device_id] ; <[1 x %struct.pci_device_id]*> [#uses=1] + [EMAIL PROTECTED] = alias [1 x %struct.pci_device_id]* @pci_ids ; <[1 x %struct.pci_device_id]*> [#uses=0] + +define i32 @ehci_pci_setup(%struct.usb_hcd* %hcd) { +entry: + %tmp14 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 0, i32 0 ; <%struct.device**> [#uses=1] + %tmp15 = load %struct.device** %tmp14, align 8 ; <%struct.device*> [#uses=0] + br i1 false, label %bb25, label %return + +bb25: ; preds = %entry + br i1 false, label %cond_true, label %return + +cond_true: ; preds = %bb25 + %tmp601 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 1, i64 2305843009213693951; [#uses=1] + %tmp67 = bitcast i64* %tmp601 to %struct.device** ; <%struct.device**> [#uses=1] + %tmp68 = load %struct.device** %tmp67, align 8 ; <%struct.device*> [#uses=0] + ret i32 undef + +return:; preds = %bb25, %entry + ret i32 undef +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
On Dec 8, 2007, at 5:52 PM, Wojciech Matyjewicz wrote: > Gordon Henriksen wrote: > >> Wojtek, you might try /(a.)/ using ".patch" in the hopes of eliciting >> Content-Type: application/octet-stream which will always appear as an >> attachment, /(b.)/ compressing the attachment, or /(c.)/ looking >> for a >> setting in Thunderbird to use Content-Disposition: attachment for >> attachments. > > Thanks, Gordon! I've applied the (c.) approach. Hope, everyone can see > the attachment now. Yep, it looks Gordon was right :). Thanks again Wojtek, I applied the patch. Please close the PR, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits