[llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt
Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.106 -> 1.107 --- Log message: move contents of PR587: http://llvm.org/PR587 to here. --- Diffs of the changes: (+45 -0) README.txt | 45 + 1 files changed, 45 insertions(+) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.106 llvm/lib/Target/PowerPC/README.txt:1.107 --- llvm/lib/Target/PowerPC/README.txt:1.106Fri Nov 17 18:32:03 2006 +++ llvm/lib/Target/PowerPC/README.txt Thu Jan 18 01:34:57 2007 @@ -552,3 +552,48 @@ or r3,r3,r0 blr + +===-=== + +Consider a function like this: + +float foo(float X) { return X + 1234.4123f; } + +The FP constant ends up in the constant pool, so we need to get the LR register. + This ends up producing code like this: + +_foo: +.LBB_foo_0: ; entry +mflr r11 +*** stw r11, 8(r1) +bl "L0$pb" +"L0$pb": +mflr r2 +addis r2, r2, ha16(.CPI_foo_0-"L0$pb") +lfs f0, lo16(.CPI_foo_0-"L0$pb")(r2) +fadds f1, f1, f0 +*** lwz r11, 8(r1) +mtlr r11 +blr + +This is functional, but there is no reason to spill the LR register all the way +to the stack (the two marked instrs): spilling it to a GPR is quite enough. + +Implementing this will require some codegen improvements. Nate writes: + +"So basically what we need to support the "no stack frame save and restore" is a +generalization of the LR optimization to "callee-save regs". + +Currently, we have LR marked as a callee-save reg. The register allocator sees +that it's callee save, and spills it directly to the stack. + +Ideally, something like this would happen: + +LR would be in a separate register class from the GPRs. The class of LR would be +marked "unspillable". When the register allocator came across an unspillable +reg, it would ask "what is the best class to copy this into that I *can* spill" +If it gets a class back, which it will in this case (the gprs), it grabs a free +register of that class. If it is then later necessary to spill that reg, so be +it. + +===-=== ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/tramp3d-v4/Makefile
Changes in directory llvm-test/MultiSource/Benchmarks/tramp3d-v4: Makefile updated: 1.1 -> 1.2 --- Log message: this doesn't use EH --- Diffs of the changes: (+1 -1) Makefile |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/tramp3d-v4/Makefile diff -u llvm-test/MultiSource/Benchmarks/tramp3d-v4/Makefile:1.1 llvm-test/MultiSource/Benchmarks/tramp3d-v4/Makefile:1.2 --- llvm-test/MultiSource/Benchmarks/tramp3d-v4/Makefile:1.1Thu Jan 18 00:28:47 2007 +++ llvm-test/MultiSource/Benchmarks/tramp3d-v4/MakefileThu Jan 18 01:00:21 2007 @@ -1,7 +1,7 @@ LEVEL = ../../.. PROG = tramp3d-v4 -CPPFLAGS = +CPPFLAGS = -fno-exceptions LDFLAGS = -lstdc++ RUN_OPTIONS = --cartvis 1.0 0.0 --rhomin 1e-8 -n 25 FP_TOLERANCE := 0.1 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp
Changes in directory llvm-test/MultiSource/Benchmarks/tramp3d-v4: tramp3d-v4.cpp updated: 1.1 -> 1.2 --- Log message: adjust to eliminate timing output --- Diffs of the changes: (+11 -4) tramp3d-v4.cpp | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp diff -u llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp:1.1 llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp:1.2 --- llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp:1.1 Thu Jan 18 00:28:47 2007 +++ llvm-test/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp Thu Jan 18 00:51:33 2007 @@ -56028,6 +56028,10 @@ out << std::flush; struct timeval end_time, start_time; gettimeofday(&start_time, NULL); + + // LLVM: disable timing. + end_time = start_time; + if (a_rhomin_f) Pooma::newRelation(Hacks::limit_rh(a_rhomin), rh); switch (eos) { @@ -56049,9 +56053,11 @@ dt = std::min(a_max_dt, std::max(a_min_dt, a_cfl*dt_)); } t += dt; -gettimeofday(&end_time, NULL); -out << "i = " << it << "\t t = " << t << "\t dt = " << dt - << " (" << end_time.tv_sec + end_time.tv_usec/100.0 - start_time.tv_sec - start_time.tv_usec/100.0 << "s/it)" << std::endl; + +// LLVM: disable timing. +//gettimeofday(&end_time, NULL); +out << "i = " << it << "\t t = " << t << "\t dt = " << dt; + //<< " (" << end_time.tv_sec + end_time.tv_usec/100.0 - start_time.tv_sec - start_time.tv_usec/100.0 << "s/it)" << std::endl; iteration_time += end_time.tv_sec + end_time.tv_usec/100.0 - start_time.tv_sec - start_time.tv_usec/100.0; start_time = end_time; Adv5::advect(dt, rh, v, 0.0, T, flm, fle, flvv, flvc, cv, scratchc, eeq, ietot); @@ -56068,7 +56074,8 @@ if (Dim > 2) Hacks::checkRegularity(v.center(2)); } - out << "Time spent in iteration: " << iteration_time << std::endl; + // LLVM: disable timing. + //out << "Time spent in iteration: " << iteration_time << std::endl; out << "Correctness:" << "\n\tsum(rh) difference = " << sum(rh)-rh0 << "\n\tsum(vx) = " << sum(v.center(0)) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Makefile
Changes in directory llvm-test/MultiSource/Benchmarks: Makefile updated: 1.12 -> 1.13 --- Log message: run tramp3d-v4 benchmark --- Diffs of the changes: (+1 -1) Makefile |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/Makefile diff -u llvm-test/MultiSource/Benchmarks/Makefile:1.12 llvm-test/MultiSource/Benchmarks/Makefile:1.13 --- llvm-test/MultiSource/Benchmarks/Makefile:1.12 Tue Jan 9 13:36:13 2007 +++ llvm-test/MultiSource/Benchmarks/Makefile Thu Jan 18 00:30:01 2007 @@ -4,6 +4,6 @@ PARALLEL_DIRS := Fhourstones Fhourstones-3.1 \ McCat Olden OptimizerEval Ptrdist llubenchmark \ sim FreeBench MallocBench Prolangs-C Prolangs-C++ SciMark2-C\ -mediabench ASCI_Purple MiBench +mediabench ASCI_Purple MiBench tramp3d-v4 include $(LEVEL)/Makefile.programs ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/tramp3d-v4/
Changes in directory llvm-test/MultiSource/Benchmarks/tramp3d-v4: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-test/MultiSource/Benchmarks/tramp3d-v4 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
> +bool IntegerType::isPowerOf2ByteWidth() const { > + unsigned BitWidth = getBitWidth(); > + return (BitWidth > 7 && Log2_32(BitWidth) == Log2_32_Ceil > (BitWidth)); > +} > + Please use the isPowerOf2_32 function or use ((BitWidth-1) & BitWidth) == 0 instead of two Log2_32 calls. Thanks, -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] "Zeros in bss" patch for llvm-gcc
Hi Anton, The small typo was maybe intentional. Because it's a macro, it's used like this: LLVM_SET_TARGET_OPTIONS(foo); With this patch, there will be an extra ';' at the end. -bw On Jan 17, 2007, at 2:49 AM, Anton Korobeynikov wrote: > Hello, Everyone. > > Now some codegens by default emit zero-initialized data to .bss > section. > However, sometimes it's really necessary not to do so. This patch will > add handling of "-fno-zero-initialized-in-bss" llvm-gcc' option. It's > necessary to compile crt*.o properly. > > PS: Also some fix some small typo. :) > -- > With best regards, Anton Korobeynikov. > > Faculty of Mathematics & Mechanics, Saint Petersburg State University. > > > ___ > 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] Round 2: ABI and preferred alignment enhancement
Previously known as struct/array vs. stack vs. global alignments... -scooter -- Scott Michel [EMAIL PROTECTED] Member of Technical Staff, CSRD 310/336-5034 The Aerospace Corporation --- old-llvm/include/llvm/Target/TargetData.h 2007-01-17 19:06:51.0 -0800 +++ new-llvm/include/llvm/Target/TargetData.h 2007-01-17 19:06:51.0 -0800 @@ -35,15 +35,28 @@ class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false - unsigned char BoolAlignment; // Defaults to 1 byte - unsigned char ByteAlignment; // Defaults to 1 byte - unsigned char ShortAlignment;// Defaults to 2 bytes - unsigned char IntAlignment; // Defaults to 4 bytes - unsigned char LongAlignment; // Defaults to 8 bytes - unsigned char FloatAlignment;// Defaults to 4 bytes - unsigned char DoubleAlignment; // Defaults to 8 bytes - unsigned char PointerSize; // Defaults to 8 bytes - unsigned char PointerAlignment; // Defaults to 8 bytes + + // ABI alignments + unsigned char BoolABIAlignment; // Defaults to 1 byte + unsigned char ByteABIAlignment; // Defaults to 1 byte + unsigned char ShortABIAlignment; // Defaults to 2 bytes + unsigned char IntABIAlignment;// Defaults to 4 bytes + unsigned char LongABIAlignment; // Defaults to 8 bytes + unsigned char FloatABIAlignment; // Defaults to 4 bytes + unsigned char DoubleABIAlignment; // Defaults to 8 bytes + unsigned char PointerMemSize;// Defaults to 8 bytes + unsigned char PointerABIAlignment;// Defaults to 8 bytes + + // Preferred stack/global type alignments + unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment + unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment + unsigned char ShortPrefAlignment; // Defaults to ShortABIAlignment + unsigned char IntPrefAlignment; // Defaults to IntABIAlignment + unsigned char LongPrefAlignment;// Defaults to LongABIAlignment + unsigned char FloatPrefAlignment; // Defaults to FloatABIAlignment + unsigned char DoublePrefAlignment; // Defaults to DoubleABIAlignment + unsigned char PointerPrefAlignment; // Defaults to PointerABIAlignment + unsigned char AggMinPrefAlignment; // Defaults to 0 bytes public: /// Default ctor - This has to exist, because this is a pass, but it should @@ -68,15 +81,24 @@ TargetData(const TargetData &TD) : ImmutablePass(), LittleEndian(TD.isLittleEndian()), -BoolAlignment(TD.getBoolAlignment()), -ByteAlignment(TD.getByteAlignment()), -ShortAlignment(TD.getShortAlignment()), -IntAlignment(TD.getIntAlignment()), -LongAlignment(TD.getLongAlignment()), -FloatAlignment(TD.getFloatAlignment()), -DoubleAlignment(TD.getDoubleAlignment()), -PointerSize(TD.getPointerSize()), -PointerAlignment(TD.getPointerAlignment()) { +BoolABIAlignment(TD.getBoolABIAlignment()), +ByteABIAlignment(TD.getByteABIAlignment()), +ShortABIAlignment(TD.getShortABIAlignment()), +IntABIAlignment(TD.getIntABIAlignment()), +LongABIAlignment(TD.getLongABIAlignment()), +FloatABIAlignment(TD.getFloatABIAlignment()), +DoubleABIAlignment(TD.getDoubleABIAlignment()), +PointerMemSize(TD.getPointerSize()), +PointerABIAlignment(TD.getPointerABIAlignment()), +BoolPrefAlignment(TD.getBoolPrefAlignment()), +BytePrefAlignment(TD.getBytePrefAlignment()), +ShortPrefAlignment(TD.getShortPrefAlignment()), +IntPrefAlignment(TD.getIntPrefAlignment()), +LongPrefAlignment(TD.getLongPrefAlignment()), +FloatPrefAlignment(TD.getFloatPrefAlignment()), +DoublePrefAlignment(TD.getDoublePrefAlignment()), +PointerPrefAlignment(TD.getPointerPrefAlignment()), +AggMinPrefAlignment(TD.getAggMinPrefAlignment()) { } ~TargetData(); // Not virtual, do not subclass this class @@ -86,10 +108,16 @@ /// Parse a target data layout string, initializing the various TargetData /// members along the way. A TargetData specification string looks like /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" and specifies the - /// target's endianess, the alignments of various data types and - /// the size of pointers. The "-" is used as a separator and ":" - /// separates a token from its argument. Alignment is indicated in bits - /// and internally converted to the appropriate number of bytes. + /// target's endianess, the ABI alignments of various data types and + /// the size of pointers. + /// + /// "-" is used as a separator and ":" separates a token from its argument. + /// + /// Alignment is indicated in bits and internally converted to the + /// appropriate number of bytes. + /// + /// The preferred stack/global alignment specifications (":[prefalign]") are + /// optional and default to the ABI alignment. /// /// Valid tokens: /// @@ -97,20 +125,24 @@ /
[llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h
Changes in directory llvm/include/llvm: DerivedTypes.h updated: 1.79 -> 1.80 --- Log message: Provide an isPowerOf2ByteWidth method for the IntegerType class. This will mostly be used by back ends that wish to distinguish between integer types that fit evenly within a natural integer type and those that don't. --- Diffs of the changes: (+6 -0) DerivedTypes.h |6 ++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.79 llvm/include/llvm/DerivedTypes.h:1.80 --- llvm/include/llvm/DerivedTypes.h:1.79 Fri Jan 12 16:11:53 2007 +++ llvm/include/llvm/DerivedTypes.hWed Jan 17 20:59:54 2007 @@ -101,6 +101,12 @@ /// @brief Get the number of bits in this IntegerType unsigned getBitWidth() const { return getSubclassData(); } + /// This method determines if the width of this IntegerType is a power-of-2 + /// in terms of 8 bit bytes. + /// @returns true if this is a power-of-2 byte width. + /// @brief Is this a power-of-2 byte-width IntegerType ? + bool isPowerOf2ByteWidth() const; + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const IntegerType *T) { return true; } static inline bool classof(const Type *T) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.161 -> 1.162 --- Log message: Provide an isPowerOf2ByteWidth method for the IntegerType class. This will mostly be used by back ends that wish to distinguish between integer types that fit evenly within a natural integer type and those that don't. --- Diffs of the changes: (+5 -0) Type.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.161 llvm/lib/VMCore/Type.cpp:1.162 --- llvm/lib/VMCore/Type.cpp:1.161 Sun Jan 14 20:27:26 2007 +++ llvm/lib/VMCore/Type.cppWed Jan 17 20:59:54 2007 @@ -975,6 +975,11 @@ return ITy; } +bool IntegerType::isPowerOf2ByteWidth() const { + unsigned BitWidth = getBitWidth(); + return (BitWidth > 7 && Log2_32(BitWidth) == Log2_32_Ceil(BitWidth)); +} + // FunctionValType - Define a class to hold the key that goes into the TypeMap // namespace llvm { ___ 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/X86AsmPrinter.cpp
Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.231 -> 1.232 --- Log message: The zerofill directive needs a newline after it. --- Diffs of the changes: (+1 -1) X86AsmPrinter.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.231 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.232 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.231 Wed Jan 17 19:49:58 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Wed Jan 17 20:30:19 2007 @@ -149,7 +149,7 @@ if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; O << Directive << "__DATA__, __common, " << name << ", " -<< Size << ", " << Align; +<< Size << ", " << Align << "\n"; continue; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.161 -> 1.162 --- Log message: Use the new maskToBitWidth function to ensure that the results of computations do not overflow the intended bit width. --- Diffs of the changes: (+15 -10) Execution.cpp | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.161 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.162 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.161Wed Jan 17 19:32:46 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Jan 17 20:12:51 2007 @@ -216,6 +216,7 @@ Dest.Int64Val = Src1.Int64Val OP Src2.Int64Val; \ else \ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ + maskToBitWidth(Dest, BitWidth); \ break; \ } @@ -234,6 +235,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); \ } \ + maskToBitWidth(Dest, BitWidth); \ } else { \ cerr << "Unhandled type for " #OP " operator: " << *Ty << "\n"; \ abort(); \ @@ -254,6 +256,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); \ } \ + maskToBitWidth(Dest, BitWidth); \ } else { \ cerr << "Unhandled type for " #OP " operator: " << *Ty << "\n"; \ abort(); \ @@ -397,6 +400,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); \ } \ + maskToBitWidth(Dest, BitWidth); \ break; \ } @@ -417,6 +421,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); \ } \ + maskToBitWidth(Dest, BitWidth); \ break; \ } @@ -1187,23 +1192,19 @@ GenericValue Dest; if (const IntegerType *ITy = cast(Ty)) { unsigned BitWidth = ITy->getBitWidth(); -uint32_t BitMask = (1ull << BitWidth) - 1; -if (BitWidth <= 8) { +if (BitWidth <= 8) Dest.Int8Val = ((uint8_t)Src1.Int8Val) << ((uint32_t)Src2.Int8Val); - Dest.Int8Val &= BitMask; -} else if (BitWidth <= 16) { +else if (BitWidth <= 16) Dest.Int16Val = ((uint16_t)Src1.Int16Val) << ((uint32_t)Src2.Int8Val); - Dest.Int16Val &= BitMask; -} else if (BitWidth <= 32) { +else if (BitWidth <= 32) Dest.Int32Val = ((uint32_t)Src1.Int32Val) << ((uint32_t)Src2.Int8Val); - Dest.Int32Val &= BitMask; -} else if (BitWidth <= 64) { +else if (BitWidth <= 64) Dest.Int64Val = ((uint64_t)Src1.Int64Val) << ((uint32_t)Src2.Int8Val); - Dest.Int64Val &= BitMask; -} else { +else { cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; abort(); } +maskToBitWidth(Dest, BitWidth); } else { cerr << "Unhandled type for Shl instruction: " << *Ty << "\n"; abort(); @@ -1228,6 +1229,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; abort(); } +maskToBitWidth(Dest, BitWidth); } else { cerr << "Unhandled type for LShr instruction: " << *Ty << "\n"; abort(); @@ -1252,6 +1254,7 @@ cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; \ abort(); } +maskToBitWidth(Dest, BitWidth); } else { cerr << "Unhandled type for AShr instruction: " << *Ty << "\n"; abort(); @@ -1567,6 +1570,7 @@ Dest.Int32Val = Src.Int32Val; else Dest.Int64Val = Src.Int64Val; + maskToBitWidth(Dest, DBitWidth); } else assert(0 && "Invalid BitCast"); } else if (DstTy == Type::FloatTy) { @@ -1673,6 +1677,7 @@ Dest.Int64Val = Src.Int64Val; else assert("Integer types > 64 bits not supported"); + maskToBitWidth(Dest, BitWidth); } IMPLEMENT_VAARG(Pointer); IMPLEMENT_VAARG(Float); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Interpreter.h updated: 1.80 -> 1.81 --- Log message: Add an inline helper function that masks a GenericValue to a specified bit width. --- Diffs of the changes: (+12 -0) Interpreter.h | 12 1 files changed, 12 insertions(+) Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.80 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.81 --- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.80 Fri Jan 12 01:05:13 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Wed Jan 17 20:12:10 2007 @@ -231,8 +231,20 @@ GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal, const Type *Ty, ExecutionContext &SF); void popStackAndReturnValueToCaller(const Type *RetTy, GenericValue Result); + }; +inline void maskToBitWidth(GenericValue& GV, unsigned BitWidth) { + uint64_t BitMask = (1ull << BitWidth) - 1; + if (BitWidth <= 8) +GV.Int8Val &= BitMask; + else if (BitWidth <= 16) +GV.Int16Val &= BitMask; + else if (BitWidth <= 32) +GV.Int32Val &= BitMask; + else +GV.Int64Val &= BitMask; +} } // End llvm namespace #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Stack and global alignment enhancement patch
On Jan 17, 2007, at 12:47 PM, Scott Michel wrote: > Per Chris' suggestion to submit enhancement patches to llvm- > commits,... > > - Adds stack and global alignment options to TargetData specification > strings. > > - Adds minimum stack and global alignment for aggregates. Hi Scott, I think I miscommunicated a little bit :( You have: + // Stack type alignments. + unsigned char BoolStackAlignment;// Defaults to BoolAlignment + unsigned char ByteStackAlignment;// Defaults to ByteAlignment + unsigned char ShortStackAlignment; // Defaults to ShortAlignment + unsigned char IntStackAlignment; // Defaults to IntAlignment + unsigned char LongStackAlignment;// Defaults to LongAlignment + unsigned char FloatStackAlignment; // Defaults to FloatAlignment + unsigned char DoubleStackAlignment; // Defaults to DoubleAlignment + unsigned char PointerStackAlignment; // Defaults to PointerAlignment + unsigned char AggMinStackAlignment; // Defaults to 4 bytes + + // Global alignments + unsigned char BoolGlobalAlignment; // Defaults to BoolAlignment + unsigned char ByteGlobalAlignment; // Defaults to ByteAlignment + unsigned char ShortGlobalAlignment; // Defaults to ShortAlignment + unsigned char IntGlobalAlignment;// Defaults to IntAlignment + unsigned char LongGlobalAlignment; // Defaults to LongAlignment + unsigned char FloatGlobalAlignment; // Defaults to FloatAlignment + unsigned char DoubleGlobalAlignment; // Defaults to DoubleAlignment + unsigned char PointerGlobalAlignment;// Defaults to PointerAlignment + unsigned char AggMinGlobalAlignment; // Defaults to 4 bytes I don't think there is any need for this generality. It seems that a target has two sorts of alignments: that imposed by the ABI, and that which is really wants things to be aligned at. The target itself doesn't care *where* something is, but if it has the choice, it sometimes wants to use a bigger alignment than necessary. As such, I don't think there is any reason to have separate variables for stack and global alignment. These are both just the, "we can use any alignment, so lets use whatever is preferred for the target". Why not have one set of XXXPrefAlignment instance variables which can be used for both globals and stack objects? If you'd like to rename the existing IntAlignment values to something, I'd suggest IntABIAlignment instead of IntSAAlignment. Aside from that, your patch looks good. Updating the X86 backend and hack removal is great! -Chris ___ 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/SignlessTypes/ccc.c
Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: ccc.c updated: 1.1 -> 1.2 --- Log message: Don't reference stderr, lli can't find it on Linux because it is both a global variable and a macro! --- Diffs of the changes: (+1 -1) ccc.c |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/ccc.c diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/ccc.c:1.1 llvm-test/SingleSource/UnitTests/SignlessTypes/ccc.c:1.2 --- llvm-test/SingleSource/UnitTests/SignlessTypes/ccc.c:1.1Wed Jan 10 11:54:02 2007 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/ccc.cWed Jan 17 20:10:04 2007 @@ -35,7 +35,7 @@ unsigned short ush; if (argc < 2) { -fprintf(stderr, "Program requires integer parameter"); +printf("Program requires integer parameter"); exit (1); } ___ 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/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp
Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.91 -> 1.92 X86AsmPrinter.cpp updated: 1.230 -> 1.231 --- Log message: Minor code clean up. --- Diffs of the changes: (+21 -18) X86ATTAsmPrinter.cpp | 37 - X86AsmPrinter.cpp|2 +- 2 files changed, 21 insertions(+), 18 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.91 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.92 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.91 Wed Jan 17 04:33:08 2007 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppWed Jan 17 19:49:58 2007 @@ -31,16 +31,15 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed"); -static std::string computePICLabel(unsigned fnNumber, - const X86Subtarget* Subtarget) -{ +static std::string computePICLabel(unsigned FnNum, + const TargetAsmInfo *TAI, + const X86Subtarget* Subtarget) { std::string label; - - if (Subtarget->isTargetDarwin()) { -label = "\"L" + utostr_32(fnNumber) + "$pb\""; - } else if (Subtarget->isTargetELF()) { -label = ".Lllvm$" + utostr_32(fnNumber) + "$piclabel"; - } else + if (Subtarget->isTargetDarwin()) +label = "\"L" + utostr_32(FnNum) + "$pb\""; + else if (Subtarget->isTargetELF()) +label = ".Lllvm$" + utostr_32(FnNum) + "$piclabel"; + else assert(0 && "Don't know how to print PIC label!\n"); return label; @@ -227,7 +226,8 @@ if (TM.getRelocationModel() == Reloc::PIC_) { if (Subtarget->isPICStyleStub()) -O << "-\"L" << getFunctionNumber() << "$pb\""; +O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber() + << "$pb\""; else if (Subtarget->isPICStyleGOT()) O << "@GOTOFF"; } @@ -244,7 +244,8 @@ if (TM.getRelocationModel() == Reloc::PIC_) { if (Subtarget->isPICStyleStub()) -O << "-\"L" << getFunctionNumber() << "$pb\""; +O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber() + << "$pb\""; if (Subtarget->isPICStyleGOT()) O << "@GOTOFF"; } @@ -280,10 +281,10 @@ // Dynamically-resolved functions need a stub for the function. if (isCallOp && isa(GV)) { FnStubs.insert(Name); - O << "L" << Name << "$stub"; + O << TAI->getPrivateGlobalPrefix() << Name << "$stub"; } else { GVStubs.insert(Name); - O << "L" << Name << "$non_lazy_ptr"; + O << TAI->getPrivateGlobalPrefix() << Name << "$non_lazy_ptr"; } } else { if (GV->hasDLLImportLinkage()) { @@ -293,7 +294,8 @@ } if (!isCallOp && TM.getRelocationModel() == Reloc::PIC_) -O << "-\"L" << getFunctionNumber() << "$pb\""; +O << "-\"" << TAI->getPrivateGlobalPrefix() << getFunctionNumber() + << "$pb\""; } else { if (GV->hasDLLImportLinkage()) { O << "__imp_"; @@ -346,7 +348,7 @@ Name += MO.getSymbolName(); if (isCallOp && Subtarget->isPICStyleStub()) { FnStubs.insert(Name); - O << "L" << Name << "$stub"; + O << TAI->getPrivateGlobalPrefix() << Name << "$stub"; return; } if (!isCallOp) O << '$'; @@ -363,7 +365,8 @@ // piclabel: // popl %some_register // addl $_GLOBAL_ADDRESS_TABLE_ + [.-piclabel], %some_register -O << " + [.-" << computePICLabel(getFunctionNumber(), Subtarget) << "]"; +O << " + [.-" + << computePICLabel(getFunctionNumber(), TAI, Subtarget) << "]"; } if (isCallOp && Subtarget->isPICStyleGOT()) @@ -440,7 +443,7 @@ } void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) { - std::string label = computePICLabel(getFunctionNumber(), Subtarget); + std::string label = computePICLabel(getFunctionNumber(), TAI, Subtarget); O << label << "\n" << label << ":"; } Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.230 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.231 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.230 Wed Jan 17 11:44:25 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Wed Jan 17 19:49:58 2007 @@ -166,7 +166,7 @@ if (I->hasInternalLinkage()) { O << TAI->getLCOMMDirective() << name << "," << Size; if (Subtarget->isTargetDarwin()) - O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); + O << "," << Align; } else O << TAI->getCOMMDirective() << name << "," << Size; } else { ___ 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/Integer/Makefile
Changes in directory llvm-test/SingleSource/UnitTests/Integer: Makefile updated: 1.3 -> 1.4 --- Log message: Turn on ENABLE_LLI so that it is run, along with CBE, by default. --- Diffs of the changes: (+1 -0) Makefile |1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/UnitTests/Integer/Makefile diff -u llvm-test/SingleSource/UnitTests/Integer/Makefile:1.3 llvm-test/SingleSource/UnitTests/Integer/Makefile:1.4 --- llvm-test/SingleSource/UnitTests/Integer/Makefile:1.3 Tue Jan 16 15:41:11 2007 +++ llvm-test/SingleSource/UnitTests/Integer/Makefile Wed Jan 17 19:33:27 2007 @@ -18,6 +18,7 @@ # DISABLE_LLC := 1 DISABLE_JIT := 1 +ENABLE_LLI := 1 # Define USE_REFERENCE_OUTPUT which is a signal to Makefile.programs # that the native compiler should not be run but that its output ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.160 -> 1.161 --- Log message: Make shl instruction mask its result to the correct bitsize. This is sufficient to get llvm-test/SingleSource/UnitTests/Integer/general-test.ll working with lli in interpreter mode. --- Diffs of the changes: (+10 -5) Execution.cpp | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.160 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.161 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.160Wed Jan 17 19:25:42 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Jan 17 19:32:46 2007 @@ -1187,15 +1187,20 @@ GenericValue Dest; if (const IntegerType *ITy = cast(Ty)) { unsigned BitWidth = ITy->getBitWidth(); -if (BitWidth <= 8) +uint32_t BitMask = (1ull << BitWidth) - 1; +if (BitWidth <= 8) { Dest.Int8Val = ((uint8_t)Src1.Int8Val) << ((uint32_t)Src2.Int8Val); -else if (BitWidth <= 16) + Dest.Int8Val &= BitMask; +} else if (BitWidth <= 16) { Dest.Int16Val = ((uint16_t)Src1.Int16Val) << ((uint32_t)Src2.Int8Val); -else if (BitWidth <= 32) + Dest.Int16Val &= BitMask; +} else if (BitWidth <= 32) { Dest.Int32Val = ((uint32_t)Src1.Int32Val) << ((uint32_t)Src2.Int8Val); -else if (BitWidth <= 64) + Dest.Int32Val &= BitMask; +} else if (BitWidth <= 64) { Dest.Int64Val = ((uint64_t)Src1.Int64Val) << ((uint32_t)Src2.Int8Val); -else { + Dest.Int64Val &= BitMask; +} else { cerr << "Integer types > 64 bits not supported: " << *Ty << "\n"; abort(); } ___ 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/Integer/general-test.c general-test.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: general-test.c updated: 1.1 -> 1.2 general-test.reference_output updated: 1.1 -> 1.2 --- Log message: Provide a simple test case and its reference output. --- Diffs of the changes: (+63 -22) general-test.c| 66 ++ general-test.reference_output | 19 +--- 2 files changed, 63 insertions(+), 22 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/general-test.c diff -u llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.1 llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/general-test.c:1.1 Tue Jan 16 14:30:27 2007 +++ llvm-test/SingleSource/UnitTests/Integer/general-test.c Wed Jan 17 19:31:25 2007 @@ -7,41 +7,71 @@ #define ATTR_BITS(N) __attribute__((bitwidth(N))) -typedef int ATTR_BITS( 4) My04BitInt; -typedef int ATTR_BITS(16) My16BitInt; -typedef int ATTR_BITS(17) My17BitInt; -typedef int ATTR_BITS(37) My37BitInt; -typedef int ATTR_BITS(65) My65BitInt; +typedef unsigned char ATTR_BITS( 4) My04BitInt; +typedef unsigned short ATTR_BITS(16) My16BitInt; +typedef unsigned int ATTR_BITS(17) My17BitInt; +typedef unsigned long long ATTR_BITS(37) My37BitInt; +typedef unsigned ATTR_BITS(65) My65BitInt; struct MyStruct { + struct MyStruct* next; My04BitInt i4Field; - short ATTR_BITS(12) i12Field; - long ATTR_BITS(17) i17Field; + unsigned short ATTR_BITS(12) i12Field; + unsigned ATTR_BITS(17) i17Field; My37BitInt i37Field; }; -My37BitInt getSizes( short ATTR_BITS(23) num) { +struct MyStruct Data1; +struct MyStruct Data2; + +struct MyStruct* getSizes( short ATTR_BITS(23) num, My37BitInt * result) { My17BitInt i; - struct MyStruct strct; - int __attribute__((bitwidth(9))) j; - int result; + short __attribute__((bitwidth(9))) j; printf("sizeof(MyStruct) == %d\n", sizeof(struct MyStruct)); printf("sizeof(My17BitInt) == %d\n", sizeof(My17BitInt)); printf("sizeof(j) == %d\n", sizeof(j)); result = sizeof(My17BitInt) + sizeof(j) + sizeof(struct MyStruct); - strct.i17Field = result; - j = 257; + Data1.i4Field = num; + Data1.i12Field = num + 1; + Data1.i17Field = num + 2; + Data1.i37Field = num + 3; + Data1.next = 0; + Data2 = Data1; + Data2.i4Field *= 7; + Data2.i12Field *= 7; + Data2.i17Field *= 7; + Data2.i37Field *= 7; + Data2.next = &Data1; + j = num * 2; printf("j = %d\n", j); printf("size sum is %d\n", result); - return result; + return &Data2; } int main ( int argc, char** argv) { srand(0); - int r = rand() + argc + 31415926; - char ATTR_BITS(23) X = r; - printf("X is %d\n", X); - return ((int ATTR_BITS(32)) getSizes(X)) & 1; + struct MyStruct* strct = malloc(sizeof(struct MyStruct)); + int r = rand(); + int num = 0; + int ATTR_BITS(23) val = 0; + My37BitInt* sizes = 0; + printf("rand = %d\n", r); + printf("argc = %d\n", argc); + if (argc > 1) +num = atoi(argv[1]); + printf("num = %d\n", num); + val = r + argc + num; + printf("val = %d\n", val); + struct MyStruct* that = ((int ATTR_BITS(32)) getSizes(val, &sizes)); + printf("that.i4Field = %d\n", (int)that->i4Field); + printf("that.i12Field = %d\n", (int)that->i12Field); + printf("that.i17Field = %d\n", (int)that->i17Field); + printf("that.i37Field = %d\n", (int)that->i37Field); + printf("next.i4Field = %d\n", (int)that->next->i4Field); + printf("next.i12Field = %d\n", (int)that->next->i12Field); + printf("next.i17Field = %d\n", (int)that->next->i17Field); + printf("next.i37Field = %d\n", (int)that->next->i37Field); + return ((int)sizes) & 1; } Index: llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output diff -u llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.2 --- llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output:1.1 Tue Jan 16 14:30:27 2007 +++ llvm-test/SingleSource/UnitTests/Integer/general-test.reference_output Wed Jan 17 19:31:25 2007 @@ -1,7 +1,18 @@ -X is 1802150879 -sizeof(MyStruct) == 12 +rand = 1804289383 +argc = 2 +num = 31415926 +val = 6988767 +sizeof(MyStruct) == 20 sizeof(My17BitInt) == 4 sizeof(j) == 2 -j = 257 -size sum is 18 +j = 446 +size sum is 26 +that.i4Field = 9 +that.i12Field = 2848 +that.i17Field = 31527 +that.i37Field = 48921390 +next.i4Field = 15 +next.i12Field = 992 +next.i17Field = 41953 +next.i37Field = 6988770 exit 0 ___ 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/Integer/.cvsignore
Changes in directory llvm-test/SingleSource/UnitTests/Integer: .cvsignore added (r1.1) --- Log message: Ignore the output directory --- Diffs of the changes: (+1 -0) .cvsignore |1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/UnitTests/Integer/.cvsignore diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/.cvsignore:1.1 *** /dev/null Wed Jan 17 19:31:07 2007 --- llvm-test/SingleSource/UnitTests/Integer/.cvsignore Wed Jan 17 19:30:57 2007 *** *** 0 --- 1 + Output ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.159 -> 1.160 --- Log message: Two changes: 1. Fix logic for executeGEP. Only 32-bit and 64-bit integer types are acceptable as indices. 2. Ensure that all integer cast operations truncate their result to the integer size of the operand. --- Diffs of the changes: (+17 -18) Execution.cpp | 35 +-- 1 files changed, 17 insertions(+), 18 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.159 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.160 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.159Sun Jan 14 20:27:26 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Jan 17 19:25:42 2007 @@ -1073,16 +1073,12 @@ int64_t Idx; unsigned BitWidth = cast(I.getOperand()->getType())->getBitWidth(); - if (BitWidth <= 8) -Idx = (int64_t)(int8_t)IdxGV.Int8Val; - else if (BitWidth <= 16) -Idx = (int64_t)(int16_t)IdxGV.Int16Val; - else if (BitWidth <= 32) + if (BitWidth == 32) Idx = (int64_t)(int32_t)IdxGV.Int32Val; - else if (BitWidth <= 64) + else if (BitWidth == 64) Idx = (int64_t)IdxGV.Int64Val; else -assert(0 && "Integer types >64 bits not supported"); +assert(0 && "Invalid index type for getelementptr"); Total += PointerTy(TD.getTypeSize(ST->getElementType())*Idx); } } @@ -1288,17 +1284,20 @@ SetValue(&I, Dest, SF); } -#define INTEGER_ASSIGN(DEST, BITWIDTH, VAL) \ - if (BITWIDTH == 1) {\ -Dest.Int1Val = (bool) VAL;\ - } else if (BITWIDTH <= 8) { \ -Dest.Int8Val = (uint8_t) VAL; \ - } else if (BITWIDTH <= 16) {\ -Dest.Int16Val = (uint16_t) VAL; \ - } else if (BITWIDTH <= 32) {\ -Dest.Int32Val = (uint32_t) VAL; \ - } else \ -Dest.Int64Val = (uint64_t) VAL; +#define INTEGER_ASSIGN(DEST, BITWIDTH, VAL) \ + { \ +uint64_t Mask = (1ull << BITWIDTH) - 1; \ +if (BITWIDTH == 1) {\ + Dest.Int1Val = (bool) (VAL & Mask); \ +} else if (BITWIDTH <= 8) { \ + Dest.Int8Val = (uint8_t) (VAL & Mask);\ +} else if (BITWIDTH <= 16) {\ + Dest.Int16Val = (uint16_t) (VAL & Mask); \ +} else if (BITWIDTH <= 32) {\ + Dest.Int32Val = (uint32_t) (VAL & Mask); \ +} else \ + Dest.Int64Val = (uint64_t) (VAL & Mask); \ + } GenericValue Interpreter::executeTruncInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.98 -> 1.99 --- Log message: Make sure we truncate stored values to their bit width. --- Diffs of the changes: (+40 -30) ExecutionEngine.cpp | 70 +--- 1 files changed, 40 insertions(+), 30 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.98 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.98 Fri Jan 12 01:05:13 2007 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cppWed Jan 17 19:24:02 2007 @@ -456,25 +456,30 @@ switch (Ty->getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = cast(Ty)->getBitWidth(); + uint64_t BitMask = (1ull << BitWidth) - 1; + GenericValue TmpVal = Val; if (BitWidth <= 8) -Ptr->Untyped[0] = Val.Int8Val; +Ptr->Untyped[0] = Val.Int8Val & BitMask; else if (BitWidth <= 16) { -Ptr->Untyped[0] = Val.Int16Val& 255; -Ptr->Untyped[1] = (Val.Int16Val >> 8) & 255; +TmpVal.Int16Val &= BitMask; +Ptr->Untyped[0] = TmpVal.Int16Val& 255; +Ptr->Untyped[1] = (TmpVal.Int16Val >> 8) & 255; } else if (BitWidth <= 32) { -Ptr->Untyped[0] = Val.Int32Val& 255; -Ptr->Untyped[1] = (Val.Int32Val >> 8) & 255; -Ptr->Untyped[2] = (Val.Int32Val >> 16) & 255; -Ptr->Untyped[3] = (Val.Int32Val >> 24) & 255; +TmpVal.Int32Val &= BitMask; +Ptr->Untyped[0] = TmpVal.Int32Val& 255; +Ptr->Untyped[1] = (TmpVal.Int32Val >> 8) & 255; +Ptr->Untyped[2] = (TmpVal.Int32Val >> 16) & 255; +Ptr->Untyped[3] = (TmpVal.Int32Val >> 24) & 255; } else if (BitWidth <= 64) { -Ptr->Untyped[0] = (unsigned char)(Val.Int64Val ); -Ptr->Untyped[1] = (unsigned char)(Val.Int64Val >> 8); -Ptr->Untyped[2] = (unsigned char)(Val.Int64Val >> 16); -Ptr->Untyped[3] = (unsigned char)(Val.Int64Val >> 24); -Ptr->Untyped[4] = (unsigned char)(Val.Int64Val >> 32); -Ptr->Untyped[5] = (unsigned char)(Val.Int64Val >> 40); -Ptr->Untyped[6] = (unsigned char)(Val.Int64Val >> 48); -Ptr->Untyped[7] = (unsigned char)(Val.Int64Val >> 56); +TmpVal.Int64Val &= BitMask; +Ptr->Untyped[0] = (unsigned char)(TmpVal.Int64Val ); +Ptr->Untyped[1] = (unsigned char)(TmpVal.Int64Val >> 8); +Ptr->Untyped[2] = (unsigned char)(TmpVal.Int64Val >> 16); +Ptr->Untyped[3] = (unsigned char)(TmpVal.Int64Val >> 24); +Ptr->Untyped[4] = (unsigned char)(TmpVal.Int64Val >> 32); +Ptr->Untyped[5] = (unsigned char)(TmpVal.Int64Val >> 40); +Ptr->Untyped[6] = (unsigned char)(TmpVal.Int64Val >> 48); +Ptr->Untyped[7] = (unsigned char)(TmpVal.Int64Val >> 56); } else assert(0 && "Integer types > 64 bits not supported"); break; @@ -507,25 +512,30 @@ switch (Ty->getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = cast(Ty)->getBitWidth(); + uint64_t BitMask = (1ull << BitWidth) - 1; + GenericValue TmpVal = Val; if (BitWidth <= 8) -Ptr->Untyped[0] = Val.Int8Val; +Ptr->Untyped[0] = Val.Int8Val & BitMask; else if (BitWidth <= 16) { -Ptr->Untyped[1] = Val.Int16Val & 255; -Ptr->Untyped[0] = (Val.Int16Val >> 8) & 255; +TmpVal.Int16Val &= BitMask; +Ptr->Untyped[1] = TmpVal.Int16Val & 255; +Ptr->Untyped[0] = (TmpVal.Int16Val >> 8) & 255; } else if (BitWidth <= 32) { -Ptr->Untyped[3] = Val.Int32Val& 255; -Ptr->Untyped[2] = (Val.Int32Val >> 8) & 255; -Ptr->Untyped[1] = (Val.Int32Val >> 16) & 255; -Ptr->Untyped[0] = (Val.Int32Val >> 24) & 255; +TmpVal.Int32Val &= BitMask; +Ptr->Untyped[3] = TmpVal.Int32Val& 255; +Ptr->Untyped[2] = (TmpVal.Int32Val >> 8) & 255; +Ptr->Untyped[1] = (TmpVal.Int32Val >> 16) & 255; +Ptr->Untyped[0] = (TmpVal.Int32Val >> 24) & 255; } else if (BitWidth <= 64) { -Ptr->Untyped[7] = (unsigned char)(Val.Int64Val ); -Ptr->Untyped[6] = (unsigned char)(Val.Int64Val >> 8); -Ptr->Untyped[5] = (unsigned char)(Val.Int64Val >> 16); -Ptr->Untyped[4] = (unsigned char)(Val.Int64Val >> 24); -Ptr->Untyped[3] = (unsigned char)(Val.Int64Val >> 32); -Ptr->Untyped[2] = (unsigned char)(Val.Int64Val >> 40); -Ptr->Untyped[1] = (unsigned char)(Val.Int64Val >> 48); -Ptr->Untyped[0] = (unsigned char)(Val.Int64Val >> 56); +TmpVal.Int64Val &= BitMask; +Ptr->Untyped[7] = (unsigned char)(TmpVal.Int64Val ); +Ptr->Untyped[6] = (unsigned char)(TmpVal.Int64Val >> 8); +Ptr->Untyped[5] = (unsigned char)(TmpVal.Int64Val >> 16); +Ptr->Untyped[4] =
[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp
Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.33 -> 1.34 MachOWriter.cpp updated: 1.15 -> 1.16 --- Log message: Have the OutputBuffer take the is64Bit and isLittleEndian booleans. --- Diffs of the changes: (+23 -14) ELFWriter.cpp | 16 +--- MachOWriter.cpp | 21 ++--- 2 files changed, 23 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.33 llvm/lib/CodeGen/ELFWriter.cpp:1.34 --- llvm/lib/CodeGen/ELFWriter.cpp:1.33 Wed Jan 17 16:22:31 2007 +++ llvm/lib/CodeGen/ELFWriter.cpp Wed Jan 17 19:23:11 2007 @@ -115,7 +115,9 @@ // Add padding zeros to the end of the buffer to make sure that the // function will start on the correct byte alignment within the section. - OutputBuffer OB(TM, *OutBuffer); + OutputBuffer OB(*OutBuffer, + TM.getTargetData()->getPointerSizeInBits() == 64, + TM.getTargetData()->isLittleEndian()); OB.align(Align); FnStart = OutBuffer->size(); } @@ -182,7 +184,7 @@ // Local alias to shortenify coming code. std::vector &FH = FileHeader; - OutputBuffer FHOut(TM, FH); + OutputBuffer FHOut(FH, is64Bit, isLittleEndian); FHOut.outbyte(0x7F); // EI_MAG0 FHOut.outbyte('E'); // EI_MAG1 @@ -353,7 +355,7 @@ StrTab.Align = 1; DataBuffer &StrTabBuf = StrTab.SectionData; - OutputBuffer StrTabOut(TM, StrTabBuf); + OutputBuffer StrTabOut(StrTabBuf, is64Bit, isLittleEndian); // Set the zero'th symbol to a null byte, as required. StrTabOut.outbyte(0); @@ -389,7 +391,7 @@ SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. SymTab.EntSize = 16; // Size of each symtab entry. FIXME: wrong for ELF64 DataBuffer &SymTabBuf = SymTab.SectionData; - OutputBuffer SymTabOut(TM, SymTabBuf); + OutputBuffer SymTabOut(SymTabBuf, is64Bit, isLittleEndian); if (!is64Bit) { // 32-bit and 64-bit formats are shuffled a bit. for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { @@ -425,7 +427,7 @@ // Now that we know which section number is the .shstrtab section, update the // e_shstrndx entry in the ELF header. - OutputBuffer FHOut(TM, FileHeader); + OutputBuffer FHOut(FileHeader, is64Bit, isLittleEndian); FHOut.fixhalf(SHStrTab.SectionIdx, ELFHeader_e_shstrndx_Offset); // Set the NameIdx of each section in the string table and emit the bytes for @@ -477,7 +479,7 @@ // Now that we know where all of the sections will be emitted, set the e_shnum // entry in the ELF header. - OutputBuffer FHOut(TM, FileHeader); + OutputBuffer FHOut(FileHeader, is64Bit, isLittleEndian); FHOut.fixhalf(NumSections, ELFHeader_e_shnum_Offset); // Now that we know the offset in the file of the section table, update the @@ -491,7 +493,7 @@ DataBuffer().swap(FileHeader); DataBuffer Table; - OutputBuffer TableOut(TM, Table); + OutputBuffer TableOut(Table, is64Bit, isLittleEndian); // Emit all of the section data and build the section table itself. while (!SectionList.empty()) { Index: llvm/lib/CodeGen/MachOWriter.cpp diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.15 llvm/lib/CodeGen/MachOWriter.cpp:1.16 --- llvm/lib/CodeGen/MachOWriter.cpp:1.15 Wed Jan 17 16:22:31 2007 +++ llvm/lib/CodeGen/MachOWriter.cppWed Jan 17 19:23:11 2007 @@ -53,6 +53,10 @@ /// Target machine description. TargetMachine &TM; +/// is64Bit/isLittleEndian - This information is inferred from the target +/// machine directly, indicating what header values and flags to set. +bool is64Bit, isLittleEndian; + /// Relocations - These are the relocations that the function needs, as /// emitted. std::vector Relocations; @@ -75,7 +79,10 @@ std::vector MBBLocations; public: -MachOCodeEmitter(MachOWriter &mow) : MOW(mow), TM(MOW.TM) {} +MachOCodeEmitter(MachOWriter &mow) : MOW(mow), TM(MOW.TM) { + is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; + isLittleEndian = TM.getTargetData()->isLittleEndian(); +} virtual void startFunction(MachineFunction &F); virtual bool finishFunction(MachineFunction &F); @@ -230,7 +237,7 @@ unsigned Size = TM.getTargetData()->getTypeSize(Ty); MachOWriter::MachOSection *Sec = MOW.getConstSection(Ty); -OutputBuffer SecDataOut(TM, Sec->SectionData); +OutputBuffer SecDataOut(Sec->SectionData, is64Bit, isLittleEndian); CPLocations.push_back(Sec->SectionData.size()); CPSections.push_back(Sec->Index); @@ -261,7 +268,7 @@ MachOWriter::MachOSection *Sec = MOW.getJumpTableSection(); unsigned TextSecIndex = MOW.getTextSection()->Index; - OutputBuffer SecDataOut(TM, Sec->SectionData); + OutputBuffer SecDataOut(Sec->SectionData, is64Bit, isLittleEndian); for (unsigned i = 0, e = JT.size(); i != e; ++i) { // For each jump table, record its offset from the start of the section, @@ -309
[llvm-commits] CVS: llvm/include/llvm/Support/OutputBuffer.h
Changes in directory llvm/include/llvm/Support: OutputBuffer.h updated: 1.1 -> 1.2 --- Log message: Have the OutputBuffer take the is64Bit and isLittleEndian booleans. --- Diffs of the changes: (+5 -6) OutputBuffer.h | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Support/OutputBuffer.h diff -u llvm/include/llvm/Support/OutputBuffer.h:1.1 llvm/include/llvm/Support/OutputBuffer.h:1.2 --- llvm/include/llvm/Support/OutputBuffer.h:1.1Wed Jan 17 16:17:24 2007 +++ llvm/include/llvm/Support/OutputBuffer.hWed Jan 17 19:23:11 2007 @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_OUTPUTBUFFER_H #define LLVM_SUPPORT_OUTPUTBUFFER_H +#include #include namespace llvm { @@ -26,11 +27,9 @@ /// machine directly, indicating what header values and flags to set. bool is64Bit, isLittleEndian; public: -OutputBuffer(const TargetMachine& TM, - std::vector &Out) : Output(Out) { - is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; - isLittleEndian = TM.getTargetData()->isLittleEndian(); -} +OutputBuffer(std::vector &Out, + bool is64bit, bool le) + : Output(Out), is64Bit(is64bit), isLittleEndian(le) {} // align - Emit padding into the file until the current output position is // aligned to the specified power of two boundary. @@ -107,7 +106,7 @@ else outxword(X); } -void outstring(std::string &S, unsigned Length) { +void outstring(const std::string &S, unsigned Length) { unsigned len_to_copy = S.length() < Length ? S.length() : Length; unsigned len_to_fill = S.length() < Length ? Length - S.length() : 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCMachOWriter.cpp updated: 1.12 -> 1.13 --- Log message: Have the OutputBuffer take the is64Bit and isLittleEndian booleans. --- Diffs of the changes: (+8 -8) PPCMachOWriter.cpp | 16 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.12 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.13 --- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.12 Wed Jan 17 16:22:31 2007 +++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Wed Jan 17 19:23:11 2007 @@ -93,11 +93,11 @@ isExtern, PPC_RELOC_VANILLA); ++From.nreloc; - OutputBuffer RelocOut(TM, From.RelocBuffer); + OutputBuffer RelocOut(From.RelocBuffer, is64Bit, isLittleEndian); RelocOut.outword(VANILLA.r_address); RelocOut.outword(VANILLA.getPackedFields()); - OutputBuffer SecOut(TM, From.SectionData); + OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian); SecOut.fixword(Addr, MR.getMachineCodeOffset()); break; } @@ -109,7 +109,7 @@ Addr <<= 2; Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24); - OutputBuffer SecOut(TM, From.SectionData); + OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian); SecOut.fixword(Addr, MR.getMachineCodeOffset()); break; } @@ -118,7 +118,7 @@ Addr -= MR.getMachineCodeOffset(); Addr &= 0xFFFC; - OutputBuffer SecOut(TM, From.SectionData); + OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian); SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2); break; } @@ -131,7 +131,7 @@ ++From.nreloc; ++From.nreloc; - OutputBuffer RelocOut(TM, From.RelocBuffer); + OutputBuffer RelocOut(From.RelocBuffer, is64Bit, isLittleEndian); RelocOut.outword(HA16.r_address); RelocOut.outword(HA16.getPackedFields()); RelocOut.outword(PAIR.r_address); @@ -139,7 +139,7 @@ printf("ha16: %x\n", (unsigned)Addr); Addr += 0x8000; - OutputBuffer SecOut(TM, From.SectionData); + OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian); SecOut.fixhalf(Addr >> 16, MR.getMachineCodeOffset() + 2); break; } @@ -152,14 +152,14 @@ ++From.nreloc; ++From.nreloc; - OutputBuffer RelocOut(TM, From.RelocBuffer); + OutputBuffer RelocOut(From.RelocBuffer, is64Bit, isLittleEndian); RelocOut.outword(LO16.r_address); RelocOut.outword(LO16.getPackedFields()); RelocOut.outword(PAIR.r_address); RelocOut.outword(PAIR.getPackedFields()); printf("lo16: %x\n", (unsigned)Addr); - OutputBuffer SecOut(TM, From.SectionData); + OutputBuffer SecOut(From.SectionData, is64Bit, isLittleEndian); SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2); break; } ___ 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/X86TargetAsmInfo.cpp
Changes in directory llvm/lib/Target/X86: X86TargetAsmInfo.cpp updated: 1.29 -> 1.30 --- Log message: Modify emission of jump tables on darwin to emit an extra "l" label that delimits the boundaries of jump tables. This lets the linker's dead code stripping optimization do a better job. --- Diffs of the changes: (+7 -0) X86TargetAsmInfo.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.29 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.30 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.29 Wed Jan 17 11:43:33 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cppWed Jan 17 19:15:58 2007 @@ -68,6 +68,13 @@ WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; +// In non-PIC modes, emit a special label before jump tables so that the +// linker can perform more accurate dead code stripping. +if (TM.getRelocationModel() != Reloc::PIC_) { + // Emit a local label that is preserved until the linker runs. + JumpTableSpecialLabelPrefix = "l"; +} + NeedsSet = true; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCTargetAsmInfo.cpp updated: 1.13 -> 1.14 --- Log message: Modify emission of jump tables on darwin to emit an extra "l" label that delimits the boundaries of jump tables. This lets the linker's dead code stripping optimization do a better job. --- Diffs of the changes: (+7 -0) PPCTargetAsmInfo.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.13 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.14 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.13 Tue Jan 16 03:29:16 2007 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cppWed Jan 17 19:15:58 2007 @@ -57,6 +57,13 @@ UsedDirective = "\t.no_dead_strip\t"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; + + // In non-PIC modes, emit a special label before jump tables so that the + // linker can perform more accurate dead code stripping. + if (TM.getRelocationModel() != Reloc::PIC_) { +// Emit a local label that is preserved until the linker runs. +JumpTableSpecialLabelPrefix = "l"; + } } LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.136 -> 1.137 --- Log message: add new JumpTableSpecialLabelPrefix hook to asmprinter for jumptable emission. --- Diffs of the changes: (+9 -1) AsmPrinter.cpp | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.136 llvm/lib/CodeGen/AsmPrinter.cpp:1.137 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.136 Mon Jan 15 21:42:04 2007 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Jan 17 19:12:56 2007 @@ -244,6 +244,13 @@ if (EmittedSets.insert(JTBBs[ii]).second) printSetLabel(i, JTBBs[ii]); +// On some targets (e.g. darwin) we want to emit two consequtive labels +// before each jump table. The first label is never referenced, but tells +// the assembler and linker the extents of the jump table object. The +// second label is actually referenced by the code. +if (const char *JTLabelPrefix = TAI->getJumpTableSpecialLabelPrefix()) + O << JTLabelPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n"; + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_' << i << ":\n"; @@ -259,7 +266,8 @@ << '_' << i << "_set_" << JTBBs[ii]->getNumber(); } else if (IsPic) { printBasicBlockLabel(JTBBs[ii], false, false); -//If the arch uses custom Jump Table directives, don't calc relative to JT +// If the arch uses custom Jump Table directives, don't calc relative to +// JT if (!HadJTEntryDirective) O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_' << i; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.22 -> 1.23 --- Log message: add new JumpTableSpecialLabelPrefix hook to asmprinter for jumptable emission. --- Diffs of the changes: (+7 -0) TargetAsmInfo.h |7 +++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.22 llvm/include/llvm/Target/TargetAsmInfo.h:1.23 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.22 Wed Jan 17 11:42:30 2007 +++ llvm/include/llvm/Target/TargetAsmInfo.hWed Jan 17 19:12:56 2007 @@ -78,6 +78,10 @@ /// have names in the .o file. This is often "." or "L". const char *PrivateGlobalPrefix; // Defaults to "." +/// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is +/// emitted before jump tables with the specified prefix. +const char *JumpTableSpecialLabelPrefix; // Default to null. + /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings /// will enclose any GlobalVariable (that isn't a function) /// @@ -343,6 +347,9 @@ const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; } +const char *getJumpTableSpecialLabelPrefix() const { + return JumpTableSpecialLabelPrefix; +} const char *getGlobalVarAddrPrefix() const { return GlobalVarAddrPrefix; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp
Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.15 -> 1.16 --- Log message: add new JumpTableSpecialLabelPrefix hook to asmprinter for jumptable emission. --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.15 llvm/lib/Target/TargetAsmInfo.cpp:1.16 --- llvm/lib/Target/TargetAsmInfo.cpp:1.15 Wed Jan 17 11:42:42 2007 +++ llvm/lib/Target/TargetAsmInfo.cpp Wed Jan 17 19:12:56 2007 @@ -28,6 +28,7 @@ CommentString("#"), GlobalPrefix(""), PrivateGlobalPrefix("."), + JumpTableSpecialLabelPrefix(0), GlobalVarAddrPrefix(""), GlobalVarAddrSuffix(""), FunctionAddrPrefix(""), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Intrinsics.td
Changes in directory llvm/include/llvm: Intrinsics.td updated: 1.40 -> 1.41 --- Log message: For PR1028: http://llvm.org/PR1028 : Add the llvm.stacksave and llvm.stackrestore intrinsics that correspond to the GCC builtins __builtin_stack_save and __builtin_stack_restore. This allows the CBE to execute these builtins, and fixes: test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll External/SPEC/CINT2000/176.gcc (CBE) Patch by Gordon Henriksen. --- Diffs of the changes: (+4 -2) Intrinsics.td |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Intrinsics.td diff -u llvm/include/llvm/Intrinsics.td:1.40 llvm/include/llvm/Intrinsics.td:1.41 --- llvm/include/llvm/Intrinsics.td:1.40Fri Jan 12 01:05:13 2007 +++ llvm/include/llvm/Intrinsics.td Wed Jan 17 17:33:20 2007 @@ -138,8 +138,10 @@ // def int_returnaddress : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>; def int_frameaddress : Intrinsic<[llvm_ptr_ty, llvm_i32_ty], [IntrNoMem]>; -def int_stacksave : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>; -def int_stackrestore : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>; +def int_stacksave : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>, +GCCBuiltin<"__builtin_stack_save">; +def int_stackrestore : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>, +GCCBuiltin<"__builtin_stack_restore">; def int_prefetch : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty]>; def int_pcmarker : Intrinsic<[llvm_void_ty, llvm_i32_ty]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll
Changes in directory llvm/test/CodeGen/CBackend: 2007-01-17-StackSaveNRestore.ll added (r1.1) --- Log message: For PR1028: http://llvm.org/PR1028 : Ensure the CBE generates calls to GCC builtins for stack_save and stack_restore when it encounters the corresponding intrinsics. Patch by Gordon Henriksen. --- Diffs of the changes: (+12 -0) 2007-01-17-StackSaveNRestore.ll | 12 1 files changed, 12 insertions(+) Index: llvm/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll diff -c /dev/null llvm/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll:1.1 *** /dev/null Wed Jan 17 17:20:53 2007 --- llvm/test/CodeGen/CBackend/2007-01-17-StackSaveNRestore.ll Wed Jan 17 17:20:43 2007 *** *** 0 --- 1,12 + ; RUN: llvm-as < %s | llc -march=c | grep __builtin_stack_save + ; RUN: llvm-as < %s | llc -march=c | grep __builtin_stack_restore + ; PR1028 + + declare i8* %llvm.stacksave() + declare void %llvm.stackrestore(i8*) + + define i8* %test() { + %s = call i8* %llvm.stacksave() + call void %llvm.stackrestore(i8* %s) + ret i8* %s + } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCMachOWriter.cpp updated: 1.11 -> 1.12 --- Log message: Changed to use the OutputBuffer instead of the methods in MachO and ELF writers. --- Diffs of the changes: (+52 -31) PPCMachOWriter.cpp | 83 + 1 files changed, 52 insertions(+), 31 deletions(-) Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.11 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.12 --- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.11 Wed Jan 17 03:06:13 2007 +++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Wed Jan 17 16:22:31 2007 @@ -17,6 +17,7 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/MachOWriter.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/OutputBuffer.h" using namespace llvm; namespace { @@ -91,24 +92,36 @@ MachORelocation VANILLA(MR.getMachineCodeOffset(), To.Index, false, 2, isExtern, PPC_RELOC_VANILLA); ++From.nreloc; - outword(From.RelocBuffer, VANILLA.r_address); - outword(From.RelocBuffer, VANILLA.getPackedFields()); + + OutputBuffer RelocOut(TM, From.RelocBuffer); + RelocOut.outword(VANILLA.r_address); + RelocOut.outword(VANILLA.getPackedFields()); + + OutputBuffer SecOut(TM, From.SectionData); + SecOut.fixword(Addr, MR.getMachineCodeOffset()); + break; } -fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); -break; case PPC::reloc_pcrel_bx: -Addr -= MR.getMachineCodeOffset(); -Addr >>= 2; -Addr &= 0xFF; -Addr <<= 2; -Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24); -fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); -break; +{ + Addr -= MR.getMachineCodeOffset(); + Addr >>= 2; + Addr &= 0xFF; + Addr <<= 2; + Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24); + + OutputBuffer SecOut(TM, From.SectionData); + SecOut.fixword(Addr, MR.getMachineCodeOffset()); + break; +} case PPC::reloc_pcrel_bcx: -Addr -= MR.getMachineCodeOffset(); -Addr &= 0xFFFC; -fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); -break; +{ + Addr -= MR.getMachineCodeOffset(); + Addr &= 0xFFFC; + + OutputBuffer SecOut(TM, From.SectionData); + SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2); + break; +} case PPC::reloc_absolute_high: { MachORelocation HA16(MR.getMachineCodeOffset(), To.Index, false, 2, @@ -117,15 +130,19 @@ PPC_RELOC_PAIR); ++From.nreloc; ++From.nreloc; - outword(From.RelocBuffer, HA16.r_address); - outword(From.RelocBuffer, HA16.getPackedFields()); - outword(From.RelocBuffer, PAIR.r_address); - outword(From.RelocBuffer, PAIR.getPackedFields()); -} -printf("ha16: %x\n", (unsigned)Addr); -Addr += 0x8000; -fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2); -break; + + OutputBuffer RelocOut(TM, From.RelocBuffer); + RelocOut.outword(HA16.r_address); + RelocOut.outword(HA16.getPackedFields()); + RelocOut.outword(PAIR.r_address); + RelocOut.outword(PAIR.getPackedFields()); + printf("ha16: %x\n", (unsigned)Addr); + Addr += 0x8000; + + OutputBuffer SecOut(TM, From.SectionData); + SecOut.fixhalf(Addr >> 16, MR.getMachineCodeOffset() + 2); + break; +} case PPC::reloc_absolute_low: { MachORelocation LO16(MR.getMachineCodeOffset(), To.Index, false, 2, @@ -134,14 +151,18 @@ PPC_RELOC_PAIR); ++From.nreloc; ++From.nreloc; - outword(From.RelocBuffer, LO16.r_address); - outword(From.RelocBuffer, LO16.getPackedFields()); - outword(From.RelocBuffer, PAIR.r_address); - outword(From.RelocBuffer, PAIR.getPackedFields()); + + OutputBuffer RelocOut(TM, From.RelocBuffer); + RelocOut.outword(LO16.r_address); + RelocOut.outword(LO16.getPackedFields()); + RelocOut.outword(PAIR.r_address); + RelocOut.outword(PAIR.getPackedFields()); + printf("lo16: %x\n", (unsigned)Addr); + + OutputBuffer SecOut(TM, From.SectionData); + SecOut.fixhalf(Addr, MR.getMachineCodeOffset() + 2); + break; } -printf("lo16: %x\n", (unsigned)Addr); -fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); -break; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp
Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.32 -> 1.33 MachOWriter.cpp updated: 1.14 -> 1.15 --- Log message: Changed to use the OutputBuffer instead of the methods in MachO and ELF writers. --- Diffs of the changes: (+148 -126) ELFWriter.cpp | 112 -- MachOWriter.cpp | 162 ++-- 2 files changed, 148 insertions(+), 126 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.32 llvm/lib/CodeGen/ELFWriter.cpp:1.33 --- llvm/lib/CodeGen/ELFWriter.cpp:1.32 Wed Jan 17 03:06:13 2007 +++ llvm/lib/CodeGen/ELFWriter.cpp Wed Jan 17 16:22:31 2007 @@ -38,6 +38,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" +#include "llvm/Support/OutputBuffer.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -50,11 +51,12 @@ /// functions to the ELF file. class ELFCodeEmitter : public MachineCodeEmitter { ELFWriter &EW; +TargetMachine &TM; ELFWriter::ELFSection *ES; // Section to write to. std::vector *OutBuffer; size_t FnStart; public: -ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutBuffer(0) {} +ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {} void startFunction(MachineFunction &F); bool finishFunction(MachineFunction &F); @@ -103,8 +105,8 @@ ELFWriter::ELFSection::SHF_EXECINSTR | ELFWriter::ELFSection::SHF_ALLOC); OutBuffer = &ES->SectionData; - cerr << "FIXME: This code needs to be updated for changes in the" - << " CodeEmitter interfaces. In particular, this should set " + cerr << "FIXME: This code needs to be updated for changes in the " + << "CodeEmitter interfaces. In particular, this should set " << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!"; abort(); @@ -113,8 +115,8 @@ // Add padding zeros to the end of the buffer to make sure that the // function will start on the correct byte alignment within the section. - ELFWriter::align(*OutBuffer, Align); - + OutputBuffer OB(TM, *OutBuffer); + OB.align(Align); FnStart = OutBuffer->size(); } @@ -145,7 +147,7 @@ FnSym.SetType(ELFWriter::ELFSym::STT_FUNC); FnSym.SectionIdx = ES->SectionIdx; -FnSym.Value = FnStart; // Value = Offset from start of Section. + FnSym.Value = FnStart; // Value = Offset from start of Section. FnSym.Size = OutBuffer->size()-FnStart; // Finally, add it to the symtab. @@ -180,37 +182,38 @@ // Local alias to shortenify coming code. std::vector &FH = FileHeader; + OutputBuffer FHOut(TM, FH); - outbyte(FH, 0x7F); // EI_MAG0 - outbyte(FH, 'E'); // EI_MAG1 - outbyte(FH, 'L'); // EI_MAG2 - outbyte(FH, 'F'); // EI_MAG3 - outbyte(FH, is64Bit ? 2 : 1); // EI_CLASS - outbyte(FH, isLittleEndian ? 1 : 2); // EI_DATA - outbyte(FH, 1);// EI_VERSION + FHOut.outbyte(0x7F); // EI_MAG0 + FHOut.outbyte('E'); // EI_MAG1 + FHOut.outbyte('L'); // EI_MAG2 + FHOut.outbyte('F'); // EI_MAG3 + FHOut.outbyte(is64Bit ? 2 : 1); // EI_CLASS + FHOut.outbyte(isLittleEndian ? 1 : 2); // EI_DATA + FHOut.outbyte(1);// EI_VERSION FH.resize(16); // EI_PAD up to 16 bytes. // This should change for shared objects. - outhalf(FH, 1); // e_type = ET_REL - outhalf(FH, e_machine); // e_machine = whatever the target wants - outword(FH, 1); // e_version = 1 - outaddr(FH, 0); // e_entry = 0 -> no entry point in .o file - outaddr(FH, 0); // e_phoff = 0 -> no program header for .o + FHOut.outhalf(1); // e_type = ET_REL + FHOut.outhalf(e_machine); // e_machine = whatever the target wants + FHOut.outword(1); // e_version = 1 + FHOut.outaddr(0); // e_entry = 0 -> no entry point in .o file + FHOut.outaddr(0); // e_phoff = 0 -> no program header for .o ELFHeader_e_shoff_Offset = FH.size(); - outaddr(FH, 0); // e_shoff - outword(FH, e_flags); // e_flags = whatever the target wants + FHOut.outaddr(0); // e_shoff + FHOut.outword(e_flags); // e_flags = whatever the target wants - outhalf(FH, is64Bit ? 64 : 52); // e_ehsize = ELF header size - outhalf(FH, 0); // e_phentsize = prog header entry size - outhalf(FH, 0); // e_phnum = # prog header entries = 0 - outhalf(FH, is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size + FHOut.outhalf(is64Bit ? 64 : 52); // e_ehsize = ELF header size + FHOut.outhalf(0); // e_phe
[llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h MachOWriter.h
Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.14 -> 1.15 MachOWriter.h updated: 1.13 -> 1.14 --- Log message: Changed to use the OutputBuffer instead of the methods in MachO and ELF writers. --- Diffs of the changes: (+0 -191) ELFWriter.h | 96 -- MachOWriter.h | 95 - 2 files changed, 191 deletions(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.14 llvm/include/llvm/CodeGen/ELFWriter.h:1.15 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.14 Wed Jan 17 03:06:13 2007 +++ llvm/include/llvm/CodeGen/ELFWriter.h Wed Jan 17 16:22:31 2007 @@ -214,102 +214,6 @@ unsigned ELFHeader_e_shoff_Offset; // e_shoffin ELF header. unsigned ELFHeader_e_shstrndx_Offset; // e_shstrndx in ELF header. unsigned ELFHeader_e_shnum_Offset; // e_shnumin ELF header. - - -// align - Emit padding into the file until the current output position is -// aligned to the specified power of two boundary. -static void align(DataBuffer &Output, unsigned Boundary) { - assert(Boundary && (Boundary & (Boundary-1)) == 0 && - "Must align to 2^k boundary"); - size_t Size = Output.size(); - if (Size & (Boundary-1)) { -// Add padding to get alignment to the correct place. -size_t Pad = Boundary-(Size & (Boundary-1)); -Output.resize(Size+Pad); - } -} - -static void outbyte(DataBuffer &Output, unsigned char X) { - Output.push_back(X); -} -void outhalf(DataBuffer &Output, unsigned short X) { - if (isLittleEndian) { -Output.push_back(X&255); -Output.push_back(X >> 8); - } else { -Output.push_back(X >> 8); -Output.push_back(X&255); - } -} -void outword(DataBuffer &Output, unsigned X) { - if (isLittleEndian) { -Output.push_back((X >> 0) & 255); -Output.push_back((X >> 8) & 255); -Output.push_back((X >> 16) & 255); -Output.push_back((X >> 24) & 255); - } else { -Output.push_back((X >> 24) & 255); -Output.push_back((X >> 16) & 255); -Output.push_back((X >> 8) & 255); -Output.push_back((X >> 0) & 255); - } -} -void outxword(DataBuffer &Output, uint64_t X) { - if (isLittleEndian) { -Output.push_back(unsigned(X >> 0) & 255); -Output.push_back(unsigned(X >> 8) & 255); -Output.push_back(unsigned(X >> 16) & 255); -Output.push_back(unsigned(X >> 24) & 255); -Output.push_back(unsigned(X >> 32) & 255); -Output.push_back(unsigned(X >> 40) & 255); -Output.push_back(unsigned(X >> 48) & 255); -Output.push_back(unsigned(X >> 56) & 255); - } else { -Output.push_back(unsigned(X >> 56) & 255); -Output.push_back(unsigned(X >> 48) & 255); -Output.push_back(unsigned(X >> 40) & 255); -Output.push_back(unsigned(X >> 32) & 255); -Output.push_back(unsigned(X >> 24) & 255); -Output.push_back(unsigned(X >> 16) & 255); -Output.push_back(unsigned(X >> 8) & 255); -Output.push_back(unsigned(X >> 0) & 255); - } -} -void outaddr32(DataBuffer &Output, unsigned X) { - outword(Output, X); -} -void outaddr64(DataBuffer &Output, uint64_t X) { - outxword(Output, X); -} -void outaddr(DataBuffer &Output, uint64_t X) { - if (!is64Bit) -outword(Output, (unsigned)X); - else -outxword(Output, X); -} - -// fix functions - Replace an existing entry at an offset. -void fixhalf(DataBuffer &Output, unsigned short X, unsigned Offset) { - unsigned char *P = &Output[Offset]; - P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255; - P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255; -} - -void fixword(DataBuffer &Output, unsigned X, unsigned Offset) { - unsigned char *P = &Output[Offset]; - P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255; - P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255; - P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255; - P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255; -} - -void fixaddr(DataBuffer &Output, uint64_t X, unsigned Offset) { - if (!is64Bit) -fixword(Output, (unsigned)X, Offset); - else -assert(0 && "Emission of 64-bit data not implemented yet!"); -} - private: void EmitGlobal(GlobalVariable *GV); Index: llvm/include/llvm/CodeGen/MachOWriter.h diff -u llvm/include/llvm/CodeGen/MachOWriter.h:1.13 llvm/include/llvm/CodeGen/MachOWriter.h:1.14 --- llvm/include/llvm/CodeGen/MachOWriter.h:1.13Wed Jan 17 03:06:13 2007 +++ llvm/include/llvm/CodeGen/MachOWriter.h Wed Jan 17 16:22:31 2007 @@ -659,101 +659,6 @@ /// SymbolTable to aid in emitting the DYSYMTAB load command. std::vector DynamicSymbolTable; -
[llvm-commits] CVS: llvm/include/llvm/Support/OutputBuffer.h
Changes in directory llvm/include/llvm/Support: OutputBuffer.h added (r1.1) --- Log message: Refactored output buffer methods from MachO and ELF writers. --- Diffs of the changes: (+146 -0) OutputBuffer.h | 146 + 1 files changed, 146 insertions(+) Index: llvm/include/llvm/Support/OutputBuffer.h diff -c /dev/null llvm/include/llvm/Support/OutputBuffer.h:1.1 *** /dev/null Wed Jan 17 16:17:34 2007 --- llvm/include/llvm/Support/OutputBuffer.hWed Jan 17 16:17:24 2007 *** *** 0 --- 1,146 + //=== OutputBuffer.h - Output Buffer *- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Bill Wendling and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // Methods to output values to a data buffer. + // + //===--===// + + #ifndef LLVM_SUPPORT_OUTPUTBUFFER_H + #define LLVM_SUPPORT_OUTPUTBUFFER_H + + #include + + namespace llvm { + + class OutputBuffer { + /// Output buffer. + std::vector &Output; + + /// is64Bit/isLittleEndian - This information is inferred from the target + /// machine directly, indicating what header values and flags to set. + bool is64Bit, isLittleEndian; + public: + OutputBuffer(const TargetMachine& TM, + std::vector &Out) : Output(Out) { + is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; + isLittleEndian = TM.getTargetData()->isLittleEndian(); + } + + // align - Emit padding into the file until the current output position is + // aligned to the specified power of two boundary. + void align(unsigned Boundary) { + assert(Boundary && (Boundary & (Boundary - 1)) == 0 && + "Must alitypedef std::vector DataBuffer;gn to 2^k boundary"); + size_t Size = Output.size(); + + if (Size & (Boundary - 1)) { + // Add padding to get alignment to the correct place. + size_t Pad = Boundary - (Size & (Boundary - 1)); + Output.resize(Size + Pad); + } + } + + //===--===// + // Out Functions - Output the specified value to the data buffer. + + void outbyte(unsigned char X) { + Output.push_back(X); + } + void outhalf(unsigned short X) { + if (isLittleEndian) { + Output.push_back(X & 255); + Output.push_back(X >> 8); + } else { + Output.push_back(X >> 8); + Output.push_back(X & 255); + } + } + void outword(unsigned X) { + if (isLittleEndian) { + Output.push_back((X >> 0) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 24) & 255); + } else { + Output.push_back((X >> 24) & 255); + Output.push_back((X >> 16) & 255); + Output.push_back((X >> 8) & 255); + Output.push_back((X >> 0) & 255); + } + } + void outxword(uint64_t X) { + if (isLittleEndian) { + Output.push_back(unsigned(X >> 0) & 255); + Output.push_back(unsigned(X >> 8) & 255); + Output.push_back(unsigned(X >> 16) & 255); + Output.push_back(unsigned(X >> 24) & 255); + Output.push_back(unsigned(X >> 32) & 255); + Output.push_back(unsigned(X >> 40) & 255); + Output.push_back(unsigned(X >> 48) & 255); + Output.push_back(unsigned(X >> 56) & 255); + } else { + Output.push_back(unsigned(X >> 56) & 255); + Output.push_back(unsigned(X >> 48) & 255); + Output.push_back(unsigned(X >> 40) & 255); + Output.push_back(unsigned(X >> 32) & 255); + Output.push_back(unsigned(X >> 24) & 255); + Output.push_back(unsigned(X >> 16) & 255); + Output.push_back(unsigned(X >> 8) & 255); + Output.push_back(unsigned(X >> 0) & 255); + } + } + void outaddr32(unsigned X) { + outword(X); + } + void outaddr64(uint64_t X) { + outxword(X); + } + void outaddr(uint64_t X) { + if (!is64Bit) + outword((unsigned)X); + else + outxword(X); + } + void outstring(std::string &S, unsigned Length) { + unsigned len_to_copy = S.length() < Length ? S.length() : Length; + unsigned len_to_fill = S.length() < Length ? Length - S.length() : 0; + + for (unsigned i = 0; i < len_to_copy; ++i) + outbyte(S[i]); + + for (unsigned i = 0; i < len_to_fill; ++i) + outbyte(0); + } + + //===--===// + // Fix Functions - Replace an e
[llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp
Changes in directory llvm/lib/Analysis/IPA: CallGraphSCCPass.cpp updated: 1.10 -> 1.11 --- Log message: Add CGPassManager. --- Diffs of the changes: (+124 -0) CallGraphSCCPass.cpp | 124 +++ 1 files changed, 124 insertions(+) Index: llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp diff -u llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.10 llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.11 --- llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.10 Thu Apr 21 16:08:44 2005 +++ llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp Wed Jan 17 15:45:01 2007 @@ -18,8 +18,132 @@ #include "llvm/CallGraphSCCPass.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/ADT/SCCIterator.h" +#include "llvm/PassManagers.h" using namespace llvm; +//===--===// +// CGPassManager +// +/// CGPassManager manages FPPassManagers and CalLGraphSCCPasses. + +class CGPassManager : public ModulePass, public PMDataManager { + +public: + CGPassManager(int Depth) : PMDataManager(Depth) { } + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool runOnModule(Module &M); + + bool doInitialization(CallGraph &CG); + bool doFinalization(CallGraph &CG); + + /// Pass Manager itself does not invalidate any analysis info. + void getAnalysisUsage(AnalysisUsage &Info) const { +// CGPassManager walks SCC and it needs CallGraph. +Info.addRequired(); +Info.setPreservesAll(); + } + + // Print passes managed by this manager + void dumpPassStructure(unsigned Offset) { +llvm::cerr << std::string(Offset*2, ' ') << "Call Graph SCC Pass Manager\n"; +for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + Pass *P = getContainedPass(Index); + P->dumpPassStructure(Offset + 1); + dumpLastUses(P, Offset+1); +} + } + + Pass *getContainedPass(unsigned N) { +assert ( N < PassVector.size() && "Pass number out of range!"); +Pass *FP = static_cast(PassVector[N]); +return FP; + } + + virtual PassManagerType getPassManagerType() { +return PMT_CallGraphPassManager; + } +}; + +/// run - Execute all of the passes scheduled for execution. Keep track of +/// whether any of the passes modifies the module, and if so, return true. +bool CGPassManager::runOnModule(Module &M) { + CallGraph &CG = getAnalysis(); + bool Changed = doInitialization(CG); + + std::string Msg1 = "Executing Pass '"; + std::string Msg3 = "' Made Modification '"; + + // Walk SCC + for (scc_iterator I = scc_begin(&CG), E = scc_end(&CG); + I != E; ++I) { + +// Run all passes on current SCC +for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + + Pass *P = getContainedPass(Index); + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + + std::string Msg2 = "' on Call Graph ...\n'"; + dumpPassInfo(P, Msg1, Msg2); + dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); + + initializeAnalysisImpl(P); + + //if (TheTimeInfo) TheTimeInfo->passStarted(P); + if (CallGraphSCCPass *CGSP = dynamic_cast(P)) + Changed |= CGSP->runOnSCC(*I); // TODO : What if CG is changed ? + else { + FPPassManager *FPP = dynamic_cast(P); + assert (FPP && "Invalid CGPassManager member"); + + // Run pass P on all functions current SCC + std::vector &SCC = *I; + for (unsigned i = 0, e = SCC.size(); i != e; ++i) { + Function *F = SCC[i]->getFunction(); + if (F) + Changed |= FPP->runOnFunction(*F); + } + } + //if (TheTimeInfo) TheTimeInfo->passEnded(MP); + + if (Changed) + dumpPassInfo(P, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); + + removeNotPreservedAnalysis(P); + recordAvailableAnalysis(P); + removeDeadPasses(P, Msg2); +} + } + Changed |= doFinalization(CG); + return Changed; +} + +/// Initialize CG +bool CGPassManager::doInitialization(CallGraph &CG) { + bool Changed = false; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { +Pass *P = getContainedPass(Index); +if (CallGraphSCCPass *CGSP = dynamic_cast(P)) + Changed |= CGSP->doInitialization(CG); + } + return Changed; +} + +/// Finalize CG +bool CGPassManager::doFinalization(CallGraph &CG) { + bool Changed = false; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { +Pass *P = getContainedPass(Index); +if (CallGraphSCCPass *CGSP = dynamic_cast(P)) + Changed |= CGSP->doFinalization(CG); + } + return Changed; +} + /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should /// always explicitly call the implementation here. _
[llvm-commits] Stack and global alignment enhancement patch
Per Chris' suggestion to submit enhancement patches to llvm-commits,... - Adds stack and global alignment options to TargetData specification strings. - Adds minimum stack and global alignment for aggregates. -scooter -- Scott Michel [EMAIL PROTECTED] Member of Technical Staff, CSRD 310/336-5034 The Aerospace Corporation --- old-llvm/include/llvm/Target/TargetData.h 2007-01-17 12:23:39.0 -0800 +++ new-llvm/include/llvm/Target/TargetData.h 2007-01-17 12:23:39.0 -0800 @@ -35,15 +35,39 @@ class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false - unsigned char BoolAlignment; // Defaults to 1 byte - unsigned char ByteAlignment; // Defaults to 1 byte - unsigned char ShortAlignment;// Defaults to 2 bytes - unsigned char IntAlignment; // Defaults to 4 bytes - unsigned char LongAlignment; // Defaults to 8 bytes - unsigned char FloatAlignment;// Defaults to 4 bytes - unsigned char DoubleAlignment; // Defaults to 8 bytes - unsigned char PointerSize; // Defaults to 8 bytes - unsigned char PointerAlignment; // Defaults to 8 bytes + + // "SAAlignment": Struct/Array alignments + unsigned char BoolSAAlignment; // Defaults to 1 byte + unsigned char ByteSAAlignment; // Defaults to 1 byte + unsigned char ShortSAAlignment; // Defaults to 2 bytes + unsigned char IntSAAlignment;// Defaults to 4 bytes + unsigned char LongSAAlignment; // Defaults to 8 bytes + unsigned char FloatSAAlignment; // Defaults to 4 bytes + unsigned char DoubleSAAlignment; // Defaults to 8 bytes + unsigned char PointerMemSize;// Defaults to 8 bytes + unsigned char PointerSAAlignment;// Defaults to 8 bytes + + // Stack type alignments. + unsigned char BoolStackAlignment;// Defaults to BoolAlignment + unsigned char ByteStackAlignment;// Defaults to ByteAlignment + unsigned char ShortStackAlignment; // Defaults to ShortAlignment + unsigned char IntStackAlignment; // Defaults to IntAlignment + unsigned char LongStackAlignment;// Defaults to LongAlignment + unsigned char FloatStackAlignment; // Defaults to FloatAlignment + unsigned char DoubleStackAlignment; // Defaults to DoubleAlignment + unsigned char PointerStackAlignment; // Defaults to PointerAlignment + unsigned char AggMinStackAlignment; // Defaults to 4 bytes + + // Global alignments + unsigned char BoolGlobalAlignment; // Defaults to BoolAlignment + unsigned char ByteGlobalAlignment; // Defaults to ByteAlignment + unsigned char ShortGlobalAlignment; // Defaults to ShortAlignment + unsigned char IntGlobalAlignment;// Defaults to IntAlignment + unsigned char LongGlobalAlignment; // Defaults to LongAlignment + unsigned char FloatGlobalAlignment; // Defaults to FloatAlignment + unsigned char DoubleGlobalAlignment; // Defaults to DoubleAlignment + unsigned char PointerGlobalAlignment;// Defaults to PointerAlignment + unsigned char AggMinGlobalAlignment; // Defaults to 4 bytes public: /// Default ctor - This has to exist, because this is a pass, but it should @@ -68,15 +92,33 @@ TargetData(const TargetData &TD) : ImmutablePass(), LittleEndian(TD.isLittleEndian()), -BoolAlignment(TD.getBoolAlignment()), -ByteAlignment(TD.getByteAlignment()), -ShortAlignment(TD.getShortAlignment()), -IntAlignment(TD.getIntAlignment()), -LongAlignment(TD.getLongAlignment()), -FloatAlignment(TD.getFloatAlignment()), -DoubleAlignment(TD.getDoubleAlignment()), -PointerSize(TD.getPointerSize()), -PointerAlignment(TD.getPointerAlignment()) { +BoolSAAlignment(TD.getBoolSAAlignment()), +ByteSAAlignment(TD.getByteSAAlignment()), +ShortSAAlignment(TD.getShortSAAlignment()), +IntSAAlignment(TD.getIntSAAlignment()), +LongSAAlignment(TD.getLongSAAlignment()), +FloatSAAlignment(TD.getFloatSAAlignment()), +DoubleSAAlignment(TD.getDoubleSAAlignment()), +PointerMemSize(TD.getPointerSize()), +PointerSAAlignment(TD.getPointerSAAlignment()), +BoolStackAlignment(TD.getBoolStackAlignment()), +ByteStackAlignment(TD.getByteStackAlignment()), +ShortStackAlignment(TD.getShortStackAlignment()), +IntStackAlignment(TD.getIntStackAlignment()), +LongStackAlignment(TD.getLongStackAlignment()), +FloatStackAlignment(TD.getFloatStackAlignment()), +DoubleStackAlignment(TD.getDoubleStackAlignment()), +PointerStackAlignment(TD.getPointerStackAlignment()), +AggMinStackAlignment(TD.getAggMinStackAlignment()), +BoolGlobalAlignment(TD.getBoolGlobalAlignment()), +ByteGlobalAlignment(TD.getByteGlobalAlignment()), +ShortGlobalAlignment(TD.getShortGlobalAlignment()), +IntGlobalAlignment(TD.getIntGlobalAlignment()), +LongGlobalAlignment(TD.getLongGlobalAlignment()), +FloatGlobalAlignment(TD.getFloat
[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.128 -> 1.129 --- Log message: Update ModulePass::assignPassManager() to take into account Preferred Pass Manager Type. --- Diffs of the changes: (+5 -4) PassManager.cpp |9 + 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.128 llvm/lib/VMCore/PassManager.cpp:1.129 --- llvm/lib/VMCore/PassManager.cpp:1.128 Wed Jan 17 14:33:36 2007 +++ llvm/lib/VMCore/PassManager.cpp Wed Jan 17 15:19:23 2007 @@ -1207,15 +1207,16 @@ // Find Module Pass Manager while(!PMS.empty()) { -if (PMS.top()->getPassManagerType() > PMT_ModulePassManager) +PassManagerType TopPMType = PMS.top()->getPassManagerType(); +if (TopPMType == PreferredType) + break; // We found desired pass manager +else if (TopPMType > PMT_ModulePassManager) PMS.pop();// Pop children pass managers else break; } - MPPassManager *MPP = dynamic_cast(PMS.top()); - assert(MPP && "Unable to find Module Pass Manager"); - MPP->add(this); + PMS.top()->add(this); } /// Find appropriate Function Pass Manager or Call Graph Pass Manager ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc4: gimplifier fixes
Backported from gcc-4.3. These should only effect the Ada front-end. Index: gcc.llvm.master/gcc/tree.c === --- gcc.llvm.master.orig/gcc/tree.c 2007-01-17 21:40:30.0 +0100 +++ gcc.llvm.master/gcc/tree.c 2007-01-17 21:47:45.0 +0100 @@ -2601,7 +2601,7 @@ break; default: - if (TREE_CODE_CLASS (code) == tcc_unary + if ((TREE_CODE_CLASS (code) == tcc_unary || code == VIEW_CONVERT_EXPR) && node && !TYPE_P (node) && TREE_CONSTANT (node)) TREE_CONSTANT (t) = 1; Index: gcc.llvm.master/gcc/varasm.c === --- gcc.llvm.master.orig/gcc/varasm.c 2007-01-17 21:40:31.0 +0100 +++ gcc.llvm.master/gcc/varasm.c2007-01-17 21:47:45.0 +0100 @@ -3707,6 +3707,10 @@ && ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value)) || DECL_NON_ADDR_CONST_P (value))) return NULL_TREE; + /* "&{...}" requires a temporary to hold the constructed + object. */ + if (value && TREE_CODE (value) == CONSTRUCTOR) +return NULL_TREE; return value; case VIEW_CONVERT_EXPR: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc4: resurrect java
Link with the common stub routines, and remove the partial set of stubs that were defined in the front-end. With this, a java build gets quite far, but dies at libffi/src/x86/ffi.c: In function 'ffi_prep_cif_machdep': libffi/src/x86/ffi.c:130: error: duplicate case value libffi/src/x86/ffi.c:129: error: previously used here Index: gcc.llvm.master/gcc/java/Make-lang.in === --- gcc.llvm.master.orig/gcc/java/Make-lang.in 2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/java/Make-lang.in 2007-01-17 21:47:14.0 +0100 @@ -134,10 +134,13 @@ java/parse-scan.o-warn = -Wno-error java/parse.o-warn = -Wno-error -jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) +# Language-independent object files. +JAVA_BACKEND = $(BACKEND) attribs.o stub-objc.o stub-c.o + +jc1$(exeext): $(JAVA_OBJS) $(JAVA_BACKEND) $(LIBDEPS) rm -f $@ - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ - $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) + $(LINKCC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ + $(JAVA_OBJS) $(JAVA_BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS) rm -f $@ Index: gcc.llvm.master/gcc/java/lang.c === --- gcc.llvm.master.orig/gcc/java/lang.c2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/java/lang.c 2007-01-17 21:47:14.0 +0100 @@ -800,21 +800,6 @@ /* APPLE LOCAL disable_typechecking_for_spec_flag */ int disable_typechecking_for_spec_flag = 0; -/* APPLE LOCAL begin CW asm blocks */ -/* Dummies needed because we use them from cpplib, yuck. */ -int flag_iasm_blocks; -int iasm_state; -int iasm_in_operands; -/* APPLE LOCAL end CW asm blocks */ - -/* APPLE LOCAL begin 4174833 */ -tree -objc_is_class_name (tree ARG_UNUSED (arg)) -{ - return 0; -} -/* APPLE LOCAL end 4174833 */ - /* Every call to a static constructor has an associated boolean variable which is in the outermost scope of the calling method. This variable is used to avoid multiple calls to the static ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc4: resurrect fortran
Link with the common stub routines, and remove the partial set of stubs that were defined in the front-end. With this, the fortran compiler builds, but dies when compiling libgfortran: llvm-convert.cpp:4243: static llvm::Constant* TreeConstantToLLVM::Convert(tree_node*): Assertion `((__extension__ ({ const tree __t = (exp); char const __c = tree_code_type[(int) (((enum tree_code) (__t)->common.code))]; if (!((__c) != tcc_type)) tree_class_check_failed (__t, tcc_type, "../../gcc.llvm.master/gcc/llvm-convert.cpp", 4243, __FUNCTION__); __t; }) ->common.constant_flag) || ((enum tree_code) (exp)->common.code) == STRING_CST) && "Isn't a constant!"' failed. libgfortran/intrinsics/selected_int_kind.f90: In function 'selected_int_kind': libgfortran/intrinsics/selected_int_kind.f90:22: internal compiler error: Aborted Index: gcc.llvm.master/gcc/fortran/Make-lang.in === --- gcc.llvm.master.orig/gcc/fortran/Make-lang.in 2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/fortran/Make-lang.in2007-01-17 21:47:04.0 +0100 @@ -103,12 +103,15 @@ -rm -f gfortran-cross$(exeext) cp gfortran$(exeext) gfortran-cross$(exeext) +# Language-independent object files. +F95_BACKEND = $(BACKEND) attribs.o stub-objc.o stub-c.o + # The compiler itself is called f951. f951$(exeext): $(F95_OBJS) \ - $(BACKEND) $(LIBDEPS) + $(F95_BACKEND) $(LIBDEPS) # APPLE LOCAL LLVM $(LINKCC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ - $(F95_OBJS) $(BACKEND) $(F95_LIBS) + $(F95_OBJS) $(F95_BACKEND) $(F95_LIBS) $(C_STUBS) gt-fortran-f95-lang.h gtype-fortran.h: s-gtype; @true gt-fortran-trans-decl.h gt-fortran-trans.h: s-gtype; @true Index: gcc.llvm.master/gcc/fortran/f95-lang.c === --- gcc.llvm.master.orig/gcc/fortran/f95-lang.c 2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/fortran/f95-lang.c 2007-01-17 21:47:04.0 +0100 @@ -154,21 +154,6 @@ /* APPLE LOCAL disable_typechecking_for_spec_flag */ int disable_typechecking_for_spec_flag = 0; -/* APPLE LOCAL begin CW asm blocks */ -/* Dummies needed because we use them from cpplib, yuck. */ -int flag_iasm_blocks; -int iasm_state; -int iasm_in_operands; -/* APPLE LOCAL end CW asm blocks */ - -/* APPLE LOCAL begin 4174833 */ -tree -objc_is_class_name (tree ARG_UNUSED (arg)) -{ - return 0; -} - -/* APPLE LOCAL end 4174833 */ /* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function that have names. Here so we can clear out their names' definitions at the end of the function. */ Index: gcc.llvm.master/gcc/fortran/trans-types.c === --- gcc.llvm.master.orig/gcc/fortran/trans-types.c 2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/fortran/trans-types.c 2007-01-17 21:47:04.0 +0100 @@ -1752,18 +1752,4 @@ /* APPLE LOCAL constant cfstrings */ struct cpp_reader* parse_in; -/* APPLE LOCAL begin AltiVec */ -tree -build_stmt (enum tree_code code ATTRIBUTE_UNUSED, ...) -{ - gcc_assert(0); -} - -void -store_init_value (tree decl ATTRIBUTE_UNUSED, tree init ATTRIBUTE_UNUSED) -{ - gcc_assert(0); -} -/* APPLE LOCAL end AltiVec */ - #include "gt-fortran-trans-types.h" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] llvm-gcc4: stubs for non C-like languages
Apple's gcc modifications require the existence of routines like iasm_addr and build_modify_expr (see the patch for an exhaustive list) that are only defined by the C-like front-ends (C, C++, ObjC). Trying to build other language front-ends fails at link-time because of the lack of these routines. Rather than adding stubs to each and every front-end (I see someone made a partial start on this), this patch introduces a new file stub-c.c that contains all the missing stubs. Front-ends can then just link with it. Later patches rip out any stubs already defined in the various non C-like front-ends, and cause them to link with stub-c.o instead. The only complication comes from java. Java defines some of the missing routines (serious definitions - not stubs) but not all of them. Because of this I made all the stubs into weak symbols, so the java routines will override the corresponding stubs. Hopefully this patch will not cause problems for non x86 platforms, but I'm not promising anything since I only tested it on x86. Index: gcc.llvm.master/gcc/Makefile.in === --- gcc.llvm.master.orig/gcc/Makefile.in2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/Makefile.in 2007-01-17 21:46:11.0 +0100 @@ -1622,6 +1622,8 @@ c-objc-common.h c-pragma.h stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(GGC_H) $(C_COMMON_H) +stub-c.o : stub-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ +$(GGC_H) $(C_COMMON_H) c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) real.h c-incpath.h cppdefault.h \ $(C_PRAGMA_H) input.h intl.h $(FLAGS_H) toplev.h output.h \ Index: gcc.llvm.master/gcc/stub-c.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ gcc.llvm.master/gcc/stub-c.c2007-01-17 21:46:11.0 +0100 @@ -0,0 +1,158 @@ +/* Stub functions for C language routines that are referenced + from the back-end. + Copyright (C) 1991, 1995, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "c-common.h" + +#define ATTRIBUTE_WEAK __attribute__ ((__weak__)) + +enum iasm_states iasm_state ATTRIBUTE_WEAK; +int iasm_in_operands ATTRIBUTE_WEAK; +int flag_iasm_blocks ATTRIBUTE_WEAK; + + +tree iasm_addr (tree) ATTRIBUTE_WEAK; + +tree iasm_addr (tree e ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + + +tree iasm_build_bracket (tree, tree) ATTRIBUTE_WEAK; + +tree iasm_build_bracket (tree v1 ATTRIBUTE_UNUSED, +tree v2 ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + + +void iasm_force_constraint (const char *, iasm_md_extra_info *) ATTRIBUTE_WEAK; + +void iasm_force_constraint (const char *c ATTRIBUTE_UNUSED, + iasm_md_extra_info *e ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + + +void iasm_get_register_var (tree, const char *, char *, unsigned, bool, + iasm_md_extra_info *) ATTRIBUTE_WEAK; + +void iasm_get_register_var (tree var ATTRIBUTE_UNUSED, + const char *modifier ATTRIBUTE_UNUSED, + char *buf ATTRIBUTE_UNUSED, + unsigned argnum ATTRIBUTE_UNUSED, + bool must_be_reg ATTRIBUTE_UNUSED, + iasm_md_extra_info *e ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + + +bool iasm_is_pseudo (const char *) ATTRIBUTE_WEAK; + +bool iasm_is_pseudo (const char *opcode ATTRIBUTE_UNUSED) +{ + gcc_assert(0); +} + + +void iasm_print_operand (char *, tree, unsigned, tree *, bool, bool, +iasm_md_extra_info *) ATTRIBUTE_WEAK; + +void iasm_print_operand (char *buf ATTRIBUTE_UNUSED, +tree arg ATTRIBUTE_UNUSED, +unsigned argnum ATTRIBUTE_UNUSED, +tree *uses ATTRIBUTE_UNUSED, +bool must_be_reg ATTRIBUTE_UNUSED, +bool must_not_be_reg ATTRIBUTE_UNUSED, +iasm_md_extra_info *e ATTRIBUTE_UNUSED) +{ + gcc_asse
[llvm-commits] llvm-gcc4: use langhooks rather than front-end calls in i386.c
The section of code marked "APPLE LOCAL CW asm blocks" contains calls to routines that only exist in the C-like front-ends (C, C++, ObjC). Some of them are equivalent to langhook calls - so use langhooks for those. This reduces the number of stubs needed to get non C-like languages compiling. Index: gcc.llvm.master/gcc/config/i386/i386.c === --- gcc.llvm.master.orig/gcc/config/i386/i386.c 2007-01-17 21:41:50.0 +0100 +++ gcc.llvm.master/gcc/config/i386/i386.c 2007-01-17 21:45:14.0 +0100 @@ -19594,7 +19594,7 @@ mode = SFmode; if (mode != VOIDmode) - type = c_common_type_for_mode (mode, 1); + type = lang_hooks.types.type_for_mode (mode, 1); } return type; @@ -19626,7 +19626,7 @@ C_DECL_REGISTER (decl) = 1; DECL_HARD_REGISTER (decl) = 1; change_decl_assembler_name (decl, arg); - decl = pushdecl (decl); + decl = lang_hooks.decls.pushdecl (decl); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.127 -> 1.128 --- Log message: s/PassDebugging_New/PassDebugging/g --- Diffs of the changes: (+5 -5) PassManager.cpp | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.127 llvm/lib/VMCore/PassManager.cpp:1.128 --- llvm/lib/VMCore/PassManager.cpp:1.127 Wed Jan 17 14:30:17 2007 +++ llvm/lib/VMCore/PassManager.cpp Wed Jan 17 14:33:36 2007 @@ -39,7 +39,7 @@ }; static cl::opt -PassDebugging_New("debug-pass", cl::Hidden, +PassDebugging("debug-pass", cl::Hidden, cl::desc("Print PassManager debugging information"), cl::values( clEnumVal(None , "disable debug output"), @@ -426,7 +426,7 @@ // Print passes managed by this top level manager. void PMTopLevelManager::dumpPasses() const { - if (PassDebugging_New < Structure) + if (PassDebugging < Structure) return; // Print out the immutable passes @@ -441,7 +441,7 @@ void PMTopLevelManager::dumpArguments() const { - if (PassDebugging_New < Arguments) + if (PassDebugging < Arguments) return; cerr << "Pass Arguments: "; @@ -704,7 +704,7 @@ void PMDataManager:: dumpPassInfo(Pass *P, std::string &Msg1, std::string &Msg2) const { - if (PassDebugging_New < Executions) + if (PassDebugging < Executions) return; cerr << (void*)this << std::string(getDepth()*2+1, ' '); cerr << Msg1; @@ -715,7 +715,7 @@ void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P, const std::vector &Set) const { - if (PassDebugging_New >= Details && !Set.empty()) { + if (PassDebugging >= Details && !Set.empty()) { cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { if (i) cerr << ","; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Pass.h
Changes in directory llvm/include/llvm: Pass.h updated: 1.75 -> 1.76 --- Log message: Update assignPassManager() signature to allow selection of preferred pass manager type. This allows new FPPassManager to select Call Graph Pass Manager (if available) as its parent. --- Diffs of the changes: (+22 -16) Pass.h | 38 ++ 1 files changed, 22 insertions(+), 16 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.75 llvm/include/llvm/Pass.h:1.76 --- llvm/include/llvm/Pass.h:1.75 Tue Jan 16 15:43:18 2007 +++ llvm/include/llvm/Pass.hWed Jan 17 14:30:17 2007 @@ -57,6 +57,20 @@ // AnalysisID - Use the PassInfo to identify a pass... typedef const PassInfo* AnalysisID; +/// Different types of internal pass managers. External pass managers +/// (PassManager and FunctionPassManager) are not represented here. +/// Ordering of pass manager types is important here. +enum PassManagerType { + PMT_Unknown = 0, + PMT_ModulePassManager = 1, /// MPPassManager + PMT_CallGraphPassManager, /// CGPassManager + PMT_FunctionPassManager, /// FPPassManager + PMT_LoopPassManager, /// LPPassManager + PMT_BasicBlockPassManager /// BBPassManager +}; + +typedef enum PassManagerType PassManagerType; + //===--===// /// Pass interface - Implemented by all 'passes'. Subclass this if you are an /// interprocedural optimization or you do not fit into any of the more @@ -107,7 +121,8 @@ void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); } void dump() const; // dump - call print(std::cerr, 0); - virtual void assignPassManager(PMStack &PMS) {} + virtual void assignPassManager(PMStack &PMS, +PassManagerType T = PMT_Unknown) {} // Access AnalysisResolver inline void setResolver(AnalysisResolver *AR) { Resolver = AR; } inline AnalysisResolver *getResolver() { return Resolver; } @@ -200,7 +215,8 @@ virtual bool runPass(Module &M) { return runOnModule(M); } virtual bool runPass(BasicBlock&) { return false; } - virtual void assignPassManager(PMStack &PMS); + virtual void assignPassManager(PMStack &PMS, +PassManagerType T = PMT_ModulePassManager); // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -266,7 +282,8 @@ /// bool run(Function &F); - virtual void assignPassManager(PMStack &PMS); + virtual void assignPassManager(PMStack &PMS, +PassManagerType T = PMT_FunctionPassManager); }; @@ -320,19 +337,8 @@ virtual bool runPass(Module &M) { return false; } virtual bool runPass(BasicBlock &BB); - virtual void assignPassManager(PMStack &PMS); -}; - -/// Different types of internal pass managers. External pass managers -/// (PassManager and FunctionPassManager) are not represented here. -/// Ordering of pass manager types is important here. -enum PassManagerType { - PMT_Unknown = 0, - PMT_ModulePassManager = 1, /// MPPassManager - PMT_CallGraphPassManager, /// CGPassManager - PMT_FunctionPassManager, /// FPPassManager - PMT_LoopPassManager, /// LPPassManager - PMT_BasicBlockPassManager /// BBPassManager + virtual void assignPassManager(PMStack &PMS, +PassManagerType T = PMT_BasicBlockPassManager); }; /// PMStack ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.126 -> 1.127 --- Log message: Update assignPassManager() signature to allow selection of preferred pass manager type. This allows new FPPassManager to select Call Graph Pass Manager (if available) as its parent. --- Diffs of the changes: (+13 -4) PassManager.cpp | 17 + 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.126 llvm/lib/VMCore/PassManager.cpp:1.127 --- llvm/lib/VMCore/PassManager.cpp:1.126 Tue Jan 16 16:38:10 2007 +++ llvm/lib/VMCore/PassManager.cpp Wed Jan 17 14:30:17 2007 @@ -1202,7 +1202,8 @@ /// Find appropriate Module Pass Manager in the PM Stack and /// add self into that manager. -void ModulePass::assignPassManager(PMStack &PMS) { +void ModulePass::assignPassManager(PMStack &PMS, + PassManagerType PreferredType) { // Find Module Pass Manager while(!PMS.empty()) { @@ -1219,7 +1220,8 @@ /// Find appropriate Function Pass Manager or Call Graph Pass Manager /// in the PM Stack and add self into that manager. -void FunctionPass::assignPassManager(PMStack &PMS) { +void FunctionPass::assignPassManager(PMStack &PMS, +PassManagerType PreferredType) { // Find Module Pass Manager (TODO : Or Call Graph Pass Manager) while(!PMS.empty()) { @@ -1245,7 +1247,13 @@ // [3] Assign manager to manage this new manager. This may create // and push new managers into PMS Pass *P = dynamic_cast(FPP); -P->assignPassManager(PMS); + +// If Call Graph Pass Manager is active then use it to manage +// this new Function Pass manager. +if (PMD->getPassManagerType() == PMT_CallGraphPassManager) + P->assignPassManager(PMS, PMT_CallGraphPassManager); +else + P->assignPassManager(PMS); // [4] Push new manager into PMS PMS.push(FPP); @@ -1257,7 +1265,8 @@ /// Find appropriate Basic Pass Manager or Call Graph Pass Manager /// in the PM Stack and add self into that manager. -void BasicBlockPass::assignPassManager(PMStack &PMS) { +void BasicBlockPass::assignPassManager(PMStack &PMS, + PassManagerType PreferredType) { BBPassManager *BBP = NULL; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/Makefile.config.in
Changes in directory llvm: Makefile.config.in updated: 1.73 -> 1.74 --- Log message: For PR739: http://llvm.org/PR739 : Support overriding the prefix and DESTDIR variables from the make command line. This makes the makefile system a little more GNU compliant and the feature makes it easier for distribution builders to re-target the install location of LLVM. --- Diffs of the changes: (+13 -19) Makefile.config.in | 32 +--- 1 files changed, 13 insertions(+), 19 deletions(-) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.73 llvm/Makefile.config.in:1.74 --- llvm/Makefile.config.in:1.73Thu Dec 21 16:55:41 2006 +++ llvm/Makefile.config.in Wed Jan 17 14:24:45 2007 @@ -47,16 +47,8 @@ LLVM_OBJ_ROOT := $(shell cd @abs_top_builddir@; $(PWD)) PROJ_SRC_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(PWD)) PROJ_SRC_DIR:= $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD)) -DESTDIR := @prefix@ -PROJ_prefix := $(DESTDIR) -PROJ_bindir := $(DESTDIR)/bin -PROJ_libdir := $(DESTDIR)/lib -PROJ_datadir:= $(DESTDIR)/share -PROJ_docsdir:= $(DESTDIR)/docs/llvm -PROJ_etcdir := $(DESTDIR)/etc/llvm -PROJ_includedir := $(DESTDIR)/include -PROJ_infodir:= $(DESTDIR)/info -PROJ_mandir := $(DESTDIR)/man +prefix := @prefix@ +PROJ_prefix := $(prefix) PROJ_VERSION:= $(LLVMVersion) else ifndef PROJ_SRC_ROOT @@ -75,20 +67,22 @@ $(error Projects must define LLVM_OBJ_ROOT) endif PROJ_SRC_DIR := $(shell cd $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD)) -PROJ_prefix := $(PROJ_INSTALL_ROOT) -PROJ_bindir := $(PROJ_INSTALL_ROOT)/bin -PROJ_libdir := $(PROJ_INSTALL_ROOT)/lib -PROJ_datadir:= $(PROJ_INSTALL_ROOT)/share -PROJ_docsdir:= $(PROJ_INSTALL_ROOT)/docs/llvm -PROJ_etcdir := $(PROJ_INSTALL_ROOT)/etc/llvm -PROJ_includedir := $(PROJ_INSTALL_ROOT)/include -PROJ_infodir:= $(PROJ_INSTALL_ROOT)/info -PROJ_mandir := $(PROJ_INSTALL_ROOT)/man +prefix := $(PROJ_INSTALL_ROOT) +PROJ_prefix := $(prefix) ifndef PROJ_VERSION PROJ_VERSION := 1.0 endif endif +PROJ_bindir := $(DESTDIR)$(PROJ_prefix)/bin +PROJ_libdir := $(DESTDIR)$(PROJ_prefix)/lib +PROJ_datadir:= $(DESTDIR)$(PROJ_prefix)/share +PROJ_docsdir:= $(DESTDIR)$(PROJ_prefix)/docs/llvm +PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm +PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include +PROJ_infodir:= $(DESTDIR)$(PROJ_prefix)/info +PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/man + # Determine if we're on a unix type operating system LLVM_ON_UNIX:[EMAIL PROTECTED]@ LLVM_ON_WIN32:[EMAIL PROTECTED]@ ___ 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/X86AsmPrinter.cpp
Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.229 -> 1.230 --- Log message: restructure code a bit to make use of continue (simplifying things). Generalize the .zerofill directive emission to not be darwin-specific --- Diffs of the changes: (+95 -92) X86AsmPrinter.cpp | 187 +++--- 1 files changed, 95 insertions(+), 92 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.229 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.230 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.229 Wed Jan 17 04:33:08 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Wed Jan 17 11:44:25 2007 @@ -138,18 +138,26 @@ unsigned Size = TD->getTypeSize(C->getType()); unsigned Align = TD->getPreferredAlignmentLog(I); -if (C->isNullValue() && /* FIXME: Verify correct */ -!I->hasSection() && -(I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage() || - (Subtarget->isTargetDarwin() && - I->hasExternalLinkage( { - if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. +if (I->hasHiddenVisibility()) + if (const char *Directive = TAI->getHiddenDirective()) +O << Directive << name << "\n"; +if (Subtarget->isTargetELF()) + O << "\t.type " << name << ",@object\n"; + +if (C->isNullValue()) { if (I->hasExternalLinkage()) { +if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; - O << "\t.zerofill __DATA__, __common, " << name << ", " + O << Directive << "__DATA__, __common, " << name << ", " << Size << ", " << Align; - } else { + continue; +} + } + + if (!I->hasSection() && + (I->hasInternalLinkage() || I->hasWeakLinkage() || + I->hasLinkOnceLinkage())) { +if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (!NoZerosInBSS && TAI->getBSSSection()) SwitchToDataSection(TAI->getBSSSection(), I); else @@ -170,96 +178,91 @@ if (TAI->getCOMMDirectiveTakesAlignment()) O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } +O << "\t\t" << TAI->getCommentString() << " " << I->getName() << "\n"; +continue; } - O << "\t\t" << TAI->getCommentString() << " " << I->getName() << "\n"; -} else { - switch (I->getLinkage()) { - case GlobalValue::LinkOnceLinkage: - case GlobalValue::WeakLinkage: -if (Subtarget->isTargetDarwin()) { - O << "\t.globl " << name << "\n" -<< "\t.weak_definition " << name << "\n"; - SwitchToDataSection(".section __DATA,__const_coal,coalesced", I); -} else if (Subtarget->isTargetCygMing()) { - std::string SectionName(".section\t.data$linkonce." + - name + - ",\"aw\""); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.globl " << name << "\n" -<< "\t.linkonce same_size\n"; -} else { - std::string SectionName("\t.section\t.llvm.linkonce.d." + - name + - ",\"aw\",@progbits"); - SwitchToDataSection(SectionName.c_str(), I); - O << "\t.weak " << name << "\n"; -} -break; - case GlobalValue::AppendingLinkage: -// FIXME: appending linkage variables should go into a section of -// their name or something. For now, just emit them as external. - case GlobalValue::DLLExportLinkage: -DLLExportedGVs.insert(Mang->makeNameProper(I->getName(),"")); -// FALL THROUGH - case GlobalValue::ExternalLinkage: -// If external or appending, declare as a global symbol -O << "\t.globl " << name << "\n"; -// FALL THROUGH - case GlobalValue::InternalLinkage: { -if (I->isConstant()) { - const ConstantArray *CVA = dyn_cast(C); - if (TAI->getCStringSection() && CVA && CVA->isCString()) { -SwitchToDataSection(TAI->getCStringSection(), I); -break; - } -} -// FIXME: special handling for ".ctors" & ".dtors" sections -if (I->hasSection() && -(I->getSection() == ".ctors" || - I->getSection() == ".dtors")) { - std::string SectionName = ".section " + I->getSection(); - - if (Subtarget->isTargetCygMing()) { -SectionName += ",\"aw\""; - } else { -assert(!Subtarget->isTargetDarwin()); -SectionName += ",\"aw\",@progbits"; - } +} - SwitchToDataSection(SectionName.c_str()); -} else { - if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) -SwitchToD
[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
Changes in directory llvm/lib/Target/X86: X86TargetAsmInfo.cpp updated: 1.28 -> 1.29 --- Log message: darwin doesn't support .bss, but it does have .zerofill --- Diffs of the changes: (+2 -0) X86TargetAsmInfo.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.28 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.29 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.28 Tue Jan 16 03:29:17 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cppWed Jan 17 11:43:33 2007 @@ -47,6 +47,8 @@ Data64bitsDirective = 0; // we can't emit a 64-bit unit ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. PrivateGlobalPrefix = "L"; // Marker for constant pool idxs +BSSSection = 0; // no BSS section. +ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill ConstantPoolSection = "\t.const\n"; JumpTableDataSection = "\t.const\n"; CStringSection = "\t.cstring"; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp
Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.14 -> 1.15 --- Log message: add new directive --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.14 llvm/lib/Target/TargetAsmInfo.cpp:1.15 --- llvm/lib/Target/TargetAsmInfo.cpp:1.14 Wed Jan 17 04:33:08 2007 +++ llvm/lib/Target/TargetAsmInfo.cpp Wed Jan 17 11:42:42 2007 @@ -20,6 +20,7 @@ TextSection(".text"), DataSection(".data"), BSSSection(".bss"), + ZeroFillDirective(0), AddressSize(4), NeedsSet(false), MaxInstLength(4), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.21 -> 1.22 --- Log message: document that BSSSection can be null. Add new ZeroFillDirective directive. --- Diffs of the changes: (+9 -1) TargetAsmInfo.h | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.21 llvm/include/llvm/Target/TargetAsmInfo.h:1.22 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.21 Wed Jan 17 04:33:08 2007 +++ llvm/include/llvm/Target/TargetAsmInfo.hWed Jan 17 11:42:30 2007 @@ -39,10 +39,15 @@ /// const char *DataSection; // Defaults to ".data". -/// BSSSection - Section directive for uninitialized data. +/// BSSSection - Section directive for uninitialized data. Null if this +/// target doesn't support a BSS section. /// const char *BSSSection; // Default to ".bss". +/// ZeroFillDirective - Directive for emitting a global to the ZeroFill +/// section on this target. Null if this target doesn't support zerofill. +const char *ZeroFillDirective;// Default is null. + /// AddressSize - Size of addresses used in file. /// unsigned AddressSize; // Defaults to 4. @@ -320,6 +325,9 @@ const char *getBSSSection() const { return BSSSection; } +const char *getZeroFillDirective() const { + return ZeroFillDirective; +} unsigned getAddressSize() const { return AddressSize; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] "Zeros in bss" patch for llvm-gcc
On Jan 17, 2007, at 2:49 AM, Anton Korobeynikov wrote: > Hello, Everyone. > > Now some codegens by default emit zero-initialized data to .bss > section. > However, sometimes it's really necessary not to do so. This patch will > add handling of "-fno-zero-initialized-in-bss" llvm-gcc' option. It's > necessary to compile crt*.o properly. Yuck, the -fno-zero-initialized-in-bss option in GCC is a horrible hack. However, your implementation of it looks great. I'll apply it. Thanks Anton! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] "Zeros in bss" patch for llvm-gcc
Hello, Everyone. Now some codegens by default emit zero-initialized data to .bss section. However, sometimes it's really necessary not to do so. This patch will add handling of "-fno-zero-initialized-in-bss" llvm-gcc' option. It's necessary to compile crt*.o properly. PS: Also some fix some small typo. :) -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. diff -r 245796fdf9af gcc/config/i386/linux.h --- a/gcc/config/i386/linux.h Fri Jan 12 17:52:01 2007 + +++ b/gcc/config/i386/linux.h Wed Jan 17 02:51:05 2007 +0300 @@ -195,6 +195,6 @@ Boston, MA 02111-1307, USA. */ if (flag_pic) \ argvec.push_back ("--relocation-model=pic"); \ else \ -argvec.push_back ("--relocation-model=static") +argvec.push_back ("--relocation-model=static"); #endif /* APPLE LOCAL end LLVM */ diff -r 245796fdf9af gcc/llvm-backend.cpp --- a/gcc/llvm-backend.cpp Fri Jan 12 17:52:01 2007 + +++ b/gcc/llvm-backend.cpp Wed Jan 17 03:02:51 2007 +0300 @@ -98,3 +98,5 @@ void llvm_initialize_backend(void) { Args.push_back("--enable-unsafe-fp-math"); if (!flag_omit_frame_pointer) Args.push_back("--disable-fp-elim"); + if (!flag_zero_initialized_in_bss) +Args.push_back("--nozero-initialized-in-bss"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetOptions.h
Changes in directory llvm/include/llvm/Target: TargetOptions.h updated: 1.12 -> 1.13 --- Log message: Document flag --- Diffs of the changes: (+3 -0) TargetOptions.h |3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/Target/TargetOptions.h diff -u llvm/include/llvm/Target/TargetOptions.h:1.12 llvm/include/llvm/Target/TargetOptions.h:1.13 --- llvm/include/llvm/Target/TargetOptions.h:1.12 Wed Jan 17 04:33:08 2007 +++ llvm/include/llvm/Target/TargetOptions.hWed Jan 17 04:40:54 2007 @@ -55,6 +55,9 @@ /// target FP instructions. extern bool UseSoftFloat; + /// NoZerosInBSS - By default some codegens place zero-initialized data to + /// .bss section. This flag disables such behaviour (necessary, e.g. for + /// crt*.o compiling). extern bool NoZerosInBSS; } // End llvm namespace ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp TargetMachine.cpp
Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.13 -> 1.14 TargetMachine.cpp updated: 1.58 -> 1.59 --- Log message: * Fix one more bug in PIC codegen: extra load is needed for *all* non-statics. * Introduce new option to output zero-initialized data to .bss section. This can reduce size of binaries. Enable it by default for ELF & Cygwin/Mingw targets. Probably, Darwin should be also added. --- Diffs of the changes: (+7 -0) TargetAsmInfo.cpp |1 + TargetMachine.cpp |6 ++ 2 files changed, 7 insertions(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.13 llvm/lib/Target/TargetAsmInfo.cpp:1.14 --- llvm/lib/Target/TargetAsmInfo.cpp:1.13 Mon Jan 15 21:42:04 2007 +++ llvm/lib/Target/TargetAsmInfo.cpp Wed Jan 17 04:33:08 2007 @@ -19,6 +19,7 @@ TargetAsmInfo::TargetAsmInfo() : TextSection(".text"), DataSection(".data"), + BSSSection(".bss"), AddressSize(4), NeedsSet(false), MaxInstLength(4), Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.58 llvm/lib/Target/TargetMachine.cpp:1.59 --- llvm/lib/Target/TargetMachine.cpp:1.58 Wed Jan 17 03:06:13 2007 +++ llvm/lib/Target/TargetMachine.cpp Wed Jan 17 04:33:08 2007 @@ -28,6 +28,7 @@ bool UnsafeFPMath; bool FiniteOnlyFPMathOption; bool UseSoftFloat; + bool NoZerosInBSS; Reloc::Model RelocationModel; CodeModel::Model CMModel; } @@ -61,6 +62,11 @@ cl::desc("Generate software floating point library calls"), cl::location(UseSoftFloat), cl::init(false)); + cl::opt + DontPlaceZerosInBSS("nozero-initialized-in-bss", + cl::desc("Don't place zero-initialized symbols into bss section"), + cl::location(NoZerosInBSS), + cl::init(false)); cl::opt DefRelocationModel( ___ 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/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86Subtarget.cpp
Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.90 -> 1.91 X86AsmPrinter.cpp updated: 1.228 -> 1.229 X86Subtarget.cpp updated: 1.48 -> 1.49 --- Log message: * Fix one more bug in PIC codegen: extra load is needed for *all* non-statics. * Introduce new option to output zero-initialized data to .bss section. This can reduce size of binaries. Enable it by default for ELF & Cygwin/Mingw targets. Probably, Darwin should be also added. --- Diffs of the changes: (+24 -16) X86ATTAsmPrinter.cpp | 23 ++- X86AsmPrinter.cpp| 11 +-- X86Subtarget.cpp |6 +- 3 files changed, 24 insertions(+), 16 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.90 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.91 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.90 Tue Jan 16 10:41:57 2007 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppWed Jan 17 04:33:08 2007 @@ -323,22 +323,19 @@ O << Offset; if (isMemOp) { - if (isExt) { -if (Subtarget->isPICStyleGOT()) { + if (Subtarget->isPICStyleGOT()) { +if (Subtarget->GVRequiresExtraLoad(GV, TM, false)) O << "@GOT"; -} else if (Subtarget->isPICStyleRIPRel()) { +else + O << "@GOTOFF"; + } else +if (isExt && Subtarget->isPICStyleRIPRel()) O << "@GOTPCREL(%rip)"; -} else if (Subtarget->is64Bit() && !NotRIPRel) -// Use rip when possible to reduce code size, except when -// index or base register are also part of the address. e.g. -// foo(%rip)(%rcx,%rax,4) is not legal -O << "(%rip)"; - } else { -if (Subtarget->is64Bit() && !NotRIPRel) +else if (Subtarget->is64Bit() && !NotRIPRel) + // Use rip when possible to reduce code size, except when + // index or base register are also part of the address. e.g. + // foo(%rip)(%rcx,%rax,4) is not legal O << "(%rip)"; -else if (Subtarget->isPICStyleGOT()) - O << "@GOTOFF"; - } } return; Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.228 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.229 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.228 Tue Jan 16 10:41:57 2007 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Wed Jan 17 04:33:08 2007 @@ -28,6 +28,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; static X86FunctionInfo calculateFunctionInfo(const Function *F, @@ -149,7 +150,10 @@ O << "\t.zerofill __DATA__, __common, " << name << ", " << Size << ", " << Align; } else { -SwitchToDataSection(TAI->getDataSection(), I); +if (!NoZerosInBSS && TAI->getBSSSection()) + SwitchToDataSection(TAI->getBSSSection(), I); +else + SwitchToDataSection(TAI->getDataSection(), I); if (TAI->getLCOMMDirective() != NULL) { if (I->hasInternalLinkage()) { O << TAI->getLCOMMDirective() << name << "," << Size; @@ -224,7 +228,10 @@ SwitchToDataSection(SectionName.c_str()); } else { - SwitchToDataSection(TAI->getDataSection(), I); + if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection()) +SwitchToDataSection(TAI->getBSSSection(), I); + else +SwitchToDataSection(TAI->getDataSection(), I); } break; Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.48 llvm/lib/Target/X86/X86Subtarget.cpp:1.49 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.48 Fri Jan 12 13:20:47 2007 +++ llvm/lib/Target/X86/X86Subtarget.cppWed Jan 17 04:33:08 2007 @@ -36,10 +36,14 @@ bool isDirectCall) const { if (TM.getRelocationModel() != Reloc::Static) -if (isTargetDarwin() || isPICStyleGOT()) { +if (isTargetDarwin()) { return (!isDirectCall && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || (GV->isExternal() && !GV->hasNotBeenReadFromBytecode(; +} else if (isPICStyleGOT()) { + // Extra load is needed for all non-statics. + return (!isDirectCall && + (GV->isExternal() || !GV->hasInternalLinkage())); } else if (isTargetCygMing() || isTargetWindows()) { return (GV->hasDLLImportLinkage()); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CodeGen/X86/test-pic-6.ll
Changes in directory llvm/test/CodeGen/X86: test-pic-6.ll added (r1.1) --- Log message: * Fix one more bug in PIC codegen: extra load is needed for *all* non-statics. * Introduce new option to output zero-initialized data to .bss section. This can reduce size of binaries. Enable it by default for ELF & Cygwin/Mingw targets. Probably, Darwin should be also added. --- Diffs of the changes: (+17 -0) test-pic-6.ll | 17 + 1 files changed, 17 insertions(+) Index: llvm/test/CodeGen/X86/test-pic-6.ll diff -c /dev/null llvm/test/CodeGen/X86/test-pic-6.ll:1.1 *** /dev/null Wed Jan 17 04:33:18 2007 --- llvm/test/CodeGen/X86/test-pic-6.ll Wed Jan 17 04:33:08 2007 *** *** 0 --- 1,17 + ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && + ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && + ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && + ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOT | wc -l | grep 3 + + %ptr = global i32* null + %dst = global i32 0 + %src = global i32 0 + + define void %foo() { + entry: + store i32* %dst, i32** %ptr + %tmp.s = load i32* %src + store i32 %tmp.s, i32* %dst + ret void + } + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h TargetOptions.h
Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.20 -> 1.21 TargetOptions.h updated: 1.11 -> 1.12 --- Log message: * Fix one more bug in PIC codegen: extra load is needed for *all* non-statics. * Introduce new option to output zero-initialized data to .bss section. This can reduce size of binaries. Enable it by default for ELF & Cygwin/Mingw targets. Probably, Darwin should be also added. --- Diffs of the changes: (+9 -0) TargetAsmInfo.h |7 +++ TargetOptions.h |2 ++ 2 files changed, 9 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.20 llvm/include/llvm/Target/TargetAsmInfo.h:1.21 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.20 Mon Jan 15 21:42:04 2007 +++ llvm/include/llvm/Target/TargetAsmInfo.hWed Jan 17 04:33:08 2007 @@ -38,6 +38,10 @@ /// DataSection - Section directive for standard data. /// const char *DataSection; // Defaults to ".data". + +/// BSSSection - Section directive for uninitialized data. +/// +const char *BSSSection; // Default to ".bss". /// AddressSize - Size of addresses used in file. /// @@ -313,6 +317,9 @@ const char *getDataSection() const { return DataSection; } +const char *getBSSSection() const { + return BSSSection; +} unsigned getAddressSize() const { return AddressSize; } Index: llvm/include/llvm/Target/TargetOptions.h diff -u llvm/include/llvm/Target/TargetOptions.h:1.11 llvm/include/llvm/Target/TargetOptions.h:1.12 --- llvm/include/llvm/Target/TargetOptions.h:1.11 Fri Dec 8 20:41:05 2006 +++ llvm/include/llvm/Target/TargetOptions.hWed Jan 17 04:33:08 2007 @@ -54,6 +54,8 @@ /// generate libcalls to the software floating point library instead of /// target FP instructions. extern bool UseSoftFloat; + + extern bool NoZerosInBSS; } // End llvm namespace #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/ELFWriter.h MachOWriter.h
Changes in directory llvm/include/llvm/CodeGen: ELFWriter.h updated: 1.13 -> 1.14 MachOWriter.h updated: 1.12 -> 1.13 --- Log message: Revert patch. --- Diffs of the changes: (+191 -10) ELFWriter.h | 101 +++--- MachOWriter.h | 100 ++--- 2 files changed, 191 insertions(+), 10 deletions(-) Index: llvm/include/llvm/CodeGen/ELFWriter.h diff -u llvm/include/llvm/CodeGen/ELFWriter.h:1.13 llvm/include/llvm/CodeGen/ELFWriter.h:1.14 --- llvm/include/llvm/CodeGen/ELFWriter.h:1.13 Tue Jan 16 21:47:54 2007 +++ llvm/include/llvm/CodeGen/ELFWriter.h Wed Jan 17 03:06:13 2007 @@ -22,7 +22,6 @@ class Mangler; class MachineCodeEmitter; class ELFCodeEmitter; - class TargetObjInfo; /// ELFWriter - This class implements the common target-independent code for /// writing ELF files. Targets should derive a class from this to @@ -50,10 +49,6 @@ /// TargetMachine &TM; -/// Target object writer info. -/// -const TargetObjInfo *TOI; - /// Mang - The object used to perform name mangling for this module. /// Mangler *Mang; @@ -219,6 +214,102 @@ unsigned ELFHeader_e_shoff_Offset; // e_shoffin ELF header. unsigned ELFHeader_e_shstrndx_Offset; // e_shstrndx in ELF header. unsigned ELFHeader_e_shnum_Offset; // e_shnumin ELF header. + + +// align - Emit padding into the file until the current output position is +// aligned to the specified power of two boundary. +static void align(DataBuffer &Output, unsigned Boundary) { + assert(Boundary && (Boundary & (Boundary-1)) == 0 && + "Must align to 2^k boundary"); + size_t Size = Output.size(); + if (Size & (Boundary-1)) { +// Add padding to get alignment to the correct place. +size_t Pad = Boundary-(Size & (Boundary-1)); +Output.resize(Size+Pad); + } +} + +static void outbyte(DataBuffer &Output, unsigned char X) { + Output.push_back(X); +} +void outhalf(DataBuffer &Output, unsigned short X) { + if (isLittleEndian) { +Output.push_back(X&255); +Output.push_back(X >> 8); + } else { +Output.push_back(X >> 8); +Output.push_back(X&255); + } +} +void outword(DataBuffer &Output, unsigned X) { + if (isLittleEndian) { +Output.push_back((X >> 0) & 255); +Output.push_back((X >> 8) & 255); +Output.push_back((X >> 16) & 255); +Output.push_back((X >> 24) & 255); + } else { +Output.push_back((X >> 24) & 255); +Output.push_back((X >> 16) & 255); +Output.push_back((X >> 8) & 255); +Output.push_back((X >> 0) & 255); + } +} +void outxword(DataBuffer &Output, uint64_t X) { + if (isLittleEndian) { +Output.push_back(unsigned(X >> 0) & 255); +Output.push_back(unsigned(X >> 8) & 255); +Output.push_back(unsigned(X >> 16) & 255); +Output.push_back(unsigned(X >> 24) & 255); +Output.push_back(unsigned(X >> 32) & 255); +Output.push_back(unsigned(X >> 40) & 255); +Output.push_back(unsigned(X >> 48) & 255); +Output.push_back(unsigned(X >> 56) & 255); + } else { +Output.push_back(unsigned(X >> 56) & 255); +Output.push_back(unsigned(X >> 48) & 255); +Output.push_back(unsigned(X >> 40) & 255); +Output.push_back(unsigned(X >> 32) & 255); +Output.push_back(unsigned(X >> 24) & 255); +Output.push_back(unsigned(X >> 16) & 255); +Output.push_back(unsigned(X >> 8) & 255); +Output.push_back(unsigned(X >> 0) & 255); + } +} +void outaddr32(DataBuffer &Output, unsigned X) { + outword(Output, X); +} +void outaddr64(DataBuffer &Output, uint64_t X) { + outxword(Output, X); +} +void outaddr(DataBuffer &Output, uint64_t X) { + if (!is64Bit) +outword(Output, (unsigned)X); + else +outxword(Output, X); +} + +// fix functions - Replace an existing entry at an offset. +void fixhalf(DataBuffer &Output, unsigned short X, unsigned Offset) { + unsigned char *P = &Output[Offset]; + P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255; + P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255; +} + +void fixword(DataBuffer &Output, unsigned X, unsigned Offset) { + unsigned char *P = &Output[Offset]; + P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255; + P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255; + P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255; + P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255; +} + +void fixaddr(DataBuffer &Output, uint64_t X, unsigned Offset) { + if (!is64Bit) +fixword(Output, (unsigned)X, Offset); + else +assert(0 && "Emission of 64-bit data not implemented yet!"); +} + private: void EmitGlobal(Globa
[llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h TargetObjInfo.h
Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.72 -> 1.73 TargetObjInfo.h (r1.1) removed --- Log message: Revert patch. --- Diffs of the changes: (+3 -18) TargetMachine.h | 21 +++-- 1 files changed, 3 insertions(+), 18 deletions(-) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.72 llvm/include/llvm/Target/TargetMachine.h:1.73 --- llvm/include/llvm/Target/TargetMachine.h:1.72 Tue Jan 16 21:48:29 2007 +++ llvm/include/llvm/Target/TargetMachine.hWed Jan 17 03:06:13 2007 @@ -21,7 +21,6 @@ namespace llvm { class TargetAsmInfo; -class TargetObjInfo; class TargetData; class TargetSubtarget; class TargetInstrInfo; @@ -67,7 +66,7 @@ TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT void operator=(const TargetMachine &); // DO NOT IMPLEMENT protected: // Can only create subclasses. - TargetMachine() : AsmInfo(NULL), ObjInfo(NULL) { } + TargetMachine() : AsmInfo(NULL) { } /// getSubtargetImpl - virtual method implemented by subclasses that returns /// a reference to that target's TargetSubtarget-derived member variable. @@ -76,19 +75,11 @@ /// AsmInfo - Contains target specific asm information. /// mutable const TargetAsmInfo *AsmInfo; - + /// createTargetAsmInfo - Create a new instance of target specific asm /// information. virtual const TargetAsmInfo *createTargetAsmInfo() const { return NULL; } - /// ObjInfo - Contains target specific object file information. - /// - mutable const TargetObjInfo *ObjInfo; - - /// createTargetObjInfo - Create a new instance of target specific object - /// information. - virtual const TargetObjInfo *createTargetObjInfo() const { return NULL; } - public: virtual ~TargetMachine(); @@ -116,6 +107,7 @@ virtual TargetLowering*getTargetLowering() const { return 0; } virtual const TargetData*getTargetData() const { return 0; } + /// getTargetAsmInfo - Return target specific asm information. /// const TargetAsmInfo *getTargetAsmInfo() const { @@ -123,13 +115,6 @@ return AsmInfo; } - /// getTargetObjInfo - Return target specific object information. - /// - const TargetObjInfo *getTargetObjInfo() const { -if (!ObjInfo) ObjInfo = createTargetObjInfo(); -return ObjInfo; - } - /// getSubtarget - This method returns a pointer to the specified type of /// TargetSubtarget. In debug builds, it verifies that the object being /// returned is of the correct type. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp
Changes in directory llvm/lib/CodeGen: ELFWriter.cpp updated: 1.31 -> 1.32 MachOWriter.cpp updated: 1.13 -> 1.14 --- Log message: Revert patch. --- Diffs of the changes: (+126 -156) ELFWriter.cpp | 116 --- MachOWriter.cpp | 166 +--- 2 files changed, 126 insertions(+), 156 deletions(-) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.31 llvm/lib/CodeGen/ELFWriter.cpp:1.32 --- llvm/lib/CodeGen/ELFWriter.cpp:1.31 Tue Jan 16 21:49:21 2007 +++ llvm/lib/CodeGen/ELFWriter.cpp Wed Jan 17 03:06:13 2007 @@ -37,7 +37,6 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetObjInfo.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -54,20 +53,8 @@ ELFWriter::ELFSection *ES; // Section to write to. std::vector *OutBuffer; size_t FnStart; - -/// Target machine description. -/// -TargetMachine &TM; - -/// Target object writer info. -/// -const TargetObjInfo *TOI; public: -ELFCodeEmitter(ELFWriter &ew, TargetMachine &tm) - : EW(ew), OutBuffer(0), TM(tm) { - // Create the target object info object for this target. - TOI = TM.getTargetObjInfo(); -} +ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutBuffer(0) {} void startFunction(MachineFunction &F); bool finishFunction(MachineFunction &F); @@ -126,7 +113,7 @@ // Add padding zeros to the end of the buffer to make sure that the // function will start on the correct byte alignment within the section. - TOI->align(*OutBuffer, Align); + ELFWriter::align(*OutBuffer, Align); FnStart = OutBuffer->size(); } @@ -178,11 +165,8 @@ isLittleEndian = TM.getTargetData()->isLittleEndian(); // Create the machine code emitter object for this target. - MCE = new ELFCodeEmitter(*this, TM); + MCE = new ELFCodeEmitter(*this); NumSections = 0; - - // Create the target object info object for this target. - TOI = TM.getTargetObjInfo(); } ELFWriter::~ELFWriter() { @@ -197,36 +181,36 @@ // Local alias to shortenify coming code. std::vector &FH = FileHeader; - TOI->outbyte(FH, 0x7F); // EI_MAG0 - TOI->outbyte(FH, 'E'); // EI_MAG1 - TOI->outbyte(FH, 'L'); // EI_MAG2 - TOI->outbyte(FH, 'F'); // EI_MAG3 - TOI->outbyte(FH, is64Bit ? 2 : 1); // EI_CLASS - TOI->outbyte(FH, isLittleEndian ? 1 : 2); // EI_DATA - TOI->outbyte(FH, 1);// EI_VERSION - FH.resize(16); // EI_PAD up to 16 bytes. + outbyte(FH, 0x7F); // EI_MAG0 + outbyte(FH, 'E'); // EI_MAG1 + outbyte(FH, 'L'); // EI_MAG2 + outbyte(FH, 'F'); // EI_MAG3 + outbyte(FH, is64Bit ? 2 : 1); // EI_CLASS + outbyte(FH, isLittleEndian ? 1 : 2); // EI_DATA + outbyte(FH, 1);// EI_VERSION + FH.resize(16); // EI_PAD up to 16 bytes. // This should change for shared objects. - TOI->outhalf(FH, 1); // e_type = ET_REL - TOI->outhalf(FH, e_machine); // e_machine = whatever the target wants - TOI->outword(FH, 1); // e_version = 1 - TOI->outaddr(FH, 0); // e_entry = 0 -> no entry point in .o file - TOI->outaddr(FH, 0); // e_phoff = 0 -> no program header for .o + outhalf(FH, 1); // e_type = ET_REL + outhalf(FH, e_machine); // e_machine = whatever the target wants + outword(FH, 1); // e_version = 1 + outaddr(FH, 0); // e_entry = 0 -> no entry point in .o file + outaddr(FH, 0); // e_phoff = 0 -> no program header for .o ELFHeader_e_shoff_Offset = FH.size(); - TOI->outaddr(FH, 0); // e_shoff - TOI->outword(FH, e_flags); // e_flags = whatever the target wants + outaddr(FH, 0); // e_shoff + outword(FH, e_flags); // e_flags = whatever the target wants - TOI->outhalf(FH, is64Bit ? 64 : 52); // e_ehsize = ELF header size - TOI->outhalf(FH, 0); // e_phentsize = prog header entry size - TOI->outhalf(FH, 0); // e_phnum = # prog header entries=0 - TOI->outhalf(FH, is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size + outhalf(FH, is64Bit ? 64 : 52); // e_ehsize = ELF header size + outhalf(FH, 0); // e_phentsize = prog header entry size + outhalf(FH, 0); // e_phnum = # prog header entries = 0 + outhalf(FH, is64Bit ? 64 : 40); // e_shentsize = sect hdr entry size ELFHeader_e_shnum_Offset = FH.size(); - TOI->outhalf(FH, 0); // e_shnum = # of section header ents + outha
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp PPCTargetMachine.cpp PPCTargetMachine.h PPCTargetObjInfo.cpp PPCTargetObjInfo.h
Changes in directory llvm/lib/Target/PowerPC: PPCMachOWriter.cpp updated: 1.10 -> 1.11 PPCTargetMachine.cpp updated: 1.113 -> 1.114 PPCTargetMachine.h updated: 1.26 -> 1.27 PPCTargetObjInfo.cpp (r1.1) removed PPCTargetObjInfo.h (r1.1) removed --- Log message: Revert patch. --- Diffs of the changes: (+18 -24) PPCMachOWriter.cpp | 36 ++-- PPCTargetMachine.cpp |5 - PPCTargetMachine.h |1 - 3 files changed, 18 insertions(+), 24 deletions(-) Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.10 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.11 --- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.10 Tue Jan 16 21:51:37 2007 +++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Wed Jan 17 03:06:13 2007 @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Nate Begeman and is distributed under the -// University of Illinois Open Source License. See LICENSE.TXT for details. +// This file was developed by Nate Begeman and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. // //===--===// // @@ -17,7 +17,6 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/MachOWriter.h" #include "llvm/Support/Compiler.h" -#include "llvm/Target/TargetObjInfo.h" using namespace llvm; namespace { @@ -92,10 +91,10 @@ MachORelocation VANILLA(MR.getMachineCodeOffset(), To.Index, false, 2, isExtern, PPC_RELOC_VANILLA); ++From.nreloc; - TOI->outword(From.RelocBuffer, VANILLA.r_address); - TOI->outword(From.RelocBuffer, VANILLA.getPackedFields()); + outword(From.RelocBuffer, VANILLA.r_address); + outword(From.RelocBuffer, VANILLA.getPackedFields()); } -TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); +fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); break; case PPC::reloc_pcrel_bx: Addr -= MR.getMachineCodeOffset(); @@ -103,12 +102,12 @@ Addr &= 0xFF; Addr <<= 2; Addr |= (From.SectionData[MR.getMachineCodeOffset()] << 24); -TOI->fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); +fixword(From.SectionData, Addr, MR.getMachineCodeOffset()); break; case PPC::reloc_pcrel_bcx: Addr -= MR.getMachineCodeOffset(); Addr &= 0xFFFC; -TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); +fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); break; case PPC::reloc_absolute_high: { @@ -118,14 +117,14 @@ PPC_RELOC_PAIR); ++From.nreloc; ++From.nreloc; - TOI->outword(From.RelocBuffer, HA16.r_address); - TOI->outword(From.RelocBuffer, HA16.getPackedFields()); - TOI->outword(From.RelocBuffer, PAIR.r_address); - TOI->outword(From.RelocBuffer, PAIR.getPackedFields()); + outword(From.RelocBuffer, HA16.r_address); + outword(From.RelocBuffer, HA16.getPackedFields()); + outword(From.RelocBuffer, PAIR.r_address); + outword(From.RelocBuffer, PAIR.getPackedFields()); } printf("ha16: %x\n", (unsigned)Addr); Addr += 0x8000; -TOI->fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2); +fixhalf(From.SectionData, Addr >> 16, MR.getMachineCodeOffset() + 2); break; case PPC::reloc_absolute_low: { @@ -135,13 +134,13 @@ PPC_RELOC_PAIR); ++From.nreloc; ++From.nreloc; - TOI->outword(From.RelocBuffer, LO16.r_address); - TOI->outword(From.RelocBuffer, LO16.getPackedFields()); - TOI->outword(From.RelocBuffer, PAIR.r_address); - TOI->outword(From.RelocBuffer, PAIR.getPackedFields()); + outword(From.RelocBuffer, LO16.r_address); + outword(From.RelocBuffer, LO16.getPackedFields()); + outword(From.RelocBuffer, PAIR.r_address); + outword(From.RelocBuffer, PAIR.getPackedFields()); } printf("lo16: %x\n", (unsigned)Addr); -TOI->fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); +fixhalf(From.SectionData, Addr, MR.getMachineCodeOffset() + 2); break; } } @@ -151,3 +150,4 @@ // FIXME: do something about PIC return MachineRelocation::getBB(Offset, PPC::reloc_vanilla, MBB); } + Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.113 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.114 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.113 Tue Jan 16 21:51:37 2007 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cppWed Jan 17 03:06:13 2007 @@ -13,7 +13,6 @@ #include "PPC.h" #include "PPCTargetAsmInfo.h" -#include "PPCTargetObjInfo.h" #include "PPCTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" @@ -35,10 +34,6 @@ return new LinuxTarge
[llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp
Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.57 -> 1.58 --- Log message: Revert patch. --- Diffs of the changes: (+0 -2) TargetMachine.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.57 llvm/lib/Target/TargetMachine.cpp:1.58 --- llvm/lib/Target/TargetMachine.cpp:1.57 Tue Jan 16 21:50:41 2007 +++ llvm/lib/Target/TargetMachine.cpp Wed Jan 17 03:06:13 2007 @@ -13,7 +13,6 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetObjInfo.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -105,7 +104,6 @@ TargetMachine::~TargetMachine() { delete AsmInfo; - delete ObjInfo; } /// getRelocationModel - Returns the code generation relocation model. The ___ 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/X86TargetMachine.cpp X86TargetMachine.h X86TargetObjInfo.cpp X86TargetObjInfo.h
Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.136 -> 1.137 X86TargetMachine.h updated: 1.42 -> 1.43 X86TargetObjInfo.cpp (r1.1) removed X86TargetObjInfo.h (r1.1) removed --- Log message: Revert patch. --- Diffs of the changes: (+0 -6) X86TargetMachine.cpp |5 - X86TargetMachine.h |1 - 2 files changed, 6 deletions(-) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.136 llvm/lib/Target/X86/X86TargetMachine.cpp:1.137 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.136 Tue Jan 16 21:51:37 2007 +++ llvm/lib/Target/X86/X86TargetMachine.cppWed Jan 17 03:06:13 2007 @@ -12,7 +12,6 @@ //===--===// #include "X86TargetAsmInfo.h" -#include "X86TargetObjInfo.h" #include "X86TargetMachine.h" #include "X86.h" #include "llvm/Module.h" @@ -43,10 +42,6 @@ return new X86TargetAsmInfo(*this); } -const TargetObjInfo *X86TargetMachine::createTargetObjInfo() const { - return new ELFTargetObjInfo(*this); -} - unsigned X86_32TargetMachine::getJITMatchQuality() { #if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86) return 10; Index: llvm/lib/Target/X86/X86TargetMachine.h diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.42 llvm/lib/Target/X86/X86TargetMachine.h:1.43 --- llvm/lib/Target/X86/X86TargetMachine.h:1.42 Tue Jan 16 21:51:37 2007 +++ llvm/lib/Target/X86/X86TargetMachine.h Wed Jan 17 03:06:13 2007 @@ -35,7 +35,6 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; - virtual const TargetObjInfo *createTargetObjInfo() const; public: X86TargetMachine(const Module &M, const std::string &FS, bool is64Bit); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/CFrontend/2006-01-13-Includes.c
Changes in directory llvm/test/CFrontend: 2006-01-13-Includes.c updated: 1.5 -> 1.6 --- Log message: The Regression directory is now gone. --- Diffs of the changes: (+1 -1) 2006-01-13-Includes.c |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CFrontend/2006-01-13-Includes.c diff -u llvm/test/CFrontend/2006-01-13-Includes.c:1.5 llvm/test/CFrontend/2006-01-13-Includes.c:1.6 --- llvm/test/CFrontend/2006-01-13-Includes.c:1.5 Fri Jun 16 11:57:43 2006 +++ llvm/test/CFrontend/2006-01-13-Includes.c Wed Jan 17 02:01:13 2007 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -g -S -o - | gccas | llvm-dis | grep "test/Regression/CFrontend" +// RUN: %llvmgcc %s -g -S -o - | gccas | llvm-dis | grep "test/CFrontend" // PR676 #include ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits