[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.40 -> 1.41 MachineDebugInfo.cpp updated: 1.22 -> 1.23 --- Log message: Adding basic structure support. --- Diffs of the changes: (+46 -4) DwarfWriter.cpp | 43 --- MachineDebugInfo.cpp |7 ++- 2 files changed, 46 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.40 llvm/lib/CodeGen/DwarfWriter.cpp:1.41 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.40 Wed Mar 1 17:52:37 2006 +++ llvm/lib/CodeGen/DwarfWriter.cppFri Mar 3 09:06:57 2006 @@ -41,6 +41,8 @@ class DIE; //===--===// +// CompileUnit - This dwarf writer support class manages information associate +// with a source file. class CompileUnit { private: CompileUnitDesc *Desc;// Compile unit debug descriptor. @@ -505,6 +507,13 @@ case DW_FORM_data8: DW.EmitInt64(Integer);break; case DW_FORM_udata: DW.EmitULEB128Bytes(Integer); break; case DW_FORM_sdata: DW.EmitSLEB128Bytes(Integer); break; + // FIXME - Punting on field offsets. + case DW_FORM_block1: { +DW.EmitInt8(1 + DW.SizeULEB128(Integer)); DW.EOL("Form1 Size"); +DW.EmitInt8(DW_OP_plus_uconst); DW.EOL("DW_OP_plus_uconst"); +DW.EmitULEB128Bytes(Integer); +break; + } default: assert(0 && "DIE Value form not supported yet"); break; } } @@ -520,6 +529,8 @@ case DW_FORM_data8: return sizeof(int64_t); case DW_FORM_udata: return DW.SizeULEB128(Integer); case DW_FORM_sdata: return DW.SizeSLEB128(Integer); + // FIXME - Punting on field offsets. + case DW_FORM_block1: return 2 + DW.SizeULEB128(Integer); default: assert(0 && "DIE Value form not supported yet"); break; } return 0; @@ -1117,10 +1128,36 @@ break; } -case DW_TAG_structure_type: { - break; -} +case DW_TAG_structure_type: case DW_TAG_union_type: { + // FIXME - this is just the basics. + // Add elements to structure type. + for(unsigned i = 0, N = Elements.size(); i < N; ++i) { +DerivedTypeDesc *MemberDesc = cast(Elements[i]); +const std::string &Name = MemberDesc->getName(); +unsigned Line = MemberDesc->getLine(); +TypeDesc *MemTy = MemberDesc->getFromType(); +uint64_t Size = MemberDesc->getSize(); +uint64_t Offset = MemberDesc->getOffset(); + +DIE *Member = new DIE(DW_TAG_member); +if (!Name.empty()) Member->AddString(DW_AT_name, DW_FORM_string, Name); +if (CompileUnitDesc *File = MemberDesc->getFile()) { + CompileUnit *FileUnit = FindCompileUnit(File); + unsigned FileID = FileUnit->getID(); + int Line = TyDesc->getLine(); + Member->AddUInt(DW_AT_decl_file, 0, FileID); + Member->AddUInt(DW_AT_decl_line, 0, Line); +} +if (TypeDesc *FromTy = MemberDesc->getFromType()) { + Member->AddDIEntry(DW_AT_type, DW_FORM_ref4, + NewType(Context, FromTy)); +} +// FIXME - Punt on the Address. +Member->AddUInt(DW_AT_data_member_location, DW_FORM_block1, +Offset >> 3); +Ty->AddChild(Member); + } break; } case DW_TAG_enumeration_type: { Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.22 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.23 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.22 Wed Mar 1 17:52:37 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Fri Mar 3 09:06:57 2006 @@ -516,6 +516,7 @@ case DW_TAG_union_type: case DW_TAG_enumeration_type: return new CompositeTypeDesc(Tag); case DW_TAG_subrange_type:return new SubrangeDesc(); + case DW_TAG_member: return new DerivedTypeDesc(DW_TAG_member); case DW_TAG_enumerator: return new EnumeratorDesc(); default: break; } @@ -673,6 +674,7 @@ , Name("") , File(NULL) , Size(0) +, Offset(0) {} /// ApplyToFields - Target the visitor to the fields of the TypeDesc. @@ -685,6 +687,7 @@ Visitor->Apply((DebugInfoDesc *&)File); Visitor->Apply(Line); Visitor->Apply(Size); + Visitor->Apply(Offset); } /// getDescString - Return a string used to compose global names and labels. @@ -707,7 +710,8 @@ << "Name(\"" << Name << "\"), " << "File(" << File << "), " << "Line(" << Line << "), " -<< "Size(" << Size << ")\n"; +<< "Size(" << Size << "), " +<< "Offset(" << Offset << ")\n"; } #endif @@ -771,6 +775,7 @@ case DW_TAG_const_type: case DW_TAG_volatile_type: case DW_TAG_restrict_type: + case DW_TAG_member: return true; default: break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiu
[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h
Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.26 -> 1.27 --- Log message: Adding basic structure support. --- Diffs of the changes: (+7 -5) MachineDebugInfo.h | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.26 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.27 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.26 Wed Mar 1 17:52:37 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.hFri Mar 3 09:06:56 2006 @@ -268,23 +268,25 @@ std::string Name; // Type name (may be empty.) CompileUnitDesc *File;// Declared compile unit (may be NULL.) int Line; // Declared line# (may be zero.) - uint64_t Size;// Type size (may be zero.) + uint64_t Size;// Type bit size (may be zero.) + uint64_t Offset; // Type bit offset (may be zero.) -protected: +public: TypeDesc(unsigned T); -public: // Accessors DebugInfoDesc *getContext()const { return Context; } const std::string &getName() const { return Name; } CompileUnitDesc *getFile() const { return File; } int getLine() const { return Line; } uint64_t getSize() const { return Size; } + uint64_t getOffset() const { return Offset; } void setContext(DebugInfoDesc *C){ Context = C; } void setName(const std::string &N) { Name = N; } void setFile(CompileUnitDesc *U) { File = U; } void setLine(int L) { Line = L; } void setSize(uint64_t S) { Size = S; } + void setOffset(uint64_t O) { Offset = O; } /// ApplyToFields - Target the visitor to the fields of the TypeDesc. /// @@ -413,8 +415,8 @@ /// value ranges. class SubrangeDesc : public DebugInfoDesc { private: - int64_t Lo; // Low value of range - int64_t Hi; // High value of range + int64_t Lo; // Low value of range. + int64_t Hi; // High value of range. public: SubrangeDesc(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AutoUpgrade.cpp
Changes in directory llvm/lib/VMCore: AutoUpgrade.cpp updated: 1.9 -> 1.10 --- Log message: Unbreak autouprade of llvm.sqrt, simplify some code. --- Diffs of the changes: (+12 -38) AutoUpgrade.cpp | 50 -- 1 files changed, 12 insertions(+), 38 deletions(-) Index: llvm/lib/VMCore/AutoUpgrade.cpp diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.9 llvm/lib/VMCore/AutoUpgrade.cpp:1.10 --- llvm/lib/VMCore/AutoUpgrade.cpp:1.9 Thu Mar 2 17:58:40 2006 +++ llvm/lib/VMCore/AutoUpgrade.cpp Fri Mar 3 10:31:22 2006 @@ -19,45 +19,36 @@ #include "llvm/Intrinsics.h" #include "llvm/SymbolTable.h" #include - using namespace llvm; -// Utility function for getting the correct suffix given a type -static inline const char *getTypeSuffix(const Type* Ty) { - switch (Ty->getTypeID()) { - case Type::ULongTyID: return ".i64"; - case Type::UIntTyID:return ".i32"; - case Type::UShortTyID: return ".i16"; - case Type::UByteTyID: return ".i8"; - case Type::FloatTyID: return ".f32"; - case Type::DoubleTyID: return ".f64"; - default:break; - } - return 0; -} - static Function *getUpgradedUnaryFn(Function *F) { - std::string Name = F->getName()+getTypeSuffix(F->getReturnType()); + const std::string &Name = F->getName(); Module *M = F->getParent(); switch (F->getReturnType()->getTypeID()) { default: return 0; case Type::UByteTyID: case Type::SByteTyID: -return M->getOrInsertFunction(Name, +return M->getOrInsertFunction(Name+".i8", Type::UByteTy, Type::UByteTy, NULL); case Type::UShortTyID: case Type::ShortTyID: -return M->getOrInsertFunction(Name, +return M->getOrInsertFunction(Name+".i16", Type::UShortTy, Type::UShortTy, NULL); case Type::UIntTyID: case Type::IntTyID: -return M->getOrInsertFunction(Name, +return M->getOrInsertFunction(Name+".i32", Type::UIntTy, Type::UIntTy, NULL); case Type::ULongTyID: case Type::LongTyID: -return M->getOrInsertFunction(Name, +return M->getOrInsertFunction(Name+".i64", Type::ULongTy, Type::ULongTy, NULL); -} + case Type::FloatTyID: +return M->getOrInsertFunction(Name+".f32", + Type::FloatTy, Type::FloatTy, NULL); + case Type::DoubleTyID: +return M->getOrInsertFunction(Name+".f64", + Type::DoubleTy, Type::DoubleTy, NULL); + } } static Function *getUpgradedIntrinsic(Function *F) { @@ -107,23 +98,6 @@ return 0; } -// This assumes the Function is one of the intrinsics we upgraded. -static inline const Type* getTypeFromFunction(Function *F) { - const Type* Ty = F->getReturnType(); - if (Ty->isFloatingPoint()) -return Ty; - if (Ty->isSigned()) -return Ty->getUnsignedVersion(); - if (Ty->isInteger()) -return Ty; - if (Ty == Type::BoolTy) { -Function::const_arg_iterator ArgIt = F->arg_begin(); -if (ArgIt != F->arg_end()) - return ArgIt->getType(); - } - return 0; -} - // UpgradeIntrinsicFunction - Convert overloaded intrinsic function names to // their non-overloaded variants by appending the appropriate suffix based on // the argument types. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-03-02-InstrSchedBug.ll
Changes in directory llvm/test/Regression/CodeGen/X86: 2006-03-02-InstrSchedBug.ll added (r1.1) --- Log message: Add another test case for instruction scheduling. --- Diffs of the changes: (+10 -0) 2006-03-02-InstrSchedBug.ll | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-03-02-InstrSchedBug.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-03-02-InstrSchedBug.ll:1.1 *** /dev/null Fri Mar 3 12:58:19 2006 --- llvm/test/Regression/CodeGen/X86/2006-03-02-InstrSchedBug.llFri Mar 3 12:58:09 2006 *** *** 0 --- 1,10 + ; RUN: llvm-as < %s | llc -march=x86 -stats 2>&1 | grep 'asm-printer' | grep 7 + + int %g(int %a, int %b) { + %tmp.1 = shl int %b, ubyte 1 + %tmp.3 = add int %tmp.1, %a + %tmp.5 = mul int %tmp.3, %a + %tmp.8 = mul int %b, %b + %tmp.9 = add int %tmp.5, %tmp.8 + ret int %tmp.9 + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/FileLexer.cpp.cvs FileLexer.l FileLexer.l.cvs
Changes in directory llvm/utils/TableGen: FileLexer.cpp.cvs updated: 1.3 -> 1.4 FileLexer.l updated: 1.27 -> 1.28 FileLexer.l.cvs updated: 1.2 -> 1.3 --- Log message: Silence a warning. --- Diffs of the changes: (+4 -4) FileLexer.cpp.cvs |4 ++-- FileLexer.l |2 +- FileLexer.l.cvs |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/utils/TableGen/FileLexer.cpp.cvs diff -u llvm/utils/TableGen/FileLexer.cpp.cvs:1.3 llvm/utils/TableGen/FileLexer.cpp.cvs:1.4 --- llvm/utils/TableGen/FileLexer.cpp.cvs:1.3 Thu Mar 2 19:47:37 2006 +++ llvm/utils/TableGen/FileLexer.cpp.cvs Fri Mar 3 13:34:28 2006 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.3 2006/03/03 01:47:37 lattner Exp $ + * $Header: /var/cvs/llvm/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.4 2006/03/03 19:34:28 lattner Exp $ */ #define FLEX_SCANNER @@ -609,7 +609,7 @@ std::string NextFilename; for (unsigned i = 0, e = IncludeDirectories.size(); i != e; ++i) { NextFilename = IncludeDirectories[i] + "/" + Filename; - if (yyin = fopen(NextFilename.c_str(), "r")) + if ((yyin = fopen(NextFilename.c_str(), "r"))) break; } Index: llvm/utils/TableGen/FileLexer.l diff -u llvm/utils/TableGen/FileLexer.l:1.27 llvm/utils/TableGen/FileLexer.l:1.28 --- llvm/utils/TableGen/FileLexer.l:1.27Thu Mar 2 19:47:14 2006 +++ llvm/utils/TableGen/FileLexer.l Fri Mar 3 13:34:28 2006 @@ -128,7 +128,7 @@ std::string NextFilename; for (unsigned i = 0, e = IncludeDirectories.size(); i != e; ++i) { NextFilename = IncludeDirectories[i] + "/" + Filename; - if (yyin = fopen(NextFilename.c_str(), "r")) + if ((yyin = fopen(NextFilename.c_str(), "r"))) break; } Index: llvm/utils/TableGen/FileLexer.l.cvs diff -u llvm/utils/TableGen/FileLexer.l.cvs:1.2 llvm/utils/TableGen/FileLexer.l.cvs:1.3 --- llvm/utils/TableGen/FileLexer.l.cvs:1.2 Thu Mar 2 19:47:37 2006 +++ llvm/utils/TableGen/FileLexer.l.cvs Fri Mar 3 13:34:28 2006 @@ -128,7 +128,7 @@ std::string NextFilename; for (unsigned i = 0, e = IncludeDirectories.size(); i != e; ++i) { NextFilename = IncludeDirectories[i] + "/" + Filename; - if (yyin = fopen(NextFilename.c_str(), "r")) + if ((yyin = fopen(NextFilename.c_str(), "r"))) break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.41 -> 1.42 --- Log message: Added support for dwarf block data entries. --- Diffs of the changes: (+248 -49) DwarfWriter.cpp | 297 ++-- 1 files changed, 248 insertions(+), 49 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.41 llvm/lib/CodeGen/DwarfWriter.cpp:1.42 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.41 Fri Mar 3 09:06:57 2006 +++ llvm/lib/CodeGen/DwarfWriter.cppFri Mar 3 15:00:14 2006 @@ -174,7 +174,8 @@ isLabel, isAsIsLabel, isDelta, -isEntry +isEntry, +isBlock }; unsigned Type; // Type of the value @@ -208,6 +209,10 @@ static bool classof(const DIEInteger *) { return true; } static bool classof(const DIEValue *I) { return I->Type == isInteger; } + /// BestForm - Choose the best form for integer. + /// + unsigned BestForm(bool IsSigned); + /// EmitValue - Emit integer of appropriate size. /// virtual void EmitValue(const DwarfWriter &DW, unsigned Form) const; @@ -316,16 +321,82 @@ static bool classof(const DIEntry *) { return true; } static bool classof(const DIEValue *E) { return E->Type == isEntry; } - /// EmitValue - Emit delta value. + /// EmitValue - Emit die entry offset. /// virtual void EmitValue(const DwarfWriter &DW, unsigned Form) const; - /// SizeOf - Determine size of delta value in bytes. + /// SizeOf - Determine size of die entry in bytes. /// virtual unsigned SizeOf(const DwarfWriter &DW, unsigned Form) const; }; //===--===// +// DIEBlock - A block of values. Primarily used for location expressions. +// +struct DIEBlock : public DIEValue { + unsigned Size;// Size in bytes excluding size header. + std::vector Forms; // Data forms. + std::vector Values; // Block values. + + DIEBlock() + : DIEValue(isBlock) + , Size(0) + , Forms() + , Values() + {} + ~DIEBlock(); + + // Implement isa/cast/dyncast. + static bool classof(const DIEBlock *) { return true; } + static bool classof(const DIEValue *E) { return E->Type == isBlock; } + + /// ComputeSize - calculate the size of the block. + /// + unsigned ComputeSize(DwarfWriter &DW); + + /// BestForm - Choose the best form for data. + /// + unsigned BestForm(); + + /// EmitValue - Emit block data. + /// + virtual void EmitValue(const DwarfWriter &DW, unsigned Form) const; + + /// SizeOf - Determine size of block data in bytes. + /// + virtual unsigned SizeOf(const DwarfWriter &DW, unsigned Form) const; + + /// AddUInt - Add an unsigned integer value. + /// + void AddUInt(unsigned Form, uint64_t Integer); + + /// AddSInt - Add an signed integer value. + /// + void AddSInt(unsigned Form, int64_t Integer); + + /// AddString - Add a std::string value. + /// + void AddString(unsigned Form, const std::string &String); + + /// AddLabel - Add a Dwarf label value. + /// + void AddLabel(unsigned Form, const DWLabel &Label); + + /// AddObjectLabel - Add a non-Dwarf label value. + /// + void AddObjectLabel(unsigned Form, const std::string &Label); + + /// AddDelta - Add a label delta value. + /// + void AddDelta(unsigned Form, const DWLabel &Hi, const DWLabel &Lo); + + /// AddDIEntry - Add a DIE value. + /// + void AddDIEntry(unsigned Form, DIE *Entry); + +}; + +//===--===// // DIE - A structured debug information entry. Has an abbreviation which // describes it's organization. class DIE { @@ -381,10 +452,14 @@ void AddDelta(unsigned Attribute, unsigned Form, const DWLabel &Hi, const DWLabel &Lo); - /// AddDIEntry - Add a DIE attribute data and value. + /// AddDIEntry - Add a DIE attribute data and value. /// void AddDIEntry(unsigned Attribute, unsigned Form, DIE *Entry); + /// AddBlock - Add block data. + /// + void AddBlock(unsigned Attribute, unsigned Form, DIEBlock *Block); + /// Complete - Indicate that all attributes have been added and /// ready to get an abbreviation ID. /// @@ -496,6 +571,21 @@ //===--===// +/// BestForm - Choose the best form for integer. +/// +unsigned DIEInteger::BestForm(bool IsSigned) { + if (IsSigned) { +if ((char)Integer == (signed)Integer) return DW_FORM_data1; +if ((short)Integer == (signed)Integer) return DW_FORM_data2; +if ((int)Integer == (signed)Integer)return DW_FORM_data4; + } else { +if ((unsigned char)Integer == Integer) return DW_FORM_data1; +if ((unsigned short)Integer == Integer) return DW_FORM_data2; +if ((unsigned int)Integer == Integer) return DW_FORM_data4; + } + return DW_FORM_data8; +} +
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.137 -> 1.138 --- Log message: Spec change: the size of a memset/memcpy/memmove is not required to be aligned to the alignment argument. --- Diffs of the changes: (+6 -7) LangRef.html | 13 ++--- 1 files changed, 6 insertions(+), 7 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.137 llvm/docs/LangRef.html:1.138 --- llvm/docs/LangRef.html:1.137Thu Mar 2 18:19:58 2006 +++ llvm/docs/LangRef.html Fri Mar 3 18:02:10 2006 @@ -3312,8 +3312,8 @@ If the call to this intrinisic has an alignment value that is not 0 or 1, then -the caller guarantees that the size of the copy is a multiple of the alignment -and that both the source and destination pointers are aligned to that boundary. +the caller guarantees that both the source and destination pointers are aligned +to that boundary. Semantics: @@ -3367,8 +3367,8 @@ If the call to this intrinisic has an alignment value that is not 0 or 1, then -the caller guarantees that the size of the copy is a multiple of the alignment -and that both the source and destination pointers are aligned to that boundary. +the caller guarantees that the source and destination pointers are aligned to +that boundary. Semantics: @@ -3421,8 +3421,7 @@ If the call to this intrinisic has an alignment value that is not 0 or 1, then -the caller guarantees that the size of the copy is a multiple of the alignment -and that the destination pointer is aligned to that boundary. +the caller guarantees that the destination pointer is aligned to that boundary. Semantics: @@ -3695,7 +3694,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.cs.uiuc.edu";>The LLVM Compiler Infrastructure - Last modified: $Date: 2006/03/03 00:19:58 $ + Last modified: $Date: 2006/03/04 00:02:10 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-03-03-MissingInitializer.c
Changes in directory llvm/test/Regression/CFrontend: 2006-03-03-MissingInitializer.c added (r1.1) --- Log message: New testcase, make sure nate doesn't vanish --- Diffs of the changes: (+10 -0) 2006-03-03-MissingInitializer.c | 10 ++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CFrontend/2006-03-03-MissingInitializer.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-03-03-MissingInitializer.c:1.1 *** /dev/null Fri Mar 3 18:47:22 2006 --- llvm/test/Regression/CFrontend/2006-03-03-MissingInitializer.c Fri Mar 3 18:47:12 2006 *** *** 0 --- 1,10 + // RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep nate | grep 'global int 0' + + struct X { int *XX; int Y;}; + + void foo() { + static int nate = 0; + struct X bob = { &nate, 14 }; + bar(&bob); + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.99 -> 1.100 --- Log message: Typo --- Diffs of the changes: (+2 -2) X86ISelLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.99 llvm/lib/Target/X86/X86ISelLowering.cpp:1.100 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.99Thu Mar 2 18:19:44 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Mar 3 19:12:00 2006 @@ -1997,8 +1997,8 @@ case X86ISD::CMOV: return "X86ISD::CMOV"; case X86ISD::BRCOND: return "X86ISD::BRCOND"; case X86ISD::RET_FLAG: return "X86ISD::RET_FLAG"; - case X86ISD::REP_STOS: return "X86ISD::RET_STOS"; - case X86ISD::REP_MOVS: return "X86ISD::RET_MOVS"; + case X86ISD::REP_STOS: return "X86ISD::REP_STOS"; + case X86ISD::REP_MOVS: return "X86ISD::REP_MOVS"; case X86ISD::LOAD_PACK: return "X86ISD::LOAD_PACK"; case X86ISD::GlobalBaseReg: return "X86ISD::GlobalBaseReg"; case X86ISD::Wrapper:return "X86ISD::Wrapper"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/README.txt
Changes in directory llvm/lib/Target: README.txt updated: 1.9 -> 1.10 --- Log message: add a note --- Diffs of the changes: (+15 -0) README.txt | 15 +++ 1 files changed, 15 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.9 llvm/lib/Target/README.txt:1.10 --- llvm/lib/Target/README.txt:1.9 Thu Mar 2 16:34:38 2006 +++ llvm/lib/Target/README.txt Fri Mar 3 19:19:34 2006 @@ -86,3 +86,18 @@ into: int f(int a, int b) { return a * (a + 2 * b) + b * b; } to eliminate a multiply. + +//===-===// + +On targets with expensive 64-bit multiply, we could LSR this: + +for (i = ...; ++i) { + x = 1ULL << i; + +into: + long long tmp = 1; + for (i = ...; ++i, tmp+=tmp) + x = tmp; + +This would be a win on ppc32, but not x86 or ppc64. + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp
Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.76 -> 1.77 --- Log message: Be more conservative with our symbolic alias analysis. In particular, don't assume that A[1][0] and A[0][i] can't alias. "i" might be out of range, or even negative. This fixes a miscompilation of 188.ammp (which does bad pointer tricks) with the new CFE. Testcase here: Analysis/BasicAA/2006-03-03-BadArraySubscript.ll --- Diffs of the changes: (+35 -6) BasicAliasAnalysis.cpp | 41 +++-- 1 files changed, 35 insertions(+), 6 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.76 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.77 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.76 Fri Jan 13 19:25:24 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cppFri Mar 3 20:06:34 2006 @@ -527,6 +527,14 @@ // chain. For example: //A[i][0] != A[j][1] iff (&A[0][1]-&A[0][0] >= std::max(G1S, G2S)) // + // We have to be careful here about array accesses. In particular, consider: + //A[1][0] vs A[0][i] + // In this case, we don't *know* that the array will be accessed in bounds: + // the index could even be negative. Because of this, we have to + // conservatively *give up* and return may alias. We disregard differing + // array subscripts that are followed by a variable index without going + // through a struct. + // unsigned SizeMax = std::max(G1S, G2S); if (SizeMax == ~0U) return MayAlias; // Avoid frivolous work. @@ -547,15 +555,36 @@ GEP1Ops[FirstConstantOper] = G1OC; GEP2Ops[FirstConstantOper] = G2OC; } - + if (G1OC != G2OC) { +// Handle the "be careful" case above: if this is an array +// subscript, scan for a subsequent variable array index. +if (isa(BasePtr1Ty)) { + const Type *NextTy =cast(BasePtr1Ty)->getElementType(); + bool isBadCase = false; + + for (unsigned Idx = FirstConstantOper+1; + Idx != MinOperands && isa(NextTy); ++Idx) { +const Value *V1 = GEP1Ops[Idx], *V2 = GEP2Ops[Idx]; +if (!isa(V1) || !isa(V2)) { + isBadCase = true; + break; +} +NextTy = cast(NextTy)->getElementType(); + } + + if (isBadCase) G1OC = 0; +} + // Make sure they are comparable (ie, not constant expressions), and // make sure the GEP with the smaller leading constant is GEP1. -Constant *Compare = ConstantExpr::getSetGT(G1OC, G2OC); -if (ConstantBool *CV = dyn_cast(Compare)) { - if (CV->getValue()) // If they are comparable and G2 > G1 -std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2 - break; +if (G1OC) { + Constant *Compare = ConstantExpr::getSetGT(G1OC, G2OC); + if (ConstantBool *CV = dyn_cast(Compare)) { +if (CV->getValue()) // If they are comparable and G2 > G1 + std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2 +break; + } } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/TableGen/TableGen.vcproj
Changes in directory llvm/win32/TableGen: TableGen.vcproj updated: 1.20 -> 1.21 --- Log message: Keep Visual Studio happy. --- Diffs of the changes: (+18 -5) TableGen.vcproj | 23 ++- 1 files changed, 18 insertions(+), 5 deletions(-) Index: llvm/win32/TableGen/TableGen.vcproj diff -u llvm/win32/TableGen/TableGen.vcproj:1.20 llvm/win32/TableGen/TableGen.vcproj:1.21 --- llvm/win32/TableGen/TableGen.vcproj:1.20Sun Jan 29 22:07:07 2006 +++ llvm/win32/TableGen/TableGen.vcproj Fri Mar 3 20:19:46 2006 @@ -20,7 +20,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include;..;..\..\utils\tablegen" - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;__STDC_LIMIT_MACROS" + PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;__STDC_LIMIT_MACROS" StringPooling="TRUE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" @@ -144,7 +144,8 @@ @@ -163,7 +165,8 @@ @@ -179,6 +183,9 @@ RelativePath="..\..\utils\TableGen\InstrInfoEmitter.cpp"> + + + + + + http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
Changes in directory llvm/test/Regression/Analysis/BasicAA: 2006-03-03-BadArraySubscript.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+31 -0) 2006-03-03-BadArraySubscript.ll | 31 +++ 1 files changed, 31 insertions(+) Index: llvm/test/Regression/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll diff -c /dev/null llvm/test/Regression/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll:1.1 *** /dev/null Fri Mar 3 20:05:17 2006 --- llvm/test/Regression/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll Fri Mar 3 20:05:07 2006 *** *** 0 --- 1,31 + ; RUN: llvm-as < %s | opt -aa-eval -disable-output 2>&1 | grep '2 no alias respon' + + ;; TEST that A[1][0] may alias A[0][i]. + + void %test(int %N) { + entry: + %X = alloca [3 x [3 x int]] ; <[3 x [3 x int]]*> [#uses=4] + %tmp.24 = setgt int %N, 0 ; [#uses=1] + br bool %tmp.24, label %no_exit, label %loopexit + + no_exit: ; preds = %no_exit, %entry + %i.0.0 = phi int [ 0, %entry ], [ %inc, %no_exit ] ; [#uses=2] + %tmp.6 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int %i.0.0 ; [#uses=1] + store int 1, int* %tmp.6 + %tmp.8 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int 0 ; [#uses=1] + %tmp.9 = load int* %tmp.8 ; [#uses=1] + %tmp.11 = getelementptr [3 x [3 x int]]* %X, int 0, int 1, int 0 ; [#uses=1] + %tmp.12 = load int* %tmp.11 ; [#uses=1] + %tmp.13 = add int %tmp.12, %tmp.9 ; [#uses=1] + %inc = add int %i.0.0, 1; [#uses=2] + %tmp.2 = setlt int %inc, %N ; [#uses=1] + br bool %tmp.2, label %no_exit, label %loopexit + + loopexit: ; preds = %no_exit, %entry + %Y.0.1 = phi int [ 0, %entry ], [ %tmp.13, %no_exit ] ; [#uses=1] + %tmp.4 = getelementptr [3 x [3 x int]]* %X, int 0, int 0 ; <[3 x int]*> [#uses=1] + %tmp.15 = call int (...)* %foo( [3 x int]* %tmp.4, int %Y.0.1 ) ; [#uses=0] + ret void + } + + declare int %foo(...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/win32/x86/x86.vcproj
Changes in directory llvm/win32/x86: x86.vcproj updated: 1.21 -> 1.22 --- Log message: Keep Visual Studio happy. --- Diffs of the changes: (+18 -20) x86.vcproj | 38 ++ 1 files changed, 18 insertions(+), 20 deletions(-) Index: llvm/win32/x86/x86.vcproj diff -u llvm/win32/x86/x86.vcproj:1.21 llvm/win32/x86/x86.vcproj:1.22 --- llvm/win32/x86/x86.vcproj:1.21 Thu Feb 16 20:11:34 2006 +++ llvm/win32/x86/x86.vcproj Fri Mar 3 20:19:46 2006 @@ -116,16 +116,15 @@ @@ -134,16 +133,15 @@ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.100 -> 1.101 --- Log message: MEMSET / MEMCPY lowering bugs: we can't issue a single WORD / DWORD version of rep/stos and rep/mov if the count is not a constant. We could do rep/stosl; and $count, 3; rep/stosb For now, I will lower them to memset / memcpy calls. We will revisit this after a little bit experiment. Also need to take care of the trailing bytes even if the count is a constant. Since the max. number of trailing bytes are 3, we will simply issue loads / stores. --- Diffs of the changes: (+83 -28) X86ISelLowering.cpp | 111 ++-- 1 files changed, 83 insertions(+), 28 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.100 llvm/lib/Target/X86/X86ISelLowering.cpp:1.101 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.100 Fri Mar 3 19:12:00 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Mar 3 20:48:56 2006 @@ -1696,7 +1696,7 @@ Op.getOperand(0), Op.getOperand(2), CC, Cond); } case ISD::MEMSET: { -SDOperand InFlag; +SDOperand InFlag(0, 0); SDOperand Chain = Op.getOperand(0); unsigned Align = (unsigned)cast(Op.getOperand(4))->getValue(); @@ -1705,7 +1705,7 @@ ConstantSDNode *I = dyn_cast(Op.getOperand(3)); // If not DWORD aligned, call memset if size is less than the threshold. // It knows how to align to the right boundary first. -if ((Align & 3) != 0 && +if ((Align & 3) != 0 || !(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { MVT::ValueType IntPtr = getPointerTy(); const Type *IntPtrTy = getTargetData().getIntPtrType(); @@ -1723,7 +1723,9 @@ MVT::ValueType AVT; SDOperand Count; -if (ConstantSDNode *ValC = dyn_cast(Op.getOperand(2))) { +ConstantSDNode *ValC = dyn_cast(Op.getOperand(2)); +unsigned BytesLeft = 0; +if (ValC) { unsigned ValReg; unsigned Val = ValC->getValue() & 255; @@ -1731,21 +1733,15 @@ switch (Align & 3) { case 2: // WORD aligned AVT = MVT::i16; -if (I) - Count = DAG.getConstant(I->getValue() / 2, MVT::i32); -else - Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), - DAG.getConstant(1, MVT::i8)); +Count = DAG.getConstant(I->getValue() / 2, MVT::i32); +BytesLeft = I->getValue() % 2; Val= (Val << 8) | Val; ValReg = X86::AX; break; case 0: // DWORD aligned AVT = MVT::i32; -if (I) - Count = DAG.getConstant(I->getValue() / 4, MVT::i32); -else - Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), - DAG.getConstant(2, MVT::i8)); +Count = DAG.getConstant(I->getValue() / 4, MVT::i32); +BytesLeft = I->getValue() % 4; Val = (Val << 8) | Val; Val = (Val << 16) | Val; ValReg = X86::EAX; @@ -1771,9 +1767,36 @@ InFlag = Chain.getValue(1); Chain = DAG.getCopyToReg(Chain, X86::EDI, Op.getOperand(1), InFlag); InFlag = Chain.getValue(1); +Chain = DAG.getNode(X86ISD::REP_STOS, MVT::Other, Chain, + DAG.getValueType(AVT), InFlag); + +if (BytesLeft) { + // Issue stores for the last 1 - 3 bytes. + SDOperand Value; + unsigned Val = ValC->getValue() & 255; + unsigned Offset = I->getValue() - BytesLeft; + SDOperand DstAddr = Op.getOperand(1); + MVT::ValueType AddrVT = DstAddr.getValueType(); + if (BytesLeft >= 2) { +Value = DAG.getConstant((Val << 8) | Val, MVT::i16); +Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain, Value, +DAG.getNode(ISD::ADD, AddrVT, DstAddr, +DAG.getConstant(Offset, AddrVT)), +DAG.getSrcValue(NULL)); +BytesLeft -= 2; +Offset += 2; + } + + if (BytesLeft == 1) { +Value = DAG.getConstant(Val, MVT::i8); +Chain = DAG.getNode(ISD::STORE, MVT::Other, Chain, Value, +DAG.getNode(ISD::ADD, AddrVT, DstAddr, +DAG.getConstant(Offset, AddrVT)), +DAG.getSrcValue(NULL)); + } +} -return DAG.getNode(X86ISD::REP_STOS, MVT::Other, Chain, - DAG.getValueType(AVT), InFlag); +return Chain; } case ISD::MEMCPY: { SDOperand Chain = Op.getOperand(0); @@ -1784,7 +1807,7 @@ ConstantSDNode *I = dyn_cast(Op.getOperand(3)); // If not DWORD aligned, call memcpy if size is less than the threshold. // It knows how to align to the right boundary first. -if ((Align & 3) != 0 && +if ((Align & 3) != 0 || !(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { MVT::
[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/add.ll
Changes in directory llvm/test/Regression/Transforms/InstCombine: add.ll updated: 1.28 -> 1.29 --- Log message: new testcase --- Diffs of the changes: (+7 -0) add.ll |7 +++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/add.ll diff -u llvm/test/Regression/Transforms/InstCombine/add.ll:1.28 llvm/test/Regression/Transforms/InstCombine/add.ll:1.29 --- llvm/test/Regression/Transforms/InstCombine/add.ll:1.28 Wed Nov 2 12:34:05 2005 +++ llvm/test/Regression/Transforms/InstCombine/add.ll Sat Mar 4 00:02:36 2006 @@ -213,3 +213,10 @@ %tmp.4 = add long %tmp.2, -9223372036854775808 ret long %tmp.4 } + +int %test31(int %A) { + %B = add int %A, 4 + %C = mul int %B, 5 + %D = sub int %C, 20 + ret int %D +} ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.447 -> 1.448 --- Log message: Canonicalize (X+C1)*C2 -> X*C2+C1*C2 This implements Transforms/InstCombine/add.ll:test31 --- Diffs of the changes: (+13 -0) InstructionCombining.cpp | 13 + 1 files changed, 13 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.447 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.448 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.447 Thu Mar 2 19:34:17 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Mar 4 00:04:02 2006 @@ -1622,6 +1622,19 @@ if (Op1F->getValue() == 1.0) return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' } + +if (BinaryOperator *Op0I = dyn_cast(Op0)) + if (Op0I->getOpcode() == Instruction::Add && Op0I->hasOneUse() && + isa(Op0I->getOperand(1))) { +// Canonicalize (X+C1)*C2 -> X*C2+C1*C2. +Instruction *Add = BinaryOperator::createMul(Op0I->getOperand(0), + Op1, "tmp"); +InsertNewInstBefore(Add, I); +Value *C1C2 = ConstantExpr::getMul(Op1, + cast(Op0I->getOperand(1))); +return BinaryOperator::createAdd(Add, C1C2); + + } // Try to fold constant mul into select arguments. if (SelectInst *SI = dyn_cast(Op0)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/README.txt
Changes in directory llvm/lib/Target/X86: README.txt updated: 1.62 -> 1.63 --- Log message: Add an entry --- Diffs of the changes: (+5 -0) README.txt |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.62 llvm/lib/Target/X86/README.txt:1.63 --- llvm/lib/Target/X86/README.txt:1.62 Tue Feb 28 17:38:49 2006 +++ llvm/lib/Target/X86/README.txt Sat Mar 4 01:49:50 2006 @@ -533,3 +533,8 @@ imull $9, 4(%esp), %eax Currently the load folding imull has a higher complexity than the LEA32 pattern. + +//===-===// + +Lower memcpy / memset to a series of SSE 128 bit move instructions when it's +feasible. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits