[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.135 -> 1.136 --- Log message: Use IntrinsicInst to test for prefetch instructions, which is ever so slightly nicer than using CallInst with an extra check; thanks Chris. --- Diffs of the changes: (+5 -6) LoopStrengthReduce.cpp | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.136 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135 Thu May 3 18:20:33 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri May 4 09:59:09 2007 @@ -19,7 +19,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Type.h" #include "llvm/DerivedTypes.h" #include "llvm/Analysis/Dominators.h" @@ -1043,12 +1043,11 @@ if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst)) { if (SI->getOperand(1) == UsersToProcess[i].OperandValToReplace) isAddress = true; - } else if (CallInst *CI = dyn_cast(UsersToProcess[i].Inst)) { + } else if (IntrinsicInst *II = + dyn_cast(UsersToProcess[i].Inst)) { // Addressing modes can also be folded into prefetches. -Function *CalledFunc = CI->getCalledFunction(); -if (CalledFunc != NULL && -CalledFunc->getIntrinsicID() == Intrinsic::prefetch && -CI->getOperand(1) == UsersToProcess[i].OperandValToReplace) +if (II->getIntrinsicID() == Intrinsic::prefetch && +II->getOperand(1) == UsersToProcess[i].OperandValToReplace) isAddress = true; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Applications/kimwitu++/k.h
Changes in directory llvm-test/MultiSource/Applications/kimwitu++: k.h updated: 1.1 -> 1.2 --- Log message: Fix test. --- Diffs of the changes: (+2 -2) k.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/MultiSource/Applications/kimwitu++/k.h diff -u llvm-test/MultiSource/Applications/kimwitu++/k.h:1.1 llvm-test/MultiSource/Applications/kimwitu++/k.h:1.2 --- llvm-test/MultiSource/Applications/kimwitu++/k.h:1.1Tue Apr 6 15:25:12 2004 +++ llvm-test/MultiSource/Applications/kimwitu++/k.hFri May 4 11:42:29 2007 @@ -11,7 +11,7 @@ "pat.k" */ /* generated by: - * @(#)$Author: criswell $ + * @(#)$Author: evancheng $ */ #ifndef KC_TYPES_HEADER #define KC_TYPES_HEADER @@ -37,10 +37,10 @@ typedef unsigned short kc_wchar_t; typedef std::string kc_cstring_t; -typedef std::wstring kc_wstring_t; #ifdef KC_UNICODE #define kc_t(TEXT) L ## TEXT +typedef std::wstring kc_wstring_t; typedef kc_wchar_t kc_char; typedef kc_wstring_t kc_string_t; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.446 -> 1.447 --- Log message: A bitcast of a global variable may have been constant folded to a GEP - handle this case too. --- Diffs of the changes: (+30 -26) SelectionDAGISel.cpp | 56 +++ 1 files changed, 30 insertions(+), 26 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.446 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.447 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.446Wed May 2 20:11:53 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri May 4 12:12:26 2007 @@ -2457,6 +2457,24 @@ } } +/// ExtractGlobalVariable - If C is a global variable, or a bitcast of one +/// (possibly constant folded), return it. Otherwise return NULL. +static GlobalVariable *ExtractGlobalVariable (Constant *C) { + if (GlobalVariable *GV = dyn_cast(C)) +return GV; + else if (ConstantExpr *CE = dyn_cast(C)) { +if (CE->getOpcode() == Instruction::BitCast) + return dyn_cast(CE->getOperand(0)); +else if (CE->getOpcode() == Instruction::GetElementPtr) { + for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i) +if (!CE->getOperand(i)->isNullValue()) + return NULL; + return dyn_cast(CE->getOperand(0)); +} + } + return NULL; +} + /// visitIntrinsicCall - Lower the call to the specified intrinsic function. If /// we want to emit this as a call to a named external function, return the name /// otherwise lower it and return null. @@ -2610,20 +2628,12 @@ // MachineModuleInfo. std::vector TyInfo; for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) { -Constant *C = cast(I.getOperand(i)); -if (GlobalVariable *GV = dyn_cast(C)) { - TyInfo.push_back(GV); -} else if (ConstantExpr *CE = dyn_cast(C)) { - assert(CE->getOpcode() == Instruction::BitCast && - isa(CE->getOperand(0)) - && "TypeInfo must be a global variable or NULL"); - TyInfo.push_back(cast(CE->getOperand(0))); -} else { - ConstantInt *CI = dyn_cast(C); - assert(CI && CI->isNullValue() && - "TypeInfo must be a global variable or NULL"); - TyInfo.push_back(NULL); -} + Constant *C = cast(I.getOperand(i)); +GlobalVariable *GV = ExtractGlobalVariable(C); +assert (GV || (isa(C) && + cast(C)->isNullValue()) && +"TypeInfo must be a global variable or NULL"); +TyInfo.push_back(GV); } MMI->addCatchTypeInfo(CurMBB, TyInfo); @@ -2651,18 +2661,12 @@ if (MMI) { // Find the type id for the given typeinfo. - GlobalVariable *GV = NULL; - ConstantExpr *CE = dyn_cast(I.getOperand(1)); - if (CE && CE->getOpcode() == Instruction::BitCast && - isa(CE->getOperand(0))) { -GV = cast(CE->getOperand(0)); - } else { -ConstantInt *CI = dyn_cast(I.getOperand(1)); -assert(CI && CI->getZExtValue() == 0 && - "TypeInfo must be a global variable typeinfo or NULL"); -GV = NULL; - } - + Constant *C = cast(I.getOperand(1)); + GlobalVariable *GV = ExtractGlobalVariable(C); + assert (GV || (isa(C) && + cast(C)->isNullValue()) && + "TypeInfo must be a global variable or NULL"); + unsigned TypeID = MMI->getTypeIDFor(GV); setValue(&I, DAG.getConstant(TypeID, MVT::i32)); } else { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll
Changes in directory llvm/test/CodeGen/Generic: 2007-05-03-EHTypeInfo.ll added (r1.1) --- Log message: Test that the eh lowering code can handle constant folded bitcasts. --- Diffs of the changes: (+12 -0) 2007-05-03-EHTypeInfo.ll | 12 1 files changed, 12 insertions(+) Index: llvm/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll diff -c /dev/null llvm/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll:1.1 *** /dev/null Fri May 4 12:14:52 2007 --- llvm/test/CodeGen/Generic/2007-05-03-EHTypeInfo.ll Fri May 4 12:14:42 2007 *** *** 0 --- 1,12 + ; RUN: llvm-as < %s | llc -enable-eh + + %struct.exception = type { i8, i8, i32, i8*, i8*, i32, i8* } + @program_error = external global %struct.exception; <%struct.exception*> [#uses=1] + + define void @typeinfo() { + entry: + %eh_typeid = tail call i32 @llvm.eh.typeid.for( i8* getelementptr (%struct.exception* @program_error, i32 0, i32 0) ) ; [#uses=0] + ret void + } + + declare i32 @llvm.eh.typeid.for(i8*) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h
Changes in directory llvm/include/llvm/Bitcode: BitCodes.h updated: 1.2 -> 1.3 BitstreamReader.h updated: 1.11 -> 1.12 BitstreamWriter.h updated: 1.6 -> 1.7 --- Log message: refcount BitCodeAbbrev objects --- Diffs of the changes: (+13 -7) BitCodes.h| 12 +--- BitstreamReader.h |6 +++--- BitstreamWriter.h |2 +- 3 files changed, 13 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Bitcode/BitCodes.h diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.2 llvm/include/llvm/Bitcode/BitCodes.h:1.3 --- llvm/include/llvm/Bitcode/BitCodes.h:1.2Mon Apr 23 11:04:05 2007 +++ llvm/include/llvm/Bitcode/BitCodes.hFri May 4 12:35:19 2007 @@ -58,9 +58,9 @@ /// 2. It could be an encoding specification ("this operand encoded like so"). /// class BitCodeAbbrevOp { - uint64_t Val;// A literal value or data for an encoding. - bool IsLiteral : 1; // Indicate whether this is a literal value or not. - unsigned Enc : 3; // The encoding to use. + uint64_t Val; // A literal value or data for an encoding. + bool IsLiteral : 1; // Indicate whether this is a literal value or not. + unsigned Enc : 3; // The encoding to use. public: enum Encoding { FixedWidth = 1, // A fixed with field, Val specifies number of bits. @@ -89,8 +89,14 @@ class BitCodeAbbrev { SmallVector OperandList; + unsigned char RefCount; // Number of things using this. + ~BitCodeAbbrev() {} public: + BitCodeAbbrev() : RefCount(1) {} + void addRef() { ++RefCount; } + void dropRef() { if (--RefCount == 0) delete this; } + unsigned getNumOperandInfos() const { return OperandList.size(); } const BitCodeAbbrevOp &getOperandInfo(unsigned N) const { return OperandList[N]; Index: llvm/include/llvm/Bitcode/BitstreamReader.h diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.11 llvm/include/llvm/Bitcode/BitstreamReader.h:1.12 --- llvm/include/llvm/Bitcode/BitstreamReader.h:1.11Tue May 1 00:51:32 2007 +++ llvm/include/llvm/Bitcode/BitstreamReader.h Fri May 4 12:35:19 2007 @@ -75,12 +75,12 @@ // Abbrevs could still exist if the stream was broken. If so, don't leak // them. for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i) - delete CurAbbrevs[i]; + CurAbbrevs[i]->dropRef(); for (unsigned S = 0, e = BlockScope.size(); S != e; ++S) { std::vector &Abbrevs = BlockScope[S].PrevAbbrevs; for (unsigned i = 0, e = Abbrevs.size(); i != e; ++i) -delete Abbrevs[i]; +Abbrevs[i]->dropRef(); } } @@ -263,7 +263,7 @@ // Delete abbrevs from popped scope. for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i) - delete CurAbbrevs[i]; + CurAbbrevs[i]->dropRef(); BlockScope.back().PrevAbbrevs.swap(CurAbbrevs); BlockScope.pop_back(); Index: llvm/include/llvm/Bitcode/BitstreamWriter.h diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.6 llvm/include/llvm/Bitcode/BitstreamWriter.h:1.7 --- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.6 Mon Apr 23 15:34:46 2007 +++ llvm/include/llvm/Bitcode/BitstreamWriter.h Fri May 4 12:35:19 2007 @@ -160,7 +160,7 @@ // Delete all abbrevs. for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i) - delete CurAbbrevs[i]; + CurAbbrevs[i]->dropRef(); const Block &B = BlockScope.back(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h LLVMBitCodes.h
Changes in directory llvm/include/llvm/Bitcode: BitCodes.h updated: 1.3 -> 1.4 BitstreamReader.h updated: 1.12 -> 1.13 BitstreamWriter.h updated: 1.7 -> 1.8 LLVMBitCodes.h updated: 1.14 -> 1.15 --- Log message: minor cleanups. Add provisions for a new standard BLOCKINFO_BLOCK block type. --- Diffs of the changes: (+41 -17) BitCodes.h| 32 BitstreamReader.h |2 +- BitstreamWriter.h |6 +++--- LLVMBitCodes.h| 18 +- 4 files changed, 41 insertions(+), 17 deletions(-) Index: llvm/include/llvm/Bitcode/BitCodes.h diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.3 llvm/include/llvm/Bitcode/BitCodes.h:1.4 --- llvm/include/llvm/Bitcode/BitCodes.h:1.3Fri May 4 12:35:19 2007 +++ llvm/include/llvm/Bitcode/BitCodes.hFri May 4 13:25:49 2007 @@ -30,9 +30,9 @@ BlockSizeWidth = 32 // BlockSize up to 2^32 32-bit words = 32GB per block. }; - // The standard code namespace always has a way to exit a block, enter a + // The standard abbrev namespace always has a way to exit a block, enter a // nested block, define abbrevs, and define an unabbreviated record. - enum FixedCodes { + enum FixedAbbrevIDs { END_BLOCK = 0, // Must be zero to guarantee termination for broken bitcode. ENTER_SUBBLOCK = 1, @@ -48,8 +48,29 @@ UNABBREV_RECORD = 3, // This is not a code, this is a marker for the first abbrev assignment. -FIRST_ABBREV = 4 +FIRST_APPLICATION_ABBREV = 4 }; + + /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO + /// block, which contains metadata about other blocks in the file. + enum StandardBlockIDs { +/// BLOCKINFO_BLOCK is used to define metadata about blocks, for example, +/// standard abbrevs that should be available to all blocks of a specified +/// ID. +BLOCKINFO_BLOCK_ID = 0, + +// Block IDs 1-7 are reserved for future expansion. +FIRST_APPLICATION_BLOCKID = 8 + }; + + /// BlockInfoCodes - The blockinfo block contains metadata about user-defined + /// blocks. + enum BlockInfoCodes { +BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#] +BLOCKINFO_CODE_ABBREV = 2 // ABBREV: [standard abbrev encoding] +// BLOCKNAME: give string name to block, if desired. + }; + } // End bitc namespace /// BitCodeAbbrevOp - This describes one or more operands in an abbreviation. @@ -63,7 +84,7 @@ unsigned Enc : 3; // The encoding to use. public: enum Encoding { -FixedWidth = 1, // A fixed with field, Val specifies number of bits. +FixedWidth = 1, // A fixed with field, Val specifies number of bits. VBR= 2 // A VBR field where Val specifies the width of each chunk. }; @@ -87,6 +108,9 @@ } }; +/// BitCodeAbbrev - This class represents an abbreviation record. An +/// abbreviation allows a complex record that has redundancy to be stored in a +/// specialized format instead of the fully-general, fully-vbr, format. class BitCodeAbbrev { SmallVector OperandList; unsigned char RefCount; // Number of things using this. Index: llvm/include/llvm/Bitcode/BitstreamReader.h diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.12 llvm/include/llvm/Bitcode/BitstreamReader.h:1.13 --- llvm/include/llvm/Bitcode/BitstreamReader.h:1.12Fri May 4 12:35:19 2007 +++ llvm/include/llvm/Bitcode/BitstreamReader.h Fri May 4 13:25:49 2007 @@ -283,7 +283,7 @@ return Code; } -unsigned AbbrevNo = AbbrevID-bitc::FIRST_ABBREV; +unsigned AbbrevNo = AbbrevID-bitc::FIRST_APPLICATION_ABBREV; assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!"); BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo]; Index: llvm/include/llvm/Bitcode/BitstreamWriter.h diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.7 llvm/include/llvm/Bitcode/BitstreamWriter.h:1.8 --- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.7 Fri May 4 12:35:19 2007 +++ llvm/include/llvm/Bitcode/BitstreamWriter.h Fri May 4 13:25:49 2007 @@ -194,7 +194,7 @@ void EmitRecord(unsigned Code, SmallVectorImpl &Vals, unsigned Abbrev = 0) { if (Abbrev) { - unsigned AbbrevNo = Abbrev-bitc::FIRST_ABBREV; + unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV; assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!"); BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo]; @@ -247,7 +247,7 @@ void EmitRecord(unsigned Code, SmallVectorImpl &Vals, unsigned Abbrev = 0) { if (Abbrev) { - unsigned AbbrevNo = Abbrev-bitc::FIRST_ABBREV; + unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV; assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!"); BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo]; @@ -318,7 +318,7 @@ } CurAbbrevs.push_back(Abbv); -return CurAbbrevs.size()-1+bitc::FIRST_ABBREV; +return CurAbbrevs.size()-1+bitc::FIRST_APPLICATION_ABBRE
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.29 -> 1.30 --- Log message: stub out creation of BLOCKINFO_BLOCK --- Diffs of the changes: (+25 -0) BitcodeWriter.cpp | 25 + 1 files changed, 25 insertions(+) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.29 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.30 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.29 Thu May 3 22:52:24 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 13:26:27 2007 @@ -858,6 +858,28 @@ Stream.ExitBlock(); } +// Emit blockinfo, which defines the standard abbreviations etc. +static void WriteBlockInfo(BitstreamWriter &Stream) { + // We only want to emit block info records for blocks that have multiple + // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK. Other + // blocks can defined their abbrevs inline. + Stream.EnterSubblock(bitc::BLOCKINFO_BLOCK_ID, 2); + +#if 0 + // Configure TYPE_SYMTAB_BLOCK's. + + // Add an abbrev for VST_ENTRY where the characters each fit in 7 bits. + BitCodeAbbrev *Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8); // Value ID + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 3)); // Linkage. + + xxx = Stream.EmitAbbrev(Abbv); +#endif + Stream.ExitBlock(); +} + + /// WriteBitcodeToFile - Write the specified module to the specified output /// stream. void llvm::WriteBitcodeToFile(const Module *M, std::ostream &Out) { @@ -874,6 +896,9 @@ Stream.Emit(0xE, 4); Stream.Emit(0xD, 4); + // Emit blockinfo, which defines the standard abbreviations etc. + WriteBlockInfo(Stream); + // Emit the module. WriteModule(M, Stream); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126896] Fix PR 1250.
Revision: 126896 Author: dpatel Date: 2007-05-04 11:42:00 -0700 (Fri, 04 May 2007) Log Message: --- Fix PR 1250. Apply Duncan's patch. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp === --- apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 16:16:23 UTC (rev 126895) +++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 18:42:00 UTC (rev 126896) @@ -473,16 +473,17 @@ } case ENUMERAL_TYPE: // Use of an enum that is implicitly declared? -if (TYPE_SIZE(type) == 0) { +if (TYPE_SIZE(orig_type) == 0) { // If we already compiled this type, use the old type. - if (const Type *Ty = GET_TYPE_LLVM(type)) + if (const Type *Ty = GET_TYPE_LLVM(orig_type)) return Ty; const Type *Ty = OpaqueType::get(); TheModule->addTypeName(GetTypeName("enum.", orig_type), Ty); - return TypeDB.setType(type, Ty); + return TypeDB.setType(orig_type, Ty); } // FALL THROUGH. +type = orig_type; case INTEGER_TYPE: if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile
Changes in directory llvm-test/External/SPEC/CINT2000/253.perlbmk: Makefile updated: 1.12 -> 1.13 --- Log message: Fix Makefile. --- Diffs of the changes: (+12 -0) Makefile | 12 1 files changed, 12 insertions(+) Index: llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile diff -u llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile:1.12 llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile:1.13 --- llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile:1.12 Tue Nov 28 18:47:17 2006 +++ llvm-test/External/SPEC/CINT2000/253.perlbmk/Makefile Fri May 4 13:43:35 2007 @@ -8,8 +8,20 @@ CPPFLAGS += -DSPEC_CPU2000_LINUX_I386 -DSPEC_CPU2000_NEED_BOOL +# Not sure why this is needed. +ifdef SMALL_PROBLEM_SIZE +RUN_TYPE=test +else +ifdef LARGE_PROBLEM_SIZE +RUN_TYPE=ref +else +RUN_TYPE=train +endif +endif + ifeq ($(RUN_TYPE),test) RUN_OPTIONS = test.pl +STDIN_FILENAME := test.in STDOUT_FILENAME := test.out else RUN_OPTIONS = scrabbl.pl ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/LLVMBitCodes.h
Changes in directory llvm/include/llvm/Bitcode: LLVMBitCodes.h updated: 1.15 -> 1.16 --- Log message: eliminate lengths from record bodies --- Diffs of the changes: (+16 -16) LLVMBitCodes.h | 32 1 files changed, 16 insertions(+), 16 deletions(-) Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h diff -u llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.15 llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.16 --- llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.15 Fri May 4 13:25:49 2007 +++ llvm/include/llvm/Bitcode/LLVMBitCodes.hFri May 4 14:10:48 2007 @@ -40,11 +40,11 @@ /// MODULE blocks have a number of optional fields and subblocks. enum ModuleCodes { MODULE_CODE_VERSION = 1,// VERSION: [version#] -MODULE_CODE_TRIPLE = 2,// TRIPLE: [strlen, strchr x N] -MODULE_CODE_DATALAYOUT = 3,// DATALAYOUT: [strlen, strchr x N] -MODULE_CODE_ASM = 4,// ASM: [strlen, strchr x N] -MODULE_CODE_SECTIONNAME = 5,// SECTIONNAME: [strlen, strchr x N] -MODULE_CODE_DEPLIB = 6,// DEPLIB: [strlen, strchr x N] +MODULE_CODE_TRIPLE = 2,// TRIPLE: [strchr x N] +MODULE_CODE_DATALAYOUT = 3,// DATALAYOUT: [strchr x N] +MODULE_CODE_ASM = 4,// ASM: [strchr x N] +MODULE_CODE_SECTIONNAME = 5,// SECTIONNAME: [strchr x N] +MODULE_CODE_DEPLIB = 6,// DEPLIB: [strchr x N] // GLOBALVAR: [type, isconst, initid, // linkage, alignment, section, visibility, threadlocal] @@ -78,8 +78,8 @@ TYPE_CODE_OPAQUE = 6, // OPAQUE TYPE_CODE_INTEGER = 7, // INTEGER: [width] TYPE_CODE_POINTER = 8, // POINTER: [pointee type] -TYPE_CODE_FUNCTION = 9, // FUNCTION: [vararg, retty, #pararms, paramty N] -TYPE_CODE_STRUCT = 10, // STRUCT: [ispacked, #elts, eltty x N] +TYPE_CODE_FUNCTION = 9, // FUNCTION: [vararg, retty, paramty x N] +TYPE_CODE_STRUCT = 10, // STRUCT: [ispacked, eltty x N] TYPE_CODE_ARRAY= 11, // ARRAY: [numelts, eltty] TYPE_CODE_VECTOR = 12// VECTOR: [numelts, eltty] // Any other type code is assumed to be an unknown type. @@ -87,13 +87,13 @@ // The type symbol table only has one code (TST_ENTRY_CODE). enum TypeSymtabCodes { -TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namelen, namechar x N] +TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namechar x N] }; // The value symbol table only has one code (VST_ENTRY_CODE). enum ValueSymtabCodes { -VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namelen, namechar x N] -VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namelen, namechar x N] +VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namechar x N] +VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namechar x N] }; // The constants block (CONSTANTS_BLOCK_ID) describes emission for each @@ -103,12 +103,12 @@ CST_CODE_NULL = 2, // NULL CST_CODE_UNDEF = 3, // UNDEF CST_CODE_INTEGER = 4, // INTEGER: [intval] -CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n, n x intval] +CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval] CST_CODE_FLOAT = 6, // FLOAT: [fpval] -CST_CODE_AGGREGATE = 7, // AGGREGATE: [n, n x value number] +CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number] CST_CODE_CE_BINOP = 8, // CE_BINOP: [opcode, opval, opval] CST_CODE_CE_CAST = 9, // CE_CAST: [opcode, opty, opval] -CST_CODE_CE_GEP= 10, // CE_GEP:[n, n x operands] +CST_CODE_CE_GEP= 10, // CE_GEP:[n x operands] CST_CODE_CE_SELECT = 11, // CE_SELECT: [opval, opval, opval] CST_CODE_CE_EXTRACTELT = 12, // CE_EXTRACTELT: [opty, opval, opval] CST_CODE_CE_INSERTELT = 13, // CE_INSERTELT: [opval, opval, opval] @@ -163,21 +163,21 @@ FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval] FUNC_CODE_INST_CAST= 3, // CAST: [opcode, ty, opty, opval] -FUNC_CODE_INST_GEP = 4, // GEP:[n, n x operands] +FUNC_CODE_INST_GEP = 4, // GEP:[n x operands] FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval] FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval] FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval] FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval] FUNC_CODE_INST_CMP = 9, // CMP:[opty, opval, opval, pred] -FUNC_CODE_INST_RET = 10, // RET:[opty,opval] +FUNC_CODE_INST_RET = 10, // RET:[opty,opval] FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#] FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, opval, n, n x ops]
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.30 -> 1.31 --- Log message: eliminate internal length fields from record. Records already know their total length --- Diffs of the changes: (+12 -11) BitcodeWriter.cpp | 23 --- 1 files changed, 12 insertions(+), 11 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.30 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.31 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.30 Fri May 4 13:26:27 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 14:11:41 2007 @@ -72,8 +72,7 @@ unsigned AbbrevToUse, BitstreamWriter &Stream) { SmallVector Vals; - // Code: [strlen, strchar x N] - Vals.push_back(Str.size()); + // Code: [strchar x N] for (unsigned i = 0, e = Str.size(); i != e; ++i) Vals.push_back(Str[i]); @@ -150,7 +149,6 @@ TypeVals.push_back(FT->isVarArg()); TypeVals.push_back(VE.getParamAttrID(FT->getParamAttrs())); TypeVals.push_back(VE.getTypeID(FT->getReturnType())); - TypeVals.push_back(FT->getNumParams()); for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) TypeVals.push_back(VE.getTypeID(FT->getParamType(i))); break; @@ -160,8 +158,7 @@ // STRUCT: [ispacked, #elts, eltty x N] Code = bitc::TYPE_CODE_STRUCT; TypeVals.push_back(ST->isPacked()); - TypeVals.push_back(ST->getNumElements()); - // Output all of the element types... + // Output all of the element types. for (StructType::element_iterator I = ST->element_begin(), E = ST->element_end(); I != E; ++I) TypeVals.push_back(VE.getTypeID(*I)); @@ -399,7 +396,6 @@ // So, we only write the number of active words. unsigned NWords = IV->getValue().getActiveWords(); const uint64_t *RawWords = IV->getValue().getRawData(); -Record.push_back(NWords); for (unsigned i = 0; i != NWords; ++i) { int64_t V = RawWords[i]; if (V >= 0) @@ -420,7 +416,6 @@ } else if (isa(C) || isa(V) || isa(V)) { Code = bitc::CST_CODE_AGGREGATE; - Record.push_back(C->getNumOperands()); for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) Record.push_back(VE.getValueID(C->getOperand(i))); } else if (const ConstantExpr *CE = dyn_cast(C)) { @@ -441,7 +436,6 @@ break; case Instruction::GetElementPtr: Code = bitc::CST_CODE_CE_GEP; -Record.push_back(CE->getNumOperands()); for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) { Record.push_back(VE.getTypeID(C->getOperand(i)->getType())); Record.push_back(VE.getValueID(C->getOperand(i))); @@ -627,7 +621,6 @@ case Instruction::PHI: Code = bitc::FUNC_CODE_INST_PHI; Vals.push_back(VE.getTypeID(I.getType())); -Vals.push_back(I.getNumOperands()); for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) Vals.push_back(VE.getValueID(I.getOperand(i))); break; @@ -710,6 +703,16 @@ if (VST.empty()) return; Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); +#if 0 + BitCodeAbbrev *Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::VST_ENTRY)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, +Log2_32_Ceil(MaxGlobalType+1))); + // Don't bother emitting vis + thread local. + SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv); +#endif + + // FIXME: Set up the abbrev, we know how many values there are! // FIXME: We know if the type names can use 7-bit ascii. SmallVector NameVals; @@ -728,7 +731,6 @@ } NameVals.push_back(VE.getValueID(SI->getValue())); -NameVals.push_back(SI->getKeyLength()); for (const char *P = SI->getKeyData(), *E = SI->getKeyData()+SI->getKeyLength(); P != E; ++P) NameVals.push_back((unsigned char)*P); @@ -794,7 +796,6 @@ NameVals.push_back(VE.getTypeID(TI->second)); const std::string &Str = TI->first; -NameVals.push_back(Str.size()); for (unsigned i = 0, e = Str.size(); i != e; ++i) NameVals.push_back(Str[i]); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Changes in directory llvm/lib/Bitcode/Reader: BitcodeReader.cpp updated: 1.36 -> 1.37 --- Log message: eliminate internal length fields from record. Records already know their total length --- Diffs of the changes: (+36 -37) BitcodeReader.cpp | 73 ++ 1 files changed, 36 insertions(+), 37 deletions(-) Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.36 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.37 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.36 Thu May 3 22:57:30 2007 +++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp Fri May 4 14:11:41 2007 @@ -36,11 +36,11 @@ template static bool ConvertToString(SmallVector &Record, unsigned Idx, StrTy &Result) { - if (Record.size() < Idx+1 || Record.size() < Record[Idx]+Idx+1) + if (Idx > Record.size()) return true; - for (unsigned i = 0, e = Record[Idx]; i != e; ++i) -Result += (char)Record[Idx+i+1]; + for (unsigned i = Idx, e = Record.size(); i != e; ++i) +Result += (char)Record[i]; return false; } @@ -313,23 +313,23 @@ ResultTy = PointerType::get(getTypeByID(Record[0], true)); break; case bitc::TYPE_CODE_FUNCTION: { - // FUNCTION: [vararg, attrid, retty, #pararms, paramty N] - if (Record.size() < 4 || Record.size() < Record[3]+4) + // FUNCTION: [vararg, attrid, retty, paramty x N] + if (Record.size() < 3) return Error("Invalid FUNCTION type record"); std::vector ArgTys; - for (unsigned i = 0, e = Record[3]; i != e; ++i) -ArgTys.push_back(getTypeByID(Record[4+i], true)); + for (unsigned i = 3, e = Record.size(); i != e; ++i) +ArgTys.push_back(getTypeByID(Record[i], true)); ResultTy = FunctionType::get(getTypeByID(Record[2], true), ArgTys, Record[0], getParamAttrs(Record[1])); break; } -case bitc::TYPE_CODE_STRUCT: { // STRUCT: [ispacked, #elts, eltty x N] - if (Record.size() < 2 || Record.size() < Record[1]+2) +case bitc::TYPE_CODE_STRUCT: { // STRUCT: [ispacked, eltty x N] + if (Record.size() < 2) return Error("Invalid STRUCT type record"); std::vector EltTys; - for (unsigned i = 0, e = Record[1]; i != e; ++i) -EltTys.push_back(getTypeByID(Record[2+i], true)); + for (unsigned i = 1, e = Record.size(); i != e; ++i) +EltTys.push_back(getTypeByID(Record[i], true)); ResultTy = StructType::get(EltTys, Record[0]); break; } @@ -411,7 +411,7 @@ switch (Stream.ReadRecord(Code, Record)) { default: // Default behavior: unknown type. break; -case bitc::TST_CODE_ENTRY:// TST_ENTRY: [typeid, namelen, namechar x N] +case bitc::TST_CODE_ENTRY:// TST_ENTRY: [typeid, namechar x N] if (ConvertToString(Record, 1, TypeName)) return Error("Invalid TST_ENTRY record"); unsigned TypeID = Record[0]; @@ -458,7 +458,7 @@ switch (Stream.ReadRecord(Code, Record)) { default: // Default behavior: unknown type. break; -case bitc::VST_CODE_ENTRY: { // VST_ENTRY: [valueid, namelen, namechar x N] +case bitc::VST_CODE_ENTRY: { // VST_ENTRY: [valueid, namechar x N] if (ConvertToString(Record, 1, ValueName)) return Error("Invalid TST_ENTRY record"); unsigned ValueID = Record[0]; @@ -591,16 +591,15 @@ return Error("Invalid CST_INTEGER record"); V = ConstantInt::get(CurTy, DecodeSignRotatedValue(Record[0])); break; -case bitc::CST_CODE_WIDE_INTEGER: {// WIDE_INTEGER: [n, n x intval] - if (!isa(CurTy) || Record.empty() || - Record.size() < Record[0]+1) +case bitc::CST_CODE_WIDE_INTEGER: {// WIDE_INTEGER: [n x intval] + if (!isa(CurTy) || Record.empty()) return Error("Invalid WIDE_INTEGER record"); - unsigned NumWords = Record[0]; + unsigned NumWords = Record.size(); SmallVector Words; Words.resize(NumWords); for (unsigned i = 0; i != NumWords; ++i) -Words[i] = DecodeSignRotatedValue(Record[i+1]); +Words[i] = DecodeSignRotatedValue(Record[i]); V = ConstantInt::get(APInt(cast(CurTy)->getBitWidth(), NumWords, &Words[0])); break; @@ -616,27 +615,27 @@ V = UndefValue::get(CurTy); break; -case bitc::CST_CODE_AGGREGATE: {// AGGREGATE: [n, n x value number] - if (Record.empty() || Record.size() < Record[0]+1) +case bitc::CST_CODE_AGGREGATE: {// AGGREGATE: [n x value number] + if (Record.empty()) return Error("Invalid CST_AGGREGATE record"); - unsigned Size = Record[0]; + unsigned Size = Record.size(); std::vector Elts; if (const StructType *STy = dyn_cast(CurTy)) { for (unsigned i = 0; i != Size; ++i) - Elts.push_back(ValueList.getConstantF
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c
Changes in directory llvm-test/MultiSource/Benchmarks/Olden/mst: hash.c updated: 1.5 -> 1.6 --- Log message: Fix test so gcc/llvm comparison is valid. --- Diffs of the changes: (+0 -4) hash.c |4 1 files changed, 4 deletions(-) Index: llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c diff -u llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c:1.5 llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c:1.6 --- llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c:1.5 Thu Feb 14 13:00:56 2002 +++ llvm-test/MultiSource/Benchmarks/Olden/mst/hash.c Fri May 4 14:57:26 2007 @@ -5,9 +5,6 @@ #define assert(num,a) if (!(a)) {printf("Assertion failure:%d in hash\n",num); exit(-1);} -#ifdef __llvm__ -#define localmalloc malloc -#else static int remaining = 0; static char *temp; @@ -26,7 +23,6 @@ remaining -= size; return blah; } -#endif #define localfree(sz) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h
Changes in directory llvm/include/llvm/Bitcode: BitCodes.h updated: 1.4 -> 1.5 BitstreamReader.h updated: 1.13 -> 1.14 BitstreamWriter.h updated: 1.8 -> 1.9 --- Log message: add support for array abbreviations. --- Diffs of the changes: (+101 -59) BitCodes.h| 22 ++--- BitstreamReader.h | 52 +--- BitstreamWriter.h | 86 ++ 3 files changed, 101 insertions(+), 59 deletions(-) Index: llvm/include/llvm/Bitcode/BitCodes.h diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.4 llvm/include/llvm/Bitcode/BitCodes.h:1.5 --- llvm/include/llvm/Bitcode/BitCodes.h:1.4Fri May 4 13:25:49 2007 +++ llvm/include/llvm/Bitcode/BitCodes.hFri May 4 15:33:47 2007 @@ -84,13 +84,15 @@ unsigned Enc : 3; // The encoding to use. public: enum Encoding { -FixedWidth = 1, // A fixed with field, Val specifies number of bits. -VBR= 2 // A VBR field where Val specifies the width of each chunk. +Fixed = 1, // A fixed with field, Val specifies number of bits. +VBR = 2, // A VBR field where Val specifies the width of each chunk. +Array = 3 // A sequence of fields, next field species elt encoding. }; BitCodeAbbrevOp(uint64_t V) : Val(V), IsLiteral(true) {} - BitCodeAbbrevOp(Encoding E, uint64_t Data) + BitCodeAbbrevOp(Encoding E, uint64_t Data = 0) : Val(Data), IsLiteral(false), Enc(E) {} + bool isLiteral() const { return IsLiteral; } bool isEncoding() const { return !IsLiteral; } @@ -100,11 +102,21 @@ // Accessors for encoding info. Encoding getEncoding() const { assert(isEncoding()); return (Encoding)Enc; } - uint64_t getEncodingData() const { assert(isEncoding()); return Val; } + uint64_t getEncodingData() const { +assert(isEncoding() && hasEncodingData()); +return Val; + } bool hasEncodingData() const { return hasEncodingData(getEncoding()); } static bool hasEncodingData(Encoding E) { -return true; +switch (E) { +default: assert(0 && "Unknown encoding"); +case Fixed: +case VBR: + return true; +case Array: + return false; +} } }; Index: llvm/include/llvm/Bitcode/BitstreamReader.h diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.13 llvm/include/llvm/Bitcode/BitstreamReader.h:1.14 --- llvm/include/llvm/Bitcode/BitstreamReader.h:1.13Fri May 4 13:25:49 2007 +++ llvm/include/llvm/Bitcode/BitstreamReader.h Fri May 4 15:33:47 2007 @@ -274,6 +274,26 @@ // Record Processing //======// +private: + void ReadAbbreviatedField(const BitCodeAbbrevOp &Op, +SmallVectorImpl &Vals) { +if (Op.isLiteral()) { + // If the abbrev specifies the literal value to use, use it. + Vals.push_back(Op.getLiteralValue()); +} else { + // Decode the value as we are commanded. + switch (Op.getEncoding()) { + default: assert(0 && "Unknown encoding!"); + case BitCodeAbbrevOp::Fixed: +Vals.push_back(Read(Op.getEncodingData())); +break; + case BitCodeAbbrevOp::VBR: +Vals.push_back(ReadVBR64(Op.getEncodingData())); +break; + } +} + } +public: unsigned ReadRecord(unsigned AbbrevID, SmallVectorImpl &Vals) { if (AbbrevID == bitc::UNABBREV_RECORD) { unsigned Code = ReadVBR(6); @@ -289,20 +309,19 @@ for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) { const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i); - if (Op.isLiteral()) { -// If the abbrev specifies the literal value to use, use it. -Vals.push_back(Op.getLiteralValue()); + if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) { +ReadAbbreviatedField(Op, Vals); } else { -// Decode the value as we are commanded. -switch (Op.getEncoding()) { -default: assert(0 && "Unknown encoding!"); -case BitCodeAbbrevOp::FixedWidth: - Vals.push_back(Read(Op.getEncodingData())); - break; -case BitCodeAbbrevOp::VBR: - Vals.push_back(ReadVBR64(Op.getEncodingData())); - break; -} +// Array case. Read the number of elements as a vbr6. +unsigned NumElts = ReadVBR(6); + +// Get the element encoding. +assert(i+2 == e && "array op not second to last?"); +const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i); + +// Read all the elements. +for (; NumElts; --NumElts) + ReadAbbreviatedField(EltEnc, Vals); } } @@ -326,11 +345,10 @@ } BitCodeAbbrevOp::Encoding E = (BitCodeAbbrevOp::Encoding)Read(3); - if (BitCodeAbbrevOp::hasEncodingData(E)) { + if (BitCodeAbbrevOp::hasEncodingData(E)) Abbv->Add(BitCodeAbbrevOp(E, ReadVBR64(5))); - } else { -assert(0 && "unimp"); - } +
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.31 -> 1.32 --- Log message: Encode all value symtab strings as arrays of 8-bit fixed width integers, instead of the default inefficient encoding. This shrinks kc++ from 4134K to 3629K --- Diffs of the changes: (+15 -15) BitcodeWriter.cpp | 30 +++--- 1 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.31 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.32 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.31 Fri May 4 14:11:41 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 15:34:50 2007 @@ -267,22 +267,22 @@ // Add an abbrev for common globals with no visibility or thread localness. BitCodeAbbrev *Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_GLOBALVAR)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(MaxGlobalType+1))); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 1)); // Constant. +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constant. Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));// Initializer. -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 3)); // Linkage. -if (MaxAlignment == 0) // Alignment. +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage. +if (MaxAlignment == 0) // Alignment. Abbv->Add(BitCodeAbbrevOp(0)); else { unsigned MaxEncAlignment = Log2_32(MaxAlignment)+1; - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(MaxEncAlignment+1))); } if (SectionMap.empty())// Section. Abbv->Add(BitCodeAbbrevOp(0)); else - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(SectionMap.size()+1))); // Don't bother emitting vis + thread local. SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv); @@ -702,15 +702,14 @@ BitstreamWriter &Stream) { if (VST.empty()) return; Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); - -#if 0 + + // 8-bit fixed width VST_ENTRY strings. BitCodeAbbrev *Abbv = new BitCodeAbbrev(); - Abbv->Add(BitCodeAbbrevOp(bitc::VST_ENTRY)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, -Log2_32_Ceil(MaxGlobalType+1))); - // Don't bother emitting vis + thread local. - SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv); -#endif + Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); + unsigned AbbrevID = Stream.EmitAbbrev(Abbv); // FIXME: Set up the abbrev, we know how many values there are! @@ -728,6 +727,7 @@ Code = bitc::VST_CODE_BBENTRY; } else { Code = bitc::VST_CODE_ENTRY; + AbbrevToUse = AbbrevID; } NameVals.push_back(VE.getValueID(SI->getValue())); @@ -873,7 +873,7 @@ BitCodeAbbrev *Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8); // Value ID - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::FixedWidth, 3)); // Linkage. + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage. xxx = Stream.EmitAbbrev(Abbv); #endif ___ 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/X86.td
Changes in directory llvm/lib/Target/X86: X86.td updated: 1.31 -> 1.32 --- Log message: Add an "implies" field to features. This indicates that, if the current feature is set, then the features in the implied list should be set also. The opposite is also enforced: if a feature in the implied list isn't set, then the feature that owns that implies list shouldn't be set either. --- Diffs of the changes: (+21 -17) X86.td | 38 +- 1 files changed, 21 insertions(+), 17 deletions(-) Index: llvm/lib/Target/X86/X86.td diff -u llvm/lib/Target/X86/X86.td:1.31 llvm/lib/Target/X86/X86.td:1.32 --- llvm/lib/Target/X86/X86.td:1.31 Wed Apr 25 16:31:48 2007 +++ llvm/lib/Target/X86/X86.td Fri May 4 15:38:40 2007 @@ -18,24 +18,28 @@ //===--===// // X86 Subtarget features. -// +//===--===// -def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true", -"Support 64-bit instructions">; -def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX", -"Enable MMX instructions">; -def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1", -"Enable SSE instructions">; -def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2", -"Enable SSE2 instructions">; -def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3", -"Enable SSE3 instructions">; -def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3", -"Enable SSSE3 instructions">; -def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow", -"Enable 3DNow! instructions">; -def Feature3DNowA: SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA", -"Enable 3DNow! Athlon instructions">; +def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true", + "Support 64-bit instructions">; +def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX", + "Enable MMX instructions">; +def FeatureSSE1: SubtargetFeature<"sse", "X86SSELevel", "SSE1", + "Enable SSE instructions", + [FeatureMMX]>; +def FeatureSSE2: SubtargetFeature<"sse2", "X86SSELevel", "SSE2", + "Enable SSE2 instructions", + [FeatureSSE1]>; +def FeatureSSE3: SubtargetFeature<"sse3", "X86SSELevel", "SSE3", + "Enable SSE3 instructions", + [FeatureSSE2]>; +def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3", + "Enable SSSE3 instructions", + [FeatureSSE3]>; +def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow", + "Enable 3DNow! instructions">; +def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA", + "Enable 3DNow! Athlon instructions">; //===--===// // X86 processors supported. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp Target.td
Changes in directory llvm/lib/Target: SubtargetFeature.cpp updated: 1.12 -> 1.13 Target.td updated: 1.98 -> 1.99 --- Log message: Add an "implies" field to features. This indicates that, if the current feature is set, then the features in the implied list should be set also. The opposite is also enforced: if a feature in the implied list isn't set, then the feature that owns that implies list shouldn't be set either. --- Diffs of the changes: (+56 -3) SubtargetFeature.cpp | 51 +-- Target.td|8 +++- 2 files changed, 56 insertions(+), 3 deletions(-) Index: llvm/lib/Target/SubtargetFeature.cpp diff -u llvm/lib/Target/SubtargetFeature.cpp:1.12 llvm/lib/Target/SubtargetFeature.cpp:1.13 --- llvm/lib/Target/SubtargetFeature.cpp:1.12 Thu Dec 7 17:41:45 2006 +++ llvm/lib/Target/SubtargetFeature.cppFri May 4 15:38:40 2007 @@ -199,6 +199,43 @@ if (Features[0].empty()) setCPU(String); } +/// SetImpliedBits - For each feature that is (transitively) implied by this +/// feature, set it. +/// +static +void SetImpliedBits(uint32_t &Bits, const SubtargetFeatureKV *FeatureEntry, +const SubtargetFeatureKV *FeatureTable, +size_t FeatureTableSize) { + for (size_t i = 0; i < FeatureTableSize; ++i) { +const SubtargetFeatureKV &FE = FeatureTable[i]; + +if (FeatureEntry->Value == FE.Value) continue; + +if (FeatureEntry->Implies & FE.Value) { + Bits |= FE.Value; + SetImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize); +} + } +} + +/// ClearImpliedBits - For each feature that (transitively) implies this +/// feature, clear it. +/// +static +void ClearImpliedBits(uint32_t &Bits, const SubtargetFeatureKV *FeatureEntry, + const SubtargetFeatureKV *FeatureTable, + size_t FeatureTableSize) { + for (size_t i = 0; i < FeatureTableSize; ++i) { +const SubtargetFeatureKV &FE = FeatureTable[i]; + +if (FeatureEntry->Value == FE.Value) continue; + +if (FE.Implies & FeatureEntry->Value) { + Bits &= ~FE.Value; + ClearImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize); +} + } +} /// getBits - Get feature bits. /// @@ -251,8 +288,17 @@ // If there is a match if (FeatureEntry) { // Enable/disable feature in bits - if (isEnabled(Feature)) Bits |= FeatureEntry->Value; - elseBits &= ~FeatureEntry->Value; + if (isEnabled(Feature)) { +Bits |= FeatureEntry->Value; + +// For each feature that this implies, set it. +SetImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize); + } else { +Bits &= ~FeatureEntry->Value; + +// For each feature that implies this, clear it. +ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize); + } } else { cerr << "'" << Feature << "' is not a recognized feature for this target" @@ -260,6 +306,7 @@ << "\n"; } } + return Bits; } Index: llvm/lib/Target/Target.td diff -u llvm/lib/Target/Target.td:1.98 llvm/lib/Target/Target.td:1.99 --- llvm/lib/Target/Target.td:1.98 Wed May 2 19:27:11 2007 +++ llvm/lib/Target/Target.td Fri May 4 15:38:40 2007 @@ -338,7 +338,8 @@ //===--===// // SubtargetFeature - A characteristic of the chip set. // -class SubtargetFeature { +class SubtargetFeature i = []> { // Name - Feature name. Used by command line (-mattr=) to determine the // appropriate target chip. // @@ -356,6 +357,11 @@ // information. // string Desc = d; + + // Implies - Features that this feature implies are present. If one of those + // features isn't set, then this one shouldn't be set either. + // + list Implies = i; } //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp
Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.25 -> 1.26 --- Log message: Add an "implies" field to features. This indicates that, if the current feature is set, then the features in the implied list should be set also. The opposite is also enforced: if a feature in the implied list isn't set, then the feature that owns that implies list shouldn't be set either. --- Diffs of the changes: (+54 -46) SubtargetEmitter.cpp | 100 +++ 1 files changed, 54 insertions(+), 46 deletions(-) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.25 llvm/utils/TableGen/SubtargetEmitter.cpp:1.26 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.25 Sun Apr 22 04:04:24 2007 +++ llvm/utils/TableGen/SubtargetEmitter.cppFri May 4 15:38:40 2007 @@ -56,8 +56,7 @@ Record *Def = DefList[i]; // Get and emit name -std::string Name = Def->getName(); -OS << " " << Name; +OS << " " << Def->getName(); // If bit flags then emit expression (1 << i) if (isBits) OS << " = " << " 1 << " << i; @@ -73,8 +72,8 @@ } // -// FeatureKeyValues - Emit data of all the subtarget features. Used by command -// line. +// FeatureKeyValues - Emit data of all the subtarget features. Used by the +// command line. // void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) { // Gather and sort all the features @@ -91,18 +90,31 @@ // Next feature Record *Feature = FeatureList[i]; -std::string Name = Feature->getName(); -std::string CommandLineName = Feature->getValueAsString("Name"); -std::string Desc = Feature->getValueAsString("Desc"); +const std::string &Name = Feature->getName(); +const std::string &CommandLineName = Feature->getValueAsString("Name"); +const std::string &Desc = Feature->getValueAsString("Desc"); if (CommandLineName.empty()) continue; -// Emit as { "feature", "decription", feactureEnum } +// Emit as { "feature", "decription", feactureEnum, i1 | i2 | ... | in } OS << " { " << "\"" << CommandLineName << "\", " << "\"" << Desc << "\", " - << Name - << " }"; + << Name << ", "; + +const std::vector &ImpliesList = + Feature->getValueAsListOfDefs("Implies"); + +if (ImpliesList.empty()) { + OS << "0"; +} else { + for (unsigned j = 0, M = ImpliesList.size(); j < M;) { +OS << ImpliesList[j]->getName(); +if (++j < M) OS << " | "; + } +} + +OS << " }"; // Depending on 'if more in the list' emit comma if ((i + 1) < N) OS << ","; @@ -138,8 +150,8 @@ // Next processor Record *Processor = ProcessorList[i]; -std::string Name = Processor->getValueAsString("Name"); -std::vector FeatureList = +const std::string &Name = Processor->getValueAsString("Name"); +const std::vector &FeatureList = Processor->getValueAsListOfDefs("Features"); // Emit as { "cpu", "description", f1 | f2 | ... fn }, @@ -151,14 +163,13 @@ OS << "0"; } else { for (unsigned j = 0, M = FeatureList.size(); j < M;) { -Record *Feature = FeatureList[j]; -std::string Name = Feature->getName(); -OS << Name; +OS << FeatureList[j]->getName(); if (++j < M) OS << " | "; } } -OS << " }"; +// The "0" is for the "implies" section of this data structure. +OS << ", 0 }"; // Depending on 'if more in the list' emit comma if (++i < N) OS << ","; @@ -190,11 +201,10 @@ unsigned N = ItinClassList.size(); for (unsigned i = 0; i < N; i++) { // Next itinerary class -Record *ItinClass = ItinClassList[i]; +const Record *ItinClass = ItinClassList[i]; // Get name of itinerary class -std::string Name = ItinClass->getName(); // Assign itinerary class a unique number -ItinClassesMap[Name] = i; +ItinClassesMap[ItinClass->getName()] = i; } // Emit size of table @@ -214,28 +224,26 @@ std::string &ItinString, unsigned &NStages) { // Get states list - std::vector StageList = ItinData->getValueAsListOfDefs("Stages"); + const std::vector &StageList = +ItinData->getValueAsListOfDefs("Stages"); // For each stage unsigned N = NStages = StageList.size(); for (unsigned i = 0; i < N;) { // Next stage -Record *Stage = StageList[i]; +const Record *Stage = StageList[i]; // Form string as ,{ cycles, u1 | u2 | ... | un } int Cycles = Stage->getValueAsInt("Cycles"); ItinString += " { " + itostr(Cycles) + ", "; // Get unit list -std::vector UnitList = Stage->getValueAsListOfDefs("Units"); +const std::vector &UnitList = Stage->getValueAsListOfDefs("Units"); // For each unit for (unsigned j = 0, M =
[llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h
Changes in directory llvm/include/llvm/Target: SubtargetFeature.h updated: 1.10 -> 1.11 --- Log message: Add an "implies" field to features. This indicates that, if the current feature is set, then the features in the implied list should be set also. The opposite is also enforced: if a feature in the implied list isn't set, then the feature that owns that implies list shouldn't be set either. --- Diffs of the changes: (+1 -0) SubtargetFeature.h |1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/Target/SubtargetFeature.h diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.10 llvm/include/llvm/Target/SubtargetFeature.h:1.11 --- llvm/include/llvm/Target/SubtargetFeature.h:1.10Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/Target/SubtargetFeature.h Fri May 4 15:38:40 2007 @@ -34,6 +34,7 @@ const char *Key; // K-V key string const char *Desc; // Help descriptor uint32_t Value; // K-V integer value + uint32_t Implies; // K-V bit mask // Compare routine for std binary search bool operator<(const SubtargetFeatureKV &S) const { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitstreamWriter.h
Changes in directory llvm/include/llvm/Bitcode: BitstreamWriter.h updated: 1.9 -> 1.10 --- Log message: use a template to eliminate manual code duplication --- Diffs of the changes: (+2 -47) BitstreamWriter.h | 49 ++--- 1 files changed, 2 insertions(+), 47 deletions(-) Index: llvm/include/llvm/Bitcode/BitstreamWriter.h diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.9 llvm/include/llvm/Bitcode/BitstreamWriter.h:1.10 --- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.9 Fri May 4 15:33:47 2007 +++ llvm/include/llvm/Bitcode/BitstreamWriter.h Fri May 4 15:40:50 2007 @@ -217,7 +217,8 @@ /// EmitRecord - Emit the specified record to the stream, using an abbrev if /// we have one to compress the output. - void EmitRecord(unsigned Code, SmallVectorImpl &Vals, + template + void EmitRecord(unsigned Code, SmallVectorImpl &Vals, unsigned Abbrev = 0) { if (Abbrev) { unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV; @@ -261,52 +262,6 @@ } } - /// EmitRecord - Emit the specified record to the stream, using an abbrev if - /// we have one to compress the output. - void EmitRecord(unsigned Code, SmallVectorImpl &Vals, - unsigned Abbrev = 0) { -if (Abbrev) { - unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV; - assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!"); - BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo]; - - EmitCode(Abbrev); - - // Insert the code into Vals to treat it uniformly. - Vals.insert(Vals.begin(), Code); - - unsigned RecordIdx = 0; - for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) { -assert(RecordIdx < Vals.size() && "Invalid abbrev/record"); -const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i); - -if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) { - EmitAbbreviatedField(Op, Vals[RecordIdx]); - ++RecordIdx; -} else { - assert(i+2 == e && "array op not second to last?"); - const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i); - - // Emit a vbr6 to indicate the number of elements present. - EmitVBR(Vals.size()-RecordIdx, 6); - - // Emit each field. - for (; RecordIdx != Vals.size(); ++RecordIdx) -EmitAbbreviatedField(EltEnc, Vals[RecordIdx]); -} - } - assert(RecordIdx == Vals.size() && "Not all record operands emitted!"); -} else { - // If we don't have an abbrev to use, emit this in its fully unabbreviated - // form. - EmitCode(bitc::UNABBREV_RECORD); - EmitVBR(Code, 6); - EmitVBR(Vals.size(), 6); - for (unsigned i = 0, e = Vals.size(); i != e; ++i) -EmitVBR(Vals[i], 6); -} - } - //======// // Abbrev Emission //======// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.32 -> 1.33 --- Log message: where possible, encode symtab names with 7 bits per char instead of 8. This shaves 110K off kc++ to 3514K. Before: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.50425e+07b/1.88031e+06B/470077W Average Size: 6414.69b/801.837B/200.459W % of file: 51.8057 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 2345/1 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 85.1791 after: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.41229e+07b/1.76536e+06B/441341W Average Size: 6022.56b/752.82B/188.205W % of file: 50.2295 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 4690/2 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 85.1791 --- Diffs of the changes: (+45 -11) BitcodeWriter.cpp | 56 +++--- 1 files changed, 45 insertions(+), 11 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.32 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.33 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.32 Fri May 4 15:34:50 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 15:52:02 2007 @@ -25,7 +25,17 @@ #include "llvm/Support/MathExtras.h" using namespace llvm; -static const unsigned CurVersion = 0; +/// These are manifest constants used by the bitcode writer. They do not need to +/// be kept in sync with the reader, but need to be consistent within this file. +enum { + CurVersion = 0, + + // VALUE_SYMTAB_BLOCK abbrev id's. + VST_ENTRY_8_ABBREV = bitc::FIRST_APPLICATION_ABBREV, + VST_ENTRY_7_ABBREV + +}; + static unsigned GetEncodedCastOpcode(unsigned Opcode) { switch (Opcode) { @@ -703,13 +713,25 @@ if (VST.empty()) return; Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); - // 8-bit fixed width VST_ENTRY strings. - BitCodeAbbrev *Abbv = new BitCodeAbbrev(); - Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); - unsigned AbbrevID = Stream.EmitAbbrev(Abbv); + { // 8-bit fixed width VST_ENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); +if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_8_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } + + { // 7-bit fixed width VST_ENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); +if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_7_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } // FIXME: Set up the abbrev, we know how many values there are! @@ -718,6 +740,18 @@ for (ValueSymbolTable::const_iterator SI = VST.begin(), SE = VST.end(); SI != SE; ++SI) { + +const ValueName &Name = *SI; + +// Figure out the encoding to use for the name. +bool is7Bit = true; +for (unsigned i = 0, e = Name.getKeyLength(); i != e; ++i) + if ((unsigned char)Name.getKeyData()[i] & 128) { +is7Bit = false; +break; + } + + unsigned AbbrevToUse = 0; // VST_ENTRY: [valueid, namelen, namechar x N] @@ -727,12 +761,12 @@ Code = bitc::VST_CODE_BBENTRY; } else { Code = bitc::VST_CODE_ENTRY; - AbbrevToUse = AbbrevID; + AbbrevToUse = is7Bit ? VST_ENTRY_7_ABBREV : VST_ENTRY_8_ABBREV; } NameVals.push_back(VE.getValueID(SI->getValue())); -for (const char *P = SI->getKeyData(), - *E = SI->getKeyData()+SI->getKeyLength(); P != E; ++P) +for (const char *P = Name.getKeyData(), + *E = Name.getKeyData()+Name.getKeyLength(); P != E; ++P) NameVals.push_back((unsigned char)*P); // Emit the finished record. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.33 -> 1.34 --- Log message: shave another 150K off of kc++, by using a 7-bit encoding for BB names where we can. This shrinks kc++'s down to 3368K, with a VST record of: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.29508e+07b/1.61885e+06B/404713W Average Size: 5522.73b/690.342B/172.585W % of file: 48.0645 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 7035/3 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 Isn't it nice to be able to optimizer bc size without touching the reader? :) --- Diffs of the changes: (+12 -1) BitcodeWriter.cpp | 13 - 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.33 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.34 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.33 Fri May 4 15:52:02 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 15:58:35 2007 @@ -32,7 +32,8 @@ // VALUE_SYMTAB_BLOCK abbrev id's. VST_ENTRY_8_ABBREV = bitc::FIRST_APPLICATION_ABBREV, - VST_ENTRY_7_ABBREV + VST_ENTRY_7_ABBREV, + VST_BBENTRY_7_ABBREV }; @@ -732,6 +733,15 @@ if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_7_ABBREV) assert(0 && "Unexpected abbrev ordering!"); } + { // 7-bit fixed width VST_BBENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); +if (Stream.EmitAbbrev(Abbv) != VST_BBENTRY_7_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } // FIXME: Set up the abbrev, we know how many values there are! @@ -759,6 +769,7 @@ unsigned Code; if (isa(SI->getValue())) { Code = bitc::VST_CODE_BBENTRY; + if (is7Bit) AbbrevToUse = VST_BBENTRY_7_ABBREV; } else { Code = bitc::VST_CODE_ENTRY; AbbrevToUse = is7Bit ? VST_ENTRY_7_ABBREV : VST_ENTRY_8_ABBREV; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/RunSafely.sh
Changes in directory llvm-test: RunSafely.sh updated: 1.28 -> 1.29 --- Log message: bugfix: wrong return value on remote test. bugfix: RUNTIMELIMIT doesn't work on remote test. --- Diffs of the changes: (+9 -8) RunSafely.sh | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) Index: llvm-test/RunSafely.sh diff -u llvm-test/RunSafely.sh:1.28 llvm-test/RunSafely.sh:1.29 --- llvm-test/RunSafely.sh:1.28 Thu May 3 16:32:39 2007 +++ llvm-test/RunSafely.sh Fri May 4 16:24:42 2007 @@ -62,24 +62,25 @@ shift 5 SYSTEM=`uname -s` +ULIMITCMD="" case $SYSTEM in CYGWIN*) ;; Darwin*) # Disable core file emission, the script doesn't find it anyway because it is put # into /cores. -ulimit -c 0 -ulimit -t $ULIMIT +ULIMITCMD="$ULIMITCMD ulimit -c 0;" +ULIMITCMD="$ULIMITCMD ulimit -t $ULIMIT;" # To prevent infinite loops which fill up the disk, specify a limit on size of # files being output by the tests. 10 MB should be enough for anybody. ;) -ulimit -f 10485760 +ULIMITCMD="$ULIMITCMD ulimit -f 10485760;" ;; *) -ulimit -t $ULIMIT -ulimit -c unlimited +ULIMITCMD="$ULIMITCMD ulimit -t $ULIMIT;" +ULIMITCMD="$ULIMITCMD ulimit -c unlimited;" # To prevent infinite loops which fill up the disk, specify a limit on size of # files being output by the tests. 10 MB should be enough for anybody. ;) -ulimit -f 10485760 +ULIMITCMD="$ULIMITCMD ulimit -f 10485760;" esac rm -f core core.* @@ -101,7 +102,7 @@ fi if [ "x$RHOST" = x ] ; then - ( time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ + ( time -p sh -c "$ULIMITCMD $COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ | awk -- '\ BEGIN { cpu = 0.0; } /^user/ { cpu += $2; print; } @@ -109,7 +110,7 @@ !/^user/ && !/^sys/ { print; } END { printf("program %f\n", cpu); }' > $OUTFILE.time else - ( rsh -l $RUSER $RHOST "cd $PWD; time -p $COMMAND >$OUTFILE.remote 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ + ( rsh -l $RUSER $RHOST "$ULIMITCMD cd $PWD; time -p $COMMAND >$OUTFILE.remote 2>&1 < $INFILE; echo exit \$?" ) 2>&1 \ | awk -- '\ BEGIN { cpu = 0.0; } /^user/ { cpu += $2; print; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.34 -> 1.35 --- Log message: allow the 8-bit abbrev to be used for either bb or other values --- Diffs of the changes: (+6 -6) BitcodeWriter.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.34 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.35 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.34 Fri May 4 15:58:35 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 16:31:13 2007 @@ -714,9 +714,9 @@ if (VST.empty()) return; Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); - { // 8-bit fixed width VST_ENTRY strings. + { // 8-bit fixed-width VST_ENTRY/VST_BBENTRY strings. BitCodeAbbrev *Abbv = new BitCodeAbbrev(); -Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); @@ -762,17 +762,17 @@ } -unsigned AbbrevToUse = 0; +unsigned AbbrevToUse = VST_ENTRY_8_ABBREV; -// VST_ENTRY: [valueid, namelen, namechar x N] -// VST_BBENTRY: [bbid, namelen, namechar x N] +// VST_ENTRY: [valueid, namechar x N] +// VST_BBENTRY: [bbid, namechar x N] unsigned Code; if (isa(SI->getValue())) { Code = bitc::VST_CODE_BBENTRY; if (is7Bit) AbbrevToUse = VST_BBENTRY_7_ABBREV; } else { Code = bitc::VST_CODE_ENTRY; - AbbrevToUse = is7Bit ? VST_ENTRY_7_ABBREV : VST_ENTRY_8_ABBREV; + if (is7Bit) AbbrevToUse = VST_ENTRY_7_ABBREV; } NameVals.push_back(VE.getValueID(SI->getValue())); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/RunSafely.sh
Changes in directory llvm-test: RunSafely.sh updated: 1.29 -> 1.30 --- Log message: Fix the previous patch: we don't want to count the time needed to run ULIMITCMD. --- Diffs of the changes: (+1 -1) RunSafely.sh |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/RunSafely.sh diff -u llvm-test/RunSafely.sh:1.29 llvm-test/RunSafely.sh:1.30 --- llvm-test/RunSafely.sh:1.29 Fri May 4 16:24:42 2007 +++ llvm-test/RunSafely.sh Fri May 4 16:31:42 2007 @@ -102,7 +102,7 @@ fi if [ "x$RHOST" = x ] ; then - ( time -p sh -c "$ULIMITCMD $COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ + ( sh -c "$ULIMITCMD"; time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \ | awk -- '\ BEGIN { cpu = 0.0; } /^user/ { cpu += $2; print; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/build2.c
Changes in directory llvm-test/SingleSource/UnitTests/Vector: build2.c updated: 1.1 -> 1.2 --- Log message: Implement SMALL_PROBLEM_SIZE. --- Diffs of the changes: (+7 -1) build2.c |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/Vector/build2.c diff -u llvm-test/SingleSource/UnitTests/Vector/build2.c:1.1 llvm-test/SingleSource/UnitTests/Vector/build2.c:1.2 --- llvm-test/SingleSource/UnitTests/Vector/build2.c:1.1Fri Apr 21 18:22:23 2006 +++ llvm-test/SingleSource/UnitTests/Vector/build2.cFri May 4 16:43:19 2007 @@ -62,7 +62,13 @@ v4f32 y = {0.0f, 0.0f, 0.0f, 0.0f}; v4f32 z = {0.0f, 0.0f, 0.0f, 0.0f}; - for (j = 0; j < 100; ++j) { +#ifdef SMALL_PROBLEM_SIZE +#define LENGTH 2 +#else +#define LENGTH 100 +#endif + + for (j = 0; j < LENGTH; ++j) { x = (v4f32){0.0f, 0.0f, 0.0f, 0.0f}; y = (v4f32){0.0f, 0.0f, 0.0f, 0.0f}; z = (v4f32){0.0f, 0.0f, 0.0f, 0.0f}; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126898] Use one i32 instead of four i8 while emitting
Revision: 126898 Author: dpatel Date: 2007-05-04 14:44:39 -0700 (Fri, 04 May 2007) Log Message: --- Use one i32 instead of four i8 while emitting tail padding. This addresses first part of PR1278. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp === --- apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 21:04:24 UTC (rev 126897) +++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 21:44:39 UTC (rev 126898) @@ -1452,10 +1452,22 @@ "LLVM type size doesn't match GCC type size!"); uint64_t LLVMLastElementEnd = Info.getNewElementByteOffset(1); const Type *PadTy = Type::Int8Ty; - if (GCCTypeSize-LLVMLastElementEnd != 1) -PadTy = ArrayType::get(PadTy, GCCTypeSize-LLVMStructSize); - Info.addElement(PadTy, GCCTypeSize-LLVMLastElementEnd, - GCCTypeSize-LLVMLastElementEnd); + if (GCCTypeSize-LLVMLastElementEnd != 1) { +unsigned Int32ArraySize = (GCCTypeSize-LLVMStructSize)/4; +unsigned Int8ArraySize = (GCCTypeSize-LLVMStructSize) % 4; +if (Int32ArraySize != 0) { + PadTy = ArrayType::get(Type::Int32Ty, Int32ArraySize); + Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, + Int32ArraySize); +} +if (Int8ArraySize != 0) { + PadTy = ArrayType::get(Type::Int8Ty, Int8ArraySize); + Info.addElement(PadTy, GCCTypeSize - Info.getNewElementByteOffset(1), + Int8ArraySize); +} + } else +Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, +GCCTypeSize - LLVMLastElementEnd); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/Makefile
Changes in directory llvm-test/SingleSource: Makefile updated: 1.12 -> 1.13 --- Log message: Merge Evan's remote test implementation with mine: Allow to define the crosscompilers (cross gcc and cross llvm-gcc). --- Diffs of the changes: (+7 -1) Makefile |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/Makefile diff -u llvm-test/SingleSource/Makefile:1.12 llvm-test/SingleSource/Makefile:1.13 --- llvm-test/SingleSource/Makefile:1.12Wed Sep 1 09:33:26 2004 +++ llvm-test/SingleSource/Makefile Fri May 4 16:50:39 2007 @@ -1,5 +1,11 @@ LEVEL = .. -PARALLEL_DIRS = UnitTests Regression Benchmarks CustomChecked + +PARALLEL_DIRS = UnitTests Regression Benchmarks + +ifndef REMOTE_HOST +PARALLEL_DIRS += CustomChecked +endif + LDFLAGS += -lm include Makefile.singlesrc ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/Makefile.programs Makefile.config.in
Changes in directory llvm-test: Makefile.programs updated: 1.265 -> 1.266 Makefile.config.in updated: 1.25 -> 1.26 --- Log message: Merge Evan's remote test implementation with mine: Allow to define the crosscompilers (cross gcc and cross llvm-gcc). --- Diffs of the changes: (+33 -1) Makefile.config.in | 28 Makefile.programs |6 +- 2 files changed, 33 insertions(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.265 llvm-test/Makefile.programs:1.266 --- llvm-test/Makefile.programs:1.265 Thu May 3 16:32:39 2007 +++ llvm-test/Makefile.programs Fri May 4 16:50:39 2007 @@ -170,6 +170,10 @@ profile:: $(PROFOUTPUT) print-profile:: $(PRINTPROFOUTPUT) +# JIT remote tests are not supported yet. +ifdef REMOTE_HOST + DISABLE_JIT := 1 +endif ifdef RUN_GCC_ONLY DISABLE_DIFFS = 1 @@ -237,7 +241,7 @@ ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts endif -ifeq ($(TARGET_ARCH),ARM) +ifeq ($(ARCH),ARM) LLCBETAOPTION := -march=thumb endif Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.25 llvm-test/Makefile.config.in:1.26 --- llvm-test/Makefile.config.in:1.25 Fri Feb 16 12:23:33 2007 +++ llvm-test/Makefile.config.inFri May 4 16:50:39 2007 @@ -28,6 +28,34 @@ SourceDir=$(PROJ_SRC_DIR) endif +ifdef TARGET_ARCH +ARCH := $(TARGET_ARCH) +endif + +ifdef TARGET_CC +CC := $(TARGET_CC) +endif + +ifdef TARGET_CXX +CXX := $(TARGET_CXX) +endif + +ifdef TARGET_LLVMGCC +LLVMGCC := $(TARGET_LLVMGCC) +endif + +ifdef TARGET_LLVMGXX +LLVMGXX := $(TARGET_LLVMGXX) +endif + +ifdef TARGET_LLVMGCCDIR +LLVMGCCDIR := $(TARGET_LLVMGCCDIR) +endif + +ifdef TARGET_LLVMGCCLIBDIR +LLVMGCCLIBDIR := $(TARGET_LLVMGCCLIBDIR) +endif + # # Provide variables specific to llvm-test # ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp
Nowadays we have two functions for the GV lowering: one for ELF and one for Darwin. So, the ELF and Darwin GV lowering implementations are completely different and ELF doesn't use the auxiliary function GVIsIndirectSymbol. Lauro 2007/5/3, Evan Cheng <[EMAIL PROTECTED]>: No idea. Lauro? Evan On May 3, 2007, at 5:33 PM, Chris Lattner wrote: > > On May 3, 2007, at 5:27 PM, Evan Cheng wrote: > >> >> >> Changes in directory llvm/lib/Target/ARM: >> >> ARMISelLowering.cpp updated: 1.49 -> 1.50 >> --- >> Log message: >> >> On Mac OS X, GV requires an extra load only when relocation-model >> is non-static. > > Does ELF do something similar? If not, this should probably be > method on ARMSubTarget, like the X86 backend does. > > -Chris > >> --- >> Diffs of the changes: (+6 -5) >> >> ARMISelLowering.cpp | 11 ++- >> 1 files changed, 6 insertions(+), 5 deletions(-) >> >> >> Index: llvm/lib/Target/ARM/ARMISelLowering.cpp >> diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.49 llvm/lib/ >> Target/ARM/ARMISelLowering.cpp:1.50 >> --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.49 Thu May 3 >> 15:28:35 2007 >> +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Thu May 3 19:26:58 2007 >> @@ -812,10 +812,11 @@ >> } >> >> /// GVIsIndirectSymbol - true if the GV will be accessed via an >> indirect symbol >> -/// even in dynamic-no-pic mode. >> -static bool GVIsIndirectSymbol(GlobalValue *GV) { >> - return (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || >> - (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode >> ())); >> +/// even in non-static mode. >> +static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model >> RelocM) { >> + return RelocM != Reloc::Static && >> +(GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || >> + (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode())); >> } >> >> SDOperand ARMTargetLowering::LowerGlobalAddressDarwin(SDOperand Op, >> @@ -823,7 +824,7 @@ >>MVT::ValueType PtrVT = getPointerTy(); >>GlobalValue *GV = cast(Op)->getGlobal(); >>Reloc::Model RelocM = getTargetMachine().getRelocationModel(); >> - bool IsIndirect = GVIsIndirectSymbol(GV); >> + bool IsIndirect = GVIsIndirectSymbol(GV, RelocM); >>SDOperand CPAddr; >>if (RelocM == Reloc::Static) >> CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 2); >> >> >> >> ___ >> llvm-commits mailing list >> llvm-commits@cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126898] Use one i32 instead of four i8 while emitting
On May 4, 2007, at 2:44 PM, [EMAIL PROTECTED] wrote: > --- > Use one i32 instead of four i8 while emitting > tail padding. > > This addresses first part of PR1278. Cool. Does this do the right thing if the end of a struct is not 4- byte aligned? If the struct requires 7 bytes of tail padding, for example, it would often be wrong to emit an i32 then [3 x i8], because there will be padding before the i32. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp
On May 4, 2007, at 3:08 PM, Lauro Ramos Venancio wrote: > Nowadays we have two functions for the GV lowering: one for ELF and > one for Darwin. So, the ELF and Darwin GV lowering implementations > are completely different and ELF doesn't use the auxiliary function > GVIsIndirectSymbol. Great point. Thanks Lauro, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/ARM/ARM.td
Changes in directory llvm/lib/Target/ARM: ARM.td updated: 1.4 -> 1.5 --- Log message: Add a processor. --- Diffs of the changes: (+1 -0) ARM.td |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARM.td diff -u llvm/lib/Target/ARM/ARM.td:1.4 llvm/lib/Target/ARM/ARM.td:1.5 --- llvm/lib/Target/ARM/ARM.td:1.4 Fri Jan 19 01:51:42 2007 +++ llvm/lib/Target/ARM/ARM.td Fri May 4 17:16:30 2007 @@ -67,6 +67,7 @@ // V5TE Processors. def : Proc<"arm9e", [ArchV5TE]>; +def : Proc<"arm926ej-s", [ArchV5TE]>; def : Proc<"arm946e-s", [ArchV5TE]>; def : Proc<"arm966e-s", [ArchV5TE]>; def : Proc<"arm968e-s", [ArchV5TE]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126898] Use one i32 instead of four i8 while emitting
On May 4, 2007, at 3:12 PM, Chris Lattner wrote: > > On May 4, 2007, at 2:44 PM, [EMAIL PROTECTED] wrote: > >> --- >> Use one i32 instead of four i8 while emitting >> tail padding. >> >> This addresses first part of PR1278. > > Cool. Does this do the right thing if the end of a struct is not 4- > byte aligned? If the struct requires 7 bytes of tail padding, for > example, it would often be wrong to emit an i32 then [3 x i8], > because there will be padding before the i32. I think, it does right thing. But I'll double check. - Devang ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126898] Use one i32 instead of four i8 while emitting
On May 4, 2007, at 3:17 PM, Devang Patel wrote: > > On May 4, 2007, at 3:12 PM, Chris Lattner wrote: > >> >> On May 4, 2007, at 2:44 PM, [EMAIL PROTECTED] wrote: >> >>> --- >>> Use one i32 instead of four i8 while emitting >>> tail padding. >>> >>> This addresses first part of PR1278. >> >> Cool. Does this do the right thing if the end of a struct is not 4- >> byte aligned? If the struct requires 7 bytes of tail padding, for >> example, it would often be wrong to emit an i32 then [3 x i8], >> because there will be padding before the i32. > > I think, it does right thing. But I'll double check. Thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126899] Revert previous patch.
Revision: 126899 Author: dpatel Date: 2007-05-04 16:10:12 -0700 (Fri, 04 May 2007) Log Message: --- Revert previous patch. It does not handle all cases properly. Modified Paths: -- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp === --- apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 21:44:39 UTC (rev 126898) +++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-05-04 23:10:12 UTC (rev 126899) @@ -1452,22 +1452,10 @@ "LLVM type size doesn't match GCC type size!"); uint64_t LLVMLastElementEnd = Info.getNewElementByteOffset(1); const Type *PadTy = Type::Int8Ty; - if (GCCTypeSize-LLVMLastElementEnd != 1) { -unsigned Int32ArraySize = (GCCTypeSize-LLVMStructSize)/4; -unsigned Int8ArraySize = (GCCTypeSize-LLVMStructSize) % 4; -if (Int32ArraySize != 0) { - PadTy = ArrayType::get(Type::Int32Ty, Int32ArraySize); - Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, - Int32ArraySize); -} -if (Int8ArraySize != 0) { - PadTy = ArrayType::get(Type::Int8Ty, Int8ArraySize); - Info.addElement(PadTy, GCCTypeSize - Info.getNewElementByteOffset(1), - Int8ArraySize); -} - } else -Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd, -GCCTypeSize - LLVMLastElementEnd); + if (GCCTypeSize-LLVMLastElementEnd != 1) +PadTy = ArrayType::get(PadTy, GCCTypeSize-LLVMStructSize); + Info.addElement(PadTy, GCCTypeSize-LLVMLastElementEnd, + GCCTypeSize-LLVMLastElementEnd); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126898] Use one i32 instead of four i8 while emitting
On May 4, 2007, at 3:12 PM, Chris Lattner wrote: > > On May 4, 2007, at 2:44 PM, [EMAIL PROTECTED] wrote: > >> --- >> Use one i32 instead of four i8 while emitting >> tail padding. >> >> This addresses first part of PR1278. > > Cool. Does this do the right thing if the end of a struct is not 4- > byte aligned? It does not. I reverted this patch for now. Thanks for caching this. - Devang > If the struct requires 7 bytes of tail padding, for > example, it would often be wrong to emit an i32 then [3 x i8], > because there will be padding before the i32. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [126898] Use one i32 instead of four i8 while emitting
On May 4, 2007, at 4:11 PM, Devang Patel wrote: > > On May 4, 2007, at 3:12 PM, Chris Lattner wrote: > >> >> On May 4, 2007, at 2:44 PM, [EMAIL PROTECTED] wrote: >> >>> --- >>> Use one i32 instead of four i8 while emitting >>> tail padding. >>> >>> This addresses first part of PR1278. >> >> Cool. Does this do the right thing if the end of a struct is not 4- >> byte aligned? > > It does not. I reverted this patch for now. Thanks for caching this. Thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc patch] when -mthumb is used, we must emit the triple thumb-linux-gnueabi or thumb-apple-darwin
Please, someone commit this patch. This is a bugfix and it is important for thumb remote tests. Lauro Index: gcc/config/arm/arm.h === --- gcc/config/arm/arm.h (revision 319) +++ gcc/config/arm/arm.h (working copy) @@ -2920,4 +2937,7 @@ } \ } +#define LLVM_OVERRIDE_TARGET_ARCH() \ + (TARGET_THUMB ? "thumb" : "arm") + #endif /* ! GCC_ARM_H */ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126900] When -mthumb is used, we must emit the triple thumb-linux-gnueabi or thumb-apple-darwin ( committed for Lauro).
Revision: 126900 Author: echeng Date: 2007-05-04 16:57:27 -0700 (Fri, 04 May 2007) Log Message: --- When -mthumb is used, we must emit the triple thumb-linux-gnueabi or thumb-apple-darwin (committed for Lauro). Modified Paths: -- apple-local/branches/llvm/gcc/config/arm/arm.h Modified: apple-local/branches/llvm/gcc/config/arm/arm.h === --- apple-local/branches/llvm/gcc/config/arm/arm.h 2007-05-04 23:10:12 UTC (rev 126899) +++ apple-local/branches/llvm/gcc/config/arm/arm.h 2007-05-04 23:57:27 UTC (rev 126900) @@ -2920,4 +2920,7 @@ } \ } +#define LLVM_OVERRIDE_TARGET_ARCH() \ + (TARGET_THUMB ? "thumb" : "arm") + #endif /* ! GCC_ARM_H */ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [126901] LLVM_OVERRIDE_TARGET_ARCH should return empty string if it doesn' t override the default target.
Revision: 126901 Author: echeng Date: 2007-05-04 16:59:58 -0700 (Fri, 04 May 2007) Log Message: --- LLVM_OVERRIDE_TARGET_ARCH should return empty string if it doesn't override the default target. Modified Paths: -- apple-local/branches/llvm/gcc/config/arm/arm.h Modified: apple-local/branches/llvm/gcc/config/arm/arm.h === --- apple-local/branches/llvm/gcc/config/arm/arm.h 2007-05-04 23:57:27 UTC (rev 126900) +++ apple-local/branches/llvm/gcc/config/arm/arm.h 2007-05-04 23:59:58 UTC (rev 126901) @@ -2921,6 +2921,6 @@ } #define LLVM_OVERRIDE_TARGET_ARCH() \ - (TARGET_THUMB ? "thumb" : "arm") + (TARGET_THUMB ? "thumb" : "") #endif /* ! GCC_ARM_H */ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/Makefile.config.in
Changes in directory llvm-test: Makefile.config.in updated: 1.26 -> 1.27 --- Log message: Enable thumb tests. --- Diffs of the changes: (+4 -0) Makefile.config.in |4 1 files changed, 4 insertions(+) Index: llvm-test/Makefile.config.in diff -u llvm-test/Makefile.config.in:1.26 llvm-test/Makefile.config.in:1.27 --- llvm-test/Makefile.config.in:1.26 Fri May 4 16:50:39 2007 +++ llvm-test/Makefile.config.inFri May 4 19:00:36 2007 @@ -56,6 +56,10 @@ LLVMGCCLIBDIR := $(TARGET_LLVMGCCLIBDIR) endif +ifeq ($(ARCH),THUMB) +TARGET_FLAGS += -mthumb +endif + # # Provide variables specific to llvm-test # ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm-gcc patch] when -mthumb is used, we must emit the triple thumb-linux-gnueabi or thumb-apple-darwin
Actually LLVM_OVERRIDE_TARGET_ARCH should return "" if the default should not be overridden. Committed. Thanks, Evan On May 4, 2007, at 4:41 PM, Lauro Ramos Venancio wrote: > Please, someone commit this patch. This is a bugfix and it is > important for thumb remote tests. > > Lauro > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h
Changes in directory llvm/include/llvm/Bitcode: BitCodes.h updated: 1.5 -> 1.6 BitstreamReader.h updated: 1.14 -> 1.15 BitstreamWriter.h updated: 1.10 -> 1.11 --- Log message: Implement support for globally associating abbrevs with block IDs, which relieves us from having to emit the abbrevs into each instance of the block. This shrinks kc.bit from 3368K to K, but will be a more significant win once instructions are abbreviated. The VST went from: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.29508e+07b/1.61885e+06B/404713W Average Size: 5522.73b/690.342B/172.585W % of file: 48.0645 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 7035/3 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 to: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.26713e+07b/1.58391e+06B/395978W Average Size: 5403.53b/675.442B/168.86W % of file: 47.5198 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 0/0 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 because we didn't emit the same 3 abbrevs 2345 times :) --- Diffs of the changes: (+213 -12) BitCodes.h|5 +- BitstreamReader.h | 102 ++ BitstreamWriter.h | 118 +- 3 files changed, 213 insertions(+), 12 deletions(-) Index: llvm/include/llvm/Bitcode/BitCodes.h diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.5 llvm/include/llvm/Bitcode/BitCodes.h:1.6 --- llvm/include/llvm/Bitcode/BitCodes.h:1.5Fri May 4 15:33:47 2007 +++ llvm/include/llvm/Bitcode/BitCodes.hFri May 4 19:16:30 2007 @@ -66,8 +66,9 @@ /// BlockInfoCodes - The blockinfo block contains metadata about user-defined /// blocks. enum BlockInfoCodes { -BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#] -BLOCKINFO_CODE_ABBREV = 2 // ABBREV: [standard abbrev encoding] +BLOCKINFO_CODE_SETBID = 1 // SETBID: [blockid#] +// DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd +// block, instead of the BlockInfo block. // BLOCKNAME: give string name to block, if desired. }; Index: llvm/include/llvm/Bitcode/BitstreamReader.h diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.14 llvm/include/llvm/Bitcode/BitstreamReader.h:1.15 --- llvm/include/llvm/Bitcode/BitstreamReader.h:1.14Fri May 4 15:33:47 2007 +++ llvm/include/llvm/Bitcode/BitstreamReader.h Fri May 4 19:16:30 2007 @@ -48,6 +48,14 @@ /// BlockScope - This tracks the codesize of parent blocks. SmallVector BlockScope; + /// BlockInfo - This contains information emitted to BLOCKINFO_BLOCK blocks. + /// These describe abbreviations that all blocks of the specified ID inherit. + struct BlockInfo { +unsigned BlockID; +std::vector Abbrevs; + }; + std::vector BlockInfoRecords; + /// FirstChar - This remembers the first byte of the stream. const unsigned char *FirstChar; public: @@ -82,6 +90,15 @@ for (unsigned i = 0, e = Abbrevs.size(); i != e; ++i) Abbrevs[i]->dropRef(); } + +// Free the BlockInfoRecords. +while (!BlockInfoRecords.empty()) { + BlockInfo &Info = BlockInfoRecords.back(); + // Free blockinfo abbrev info. + for (unsigned i = 0, e = Info.Abbrevs.size(); i != e; ++i) +Info.Abbrevs[i]->dropRef(); + BlockInfoRecords.pop_back(); +} } bool AtEndOfStream() const { return NextChar == LastChar; } @@ -206,6 +223,22 @@ // Block Manipulation //======// +private: + /// getBlockInfo - If there is block info for the specified ID, return it, + /// otherwise return null. + BlockInfo *getBlockInfo(unsigned BlockID) { +// Common case, the most recent entry matches BlockID. +if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID) + return &BlockInfoRecords.back(); + +for (unsigned i = 0, e = BlockInfoRecords.size(); i != e; ++i) + if (BlockInfoRecords[i].BlockID == BlockID) +return &BlockInfoRecords[i]; +return 0; + } +public: + + // Block header: //[ENTER_SUBBLOCK, blockid, newcodelen, , blocklen] @@ -236,10 +269,19 @@ /// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, read and enter /// the block, returning the BlockID of the block we just entered. - bool EnterSubBlock(unsigned *NumWordsP = 0) { + bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0) { +// Save the current block's state on BlockScope. BlockScope.push_back(Block(CurCodeSize)); BlockScope.back().PrevAbbrevs.swap(CurAbbrevs); +// Add the abbrevs specific to this block to the CurAbbrevs list. +if (BlockInfo *Info = getBlockInfo(BlockID)) { + for (unsigned i = 0, e = Info->Abbrevs.size(); i != e; ++i) { +CurAbbrevs.push_back(Info->Abbrevs[i]); +CurAbbrevs.back()
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.35 -> 1.36 --- Log message: Implement support for globally associating abbrevs with block IDs, which relieves us from having to emit the abbrevs into each instance of the block. This shrinks kc.bit from 3368K to K, but will be a more significant win once instructions are abbreviated. The VST went from: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.29508e+07b/1.61885e+06B/404713W Average Size: 5522.73b/690.342B/172.585W % of file: 48.0645 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 7035/3 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 to: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.26713e+07b/1.58391e+06B/395978W Average Size: 5403.53b/675.442B/168.86W % of file: 47.5198 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 0/0 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 because we didn't emit the same 3 abbrevs 2345 times :) --- Diffs of the changes: (+33 -42) BitcodeWriter.cpp | 75 +++--- 1 files changed, 33 insertions(+), 42 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.35 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.36 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.35 Fri May 4 16:31:13 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 19:17:00 2007 @@ -714,36 +714,6 @@ if (VST.empty()) return; Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); - { // 8-bit fixed-width VST_ENTRY/VST_BBENTRY strings. -BitCodeAbbrev *Abbv = new BitCodeAbbrev(); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); -if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_8_ABBREV) - assert(0 && "Unexpected abbrev ordering!"); - } - - { // 7-bit fixed width VST_ENTRY strings. -BitCodeAbbrev *Abbv = new BitCodeAbbrev(); -Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); -if (Stream.EmitAbbrev(Abbv) != VST_ENTRY_7_ABBREV) - assert(0 && "Unexpected abbrev ordering!"); - } - { // 7-bit fixed width VST_BBENTRY strings. -BitCodeAbbrev *Abbv = new BitCodeAbbrev(); -Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTRY)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); -if (Stream.EmitAbbrev(Abbv) != VST_BBENTRY_7_ABBREV) - assert(0 && "Unexpected abbrev ordering!"); - } - - // FIXME: Set up the abbrev, we know how many values there are! // FIXME: We know if the type names can use 7-bit ascii. SmallVector NameVals; @@ -909,19 +879,40 @@ // We only want to emit block info records for blocks that have multiple // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK. Other // blocks can defined their abbrevs inline. - Stream.EnterSubblock(bitc::BLOCKINFO_BLOCK_ID, 2); - -#if 0 - // Configure TYPE_SYMTAB_BLOCK's. - - // Add an abbrev for VST_ENTRY where the characters each fit in 7 bits. - BitCodeAbbrev *Abbv = new BitCodeAbbrev(); - Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8); // Value ID - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage. + Stream.EnterBlockInfoBlock(2); + + { // 8-bit fixed-width VST_ENTRY/VST_BBENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); +if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, + Abbv) != VST_ENTRY_8_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } + + { // 7-bit fixed width VST_ENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); +if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, + Abbv) != VST_ENTRY_7_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } + { // 7-bit fixed width VST_BBENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTR
[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Changes in directory llvm/lib/Bitcode/Reader: BitcodeReader.cpp updated: 1.37 -> 1.38 --- Log message: Implement support for globally associating abbrevs with block IDs, which relieves us from having to emit the abbrevs into each instance of the block. This shrinks kc.bit from 3368K to K, but will be a more significant win once instructions are abbreviated. The VST went from: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.29508e+07b/1.61885e+06B/404713W Average Size: 5522.73b/690.342B/172.585W % of file: 48.0645 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 7035/3 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 to: Block ID #14 (VALUE_SYMTAB): Num Instances: 2345 Total Size: 1.26713e+07b/1.58391e+06B/395978W Average Size: 5403.53b/675.442B/168.86W % of file: 47.5198 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 0/0 Tot/Avg Records: 120924/51.5667 % Abbrev Recs: 100 because we didn't emit the same 3 abbrevs 2345 times :) --- Diffs of the changes: (+18 -10) BitcodeReader.cpp | 28 ++-- 1 files changed, 18 insertions(+), 10 deletions(-) Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.37 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.38 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.37 Fri May 4 14:11:41 2007 +++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp Fri May 4 19:17:00 2007 @@ -182,7 +182,7 @@ //===--===// bool BitcodeReader::ParseParamAttrBlock() { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::PARAMATTR_BLOCK_ID)) return Error("Malformed block record"); if (!ParamAttrs.empty()) @@ -239,7 +239,7 @@ bool BitcodeReader::ParseTypeTable() { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::TYPE_BLOCK_ID)) return Error("Malformed block record"); if (!TypeList.empty()) @@ -378,7 +378,7 @@ bool BitcodeReader::ParseTypeSymbolTable() { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::TYPE_SYMTAB_BLOCK_ID)) return Error("Malformed block record"); SmallVector Record; @@ -426,7 +426,7 @@ } bool BitcodeReader::ParseValueSymbolTable() { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::VALUE_SYMTAB_BLOCK_ID)) return Error("Malformed block record"); SmallVector Record; @@ -536,7 +536,7 @@ bool BitcodeReader::ParseConstants() { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::CONSTANTS_BLOCK_ID)) return Error("Malformed block record"); SmallVector Record; @@ -768,7 +768,7 @@ if (TheModule) return Error("Multiple MODULE_BLOCKs in same stream"); - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID)) return Error("Malformed block record"); // Otherwise, create the module. @@ -1022,11 +1022,19 @@ unsigned BlockID = Stream.ReadSubBlockID(); // We only know the MODULE subblock ID. -if (BlockID == bitc::MODULE_BLOCK_ID) { +switch (BlockID) { +case bitc::BLOCKINFO_BLOCK_ID: + if (Stream.ReadBlockInfoBlock()) +return Error("Malformed BlockInfoBlock"); + break; +case bitc::MODULE_BLOCK_ID: if (ParseModule(Buffer->getBufferIdentifier())) return true; -} else if (Stream.SkipBlock()) { - return Error("Malformed block record"); + break; +default: + if (Stream.SkipBlock()) +return Error("Malformed block record"); + break; } } @@ -1072,7 +1080,7 @@ /// ParseFunctionBody - Lazily parse the specified function body block. bool BitcodeReader::ParseFunctionBody(Function *F) { - if (Stream.EnterSubBlock()) + if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID)) return Error("Malformed block record"); unsigned ModuleValueListSize = ValueList.size(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
Changes in directory llvm/tools/llvm-bcanalyzer: llvm-bcanalyzer.cpp updated: 1.17 -> 1.18 --- Log message: update to new APIs, make output a bit (haha) nicer --- Diffs of the changes: (+35 -5) llvm-bcanalyzer.cpp | 40 +++- 1 files changed, 35 insertions(+), 5 deletions(-) Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.17 llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.18 --- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.17 Thu May 3 22:01:41 2007 +++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri May 4 19:17:42 2007 @@ -75,6 +75,13 @@ /// GetBlockName - Return a symbolic block name if known, otherwise return /// null. static const char *GetBlockName(unsigned BlockID) { + // Standard blocks for all bitcode files. + if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) { +if (BlockID == bitc::BLOCKINFO_BLOCK_ID) + return "BLOCKINFO_BLOCK"; +return 0; + } + if (CurStreamType != LLVMIRBitstream) return 0; switch (BlockID) { @@ -92,6 +99,18 @@ /// GetCodeName - Return a symbolic code name if known, otherwise return /// null. static const char *GetCodeName(unsigned CodeID, unsigned BlockID) { + // Standard blocks for all bitcode files. + if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) { +if (BlockID == bitc::BLOCKINFO_BLOCK_ID) { + switch (CodeID) { + default: return 0; + case bitc::MODULE_CODE_VERSION: return "VERSION"; + } +} +return 0; + } + + if (CurStreamType != LLVMIRBitstream) return 0; switch (BlockID) { @@ -231,6 +250,7 @@ /// ParseBlock - Read a block, updating statistics, etc. static bool ParseBlock(BitstreamReader &Stream, unsigned IndentLevel) { + std::string Indent(IndentLevel*2, ' '); uint64_t BlockBitStart = Stream.GetCurrentBitNo(); unsigned BlockID = Stream.ReadSubBlockID(); @@ -239,11 +259,20 @@ BlockStats.NumInstances++; + // BLOCKINFO is a special part of the stream. + if (BlockID == bitc::BLOCKINFO_BLOCK_ID) { +if (Dump) std::cerr << Indent << "\n"; +if (Stream.ReadBlockInfoBlock()) + return Error("Malformed BlockInfoBlock"); +uint64_t BlockBitEnd = Stream.GetCurrentBitNo(); +BlockStats.NumBits += BlockBitEnd-BlockBitStart; +return false; + } + unsigned NumWords = 0; - if (Stream.EnterSubBlock(&NumWords)) + if (Stream.EnterSubBlock(BlockID, &NumWords)) return Error("Malformed block record"); - std::string Indent(IndentLevel*2, ' '); const char *BlockName = 0; if (Dump) { std::cerr << Indent << "<"; @@ -315,7 +344,7 @@ for (unsigned i = 0, e = Record.size(); i != e; ++i) std::cerr << " op" << i << "=" << (int64_t)Record[i]; -std::cerr << ">\n"; +std::cerr << "/>\n"; } break; @@ -418,8 +447,9 @@ << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n"; std::cerr << "Tot/Avg Records: " << Stats.NumRecords << "/" << Stats.NumRecords/(double)Stats.NumInstances << "\n"; -std::cerr << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/ - (double)Stats.NumRecords)*100 << "\n"; +if (Stats.NumRecords) + std::cerr << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/ + (double)Stats.NumRecords)*100 << "\n"; std::cerr << "\n"; } return 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.36 -> 1.37 --- Log message: add an abbreviation for the type symtab, this shrinks the TST from 175197 bits to 103165 bits: Old: Block ID #13 (TYPE_SYMTAB): Num Instances: 1 Total Size: 175197b/21899.6B/5474.91W Average Size: 175197b/21899.6B/5474.91W % of file: 0.657023 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 0/0 Tot/Avg Records: 255/255 % Abbrev Recs: 0 New: Block ID #13 (TYPE_SYMTAB): Num Instances: 1 Total Size: 103165b/12895.6B/3223.91W Average Size: 103165b/12895.6B/3223.91W % of file: 0.387937 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 1/1 Tot/Avg Records: 255/255 % Abbrev Recs: 100 --- Diffs of the changes: (+16 -8) BitcodeWriter.cpp | 24 1 files changed, 16 insertions(+), 8 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.36 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.37 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.36 Fri May 4 19:17:00 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 19:47:19 2007 @@ -798,24 +798,32 @@ Stream.EnterSubblock(bitc::TYPE_SYMTAB_BLOCK_ID, 3); - // FIXME: Set up the abbrev, we know how many types there are! - // FIXME: We know if the type names can use 7-bit ascii. + // 7-bit fixed width VST_CODE_ENTRY strings. + BitCodeAbbrev *Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getTypes().size()+1))); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); + unsigned V7Abbrev = Stream.EmitAbbrev(Abbv); SmallVector NameVals; for (TypeSymbolTable::const_iterator TI = TST.begin(), TE = TST.end(); TI != TE; ++TI) { -unsigned AbbrevToUse = 0; - -// TST_ENTRY: [typeid, namelen, namechar x N] +// TST_ENTRY: [typeid, namechar x N] NameVals.push_back(VE.getTypeID(TI->second)); const std::string &Str = TI->first; -for (unsigned i = 0, e = Str.size(); i != e; ++i) - NameVals.push_back(Str[i]); +bool is7Bit = true; +for (unsigned i = 0, e = Str.size(); i != e; ++i) { + NameVals.push_back((unsigned char)Str[i]); + if (Str[i] & 128) +is7Bit = false; +} // Emit the finished record. -Stream.EmitRecord(bitc::VST_CODE_ENTRY, NameVals, AbbrevToUse); +Stream.EmitRecord(bitc::VST_CODE_ENTRY, NameVals, is7Bit ? V7Abbrev : 0); NameVals.clear(); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h
Changes in directory llvm/include/llvm/Bitcode: BitCodes.h updated: 1.6 -> 1.7 BitstreamReader.h updated: 1.15 -> 1.16 BitstreamWriter.h updated: 1.11 -> 1.12 --- Log message: add a 6-bit encoding type for strings. --- Diffs of the changes: (+38 -3) BitCodes.h| 35 --- BitstreamReader.h |3 +++ BitstreamWriter.h |3 +++ 3 files changed, 38 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Bitcode/BitCodes.h diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.6 llvm/include/llvm/Bitcode/BitCodes.h:1.7 --- llvm/include/llvm/Bitcode/BitCodes.h:1.6Fri May 4 19:16:30 2007 +++ llvm/include/llvm/Bitcode/BitCodes.hFri May 4 20:15:42 2007 @@ -85,15 +85,15 @@ unsigned Enc : 3; // The encoding to use. public: enum Encoding { -Fixed = 1, // A fixed with field, Val specifies number of bits. +Fixed = 1, // A fixed width field, Val specifies number of bits. VBR = 2, // A VBR field where Val specifies the width of each chunk. -Array = 3 // A sequence of fields, next field species elt encoding. +Array = 3, // A sequence of fields, next field species elt encoding. +Char6 = 4 // A 6-bit fixed field which maps to [a-zA-Z0-9._]. }; BitCodeAbbrevOp(uint64_t V) : Val(V), IsLiteral(true) {} BitCodeAbbrevOp(Encoding E, uint64_t Data = 0) : Val(Data), IsLiteral(false), Enc(E) {} - bool isLiteral() const { return IsLiteral; } bool isEncoding() const { return !IsLiteral; } @@ -116,9 +116,38 @@ case VBR: return true; case Array: +case Char6: return false; } } + + /// isChar6 - Return true if this character is legal in the Char6 encoding. + static bool isChar6(char C) { +if (C >= 'a' && C <= 'z') return true; +if (C >= 'A' && C <= 'Z') return true; +if (C >= '0' && C <= '9') return true; +if (C == '.' || C == '_') return true; +return false; + } + static unsigned EncodeChar6(char C) { +if (C >= 'a' && C <= 'z') return C-'a'; +if (C >= 'A' && C <= 'Z') return C-'A'+26; +if (C >= '0' && C <= '9') return C-'0'+26+26; +if (C == '.') return 62; +if (C == '_') return 63; +assert(0 && "Not a value Char6 character!"); + } + + static char DecodeChar6(unsigned V) { +assert((V & ~63) == 0 && "Not a Char6 encoded character!"); +if (V < 26) return V+'a'; +if (V < 26+26) return V-26+'A'; +if (V < 26+26+10) return V-26-26+'0'; +if (V == 62) return '.'; +if (V == 63) return '_'; +assert(0 && "Not a value Char6 character!"); + } + }; /// BitCodeAbbrev - This class represents an abbreviation record. An Index: llvm/include/llvm/Bitcode/BitstreamReader.h diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.15 llvm/include/llvm/Bitcode/BitstreamReader.h:1.16 --- llvm/include/llvm/Bitcode/BitstreamReader.h:1.15Fri May 4 19:16:30 2007 +++ llvm/include/llvm/Bitcode/BitstreamReader.h Fri May 4 20:15:42 2007 @@ -332,6 +332,9 @@ case BitCodeAbbrevOp::VBR: Vals.push_back(ReadVBR64(Op.getEncodingData())); break; + case BitCodeAbbrevOp::Char6: +Vals.push_back(BitCodeAbbrevOp::DecodeChar6(Read(6))); +break; } } } Index: llvm/include/llvm/Bitcode/BitstreamWriter.h diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.11 llvm/include/llvm/Bitcode/BitstreamWriter.h:1.12 --- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.11Fri May 4 19:16:30 2007 +++ llvm/include/llvm/Bitcode/BitstreamWriter.h Fri May 4 20:15:42 2007 @@ -260,6 +260,9 @@ case BitCodeAbbrevOp::VBR: EmitVBR(V, Op.getEncodingData()); break; +case BitCodeAbbrevOp::Char6: + Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6); + break; } } public: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.37 -> 1.38 --- Log message: add a char6 abbrev for bbnames and value names. This represents each character with 6 bits where possible. This shrinks kc++ from 3324164B to 3183584B. The old VST was: Block ID #14 (VALUE_SYMTAB): Total Size: 1.26713e+07b/1.58391e+06B/395978W Average Size: 5403.53b/675.442B/168.86W % of file: 47.6484 The new one is: Block ID #14 (VALUE_SYMTAB): Total Size: 1.15467e+07b/1.44334e+06B/360834W Average Size: 4923.96b/615.495B/153.874W % of file: 45.3368 This is 11% smaller than the VST in the bytecode format. --- Diffs of the changes: (+30 -12) BitcodeWriter.cpp | 42 ++ 1 files changed, 30 insertions(+), 12 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.37 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.38 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.37 Fri May 4 19:47:19 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Fri May 4 20:26:50 2007 @@ -33,8 +33,8 @@ // VALUE_SYMTAB_BLOCK abbrev id's. VST_ENTRY_8_ABBREV = bitc::FIRST_APPLICATION_ABBREV, VST_ENTRY_7_ABBREV, - VST_BBENTRY_7_ABBREV - + VST_ENTRY_6_ABBREV, + VST_BBENTRY_6_ABBREV }; @@ -712,7 +712,7 @@ const ValueEnumerator &VE, BitstreamWriter &Stream) { if (VST.empty()) return; - Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 3); + Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4); // FIXME: Set up the abbrev, we know how many values there are! // FIXME: We know if the type names can use 7-bit ascii. @@ -725,12 +725,16 @@ // Figure out the encoding to use for the name. bool is7Bit = true; -for (unsigned i = 0, e = Name.getKeyLength(); i != e; ++i) - if ((unsigned char)Name.getKeyData()[i] & 128) { +bool isChar6 = true; +for (const char *C = Name.getKeyData(), *E = C+Name.getKeyLength(); + C != E; ++C) { + if (isChar6) +isChar6 = BitCodeAbbrevOp::isChar6(*C); + if ((unsigned char)*C & 128) { is7Bit = false; -break; +break; // don't bother scanning the rest. } - +} unsigned AbbrevToUse = VST_ENTRY_8_ABBREV; @@ -739,10 +743,14 @@ unsigned Code; if (isa(SI->getValue())) { Code = bitc::VST_CODE_BBENTRY; - if (is7Bit) AbbrevToUse = VST_BBENTRY_7_ABBREV; + if (isChar6) +AbbrevToUse = VST_BBENTRY_6_ABBREV; } else { Code = bitc::VST_CODE_ENTRY; - if (is7Bit) AbbrevToUse = VST_ENTRY_7_ABBREV; + if (isChar6) +AbbrevToUse = VST_ENTRY_6_ABBREV; + else if (is7Bit) +AbbrevToUse = VST_ENTRY_7_ABBREV; } NameVals.push_back(VE.getValueID(SI->getValue())); @@ -910,14 +918,24 @@ Abbv) != VST_ENTRY_7_ABBREV) assert(0 && "Unexpected abbrev ordering!"); } - { // 7-bit fixed width VST_BBENTRY strings. + { // 6-bit char6 VST_ENTRY strings. +BitCodeAbbrev *Abbv = new BitCodeAbbrev(); +Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6)); +if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, + Abbv) != VST_ENTRY_6_ABBREV) + assert(0 && "Unexpected abbrev ordering!"); + } + { // 6-bit char6 VST_BBENTRY strings. BitCodeAbbrev *Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTRY)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); -Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); +Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6)); if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, - Abbv) != VST_BBENTRY_7_ABBREV) + Abbv) != VST_BBENTRY_6_ABBREV) assert(0 && "Unexpected abbrev ordering!"); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
Changes in directory llvm/tools/llvm-bcanalyzer: llvm-bcanalyzer.cpp updated: 1.18 -> 1.19 --- Log message: do not charge subblock sizes to the parent block. --- Diffs of the changes: (+7 -1) llvm-bcanalyzer.cpp |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.18 llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.19 --- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.18 Fri May 4 19:17:42 2007 +++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri May 4 20:29:31 2007 @@ -312,11 +312,17 @@ } return false; } -case bitc::ENTER_SUBBLOCK: +case bitc::ENTER_SUBBLOCK: { + uint64_t SubBlockBitStart = Stream.GetCurrentBitNo(); if (ParseBlock(Stream, IndentLevel+1)) return true; ++BlockStats.NumSubBlocks; + uint64_t SubBlockBitEnd = Stream.GetCurrentBitNo(); + + // Don't include subblock sizes in the size of this block. + BlockBitStart += SubBlockBitEnd-SubBlockBitStart; break; +} case bitc::DEFINE_ABBREV: Stream.ReadAbbrevRecord(); ++BlockStats.NumAbbrevs; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
Changes in directory llvm/tools/llvm-bcanalyzer: llvm-bcanalyzer.cpp updated: 1.19 -> 1.20 --- Log message: emit spiffy little histograms of codes, if enabled. Don't print averages if there is only one item. --- Diffs of the changes: (+47 -11) llvm-bcanalyzer.cpp | 58 ++-- 1 files changed, 47 insertions(+), 11 deletions(-) Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.19 llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.20 --- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.19 Fri May 4 20:29:31 2007 +++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri May 4 20:46:49 2007 @@ -41,6 +41,7 @@ #include "llvm/System/Signals.h" #include #include +#include using namespace llvm; static cl::opt @@ -58,6 +59,8 @@ //===--===// static cl::opt Bitcode("bitcode", cl::desc("Read a bitcode file")); +static cl::opt NoHistogram("disable-histogram", + cl::desc("Do not print per-code histogram")); static cl::opt NonSymbolic("non-symbolic", @@ -110,7 +113,6 @@ return 0; } - if (CurStreamType != LLVMIRBitstream) return 0; switch (BlockID) { @@ -232,6 +234,9 @@ /// number that are abbreviated. unsigned NumRecords, NumAbbreviatedRecords; + /// CodeFreq - Keep track of the number of times we see each code. + std::vector CodeFreq; + PerBlockIDStats() : NumInstances(0), NumBits(0), NumSubBlocks(0), NumAbbrevs(0), NumRecords(0), NumAbbreviatedRecords(0) {} @@ -334,7 +339,11 @@ Record.clear(); unsigned Code = Stream.ReadRecord(AbbrevID, Record); - // TODO: Compute per-blockid/code stats. + + // Increment the # occurrences of this code. + if (BlockStats.CodeFreq.size() <= Code) +BlockStats.CodeFreq.resize(Code+1); + BlockStats.CodeFreq[Code]++; if (Dump) { std::cerr << Indent << " <"; @@ -442,21 +451,48 @@ std::cerr << " Total Size: "; PrintSize(Stats.NumBits); std::cerr << "\n"; -std::cerr << " Average Size: "; -PrintSize(Stats.NumBits/(double)Stats.NumInstances); -std::cerr << "\n"; std::cerr << " % of file: " << Stats.NumBits/(double)BufferSizeBits*100 << "\n"; -std::cerr << " Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/" - << Stats.NumSubBlocks/(double)Stats.NumInstances << "\n"; -std::cerr << "Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/" - << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n"; -std::cerr << "Tot/Avg Records: " << Stats.NumRecords << "/" - << Stats.NumRecords/(double)Stats.NumInstances << "\n"; +if (Stats.NumInstances > 1) { + std::cerr << " Average Size: "; + PrintSize(Stats.NumBits/(double)Stats.NumInstances); + std::cerr << "\n"; + std::cerr << " Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/" +<< Stats.NumSubBlocks/(double)Stats.NumInstances << "\n"; + std::cerr << "Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/" +<< Stats.NumAbbrevs/(double)Stats.NumInstances << "\n"; + std::cerr << "Tot/Avg Records: " << Stats.NumRecords << "/" +<< Stats.NumRecords/(double)Stats.NumInstances << "\n"; +} else { + std::cerr << " Num SubBlocks: " << Stats.NumSubBlocks << "\n"; + std::cerr << "Num Abbrevs: " << Stats.NumAbbrevs << "\n"; + std::cerr << "Num Records: " << Stats.NumRecords << "\n"; +} if (Stats.NumRecords) std::cerr << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/ (double)Stats.NumRecords)*100 << "\n"; std::cerr << "\n"; + +// Print a histogram of the codes we see. +if (!NoHistogram && !Stats.CodeFreq.empty()) { + std::vector > FreqPairs; // + for (unsigned i = 0, e = Stats.CodeFreq.size(); i != e; ++i) +if (unsigned Freq = Stats.CodeFreq[i]) + FreqPairs.push_back(std::make_pair(Freq, i)); + std::stable_sort(FreqPairs.begin(), FreqPairs.end()); + std::reverse(FreqPairs.begin(), FreqPairs.end()); + + std::cerr << "\tCode Histogram:\n"; + for (unsigned i = 0, e = FreqPairs.size(); i != e; ++i) { +std::cerr << "\t\t" << FreqPairs[i].first << "\t"; +if (const char *CodeName = GetCodeName(FreqPairs[i].second, I->first)) + std::cerr << CodeName << "\n"; +else + std::cerr << "UnknownCode" << FreqPairs[i].second << "\n"; + } + std::cerr << "\n"; + +} } return 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-05-04-Crash.ll
Changes in directory llvm/test/Transforms/InstCombine: 2007-05-04-Crash.ll added (r1.1) --- Log message: new testacse for PR1384: http://llvm.org/PR1384 --- Diffs of the changes: (+30 -0) 2007-05-04-Crash.ll | 30 ++ 1 files changed, 30 insertions(+) Index: llvm/test/Transforms/InstCombine/2007-05-04-Crash.ll diff -c /dev/null llvm/test/Transforms/InstCombine/2007-05-04-Crash.ll:1.1 *** /dev/null Fri May 4 20:59:15 2007 --- llvm/test/Transforms/InstCombine/2007-05-04-Crash.llFri May 4 20:59:05 2007 *** *** 0 --- 1,30 + ; RUN: llvm-as < %s | opt -instcombine -disable-output + ; PR1384 + + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "i686-apple-darwin8" + %struct.CFRuntimeBase = type { i32, [4 x i8] } + %struct.CGColor = type opaque + %struct.CGColorSpace = type { %struct.CFRuntimeBase, i8, i8, i8, i32, i32, i32, %struct.CGColor*, float*, %struct.CGMD5Signature, %struct.CGMD5Signature*, [0 x %struct.CGColorSpaceDescriptor] } + %struct.CGColorSpaceCalibratedRGBData = type { [3 x float], [3 x float], [3 x float], [9 x float] } + %struct.CGColorSpaceDescriptor = type { %struct.CGColorSpaceCalibratedRGBData } + %struct.CGColorSpaceLabData = type { [3 x float], [3 x float], [4 x float] } + %struct.CGMD5Signature = type { [16 x i8], i8 } + + declare fastcc %struct.CGColorSpace* @CGColorSpaceCreate(i32, i32) + + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) + + define %struct.CGColorSpace* @CGColorSpaceCreateLab(float* %whitePoint, float* %blackPoint, float* %range) { + entry: + %tmp17 = call fastcc %struct.CGColorSpace* @CGColorSpaceCreate( i32 5, i32 3 ) ; <%struct.CGColorSpace*> [#uses=2] + %tmp28 = getelementptr %struct.CGColorSpace* %tmp17, i32 0, i32 11 ; <[0 x %struct.CGColorSpaceDescriptor]*> [#uses=1] + %tmp29 = getelementptr [0 x %struct.CGColorSpaceDescriptor]* %tmp28, i32 0, i32 0 ; <%struct.CGColorSpaceDescriptor*> [#uses=1] + %tmp30 = getelementptr %struct.CGColorSpaceDescriptor* %tmp29, i32 0, i32 0 ; <%struct.CGColorSpaceCalibratedRGBData*> [#uses=1] + %tmp3031 = bitcast %struct.CGColorSpaceCalibratedRGBData* %tmp30 to %struct.CGColorSpaceLabData*; <%struct.CGColorSpaceLabData*> [#uses=1] + %tmp45 = getelementptr %struct.CGColorSpaceLabData* %tmp3031, i32 0, i32 2 ; <[4 x float]*> [#uses=1] + %tmp46 = getelementptr [4 x float]* %tmp45, i32 0, i32 0 ; [#uses=1] + %tmp4648 = bitcast float* %tmp46 to i8* ; [#uses=1] + call void @llvm.memcpy.i32( i8* %tmp4648, i8* null, i32 16, i32 4 ) + ret %struct.CGColorSpace* %tmp17 + } ___ 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.757 -> 1.758 --- Log message: Fix InstCombine/2007-05-04-Crash.ll and PR1384: http://llvm.org/PR1384 --- Diffs of the changes: (+14 -10) InstructionCombining.cpp | 24 ++-- 1 files changed, 14 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.757 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.758 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.757 Wed May 2 20:11:54 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri May 4 20:59:31 2007 @@ -6404,21 +6404,25 @@ if (GEPIdxTy->isSized()) { SmallVector NewIndices; - // Start with the index over the outer type. + // Start with the index over the outer type. Note that the type size + // might be zero (even if the offset isn't zero) if the indexed type + // is something like [0 x {int, int}] const Type *IntPtrTy = TD->getIntPtrType(); - int64_t TySize = TD->getTypeSize(GEPIdxTy); - int64_t FirstIdx = Offset/TySize; - Offset %= TySize; + int64_t FirstIdx = 0; + if (int64_t TySize = TD->getTypeSize(GEPIdxTy)) { +FirstIdx = Offset/TySize; +Offset %= TySize; - // Handle silly modulus not returning values values [0..TySize). - if (Offset < 0) { ---FirstIdx; -Offset += TySize; -assert(Offset >= 0); +// Handle silly modulus not returning values values [0..TySize). +if (Offset < 0) { + --FirstIdx; + Offset += TySize; + assert(Offset >= 0); +} +assert((uint64_t)Offset < (uint64_t)TySize && "Out of range offset"); } NewIndices.push_back(ConstantInt::get(IntPtrTy, FirstIdx)); - assert((uint64_t)Offset < (uint64_t)TySize && "Out of range offset"); // Index into the types. If we fail, set OrigBase to null. while (Offset) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Changes in directory llvm/lib/Bitcode/Writer: BitcodeWriter.cpp updated: 1.38 -> 1.39 --- Log message: Add abbreviations to the TYPE_BLOCK for pointers, functions, structs and arrays. This shrinks the type_block of kc++ from 139901 bits to 99389 bits (0.55% to 0.39% of the file), a 40% reduction. This shrink the record from: Block ID #10 (TYPE_BLOCK): Num Instances: 1 Total Size: 139901b/17487.6B/4371.91W % of file: 0.549306 Num Abbrevs: 0 Num Records: 3203 % Abbrev Recs: 0 to: Block ID #10 (TYPE_BLOCK): Num Instances: 1 Total Size: 99389b/12423.6B/3105.91W % of file: 0.390862 Num Abbrevs: 4 Num Records: 3203 % Abbrev Recs: 99.6566 With a common histogram of: Code Histogram: 1613POINTER 1100FUNCTION 255 STRUCT 224 ARRAY 5 INTEGER 2 OPAQUE 1 LABEL 1 DOUBLE 1 VOID 1 NUMENTRY --- Diffs of the changes: (+40 -3) BitcodeWriter.cpp | 43 --- 1 files changed, 40 insertions(+), 3 deletions(-) Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.38 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.39 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.38 Fri May 4 20:26:50 2007 +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp Sat May 5 01:30:12 2007 @@ -121,7 +121,40 @@ Stream.EnterSubblock(bitc::TYPE_BLOCK_ID, 4 /*count from # abbrevs */); SmallVector TypeVals; - // FIXME: Set up abbrevs now that we know the width of the type fields, etc. + // Abbrev for TYPE_CODE_POINTER. + BitCodeAbbrev *Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getTypes().size()+1))); + unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv); + + // Abbrev for TYPE_CODE_FUNCTION. + Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_FUNCTION)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isvararg + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getParamAttrs().size()+1))); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getTypes().size()+1))); + unsigned FunctionAbbrev = Stream.EmitAbbrev(Abbv); + + // Abbrev for TYPE_CODE_STRUCT. + Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_STRUCT)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ispacked + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getTypes().size()+1))); + unsigned StructAbbrev = Stream.EmitAbbrev(Abbv); + + // Abbrev for TYPE_CODE_ARRAY. + Abbv = new BitCodeAbbrev(); + Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_ARRAY)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // size + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, +Log2_32_Ceil(VE.getTypes().size()+1))); + unsigned ArrayAbbrev = Stream.EmitAbbrev(Abbv); // Emit an entry count so the reader can reserve space. TypeVals.push_back(TypeList.size()); @@ -151,28 +184,31 @@ // POINTER: [pointee type] Code = bitc::TYPE_CODE_POINTER; TypeVals.push_back(VE.getTypeID(cast(T)->getElementType())); + AbbrevToUse = PtrAbbrev; break; case Type::FunctionTyID: { const FunctionType *FT = cast(T); - // FUNCTION: [isvararg, attrid, #pararms, paramty x N] + // FUNCTION: [isvararg, attrid, retty, paramty x N] Code = bitc::TYPE_CODE_FUNCTION; TypeVals.push_back(FT->isVarArg()); TypeVals.push_back(VE.getParamAttrID(FT->getParamAttrs())); TypeVals.push_back(VE.getTypeID(FT->getReturnType())); for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) TypeVals.push_back(VE.getTypeID(FT->getParamType(i))); + AbbrevToUse = FunctionAbbrev; break; } case Type::StructTyID: { const StructType *ST = cast(T); - // STRUCT: [ispacked, #elts, eltty x N] + // STRUCT: [ispacked, eltty x N] Code = bitc::TYPE_CODE_STRUCT; TypeVals.push_back(ST->isPacked()); // Output all of the element types. for (StructType::element_iterator I = ST->element_begin(), E = ST->element_end(); I != E; ++I) TypeVals.push_back(VE.getTypeID(*I)); + AbbrevToUse = StructAbbrev; break; } case Type::ArrayTyID: { @@ -181,6 +217,7 @@ Code = bitc::TYPE_CODE_ARRAY; TypeVals.push_back(AT->getNumElements()); TypeVals.push_