From lattner at cs.uiuc.edu Mon Oct 6 10:03:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 10:03:04 2003 Subject: [llvm-commits] CVS: llvm/include/Support/Timer.h Message-ID: <200310061502.KAA26667@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: Timer.h updated: 1.9 -> 1.10 --- Log message: Doxygenize class comments. Add new NamedRegionTimer class --- Diffs of the changes: Index: llvm/include/Support/Timer.h diff -u llvm/include/Support/Timer.h:1.9 llvm/include/Support/Timer.h:1.10 --- llvm/include/Support/Timer.h:1.9 Fri Jul 25 12:23:27 2003 +++ llvm/include/Support/Timer.h Mon Oct 6 10:02:16 2003 @@ -1,24 +1,7 @@ //===-- Support/Timer.h - Interval Timing Support ---------------*- C++ -*-===// // -// This file defines three classes: Timer, TimeRegion, and TimerGroup. -// -// The Timer class is used to track the amount of time spent between invocations -// of it's startTimer()/stopTimer() methods. Given appropriate OS support it -// can also keep track of the RSS of the program at various points. By default, -// the Timer will print the amount of time it has captured to standard error -// when the laster timer is destroyed, otherwise it is printed when it's -// TimerGroup is destroyed. Timer's do not print their information if they are -// never started. -// -// The TimeRegion class is used as a helper class to call the startTimer() and -// stopTimer() methods of the Timer class. When the object is constructed, it -// starts the timer specified as it's argument. When it is destroyed, it stops -// the relevant timer. This makes it easy to time a region of code. -// -// The TimerGroup class is used to group together related timers into a single -// report that is printed when the TimerGroup is destroyed. It is illegal to -// destroy a TimerGroup object before all of the Timers in it are gone. A -// TimerGroup can be specified for a newly created timer in its constructor. +// This file defines three classes: Timer, TimeRegion, and TimerGroup, +// documented below. // //===----------------------------------------------------------------------===// @@ -32,6 +15,14 @@ class TimerGroup; +/// Timer - This class is used to track the amount of time spent between +/// invocations of it's startTimer()/stopTimer() methods. Given appropriate OS +/// support it can also keep track of the RSS of the program at various points. +/// By default, the Timer will print the amount of time it has captured to +/// standard error when the laster timer is destroyed, otherwise it is printed +/// when it's TimerGroup is destroyed. Timer's do not print their information +/// if they are never started. +/// class Timer { double Elapsed; // Wall clock time elapsed in seconds double UserTime; // User time elapsed @@ -52,7 +43,7 @@ double getWallTime() const { return Elapsed; } long getMemUsed() const { return MemUsed; } long getPeakMem() const { return PeakMem; } - std::string getName() const { return Name; } + std::string getName() const { return Name; } const Timer &operator=(const Timer &T) { Elapsed = T.Elapsed; @@ -106,6 +97,11 @@ }; +/// The TimeRegion class is used as a helper class to call the startTimer() and +/// stopTimer() methods of the Timer class. When the object is constructed, it +/// starts the timer specified as it's argument. When it is destroyed, it stops +/// the relevant timer. This makes it easy to time a region of code. +/// class TimeRegion { Timer &T; TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT @@ -118,6 +114,22 @@ } }; + +/// NamedRegionTimer - This class is basically a combination of TimeRegion and +/// Timer. It allows you to declare a new timer, AND specify the region to +/// time, all in one statement. All timers with the same name are merged. This +/// is primarily used for debugging and for hunting performance problems. +/// +struct NamedRegionTimer : public TimeRegion { + NamedRegionTimer(const std::string &Name); +}; + + +/// The TimerGroup class is used to group together related timers into a single +/// report that is printed when the TimerGroup is destroyed. It is illegal to +/// destroy a TimerGroup object before all of the Timers in it are gone. A +/// TimerGroup can be specified for a newly created timer in its constructor. +/// class TimerGroup { std::string Name; unsigned NumTimers; From lattner at cs.uiuc.edu Mon Oct 6 10:03:09 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 10:03:09 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200310061502.KAA26676@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.24 -> 1.25 --- Log message: Implement the NamedRegionTimer class --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.24 llvm/lib/Support/Timer.cpp:1.25 --- llvm/lib/Support/Timer.cpp:1.24 Fri Aug 1 17:15:15 2003 +++ llvm/lib/Support/Timer.cpp Mon Oct 6 10:02:31 2003 @@ -16,6 +16,7 @@ #include #include #include +#include // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy // of constructor/destructor ordering being unspecified by C++. Basically the @@ -177,6 +178,23 @@ E = ActiveTimers.end(); I != E; ++I) (*I)->PeakMem = std::max((*I)->PeakMem, MemUsed-(*I)->PeakMemBase); } + +//===----------------------------------------------------------------------===// +// NamedRegionTimer Implementation +//===----------------------------------------------------------------------===// + +static Timer &getNamedRegionTimer(const std::string &Name) { + static std::map NamedTimers; + + std::map::iterator I = NamedTimers.lower_bound(Name); + if (I != NamedTimers.end() && I->first == Name) + return I->second; + + return NamedTimers.insert(I, std::make_pair(Name, Timer(Name)))->second; +} + +NamedRegionTimer::NamedRegionTimer(const std::string &Name) + : TimeRegion(getNamedRegionTimer(Name)) {} //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Mon Oct 6 10:24:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 10:24:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/ValueMapper.cpp InlineFunction.cpp Message-ID: <200310061523.KAA31928@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: ValueMapper.cpp updated: 1.4 -> 1.5 InlineFunction.cpp updated: 1.11 -> 1.12 --- Log message: Avoid doing pointless work. Amazingly, this makes us go faster. Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s. In release mode, it went from taking 25.8741s to taking 11.5712s. This also fixes a FIXME. --- Diffs of the changes: Index: llvm/lib/Transforms/Utils/ValueMapper.cpp diff -u llvm/lib/Transforms/Utils/ValueMapper.cpp:1.4 llvm/lib/Transforms/Utils/ValueMapper.cpp:1.5 --- llvm/lib/Transforms/Utils/ValueMapper.cpp:1.4 Thu Apr 17 22:49:49 2003 +++ llvm/lib/Transforms/Utils/ValueMapper.cpp Mon Oct 6 10:23:43 2003 @@ -13,6 +13,11 @@ Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? + // Global values do not need to be seeded into the ValueMap if they are using + // the identity mapping. + if (isa(V)) + return VMSlot = const_cast(V); + if (Constant *C = const_cast(dyn_cast(V))) { if (isa(C) || isa(C) || isa(C)) Index: llvm/lib/Transforms/Utils/InlineFunction.cpp diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.11 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.12 --- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.11 Mon Sep 22 18:30:59 2003 +++ llvm/lib/Transforms/Utils/InlineFunction.cpp Mon Oct 6 10:23:43 2003 @@ -124,14 +124,6 @@ // Make a vector to capture the return instructions in the cloned function... std::vector Returns; - // Populate the value map with all of the globals in the program. - // FIXME: This should be the default for CloneFunctionInto! - Module &M = *Caller->getParent(); - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - ValueMap[I] = I; - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) - ValueMap[I] = I; - // Do all of the hard part of cloning the callee into the caller... CloneFunctionInto(Caller, CalledFunc, ValueMap, Returns, ".i"); From gaeke at cs.uiuc.edu Mon Oct 6 10:31:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 10:31:01 2003 Subject: [llvm-commits] CVS: llvm/utils/NightlyTestTemplate.html Message-ID: <200310061530.KAA15660@zion.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTestTemplate.html updated: 1.19 -> 1.20 --- Log message: I wanted to make the top of the page less verbose. Hope this helps. --- Diffs of the changes: Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.19 llvm/utils/NightlyTestTemplate.html:1.20 --- llvm/utils/NightlyTestTemplate.html:1.19 Wed Sep 17 17:02:49 2003 +++ llvm/utils/NightlyTestTemplate.html Mon Oct 6 10:30:00 2003 @@ -56,10 +56,8 @@
  • CVS Checkout Log
      - Time to check out CVS tree: $CVSCheckoutTime seconds
      - Number of directories in CVS: $NumDirsInCVS
      - Number of files in CVS: $NumFilesInCVS
      - Number of lines of code: $LOC
    + $NumDirsInCVS dirs, $NumFilesInCVS files, $LOC + lines of code, checked out in $CVSCheckoutTime seconds
  • Compilation Log
      $BuildError From gaeke at cs.uiuc.edu Mon Oct 6 10:42:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 10:42:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp Message-ID: <200310061541.KAA16884@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.90 -> 1.91 --- Log message: Add # of printed instructions statistic to both the SPARC and X86 LLC backends. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.90 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.91 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.90 Tue Sep 23 12:27:28 2003 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Mon Oct 6 10:41:20 2003 @@ -21,11 +21,14 @@ #include "llvm/Pass.h" #include "llvm/Assembly/Writer.h" #include "Support/StringExtras.h" +#include "Support/Statistic.h" #include "SparcInternals.h" #include namespace { +Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); + class GlobalIdTable: public Annotation { static AnnotationID AnnotId; friend class AsmPrinter; // give access to AnnotId @@ -483,7 +486,6 @@ toAsm << ")"; } - void SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI) { @@ -507,6 +509,7 @@ N = 1; toAsm << "\n"; + ++EmittedInsts; } void From gaeke at cs.uiuc.edu Mon Oct 6 10:42:04 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 10:42:04 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp Message-ID: <200310061541.KAA16893@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: Printer.cpp updated: 1.61 -> 1.62 --- Log message: Add # of printed instructions statistic to both the SPARC and X86 LLC backends. --- Diffs of the changes: Index: llvm/lib/Target/X86/Printer.cpp diff -u llvm/lib/Target/X86/Printer.cpp:1.61 llvm/lib/Target/X86/Printer.cpp:1.62 --- llvm/lib/Target/X86/Printer.cpp:1.61 Wed Sep 10 14:52:24 2003 +++ llvm/lib/Target/X86/Printer.cpp Mon Oct 6 10:41:21 2003 @@ -18,10 +18,13 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" +#include "Support/Statistic.h" #include "Support/StringExtras.h" #include "Support/CommandLine.h" namespace { + Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); + // FIXME: This should be automatically picked up by autoconf from the C // frontend cl::opt EmitCygwin("enable-cygwin-compatible-output", cl::Hidden, @@ -573,6 +576,7 @@ const TargetInstrInfo &TII = TM.getInstrInfo(); const TargetInstrDescriptor &Desc = TII.get(Opcode); + ++EmittedInsts; switch (Desc.TSFlags & X86II::FormMask) { case X86II::Pseudo: // Print pseudo-instructions as comments; either they should have been From lattner at cs.uiuc.edu Mon Oct 6 10:53:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 10:53:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/InlineSimple.cpp Message-ID: <200310061552.KAA00752@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: InlineSimple.cpp updated: 1.50 -> 1.51 --- Log message: Speed up the predicate used to decide when to inline by caching the size of callees between executions. On eon, in release mode, this changes the inliner from taking 11.5712s to taking 2.2066s. In debug mode, it went from taking 14.4148s to taking 7.0745s. In release mode, this is a 24.7% speedup of gccas, in debug mode, it's a total speedup of 11.7%. This also makes it slightly more aggressive. This could be because we are not judging the size of the functions quite as accurately as before. When we start looking at the performance of the generated code, this can be investigated further. --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.50 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.51 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.50 Sun Aug 31 14:10:30 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Mon Oct 6 10:52:43 2003 @@ -11,7 +11,17 @@ #include "llvm/Transforms/IPO.h" namespace { - struct SimpleInliner : public Inliner { + // FunctionInfo - For each function, calculate the size of it in blocks and + // instructions. + struct FunctionInfo { + unsigned NumInsts, NumBlocks; + + FunctionInfo() : NumInsts(0), NumBlocks(0) {} + }; + + class SimpleInliner : public Inliner { + std::map CachedFunctionInfo; + public: int getInlineCost(CallSite CS); }; RegisterOpt X("inline", "Function Integration/Inlining"); @@ -19,7 +29,6 @@ Pass *createFunctionInliningPass() { return new SimpleInliner(); } - // getInlineCost - The heuristic used to determine if we should inline the // function call or not. // @@ -71,19 +80,25 @@ // Now that we have considered all of the factors that make the call site more // likely to be inlined, look at factors that make us not want to inline it. - // As soon as the inline quality gets negative, bail out. + FunctionInfo &CalleeFI = CachedFunctionInfo[Callee]; - // Look at the size of the callee. Each basic block counts as 20 units, and - // each instruction counts as 10. - for (Function::const_iterator BB = Callee->begin(), E = Callee->end(); - BB != E; ++BB) - InlineCost += BB->size()*10 + 20; - - // Don't inline into something too big, which would make it bigger. Here, we - // count each basic block as a single unit. - for (Function::const_iterator BB = Caller->begin(), E = Caller->end(); - BB != E; ++BB) - InlineCost++; + // If we haven't calculated this information yet... + if (CalleeFI.NumBlocks == 0) { + unsigned NumInsts = 0, NumBlocks = 0; + + // Look at the size of the callee. Each basic block counts as 20 units, and + // each instruction counts as 10. + for (Function::const_iterator BB = Callee->begin(), E = Callee->end(); + BB != E; ++BB) { + NumInsts += BB->size(); + NumBlocks++; + } + CalleeFI.NumBlocks = NumBlocks; + CalleeFI.NumInsts = NumInsts; + } + // Look at the size of the callee. Each basic block counts as 21 units, and + // each instruction counts as 10. + InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20; return InlineCost; } From lattner at cs.uiuc.edu Mon Oct 6 12:12:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 12:12:08 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200310061711.MAA14304@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.124 -> 1.125 --- Log message: Minor speedups for the instcombine pass --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.124 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.125 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.124 Thu Oct 2 10:11:26 2003 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 6 12:11:01 2003 @@ -1939,17 +1939,16 @@ // Check to see if we can DIE the instruction... if (isInstructionTriviallyDead(I)) { // Add operands to the worklist... - for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (Instruction *Op = dyn_cast(I->getOperand(i))) - WorkList.push_back(Op); - + if (I->getNumOperands() < 4) + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (Instruction *Op = dyn_cast(I->getOperand(i))) + WorkList.push_back(Op); ++NumDeadInst; - BasicBlock::iterator BBI = I; - if (dceInstruction(BBI)) { - removeFromWorkList(I); - continue; - } - } + + I->getParent()->getInstList().erase(I); + removeFromWorkList(I); + continue; + } // Instruction isn't dead, see if we can constant propagate it... if (Constant *C = ConstantFoldInstruction(I)) { @@ -1960,13 +1959,10 @@ ReplaceInstUsesWith(*I, C); ++NumConstProp; - BasicBlock::iterator BBI = I; - if (dceInstruction(BBI)) { - removeFromWorkList(I); - continue; - } + I->getParent()->getInstList().erase(I); + continue; } - + // Now that we have an instruction, try combining it to simplify it... if (Instruction *Result = visit(*I)) { ++NumCombined; @@ -1975,7 +1971,20 @@ // Instructions can end up on the worklist more than once. Make sure // we do not process an instruction that has been deleted. removeFromWorkList(I); - ReplaceInstWithInst(I, Result); + + // Move the name to the new instruction first... + std::string OldName = I->getName(); I->setName(""); + Result->setName(I->getName()); + + // Insert the new instruction into the basic block... + BasicBlock *InstParent = I->getParent(); + InstParent->getInstList().insert(I, Result); + + // Everything uses the new instruction now... + I->replaceAllUsesWith(Result); + + // Erase the old instruction. + InstParent->getInstList().erase(I); } else { BasicBlock::iterator II = I; From lattner at cs.uiuc.edu Mon Oct 6 12:34:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 12:34:02 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Value.cpp Message-ID: <200310061733.MAA03359@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Value.cpp updated: 1.35 -> 1.36 --- Log message: Users can never be null --- Diffs of the changes: Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.35 llvm/lib/VMCore/Value.cpp:1.36 --- llvm/lib/VMCore/Value.cpp:1.35 Thu Oct 2 14:44:40 2003 +++ llvm/lib/VMCore/Value.cpp Mon Oct 6 12:33:39 2003 @@ -87,7 +87,7 @@ void Value::killUse(User *U) { - if (U == 0) return; + assert(U != 0 && "Null users are not allowed!"); unsigned i; // Scan backwards through the uses list looking for the user. We do this From lattner at cs.uiuc.edu Mon Oct 6 12:37:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 12:37:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Instruction.h User.h Message-ID: <200310061736.MAA08840@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instruction.h updated: 1.45 -> 1.46 User.h updated: 1.21 -> 1.22 --- Log message: Remove unneeded dtors --- Diffs of the changes: Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.45 llvm/include/llvm/Instruction.h:1.46 --- llvm/include/llvm/Instruction.h:1.45 Thu Jul 31 00:08:02 2003 +++ llvm/include/llvm/Instruction.h Mon Oct 6 12:36:49 2003 @@ -30,9 +30,6 @@ Instruction(const Type *Ty, unsigned iType, const std::string &Name = "", Instruction *InsertBefore = 0); public: - virtual ~Instruction() { - assert(Parent == 0 && "Instruction still embedded in basic block!"); - } // Specialize setName to handle symbol table majik... virtual void setName(const std::string &name, SymbolTable *ST = 0); Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.21 llvm/include/llvm/User.h:1.22 --- llvm/include/llvm/User.h:1.21 Tue Sep 30 13:37:37 2003 +++ llvm/include/llvm/User.h Mon Oct 6 12:36:49 2003 @@ -20,7 +20,6 @@ std::vector Operands; public: User(const Type *Ty, ValueTy vty, const std::string &name = ""); - virtual ~User() { dropAllReferences(); } inline Value *getOperand(unsigned i) { assert(i < Operands.size() && "getOperand() out of range!"); From gaeke at cs.uiuc.edu Mon Oct 6 12:58:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 12:58:02 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/SLI.cpp Message-ID: <200310061757.MAA17787@trinity.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: SLI.cpp updated: 1.6 -> 1.7 --- Log message: Qualify many `namespace std' names with std::, to eventually get rid of `using namespace std' in this file. Use `succ_iterator' instead of `BasicBlock::succ_iterator'. When checking an edge's color, it's okay to compare == WHITE instead of != BLACK && != GREY. Remove some commented-out code. Transform if (...) assert(0) and if (...) { ... } else assert (0) appropriately. --- Diffs of the changes: Index: reopt/lib/LightWtProfiling/SLI.cpp diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.6 reopt/lib/LightWtProfiling/SLI.cpp:1.7 --- reopt/lib/LightWtProfiling/SLI.cpp:1.6 Sat Sep 13 16:12:11 2003 +++ reopt/lib/LightWtProfiling/SLI.cpp Mon Oct 6 12:56:52 2003 @@ -30,20 +30,19 @@ void doInlining(uint64_t addr1, vector &stack, VirtualMem *vm); -void doBackEdgeDFS(BasicBlock *node, map &backedges, - map &color){ +void doBackEdgeDFS(BasicBlock *node, + std::map &backedges, + std::map &color) { color[node] = GREY; - for(BasicBlock::succ_iterator s=succ_begin(node), se=succ_end(node); - s!=se; ++s){ - if(color[*s] == GREY){ - //backedge node->*s + for(succ_iterator si=succ_begin(node), se=succ_end(node); si!=se; ++si){ + if (color[*si] == GREY) { + //backedge node->*si assert(backedges.find(node) == backedges.end() && "Multiple backedges starting at same basic block"); - backedges[node] = *s; - } - else if(color[*s] != BLACK){ - //must be white - doBackEdgeDFS(*s, backedges, color); + backedges[node] = *si; + } else if (color[*si] != BLACK) { + assert(color[*si] == WHITE); + doBackEdgeDFS(*si, backedges, color); } } color[node] = BLACK; @@ -56,20 +55,17 @@ } void doForwardDFS(BasicBlock *node,BasicBlock *end, - map &backEdges, - map &forward, - map &color){ + std::map &backEdges, + std::map &forward, + std::map &color){ color[node] = GREY; - //std::cerr<<"Forward--------------\n"; - //std::cerr< *s is a backedge, neglect if(backEdges[node] == *s) continue; - if(color[*s] != GREY && color[*s] != BLACK){ + if(color[*s] == WHITE) { doForwardDFS(*s, end, backEdges, forward, color); } } @@ -78,33 +74,27 @@ } void getForward(BasicBlock *root, BasicBlock *end, - map &backEdges, - map &forward){ + std::map &backEdges, + std::map &forward){ //do DFS, avoid backedges, don't go beyond end - map color; + std::map color; doForwardDFS(root, end, backEdges, forward, color); } void doBackwardDFS(BasicBlock *node, BasicBlock *start, - map &backEdges, - map &forward, - map &backward, - map &color){ + std::map &backEdges, + std::map &forward, + std::map &backward, + std::map &color){ color[node] = GREY; backward[node] = 1; - //std::cerr<<"Backward----------\n"; - //std::cerr< &backEdges, - map &forward, - map &backward){ + std::map &backEdges, + std::map &forward, + std::map &backward){ //do DFS, avoid backedges, consider only forward edges - map color; + std::map color; doBackwardDFS(node, start, backEdges, forward, backward, color); backward[start] = 1; } -void getExit(map &backward, - map &exitBBs){ - vector toPush; - for(map::iterator MI = backward.begin(), +void getExit(std::map &backward, + std::map &exitBBs){ + std::vector toPush; + for(std::map::iterator MI = backward.begin(), ME = backward.end(); MI != ME; ++MI){ - for(BasicBlock::succ_iterator s=succ_begin(MI->first), + for(succ_iterator s=succ_begin(MI->first), se=succ_end(MI->first); s != se; ++s){ if(backward.find(*s) == backward.end()){ exitBBs[*s] = 1; toPush.push_back(*s); - //std::cerr<<"Exit-----------\n"; - //std::cerr<<*s; } } } - - for(vector::iterator VI = toPush.begin(), VE = toPush.end(); - VI != VE; ++VI){ + for(std::vector::iterator VI = toPush.begin(), + VE = toPush.end(); VI != VE; ++VI){ backward[*VI] = 1; } } -void doTraceDFS(BasicBlock *node, vector &trace, - map &backward, - map &color){ - //std::cerr< &trace, + std::map &backward, + std::map &color){ color[node] = GREY; trace.push_back(node); - for(BasicBlock::succ_iterator s=succ_begin(node), - se=succ_end(node); s != se; ++s){ - if(backward.find(*s) != backward.end()){ - if(color[*s] != GREY && color[*s] != BLACK){ - doTraceDFS(*s, trace, backward, color); - } - } - } - + for(succ_iterator s=succ_begin(node), se=succ_end(node); s != se; ++s) + if(backward.find(*s) != backward.end()) + if(color[*s] == WHITE) + doTraceDFS(*s, trace, backward, color); color[node] = BLACK; } -void getTrace(BasicBlock *root, vector &trace, - map &backward){ +void getTrace(BasicBlock *root, std::vector &trace, + std::map &backward){ //do a DFS from root ONLY on nodes in backward - map color; + std::map color; doTraceDFS(root, trace, backward, color); } - void doTraceDFSForFunction(BasicBlock *node, vector &trace, map &color){ - color[node] = GREY; trace.push_back(node); - for(BasicBlock::succ_iterator s=succ_begin(node), - se=succ_end(node); s != se; ++s){ - if(color[*s] != GREY && color[*s] != BLACK){ + for(succ_iterator s=succ_begin(node), se=succ_end(node); s != se; ++s) + if(color[*s] == WHITE) doTraceDFSForFunction(*s, trace, color); - } - } color[node] = BLACK; } - //Inlining algorithm // //For the TOP loop @@ -233,17 +208,8 @@ assert(root && end && "No root or end found"); - /* - std::cerr<getParent(); - std::cerr<<"root---------------------------\n"; - std::cerr< backEdges; //edge from key->value + std::map backEdges; //edge from key->value getBackEdges(backEdges, root->getParent()); //end node @@ -251,24 +217,21 @@ "No backedge with end found"); //get forward edges - map forward; + std::map forward; getForward(root, end, backEdges, forward); //get backward edges - map backward; + std::map backward; getBackward(end, root, backEdges, forward, backward); //for BBs in backward, find exit nodes - map exitBBs; + std::map exitBBs; getExit(backward, exitBBs); - //std::cerr<<"Trace------------------\n"; //get a vector of trace - vector vBB; + std::vector vBB; getTrace(root, vBB, backward); - //std::cerr<<"END---------------------------\n"; - unsigned int initial_code[] = {0x83663001};//0x82102001//move 1 to g1 unsigned int call_code[] = {0xc277a7ef, 0xc25fa7ef, 0xde77a7f7, 0xde5fa7f7}; //save g1, restore g1, save o7, restore o7 @@ -279,26 +242,24 @@ //spill o0, g7->o0, call, unspill o0 0x90104000 unsigned int exit_code[] = {CALL, NOP};//call llvm_time_end - map callMap; - map branchMap; - map bbPlacement; - map branchStub; - map toInline; + std::map callMap; + std::map branchMap; + std::map bbPlacement; + std::map branchStub; + std::map toInline; int index = 0; - vector trace; + std::vector trace; //generate a vector of instructions trace.push_back(initial_code[0]); - //trace.push_back(initial_code[1]); index += 1; + //assume: succ[0] is 0, succ[1] is 1 - for(vector::iterator VBI = vBB.begin(), VBE = vBB.end(); + for(std::vector::iterator VBI = vBB.begin(), VBE = vBB.end(); VBI != VBE; ++VBI){//loop on vBB - std::pair bbInst = getBasicBlockInfo(*VBI); uint64_t bbStart = bbInst.first; uint64_t bbEnd = bbInst.second; - if(exitBBs.find(*VBI) != exitBBs.end()){ //is an exit BB bbPlacement[*VBI] = index; trace.push_back(call_code[2]); @@ -311,15 +272,11 @@ branchMap[index + 4] = bbStart; callMap[index+1] = (uint64_t)(intptr_t)(&llvm_time_end); index += 6; - } - else{ //This is not an exit BB - + } else{ //This is not an exit BB bbPlacement[*VBI] = index; - bool isCondBranch = false; int fillLater = 0; bool isSucc0 = false; - uint64_t succ0=0, succ1=0; BasicBlock *taken=NULL, *ntaken=NULL; TerminatorInst *TI = (*VBI)->getTerminator(); @@ -333,24 +290,19 @@ succ1 = getBasicBlockInfo(ntaken).first; } } - for(uint64_t addr = bbStart; addr <= bbEnd; addr+=4){//loop on BB unsigned instr = vm->readInstrFrmVm(addr, tr, tr2); - if(isIndirectCall(instr)){ trace.push_back(call_code[0]); trace.push_back(instr); - //trace.push_back(NOP); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); trace.push_back(call_code[1]); index += 4; addr += 4; - } - else if(isCallInstr(instr)){ + } else if(isCallInstr(instr)){ uint64_t callTarget = getCallTarget(instr, addr); if(callTarget != (uint64_t)(intptr_t)&llvm_first_trigger){ - if(isInlinable(getRevFunction(M, callTarget))){ trace.push_back(instr); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); @@ -358,20 +310,16 @@ toInline[callTarget] = 1; index += 2; addr += 4; - } - else{ - + } else{ trace.push_back(call_code[0]); trace.push_back(instr); - //trace.push_back(NOP); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); trace.push_back(call_code[1]); callMap[index+1] = getCallTarget(instr, addr); index += 4; addr += 4; } - } - else{ + } else{ trace.push_back(call_code[2]); //save o7 trace.push_back(loop_top_code[0]); trace.push_back(loop_top_code[1]); @@ -379,36 +327,30 @@ callMap[index+1] = (uint64_t)(intptr_t)&countPath; index += 4; } - } - else if(isBranchInstr(instr)){//is branch + } else if(isBranchInstr(instr)){//is branch assert(!isBranchNever(instr) && "Branch never not handled!"); if(isBranchAlways(instr)){ uint64_t target = getBranchTarget(instr, addr); if(target == addr1){ - trace.push_back(instr); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); trace[index] = getBranchInst(instr, (uint64_t)(intptr_t)&trace[0], (uint64_t)(intptr_t)&trace[index]); index += 2; - } - else{ + } else{ trace.push_back(instr); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - BasicBlock *targetBB=NULL; assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); branchStub[index] = targetBB; index += 2; } - addr += 4; - } - else{ - if(isCondBranch){ - uint64_t target = getBranchTarget(instr, addr); - if(target == succ0){ + } else{ + assert (isCondBranch); + uint64_t target = getBranchTarget(instr, addr); + if (target == succ0) { isSucc0 = true; fillLater = index; trace.push_back(instr); @@ -417,8 +359,7 @@ trace.push_back(succ1_code[1]); index += 4; addr += 4; - } - else{ + } else { fillLater = index; trace.push_back(instr); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); @@ -426,60 +367,47 @@ trace.push_back(succ0_code[1]); index += 4; addr += 4; - } - } - else{ - assert(false && "Should not be here!"); } } - } - else{ + } else{ trace.push_back(instr); index++; } } - + if(isCondBranch){ trace.push_back(0);//dummy - - unsigned int newBranch = getBranchInst(trace[fillLater], - (uint64_t)(intptr_t)&trace[index], - (uint64_t)(intptr_t)&trace[fillLater]); - + unsigned int newBranch = + getBranchInst(trace[fillLater], (uint64_t)(intptr_t)&trace[index], + (uint64_t)(intptr_t)&trace[fillLater]); trace[fillLater] = newBranch; - if(isSucc0){ + assert((taken != vBB[0]) && "Conditional branch to top!"); trace[index] = succ0_code[0]; trace.push_back(succ0_code[1]); trace.push_back(BRANCH_ALWAYS); trace.push_back(NOP); - - if(taken == vBB[0]){ - assert(false && "Conditional branch to top!"); - } branchStub[index+2] = taken; index += 4; - } - else{ + } else{ + assert((ntaken != vBB[0]) && "Conditional branch to top!"); trace[index] = succ1_code[0]; trace.push_back(succ1_code[1]); trace.push_back(BRANCH_ALWAYS); - if(ntaken == vBB[0]){ - assert(false && "Conditional branch to top!"); - } - branchStub[index+2] = ntaken; trace.push_back(NOP); + branchStub[index+2] = ntaken; index += 4; } } } } - for(map::iterator MI = branchStub.begin(), - ME = branchStub.end(); MI != ME; ++MI){ - trace[MI->first] = getBranchInst(trace[MI->first], - (uint64_t)(intptr_t)&trace[bbPlacement[MI->second]], - (uint64_t)(intptr_t)&trace[MI->first]); + for (std::map::iterator MI = branchStub.begin(), + ME = branchStub.end(); MI != ME; ++MI) { + trace[MI->first] = + getBranchInst(trace[MI->first], + (uint64_t)(intptr_t)&trace[bbPlacement[MI->second]], + (uint64_t)(intptr_t)&trace[MI->first]); } @@ -490,15 +418,14 @@ DEBUG(std::cerr << "Added-SLI-trace\t" << (void *)addr1 << "\t" << (void *)endAddr << "\t" << trace.size() << "\n"); - for(map::iterator MI = toInline.begin(), ME = toInline.end(); - MI != ME; ++MI){ + for(std::map::iterator MI = toInline.begin(), + ME = toInline.end(); MI != ME; ++MI) { if(!tr->hasTraceAddr(MI->first)){ vector stack; stack.push_back(root->getParent()); doInlining(MI->first, stack, vm); } } - } void doInlining(uint64_t addr1, vector &stack, VirtualMem *vm){ From gaeke at cs.uiuc.edu Mon Oct 6 13:16:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 13:16:01 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/SecondTrigger.cpp Message-ID: <200310061815.NAA08984@gally.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: SecondTrigger.cpp updated: 1.19 -> 1.20 --- Log message: #define moved to reopt/InstrUtils.h --- Diffs of the changes: Index: reopt/lib/LightWtProfiling/SecondTrigger.cpp diff -u reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.19 reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.20 --- reopt/lib/LightWtProfiling/SecondTrigger.cpp:1.19 Sat Sep 13 16:12:11 2003 +++ reopt/lib/LightWtProfiling/SecondTrigger.cpp Mon Oct 6 13:15:26 2003 @@ -24,8 +24,6 @@ #include #include -#define CALL 0x40000000 - static std::map *> pathCounter; static std::map totalCount; static std::map exitCounter; From gaeke at cs.uiuc.edu Mon Oct 6 13:17:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 13:17:01 2003 Subject: [llvm-commits] CVS: reopt/include/reopt/InstrUtils.h Message-ID: <200310061816.NAA18580@trinity.cs.uiuc.edu> Changes in directory reopt/include/reopt: InstrUtils.h updated: 1.7 -> 1.8 --- Log message: Move more hex constants of instructions here. --- Diffs of the changes: Index: reopt/include/reopt/InstrUtils.h diff -u reopt/include/reopt/InstrUtils.h:1.7 reopt/include/reopt/InstrUtils.h:1.8 --- reopt/include/reopt/InstrUtils.h:1.7 Fri Aug 22 12:43:34 2003 +++ reopt/include/reopt/InstrUtils.h Mon Oct 6 13:15:56 2003 @@ -11,7 +11,9 @@ #include "Support/DataTypes.h" #include -#define NOP 0x01000000 +#define BRANCH_ALWAYS 0x10800000 +#define CALL 0x40000000 +#define NOP 0x01000000 uint64_t getBranchTarget(unsigned int y, uint64_t oldAdd); unsigned int getBranchInst(unsigned int a, uint64_t to, uint64_t pc); From brukman at cs.uiuc.edu Mon Oct 6 13:35:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Oct 6 13:35:02 2003 Subject: [llvm-commits] CVS: llvm/include/Support/ToolRunner.h Message-ID: <200310061834.NAA16460@zion.cs.uiuc.edu> Changes in directory llvm/include/Support: ToolRunner.h (r1.2) removed --- Log message: Moved to llvm/include/llvm/Support because it is LLVM-specific. --- Diffs of the changes: From brukman at cs.uiuc.edu Mon Oct 6 13:38:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Oct 6 13:38:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/ToolRunner.cpp Message-ID: <200310061837.NAA20497@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: ToolRunner.cpp updated: 1.1 -> 1.2 --- Log message: ToolRunner.h has been moved from include/Support to include/llvm/Support. --- Diffs of the changes: Index: llvm/lib/Support/ToolRunner.cpp diff -u llvm/lib/Support/ToolRunner.cpp:1.1 llvm/lib/Support/ToolRunner.cpp:1.2 --- llvm/lib/Support/ToolRunner.cpp:1.1 Mon Sep 29 17:39:25 2003 +++ llvm/lib/Support/ToolRunner.cpp Mon Oct 6 13:37:24 2003 @@ -1,6 +1,6 @@ +#include "llvm/Support/ToolRunner.h" #include "Support/Debug.h" #include "Support/FileUtilities.h" -#include "Support/ToolRunner.h" //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface From lattner at cs.uiuc.edu Mon Oct 6 14:08:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 14:08:05 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200310061907.OAA25329@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.25 -> 1.26 --- Log message: Actually _PASS IN_ NO_RESERVE if we have it. Thanks to Brian for fixing this obvious oops --- Diffs of the changes: Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.25 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.26 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.25 Wed Sep 10 15:52:05 2003 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Mon Oct 6 14:07:41 2003 @@ -71,7 +71,7 @@ #endif void *pa = mmap(0, pageSize*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC, - MAP_PRIVATE|MAP_ANONYMOUS, fd, 0); + mmapFlags, fd, 0); if (pa == MAP_FAILED) { perror("mmap"); abort(); From brukman at cs.uiuc.edu Mon Oct 6 14:24:02 2003 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 6 14:24:02 2003 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200310061923.OAA16397@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.33 -> 1.34 --- Log message: * Alphabetized order of tools * Added blurb about `bugpoint' * Fixed some grammar issues * Added blurb about `llvm-link' * Took out the part about the `lli debugger' which disappeared --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.33 llvm/www/docs/GettingStarted.html:1.34 --- llvm/www/docs/GettingStarted.html:1.33 Thu Aug 28 17:02:50 2003 +++ llvm/www/docs/GettingStarted.html Mon Oct 6 14:23:34 2003 @@ -815,26 +815,47 @@ following is a brief introduction to the most important tools.

      +
      + +
      analyze
      analyze is used to run a specific + analysis on an input LLVM bytecode file and print out the results. It is + primarily useful for debugging analyses, or familiarizing yourself with + what an analysis does.

      + +

      bugpoint
      bugpoint is used to debug + optimization passes or code generation backends by narrowing down the + given test case to the minimum number of passes and/or instructions that + still cause a problem, whether it is a crash or miscompilation. See HowToSubmitABug.html for more information + on using bugpoint.

      + +

      llvm-ar
      The archiver produces an archive containing + the given LLVM bytecode files, optionally with an index for faster + lookup.

      +

      llvm-as
      The assembler transforms the human readable LLVM assembly to LLVM bytecode.

      llvm-dis
      The disassembler transforms the LLVM - bytecode to human readable LLVM assembly. Additionally it can convert + bytecode to human readable LLVM assembly. Additionally, it can convert LLVM bytecode to C, which is enabled with the -c option.

      +

      llvm-link
      llvm-link, not surprisingly, + links multiple LLVM modules into a single program.

      +

      lli
      lli is the LLVM interpreter, which can directly execute LLVM bytecode (although very slowly...). In addition - to a simple interpreter, lli is also has debugger and tracing - modes (entered by specifying -debug or -trace on the - command line, respectively). Finally, for architectures that support it - (currently only x86 and Sparc), by default, lli will function as - a Just-In-Time compiler (if the functionality was compiled in), and will - execute the code much faster than the interpreter.

      + to a simple interpreter, lli also has a tracing mode (entered by + specifying -trace on the command line). Finally, for + architectures that support it (currently only x86 and Sparc), by default, + lli will function as a Just-In-Time compiler (if the + functionality was compiled in), and will execute the code much + faster than the interpreter.

      llc
      llc is the LLVM backend compiler, which translates LLVM bytecode to a SPARC or x86 assembly file.

      -

      llvmgcc
      llvmgcc is a GCC based C frontend +
      llvmgcc
      llvmgcc is a GCC-based C frontend that has been retargeted to emit LLVM code as the machine code output. It works just like any other GCC compiler, taking the typical -c, -S, -E, -o options that are typically used. The source code for the @@ -845,15 +866,14 @@
      gccas
      This tool is invoked by the llvmgcc frontend as the "assembler" part of the compiler. This tool actually assembles LLVM assembly to LLVM bytecode, - performs a variety of optimizations, - and outputs LLVM bytecode. Thus when you invoke llvmgcc -c x.c -o - x.o, you are causing gccas to be run, which writes the - x.o file (which is an LLVM bytecode file that can be - disassembled or manipulated just like any other bytecode file). The - command line interface to gccas is designed to be as close as - possible to the system `as' utility so that the gcc - frontend itself did not have to be modified to interface to a "weird" - assembler.

      + performs a variety of optimizations, and outputs LLVM bytecode. Thus + when you invoke llvmgcc -c x.c -o x.o, you are causing + gccas to be run, which writes the x.o file (which is + an LLVM bytecode file that can be disassembled or manipulated just like + any other bytecode file). The command line interface to gccas + is designed to be as close as possible to the system + `as' utility so that the gcc frontend itself did not have to be + modified to interface to a "weird" assembler.

      gccld
      gccld links together several LLVM bytecode files into one bytecode file and does some optimization. It is @@ -868,12 +888,6 @@ line), and then outputs the resultant bytecode. The 'opt --help' command is a good way to get a list of the program transformations available in LLVM.

      - - -

      analyze
      analyze is used to run a specific - analysis on an input LLVM bytecode file and print out the results. It is - primarily useful for debugging analyses, or familiarizing yourself with - what an analysis does.

      From brukman at cs.uiuc.edu Mon Oct 6 14:27:02 2003 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 6 14:27:02 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CodingStandards.html Message-ID: <200310061926.OAA16457@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: CodingStandards.html updated: 1.10 -> 1.11 --- Log message: Break lines so that they fit within 80 columns. --- Diffs of the changes: Index: llvm/www/docs/CodingStandards.html diff -u llvm/www/docs/CodingStandards.html:1.10 llvm/www/docs/CodingStandards.html:1.11 --- llvm/www/docs/CodingStandards.html:1.10 Mon Aug 18 09:41:19 2003 +++ llvm/www/docs/CodingStandards.html Mon Oct 6 14:26:00 2003 @@ -53,14 +53,24 @@


      Commenting

        -Comments are one critical part of readability and maintainability. Everyone knows they should comment, so should you. :) Although we all should probably comment our code more than we do, there are a few very critical places that documentation is very useful:

        +Comments are one critical part of readability and maintainability. Everyone +knows they should comment, so should you. :) Although we all should probably +comment our code more than we do, there are a few very critical places that +documentation is very useful:

        1. File Headers
        2. -Every source file should have a header on it that describes the basic purpose of the file. If a file does not have a header, it should not be checked into CVS. Most source trees will probably have a standard file header format. The standard format for the LLVM source tree looks like this:

          +Every source file should have a header on it that describes the basic purpose of +the file. If a file does not have a header, it should not be checked into CVS. +Most source trees will probably have a standard file header format. The +standard format for the LLVM source tree looks like this:

           //===-- llvm/Instruction.h - Instruction class definition --------*- C++ -*--=//
          @@ -93,36 +109,59 @@
           //===----------------------------------------------------------------------===//
           
          -A few things to note about this particular format. The "-*- C++ -*-" string on the first line is there to tell Emacs that the source file is a C++ file, not a C file (Emacs assumes .h files are C files by default [Note that tag this is not necessary in .cpp files]). The name of the file is also on the first line, along with a very short description of the purpose of the file. This is important when printing out code and flipping though lots of pages.

          - -The main body of the description does not have to be very long in most cases. Here it's only two lines. If an algorithm is being implemented or something tricky is going on, a reference to the paper where it is published should be included, as well as any notes or "gotchas" in the code to watch out for.

          +A few things to note about this particular format. The "-*- C++ -*-" +string on the first line is there to tell Emacs that the source file is a C++ +file, not a C file (Emacs assumes .h files are C files by default [Note that tag +this is not necessary in .cpp files]). The name of the file is also on the +first line, along with a very short description of the purpose of the file. +This is important when printing out code and flipping though lots of pages.

          + +The main body of the description does not have to be very long in most cases. +Here it's only two lines. If an algorithm is being implemented or something +tricky is going on, a reference to the paper where it is published should be +included, as well as any notes or "gotchas" in the code to watch out for.

        3. Class overviews
        4. -Classes are one fundemental part of a good object oriented design. As such, a class definition should have a comment block that explains what the class is used for... if it's not obvious. If it's so completely obvious your grandma could figure it out, it's probably safe to leave it out. Naming classes something sane goes a long ways towards avoiding writing documentation. :)

          +Classes are one fundemental part of a good object oriented design. As such, a +class definition should have a comment block that explains what the class is +used for... if it's not obvious. If it's so completely obvious your grandma +could figure it out, it's probably safe to leave it out. Naming classes +something sane goes a long ways towards avoiding writing documentation. :)

        5. Method information
        6. -Methods defined in a class (as well as any global functions) should also be documented properly. A quick note about what it does any a description of the borderline behaviour is all that is necessary here (unless something particularly tricky or insideous is going on). The hope is that people can figure out how to use your interfaces without reading the code itself... that is the goal metric.

          +Methods defined in a class (as well as any global functions) should also be +documented properly. A quick note about what it does any a description of the +borderline behaviour is all that is necessary here (unless something +particularly tricky or insideous is going on). The hope is that people can +figure out how to use your interfaces without reading the code itself... that is +the goal metric.

          -Good things to talk about here are what happens when something unexpected happens: does the method return null? Abort? Format your hard disk?

          +Good things to talk about here are what happens when something unexpected +happens: does the method return null? Abort? Format your hard disk?


      Comment Formatting

        -In general, prefer C++ style (//) comments. They take less space, require less typing, don't have nesting problems, etc. There are a few cases when it is useful to use C style (/* */) comments however:

        +In general, prefer C++ style (//) comments. They take less space, +require less typing, don't have nesting problems, etc. There are a few cases +when it is useful to use C style (/* */) comments however:

          -
        1. When writing a C code: Obviously if you are writing C code, use C style comments. :) +
        2. When writing a C code: Obviously if you are writing C code, use C style +comments. :)
        3. When writing a header file that may be #included by a C source file. -
        4. When writing a source file that is used by a tool that only accepts C style comments. +
        5. When writing a source file that is used by a tool that only accepts C style +comments.

        -To comment out a large block of code, use #if 0 and #endif. These nest properly and are better behaved in general than C style comments.

        +To comment out a large block of code, use #if 0 and #endif. +These nest properly and are better behaved in general than C style comments.


      #include Style

        @@ -167,15 +206,25 @@


      Use Spaces Instead of Tabs


      Indent Code Consistently

        -Okay, your first year of programming you were told that indentation is important. If you didn't believe and internalize this then, now is the time. Just do it.

        +Okay, your first year of programming you were told that indentation is +important. If you didn't believe and internalize this then, now is the time. +Just do it.

        @@ -189,9 +238,17 @@


      Treat Compiler Warnings Like Errors

        -If your code has compiler warnings in it, something is wrong: you aren't casting values correctly, your have "questionable" constructs in your code, or you are doing something legitimately wrong. Compiler warnings can cover up legitimate errors in output and make dealing with a translation unit difficult.

        - -It is not possible to prevent all warnings from all compilers, nor is it desirable. Instead, pick a standard compiler (like gcc) that provides a good thorough set of warnings, and stick to them. At least in the case of gcc, it is possible to work around any spurious errors by changing the syntax of the code slightly. For example, an warning that annoys me occurs when I write code like this:

        +If your code has compiler warnings in it, something is wrong: you aren't casting +values correctly, your have "questionable" constructs in your code, or you are +doing something legitimately wrong. Compiler warnings can cover up legitimate +errors in output and make dealing with a translation unit difficult.

        + +It is not possible to prevent all warnings from all compilers, nor is it +desirable. Instead, pick a standard compiler (like gcc) that provides +a good thorough set of warnings, and stick to them. At least in the case of +gcc, it is possible to work around any spurious errors by changing the +syntax of the code slightly. For example, an warning that annoys me occurs when +I write code like this:

           if (V = getValue()) {
        @@ -199,7 +256,10 @@
           }
         

        -gcc will warn me that I probably want to use the == operator, and that I probably mistyped it. In most cases, I haven't, and I really don't want the spurious errors. To fix this particular problem, I rewrite the code like this:

        +gcc will warn me that I probably want to use the == operator, +and that I probably mistyped it. In most cases, I haven't, and I really don't +want the spurious errors. To fix this particular problem, I rewrite the code +like this:

           if ((V = getValue())) {
        @@ -429,7 +489,9 @@
         Writing Iterators
         
          -Here's a pretty good summary of how to write your own data structure iterators in a way that is compatible with the STL, and with a lot of other code out there (slightly edited by Chris):

          +Here's a pretty good summary of how to write your own data structure iterators +in a way that is compatible with the STL, and with a lot of other code out there +(slightly edited by Chris):

           From: Ross Smith 
          @@ -750,14 +812,16 @@
           
            -A lot of these comments and recommendations have been culled for other sources. Two particularly important books for our work are:

            +A lot of these comments and recommendations have been culled for other sources. +Two particularly important books for our work are:

            1. Effective C++ by Scott Meyers. There is an online version of the book (only some chapters though) available as well.
            2. Large-Scale C++ Software Design by John Lakos

            -If you get some free time, and you haven't read them: do so, you might learn something. :) +If you get some free time, and you haven't read them: do so, you might learn +something. :) From gaeke at cs.uiuc.edu Mon Oct 6 15:51:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 15:51:01 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/SLI.cpp Message-ID: <200310062050.PAA18752@trinity.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: SLI.cpp updated: 1.7 -> 1.8 --- Log message: Move #defines of BRANCH_ALWAYS and CALL to reopt/InstrUtils.h. Stdify more names. No more `using namespace std'. Untabify. Erase more commented-out code. Fix more asserts. Shorten. --- Diffs of the changes: Index: reopt/lib/LightWtProfiling/SLI.cpp diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.7 reopt/lib/LightWtProfiling/SLI.cpp:1.8 --- reopt/lib/LightWtProfiling/SLI.cpp:1.7 Mon Oct 6 12:56:52 2003 +++ reopt/lib/LightWtProfiling/SLI.cpp Mon Oct 6 15:50:01 2003 @@ -12,23 +12,19 @@ #include #include -using namespace std; - extern "C" void llvm_time_end(); extern void countPath(); extern "C" void llvm_first_trigger(); extern void initModules (); -enum Color{ +enum Color { WHITE, GREY, BLACK }; -#define BRANCH_ALWAYS 0x10800000 -#define CALL 0x40000000 - -void doInlining(uint64_t addr1, vector &stack, VirtualMem *vm); +void doInlining(uint64_t addr1, std::vector &stack, + VirtualMem *vm); void doBackEdgeDFS(BasicBlock *node, std::map &backedges, @@ -38,7 +34,7 @@ if (color[*si] == GREY) { //backedge node->*si assert(backedges.find(node) == backedges.end() && - "Multiple backedges starting at same basic block"); + "Multiple backedges starting at same basic block"); backedges[node] = *si; } else if (color[*si] != BLACK) { assert(color[*si] == WHITE); @@ -48,65 +44,59 @@ color[node] = BLACK; } -void getBackEdges(map &backedges, Function *F){ +void getBackEdges (std::map &backedges, Function *F){ BasicBlock &root = F->front(); - map color; + std::map color; doBackEdgeDFS(&root, backedges, color); } void doForwardDFS(BasicBlock *node,BasicBlock *end, - std::map &backEdges, - std::map &forward, - std::map &color){ + std::map &backEdges, + std::map &forward, + std::map &color){ color[node] = GREY; forward[node] = 1; - if(node != end){ - for(succ_iterator s=succ_begin(node), se=succ_end(node); s!=se; ++s){ - //if node -> *s is a backedge, neglect - if(backEdges[node] == *s) - continue; - if(color[*s] == WHITE) { - doForwardDFS(*s, end, backEdges, forward, color); - } - } - } + if (node != end) + for (succ_iterator s=succ_begin(node), se=succ_end(node); s!=se; ++s) { + //if node -> *s is a backedge, neglect + if(backEdges[node] == *s) + continue; + if(color[*s] == WHITE) + doForwardDFS(*s, end, backEdges, forward, color); + } color[node] = BLACK; } void getForward(BasicBlock *root, BasicBlock *end, - std::map &backEdges, - std::map &forward){ + std::map &backEdges, + std::map &forward){ //do DFS, avoid backedges, don't go beyond end std::map color; doForwardDFS(root, end, backEdges, forward, color); } void doBackwardDFS(BasicBlock *node, BasicBlock *start, - std::map &backEdges, - std::map &forward, - std::map &backward, - std::map &color){ + std::map &backEdges, + std::map &forward, + std::map &backward, + std::map &color){ color[node] = GREY; backward[node] = 1; - if(node != start){ - for(pred_iterator p=pred_begin(node), pe=pred_end(node); p!=pe; ++p){ - if(forward[*p]){ - if(backEdges[*p] == node){ - continue; - } - if(color[*p] == WHITE) { - doBackwardDFS(*p, start, backEdges, forward, backward, color); - } + if(node != start) + for(pred_iterator p=pred_begin(node), pe=pred_end(node); p!=pe; ++p) + if(forward[*p]) { + if(backEdges[*p] == node) + continue; + if(color[*p] == WHITE) + doBackwardDFS(*p, start, backEdges, forward, backward, color); } - } - } color[node] = BLACK; } void getBackward(BasicBlock *node, BasicBlock *start, - std::map &backEdges, - std::map &forward, - std::map &backward){ + std::map &backEdges, + std::map &forward, + std::map &backward){ //do DFS, avoid backedges, consider only forward edges std::map color; doBackwardDFS(node, start, backEdges, forward, backward, color); @@ -114,27 +104,24 @@ } void getExit(std::map &backward, - std::map &exitBBs){ + std::map &exitBBs){ std::vector toPush; for(std::map::iterator MI = backward.begin(), - ME = backward.end(); MI != ME; ++MI){ - for(succ_iterator s=succ_begin(MI->first), - se=succ_end(MI->first); s != se; ++s){ - if(backward.find(*s) == backward.end()){ - exitBBs[*s] = 1; - toPush.push_back(*s); + ME = backward.end(); MI != ME; ++MI) + for (succ_iterator s=succ_begin(MI->first), + se=succ_end(MI->first); s != se; ++s) + if(backward.find(*s) == backward.end()) { + exitBBs[*s] = 1; + toPush.push_back(*s); } - } - } for(std::vector::iterator VI = toPush.begin(), - VE = toPush.end(); VI != VE; ++VI){ + VE = toPush.end(); VI != VE; ++VI) backward[*VI] = 1; - } } void doTraceDFS(BasicBlock *node, std::vector &trace, - std::map &backward, - std::map &color){ + std::map &backward, + std::map &color){ color[node] = GREY; trace.push_back(node); for(succ_iterator s=succ_begin(node), se=succ_end(node); s != se; ++s) @@ -145,14 +132,14 @@ } void getTrace(BasicBlock *root, std::vector &trace, - std::map &backward){ + std::map &backward){ //do a DFS from root ONLY on nodes in backward std::map color; doTraceDFS(root, trace, backward, color); } -void doTraceDFSForFunction(BasicBlock *node, vector &trace, - map &color){ +void doTraceDFSForFunction(BasicBlock *node, std::vector &trace, + std::map &color){ color[node] = GREY; trace.push_back(node); for(succ_iterator s=succ_begin(node), se=succ_end(node); s != se; ++s) @@ -214,7 +201,7 @@ //end node assert(backEdges.find(end) != backEdges.end() && - "No backedge with end found"); + "No backedge with end found"); //get forward edges std::map forward; @@ -266,7 +253,6 @@ trace.push_back(exit_code[0]); trace.push_back(exit_code[1]); trace.push_back(call_code[3]); - //trace.push_back(exit_code[2]); trace.push_back(BRANCH_ALWAYS); trace.push_back(NOP); branchMap[index + 4] = bbStart; @@ -281,123 +267,123 @@ BasicBlock *taken=NULL, *ntaken=NULL; TerminatorInst *TI = (*VBI)->getTerminator(); if(isa(TI)){ - BranchInst *BI = cast(TI); - if(BI->isConditional()){ - isCondBranch = true; - taken = BI->getSuccessor(0); - ntaken = BI->getSuccessor(1); - succ0 = getBasicBlockInfo(taken).first; - succ1 = getBasicBlockInfo(ntaken).first; - } + BranchInst *BI = cast(TI); + if(BI->isConditional()){ + isCondBranch = true; + taken = BI->getSuccessor(0); + ntaken = BI->getSuccessor(1); + succ0 = getBasicBlockInfo(taken).first; + succ1 = getBasicBlockInfo(ntaken).first; + } } for(uint64_t addr = bbStart; addr <= bbEnd; addr+=4){//loop on BB - unsigned instr = vm->readInstrFrmVm(addr, tr, tr2); - if(isIndirectCall(instr)){ - trace.push_back(call_code[0]); - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(call_code[1]); - index += 4; - addr += 4; - } else if(isCallInstr(instr)){ - uint64_t callTarget = getCallTarget(instr, addr); - if(callTarget != (uint64_t)(intptr_t)&llvm_first_trigger){ - if(isInlinable(getRevFunction(M, callTarget))){ - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - callMap[index] = getCallTarget(instr, addr); - toInline[callTarget] = 1; - index += 2; - addr += 4; - } else{ - trace.push_back(call_code[0]); - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(call_code[1]); - callMap[index+1] = getCallTarget(instr, addr); - index += 4; - addr += 4; - } - } else{ - trace.push_back(call_code[2]); //save o7 - trace.push_back(loop_top_code[0]); - trace.push_back(loop_top_code[1]); - trace.push_back(call_code[3]); //restore o7 - callMap[index+1] = (uint64_t)(intptr_t)&countPath; - index += 4; - } - } else if(isBranchInstr(instr)){//is branch - assert(!isBranchNever(instr) && "Branch never not handled!"); - if(isBranchAlways(instr)){ - uint64_t target = getBranchTarget(instr, addr); - if(target == addr1){ - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace[index] = getBranchInst(instr, - (uint64_t)(intptr_t)&trace[0], - (uint64_t)(intptr_t)&trace[index]); - index += 2; - } else{ - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - BasicBlock *targetBB=NULL; - assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); - branchStub[index] = targetBB; - index += 2; - } - addr += 4; - } else{ + unsigned instr = vm->readInstrFrmVm(addr, tr, tr2); + if(isIndirectCall(instr)){ + trace.push_back(call_code[0]); + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(call_code[1]); + index += 4; + addr += 4; + } else if(isCallInstr(instr)){ + uint64_t callTarget = getCallTarget(instr, addr); + if(callTarget != (uint64_t)(intptr_t)&llvm_first_trigger){ + if(isInlinable(getRevFunction(M, callTarget))){ + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + callMap[index] = getCallTarget(instr, addr); + toInline[callTarget] = 1; + index += 2; + addr += 4; + } else{ + trace.push_back(call_code[0]); + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(call_code[1]); + callMap[index+1] = getCallTarget(instr, addr); + index += 4; + addr += 4; + } + } else{ + trace.push_back(call_code[2]); //save o7 + trace.push_back(loop_top_code[0]); + trace.push_back(loop_top_code[1]); + trace.push_back(call_code[3]); //restore o7 + callMap[index+1] = (uint64_t)(intptr_t)&countPath; + index += 4; + } + } else if(isBranchInstr(instr)){//is branch + assert(!isBranchNever(instr) && "Branch never not handled!"); + if(isBranchAlways(instr)){ + uint64_t target = getBranchTarget(instr, addr); + if(target == addr1){ + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace[index] = getBranchInst(instr, + (uint64_t)(intptr_t)&trace[0], + (uint64_t)(intptr_t)&trace[index]); + index += 2; + } else{ + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + BasicBlock *targetBB=NULL; + assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); + branchStub[index] = targetBB; + index += 2; + } + addr += 4; + } else{ assert (isCondBranch); - uint64_t target = getBranchTarget(instr, addr); - if (target == succ0) { - isSucc0 = true; - fillLater = index; - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(succ1_code[0]); - trace.push_back(succ1_code[1]); - index += 4; - addr += 4; - } else { - fillLater = index; - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(succ0_code[0]); - trace.push_back(succ0_code[1]); - index += 4; - addr += 4; - } - } - } else{ - trace.push_back(instr); - index++; - } + uint64_t target = getBranchTarget(instr, addr); + if (target == succ0) { + isSucc0 = true; + fillLater = index; + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(succ1_code[0]); + trace.push_back(succ1_code[1]); + index += 4; + addr += 4; + } else { + fillLater = index; + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(succ0_code[0]); + trace.push_back(succ0_code[1]); + index += 4; + addr += 4; + } + } + } else{ + trace.push_back(instr); + index++; + } } if(isCondBranch){ - trace.push_back(0);//dummy - unsigned int newBranch = + trace.push_back(0);//dummy + unsigned int newBranch = getBranchInst(trace[fillLater], (uint64_t)(intptr_t)&trace[index], (uint64_t)(intptr_t)&trace[fillLater]); - trace[fillLater] = newBranch; - if(isSucc0){ - assert((taken != vBB[0]) && "Conditional branch to top!"); - trace[index] = succ0_code[0]; - trace.push_back(succ0_code[1]); - trace.push_back(BRANCH_ALWAYS); - trace.push_back(NOP); - branchStub[index+2] = taken; - index += 4; - } else{ - assert((ntaken != vBB[0]) && "Conditional branch to top!"); - trace[index] = succ1_code[0]; - trace.push_back(succ1_code[1]); - trace.push_back(BRANCH_ALWAYS); - trace.push_back(NOP); - branchStub[index+2] = ntaken; - index += 4; - } + trace[fillLater] = newBranch; + if(isSucc0){ + assert((taken != vBB[0]) && "Conditional branch to top!"); + trace[index] = succ0_code[0]; + trace.push_back(succ0_code[1]); + trace.push_back(BRANCH_ALWAYS); + trace.push_back(NOP); + branchStub[index+2] = taken; + index += 4; + } else{ + assert((ntaken != vBB[0]) && "Conditional branch to top!"); + trace[index] = succ1_code[0]; + trace.push_back(succ1_code[1]); + trace.push_back(BRANCH_ALWAYS); + trace.push_back(NOP); + branchStub[index+2] = ntaken; + index += 4; + } } } } @@ -411,24 +397,22 @@ } - if(!tr->addTrace(addr1, endAddr, trace, 0, callMap, branchMap, tr2)){ - std::cerr<<"Could not add!\n"; - } + if(!tr->addTrace(addr1, endAddr, trace, 0, callMap, branchMap, tr2)) + std::cerr << "Could not add!\n"; DEBUG(std::cerr << "Added-SLI-trace\t" << (void *)addr1 << "\t" - << (void *)endAddr << "\t" << trace.size() << "\n"); + << (void *)endAddr << "\t" << trace.size() << "\n"); - for(std::map::iterator MI = toInline.begin(), - ME = toInline.end(); MI != ME; ++MI) { - if(!tr->hasTraceAddr(MI->first)){ - vector stack; + for (std::map::iterator MI = toInline.begin(), + ME = toInline.end(); MI != ME; ++MI) + if (!tr->hasTraceAddr(MI->first)) { + std::vector stack; stack.push_back(root->getParent()); doInlining(MI->first, stack, vm); } - } } -void doInlining(uint64_t addr1, vector &stack, VirtualMem *vm){ +void doInlining(uint64_t addr1, std::vector &stack, VirtualMem *vm){ // Make sure we have already parsed the LLVM bytecode and have the // resulting LLVM Module handy. if (!M) @@ -440,16 +424,10 @@ //get BB address BasicBlock *root = &F->front(); - //BasicBlock *end = &F->back(); - //std::cerr<(end->getTerminator()) && "Not the terminal BB"); - //get a vector of trace - vector vBB; - map color; + std::vector vBB; + std::map color; doTraceDFSForFunction(root, vBB, color); unsigned int initial_code[] = {0x83663001};//0x82102001//move 1 to g1 @@ -462,18 +440,18 @@ //spill o0, g7->o0, call, unspill o0 0x90104000 unsigned int exit_code[] = {CALL, NOP};//call llvm_time_end - map callMap; - map branchMap; - map bbPlacement; - map branchStub; - map toInline; + std::map callMap; + std::map branchMap; + std::map bbPlacement; + std::map branchStub; + std::map toInline; int index = 0; - vector trace; + std::vector trace; //generate a vector of instructions //assume: succ[0] is 0, succ[1] is 1 - for(vector::iterator VBI = vBB.begin(), VBE = vBB.end(); + for(std::vector::iterator VBI = vBB.begin(), VBE = vBB.end(); VBI != VBE; ++VBI){//loop on vBB std::pair bbInst = getBasicBlockInfo(*VBI); @@ -492,165 +470,126 @@ if(isa(TI)){ BranchInst *BI = cast(TI); if(BI->isConditional()){ - isCondBranch = true; - taken = BI->getSuccessor(0); - ntaken = BI->getSuccessor(1); - succ0 = getBasicBlockInfo(taken).first; - succ1 = getBasicBlockInfo(ntaken).first; + isCondBranch = true; + taken = BI->getSuccessor(0); + ntaken = BI->getSuccessor(1); + succ0 = getBasicBlockInfo(taken).first; + succ1 = getBasicBlockInfo(ntaken).first; } } - for(uint64_t addr = bbStart; addr <= bbEnd; addr+=4){//loop on BB unsigned instr = vm->readInstrFrmVm(addr, tr, tr2); - - if(isIndirectCall(instr)){ - trace.push_back(call_code[0]); + if (isIndirectCall(instr)) { + trace.push_back(call_code[0]); + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(call_code[1]); + index += 4; + addr += 4; + } else if (isCallInstr(instr)) { + uint64_t callTarget = getCallTarget(instr, addr); + if(callTarget != (uint64_t)(intptr_t)&llvm_first_trigger){ + if(isInlinable(getRevFunction(M, callTarget)) && + find(stack.begin(), stack.end(), + getRevFunction(M, callTarget)) == stack.end()){ + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + callMap[index] = getCallTarget(instr, addr); + toInline[callTarget] = 1; + index += 2; + addr += 4; + } else { + trace.push_back(call_code[0]); + trace.push_back(instr); + trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); + trace.push_back(call_code[1]); + callMap[index+1] = getCallTarget(instr, addr); + index += 4; + addr += 4; + } + } else { + trace.push_back(call_code[2]); //save o7 + trace.push_back(loop_top_code[0]); + trace.push_back(loop_top_code[1]); + trace.push_back(call_code[3]); //restore o7 + callMap[index+1] = (uint64_t)(intptr_t)&countPath; + index += 4; + } + } else if(isBranchInstr(instr)){//is branch + assert ((isBranchAlways (instr) || isCondBranch) + && "Unhandled type of branch instruction"); + uint64_t target = getBranchTarget(instr, addr); trace.push_back(instr); - //trace.push_back(NOP); trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(call_code[1]); - index += 4; + if (isBranchAlways(instr)) { + BasicBlock *targetBB = NULL; + assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); + branchStub[index] = targetBB; + index += 2; + } else if (isCondBranch) { + fillLater = index; + if (target == succ0) { + isSucc0 = true; + trace.push_back(succ1_code[0]); + trace.push_back(succ1_code[1]); + } else{ + trace.push_back(succ0_code[0]); + trace.push_back(succ0_code[1]); + } + index += 4; + } addr += 4; - } - else if(isCallInstr(instr)){ - uint64_t callTarget = getCallTarget(instr, addr); - if(callTarget != (uint64_t)(intptr_t)&llvm_first_trigger){ - if(isInlinable(getRevFunction(M, callTarget)) && - find(stack.begin(), stack.end(), - getRevFunction(M, callTarget)) == stack.end()){ - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - callMap[index] = getCallTarget(instr, addr); - toInline[callTarget] = 1; - index += 2; - addr += 4; - } - else{ - trace.push_back(call_code[0]); - trace.push_back(instr); - //trace.push_back(NOP); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(call_code[1]); - callMap[index+1] = getCallTarget(instr, addr); - index += 4; - addr += 4; - } - } - else{ - trace.push_back(call_code[2]); //save o7 - trace.push_back(loop_top_code[0]); - trace.push_back(loop_top_code[1]); - trace.push_back(call_code[3]); //restore o7 - callMap[index+1] = (uint64_t)(intptr_t)&countPath; - index += 4; - } - } - else if(isBranchInstr(instr)){//is branch - assert(!isBranchNever(instr) && "Branch never not handled!"); - if(isBranchAlways(instr)){ - uint64_t target = getBranchTarget(instr, addr); - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - - BasicBlock *targetBB=NULL; - assert(getReverseBBMap(getBranchTarget(instr, addr), M, targetBB)); - branchStub[index] = targetBB; - index += 2; - addr += 4; - } - else{ - if(isCondBranch){ - uint64_t target = getBranchTarget(instr, addr); - if(target == succ0){ - isSucc0 = true; - fillLater = index; - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(succ1_code[0]); - trace.push_back(succ1_code[1]); - index += 4; - addr += 4; - } - else{ - fillLater = index; - trace.push_back(instr); - trace.push_back(vm->readInstrFrmVm(addr+4, tr, tr2)); - trace.push_back(succ0_code[0]); - trace.push_back(succ0_code[1]); - index += 4; - addr += 4; - } - } - else{ - assert(false && "Should not be here!"); - } - } - } - else{ - trace.push_back(instr); - index++; + } else { + trace.push_back(instr); + index++; } } - if(isCondBranch){ + if (isCondBranch) { trace.push_back(0);//dummy - - unsigned int newBranch = getBranchInst(trace[fillLater], - (uint64_t)(intptr_t)&trace[index], - (uint64_t)(intptr_t)&trace[fillLater]); - + unsigned int newBranch = + getBranchInst(trace[fillLater], + (uint64_t)(intptr_t)&trace[index], + (uint64_t)(intptr_t)&trace[fillLater]); trace[fillLater] = newBranch; - - if(isSucc0){ - trace[index] = succ0_code[0]; - trace.push_back(succ0_code[1]); - trace.push_back(BRANCH_ALWAYS); - trace.push_back(NOP); - - if(taken == vBB[0]){ - assert(false && "Conditional branch to top!"); - } - branchStub[index+2] = taken; - index += 4; - } - else{ - trace[index] = succ1_code[0]; - trace.push_back(succ1_code[1]); - trace.push_back(BRANCH_ALWAYS); - if(ntaken == vBB[0]){ - assert(false && "Conditional branch to top!"); - } - branchStub[index+2] = ntaken; - trace.push_back(NOP); - index += 4; + if (isSucc0) { + assert ((taken != vBB[0]) && "Conditional branch to top!"); + trace[index] = succ0_code[0]; + trace.push_back(succ0_code[1]); + branchStub[index+2] = taken; + } else { + assert ((ntaken != vBB[0]) && "Conditional branch to top!"); + trace[index] = succ1_code[0]; + trace.push_back(succ1_code[1]); + branchStub[index+2] = ntaken; } + trace.push_back(BRANCH_ALWAYS); + trace.push_back(NOP); + index += 4; } - } - for(map::iterator MI = branchStub.begin(), - ME = branchStub.end(); MI != ME; ++MI){ - trace[MI->first] = getBranchInst(trace[MI->first], - (uint64_t)(intptr_t)&trace[bbPlacement[MI->second]], - (uint64_t)(intptr_t)&trace[MI->first]); + for (std::map::iterator MI = branchStub.begin(), + ME = branchStub.end(); MI != ME; ++MI) { + trace[MI->first] = + getBranchInst(trace[MI->first], + (uint64_t)(intptr_t)&trace[bbPlacement[MI->second]], + (uint64_t)(intptr_t)&trace[MI->first]); } uint64_t fakeEnd = 0; - if(F->size() > 1){ - if(!tr->addTrace(addr1, fakeEnd, trace, 0, callMap, branchMap, tr2)){ - std::cerr<<"Could not add!\n"; - } - } + if (F->size() > 1) + if (!tr->addTrace(addr1, fakeEnd, trace, 0, callMap, branchMap, tr2)) + std::cerr << "Could not add!\n"; DEBUG(std::cerr << "Added-SLI-inline\t" << (void *)addr1 << "\t" << - trace.size() << "\n"); + trace.size() << "\n"); - for(map::iterator MI = toInline.begin(), ME = toInline.end(); - MI != ME; ++MI){ - if(!tr->hasTraceAddr(MI->first)){ + for (std::map::iterator MI = toInline.begin(), + ME = toInline.end(); MI != ME; ++MI) + if (!tr->hasTraceAddr(MI->first)) { stack.push_back(root->getParent()); doInlining(MI->first, stack, vm); } - } } From lattner at cs.uiuc.edu Mon Oct 6 15:53:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 15:53:03 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/External/SPEC/CINT2000/Makefile Message-ID: <200310062052.PAA26010@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/External/SPEC/CINT2000: Makefile updated: 1.5 -> 1.6 --- Log message: Add the three remaining spec tests, though they don't work, they shouldn't stop the nightly tester --- Diffs of the changes: Index: llvm/test/Programs/External/SPEC/CINT2000/Makefile diff -u llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.5 llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.6 --- llvm/test/Programs/External/SPEC/CINT2000/Makefile:1.5 Sat Sep 20 10:17:14 2003 +++ llvm/test/Programs/External/SPEC/CINT2000/Makefile Mon Oct 6 15:51:56 2003 @@ -2,9 +2,12 @@ PARALLEL_DIRS := \ 164.gzip \ 175.vpr \ + 176.gcc \ 181.mcf \ 186.crafty \ 197.parser \ + 252.eon \ + 253.perlbmk \ 254.gap \ 255.vortex \ 256.bzip2 \ From gaeke at cs.uiuc.edu Mon Oct 6 15:56:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 15:56:01 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310062055.PAA18788@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.43 -> 1.44 --- Log message: Put the number of pluses and minuses in the e-mail message. Heh heh heh. --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.43 CVSROOT/commit-diffs.pl:1.44 --- CVSROOT/commit-diffs.pl:1.43 Fri Aug 1 16:17:10 2003 +++ CVSROOT/commit-diffs.pl Mon Oct 6 15:55:11 2003 @@ -121,7 +121,10 @@ } } $msg .= "\n---\nLog message:\n\n" . join('', at logmessage); -$msg .= "\n---\nDiffs of the changes:\n\n" . $diffs; +foreach my $line (split /\n/, $diffs) { + $pluses++ if /^\+/; $minuses++ if /^\-/; +} +$msg .= "\n---\nDiffs of the changes: (+$pluses -$minuses)\n\n" . $diffs; open TEMP, ">$TEMPFILE"; print TEMP $msg; From gaeke at cs.uiuc.edu Mon Oct 6 15:57:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 15:57:01 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/SLI.cpp Message-ID: <200310062056.PAA18804@trinity.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: SLI.cpp updated: 1.8 -> 1.9 --- Log message: file header comment. --- Diffs of the changes: (+ -) Index: reopt/lib/LightWtProfiling/SLI.cpp diff -u reopt/lib/LightWtProfiling/SLI.cpp:1.8 reopt/lib/LightWtProfiling/SLI.cpp:1.9 --- reopt/lib/LightWtProfiling/SLI.cpp:1.8 Mon Oct 6 15:50:01 2003 +++ reopt/lib/LightWtProfiling/SLI.cpp Mon Oct 6 15:56:06 2003 @@ -1,3 +1,8 @@ +//===- SLI.cpp - Perform second-level instrumentation ------------*- C++-*---=// +// +// +//===----------------------------------------------------------------------===// + #include "GetTimer.h" #include "Globals.h" #include "Support/DataTypes.h" @@ -25,7 +30,6 @@ void doInlining(uint64_t addr1, std::vector &stack, VirtualMem *vm); - void doBackEdgeDFS(BasicBlock *node, std::map &backedges, std::map &color) { From gaeke at cs.uiuc.edu Mon Oct 6 15:58:03 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 15:58:03 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310062057.PAA18818@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.44 -> 1.45 --- Log message: initialize variable. --- Diffs of the changes: (+ -) Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.44 CVSROOT/commit-diffs.pl:1.45 --- CVSROOT/commit-diffs.pl:1.44 Mon Oct 6 15:55:11 2003 +++ CVSROOT/commit-diffs.pl Mon Oct 6 15:57:01 2003 @@ -121,6 +121,8 @@ } } $msg .= "\n---\nLog message:\n\n" . join('', at logmessage); +my $pluses = 0; +my $minuses = 0; foreach my $line (split /\n/, $diffs) { $pluses++ if /^\+/; $minuses++ if /^\-/; } From lattner at cs.uiuc.edu Mon Oct 6 19:50:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 19:50:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ Message-ID: <200310070049.TAA26877@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++ added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Mon Oct 6 19:51:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 19:51:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp Message-ID: <200310070050.TAA26907@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: ary2.cpp added (r1.1) --- Log message: Initial checkin of ary2 test --- Diffs of the changes: (+0 -0) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp:1.1 *** /dev/null Mon Oct 6 19:50:22 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary2.cpp Mon Oct 6 19:50:12 2003 *************** *** 0 **** --- 1,43 ---- + // -*- mode: c++ -*- + // $Id: ary2.cpp,v 1.1 2003/10/07 00:50:12 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + int + main(int argc, char *argv[]) { + int i, n = ((argc == 2) ? atoi(argv[1]) : 1); + typedef vector ARY; + ARY x(n); + ARY y(n); + + for (i=0; i= 0;) { + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + y[i] = x[i]; --i; + } + + cout << y.back() << endl; + } From lattner at cs.uiuc.edu Mon Oct 6 19:52:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 19:52:00 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary.cpp Message-ID: <200310070051.TAA26936@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: ary.cpp added (r1.1) --- Log message: Initial checkin of ary test --- Diffs of the changes: (+0 -0) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary.cpp:1.1 *** /dev/null Mon Oct 6 19:51:10 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary.cpp Mon Oct 6 19:51:00 2003 *************** *** 0 **** --- 1,23 ---- + // -*- mode: c++ -*- + // $Id: ary.cpp,v 1.1 2003/10/07 00:51:00 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + int + main(int argc, char *argv[]) { + int i, n = ((argc == 2) ? atoi(argv[1]) : 1); + typedef vector ARY; + ARY x(n); + ARY y(n); + + for (i=0; i= 0; --i) { + y[i] = x[i]; + } + + cout << y.back() << endl; + } From lattner at cs.uiuc.edu Mon Oct 6 19:53:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 19:53:00 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310070052.TAA26976@apoc.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.45 -> 1.46 --- Log message: Actually search the line in question. Avoid spamming me with lots of uninitialized value problems --- Diffs of the changes: (+0 -0) Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.45 CVSROOT/commit-diffs.pl:1.46 --- CVSROOT/commit-diffs.pl:1.45 Mon Oct 6 15:57:01 2003 +++ CVSROOT/commit-diffs.pl Mon Oct 6 19:52:39 2003 @@ -124,7 +124,7 @@ my $pluses = 0; my $minuses = 0; foreach my $line (split /\n/, $diffs) { - $pluses++ if /^\+/; $minuses++ if /^\-/; + $pluses++ if /^\+/ $line; $minuses++ if /^\-/ $line; } $msg .= "\n---\nDiffs of the changes: (+$pluses -$minuses)\n\n" . $diffs; From lattner at cs.uiuc.edu Mon Oct 6 19:58:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 19:58:00 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ackermann.cpp Message-ID: <200310070057.TAA27106@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: ackermann.cpp added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+17 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ackermann.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ackermann.cpp:1.1 *** /dev/null Mon Oct 6 19:57:18 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ackermann.cpp Mon Oct 6 19:57:08 2003 *************** *** 0 **** --- 1,17 ---- + // -*- mode: c++ -*- + // $Id: ackermann.cpp,v 1.1 2003/10/07 00:57:08 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + using namespace std; + + int Ack(int M, int N) { return(M ? (Ack(M-1,N ? Ack(M,(N-1)) : 1)) : N+1); } + + int main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + + cout << "Ack(3," << n << "): " << Ack(3, n) << endl; + return(0); + } From lattner at cs.uiuc.edu Mon Oct 6 20:01:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:01:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Message-ID: <200310070100.UAA27184@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: lists1.cpp added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+72 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp:1.1 *** /dev/null Mon Oct 6 20:00:55 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Mon Oct 6 20:00:44 2003 *************** *** 0 **** --- 1,72 ---- + // -*- mode: c++ -*- + // $Id: lists1.cpp,v 1.1 2003/10/07 01:00:44 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + #include + + using namespace std; + + void list_print_n (list L, int n) { + int c, lastc = n - 1; + list::iterator i; + for (c = 0, i = L.begin(); i != L.end(), c < n; ++i, ++c) { + cout << (*i); + if (c < lastc) cout << " "; + } + cout << endl; + } + + int main(int argc, char* argv[]) { + int N = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])): 1); + list::iterator i; + + // create empty list B + list B; + + // create list (A) of integers from 1 through N + list A(N); + iota(A.begin(), A.end(), 1); + + // move each individual item from A to B, in a loop, reversing order + while (! A.empty()) { + B.push_front(A.front()); + A.pop_front(); + } + + // print first 2 elements of B + list_print_n(B, 2); + + // reverse B (can be done in place) + B.reverse(); + // reverse(B.begin(), B.end()); + + // is 0 a member of B? + cout << ((find(B.begin(), B.end(), 0) == B.end()) ? "false" : "true") << endl; + + // is N a member of B? + cout << ((find(B.begin(), B.end(), N) == B.end()) ? "false" : "true") << endl; + + // filter values from B to A that are less than N/2, preserving order + int mid = N/2; + for (i = B.begin(); i != B.end(); ++i) { + if ((*i) < mid) A.push_back(*i); + } + + // print first ten items of A + list_print_n(A, 10); + + // print sum of items in A that are less than 1000 + int sum = 0; + for (i = A.begin(); i != A.end(); ++i) { + if ((*i) < 1000) sum += (*i); + } + cout << sum << endl; + + // append B to end of A + A.splice(A.end(), B); + + // print length and last element of A + cout << A.size() << " " << A.back() << endl; + } From lattner at cs.uiuc.edu Mon Oct 6 20:03:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:03:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp Message-ID: <200310070102.UAA27224@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: lists.cpp added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+50 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp:1.1 *** /dev/null Mon Oct 6 20:02:45 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp Mon Oct 6 20:02:35 2003 *************** *** 0 **** --- 1,50 ---- + // -*- mode: c++ -*- + // $Id: lists.cpp,v 1.1 2003/10/07 01:02:35 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // from Bill Lear + + #include + #include + #include + + using namespace std; + + const size_t SIZE = 10000; + + size_t test_lists() { + std::list li1(SIZE); + + std::iota(li1.begin(), li1.end(), 1); + + std::list li2(li1); + + std::list li3; + + size_t N = li2.size(); + while (N--) { + li3.push_back(li2.front()); + li2.pop_front(); + } + + N = li3.size(); + while (N--) { + li2.push_back(li3.back()); + li3.pop_back(); + } + + li1.reverse(); + + return (li1.front() == SIZE) && (li1 == li2) ? li1.size() : 0; + } + + int main(int argc, char* argv[]) { + size_t ITER = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])): 1); + + size_t result = 0; + while (ITER > 0) { + result = test_lists(); + --ITER; + } + + std::cout << result << std::endl; + } From lattner at cs.uiuc.edu Mon Oct 6 20:04:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:04:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp lists1.cpp Message-ID: <200310070103.UAA27277@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: lists.cpp updated: 1.1 -> 1.2 lists1.cpp updated: 1.1 -> 1.2 --- Log message: iota is a historical oddity from the SGI STL, it is not part of the standard --- Diffs of the changes: (+21 -5) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp:1.2 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp:1.1 Mon Oct 6 20:02:35 2003 +++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists.cpp Mon Oct 6 20:03:17 2003 @@ -1,5 +1,5 @@ // -*- mode: c++ -*- -// $Id: lists.cpp,v 1.1 2003/10/07 01:02:35 lattner Exp $ +// $Id: lists.cpp,v 1.2 2003/10/07 01:03:17 lattner Exp $ // http://www.bagley.org/~doug/shootout/ // from Bill Lear @@ -11,10 +11,18 @@ const size_t SIZE = 10000; +template +void +iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) +{ + while (__first != __last) + *__first++ = __value++; +} + size_t test_lists() { std::list li1(SIZE); - std::iota(li1.begin(), li1.end(), 1); + iota(li1.begin(), li1.end(), 1); std::list li2(li1); Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp:1.2 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp:1.1 Mon Oct 6 20:00:44 2003 +++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Mon Oct 6 20:03:17 2003 @@ -1,10 +1,18 @@ // -*- mode: c++ -*- -// $Id: lists1.cpp,v 1.1 2003/10/07 01:00:44 lattner Exp $ +// $Id: lists1.cpp,v 1.2 2003/10/07 01:03:17 lattner Exp $ // http://www.bagley.org/~doug/shootout/ #include #include #include + +template +void +iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) +{ + while (__first != __last) + *__first++ = __value++; +} using namespace std; From lattner at cs.uiuc.edu Mon Oct 6 20:07:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:07:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp Message-ID: <200310070106.UAA27379@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: reversefile.cpp added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+25 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp:1.1 *** /dev/null Mon Oct 6 20:06:06 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp Mon Oct 6 20:05:56 2003 *************** *** 0 **** --- 1,25 ---- + // -*- mode: c++ -*- + // $Id: reversefile.cpp,v 1.1 2003/10/07 01:05:56 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // with help from Allan Stokes + + #include + #include + #include + #include + + using namespace std; + + int main() { + typedef deque LINES; + LINES l; + char line[256]; + char buff[4096]; + cin.rdbuf()->pubsetbuf(buff, 4096); // enable buffering + cout.rdbuf()->pubsetbuf(buff, 4096); // enable buffering + + while (cin.getline(line, 256)) { + l.push_front(line); + } + copy (l.begin(), l.end(), ostream_iterator(cout,"\n")); + } From lattner at cs.uiuc.edu Mon Oct 6 20:07:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:07:03 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp Message-ID: <200310070106.UAA27410@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: reversefile.cpp updated: 1.1 -> 1.2 --- Log message: Add needed #include --- Diffs of the changes: (+3 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp:1.2 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp:1.1 Mon Oct 6 20:05:56 2003 +++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/reversefile.cpp Mon Oct 6 20:06:17 2003 @@ -1,5 +1,5 @@ // -*- mode: c++ -*- -// $Id: reversefile.cpp,v 1.1 2003/10/07 01:05:56 lattner Exp $ +// $Id: reversefile.cpp,v 1.2 2003/10/07 01:06:17 lattner Exp $ // http://www.bagley.org/~doug/shootout/ // with help from Allan Stokes @@ -7,6 +7,7 @@ #include #include #include +#include using namespace std; From lattner at cs.uiuc.edu Mon Oct 6 20:08:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:08:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp Message-ID: <200310070107.UAA27425@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: spellcheck.cpp added (r1.1) --- Log message: new benchmark --- Diffs of the changes: (+75 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.1 *** /dev/null Mon Oct 6 20:07:00 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp Mon Oct 6 20:06:50 2003 *************** *** 0 **** --- 1,75 ---- + // -*- mode: c++ -*- + // $Id: spellcheck.cpp,v 1.1 2003/10/07 01:06:50 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // STL spell checker from Bill Lear + + #include + #include + #include + #include + #include + #include + + using namespace std; + + typedef std::pair span; + + namespace std { + template <> struct hash; + template <> struct equal_to; + } + + template<> struct hash { + inline size_t operator()(const span& s) const { + size_t h = 0; + const char* end = s.second; + for (const char* begin = s.first; begin != end; ++begin) { + h = 5 * h + *begin; + } + return h; + } + }; + + template<> struct equal_to { + inline bool operator()(const span& s1, const span& s2) const { + return (s1.second - s1.first) == (s2.second - s2.first) && + std::equal(s1.first, s1.second, s2.first); + } + }; + + class spell_checker { + public: + spell_checker() { + std::ifstream in("Usr.Dict.Words"); + char line[32]; + while (in.getline(line, 32)) { + const char* begin = line; + const char* end = line + in.gcount() - 1; + if (dict.end() == dict.find(span(begin, end))) { + const size_t len = end - begin; + char* word = new char[len]; + copy(begin, end, word); + ++dict[span(word, word + len)]; + } + } + } + + void process(std::istream& in) { + char line[32]; + while (in.getline(line, 32)) { + if (dict.end() == dict.find(span(line, line + in.gcount() - 1))) { + cout << line << '\n'; + } + } + } + + private: + std::hash_map dict; + }; + + int main() { + spell_checker spell; + char buff[4096]; + cin.rdbuf()->pubsetbuf(buff, 4096); // enable buffering + spell.process(cin); + } From lattner at cs.uiuc.edu Mon Oct 6 20:09:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:09:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp Message-ID: <200310070108.UAA27485@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: spellcheck.cpp updated: 1.1 -> 1.2 --- Log message: Ugh, this uses a wierd implementation of hash_map, which is not standardized I don't want to even THINK About autoconfing this test, so switch it to use --- Diffs of the changes: (+4 -27) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.2 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.1 Mon Oct 6 20:06:50 2003 +++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp Mon Oct 6 20:08:48 2003 @@ -1,42 +1,19 @@ // -*- mode: c++ -*- -// $Id: spellcheck.cpp,v 1.1 2003/10/07 01:06:50 lattner Exp $ +// $Id: spellcheck.cpp,v 1.2 2003/10/07 01:08:48 lattner Exp $ // http://www.bagley.org/~doug/shootout/ // STL spell checker from Bill Lear #include #include #include -#include #include #include +#include using namespace std; typedef std::pair span; -namespace std { - template <> struct hash; - template <> struct equal_to; -} - -template<> struct hash { - inline size_t operator()(const span& s) const { - size_t h = 0; - const char* end = s.second; - for (const char* begin = s.first; begin != end; ++begin) { - h = 5 * h + *begin; - } - return h; - } -}; - -template<> struct equal_to { - inline bool operator()(const span& s1, const span& s2) const { - return (s1.second - s1.first) == (s2.second - s2.first) && - std::equal(s1.first, s1.second, s2.first); - } -}; - class spell_checker { public: spell_checker() { @@ -64,7 +41,7 @@ } private: - std::hash_map dict; + std::map dict; }; int main() { From lattner at cs.uiuc.edu Mon Oct 6 20:10:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:10:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp Message-ID: <200310070109.UAA27499@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: wordfreq.cpp added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+98 -2) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp:1.1 *** /dev/null Mon Oct 6 20:09:19 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp Mon Oct 6 20:09:09 2003 *************** *** 0 **** --- 1,98 ---- + // -*- mode: c++ -*- + // $Id: wordfreq.cpp,v 1.1 2003/10/07 01:09:09 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // By Tam?s Benk? + + #include + #include + #include + #include + #include + #include + + using namespace std; + + int const bufsize = 4096; + int const wsize = 64; + + class word_reader + { + int ws; + char buf[bufsize+1], *bptr, *word; + FILE *input; + + bool fill(); + + public: + word_reader(FILE *i): ws(wsize), bptr(buf), word(new char[ws+1]), input(i) + {*bptr = *word = '\0';} + int operator()(char const **); + }; + + inline bool word_reader::fill() + { + int nread = fread(buf, sizeof(char), bufsize, input); + buf[nread] = '\0'; + bptr = buf; + return nread > 0; + } + + int word_reader::operator()(char const **w) + { + int len = 0; + char c; + while (*bptr || fill()) { + if (isalpha(c = *bptr++)) { + word[len] = tolower(c); + if (++len == ws) { + char *nword = new char[(ws *= 2)+1]; + memcpy(nword, word, len); + delete[] word; + word = nword; + } + } + else if (len > 0) break; + } + *w = word; + word[len] = '\0'; + return len; + } + + typedef hash_map counter; + typedef pair hpair; + + namespace std + { + inline bool operator<(hpair const &lhs, hpair const &rhs) + { + return lhs.second != rhs.second ? lhs.second > rhs.second + : strcmp(lhs.first, rhs.first) > 0; + } + + template<> struct equal_to + { + bool operator()(char const *s1, char const *s2) const + {return strcmp(s1, s2) == 0;} + }; + } + + int main() + { + int len; + const char *w; + counter hist; + word_reader wr(stdin); + + while ((len = wr(&w)) > 0) { + counter::iterator i = hist.find(w); + if (i == hist.end()) hist[strcpy(new char[len+1], w)] = 1; + else ++i->second; + } + + vector v(hist.begin(), hist.end()); + sort(v.begin(), v.end()); + for (size_t i = 0; i < v.size(); ++i) + printf("%7d\t%s\n", v[i].second, v[i].first); + + return 0; + } From lattner at cs.uiuc.edu Mon Oct 6 20:11:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:11:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp Message-ID: <200310070110.UAA27682@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: wordfreq.cpp updated: 1.1 -> 1.2 --- Log message: switch testcase to use map instead of hash_map --- Diffs of the changes: (+4 -4) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp:1.2 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp:1.1 Mon Oct 6 20:09:09 2003 +++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wordfreq.cpp Mon Oct 6 20:10:06 2003 @@ -1,14 +1,14 @@ // -*- mode: c++ -*- -// $Id: wordfreq.cpp,v 1.1 2003/10/07 01:09:09 lattner Exp $ +// $Id: wordfreq.cpp,v 1.2 2003/10/07 01:10:06 lattner Exp $ // http://www.bagley.org/~doug/shootout/ // By Tam?s Benk? #include #include #include -#include #include #include +#include using namespace std; @@ -58,7 +58,7 @@ return len; } -typedef hash_map counter; +typedef map counter; typedef pair hpair; namespace std From lattner at cs.uiuc.edu Mon Oct 6 20:12:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:12:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/Makefile README.txt Message-ID: <200310070111.UAA28058@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: Makefile added (r1.1) README.txt added (r1.1) --- Log message: blah --- Diffs of the changes: (+8 -4) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/Makefile diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/Makefile:1.1 *** /dev/null Mon Oct 6 20:11:54 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/Makefile Mon Oct 6 20:11:44 2003 *************** *** 0 **** --- 1,4 ---- + LEVEL = ../../../../.. + LDFLAGS += -lm + + include $(LEVEL)/test/Programs/SingleSource/Makefile.singlesrc Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/README.txt diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/README.txt:1.1 *** /dev/null Mon Oct 6 20:11:54 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/README.txt Mon Oct 6 20:11:44 2003 *************** *** 0 **** --- 1,4 ---- + This directory contains testcases culled from the Programming Language Shootout: + + http://www.bagley.org/~doug/shootout/ + From lattner at cs.uiuc.edu Mon Oct 6 20:13:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:13:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary3.cpp echo.cpp except.cpp hash.cpp hash2.cpp heapsort.cpp hello.cpp matrix.cpp methcall.cpp moments.cpp nestedloop.cpp objinst.cpp prodcons.cpp random.cpp sieve.cpp strcat.cpp sumcol.cpp wc.cpp Message-ID: <200310070112.UAA28099@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++: ary3.cpp added (r1.1) echo.cpp added (r1.1) except.cpp added (r1.1) hash.cpp added (r1.1) hash2.cpp added (r1.1) heapsort.cpp added (r1.1) hello.cpp added (r1.1) matrix.cpp added (r1.1) methcall.cpp added (r1.1) moments.cpp added (r1.1) nestedloop.cpp added (r1.1) objinst.cpp added (r1.1) prodcons.cpp added (r1.1) random.cpp added (r1.1) sieve.cpp added (r1.1) strcat.cpp added (r1.1) sumcol.cpp added (r1.1) wc.cpp added (r1.1) --- Log message: Add tests which did not have to be "ported" to our C++ fe --- Diffs of the changes: (+968 -36) Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary3.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary3.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/ary3.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,26 ---- + // -*- mode: c++ -*- + // $Id: ary3.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + using namespace std; + + int main(int argc, char *argv[]) { + int i, k, n = ((argc == 2) ? atoi(argv[1]) : 1); + typedef vector ARY; + ARY x(n); + ARY y(n); + + for (i=0; i= 0; --i) { + y[i] += x[i]; + } + } + + cout << y[0] << " " << y.back() << endl; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/echo.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/echo.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/echo.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,152 ---- + // -*- mode: c++ -*- + // $Id: echo.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + using namespace std; + + #define DATA "Hello there sailor\n" + + void myabort (char *m) { fprintf(stderr, "%s\n", m); exit(1); } + void sysabort (char *m) { perror(m); exit(1); } + + int sigchld = 0; + void reaper (int sig) { sigchld = 1; } + + int + server_sock () { + int ss, optval = 1; + struct sockaddr_in sin; + if ((ss = socket(PF_INET, SOCK_STREAM, 0)) == -1) + sysabort("server/socket"); + if (setsockopt(ss, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == -1) + sysabort("server/setsockopt"); + memset(&sin,0,sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + sin.sin_port = 0; + if (bind(ss, (sockaddr *)&sin, sizeof(sin)) == -1) + sysabort("server/bind"); + listen(ss, 2); + return(ss); + } + + + int + get_port (int sock) { + struct sockaddr_in sin; + socklen_t slen = sizeof(sin); + if (getsockname(sock, (sockaddr *)&sin, &slen) == -1) + sysabort("server/getsockname"); + return(sin.sin_port); + } + + + int + client_sock (int port) { + struct sockaddr_in sin; + int sock; + if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == -1) + sysabort("client/socket"); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + sin.sin_port = port; + if (connect(sock, (sockaddr *)&sin, sizeof(sin)) == -1) + sysabort("client/connect"); + return(sock); + } + + + void + echo_client (int n, int port) { + int i, sock, olen, len, nwritten, nread; + char *offset, obuf[64], ibuf[64]; + char *end = ibuf + sizeof(ibuf); + + sock = client_sock(port); + strcpy(obuf, DATA); + olen = strlen(obuf); + for (i=0; i 0) { + if ((nwritten = write(sock, offset, len)) == -1) + sysabort("client/write"); + offset += nwritten; + len -= nwritten; + } + offset = ibuf; + while ((nread = read(sock, offset, (end - offset))) > 0) { + offset += nread; + if (*(offset-1) == '\n') break; + } + if (nread == -1) + sysabort("client/read"); + *offset = 0; + if ((strcmp(obuf, ibuf)) != 0) { + char mbuf[128]; + sprintf(mbuf, "client: \"%s\" ne \"%s\"", obuf, ibuf); + myabort(mbuf); + } + } + close(sock); + } + + + void + echo_server (int n) { + int ssock, csock, len, nwritten, total_bytes; + pid_t pid; + char buf[64], *offset; + struct sockaddr_in sin; + socklen_t slen = sizeof(sin); + int status; + + ssock = server_sock(); + signal(SIGCHLD, reaper); + if ((pid = fork()) == -1) + sysabort("server/fork"); + if (pid) { + /* parent is server */ + if ((csock = accept(ssock, (sockaddr *)&sin, &slen)) == -1) + sysabort("server/accept"); + total_bytes = 0; + while ((len = read(csock, buf, sizeof(buf))) > 0) { + if (sigchld) myabort("server/sigchld"); + offset = buf; + total_bytes += len; + while (len > 0) { + if ((nwritten = write(csock, offset, len)) == -1) + sysabort("server/write"); + offset += nwritten; + len -= nwritten; + } + } + if (len == -1) + sysabort("server/read"); + close(csock); + fprintf(stdout, "server processed %d bytes\n", total_bytes); + } else { + /* child is client */ + echo_client(n, get_port(ssock)); + } + wait(&status); + } + + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + echo_server(n); + return(0); + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/except.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/except.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/except.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,69 ---- + // -*- mode: c++ -*- + // $Id: except.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // from Bill Lear + + #include + #include + #include + + using namespace std; + + size_t HI = 0; + size_t LO = 0; + + class Hi_exception { + public: + explicit Hi_exception(size_t _n) : n(_n) {} + const char* what() { sprintf(N, "%d", n); return N; } + private: + size_t n; char N[8]; + }; + + class Lo_exception { + public: + explicit Lo_exception(size_t _n) : n(_n) {} + const char* what() { sprintf(N, "%d", n); return N; } + private: + size_t n; char N[8]; + }; + + void blowup(size_t num) { + if (num % 2) { + throw Lo_exception(num); + } + throw Hi_exception(num); + } + + void lo_function(size_t num) { + try { + blowup(num); + } catch(const Lo_exception& ex) { + ++LO; + } + } + + void hi_function(size_t num) { + try { + lo_function(num); + } catch(const Hi_exception& ex) { + ++HI; + } + } + + void some_function(size_t num) { + try { + hi_function(num); + } catch (...) { + cerr << "We shouldn't get here\n"; exit(1); + } + } + + int + main(int argc, char* argv[]) { + size_t NUM = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])): 1); + while (NUM--) { + some_function(NUM); + } + cout << "Exceptions: HI=" << HI << " / " << "LO=" << LO << endl; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,36 ---- + // -*- mode: c++ -*- + // $Id: hash.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + #include + + using namespace std; + + struct eqstr { + bool operator()(const char* s1, const char* s2) const { + return strcmp(s1, s2) == 0; + } + }; + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + char buf[16]; + typedef hash_map, eqstr> HM; + HM X; + + for (int i=1; i<=n; i++) { + sprintf(buf, "%x", i); + X[strdup(buf)] = i; + } + + int c = 0; + for (int i=n; i>0; i--) { + sprintf(buf, "%d", i); + if (X[strdup(buf)]) c++; + } + + cout << c << endl; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash2.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash2.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hash2.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,35 ---- + // -*- mode: c++ -*- + // $Id: hash2.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + #include + + using namespace std; + + struct eqstr { + bool operator()(const char* s1, const char* s2) const { + return strcmp(s1, s2) == 0; + } + }; + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + char buf[16]; + typedef hash_map, eqstr> HM; + HM hash1, hash2; + + for (int i=0; i<10000; i++) { + sprintf(buf, "foo_%d", i); + hash1[strdup(buf)] = i; + } + for (int i=0; i + #include + #include + + using namespace std; + + #define IM 139968 + #define IA 3877 + #define IC 29573 + + double + gen_random(double max) { + static long last = 42; + return( max * (last = (last * IA + IC) % IM) / IM ); + } + + void + heapsort(int n, double *ra) { + int i, j; + int ir = n; + int l = (n >> 1) + 1; + double rra; + + for (;;) { + if (l > 1) { + rra = ra[--l]; + } else { + rra = ra[ir]; + ra[ir] = ra[1]; + if (--ir == 1) { + ra[1] = rra; + return; + } + } + i = l; + j = l << 1; + while (j <= ir) { + if (j < ir && ra[j] < ra[j+1]) { ++j; } + if (rra < ra[j]) { + ra[i] = ra[j]; + j += (i = j); + } else { + j = ir + 1; + } + } + ra[i] = rra; + } + } + + int + main(int argc, char *argv[]) { + int N = ((argc == 2) ? atoi(argv[1]) : 1); + double *ary; + int i; + + /* create an array of N random doubles */ + ary = (double *)malloc((N+1) * sizeof(double)); + for (i=1; i<=N; i++) { + ary[i] = gen_random(1); + } + + heapsort(N, ary); + + printf("%.10f\n", ary[N]); + free(ary); + return(0); + } + Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hello.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hello.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/hello.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,12 ---- + // -*- mode: c++ -*- + // $Id: hello.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + + using namespace std; + + int main() { + cout << "hello world" << endl; + return(0); + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/matrix.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/matrix.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/matrix.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,66 ---- + // -*- mode: c++ -*- + // $Id: matrix.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + using namespace std; + + #define SIZE 30 + + int **mkmatrix(int rows, int cols) { + int i, j, count = 1; + int **m = (int **) malloc(rows * sizeof(int *)); + for (i=0; i -1) { free(m[rows]); } + free(m); + } + + int **mmult(int rows, int cols, int **m1, int **m2, int **m3) { + int i, j, k, val; + for (i=0; i + #include + + using namespace std; + + class Toggle { + public: + Toggle(bool start_state) : state(start_state) { } + virtual ~Toggle() { } + bool value() { + return(state); + } + virtual Toggle& activate() { + state = !state; + return(*this); + } + bool state; + }; + + class NthToggle : public Toggle { + public: + NthToggle(bool start_state, int max_counter) : + Toggle(start_state), count_max(max_counter), counter(0) { + } + Toggle& activate() { + if (++this->counter >= this->count_max) { + state = !state; + counter = 0; + } + return(*this); + } + private: + int count_max; + int counter; + }; + + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + + bool val = true; + Toggle *toggle = new Toggle(val); + for (int i=0; iactivate().value(); + } + cout << ((val) ? "true" : "false") << endl; + delete toggle; + + val = true; + NthToggle *ntoggle = new NthToggle(val, 3); + for (int i=0; iactivate().value(); + } + cout << ((val) ? "true" : "false") << endl; + delete ntoggle; + + return 0; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/moments.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/moments.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/moments.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,85 ---- + // -*- mode: c++ -*- + // $Id + // http://www.bagley.org/~doug/shootout/ + // Calculate statistical moments of a region, from Bill Lear + // Modified by Tam?s Benk? + // Further modified by Tom Hyer + + #include + #include + #include + #include + #include + #include + #include + + using namespace std; + + template + struct moments { + public: + template + moments(InputIterator begin, InputIterator end) + : median(0.0), mean(0.0), average_deviation(0.0), + standard_deviation(0.0), variance(0.0), + skew(0.0), kurtosis(0.0) + { + T sum = accumulate(begin, end, 0.0); + size_t N = end - begin; + mean = sum / N; + for (InputIterator i = begin; i != end; ++i) { + T deviation = *i - mean; + average_deviation += fabs(deviation); + T temp = deviation * deviation; + variance += temp; + temp *= deviation; + skew += temp; + kurtosis += temp * deviation; + } + average_deviation /= N; + variance /= (N - 1); + standard_deviation = sqrt(variance); + + if (variance) { + skew /= (N * variance * standard_deviation); + kurtosis = kurtosis/(N * variance * variance) - 3.0; + } + + InputIterator mid = begin+N/2; + nth_element(begin, mid, end); + if (N % 2 == 0) { + InputIterator next_biggest = max_element(begin, + mid); + median = (*mid+*next_biggest)/2; + } + else + median = *mid; + } + + T median; + T mean; + T average_deviation; + T standard_deviation; + T variance; + T skew; + T kurtosis; + }; + + int main() { + vector v; + double d; + + while (scanf(" %lf", &d) == 1) v.push_back(d); + moments m(v.begin(), v.end()); + + printf("n: %d\n", v.end() - v.begin()); + printf("median: %f\n", m.median); + printf("mean: %f\n", m.mean); + printf("average_deviation: %f\n", m.average_deviation); + printf("standard_deviation: %f\n", m.standard_deviation); + printf("variance: %f\n", m.variance); + printf("skew: %f\n", m.skew); + printf("kurtosis: %f\n", m.kurtosis); + + return 0; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/nestedloop.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/nestedloop.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/nestedloop.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,24 ---- + // -*- mode: c++ -*- + // $Id: nestedloop.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + + using namespace std; + + int main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + int a, b, c, d, e, f, x=0; + + for (a=0; a + #include + + using namespace std; + + class Toggle { + public: + Toggle(bool start_state) : state(start_state) { } + virtual ~Toggle() { } + bool value() { + return(state); + } + virtual Toggle& activate() { + state = !state; + return(*this); + } + bool state; + }; + + class NthToggle : public Toggle { + public: + NthToggle(bool start_state, int max_counter) : + Toggle(start_state), count_max(max_counter), counter(0) { + } + Toggle& activate() { + if (++this->counter >= this->count_max) { + state = !state; + counter = 0; + } + return(*this); + } + private: + int count_max; + int counter; + }; + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + + Toggle *toggle1 = new Toggle(true); + for (int i=0; i<5; i++) { + cout << ((toggle1->activate().value()) ? "true" : "false") << endl; + } + delete toggle1; + for (int i=0; iactivate().value()) ? "true" : "false") << endl; + } + delete ntoggle1; + for (int i=0; i + #include + #include + #include + #include + #include + #include + #include + #include + + using namespace std; + + pthread_mutex_t mutex; + pthread_cond_t control; + void producer(int *arg); + void consumer(int *arg); + int pcount, data, consumed, produced; + + + int + main(int argc, char *argv[]) { + int n = ((argc == 2) ? atoi(argv[1]) : 1); + pthread_t t1, t2; + + pcount = data = consumed = produced = 0; + + if (pthread_mutex_init(&mutex, NULL)) { + perror("pthread_mutex_init"); + exit(1); + } + if (pthread_cond_init(&control, NULL)) { + perror("pthread_cond_init"); + exit(1); + } + if (pthread_create(&t1, (pthread_attr_t *)NULL, + (void * (*)(void *))producer, (void *)&n)) { + perror("pthread_create"); + exit(1); + } + if (pthread_create(&t2, (pthread_attr_t *)NULL, + (void * (*)(void *))consumer, (void *)&n)) { + perror("pthread_create"); + exit(1); + } + + pthread_join(t1, NULL); + pthread_join(t2, NULL); + cout << produced << " " << consumed << endl; + return(0); + } + + + void producer(int *arg) { + int i, n = *arg; + for (i=1; i<=n; i++) { + pthread_mutex_lock(&mutex); + while (pcount == 1) { + pthread_cond_wait(&control, &mutex); + } + data = i; + pcount = 1; + pthread_cond_signal(&control); + pthread_mutex_unlock(&mutex); + produced++; + } + } + + + void consumer(int *arg) { + int i = 0, n = *arg; + while (1) { + pthread_mutex_lock(&mutex); + while (pcount == 0) { + pthread_cond_wait(&control, &mutex); + } + i = data; + pcount = 0; + pthread_cond_signal(&control); + pthread_mutex_unlock(&mutex); + consumed++; + if (i == n) return; + } + } + Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/random.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/random.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/random.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,33 ---- + // -*- mode: c++ -*- + // $Id: random.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + + #include + #include + #include + + using namespace std; + + #define IM 139968 + #define IA 3877 + #define IC 29573 + + inline double gen_random(double max) { + static long last = 42; + last = (last * IA + IC) % IM; + return( max * last / IM ); + } + + int main(int argc, char *argv[]) { + int N = ((argc == 2) ? atoi(argv[1]) : 1); + double result = 0; + + while (N--) { + result = gen_random(100.0); + } + cout.precision(9); + cout.setf(ios::fixed); + cout << result << endl; + return(0); + } + Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sieve.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sieve.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sieve.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,44 ---- + #include + #include + #include + #include + + using namespace std; + + void sieve(list& unknown, vector& primes) + { + while (!unknown.empty()) + { + int p = unknown.front(); + unknown.pop_front(); + list::iterator i = unknown.begin(); + while (i != unknown.end()) + { + if (*i % p) + ++i; + else + i = unknown.erase(i); + } + primes.push_back(p); + } + } + + int main(int argc, char *argv[]) + { + size_t NUM = (argc == 2 ? (atoi(argv[1]) < 1 ? 1 : atoi(argv[1])): + 1); + + vector primes; + + // run the sieve repeatedly + while (NUM--) { + list integers; + for (int i = 2; i < 8192; ++i) + integers.push_back(i); + primes.clear(); + sieve(integers, primes); + } + + cout << "Count: " << primes.size() << endl; + return 0; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/strcat.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/strcat.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/strcat.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,29 ---- + // -*- mode: c++ -*- + // $Id: strcat.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // with help from PeterB + + #include + #include + using namespace std; + + int main(int argc, char *argv[]) + { + int i, n = ((argc == 2) ? atoi(argv[1]) : 1); + string str; + size_t capacity = 31; + str.reserve(capacity); // as per C-string + size_t newLength = 6; + for (i = 0; i < n; i++) + { + if(newLength > capacity) + { + capacity *= 2; + str.reserve(capacity); + } + str += "hello\n"; + newLength += 6; + } + cout << str.length() << endl; + return 0; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sumcol.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sumcol.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/sumcol.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,25 ---- + // -*- mode: c++ -*- + // $Id: sumcol.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // with help from Waldek Hebisch + + #include + #include + #include + #include + + using namespace std; + + #define MAXLINELEN 128 + + int main(int argc, char * * argv) { + char line[MAXLINELEN]; + int sum = 0; + char buff[4096]; + cin.rdbuf()->pubsetbuf(buff, 4096); // enable buffering + + while (cin.getline(line, MAXLINELEN)) { + sum += atoi(line); + } + cout << sum << '\n'; + } Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wc.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wc.cpp:1.1 *** /dev/null Mon Oct 6 20:12:13 2003 --- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/wc.cpp Mon Oct 6 20:11:33 2003 *************** *** 0 **** --- 1,40 ---- + // -*- mode: c++ -*- + // $Id: wc.cpp,v 1.1 2003/10/07 01:11:33 lattner Exp $ + // http://www.bagley.org/~doug/shootout/ + // with help from Tom Widmer + + #include + #include + + using namespace std; + + enum { + OUT, /* outside a word */ + IN /* inside a word */ + }; + + int + main(int argc, char *argv[]) { + char c; + int nl, nw, nc, state; + char buff[4096]; + cin.rdbuf()->pubsetbuf(buff, 4096); // enable buffering + + state = OUT; + nl = nw = nc = 0; + int intc; + streambuf* sbuf = cin.rdbuf(); + while ((intc = sbuf->sbumpc()) != EOF) { + c = (char)intc; + ++nc; + if (c == '\n') + ++nl; + if (c == ' ' || c == '\n' || c == '\t') + state = OUT; + else if (state == OUT) { + state = IN; + ++nw; + } + } + cout << nl << " " << nw << " " << nc << endl; + } From lattner at cs.uiuc.edu Mon Oct 6 20:14:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 20:14:00 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310070113.UAA28110@apoc.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.47 -> 1.48 --- Log message: Don't count the --- 1,72 --- type lines --- Diffs of the changes: (+2 -2) Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.47 CVSROOT/commit-diffs.pl:1.48 --- CVSROOT/commit-diffs.pl:1.47 Mon Oct 6 19:56:56 2003 +++ CVSROOT/commit-diffs.pl Mon Oct 6 20:13:16 2003 @@ -124,7 +124,7 @@ my $pluses = 0; my $minuses = 0; foreach my $line (split /\n/, $diffs) { - $pluses++ if $line =~ /^\+/; $minuses++ if $line =~ /^\-/; + $pluses++ if $line =~ /^\+ /; $minuses++ if $line =~ /^\- /; } $msg .= "\n---\nDiffs of the changes: (+$pluses -$minuses)\n\n" . $diffs; From lattner at cs.uiuc.edu Mon Oct 6 21:59:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 21:59:00 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-10-06-NegateExprType.c Message-ID: <200310070258.VAA29933@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-10-06-NegateExprType.c added (r1.1) --- Log message: new testcase, distilled by Brian --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/CFrontend/2003-10-06-NegateExprType.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-10-06-NegateExprType.c:1.1 *** /dev/null Mon Oct 6 21:58:01 2003 --- llvm/test/Regression/CFrontend/2003-10-06-NegateExprType.c Mon Oct 6 21:57:51 2003 *************** *** 0 **** --- 1,6 ---- + + extern int A[10]; + void Func(int *B) { + B - &A[5]; + } + From gaeke at cs.uiuc.edu Mon Oct 6 22:57:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Mon Oct 6 22:57:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310070356.WAA29540@psmith.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.32 -> 1.33 --- Log message: Check for functions: strtoq, strtoll. --- Diffs of the changes: (+0 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.32 llvm/autoconf/configure.ac:1.33 --- llvm/autoconf/configure.ac:1.32 Sun Oct 5 21:09:25 2003 +++ llvm/autoconf/configure.ac Mon Oct 6 22:56:29 2003 @@ -480,7 +480,7 @@ fi AC_HEADER_MMAP_ANONYMOUS AC_TYPE_SIGNAL -AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol) +AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll) dnl dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED From lattner at cs.uiuc.edu Mon Oct 6 23:04:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 6 23:04:01 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310070403.XAA31244@apoc.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.48 -> 1.49 --- Log message: Ok, not all lines start with '+ ' or '- ', arg. Now, just filter out "+++ " and "--- " explicitly --- Diffs of the changes: (+6 -1) Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.48 CVSROOT/commit-diffs.pl:1.49 --- CVSROOT/commit-diffs.pl:1.48 Mon Oct 6 20:13:16 2003 +++ CVSROOT/commit-diffs.pl Mon Oct 6 23:02:50 2003 @@ -124,7 +124,12 @@ my $pluses = 0; my $minuses = 0; foreach my $line (split /\n/, $diffs) { - $pluses++ if $line =~ /^\+ /; $minuses++ if $line =~ /^\- /; + if (!$line =~ /^\+\+\+ /) { + if (!$line =~ /^\-\-\- /) { + $pluses++ if $line =~ /^\+/; + $minuses++ if $line =~ /^\-/; + } + } } $msg .= "\n---\nDiffs of the changes: (+$pluses -$minuses)\n\n" . $diffs; From gaeke at cs.uiuc.edu Tue Oct 7 00:04:14 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 00:04:14 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310070503.AAA29747@psmith.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.33 -> 1.34 --- Log message: Don't abort if dlopen cannot be found; it's not like it's going to break everything. --- Diffs of the changes: (+0 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.33 llvm/autoconf/configure.ac:1.34 --- llvm/autoconf/configure.ac:1.33 Mon Oct 6 22:56:29 2003 +++ llvm/autoconf/configure.ac Tue Oct 7 00:03:36 2003 @@ -405,8 +405,8 @@ dnl libelf is for sparc only; we can ignore it if we don't have it AC_CHECK_LIB(elf, elf_begin) -dnl dlopen() is required. If we don't find it, quit. -AC_SEARCH_LIBS(dlopen,dl,,AC_MSG_ERROR([dlopen() required but not found])) +dnl dlopen() is required for plugin support. +AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1]),AC_MSG_WARN([dlopen() not found - disabling plugin support])) dnl mallinfo is optional; the code can compile (minus features) without it AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1])) From gaeke at cs.uiuc.edu Tue Oct 7 01:02:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 01:02:01 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200310070601.BAA30034@psmith.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.40 -> 1.41 --- Log message: regenerated using autoconf-2.57. --- Diffs of the changes: (+0 -0) Index: llvm/configure diff -u llvm/configure:1.40 llvm/configure:1.41 --- llvm/configure:1.40 Sun Oct 5 21:13:00 2003 +++ llvm/configure Tue Oct 7 01:01:34 2003 @@ -1605,6 +1605,9 @@ ac_config_commands="$ac_config_commands lib/ExecutionEngine/JIT/Makefile" + ac_config_commands="$ac_config_commands lib/Support/Makefile" + + ac_config_commands="$ac_config_commands lib/Target/Makefile" @@ -2019,6 +2022,18 @@ ac_config_commands="$ac_config_commands tools/opt/Makefile" + ac_config_commands="$ac_config_commands utils/Makefile" + + + ac_config_commands="$ac_config_commands utils/Burg/Makefile" + + + ac_config_commands="$ac_config_commands utils/Burg/Doc/Makefile" + + + ac_config_commands="$ac_config_commands utils/TableGen/Makefile" + + ac_config_commands="$ac_config_commands www/docs/Makefile" @@ -2058,21 +2073,6 @@ ac_config_commands="$ac_config_commands projects/ModuleMaker/tools/ModuleMaker/Makefile" - ac_config_commands="$ac_config_commands lib/Support/Makefile" - - - ac_config_commands="$ac_config_commands utils/Makefile" - - - ac_config_commands="$ac_config_commands utils/Burg/Makefile" - - - ac_config_commands="$ac_config_commands utils/Burg/Doc/Makefile" - - - ac_config_commands="$ac_config_commands utils/TableGen/Makefile" - - # Find a good install program. We prefer a C program (faster), @@ -4420,7 +4420,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4429 "configure"' > conftest.$ac_ext + echo '#line 4423 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5261,7 +5261,7 @@ # Provide some information about the compiler. -echo "$as_me:5270:" \ +echo "$as_me:5264:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6270,11 +6270,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6279: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6273: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6283: \$? = $ac_status" >&5 + echo "$as_me:6277: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6502,11 +6502,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6511: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6505: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6515: \$? = $ac_status" >&5 + echo "$as_me:6509: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6569,11 +6569,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6578: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6572: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6582: \$? = $ac_status" >&5 + echo "$as_me:6576: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8581,7 +8581,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10818: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10828: \$? = $ac_status" >&5 + echo "$as_me:10822: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10882,11 +10882,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10891: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10885: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10895: \$? = $ac_status" >&5 + echo "$as_me:10889: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12125,7 +12125,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13048: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13058: \$? = $ac_status" >&5 + echo "$as_me:13052: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13112,11 +13112,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13121: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13115: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13125: \$? = $ac_status" >&5 + echo "$as_me:13119: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15056,11 +15056,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15065: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15059: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15069: \$? = $ac_status" >&5 + echo "$as_me:15063: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15288,11 +15288,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15297: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15291: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15301: \$? = $ac_status" >&5 + echo "$as_me:15295: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15355,11 +15355,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15364: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15358: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15368: \$? = $ac_status" >&5 + echo "$as_me:15362: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17367,7 +17367,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 if test "$ac_cv_search_dlopen" != no; then test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS" + cat >>confdefs.h <<\_ACEOF +#define HAVE_DLOPEN 1 +_ACEOF else - { { echo "$as_me:$LINENO: error: dlopen() required but not found" >&5 -echo "$as_me: error: dlopen() required but not found" >&2;} - { (exit 1); exit 1; }; } + { echo "$as_me:$LINENO: WARNING: dlopen() not found - disabling plugin support" >&5 +echo "$as_me: WARNING: dlopen() not found - disabling plugin support" >&2;} fi @@ -22420,7 +22422,9 @@ -for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol + + +for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23374,6 +23378,7 @@ ${srcdir}/autoconf/mkinstalldirs `dirname lib/ExecutionEngine/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname lib/ExecutionEngine/Interpreter/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname lib/ExecutionEngine/JIT/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname lib/Support/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname lib/Target/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname lib/Target/Sparc/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname lib/Target/X86/Makefile` @@ -23512,6 +23517,10 @@ ${srcdir}/autoconf/mkinstalldirs `dirname tools/llvm-dis/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname tools/llvm-link/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname tools/opt/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname utils/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Doc/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname utils/TableGen/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname www/docs/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/sample/Makefile` @@ -23525,11 +23534,6 @@ ${srcdir}/autoconf/mkinstalldirs `dirname projects/ModuleMaker/Makefile.common` ${srcdir}/autoconf/mkinstalldirs `dirname projects/ModuleMaker/tools/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/ModuleMaker/tools/ModuleMaker/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Support/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname utils/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Doc/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname utils/TableGen/Makefile` _ACEOF @@ -23563,6 +23567,7 @@ "lib/ExecutionEngine/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/ExecutionEngine/Makefile" ;; "lib/ExecutionEngine/Interpreter/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/ExecutionEngine/Interpreter/Makefile" ;; "lib/ExecutionEngine/JIT/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/ExecutionEngine/JIT/Makefile" ;; + "lib/Support/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Support/Makefile" ;; "lib/Target/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Target/Makefile" ;; "lib/Target/Sparc/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Target/Sparc/Makefile" ;; "lib/Target/X86/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Target/X86/Makefile" ;; @@ -23701,6 +23706,10 @@ "tools/llvm-dis/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/llvm-dis/Makefile" ;; "tools/llvm-link/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/llvm-link/Makefile" ;; "tools/opt/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tools/opt/Makefile" ;; + "utils/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Makefile" ;; + "utils/Burg/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Makefile" ;; + "utils/Burg/Doc/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Doc/Makefile" ;; + "utils/TableGen/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/TableGen/Makefile" ;; "www/docs/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS www/docs/Makefile" ;; "projects/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/Makefile" ;; "projects/sample/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/sample/Makefile" ;; @@ -23714,11 +23723,6 @@ "projects/ModuleMaker/Makefile.common" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/ModuleMaker/Makefile.common" ;; "projects/ModuleMaker/tools/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/ModuleMaker/tools/Makefile" ;; "projects/ModuleMaker/tools/ModuleMaker/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/ModuleMaker/tools/ModuleMaker/Makefile" ;; - "lib/Support/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Support/Makefile" ;; - "utils/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Makefile" ;; - "utils/Burg/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Makefile" ;; - "utils/Burg/Doc/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Doc/Makefile" ;; - "utils/TableGen/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/TableGen/Makefile" ;; "include/Config/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/Config/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -24383,6 +24387,7 @@ lib/ExecutionEngine/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/ExecutionEngine/Makefile lib/ExecutionEngine/Makefile ;; lib/ExecutionEngine/Interpreter/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/ExecutionEngine/Interpreter/Makefile lib/ExecutionEngine/Interpreter/Makefile ;; lib/ExecutionEngine/JIT/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/ExecutionEngine/JIT/Makefile lib/ExecutionEngine/JIT/Makefile ;; + lib/Support/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Support/Makefile lib/Support/Makefile ;; lib/Target/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Target/Makefile lib/Target/Makefile ;; lib/Target/Sparc/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Target/Sparc/Makefile lib/Target/Sparc/Makefile ;; lib/Target/X86/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Target/X86/Makefile lib/Target/X86/Makefile ;; @@ -24521,6 +24526,10 @@ tools/llvm-dis/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/llvm-dis/Makefile tools/llvm-dis/Makefile ;; tools/llvm-link/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/llvm-link/Makefile tools/llvm-link/Makefile ;; tools/opt/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/tools/opt/Makefile tools/opt/Makefile ;; + utils/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; + utils/Burg/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Makefile utils/Burg/Makefile ;; + utils/Burg/Doc/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Doc/Makefile utils/Burg/Doc/Makefile ;; + utils/TableGen/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/TableGen/Makefile utils/TableGen/Makefile ;; www/docs/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/www/docs/Makefile www/docs/Makefile ;; projects/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; projects/sample/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/sample/Makefile projects/sample/Makefile ;; @@ -24534,11 +24543,6 @@ projects/ModuleMaker/Makefile.common ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/ModuleMaker/Makefile.common projects/ModuleMaker/Makefile.common ;; projects/ModuleMaker/tools/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/ModuleMaker/tools/Makefile projects/ModuleMaker/tools/Makefile ;; projects/ModuleMaker/tools/ModuleMaker/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/ModuleMaker/tools/ModuleMaker/Makefile projects/ModuleMaker/tools/ModuleMaker/Makefile ;; - lib/Support/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Support/Makefile lib/Support/Makefile ;; - utils/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; - utils/Burg/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Makefile utils/Burg/Makefile ;; - utils/Burg/Doc/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Doc/Makefile utils/Burg/Doc/Makefile ;; - utils/TableGen/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/TableGen/Makefile utils/TableGen/Makefile ;; esac done _ACEOF From dhurjati at cs.uiuc.edu Tue Oct 7 08:05:03 2003 From: dhurjati at cs.uiuc.edu (Dinakar Dhurjati) Date: Tue Oct 7 08:05:03 2003 Subject: [llvm-commits] CVS: poolalloc/include/poolalloc/PoolAllocate.h Message-ID: <200310071304.IAA28074@apoc.cs.uiuc.edu> Changes in directory poolalloc/include/poolalloc: PoolAllocate.h updated: 1.6 -> 1.7 --- Log message: Added a map from pooldescriptor to the type of the objects stored in that pool. useful for cyclone --- Diffs of the changes: (+0 -0) Index: poolalloc/include/poolalloc/PoolAllocate.h diff -u poolalloc/include/poolalloc/PoolAllocate.h:1.6 poolalloc/include/poolalloc/PoolAllocate.h:1.7 --- poolalloc/include/poolalloc/PoolAllocate.h:1.6 Wed Aug 6 23:37:52 2003 +++ poolalloc/include/poolalloc/PoolAllocate.h Tue Oct 7 08:04:00 2003 @@ -13,11 +13,16 @@ #include "llvm/Pass.h" #include "Support/hash_set" #include "Support/EquivalenceClasses.h" +#include "llvm/DerivedTypes.h" +#include "Support/VectorExtras.h" +#include "llvm/Function.h" + class BUDataStructures; class TDDataStructures; class DSNode; class DSGraph; class CallInst; +class Type; namespace PA { /// FuncInfo - Represent the pool allocation information for one function in @@ -57,6 +62,10 @@ /// indirect function calls that are not used in the function. std::map PoolDescriptors; + // Dinakar : Added map from alloca of poolinit or argument to the + // corresponding type, the type of Value * is that of pooldescriptor + std::map PoolDescType; + /// NewToOldValueMap - When and if a function needs to be cloned, this map /// contains a mapping from all of the values in the new function back to /// the values they correspond to in the old function. @@ -65,6 +74,8 @@ }; } + + /// PoolAllocate - The main pool allocation pass /// class PoolAllocate : public Pass { @@ -85,6 +96,7 @@ void printFuncECs(); public: + Function *PoolInit, *PoolDestroy, *PoolAlloc, *PoolAllocArray, *PoolFree; // Equivalence class where functions that can potentially be called via @@ -113,6 +125,26 @@ BUDataStructures &getBUDataStructures() const { return *BU; } + //Dinakar to get function info for all (cloned functions) + PA::FuncInfo *getFunctionInfo(Function *F) { + //If it is cloned or not check it out + if (FunctionInfo.count(F) > 0) + return &FunctionInfo[F]; + else { + //Probably cloned + std::map::iterator fI = FunctionInfo.begin(), + fE = FunctionInfo.end(); + for (; fI != fE; ++fI) { + if (fI->second.Clone == F) { + return &(fI->second); + } + } + std::cerr << F->getName() << " for the function \n"; + // assert(1 != 1 && "Still cant find it"); + return 0; + } + } + PA::FuncInfo *getFuncInfo(Function &F) { std::map::iterator I = FunctionInfo.find(&F); return I != FunctionInfo.end() ? &I->second : 0; @@ -144,7 +176,8 @@ /// the PoolDescriptors map for each DSNode. /// void CreatePools(Function &F, const std::vector &NodesToPA, - std::map &PoolDescriptors); + std::map &PoolDescriptors, + std::map &PoolDescTypeMap); void TransformFunctionBody(Function &F, Function &OldF, DSGraph &G, PA::FuncInfo &FI); From dhurjati at cs.uiuc.edu Tue Oct 7 08:08:05 2003 From: dhurjati at cs.uiuc.edu (Dinakar Dhurjati) Date: Tue Oct 7 08:08:05 2003 Subject: [llvm-commits] CVS: poolalloc/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200310071307.IAA28185@apoc.cs.uiuc.edu> Changes in directory poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.22 -> 1.23 --- Log message: Added a map from pooldescriptors to the type of objects in the pool Useful for cyclone backend. --- Diffs of the changes: (+0 -0) Index: poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.22 poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.23 --- poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.22 Sat Sep 20 14:10:11 2003 +++ poolalloc/lib/PoolAllocate/PoolAllocate.cpp Tue Oct 7 08:07:25 2003 @@ -126,6 +126,7 @@ } bool PoolAllocate::run(Module &M) { + if (M.begin() == M.end()) return false; CurModule = &M; BU = &getAnalysis(); @@ -437,6 +438,8 @@ // Set the rest of the new arguments names to be PDa and add entries to the // pool descriptors map std::map &PoolDescriptors = FI.PoolDescriptors; + //Dinakar set the type of pooldesctriptors + std::map &PoolDescTypeMap = FI.PoolDescType; Function::aiterator NI = New->abegin(); if (FuncECs.findClass(&F)) { @@ -450,9 +453,11 @@ for (int i = 0; i < FI.PoolArgFirst; ++NI, ++i) ; - for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) + for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) { + PoolDescTypeMap[NI] = FI.ArgNodes[i]->getType(); + PoolDescriptors.insert(std::make_pair(FI.ArgNodes[i], NI)); - + } NI = New->abegin(); if (EqClass2LastPoolArg.count(FuncECs.findClass(&F))) for (int i = 0; i <= EqClass2LastPoolArg[FuncECs.findClass(&F)]; ++i,++NI) @@ -462,6 +467,7 @@ if (FI.ArgNodes.size()) for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) { NI->setName("PDa"); // Add pd entry + PoolDescTypeMap[NI] = FI.ArgNodes[i]->getType(); PoolDescriptors.insert(std::make_pair(FI.ArgNodes[i], NI)); } NI = New->abegin(); @@ -525,7 +531,8 @@ if (!NodesToPA.empty()) { // Create pool construction/destruction code std::map &PoolDescriptors = FI.PoolDescriptors; - CreatePools(NewF, NodesToPA, PoolDescriptors); + std::map &PoolDescTypeMap = FI.PoolDescType; + CreatePools(NewF, NodesToPA, PoolDescriptors, PoolDescTypeMap); } // Transform the body of the function now... @@ -539,7 +546,8 @@ // void PoolAllocate::CreatePools(Function &F, const std::vector &NodesToPA, - std::map &PoolDescriptors) { + std::map &PoolDescriptors, + std::map &PoolDescTypeMap) { // Find all of the return nodes in the CFG... std::vector ReturnNodes; for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) @@ -558,12 +566,14 @@ // Create a new alloca instruction for the pool... Value *AI = new AllocaInst(PoolDescType, 0, "PD", InsertPoint); - + const Type *Eltype; Value *ElSize; // Void types in DS graph are never used - if (Node->getType() != Type::VoidTy) + if (Node->getType() != Type::VoidTy) { ElSize = ConstantUInt::get(Type::UIntTy, TD.getTypeSize(Node->getType())); + Eltype = Node->getType(); + } else { DEBUG(std::cerr << "Potential node collapsing in " << F.getName() << ". All Data Structures may not be pool allocated\n"); @@ -576,6 +586,7 @@ // Update the PoolDescriptors map PoolDescriptors.insert(std::make_pair(Node, AI)); + PoolDescTypeMap[AI] = Eltype; // Insert a call to pool destroy before each return inst in the function for (unsigned r = 0, e = ReturnNodes.size(); r != e; ++r) @@ -834,7 +845,23 @@ else V = new CallInst(PAInfo.PoolAlloc, make_vector(PH, 0), MI.getName(), &MI); - + + //Added by Dinakar to store the type + // std::cout << " In pool allocation for instruction \n"; + // std::cout << MI << "\n"; + // std::cout << MI.getType() << "\n"; + const Type *phtype = 0; + if (const PointerType * ptype = dyn_cast(MI.getType())) { + phtype = ptype->getElementType(); + } + assert((phtype != 0) && "Needs to be implemented \n "); + std::map &PoolDescType = FI.PoolDescType; + if (PoolDescType.count(PH)) { + //There is already an entry, so this is just sanity check + assert((phtype == PoolDescType[PH]) && "pool allocate type info wrong"); + } else { + PoolDescType[PH] = phtype; + } MI.setName(""); // Nuke MIs name Value *Casted = V; @@ -875,6 +902,21 @@ Value *Arg = FrI.getOperand(0); Value *PH = getPoolHandle(Arg); // Get the pool handle for this DSNode... if (PH == 0) return; + + const Type *phtype = 0; + if (const PointerType * ptype = dyn_cast(Arg->getType())) { + phtype = ptype->getElementType(); + } + assert((phtype != 0) && "Needs to be implemented \n "); + std::map &PoolDescType = FI.PoolDescType; + if (PoolDescType.count(PH)) { + //There is already an entry, so this is just sanity check + assert((phtype == PoolDescType[PH]) && "pool allocate type info wrong"); + } else { + PoolDescType[PH] = phtype; + } + + // Insert a cast and a call to poolfree... Value *Casted = Arg; if (Arg->getType() != PointerType::get(Type::SByteTy)) From lattner at cs.uiuc.edu Tue Oct 7 08:47:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 08:47:05 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExecutionDriver.cpp Message-ID: <200310071346.IAA08403@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExecutionDriver.cpp updated: 1.21 -> 1.22 --- Log message: This header file moved. Thanks to Bill and Nightly tester for noticing --- Diffs of the changes: (+0 -0) Index: llvm/tools/bugpoint/ExecutionDriver.cpp diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.21 llvm/tools/bugpoint/ExecutionDriver.cpp:1.22 --- llvm/tools/bugpoint/ExecutionDriver.cpp:1.21 Mon Sep 29 17:40:52 2003 +++ llvm/tools/bugpoint/ExecutionDriver.cpp Tue Oct 7 08:45:51 2003 @@ -15,11 +15,11 @@ */ #include "BugDriver.h" -#include "Support/ToolRunner.h" #include "Support/CommandLine.h" #include "Support/Debug.h" #include "Support/FileUtilities.h" #include "Support/SystemUtils.h" +#include "llvm/Support/ToolRunner.h" #include #include From criswell at cs.uiuc.edu Tue Oct 7 09:17:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 09:17:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200310071416.JAA23225@choi.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.142 -> 1.143 --- Log message: Added targets that force users to re-run autoconf when the script has been updated. --- Diffs of the changes: (+0 -0) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.142 llvm/Makefile.rules:1.143 --- llvm/Makefile.rules:1.142 Thu Oct 2 14:02:02 2003 +++ llvm/Makefile.rules Tue Oct 7 09:16:44 2003 @@ -58,6 +58,9 @@ # building. ########################################################################### +# Ensure people re-run configure when it gets updated +all::$(LLVM_OBJ_ROOT)/include/Config/config.h + ifdef SHARED_LIBRARY # if SHARED_LIBRARY is specified, the default is to build the dynamic lib all:: dynamic @@ -773,6 +776,14 @@ # Create dependencies for the *.c files... $(BUILD_OBJ_DIR)/Depend/%.d: %.c $(BUILD_OBJ_DIR)/Depend/.dir $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@ + +# +# Autoconf Dependencies. +# +$(LLVM_OBJ_ROOT)/include/Config/config.h:: $(LLVM_SRC_ROOT)/configure + @${ECHO} "You need to re-run $(LLVM_SRC_ROOT)/configure" + @${ECHO} "inside the directory $(LLVM_OBJ_ROOT)" + $(VERB) exit 1 # # Include dependencies generated from C/C++ source files, but not if we From lattner at cs.uiuc.edu Tue Oct 7 10:03:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 10:03:02 2003 Subject: [llvm-commits] CVS: CVSROOT/commit-diffs.pl Message-ID: <200310071502.KAA13835@apoc.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.49 -> 1.50 --- Log message: Try again --- Diffs of the changes: (+0 -0) Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.49 CVSROOT/commit-diffs.pl:1.50 --- CVSROOT/commit-diffs.pl:1.49 Mon Oct 6 23:02:50 2003 +++ CVSROOT/commit-diffs.pl Tue Oct 7 10:02:24 2003 @@ -124,8 +124,8 @@ my $pluses = 0; my $minuses = 0; foreach my $line (split /\n/, $diffs) { - if (!$line =~ /^\+\+\+ /) { - if (!$line =~ /^\-\-\- /) { + if ($line !~ /^\+\+\+ /) { + if ($line !~ /^\-\-\- /) { $pluses++ if $line =~ /^\+/; $minuses++ if $line =~ /^\-/; } From lattner at cs.uiuc.edu Tue Oct 7 10:18:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 10:18:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200310071517.KAA14514@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.125 -> 1.126 --- Log message: Fix bug in previous checkin --- Diffs of the changes: (+1 -0) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.125 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.126 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.125 Mon Oct 6 12:11:01 2003 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 7 10:17:02 2003 @@ -1960,6 +1960,7 @@ ++NumConstProp; I->getParent()->getInstList().erase(I); + removeFromWorkList(I); continue; } From brukman at cs.uiuc.edu Tue Oct 7 10:25:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue Oct 7 10:25:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200310071524.KAA20496@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.143 -> 1.144 --- Log message: Depend on config.status instead of config.h, because config.h timestamp may not change even though configure changes. --- Diffs of the changes: (+2 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.143 llvm/Makefile.rules:1.144 --- llvm/Makefile.rules:1.143 Tue Oct 7 09:16:44 2003 +++ llvm/Makefile.rules Tue Oct 7 10:24:23 2003 @@ -59,7 +59,7 @@ ########################################################################### # Ensure people re-run configure when it gets updated -all::$(LLVM_OBJ_ROOT)/include/Config/config.h +all::$(LLVM_OBJ_ROOT)/config.status ifdef SHARED_LIBRARY # if SHARED_LIBRARY is specified, the default is to build the dynamic lib @@ -780,7 +780,7 @@ # # Autoconf Dependencies. # -$(LLVM_OBJ_ROOT)/include/Config/config.h:: $(LLVM_SRC_ROOT)/configure +$(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure @${ECHO} "You need to re-run $(LLVM_SRC_ROOT)/configure" @${ECHO} "inside the directory $(LLVM_OBJ_ROOT)" $(VERB) exit 1 From lattner at cs.uiuc.edu Tue Oct 7 11:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 11:34:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/opt.html Message-ID: <200310071633.LAA07360@apoc.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: opt.html updated: 1.4 -> 1.5 --- Log message: remove options specific to the -internalize pass, add the -debug option --- Diffs of the changes: (+9 -0) Index: llvm/www/docs/CommandGuide/opt.html diff -u llvm/www/docs/CommandGuide/opt.html:1.4 llvm/www/docs/CommandGuide/opt.html:1.5 --- llvm/www/docs/CommandGuide/opt.html:1.4 Fri Sep 26 11:32:00 2003 +++ llvm/www/docs/CommandGuide/opt.html Tue Oct 7 11:33:42 2003 @@ -74,6 +74,14 @@ error.

            +

          • -debug +
            + If this is a debug build, this option will enable debug printouts from + passes which use the DEBUG macro. See the Programmer's Manual for more + information. +

            +

          • -q
            From lattner at cs.uiuc.edu Tue Oct 7 11:36:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 11:36:02 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/index.html Message-ID: <200310071635.LAA16786@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: index.html updated: 1.4 -> 1.5 --- Log message: Renamed llvmas.html llvmdis.html and llvmlink.html to have hyphens in them --- Diffs of the changes: (+3 -3) Index: llvm/www/docs/CommandGuide/index.html diff -u llvm/www/docs/CommandGuide/index.html:1.4 llvm/www/docs/CommandGuide/index.html:1.5 --- llvm/www/docs/CommandGuide/index.html:1.4 Fri Oct 3 08:48:27 2003 +++ llvm/www/docs/CommandGuide/index.html Tue Oct 7 11:34:51 2003 @@ -21,12 +21,12 @@
            -
            llvm-as +
            llvm-as
            Assemble a human-readable LLVM program into LLVM bytecode.

            -

            llvm-dis +
            llvm-dis
            Disassemble an LLVM bytecode file into human-readable form.

            @@ -41,7 +41,7 @@ Optimize an LLVM bytecode file.

            -

            llvm-link +
            llvm-link
            Link several LLVM bytecode files together into one LLVM bytecode file. From lattner at cs.uiuc.edu Tue Oct 7 11:37:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 11:37:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/llvm-link.html Message-ID: <200310071636.LAA16934@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: llvm-link.html updated: 1.3 -> 1.4 --- Log message: Wrap at 80 columns remove -time-passes and -stats, because llvm-link doesn't really need them --- Diffs of the changes: (+7 -17) Index: llvm/www/docs/CommandGuide/llvm-link.html diff -u llvm/www/docs/CommandGuide/llvm-link.html:1.3 llvm/www/docs/CommandGuide/llvm-link.html:1.4 --- llvm/www/docs/CommandGuide/llvm-link.html:1.3 Fri Sep 26 11:32:00 2003 +++ llvm/www/docs/CommandGuide/llvm-link.html Tue Oct 7 11:36:25 2003 @@ -44,10 +44,11 @@
            • -L <directory>
              - Add the specified directory to the library search path. When looking for - libraries, llvm-link will look in pathname for libraries. This option can - be specified multiple times; llvm-link will search inside these directories - in the order in which they were specified on the command line. + Add the specified directory to the library search path. When looking + for libraries, llvm-link will look in pathname for libraries. This + option can be specified multiple times; llvm-link will search inside + these directories in the order in which they were specified on the + command line.

            • -f @@ -58,8 +59,8 @@
            • -o <filename>
              - Output filename. If filename is -, then llvm-link will write its output to - standard output. + Output filename. If filename is -, then llvm-link will write its output + to standard output.

            • -d @@ -71,17 +72,6 @@
            • -help
              Print a summary of command line options. -

              - -

            • -stats -
              - Print statistics. -

              - -

            • -time-passes -
              - Record the amount of time needed for each pass and print it to standard - error.

            • -v From gaeke at cs.uiuc.edu Tue Oct 7 12:13:05 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 12:13:05 2003 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200310071712.MAA00636@gally.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.8 -> 1.9 --- Log message: Add target to regenerate top-level "configure" script. --- Diffs of the changes: (+5 -0) Index: llvm/Makefile diff -u llvm/Makefile:1.8 llvm/Makefile:1.9 --- llvm/Makefile:1.8 Sun Oct 5 14:28:27 2003 +++ llvm/Makefile Tue Oct 7 12:12:11 2003 @@ -14,3 +14,8 @@ $(LEVEL)/config.log \ $(LEVEL)/TAGS +AUTOCONF = autoconf + +configure: autoconf/configure.ac + cd autoconf && $(AUTOCONF) -o ../configure configure.ac + From lattner at cs.uiuc.edu Tue Oct 7 13:47:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 13:47:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerSwitch.cpp Message-ID: <200310071846.NAA09195@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LowerSwitch.cpp updated: 1.4 -> 1.5 --- Log message: Bill contributed this major rewrite of the -lowerswitch pass to make it generate logarithmic conditional branch sequences instead of linear sequences. Thanks Bill! --- Diffs of the changes: (+144 -44) Index: llvm/lib/Transforms/Scalar/LowerSwitch.cpp diff -u llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.4 llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.5 --- llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.4 Sat Aug 23 17:54:34 2003 +++ llvm/lib/Transforms/Scalar/LowerSwitch.cpp Tue Oct 7 13:46:23 2003 @@ -7,11 +7,13 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar.h" +#include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/iTerminators.h" #include "llvm/iOperators.h" #include "llvm/iPHINode.h" #include "llvm/Pass.h" +#include "Support/Debug.h" #include "Support/Statistic.h" namespace { @@ -20,9 +22,30 @@ /// LowerSwitch Pass - Replace all SwitchInst instructions with chained branch /// instructions. Note that this cannot be a BasicBlock pass because it /// modifies the CFG! - struct LowerSwitch : public FunctionPass { + class LowerSwitch : public FunctionPass { + public: bool runOnFunction(Function &F); + typedef std::pair Case; + typedef std::vector::iterator CaseItr; + private: void processSwitchInst(SwitchInst *SI); + + BasicBlock* switchConvert(CaseItr Begin, CaseItr End, Value* Val, + BasicBlock* OrigBlock, BasicBlock* Default); + BasicBlock* newLeafBlock(Case& Leaf, Value* Val, + BasicBlock* OrigBlock, BasicBlock* Default); + }; + + /// The comparison function for sorting the switch case values in the vector. + struct CaseCmp { + bool operator () (const LowerSwitch::Case& C1, + const LowerSwitch::Case& C2) { + if (const ConstantUInt* U1 = dyn_cast(C1.first)) + return U1->getValue() < cast(C2.first)->getValue(); + + const ConstantSInt* S1 = dyn_cast(C1.first); + return S1->getValue() < cast(C2.first)->getValue(); + } }; RegisterOpt @@ -49,16 +72,107 @@ return Changed; } +// operator<< - Used for debugging purposes. +// +std::ostream& operator << (std::ostream& O, std::vector& C) +{ + O << "["; + + for (std::vector::iterator B = C.begin(), E = C.end(); + B != E; ) { + O << *B->first; + if (++B != E) O << ", "; + } + + return O << "]"; +} + +// switchConvert - Convert the switch statement into a binary lookup of +// the case values. The function recursively builds this tree. +// +BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End, + Value* Val, BasicBlock* OrigBlock, + BasicBlock* Default) +{ + unsigned Size = End - Begin; + + if (Size == 1) + return newLeafBlock(*Begin, Val, OrigBlock, Default); + + unsigned Mid = Size / 2; + std::vector LHS(Begin, Begin + Mid); + DEBUG(std::cerr << "LHS: " << LHS << "\n"); + std::vector RHS(Begin + Mid, End); + DEBUG(std::cerr << "RHS: " << RHS << "\n"); + + Case& Pivot = *(Begin + Mid); + DEBUG(std::cerr << "Pivot ==> " + << cast(Pivot.first)->getValue() << "\n"); + + BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val, + OrigBlock, Default); + BasicBlock* RBranch = switchConvert(RHS.begin(), RHS.end(), Val, + OrigBlock, Default); + + // Create a new node that checks if the value is < pivot. Go to the + // left branch if it is and right branch if not. + Function* F = OrigBlock->getParent(); + BasicBlock* NewNode = new BasicBlock("NodeBlock"); + F->getBasicBlockList().insert(OrigBlock->getNext(), NewNode); + + SetCondInst* Comp = new SetCondInst(Instruction::SetLT, Val, Pivot.first, + "Pivot"); + NewNode->getInstList().push_back(Comp); + BranchInst* Br = new BranchInst(LBranch, RBranch, Comp); + NewNode->getInstList().push_back(Br); + return NewNode; +} + +// newLeafBlock - Create a new leaf block for the binary lookup tree. It +// checks if the switch's value == the case's value. If not, then it +// jumps to the default branch. At this point in the tree, the value +// can't be another valid case value, so the jump to the "default" branch +// is warranted. +// +BasicBlock* LowerSwitch::newLeafBlock(Case& Leaf, Value* Val, + BasicBlock* OrigBlock, + BasicBlock* Default) +{ + Function* F = OrigBlock->getParent(); + BasicBlock* NewLeaf = new BasicBlock("LeafBlock"); + F->getBasicBlockList().insert(OrigBlock->getNext(), NewLeaf); + + // Make the seteq instruction... + SetCondInst* Comp = new SetCondInst(Instruction::SetEQ, Val, + Leaf.first, "SwitchLeaf"); + NewLeaf->getInstList().push_back(Comp); + + // Make the conditional branch... + BasicBlock* Succ = Leaf.second; + Instruction* Br = new BranchInst(Succ, Default, Comp); + NewLeaf->getInstList().push_back(Br); + + // If there were any PHI nodes in this successor, rewrite one entry + // from OrigBlock to come from NewLeaf. + for (BasicBlock::iterator I = Succ->begin(); + PHINode* PN = dyn_cast(I); ++I) { + int BlockIdx = PN->getBasicBlockIndex(OrigBlock); + assert(BlockIdx != -1 && "Switch didn't go to this successor??"); + PN->setIncomingBlock((unsigned)BlockIdx, NewLeaf); + } + + return NewLeaf; +} + // processSwitchInst - Replace the specified switch instruction with a sequence -// of chained basic blocks. Right now we just insert an incredibly stupid -// linear sequence of branches. It would be better to do a balanced binary -// search eventually. FIXME +// of chained if-then insts in a balanced binary search. // void LowerSwitch::processSwitchInst(SwitchInst *SI) { BasicBlock *CurBlock = SI->getParent(); BasicBlock *OrigBlock = CurBlock; Function *F = CurBlock->getParent(); Value *Val = SI->getOperand(0); // The value we are switching on... + BasicBlock* Default = SI->getDefaultDest(); // Unlink the switch instruction from it's block. CurBlock->getInstList().remove(SI); @@ -70,49 +184,35 @@ return; } - // Expand comparisons for all of the non-default cases... - for (unsigned i = 2, e = SI->getNumOperands(); i != e; i += 2) { - // Insert a new basic block after the current one... - BasicBlock *NextBlock; - if (i != e-2) { - NextBlock = new BasicBlock("switchblock"); - F->getBasicBlockList().insert(CurBlock->getNext(), NextBlock); - } else { // Last case, if it's not the value, go to default block. - NextBlock = cast(SI->getDefaultDest()); - } + // Create a new, empty default block so that the new hierarchy of + // if-then statements go to this and the PHI nodes are happy. + BasicBlock* NewDefault = new BasicBlock("NewDefault"); + F->getBasicBlockList().insert(Default, NewDefault); + + NewDefault->getInstList().push_back(new BranchInst(Default)); + + // If there is an entry in any PHI nodes for the default edge, make sure + // to update them as well. + for (BasicBlock::iterator I = Default->begin(); + PHINode *PN = dyn_cast(I); ++I) { + int BlockIdx = PN->getBasicBlockIndex(OrigBlock); + assert(BlockIdx != -1 && "Switch didn't go to this successor??"); + PN->setIncomingBlock((unsigned)BlockIdx, NewDefault); + } - // Make the seteq instruction... - Instruction *Comp = new SetCondInst(Instruction::SetEQ, Val, - SI->getOperand(i), "switchcase"); - CurBlock->getInstList().push_back(Comp); - - // Make the conditional branch... - BasicBlock *Succ = cast(SI->getOperand(i+1)); - Instruction *Br = new BranchInst(Succ, NextBlock, Comp); - CurBlock->getInstList().push_back(Br); - - // If there were any PHI nodes in this successor, rewrite one entry from - // OrigBlock to come from CurBlock. - for (BasicBlock::iterator I = Succ->begin(); - PHINode *PN = dyn_cast(I); ++I) { - int BlockIdx = PN->getBasicBlockIndex(OrigBlock); - assert(BlockIdx != -1 && "Switch didn't go to this successor??"); - PN->setIncomingBlock((unsigned)BlockIdx, CurBlock); - } + std::vector Cases; - if (i == e-2) { // Is this looking at the default destination? - // If there is an entry in any PHI nodes for the default edge, make sure - // to update them as well. - for (BasicBlock::iterator I = NextBlock->begin(); - PHINode *PN = dyn_cast(I); ++I) { - int BlockIdx = PN->getBasicBlockIndex(OrigBlock); - assert(BlockIdx != -1 && "Switch didn't go to this successor??"); - PN->setIncomingBlock((unsigned)BlockIdx, CurBlock); - } - } + // Expand comparisons for all of the non-default cases... + for (unsigned i = 1; i < SI->getNumSuccessors(); ++i) + Cases.push_back(Case(SI->getSuccessorValue(i), SI->getSuccessor(i))); - CurBlock = NextBlock; // Move on to the next condition - } + std::sort(Cases.begin(), Cases.end(), CaseCmp()); + DEBUG(std::cerr << "Cases: " << Cases << "\n"); + BasicBlock* SwitchBlock = switchConvert(Cases.begin(), Cases.end(), Val, + OrigBlock, NewDefault); + + // Branch to our shiny new if-then stuff... + OrigBlock->getInstList().push_back(new BranchInst(SwitchBlock)); // We are now done with the switch instruction, delete it. delete SI; From criswell at cs.uiuc.edu Tue Oct 7 14:08:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 14:08:01 2003 Subject: [llvm-commits] CVS: llvm/test/Feature/TestAsmDisasm.sh TestOptimizer.sh Message-ID: <200310071907.OAA19215@choi.cs.uiuc.edu> Changes in directory llvm/test/Feature: TestAsmDisasm.sh (r1.11) removed TestOptimizer.sh (r1.18) removed --- Log message: These scripts are no longer needed. They have been replaced by QMTest. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Tue Oct 7 14:13:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 14:13:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200310071912.OAA20010@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.13 -> 1.14 --- Log message: Adjusted tests so that they compile the LLVM assembly code into bytecode, if necessary. Modified some tests so that they use ExecProgram(). Hopefully this will flag failures when programs terminate abnormally. All of the tests now take a pathname relative to llvm. --- Diffs of the changes: (+42 -32) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.13 llvm/test/QMTest/llvm.py:1.14 --- llvm/test/QMTest/llvm.py:1.13 Fri Oct 3 14:21:02 2003 +++ llvm/test/QMTest/llvm.py Tue Oct 7 14:12:32 2003 @@ -133,11 +133,9 @@ # # Use the LLVM assembler to assemble the program. # - cmd = as + ' ' + srcfile + ' -d -f -o ' + bcpath + self.devnull - estatus=os.system (cmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (ExecProgram ((as, srcfile, '-d', '-f', '-o', bcpath))): fail = 1 - result.Fail() + result.Fail('Failed to assemble ' + srcfile) # # Cleanup the bytecode file. @@ -193,22 +191,29 @@ # # Construct the pathname of the source file and object file. # - srcfile=tmpdir + '/' + self.srcfile - objfile=tmpdir + '/' + self.srcfile + '.tc' + srcfile=srcroot + '/' + self.srcfile + bcfile=tmpdir + '/' + os.path.basename (self.srcfile) + objfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.tc' # # Construct the pathnames to the various utilities. # + as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' dis = buildroot + '/tools/' + context['buildtype'] + '/llvm-dis' # # Use the LLVM assembler to assemble the program. # - cmd = dis + ' ' + srcfile + ' -c -o ' + objfile + self.devnull - estatus=os.system (cmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (ExecProgram ((as, srcfile, '-f', '-o', bcfile))): + result.Fail ('Failed to assemble ' + srcfile) + return + + # + # Use the LLVM disassembler to convert the program to C code. + # + if (ExecProgram ((dis, bcfile, '-f', '-c', '-o', objfile))): fail = 1 - result.Fail() + result.Fail ('Failed to convert ' + bcfile + ' to C code.') else: fail = 0 @@ -417,8 +422,8 @@ # arguments = [ qm.fields.TextField(name='srcfile', - title='LLVM Bytecode File', - description='LLVM Bytecode File to Convert to Machine Code'), + title='LLVM Assembly Code File', + description='LLVM Assembly Code File to Convert to Machine Code'), ] devnull = ' > /dev/null 2>&1' @@ -441,20 +446,29 @@ # # Construct the pathname of the source file and object file. # - srcfile=tmpdir + '/' + self.srcfile - objfile=tmpdir + '/' + self.srcfile + '.s' + srcfile=srcroot + '/' + self.srcfile + bcfile=tmpdir + '/feature-' + os.path.basename (self.srcfile) + objfile=tmpdir + '/feature-' + self.srcfile + '.s' # # Construct the pathnames to the various utilities. # + as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' llc = buildroot + '/tools/' + context['buildtype'] + '/llc' # + # Assemble the bytecode file. + # + if (ExecProgram ((as, srcfile, '-f', '-o', bcfile))): + result.Fail ('Failed to assemble ' + srcfile + ' to file ' + bcfile) + return + + # # Use the LLVM assembler to assemble the program. # - exstatus=os.spawnl (os.P_WAIT, llc, llc, srcfile, '-f', '-o=' + objfile) + exstatus=os.spawnl (os.P_WAIT, llc, llc, bcfile, '-f', '-o=' + objfile) if (exstatus != 0): - result.Fail() + result.Fail('Failed to compile ' + bcfile + ' to native asm code.') # # Cleanup the file if it exists. @@ -491,6 +505,11 @@ opt='opt' # + # LLVM Directories + # + tmpdir='' + + # # Method: Run # # Description: @@ -508,6 +527,7 @@ # srcroot=context['srcroot'] buildroot=context['buildroot'] + self.tmpdir = context['tmpdir'] # # Construct the pathname of the source file. @@ -561,14 +581,7 @@ # p=' | ' - # - # Assemble and optimize the given program. Then, disassemble - # it and reassemble it again. - # - # This should provide a bytecode file that cannot be optimized - # any further. - # - estatus = os.system (as + ' < ' + file + p + opt + ' -q -inline -dce ' + flags + p + dis + p + as + ' > bc.1') + estatus = os.system (as + ' < ' + file + p + opt + ' -q -inline -dce ' + flags + p + dis + p + as + ' > ' + 'bc.1') if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): result.Fail() return; @@ -576,7 +589,7 @@ # # Now, attempt to optimize the the program again. # - estatus=os.system (opt + ' -q ' + flags + ' < bc.1 > bc.2') + estatus=os.system (opt + ' -q ' + flags + ' < ' + 'bc.1 > ' + 'bc.2') if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): result.Fail() return @@ -584,6 +597,9 @@ # # If the two programs are identical, then we have failed! # + # This should provide a bytecode file that cannot be optimized + # any further. + # status1 = os.spawnl (os.P_WAIT, dis, dis, 'bc.1', '-f', '-o=ll.1'); status2 = os.spawnl (os.P_WAIT, dis, dis, 'bc.2', '-f', '-o=ll.2'); if ((status1 != 0) or (status2 != 0)): @@ -613,11 +629,6 @@ # disassemble a given LLVM assembly file to ensure that the assembler # and disassembler work properly. # -# Note: -# This class is restricted to running programs in llvm/test/Feature. -# Eventually it will be modified to run them from anywhere within the -# LLVM source tree. -# ############################################################################## class TestAsmDisasm(qm.test.test.Test): @@ -649,7 +660,6 @@ # srcroot=context['srcroot'] buildroot=context['buildroot'] - testdir=srcroot + '/test/Feature' # # Determine the path to the assembler and disassembler @@ -660,7 +670,7 @@ # # Find the name of the file to assemble. # - input=testdir + '/' + self.srcfile + input=srcroot + '/' + self.srcfile # # Construct output filenames. From criswell at cs.uiuc.edu Tue Oct 7 14:15:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 14:15:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvmdb.py Message-ID: <200310071914.OAA20026@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvmdb.py updated: 1.4 -> 1.5 --- Log message: Added the magic to make the Feature tests work. Feature tests now appear as 'Feature.fxx.yyyy' where xx is the test type and yyyy is the name of the test. Removed the opaquetypes test for now. --- Diffs of the changes: (+45 -5) Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.4 llvm/test/QMTest/llvmdb.py:1.5 --- llvm/test/QMTest/llvmdb.py:1.4 Fri Oct 3 16:03:05 2003 +++ llvm/test/QMTest/llvmdb.py Tue Oct 7 14:13:56 2003 @@ -60,11 +60,22 @@ # def GetTest (self, test_id): # + # Determine if this is a feature test. If so, massage the pathname + # a little bit. + # + (headlabel, label) = self.SplitLabelLeft (test_id) + if (headlabel == 'Feature'): + (featuretypelabel, testlabel) = self.SplitLabelLeft (label) + testlabel = headlabel + '.' + testlabel + else: + testlabel = test_id + + # # Try to figure out whether this test exists or not. # exts=['ll', 'llx', 'c', 'cpp', 'td', 'c.tr', 'cpp.tr'] - testpath = self.dbpath + '/' + self.LabelToPath (test_id) + testpath = self.dbpath + '/' + self.LabelToPath (testlabel) for ext in exts: if (os.path.exists (testpath + '.' + ext)): break @@ -74,11 +85,26 @@ # # Construct the pathname of the test relative to the LLVM source tree. # - testpath = 'test/' + self.LabelToPath (test_id) + '.' + ext + testpath = 'test/' + self.LabelToPath (testlabel) + '.' + ext + + # + # If the test is a feature test, create the appropraite test for it. + # + if (headlabel == 'Feature'): + if (featuretypelabel == 'fopt'): + return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestOptimizer', {'srcfile':testpath}) + if (featuretypelabel == 'fasm'): + return qm.test.database.TestDescriptor(self, test_id, 'llvm.AssemblyCodeTest', {'srcfile':testpath}) + if (featuretypelabel == 'fmc'): + return qm.test.database.TestDescriptor(self, test_id, 'llvm.MachineCodeTest', {'srcfile':testpath}) + if (featuretypelabel == 'fcc'): + return qm.test.database.TestDescriptor(self, test_id, 'llvm.ConvertToCTest', {'srcfile':testpath}) + if (featuretypelabel == 'fad'): + return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestAsmDisasm', {'srcfile':testpath}) # # If the file ends in .llx or .tr, then it is a TestRunner (as opposed - # to # HomeStar Runner) test. + # to HomeStar Runner) test. # if ((ext == 'llx') or (ext == 'c.tr') or (ext == 'cpp.tr')): return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestRunner', {'srcfile':testpath}) @@ -110,6 +136,20 @@ # files = A list of files within this directory. # def GetDirsAndFiles (self, dirpath): + + # The list of feature directories + featuredirs = ['fopt', 'fasm', 'fmc', 'fcc', 'fad'] + + # + # To perform magic on the Feature tests, adjust the pathname. + # + if (os.path.basename (dirpath) == 'Feature'): + return (featuredirs, []) + + for x in featuredirs: + if (x == os.path.basename (dirpath)): + dirpath = os.path.dirname (dirpath) + # # Get a list of the tests located in this directory. # @@ -119,9 +159,9 @@ # Record names of invalid directories and files. # invalid_dirs = ['CVS', 'QMTest', 'QMTestDB', 'Scripts', 'Programs', - 'Feature', 'Fragments'] + 'Fragments'] - invalid_files = ['Makefile', 'README.txt', '.cvsignore'] + invalid_files = ['Makefile', 'README.txt', '.cvsignore', 'opaquetypes.ll'] # # Start with an empty list of files and directories. From lattner at cs.uiuc.edu Tue Oct 7 14:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:34:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/InlineSimple.cpp Message-ID: <200310071933.OAA10267@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: InlineSimple.cpp updated: 1.51 -> 1.52 --- Log message: Fix bugzilla bug #5 --- Diffs of the changes: (+6 -1) Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.51 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.52 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.51 Mon Oct 6 10:52:43 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Tue Oct 7 14:33:31 2003 @@ -97,7 +97,12 @@ CalleeFI.NumInsts = NumInsts; } - // Look at the size of the callee. Each basic block counts as 21 units, and + // Don't inline into something too big, which would make it bigger. Here, we + // count each basic block as a single unit. + InlineCost += Caller->size()*2; + + + // Look at the size of the callee. Each basic block counts as 20 units, and // each instruction counts as 10. InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20; return InlineCost; From lattner at cs.uiuc.edu Tue Oct 7 14:38:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:38:03 2003 Subject: [llvm-commits] CVS: llvm/www/www-index.html Message-ID: <200310071937.OAA20556@tank.cs.uiuc.edu> Changes in directory llvm/www: www-index.html updated: 1.57 -> 1.58 --- Log message: Add a link to the command guide, for John --- Diffs of the changes: (+3 -0) Index: llvm/www/www-index.html diff -u llvm/www/www-index.html:1.57 llvm/www/www-index.html:1.58 --- llvm/www/www-index.html:1.57 Wed Oct 1 22:27:20 2003 +++ llvm/www/www-index.html Tue Oct 7 14:37:07 2003 @@ -282,6 +282,9 @@ Everything from unpacking & compilation of the distribution to execution of some tools.
            • +
            • LLVM Command + Guide - A reference manual for the LLVM command line + utilities.
            • LLVM Reference Manual - Defines the LLVM intermediate representation, the assembly From lattner at cs.uiuc.edu Tue Oct 7 14:44:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:44:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/llc.html Message-ID: <200310071943.OAA20619@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: llc.html updated: 1.4 -> 1.5 --- Log message: separate options into X86 and sparc specific options --- Diffs of the changes: (+50 -48) Index: llvm/www/docs/CommandGuide/llc.html diff -u llvm/www/docs/CommandGuide/llc.html:1.4 llvm/www/docs/CommandGuide/llc.html:1.5 --- llvm/www/docs/CommandGuide/llc.html:1.4 Thu Oct 2 01:13:19 2003 +++ llvm/www/docs/CommandGuide/llc.html Tue Oct 7 14:42:50 2003 @@ -88,80 +88,68 @@

              OPTIONS

              -
                -
              • -disable-fp-elim -
                - Disable frame pointer elimination optimization. -

                - -

              • -disable-pattern-isel +
              • -f
                - Use the 'simple' X86 instruction selector. + Overwrite output files

                -

              • -disable-peephole +
              • -m<arch>
                - Disable peephole optimization pass. -

                + Specify the architecture for which to generate assembly. Valid + architectures are: -

              • -disable-preopt -
                - Disable optimizations prior to instruction selection. -

                +

                + x86 +
                IA-32 (Pentium and above)
                -
              • -disable-sched -
                - Disable local scheduling pass. + sparc +
                SPARC V9
                +
              • -

              • -disable-strip +
              • -o <filename>
                - Do not strip the LLVM bytecode included in executable. + Specify the output filename.

                -

              • -enable-maps +
              • -help
                - Emit LLVM-to-MachineCode mapping info to assembly. + Print a summary of command line options.

                -

              • -f +
              • -stats
                - Overwrite output files + Print statistics.

                -

              • -load=<plugin.so> +
              • -time-passes
                - Load the specified plugin. + Record the amount of time needed for each pass and print it to standard + error.

                -

              • -m<arch> +
              +

              X86 Specific Options

              +
                +
              • -disable-fp-elim
                - Specify the architecture for which to generate assembly. Valid - architectures are: - -
                - x86 -
                IA-32 (Pentium and above)
                - - sparc -
                SPARC V9
                -
                + Disable frame pointer elimination optimization.

                -

              • -o <filename> +
              • -disable-pattern-isel
                - Specify the output filename. + Use the 'simple' X86 instruction selector (the default).

                -

              • -print-machineinstrs +
              • -print-machineinstrs
                Print generated machine code.

              • -regalloc=<ra>
                - Specify the register allocator to use. The default is simple. + Specify the register allocator to use. The default is simple. Valid register allocators are:
                simple @@ -172,22 +160,36 @@

                -

              • -help +
              + +

              Sparc Specific Options

              +
                +
              • -disable-peephole
                - Print a summary of command line options. + Disable peephole optimization pass.

                -

              • -stats +
              • -disable-preopt
                - Print statistics. + Disable optimizations prior to instruction selection.

                -

              • -time-passes +
              • -disable-sched
                - Record the amount of time needed for each pass and print it to standard - error. + Disable local scheduling pass. +

                + +

              • -disable-strip +
                + Do not strip the LLVM bytecode included in executable. +

                + +

              • -enable-maps +
                + Emit LLVM-to-MachineCode mapping info to assembly.

              +

              EXIT STATUS From lattner at cs.uiuc.edu Tue Oct 7 14:47:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:47:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/lli.html Message-ID: <200310071946.OAA20716@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: lli.html updated: 1.4 -> 1.5 --- Log message: Add pointer to LLC for code generator options. a bunch of stuff which should be --- Diffs of the changes: (+10 -35) Index: llvm/www/docs/CommandGuide/lli.html diff -u llvm/www/docs/CommandGuide/lli.html:1.4 llvm/www/docs/CommandGuide/lli.html:1.5 --- llvm/www/docs/CommandGuide/lli.html:1.4 Mon Sep 29 15:10:08 2003 +++ llvm/www/docs/CommandGuide/lli.html Tue Oct 7 14:46:37 2003 @@ -6,7 +6,7 @@
              -

              LLVM: lli tool

              +

              LLVM: lli tool


              @@ -14,56 +14,36 @@ NAME

              -lli +lli

              SYNOPSIS

              -lli [options] [filename] [args ...] +lli [options] [filename] [args ...]

              DESCRIPTION

              -The lli command is the LLVM interpreter. It takes a program in LLVM bytecode -format and executes it using an interpreter or a Just In Time (JIT) compiler. +The lli command is the LLVM interpreter. It takes a program in LLVM +bytecode format and executes it using an interpreter or a Just In Time (JIT) +compiler. lli takes all of the same code generator option as the +llc tool as well.

              If filename is not specified, then lli reads its input from standard input.

              -The optional arguments specified on the command line are passed to the executed +The optional "args" specified on the command line are passed to the executed program as arguments.

              -

              -MAIN FUNCTION -

              - -The main() function of the bytecode program is where execution starts. It -is passed three arguments: - -
                -
              • - int argc - The number of command line arguments. -

                - -

              • - char ** argv - The arguments to the program. -

                - -

              • - char ** envp - An array of environment variables used by the program. -
              - -The first argument to the program is the name of the executed bytecode file -(with the .bc suffix removed).

              OPTIONS

                -
              • -array-checks +
              • -array-checks (interpreter specific)
                Enable array bound checks.

                @@ -73,11 +53,6 @@ Print a summary of command line options.

                -

              • -disable-fp-elim -
                - Disable frame pointer elimination optimization. -

                -

              • -stats
                Print statistics. @@ -100,7 +75,7 @@

                SEE ALSO

                -llvm-dis +llc
                LLVM Team From lattner at cs.uiuc.edu Tue Oct 7 14:49:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:49:02 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/extract.html Message-ID: <200310071948.OAA20756@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: extract.html updated: 1.3 -> 1.4 --- Log message: stuff simplify a bit --- Diffs of the changes: (+14 -26) Index: llvm/www/docs/CommandGuide/extract.html diff -u llvm/www/docs/CommandGuide/extract.html:1.3 llvm/www/docs/CommandGuide/extract.html:1.4 --- llvm/www/docs/CommandGuide/extract.html:1.3 Tue Sep 30 17:55:44 2003 +++ llvm/www/docs/CommandGuide/extract.html Tue Oct 7 14:48:25 2003 @@ -6,35 +6,33 @@
                -

                LLVM: extract tool

                +

                LLVM: extract tool


                -

                -NAME -

                - -extract +

                NAME

                +extract

                SYNOPSIS

                -extract [options] [filename] +extract [options] [filename]

                DESCRIPTION

                -The extract command takes the name of a function and extracts it from the -specified LLVM bytecode file. It is primarily used as a debugging tool to +The extract command takes the name of a function and extracts it from +the specified LLVM bytecode file. It is primarily used as a debugging tool to reduce test cases from larger programs that are triggering a bug.

                -In addition to extracting the bytecode of the specified function, extract will -also remove unreachable global variables, prototypes, and unused types. +In addition to extracting the bytecode of the specified function, +extract will also remove unreachable global variables, prototypes, and +unused types.

                -The extract command will read its input from standard input if filename is +The extract command reads its input from standard input if filename is omitted or if filename is -. The output is always written to standard output.

                @@ -44,36 +42,26 @@
                • -func <function>
                  - Extract function from the LLVM bytecode. + Extract the specified function from the LLVM bytecode.

                • -help
                  Print a summary of command line options.

                  - -

                • -stats -
                  - Print statistics. -

                  - -

                • -time-passes -
                  - Record the amount of time needed for each pass and print it to standard - error.

                EXIT STATUS

                -If extract succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If extract succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value.

                SEE ALSO

                -bugpoint +bugpoint
                LLVM Team From lattner at cs.uiuc.edu Tue Oct 7 14:53:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 14:53:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/llvmgcc.html Message-ID: <200310071952.OAA20829@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: llvmgcc.html updated: 1.1 -> 1.2 --- Log message: ify, other minor cleanups --- Diffs of the changes: (+24 -25) Index: llvm/www/docs/CommandGuide/llvmgcc.html diff -u llvm/www/docs/CommandGuide/llvmgcc.html:1.1 llvm/www/docs/CommandGuide/llvmgcc.html:1.2 --- llvm/www/docs/CommandGuide/llvmgcc.html:1.1 Fri Oct 3 08:45:55 2003 +++ llvm/www/docs/CommandGuide/llvmgcc.html Tue Oct 7 14:51:55 2003 @@ -6,37 +6,36 @@
                -

                LLVM: llvmgcc tool

                +

                LLVM: llvmgcc tool


                -

                -NAME -

                - -llvmgcc +

                NAME

                +llvmgcc

                SYNOPSIS

                -llvmgcc [options] filename +llvmgcc [options] filename

                DESCRIPTION

                -The llvmgcc command is the LLVM C front end. It is a modified version of GCC -that takes C programs and compiles them into LLVM bytecode or assembly -language, depending upon the options. +The llvmgcc command is the LLVM C front end. It is a modified version +of the GNU Compiler Collection (GCC) that takes +C programs and compiles them into LLVM bytecode or assembly language, depending +upon the options.

                -The llvmgcc program uses the LLVM assembler gccas and the LLVM linker gccld to -do the work of creating complete programs. +The llvmgcc program uses the gccas +and gccld programs to do the work of creating +complete programs.

                -Being derived from the GNU Compiler Collection, llvmgcc has many of gcc's -features and accepts most of gcc's options. It handles a number of gcc's -extensions to the C programming language. +Being derived from GCC, llvmgcc has many of GCC's features and accepts most of +GCC's options. It handles a number of GCC's extensions to the C programming +language.

                Below you will find several commonly used options: @@ -61,8 +60,7 @@

              • -o filename
                - Specify the output file to be filename. If filename is -, - then llvmgcc sends its output to standard output. + Specify the output file to be filename.

              • -I directory @@ -79,13 +77,14 @@
              • -lname
                - Link in the library libname.[bc | a | so]. This library should be - a bytecode library. + Link in the library libname.[bc | a | so]. This library should + be a bytecode library.

              • -Wl,option
                - Pass option to the linker (usually gccld). + Pass option to the linker program, gccld.

              @@ -93,15 +92,15 @@ EXIT STATUS -If llvmgcc succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If llvmgcc succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value.

              SEE ALSO

              -llvmg++, -gccas, -gccld +llvmg++, +gccas, +gccld
              LLVM Team From lattner at cs.uiuc.edu Tue Oct 7 15:02:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:02:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/gccas.html gccld.html llvmgxx.html Message-ID: <200310072001.PAA20937@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: gccas.html updated: 1.3 -> 1.4 gccld.html updated: 1.5 -> 1.6 llvmgxx.html updated: 1.1 -> 1.2 --- Log message: More changes and updates --- Diffs of the changes: (+117 -140) Index: llvm/www/docs/CommandGuide/gccas.html diff -u llvm/www/docs/CommandGuide/gccas.html:1.3 llvm/www/docs/CommandGuide/gccas.html:1.4 --- llvm/www/docs/CommandGuide/gccas.html:1.3 Thu Sep 25 14:50:04 2003 +++ llvm/www/docs/CommandGuide/gccas.html Tue Oct 7 15:01:09 2003 @@ -1,34 +1,28 @@ - -LLVM: gccas tool - +LLVM: gccas tool
              -

              LLVM: gccas tool

              +

              LLVM: gccas tool


              -

              -NAME -

              +

              NAME

              +gccas -gccas +

              SYNOPSIS

              +gccas [options] < filename> -

              -SYNOPSIS -

              +

              DESCRIPTION

              -gccas [options] < filename> -

              -DESCRIPTION -

              +The gccas utility takes an LLVM assembly file generated by the C or C++ frontends and +converts it into an LLVM bytecode file. It is primarily used by the GCC front +end, and as such, attempts to mimic the interface provided by the default system +assembler so that it can act as a "drop-in" replacement.

              -The gccas utility takes an LLVM assembly file generated by GCC and converts it -into an LLVM bytecode file. It is primarily used by the GCC front end, and as -such, attempts to mimic the interface provided by the default system assembler -so that it can act as a "drop-in" replacement. +gccas performs a number of optimizations on the input program.

              OPTIONS @@ -66,13 +60,12 @@ EXIT STATUS

              -If gccas succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If gccas succeeds, it will exit with 0. Otherwise, if an error occurs, +it will exit with a non-zero value. -

              -SEE ALSO -

              -llvm-dis +

              SEE ALSO

              +llvm-as +gccld
              LLVM Team Index: llvm/www/docs/CommandGuide/gccld.html diff -u llvm/www/docs/CommandGuide/gccld.html:1.5 llvm/www/docs/CommandGuide/gccld.html:1.6 --- llvm/www/docs/CommandGuide/gccld.html:1.5 Thu Sep 25 14:50:04 2003 +++ llvm/www/docs/CommandGuide/gccld.html Tue Oct 7 15:01:09 2003 @@ -1,69 +1,64 @@ - -LLVM: gccld tool - - - - -
              -

              LLVM: gccld tool

              -
              +LLVM: gccld tool + + + +

              LLVM: gccld tool


              -

              -NAME -

              - -gccld - -

              -SYNOPSIS -

              - -gccld [options] < filename> [ filename ...] -

              -DESCRIPTION -

              - -The gccld utility takes a set of LLVM bytecode files and links them together -into a single LLVM bytecode file. The output bytecode file can be another -bytecode library or an executable bytecode program. Using additional options, -gccld is able to produce native code executables. +

              NAME

              +gccld + +

              SYNOPSIS

              +gccld [options] < filename> [ filename ...] + +

              DESCRIPTION

              + +The gccld utility takes a set of LLVM bytecode files and links them +together into a single LLVM bytecode file. The output bytecode file can be +another bytecode library or an executable bytecode program. Using additional +options, gccld is able to produce native code executables.

              -The gccld utility is primarily used by the GCC front end, and as such, attempts -to mimic the interface provided by the default system linker so that it can act -as a "drop-in" replacement. - -

              -Search Order -

              -When looking for objects specified on the command line, gccld will search for -the object first in the current directory and then in the directory specified -by LLVM_LIB_SEARCH_PATH. If it cannot find the object, it fails. + +The gccld utility is primarily used by the C +and C++ front-ends, and as such, attempts to mimic +the interface provided by the default system linker so that it can act as a +"drop-in" replacement. +

              + +The gccld tool performs a small set of interprocedural, post-link, +optimizations on the program. + + +

              Search Order

              + +When looking for objects specified on the command line, gccld will +search for the object first in the current directory and then in the directory +specified by the LLVM_LIB_SEARCH_PATH environment variable. If it +cannot find the object, it fails.

              -When looking for a library specified with the -l option, gccld first attempts -to load a file with that name from the current directory. If that fails, it -looks for lib<library>.bc, lib<library>.a, or + +When looking for a library specified with the -l option, gccld first +attempts to load a file with that name from the current directory. If that +fails, it looks for lib<library>.bc, lib<library>.a, or lib<library>.so, in that order, in each directory added to the library search path with the -L option. These directories are searched in order they -were specified. If the library cannot be located, then gccld looks in the -directory specified by the LLVM_LIB_SEARCH_PATH environment variable. If it -does not find lib<library>.[bc | a | so] there, it fails. +were specified. If the library cannot be located, then gccld looks in +the directory specified by the LLVM_LIB_SEARCH_PATH environment +variable. If it does not find lib<library>.[bc | a | so] there, it fails. The -L option is global. It does not matter where it is specified in the list of command line arguments; the directory is simply added to the search path and is applied to all libraries, preceding or succeeding, in the command line. -

              -Link order -

              +

              Link order

              + All object files are linked first in the order they were specified on the command line. All library files are linked next. Some libraries may not be linked into the object program; see below. -

              -Library Linkage -

              +

              Library Linkage

              + Object files and static bytecode objects are always linked into the output file. Library archives (.a files) load only the objects within the archive that define symbols needed by the output file. Hence, libraries should be @@ -71,13 +66,13 @@ library may not be linked in, and the dependent library will not have its undefined symbols defined. -

              -Native code generation -

              -The gccld program has limited support for native code generation. -

              -OPTIONS -

              +

              Native code generation

              + +The gccld program has limited support for native code generation, when +using the -native option. + + +

              OPTIONS

              • -help @@ -129,10 +124,11 @@
              • -l=<library>
                - Specify libraries to include when linking the output file. When linking, - gccld will first attempt to load a file with the pathname library. If that - fails, it will then attempt to load lib<library>.bc, - lib<library>.a, and lib<library>.so, in that order. + Specify libraries to include when linking the output file. When + linking, gccld will first attempt to load a file with the + pathname library. If that fails, it will then attempt to load + lib<library>.bc, lib<library>.a, and lib<library>.so, + in that order.

              • -link-as-library @@ -144,13 +140,14 @@
                Generate a native, machine code executable.

                - When generating native executables, gccld first checks for a bytecode version - of the library and links it in, if necessary. If the library is missing, - gccld skips it. Then, gccld links in the same libraries as native code. + When generating native executables, gccld first checks for a bytecode + version of the library and links it in, if necessary. If the library is + missing, gccld skips it. Then, gccld links in the same + libraries as native code.

                - In this way, gccld should be able to link in optimized bytecode subsets of - common libraries and then link in any part of the library that hasn't been - converted to bytecode. + In this way, gccld should be able to link in optimized bytecode + subsets of common libraries and then link in any part of the library that + hasn't been converted to bytecode.

              • -s @@ -163,21 +160,16 @@ Print information about actions taken.
              -

              -EXIT STATUS -

              - -If gccld succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. - -

              -SEE ALSO -

              -gccas - -

              -BUGS -

              +

              EXIT STATUS

              + +If gccld succeeds, it will exit with 0. Otherwise, if an error occurs, +it will exit with a non-zero value. + +

              SEE ALSO

              +llvm-link +gccas + +

              BUGS

              The -L option cannot be used for find native code libraries when using the -native option. Index: llvm/www/docs/CommandGuide/llvmgxx.html diff -u llvm/www/docs/CommandGuide/llvmgxx.html:1.1 llvm/www/docs/CommandGuide/llvmgxx.html:1.2 --- llvm/www/docs/CommandGuide/llvmgxx.html:1.1 Fri Oct 3 08:45:55 2003 +++ llvm/www/docs/CommandGuide/llvmgxx.html Tue Oct 7 15:01:09 2003 @@ -6,37 +6,30 @@
              -

              LLVM: llvmg++ tool

              +

              LLVM: llvmg++ tool


              -

              -NAME -

              +

              NAME

              +llvmg++ -llvmg++ +

              SYNOPSIS

              +llvmg++ [options] filename -

              -SYNOPSIS -

              - -llvmg++ [options] filename -

              -DESCRIPTION -

              +

              DESCRIPTION

              -The llvmg++ command is the LLVM C++ front end. It is a modified version of g++ -that takes C++ programs and compiles them into LLVM bytecode or assembly -language, depending upon the options. +The llvmg++ command is the LLVM C++ front end. It is a modified +version of g++ that takes C++ programs and compiles them into LLVM bytecode or +assembly language, depending upon the options.

              -The llvmg++ program uses the LLVM assembler gccas and the LLVM linker gccld to -do the work of creating complete programs. +The llvmg++ program uses the gccas and gccld to +assist with the creation of complete programs.

              -Being derived from the GNU Compiler Collection, llvmg++ has many of g++'s -features and accepts most of g++'s options. It handles a number of g++'s -extensions to the C++ programming language. +Being derived from the GNU Compiler Collection, +llvmg++ has many of g++'s features and accepts most of g++'s options. +It handles a number of g++'s extensions to the C++ programming language.

              Below you will find several commonly used options: @@ -54,15 +47,14 @@

            • -c
              - Do not generate a linked executable. Rather, compile the source file into - an LLVM bytecode file. This bytecode file can then be linked with other - bytecode files later on to generate a full LLVM executable. + Do not generate a linked executable. Rather, compile the source file + into an LLVM bytecode file. This bytecode file can then be linked with + other bytecode files later on to generate a full LLVM executable.

            • -o filename
              - Specify the output file to be filename. If filename is -, - then llvmgcc sends its output to standard output. + Specify the output file to be filename.

            • -I directory @@ -79,8 +71,8 @@
            • -lname
              - Link in the library libname.[bc | a | so]. This library should be - a bytecode library. + Link in the library libname.[bc | a | so]. This library should + be a bytecode library.

            • -Wl,option @@ -94,15 +86,15 @@ EXIT STATUS -If llvmg++ succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If llvmg++ succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value.

              SEE ALSO

              -llvmg++, -gccas, -gccld +llvmg++, +gccas, +gccld
              LLVM Team From lattner at cs.uiuc.edu Tue Oct 7 15:06:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:06:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/index.html Message-ID: <200310072005.PAA20977@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: index.html updated: 1.5 -> 1.6 --- Log message: Make the index page a big more attractive --- Diffs of the changes: (+35 -21) Index: llvm/www/docs/CommandGuide/index.html diff -u llvm/www/docs/CommandGuide/index.html:1.5 llvm/www/docs/CommandGuide/index.html:1.6 --- llvm/www/docs/CommandGuide/index.html:1.5 Tue Oct 7 11:34:51 2003 +++ llvm/www/docs/CommandGuide/index.html Tue Oct 7 15:05:23 2003 @@ -8,16 +8,17 @@

              LLVM Command Guide

              - -

              Overview

              - - This document is the reference manual for the LLVM utilities. It will show you how to use the LLVM commands and what all of their options are. + + + +
              + -

              LLVM Base Commands

              +

              Basic Commands

              @@ -58,24 +59,10 @@

              - -

              LLVM Debugging Tools

              - - -
              -
              bugpoint -
              - Trace an LLVM bytecode program and reduce its failure to a - simple testcase. -

              - -

              extract -
              - Extract a function from an LLVM bytecode file. -
              +
              -

              LLVM GCC Support Commands

              +

              C and C++ Front-end Commands

              @@ -98,6 +85,33 @@
              LLVM linker used by GCC and other native compiler tools.
              + + +

              Debugging Tools

              + + +
              +
              bugpoint +
              + Trace an LLVM bytecode program and reduce its failure to a + simple testcase. +

              + +

              extract +
              + Extract a function from an LLVM bytecode file. +
              +
              + + +
              +Maintained by the +LLVM Team.
              + + +Last modified: Tue Oct 7 15:04:55 CDT 2003 + +
              From lattner at cs.uiuc.edu Tue Oct 7 15:10:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:10:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/llvm-link.html Message-ID: <200310072009.PAA21082@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: llvm-link.html updated: 1.4 -> 1.5 --- Log message: ify things --- Diffs of the changes: (+30 -42) Index: llvm/www/docs/CommandGuide/llvm-link.html diff -u llvm/www/docs/CommandGuide/llvm-link.html:1.4 llvm/www/docs/CommandGuide/llvm-link.html:1.5 --- llvm/www/docs/CommandGuide/llvm-link.html:1.4 Tue Oct 7 11:36:25 2003 +++ llvm/www/docs/CommandGuide/llvm-link.html Tue Oct 7 15:09:21 2003 @@ -3,39 +3,29 @@ LLVM: llvm-link tool - + -
              -

              LLVM: llvm-link tool

              -
              +

              LLVM: llvm-link tool


              -

              -NAME -

              +

              NAME

              +llvm-link -llvm-link +

              SYNOPSIS

              +llvm-link [options] <filename> [filename ...] -

              -SYNOPSIS -

              +

              DESCRIPTION

              -llvm-link [options] <filename> [filename ...] -

              -DESCRIPTION -

              - -The llvm-link command takes several LLVM bytecode files and links them together -into a single LLVM bytecode file. It writes the output file to standard -output, unless the -o option is used to specify a filename. +The llvm-link command takes several LLVM bytecode files and links them +together into a single LLVM bytecode file. It writes the output file to +standard output, unless the -o option is used to specify a filename.

              -The llvm-link command attempts to load the input files from the current +The llvm-link command attempts to load the input files from the current directory. If that fails, it attempts to locate each file within the -directories specified by the -L options on the command line. The library -search paths are global; each one is search for every input file if necessary. -The directories are searched in the order they were specified on the command -line. +directories specified by the -L options on the command line. The library search +paths are global; each one is search for every input file if necessary. The +directories are searched in the order they were specified on the command line.

              OPTIONS @@ -45,28 +35,28 @@
            • -L <directory>
              Add the specified directory to the library search path. When looking - for libraries, llvm-link will look in pathname for libraries. This - option can be specified multiple times; llvm-link will search inside - these directories in the order in which they were specified on the - command line. + for libraries, llvm-link will look in pathname for libraries. + This option can be specified multiple times; llvm-link will + search inside these directories in the order in which they were + specified on the command line.

            • -f
              - Overwrite output files. By default, llvm-link will not overwrite an - output file if it alreadys exists. + Overwrite output files. By default, llvm-link will not + overwrite an output file if it alreadys exists.

            • -o <filename>
              - Output filename. If filename is -, then llvm-link will write its output - to standard output. + Output filename. If filename is -, then llvm-link will write + its output to standard output.

            • -d
              - If specified, llvm-link prints a human readable version of the output - bytecode file to standard error. + If specified, llvm-link prints a human readable version of the + output bytecode file to standard error.

            • -help @@ -76,23 +66,21 @@
            • -v
              - Verbose mode. Print information about what llvm-link is doing. + Verbose mode. Print information about what llvm-link is doing.

            EXIT STATUS

            -If llvm-link succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If llvm-link succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. -

            -SEE ALSO -

            -llvm-dis, lli, gccld +

            SEE ALSO

            +gccld
            -LLVM Team +Maintained by the LLVM Team. From lattner at cs.uiuc.edu Tue Oct 7 15:13:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:13:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/analyze.html extract.html gccas.html gccld.html llc.html lli.html llvm-as.html llvm-dis.html llvmgcc.html llvmgxx.html opt.html Message-ID: <200310072012.PAA21199@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: analyze.html updated: 1.6 -> 1.7 extract.html updated: 1.4 -> 1.5 gccas.html updated: 1.4 -> 1.5 gccld.html updated: 1.6 -> 1.7 llc.html updated: 1.5 -> 1.6 lli.html updated: 1.5 -> 1.6 llvm-as.html updated: 1.4 -> 1.5 llvm-dis.html updated: 1.4 -> 1.5 llvmgcc.html updated: 1.2 -> 1.3 llvmgxx.html updated: 1.2 -> 1.3 opt.html updated: 1.5 -> 1.6 --- Log message: Consistently set the background color Change the footer to include "maintained by" --- Diffs of the changes: (+44 -56) Index: llvm/www/docs/CommandGuide/analyze.html diff -u llvm/www/docs/CommandGuide/analyze.html:1.6 llvm/www/docs/CommandGuide/analyze.html:1.7 --- llvm/www/docs/CommandGuide/analyze.html:1.6 Mon Sep 29 09:05:08 2003 +++ llvm/www/docs/CommandGuide/analyze.html Tue Oct 7 15:12:03 2003 @@ -3,7 +3,7 @@ LLVM: analyze tool - +

            LLVM: analyze tool

            @@ -86,7 +86,7 @@ opt
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/extract.html diff -u llvm/www/docs/CommandGuide/extract.html:1.4 llvm/www/docs/CommandGuide/extract.html:1.5 --- llvm/www/docs/CommandGuide/extract.html:1.4 Tue Oct 7 14:48:25 2003 +++ llvm/www/docs/CommandGuide/extract.html Tue Oct 7 15:12:03 2003 @@ -3,7 +3,7 @@ LLVM: extract tool - +

            LLVM: extract tool

            @@ -64,7 +64,7 @@ bugpoint
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/gccas.html diff -u llvm/www/docs/CommandGuide/gccas.html:1.4 llvm/www/docs/CommandGuide/gccas.html:1.5 --- llvm/www/docs/CommandGuide/gccas.html:1.4 Tue Oct 7 15:01:09 2003 +++ llvm/www/docs/CommandGuide/gccas.html Tue Oct 7 15:12:03 2003 @@ -1,7 +1,7 @@ LLVM: gccas tool - +

            LLVM: gccas tool

            @@ -68,7 +68,7 @@ gccld
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/gccld.html diff -u llvm/www/docs/CommandGuide/gccld.html:1.6 llvm/www/docs/CommandGuide/gccld.html:1.7 --- llvm/www/docs/CommandGuide/gccld.html:1.6 Tue Oct 7 15:01:09 2003 +++ llvm/www/docs/CommandGuide/gccld.html Tue Oct 7 15:12:04 2003 @@ -174,7 +174,7 @@ -native option.
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llc.html diff -u llvm/www/docs/CommandGuide/llc.html:1.5 llvm/www/docs/CommandGuide/llc.html:1.6 --- llvm/www/docs/CommandGuide/llc.html:1.5 Tue Oct 7 14:42:50 2003 +++ llvm/www/docs/CommandGuide/llc.html Tue Oct 7 15:12:04 2003 @@ -1,33 +1,22 @@ - -LLVM: llc tool - - - - -
            -

            LLVM: llc tool

            -
            -
            +LLVM: llc tool -

            -NAME -

            + -llc +

            LLVM: llc tool

            +
            -

            -SYNOPSIS -

            +

            NAME

            +llc -llc [options] [filename] -

            -DESCRIPTION -

            +

            SYNOPSIS

            +llc [options] [filename] + +

            DESCRIPTION

            -The llc command compiles LLVM bytecode into assembly language for a specified -architecture. The assembly language output can then be passed through a native -assembler and linker to generate native code. +The llc command compiles LLVM bytecode into assembly language for a +specified architecture. The assembly language output can then be passed through +a native assembler and linker to generate native code.

            The choice of architecture for the output assembly code is determined as follows: @@ -53,8 +42,9 @@

          • - If llc was compiled on an architecture for which it can generate code, - select the architecture upon which llc was compiled. + If llc was compiled on an architecture for which it can + generate code, select the architecture upon which llc was + compiled.

          • @@ -64,17 +54,17 @@

            -If filename is not specified, or if filename is -, llc reads its input from -standard input. Otherwise, it will read its input from filename. +If filename is not specified, or if filename is -, llc reads its input +from standard input. Otherwise, it will read its input from filename.

            -If the -o option is left unspecified, then llc will send its output to standard +If the -o option is left unspecified, then llc will send its output to standard output if the input is from standard input. If the -o option specifies -, then the output will also be sent to standard output.

            If no -o option is specified and an input file other than - is specified, then -llc creates the output filename as follows: +llc creates the output filename as follows:

            • @@ -191,20 +181,18 @@
            -

            -EXIT STATUS -

            +

            EXIT STATUS

            -If llc succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. +If llc succeeds, it will exit with 0. Otherwise, if an error occurs, +it will exit with a non-zero value.

            SEE ALSO

            -llvm-dis, lli +lli
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/lli.html diff -u llvm/www/docs/CommandGuide/lli.html:1.5 llvm/www/docs/CommandGuide/lli.html:1.6 --- llvm/www/docs/CommandGuide/lli.html:1.5 Tue Oct 7 14:46:37 2003 +++ llvm/www/docs/CommandGuide/lli.html Tue Oct 7 15:12:04 2003 @@ -3,7 +3,7 @@ LLVM: lli tool - +

            LLVM: lli tool

            @@ -78,7 +78,7 @@ llc
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llvm-as.html diff -u llvm/www/docs/CommandGuide/llvm-as.html:1.4 llvm/www/docs/CommandGuide/llvm-as.html:1.5 --- llvm/www/docs/CommandGuide/llvm-as.html:1.4 Thu Sep 25 21:59:00 2003 +++ llvm/www/docs/CommandGuide/llvm-as.html Tue Oct 7 15:12:04 2003 @@ -3,7 +3,7 @@ LLVM: llvm-as tool - +

            LLVM: llvm-as tool

            @@ -102,7 +102,7 @@ llvm-dis
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llvm-dis.html diff -u llvm/www/docs/CommandGuide/llvm-dis.html:1.4 llvm/www/docs/CommandGuide/llvm-dis.html:1.5 --- llvm/www/docs/CommandGuide/llvm-dis.html:1.4 Thu Sep 25 21:59:00 2003 +++ llvm/www/docs/CommandGuide/llvm-dis.html Tue Oct 7 15:12:04 2003 @@ -3,7 +3,7 @@ LLVM: llvm-dis tool - +

            LLVM: llvm-dis tool

            @@ -107,7 +107,7 @@ llvm-as
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llvmgcc.html diff -u llvm/www/docs/CommandGuide/llvmgcc.html:1.2 llvm/www/docs/CommandGuide/llvmgcc.html:1.3 --- llvm/www/docs/CommandGuide/llvmgcc.html:1.2 Tue Oct 7 14:51:55 2003 +++ llvm/www/docs/CommandGuide/llvmgcc.html Tue Oct 7 15:12:04 2003 @@ -3,7 +3,7 @@ LLVM: llvmgcc tool - +

            LLVM: llvmgcc tool

            @@ -103,7 +103,7 @@ gccld
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llvmgxx.html diff -u llvm/www/docs/CommandGuide/llvmgxx.html:1.2 llvm/www/docs/CommandGuide/llvmgxx.html:1.3 --- llvm/www/docs/CommandGuide/llvmgxx.html:1.2 Tue Oct 7 15:01:09 2003 +++ llvm/www/docs/CommandGuide/llvmgxx.html Tue Oct 7 15:12:05 2003 @@ -3,7 +3,7 @@ LLVM: llvmg++ tool - +

            LLVM: llvmg++ tool

            @@ -97,7 +97,7 @@ gccld
            -LLVM Team +Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/opt.html diff -u llvm/www/docs/CommandGuide/opt.html:1.5 llvm/www/docs/CommandGuide/opt.html:1.6 --- llvm/www/docs/CommandGuide/opt.html:1.5 Tue Oct 7 11:33:42 2003 +++ llvm/www/docs/CommandGuide/opt.html Tue Oct 7 15:12:05 2003 @@ -3,7 +3,7 @@ LLVM: opt tool - +

            LLVM: opt tool

            @@ -127,7 +127,7 @@ analyze
            -LLVM Team +Maintained by the LLVM Team. From lattner at cs.uiuc.edu Tue Oct 7 15:20:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:20:02 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/llvm-as.html llvm-dis.html opt.html Message-ID: <200310072017.PAA10426@apoc.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: llvm-as.html updated: 1.5 -> 1.6 llvm-dis.html updated: 1.5 -> 1.6 opt.html updated: 1.6 -> 1.7 --- Log message: TTify, add links between pages --- Diffs of the changes: (+107 -145) Index: llvm/www/docs/CommandGuide/llvm-as.html diff -u llvm/www/docs/CommandGuide/llvm-as.html:1.5 llvm/www/docs/CommandGuide/llvm-as.html:1.6 --- llvm/www/docs/CommandGuide/llvm-as.html:1.5 Tue Oct 7 15:12:04 2003 +++ llvm/www/docs/CommandGuide/llvm-as.html Tue Oct 7 15:17:24 2003 @@ -5,37 +5,29 @@ -
            -

            LLVM: llvm-as tool

            -
            +

            LLVM: llvm-as tool


            -

            -NAME -

            - -llvm-as - -

            -SYNOPSIS -

            - -llvm-as [options] [filename] -

            -DESCRIPTION -

            - -The llvm-as command is the LLVM assembler. It reads a file containing human -readable LLVM assembly language, translates it to LLVM bytecode, and writes the -result into a file or to standard output. +

            NAME

            +llvm-as + +

            SYNOPSIS

            +llvm-as [options] [filename] + +

            DESCRIPTION

            + +The llvm-as command is the LLVM assembler. It reads a file containing +human readable LLVM assembly language, translates it to LLVM bytecode, and +writes the result into a file or to standard output.

            -If filename is omitted or is -, then llvm-as reads its input from standard -input. +If filename is omitted or is -, then llvm-as reads its input from +standard input.

            -If an output file is not specified with the -o option, then llvm-as sends its -output to a file or standard output by the following logic: +If an output file is not specified with the -o option, then +llvm-as sends its output to a file or standard output by the following +logic:

            • @@ -49,21 +41,19 @@
            • If the input is a file that does not end with the .ll suffix, then the - output file has the same name as the input file, except that the .bc suffix - is appended. + output file has the same name as the input file, except that the .bc + suffix is appended.

            -

            -OPTIONS -

            +

            OPTIONS

            • -f
              - Force overwrite. Normally, llvm-as will refuse to overwrite an output - file that already exists. With this option, llvm-as will overwrite the - output file and replace it with new bytecode. + Force overwrite. Normally, llvm-as will refuse to overwrite an + output file that already exists. With this option, llvm-as + will overwrite the output file and replace it with new bytecode.

            • -help @@ -73,8 +63,8 @@
            • -o <filename>
              - Specify the output filename. If filename is -, then llvm-as sends its - output to standard output. + Specify the output filename. If filename is -, then llvm-as + sends its output to standard output.

            • -stats @@ -89,17 +79,16 @@

            -

            -EXIT STATUS -

            - -If llvm-as succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. - -

            -SEE ALSO -

            -llvm-dis +

            EXIT STATUS

            + +If llvm-as succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. + +

            SEE ALSO

            + +llvm-dis +gccas +
            Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/llvm-dis.html diff -u llvm/www/docs/CommandGuide/llvm-dis.html:1.5 llvm/www/docs/CommandGuide/llvm-dis.html:1.6 --- llvm/www/docs/CommandGuide/llvm-dis.html:1.5 Tue Oct 7 15:12:04 2003 +++ llvm/www/docs/CommandGuide/llvm-dis.html Tue Oct 7 15:17:24 2003 @@ -5,39 +5,30 @@ -
            -

            LLVM: llvm-dis tool

            -
            +

            LLVM: llvm-dis tool


            -

            -NAME -

            - -llvm-dis - -

            -SYNOPSIS -

            - -llvm-dis [options] [filename] -

            -DESCRIPTION -

            - -The llvm-dis command is the LLVM disassembler. It takes an LLVM bytecode file -and converts it into LLVM assembly language or C source code with equivalent -functionality. +

            NAME

            +llvm-dis + +

            SYNOPSIS

            +llvm-dis [options] [filename] + +

            DESCRIPTION

            + +The llvm-dis command is the LLVM disassembler. It takes an LLVM +bytecode file and converts it into LLVM assembly language or C source code with +equivalent functionality.

            -If filename is omitted, llvm-dis reads its input from standard input. +If filename is omitted, llvm-dis reads its input from standard input.

            -The default output file for llvm-dis is determined by the following logic: +The default output file for llvm-dis is determined by the following logic:

            • - If the input is standard input or the file -, then the output is standard - output. + If the input is standard input or the file -, then the output is + standard output.

            • @@ -47,33 +38,31 @@

            • - If the input filename does not end in .bc, then the output filename will be - identical to the input filename, except that the .ll or .c suffix will be - appended to the filename (for LLVM assembly language and C code, + If the input filename does not end in .bc, then the output filename will + be identical to the input filename, except that the .ll or .c suffix + will be appended to the filename (for LLVM assembly language and C code, respectively).
            -

            -OPTIONS -

            +

            OPTIONS

            • -llvm
              - Instruct llvm-dis to generate LLVM assembly code in human readable - format. This is the default behavior. + Instruct llvm-dis to generate LLVM assembly code in human + readable format. This is the default behavior.

            • -c
              - Instruct llvm-dis to generate C source code. + Instruct llvm-dis to generate C source code.

            • -f
              - Force overwrite. Normally, llvm-dis will refuse to overwrite an output - file that already exists. With this option, llvm-dis will overwrite the - output file. + Force overwrite. Normally, llvm-dis will refuse to overwrite + an output file that already exists. With this option, llvm-dis + will overwrite the output file.

            • -help @@ -83,8 +72,8 @@
            • -o <filename>
              - Specify the output filename. If filename is -, then the output is sent to - standard output. + Specify the output filename. If filename is -, then the output is sent + to standard output.

            • -time-passes @@ -94,17 +83,14 @@

            -

            -EXIT STATUS -

            - -If llvm-dis succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. - -

            -SEE ALSO -

            -llvm-as +

            EXIT STATUS

            + +If llvm-dis succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. + +

            SEE ALSO

            + +llvm-as
            Maintained by the LLVM Team. Index: llvm/www/docs/CommandGuide/opt.html diff -u llvm/www/docs/CommandGuide/opt.html:1.6 llvm/www/docs/CommandGuide/opt.html:1.7 --- llvm/www/docs/CommandGuide/opt.html:1.6 Tue Oct 7 15:12:05 2003 +++ llvm/www/docs/CommandGuide/opt.html Tue Oct 7 15:17:24 2003 @@ -1,56 +1,46 @@ - -LLVM: opt tool - +LLVM: opt tool -
            -

            LLVM: opt tool

            -
            +

            LLVM: opt tool


            -

            -NAME -

            - -opt - -

            -SYNOPSIS -

            - -opt [options] [filename] -

            -DESCRIPTION -

            - -The opt command is the LLVM optimizer. It takes LLVM bytecode as input, runs -the specified optimizations on it, and then outputs the optimized LLVM -bytecode. +

            NAME

            +opt + +

            SYNOPSIS

            +opt [options] [filename] + +

            DESCRIPTION

            + +The opt command is the modular LLVM optimizer. It takes LLVM bytecode +as input, runs the specified optimizations on it, and then outputs the optimized +LLVM bytecode.

            -The optimizations available via opt depend upon what libraries were linked -into it as well as any additional libraries that have been loaded with the --load option. Use the -help option to determine what optimizations you can use. +The optimizations available via opt depend upon what libraries were +linked into it as well as any additional libraries that have been loaded with +the -load option. Use the -help option to determine what +optimizations you can use.

            -If no filename is specified on the command line, opt reads its input from -standard input. +If no filename is specified on the command line, opt reads its input +from standard input.

            -If an output filename is not specified with the -o option, opt writes its -output to the standard output. -

            -OPTIONS -

            +If an output filename is not specified with the -o option, opt +writes its output to the standard output. + + +

            OPTIONS

            • -f
              - Force overwrite. Normally, opt will refuse to overwrite an output - file that already exists. With this option, opt will overwrite the - output file and replace it with new bytecode. + Force overwrite. Normally, opt will refuse to overwrite an + output file that already exists. With this option, opt will + overwrite the output file and replace it with new bytecode.

            • -help @@ -105,7 +95,7 @@ options to enable various optimizations. To see the new complete list of optimizations, use the -help and -load options together:

              - opt -load <plugin.so> -help + opt -load <plugin.so> -help

            • -p @@ -114,17 +104,14 @@

            -

            -EXIT STATUS -

            - -If opt succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. - -

            -SEE ALSO -

            -analyze +

            EXIT STATUS

            + +If opt succeeds, it will exit with 0. Otherwise, if an error occurs, +it will exit with a non-zero value. + +

            SEE ALSO

            + +analyze
            Maintained by the LLVM Team. From lattner at cs.uiuc.edu Tue Oct 7 15:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:34:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/bugpoint.html Message-ID: <200310072033.PAA21324@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: bugpoint.html added (r1.1) --- Log message: initial checkin of the bugpoint doxs --- Diffs of the changes: (+113 -0) Index: llvm/www/docs/CommandGuide/bugpoint.html diff -c /dev/null llvm/www/docs/CommandGuide/bugpoint.html:1.1 *** /dev/null Tue Oct 7 15:33:41 2003 --- llvm/www/docs/CommandGuide/bugpoint.html Tue Oct 7 15:33:30 2003 *************** *** 0 **** --- 1,113 ---- + + LLVM: bugpoint tool + + + +

            LLVM: bugpoint tool

            +
            + +

            NAME

            + bugpoint + +

            SYNOPSIS

            + extract [options] [input llvm ll/bc files] [LLVM passes] --args <program arguments>... + + +

            DESCRIPTION

            + + The bugpoint tool is a generally useful tool for narrowing down + problems in LLVM tools and passes.

            + + bugpoint reads the specified list of .bc or .ll files specified on the + command-line and links them together. It then runs the specified LLVM passes on + the resultant bytecode file. If any of the passes crash, or if they produce an + LLVM module which is not verifiable, bugpoint enters "crash debugging mode". + Otherwise, bugpoint tries to run the resultant program with a code + generator. If the code generated program does not match the reference output, + it enters "miscompilation debugging mode". If the -mode option is + specified, bugpoint enters "code generator debugging mode". + +

            Crash debugging mode

            + + TODO + +

            Miscompilation debugging mode

            + + TODO + +

            Code generator debugging mode

            + + TODO + + +

            OPTIONS

            + +
              +
            • -args <arguments> +
              + All arguments specified after -args are passed into the + executed program when the program must be executed. +

              + +

            • -disable-(adce,dce,final-cleanup,simplifycfg) +
              + bugpoint uses several passes internally for cleanup routines to + reduce the size of the program. If you're trying to find a bug in out + of these passes, bugpoint may crash. These options tell + bugpoint not use the specified passes. +

              + +

            • -help +
              + Print a summary of command line options. +

              + +

            • -input <filename> +
              + Specify the contents of <stdin> when the program must be executed. +

              + +

            • -load <plugin.so> +
              + Load the dynamic object plugin.so. This object should register new + optimization passes. Once loaded, the object will add new command line + options to enable various optimizations. To see the new complete list + of optimizations, use the -help and -load options together: +

              + opt -load <plugin.so> -help +

              + +

            • -mode=(compile|codegen) +
              + Specify whether bugpoint should operate in compilation + debugging mode (detecting miscompilations and optimizer crashes), or in + code generator debugging mode. +

              + +

            • -output <filename> +
              + Specify a reference output for the <stdout> file stream. +

              + +

            • -run-(lli|jit|llc|cbe) +
              + Specify which code generator bugpoint should use to run the + program with. +

              + +

            + +

            EXIT STATUS

            + + If bugpoint succeeds in finding a problem, it will exit with 0. + Otherwise, if an error occurs, it will exit with a non-zero value. + +

            SEE ALSO

            + opt + analyze + +
            + Maintained by the LLVM Team. + + + From lattner at cs.uiuc.edu Tue Oct 7 15:35:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:35:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/bugpoint.html Message-ID: <200310072034.PAA21346@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: bugpoint.html updated: 1.1 -> 1.2 --- Log message: no this really isn't extract --- Diffs of the changes: (+1 -1) Index: llvm/www/docs/CommandGuide/bugpoint.html diff -u llvm/www/docs/CommandGuide/bugpoint.html:1.1 llvm/www/docs/CommandGuide/bugpoint.html:1.2 --- llvm/www/docs/CommandGuide/bugpoint.html:1.1 Tue Oct 7 15:33:30 2003 +++ llvm/www/docs/CommandGuide/bugpoint.html Tue Oct 7 15:33:52 2003 @@ -10,7 +10,7 @@ bugpoint

            SYNOPSIS

            -extract [options] [input llvm ll/bc files] [LLVM passes] --args <program arguments>... +bugpoint [options] [input llvm ll/bc files] [LLVM passes] --args <program arguments>...

            DESCRIPTION

            From lattner at cs.uiuc.edu Tue Oct 7 15:37:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:37:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/index.html Message-ID: <200310072036.PAA21460@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: index.html updated: 1.6 -> 1.7 --- Log message: Ensure both columns take 50% --- Diffs of the changes: (+3 -3) Index: llvm/www/docs/CommandGuide/index.html diff -u llvm/www/docs/CommandGuide/index.html:1.6 llvm/www/docs/CommandGuide/index.html:1.7 --- llvm/www/docs/CommandGuide/index.html:1.6 Tue Oct 7 15:05:23 2003 +++ llvm/www/docs/CommandGuide/index.html Tue Oct 7 15:35:55 2003 @@ -15,7 +15,7 @@ - @@ -487,7 +453,7 @@ @@ -520,11 +486,11 @@
            --enable-spec2000=<directory>
            Enable the use of SPEC2000 when testing LLVM. This is disabled by default - (unless configure find SPEC2000 installed). By specifying + (unless configure finds SPEC2000 installed). By specifying directory, you can tell configure where to find the SPEC2000 - benchmarks. If directory is left unspecified, it - configure uses a default value for our internal - installation of SPEC2000. + benchmarks. If directory is left unspecified, configure + uses the default value + /home/vadve/shared/benchmarks/speccpu2000/benchspec.

            @@ -535,7 +501,7 @@ cd OBJ_ROOT

            -

          • Run the script located in the LLVM source tree: +
          • Run the configure script located in the LLVM source tree:
            SRC_ROOT/configure

            @@ -547,10 +513,10 @@ This environment variable is used to locate "system" libraries like "-lc" and "-lm" when linking. This variable should be set to the absolute path for the bytecode-libs subdirectory of the GCC front end - install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might + install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might set LLVM_LIB_SEARCH_PATH to /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 - version of the C front-end on our research machines.

            + version of the GCC front end on our research machines.

            Compiling the LLVM Suite Source Code

            @@ -563,17 +529,18 @@
            Debug Builds
            These builds are the default when one types gmake (unless the - --enable-optimized option was used during configuration). They - compile the tools and libraries with debugging information. + --enable-optimized option was used during configuration). The + build system will compile the tools and libraries with debugging + information.

            Release (Optimized) Builds
            These builds are enabled with the --enable-optimized option to configure or by specifying ENABLE_OPTIMIZED=1 on the - gmake command line. They compile the tools and libraries with GCC - optimizer flags on and strip debugging information from the libraries - and executables it generates. + gmake command line. For these builds, the build system will + compile the tools and libraries with GCC optimizations enabled and strip + debugging information from the libraries and executables it generates.

            Profile Builds @@ -584,8 +551,8 @@ on the gmake command line. - Once you have LLVM configured, you can build it by entering the OBJ_ROOT - directory and issuing the following command: + Once you have LLVM configured, you can build it by entering the + OBJ_ROOT directory and issuing the following command:

            gmake @@ -746,13 +713,13 @@

          • llvm/include/Support - This directory contains generic support libraries that are independent of LLVM, but are used by LLVM. For example, some C++ STL utilities and a Command Line option processing - library. + library store their header files here.
          • llvm/include/Config - This directory contains header files configured by the configure script. They wrap "standard" UNIX and C header files. Source code can include these header files which - automatically take care of the conditional #includes that the configure - script generates. + automatically take care of the conditional #includes that the + configure script generates. @@ -760,7 +727,7 @@ This directory contains most of the source files of the LLVM system. In - LLVM almost all + LLVM, almost all code exists in libraries, making it very easy to share code among the different tools.

            @@ -897,8 +864,8 @@

            gccld
            gccld links together several LLVM bytecode files into one bytecode file and does some optimization. It is - the linker invoked by the gcc frontend when multiple .o files need to be - linked together. Like gccas the command line interface of + the linker invoked by the GCC frontend when multiple .o files need to be + linked together. Like gccas, the command line interface of gccld is designed to match the system linker, to aid interfacing with the GCC frontend.

            @@ -978,62 +945,6 @@ the README file in that directory.

            - - -

            Compiling the LLVM GCC Front End

            -
            - - -

            - - This step is optional if you have the GCC front end binary distribution for - your platform. - -

            - - Now that you have the LLVM suite built, you can build the GCC front end. For - those of you that have built GCC before, the process is very similar. -

            - Be forewarned, though: the build system for the GCC front end is not as - polished as the rest of the LLVM code, so there will be many warnings and - errors that you will need to ignore for now: - -

              -
            1. Ensure that OBJ_ROOT/llvm/tools/Debug is at the - end of your PATH environment variable. The front end - build needs to know where to find the LLVM tools, but you want to - ensure that these tools are not found before the system assembler and - linker that you normally use for compilation. - -
            2. cd GCCOBJ - -
            3. Configure the source code: -
                -
              • On Linux/x86, use -
                  -
                • GCCSRC/configure --prefix=LLVMGCCDIR - --enable-languages=c -
                - -
              • On Solaris/Sparc, use -
                  -
                • GCCSRC/configure --prefix=LLVMGCCDIR - --enable-languages=c --target=sparcv9-sun-solaris2 -
                -
              - -
            4. gmake - -
            5. The build will eventually fail. Don't worry; chances are good that - everything that needed to build is built. - -
            6. gmake -k install -
            - -

            - Once this is done, you should have a built front end compiler in - LLVMGCCDIR. -

            From lattner at cs.uiuc.edu Fri Oct 10 11:36:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 11:36:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200310101635.LAA21392@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.127 -> 1.128 --- Log message: Reserve space for PHI operands --- Diffs of the changes: (+1 -0) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.127 llvm/lib/AsmParser/llvmAsmParser.y:1.128 --- llvm/lib/AsmParser/llvmAsmParser.y:1.127 Thu Oct 9 23:54:02 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Fri Oct 10 11:34:58 2003 @@ -1649,6 +1649,7 @@ | PHI PHIList { const Type *Ty = $2->front().first->getType(); $$ = new PHINode(Ty); + $$->op_reserve($2->size()*2); while ($2->begin() != $2->end()) { if ($2->front().first->getType() != Ty) ThrowException("All elements of a PHI node must be of the same type!"); From gaeke at cs.uiuc.edu Fri Oct 10 11:56:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 11:56:01 2003 Subject: [llvm-commits] CVS: llvm/include/Support/DynamicLinker.h Message-ID: <200310101655.LAA16943@gally.cs.uiuc.edu> Changes in directory llvm/include/Support: DynamicLinker.h added (r1.1) --- Log message: Add my abstracted dynamic linker support files. --- Diffs of the changes: (+29 -0) Index: llvm/include/Support/DynamicLinker.h diff -c /dev/null llvm/include/Support/DynamicLinker.h:1.1 *** /dev/null Fri Oct 10 11:55:51 2003 --- llvm/include/Support/DynamicLinker.h Fri Oct 10 11:55:40 2003 *************** *** 0 **** --- 1,29 ---- + //===-- DynamicLinker.h - System-indep. DynamicLinker interface -*- C++ -*-===// + // + // Lightweight interface to dynamic library linking and loading, and dynamic + // symbol lookup functionality, in whatever form the operating system + // provides it. + // + //===----------------------------------------------------------------------===// + + #ifndef SUPPORT_DYNAMICLINKER_H + #define SUPPORT_DYNAMICLINKER_H + + #include + + /// LinkDynamicObject - Load the named file as a dynamic library + /// and link it with the currently running process. Returns false + /// on success, true if there is an error (and sets ErrorMessage + /// if it is not NULL). Analogous to dlopen(). + /// + bool LinkDynamicObject (const char *filename, std::string *ErrorMessage); + + /// GetAddressOfSymbol - Returns the address of the named symbol in + /// the currently running process, as reported by the dynamic linker, + /// or NULL if the symbol does not exist or some other error has + /// occurred. + /// + void *GetAddressOfSymbol (const char *symbolName); + void *GetAddressOfSymbol (const std::string &symbolName); + + #endif // SUPPORT_DYNAMICLINKER_H From gaeke at cs.uiuc.edu Fri Oct 10 11:56:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 11:56:09 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/DynamicLinker.cpp Message-ID: <200310101655.LAA16952@gally.cs.uiuc.edu> Changes in directory llvm/lib/Support: DynamicLinker.cpp added (r1.1) --- Log message: Add my abstracted dynamic linker support files. --- Diffs of the changes: (+42 -0) Index: llvm/lib/Support/DynamicLinker.cpp diff -c /dev/null llvm/lib/Support/DynamicLinker.cpp:1.1 *** /dev/null Fri Oct 10 11:55:52 2003 --- llvm/lib/Support/DynamicLinker.cpp Fri Oct 10 11:55:42 2003 *************** *** 0 **** --- 1,42 ---- + //===-- DynamicLinker.cpp - Implement DynamicLinker interface -------------===// + // + // Lightweight interface to dynamic library linking and loading, and dynamic + // symbol lookup functionality, in whatever form the operating system + // provides it. + // + // Possible future extensions include support for the HPUX shl_load() + // interface, the Mac OS X NSLinkModule() interface, and the Windows + // LoadLibrary() interface. + // + // Note that we assume that if dlopen() is available, then dlsym() is too. + // + //===----------------------------------------------------------------------===// + + #include "Support/DynamicLinker.h" + #include "Config/dlfcn.h" + #include + + bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) { + #if defined (HAVE_DLOPEN) + if (dlopen (filename, RTLD_NOW | RTLD_GLOBAL) == 0) { + if (ErrorMessage) *ErrorMessage = dlerror (); + return true; + } + return false; + #else + assert (0 && "Dynamic object linking not implemented for this platform"); + #endif + } + + void *GetAddressOfSymbol (const char *symbolName) { + #if defined (HAVE_DLOPEN) + return dlsym (RTLD_DEFAULT, symbolName); + #else + assert (0 && "Dynamic symbol lookup not implemented for this platform"); + #endif + } + + // soft, cushiony C++ interface. + void *GetAddressOfSymbol (const std::string &symbolName) { + return GetAddressOfSymbol (symbolName.c_str ()); + } From brukman at cs.uiuc.edu Fri Oct 10 11:58:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 11:58:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp Message-ID: <200310101657.LAA21943@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: GraphAuxillary.cpp (r1.17) removed --- Log message: Fixing the spelling of this filename. --- Diffs of the changes: (+0 -0) From gaeke at cs.uiuc.edu Fri Oct 10 12:02:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:02:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/PluginLoader.cpp Message-ID: <200310101701.MAA17355@gally.cs.uiuc.edu> Changes in directory llvm/lib/Support: PluginLoader.cpp updated: 1.4 -> 1.5 --- Log message: Change to use LinkDynamicObject instead of dlopen. --- Diffs of the changes: (+5 -3) Index: llvm/lib/Support/PluginLoader.cpp diff -u llvm/lib/Support/PluginLoader.cpp:1.4 llvm/lib/Support/PluginLoader.cpp:1.5 --- llvm/lib/Support/PluginLoader.cpp:1.4 Mon Jul 28 14:19:58 2003 +++ llvm/lib/Support/PluginLoader.cpp Fri Oct 10 12:01:49 2003 @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "Support/DynamicLinker.h" #include "Support/CommandLine.h" #include "Config/dlfcn.h" #include "Config/link.h" @@ -18,9 +19,10 @@ namespace { struct PluginLoader { void operator=(const std::string &Filename) { - if (dlopen(Filename.c_str(), RTLD_NOW|RTLD_GLOBAL) == 0) - std::cerr << "Error opening '" << Filename << "': " << dlerror() - << "\n -load request ignored.\n"; + std::string ErrorMessage; + if (LinkDynamicObject (Filename.c_str (), &ErrorMessage)) + std::cerr << "Error opening '" << Filename << "': " << ErrorMessage + << "\n -load request ignored.\n"; } }; } From gaeke at cs.uiuc.edu Fri Oct 10 12:03:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:03:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200310101702.MAA17381@gally.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.38 -> 1.39 --- Log message: Change to use strtoul instead of strtoll. --- Diffs of the changes: (+7 -2) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.38 llvm/lib/Support/CommandLine.cpp:1.39 --- llvm/lib/Support/CommandLine.cpp:1.38 Tue Sep 16 13:00:35 2003 +++ llvm/lib/Support/CommandLine.cpp Fri Oct 10 12:01:36 2003 @@ -14,6 +14,8 @@ #include #include #include +#include +#include using namespace cl; @@ -682,9 +684,12 @@ bool parser::parse(Option &O, const char *ArgName, const std::string &Arg, unsigned &Value) { char *End; - long long int V = strtoll(Arg.c_str(), &End, 0); + errno = 0; + unsigned long V = strtoul(Arg.c_str(), &End, 0); Value = (unsigned)V; - if (*End != 0 || V < 0 || Value != V) + if (((V == ULONG_MAX) && (errno == ERANGE)) + || (*End != 0) + || (Value != V)) return O.error(": '" + Arg + "' value invalid for uint argument!"); return false; } From gaeke at cs.uiuc.edu Fri Oct 10 12:03:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:03:09 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200310101702.MAA17433@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.29 -> 1.30 --- Log message: Change to use GetAddressOfSymbol instead of dlsym. --- Diffs of the changes: (+4 -8) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.29 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.30 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.29 Fri Sep 5 15:08:07 2003 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Fri Oct 10 12:02:41 2003 @@ -16,6 +16,7 @@ #include "llvm/Target/TargetData.h" #include "Support/Debug.h" #include "Support/Statistic.h" +#include "Support/DynamicLinker.h" #include "Config/dlfcn.h" Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); @@ -339,14 +340,9 @@ DEBUG(std::cerr << "Global '" << I->getName() << "' -> " << (void*)GlobalAddress[I] << "\n"); } else { - // On Sparc, RTLD_SELF is already defined and it's not zero - // Linux/x86 wants to use a 0, other systems may differ -#ifndef RTLD_SELF -#define RTLD_SELF 0 -#endif - // External variable reference, try to use dlsym to get a pointer to it in - // the LLI image. - if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str())) + // External variable reference. Try to use the dynamic loader to + // get a pointer to it. + if (void *SymAddr = GetAddressOfSymbol(I->getName().c_str())) GlobalAddress[I] = SymAddr; else { std::cerr << "Could not resolve external global address: " From gaeke at cs.uiuc.edu Fri Oct 10 12:03:16 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:03:16 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Intercept.cpp Message-ID: <200310101702.MAA17441@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Intercept.cpp updated: 1.7 -> 1.8 --- Log message: Change to use GetAddressOfSymbol instead of dlsym. --- Diffs of the changes: (+5 -10) Index: llvm/lib/ExecutionEngine/JIT/Intercept.cpp diff -u llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.7 llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.8 --- llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.7 Fri Sep 5 13:42:01 2003 +++ llvm/lib/ExecutionEngine/JIT/Intercept.cpp Fri Oct 10 12:02:42 2003 @@ -1,7 +1,7 @@ //===-- Intercept.cpp - System function interception routines -------------===// // // If a function call occurs to an external function, the JIT is designed to use -// dlsym on the current process to find a function to call. This is useful for +// the dynamic loader interface to find a function to call. This is useful for // calling system calls and library functions that are not available in LLVM. // Some system calls, however, need to be handled specially. For this reason, // we intercept some of them here and use our own stubs to handle them. @@ -9,7 +9,7 @@ //===----------------------------------------------------------------------===// #include "VM.h" -#include "Config/dlfcn.h" // dlsym access +#include "Support/DynamicLinker.h" #include // AtExitHandlers - List of functions to call when the program exits, @@ -50,8 +50,8 @@ //===----------------------------------------------------------------------===// // /// getPointerToNamedFunction - This method returns the address of the specified -/// function by using the dlsym function call. As such it is only useful for -/// resolving library symbols, not code generated symbols. +/// function by using the dynamic loader interface. As such it is only useful +/// for resolving library symbols, not code generated symbols. /// void *VM::getPointerToNamedFunction(const std::string &Name) { // Check to see if this is one of the functions we want to intercept... @@ -59,12 +59,7 @@ if (Name == "atexit") return (void*)&jit_atexit; // If it's an external function, look it up in the process image... - // On Sparc, RTLD_SELF is already defined and it's not zero - // Linux/x86 wants to use a 0, other systems may differ -#ifndef RTLD_SELF -#define RTLD_SELF 0 -#endif - void *Ptr = dlsym(RTLD_SELF, Name.c_str()); + void *Ptr = GetAddressOfSymbol(Name); if (Ptr == 0) { std::cerr << "WARNING: Cannot resolve fn '" << Name << "' using a dummy noop function instead!\n"; From gaeke at cs.uiuc.edu Fri Oct 10 12:04:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:04:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200310101703.MAA17502@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.98 -> 1.99 --- Log message: Never set any signal handlers. Never call setjmp(), longjmp() or strsignal(). --- Diffs of the changes: (+2 -37) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.98 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.99 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.98 Wed Sep 17 12:26:22 2003 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Fri Oct 10 12:03:22 2003 @@ -13,9 +13,7 @@ #include "llvm/Assembly/Writer.h" #include "Support/CommandLine.h" #include "Support/Statistic.h" -#include // For fmod -#include -#include +#include // For fmod Interpreter *TheEE = 0; @@ -38,27 +36,6 @@ // CachedWriter CW; // Object to accelerate printing of LLVM -sigjmp_buf SignalRecoverBuffer; -static bool InInstruction = false; - -extern "C" { -static void SigHandler(int Signal) { - if (InInstruction) - siglongjmp(SignalRecoverBuffer, Signal); -} -} - -static void initializeSignalHandlers() { - struct sigaction Action; - Action.sa_handler = SigHandler; - Action.sa_flags = SA_SIGINFO; - sigemptyset(&Action.sa_mask); - sigaction(SIGSEGV, &Action, 0); - sigaction(SIGBUS, &Action, 0); - sigaction(SIGINT, &Action, 0); - sigaction(SIGFPE, &Action, 0); -} - //===----------------------------------------------------------------------===// // Value Manipulation code @@ -120,7 +97,6 @@ void Interpreter::initializeExecutionEngine() { TheEE = this; - initializeSignalHandlers(); } //===----------------------------------------------------------------------===// @@ -681,8 +657,7 @@ std::cerr << "Out of range memory access to element #" << Idx << " of a " << AT->getNumElements() << " element array." << " Subscript #" << *I << "\n"; - // Get outta here!!! - siglongjmp(SignalRecoverBuffer, SIGTRAP); + abort(); } Ty = ST->getElementType(); @@ -1006,17 +981,7 @@ // Track the number of dynamic instructions executed. ++NumDynamicInsts; - // Set a sigsetjmp buffer so that we can recover if an error happens during - // instruction execution... - // - if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) { - std::cout << "EXCEPTION OCCURRED [" << strsignal(SigNo) << "]\n"; - exit(1); - } - - InInstruction = true; visit(I); // Dispatch to one of the visit* methods... - InInstruction = false; // Reset the current frame location to the top of stack CurFrame = ECStack.size()-1; From gaeke at cs.uiuc.edu Fri Oct 10 12:04:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:04:09 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Message-ID: <200310101703.MAA17525@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: ExternalFunctions.cpp updated: 1.59 -> 1.60 --- Log message: Rewrite head-of-file comment. In lookupFunction(): Change to use "F" for Function argument instead of ancient "M". Remove commented-out code. Change to use GetAddressOfSymbol instead of dlsym. --- Diffs of the changes: (+16 -14) Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.59 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.60 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.59 Thu Oct 9 15:31:18 2003 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri Oct 10 12:03:10 2003 @@ -3,10 +3,12 @@ // This file contains both code to deal with invoking "external" functions, but // also contains code that implements "exported" external functions. // -// External functions in LLI are implemented by dlopen'ing the lli executable -// and using dlsym to look op the functions that we want to invoke. If a -// function is found, then the arguments are mangled and passed in to the -// function call. +// External functions in the interpreter are implemented by +// using the system's dynamic loader to look up the address of the function +// we want to invoke. If a function is found, then one of the +// many lle_* wrapper functions in this file will translate its arguments from +// GenericValues to the types the function is actually expecting, before the +// function is called. // //===----------------------------------------------------------------------===// @@ -21,6 +23,7 @@ #include "Config/link.h" #include #include "Config/stdio.h" +#include "Support/DynamicLinker.h" using std::vector; typedef GenericValue (*ExFunc)(FunctionType *, const vector &); @@ -52,25 +55,24 @@ } } -static ExFunc lookupFunction(const Function *M) { +static ExFunc lookupFunction(const Function *F) { // Function not found, look it up... start by figuring out what the // composite function name should be. std::string ExtName = "lle_"; - const FunctionType *MT = M->getFunctionType(); - for (unsigned i = 0, e = MT->getNumContainedTypes(); i != e; ++i) - ExtName += getTypeID(MT->getContainedType(i)); - ExtName += "_" + M->getName(); + const FunctionType *FT = F->getFunctionType(); + for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i) + ExtName += getTypeID(FT->getContainedType(i)); + ExtName += "_" + F->getName(); - //std::cout << "Tried: '" << ExtName << "'\n"; ExFunc FnPtr = FuncNames[ExtName]; if (FnPtr == 0) - FnPtr = (ExFunc)dlsym(RTLD_DEFAULT, ExtName.c_str()); + FnPtr = (ExFunc)GetAddressOfSymbol(ExtName); if (FnPtr == 0) - FnPtr = FuncNames["lle_X_"+M->getName()]; + FnPtr = FuncNames["lle_X_"+F->getName()]; if (FnPtr == 0) // Try calling a generic function... if it exists... - FnPtr = (ExFunc)dlsym(RTLD_DEFAULT, ("lle_X_"+M->getName()).c_str()); + FnPtr = (ExFunc)GetAddressOfSymbol(("lle_X_"+F->getName()).c_str()); if (FnPtr != 0) - Functions.insert(std::make_pair(M, FnPtr)); // Cache for later + Functions.insert(std::make_pair(F, FnPtr)); // Cache for later return FnPtr; } From gaeke at cs.uiuc.edu Fri Oct 10 12:05:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 12:05:02 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310101704.MAA17607@gally.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.40 -> 1.41 --- Log message: The code that called strsignal is toast. --- Diffs of the changes: (+1 -5) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.40 llvm/autoconf/configure.ac:1.41 --- llvm/autoconf/configure.ac:1.40 Thu Oct 9 20:11:54 2003 +++ llvm/autoconf/configure.ac Fri Oct 10 12:04:43 2003 @@ -477,11 +477,7 @@ fi AC_HEADER_MMAP_ANONYMOUS AC_TYPE_SIGNAL -AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll strsignal) -AC_CHECK_DECLS([sys_siglist],[],[],[ -#if HAVE_SIGNAL_H -#include -#endif]) +AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll) dnl dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED From brukman at cs.uiuc.edu Fri Oct 10 12:30:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:30:01 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/as.cpp Message-ID: <200310101729.MAA13133@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: as.cpp (r1.21) removed --- Log message: Renamed as.cpp => llvm-as.cpp; this should've happened a long time ago. --- Diffs of the changes: (+0 -0) From brukman at cs.uiuc.edu Fri Oct 10 12:31:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:31:01 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-dis/dis.cpp Message-ID: <200310101730.MAA13553@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-dis: dis.cpp (r1.32) removed --- Log message: Renamed dis.cpp => llvm-dis.cpp --- Diffs of the changes: (+0 -0) From brukman at cs.uiuc.edu Fri Oct 10 12:38:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:38:02 2003 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200310101737.MAA14764@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.145 -> 1.146 --- Log message: Print out just the filename being compiled/linked, not the full path to it. --- Diffs of the changes: (+12 -12) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.145 llvm/Makefile.rules:1.146 --- llvm/Makefile.rules:1.145 Fri Oct 10 10:55:43 2003 +++ llvm/Makefile.rules Fri Oct 10 12:37:22 2003 @@ -536,15 +536,15 @@ # I think that is safe. # $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir - @echo "Linking $@" + @echo "Linking `basename $@`" $(VERB) $(Relink) -o $@ $(RObjectsO) $(LibSubDirs) $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir - @echo "Linking $@" + @echo "Linking `basename $@`" $(VERB) $(Relink) -o $@ $(RObjectsP) $(LibSubDirs) $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir - @echo "Linking $@" + @echo "Linking `basename $@`" $(VERB) $(Relink) -o $@ $(RObjectsG) $(LibSubDirs) endif @@ -650,39 +650,39 @@ # Create .lo files in the ObjectFiles directory from the .cpp and .c files... $(BUILD_OBJ_DIR)/Release/%.lo: %.cpp $(BUILD_OBJ_DIR)/Release/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileO) $< -o $@ $(BUILD_OBJ_DIR)/Release/%.lo: %.c $(BUILD_OBJ_DIR)/Release/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileCO) $< -o $@ $(BUILD_OBJ_DIR)/Profile/%.lo: %.cpp $(BUILD_OBJ_DIR)/Profile/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileP) $< -o $@ $(BUILD_OBJ_DIR)/Profile/%.lo: %.c $(BUILD_OBJ_DIR)/Profile/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileCP) $< -o $@ $(BUILD_OBJ_DIR)/Debug/%.lo: %.cpp $(BUILD_OBJ_DIR)/Debug/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileG) $< -o $@ $(BUILD_OBJ_DIR)/Debug/%.lo: %.c $(BUILD_OBJ_DIR)/Debug/.dir - @echo "Compiling $<" + @echo "Compiling `basename $<`" $(VERB) $(CompileCG) $< -o $@ $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.cpp $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1XX) - @echo "Compiling $< to bytecode" + @echo "Compiling `basename $<` to bytecode" $(VERB) $(LLVMGXX) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@ $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.c $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1) - @echo "Compiling $< to bytecode" + @echo "Compiling `basename $<` to bytecode" $(VERB) $(LLVMGCC) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@ $(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.ll $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LLVMAS) - @echo "Compiling $< to bytecode" + @echo "Compiling `basename $<` to bytecode" $(VERB) $(LLVMAS) $< -f -o $@ From brukman at cs.uiuc.edu Fri Oct 10 12:39:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:39:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200310101738.MAA15003@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.7 -> 1.8 --- Log message: Use 'F' for Function instead of 'M'. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.7 llvm/include/llvm/PassManager.h:1.8 --- llvm/include/llvm/PassManager.h:1.7 Tue Sep 30 13:37:37 2003 +++ llvm/include/llvm/PassManager.h Fri Oct 10 12:38:31 2003 @@ -60,7 +60,7 @@ /// track of whether any of the passes modifies the function, and if /// so, return true. /// - bool run(Function &M); + bool run(Function &F); }; #endif From brukman at cs.uiuc.edu Fri Oct 10 12:40:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:40:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Interval.h Message-ID: <200310101739.MAA15035@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Interval.h updated: 1.14 -> 1.15 --- Log message: Fix spelling. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Analysis/Interval.h diff -u llvm/include/llvm/Analysis/Interval.h:1.14 llvm/include/llvm/Analysis/Interval.h:1.15 --- llvm/include/llvm/Analysis/Interval.h:1.14 Wed Oct 1 17:27:36 2003 +++ llvm/include/llvm/Analysis/Interval.h Fri Oct 10 12:39:27 2003 @@ -50,7 +50,7 @@ // Successors - List of BasicBlocks that are reachable directly from nodes in // this interval, but are not in the interval themselves. - // These nodes neccesarily must be header nodes for other intervals. + // These nodes necessarily must be header nodes for other intervals. // std::vector Successors; From brukman at cs.uiuc.edu Fri Oct 10 12:40:10 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:40:10 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200310101739.MAA15019@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.39 -> 1.40 --- Log message: Fix spelling. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.39 llvm/include/llvm/Pass.h:1.40 --- llvm/include/llvm/Pass.h:1.39 Tue Sep 30 13:37:37 2003 +++ llvm/include/llvm/Pass.h Fri Oct 10 12:38:57 2003 @@ -65,7 +65,7 @@ /// implemented in terms of the name that is registered by one of the /// Registration templates, but can be overloaded directly, and if nothing /// else is available, C++ RTTI will be consulted to get a SOMEWHAT - /// intelligable name for the pass. + /// intelligible name for the pass. /// virtual const char *getPassName() const; From brukman at cs.uiuc.edu Fri Oct 10 12:41:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:41:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CallSite.h Message-ID: <200310101740.MAA15057@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CallSite.h updated: 1.5 -> 1.6 --- Log message: Fix spelling. --- Diffs of the changes: (+1 -1) Index: llvm/include/llvm/Support/CallSite.h diff -u llvm/include/llvm/Support/CallSite.h:1.5 llvm/include/llvm/Support/CallSite.h:1.6 --- llvm/include/llvm/Support/CallSite.h:1.5 Tue Jun 17 17:16:59 2003 +++ llvm/include/llvm/Support/CallSite.h Fri Oct 10 12:39:58 2003 @@ -52,7 +52,7 @@ return dyn_cast(getCalledValue()); } - /// setCalledFunction - Set the callee to the specied value... + /// setCalledFunction - Set the callee to the specified value... /// void setCalledFunction(Value *V) { I->setOperand(0, V); From brukman at cs.uiuc.edu Fri Oct 10 12:42:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:42:01 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp Message-ID: <200310101741.MAA15078@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/ModuloScheduling: ModuloScheduling.cpp updated: 1.11 -> 1.12 --- Log message: * Doxygenified comments * Wrap code at 80 columns * Ordered includes according to LLVM style guide --- Diffs of the changes: (+8 -8) Index: llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp diff -u llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.11 llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.12 --- llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.11 Thu Aug 28 12:12:14 2003 +++ llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp Fri Oct 10 12:41:32 2003 @@ -1,14 +1,13 @@ //===-- ModuloScheduling.cpp - Software Pipeling Approach - SMS --*- C++ -*--=// // // The is a software pipelining pass based on the Swing Modulo Scheduling -// alogrithm (SMS). +// algorithm (SMS). // //===----------------------------------------------------------------------===// #include "ModuloSchedGraph.h" - -#include "llvm/Pass.h" #include "llvm/Function.h" +#include "llvm/Pass.h" namespace { @@ -18,18 +17,19 @@ virtual bool runOnFunction(Function &F); }; - RegisterOpt X("modulo-sched", "Modulo Scheduling/Software Pipelining"); + RegisterOpt X("modulo-sched", + "Modulo Scheduling/Software Pipelining"); } -//Create Modulo Scheduling Pass +/// Create Modulo Scheduling Pass +/// Pass *createModuloSchedPass() { return new ModuloScheduling(); } -//ModuloScheduling::runOnFunction - Main transformation entry point. +/// ModuloScheduling::runOnFunction - main transformation entry point +/// bool ModuloScheduling::runOnFunction(Function &F) { bool Changed = false; - return Changed; } - From brukman at cs.uiuc.edu Fri Oct 10 12:43:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:43:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp ExternalFunctions.cpp Message-ID: <200310101742.MAA15099@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.99 -> 1.100 ExternalFunctions.cpp updated: 1.60 -> 1.61 --- Log message: Fix spelling. --- Diffs of the changes: (+2 -2) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.99 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.100 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.99 Fri Oct 10 12:03:22 2003 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Fri Oct 10 12:42:19 2003 @@ -640,7 +640,7 @@ if (const StructType *STy = dyn_cast(Ty)) { const StructLayout *SLO = TD.getStructLayout(STy); - // Indicies must be ubyte constants... + // Indices must be ubyte constants... const ConstantUInt *CPU = cast(*I); assert(CPU->getType() == Type::UByteTy); unsigned Index = CPU->getValue(); Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.60 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.61 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.60 Fri Oct 10 12:03:10 2003 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri Oct 10 12:42:19 2003 @@ -81,7 +81,7 @@ TheInterpreter = this; // Do a lookup to see if the function is in our cache... this should just be a - // defered annotation! + // deferred annotation! std::map::iterator FI = Functions.find(M); ExFunc Fn = (FI == Functions.end()) ? lookupFunction(M) : FI->second; if (Fn == 0) { From brukman at cs.uiuc.edu Fri Oct 10 12:46:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:46:00 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200310101745.MAA15141@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.30 -> 1.31 --- Log message: * Tabs to spaces * Doxygenified function comments * Added FIXMEs to solicit documentation for other functions --- Diffs of the changes: (+16 -8) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.30 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.31 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.30 Fri Oct 10 12:02:41 2003 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Fri Oct 10 12:45:12 2003 @@ -1,4 +1,4 @@ -//===-- ExecutionEngine.cpp - Common Implementation shared by EE's --------===// +//===-- ExecutionEngine.cpp - Common Implementation shared by EEs ---------===// // // This file defines the common interface used by the various execution engine // subclasses. @@ -25,8 +25,10 @@ delete &CurMod; } -ExecutionEngine *ExecutionEngine::create (Module *M, bool ForceInterpreter, - bool TraceMode) { +/// FIXME: document +/// +ExecutionEngine *ExecutionEngine::create(Module *M, bool ForceInterpreter, + bool TraceMode) { ExecutionEngine *EE = 0; // If there is nothing that is forcing us to use the interpreter, make a JIT. @@ -39,9 +41,9 @@ return EE; } -// getPointerToGlobal - This returns the address of the specified global -// value. This may involve code generation if it's a function. -// +/// getPointerToGlobal - This returns the address of the specified global +/// value. This may involve code generation if it's a function. +/// void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) { if (Function *F = const_cast(dyn_cast(GV))) return getPointerToFunction(F); @@ -50,6 +52,8 @@ return GlobalAddress[GV]; } +/// FIXME: document +/// GenericValue ExecutionEngine::getConstantValue(const Constant *C) { GenericValue Result; @@ -133,8 +137,10 @@ return Result; } +/// FIXME: document +/// void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, - const Type *Ty) { + const Type *Ty) { if (getTargetData().isLittleEndian()) { switch (Ty->getPrimitiveID()) { case Type::BoolTyID: @@ -204,6 +210,8 @@ } } +/// FIXME: document +/// GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, const Type *Ty) { GenericValue Result; @@ -338,7 +346,7 @@ NumInitBytes += Size; DEBUG(std::cerr << "Global '" << I->getName() << "' -> " - << (void*)GlobalAddress[I] << "\n"); + << (void*)GlobalAddress[I] << "\n"); } else { // External variable reference. Try to use the dynamic loader to // get a pointer to it. From brukman at cs.uiuc.edu Fri Oct 10 12:48:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:48:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/MappingInfo.cpp SparcRegClassInfo.cpp SparcRegInfo.cpp SparcV9CodeEmitter.cpp Message-ID: <200310101747.MAA15187@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: MappingInfo.cpp updated: 1.12 -> 1.13 SparcRegClassInfo.cpp updated: 1.29 -> 1.30 SparcRegInfo.cpp updated: 1.110 -> 1.111 SparcV9CodeEmitter.cpp updated: 1.33 -> 1.34 --- Log message: Fix spelling. --- Diffs of the changes: (+12 -11) Index: llvm/lib/Target/Sparc/MappingInfo.cpp diff -u llvm/lib/Target/Sparc/MappingInfo.cpp:1.12 llvm/lib/Target/Sparc/MappingInfo.cpp:1.13 --- llvm/lib/Target/Sparc/MappingInfo.cpp:1.12 Thu Sep 18 12:37:25 2003 +++ llvm/lib/Target/Sparc/MappingInfo.cpp Fri Oct 10 12:47:23 2003 @@ -132,7 +132,7 @@ /// Function. MachineBasicBlocks are numbered from begin() to end() /// in the Function's corresponding MachineFunction. Each successive /// MachineBasicBlock increments the numbering by the number of instructions -/// it contains. The side-effect of this method is to fill in the paramete +/// it contains. The side-effect of this method is to fill in the parameter /// KEY with the mapping of MachineBasicBlocks to numbers. KEY /// is keyed on MachineInstrs, so each MachineBasicBlock is represented /// therein by its first MachineInstr. Index: llvm/lib/Target/Sparc/SparcRegClassInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.29 llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.30 --- llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.29 Tue Sep 23 12:28:11 2003 +++ llvm/lib/Target/Sparc/SparcRegClassInfo.cpp Fri Oct 10 12:47:23 2003 @@ -261,7 +261,7 @@ return; } else { - // if we didn't find a color becuase the LR was single precision or + // if we didn't find a color because the LR was single precision or // all f32-f63 range is filled, we try to allocate a register from // the f0 - f31 region @@ -292,7 +292,7 @@ } if (ColorFound >= 0) { - LR->setColor(ColorFound); // first color found in prefered order + LR->setColor(ColorFound); // first color found in preferred order LR->markForSaveAcrossCalls(); } else { // we are here because no color could be found Index: llvm/lib/Target/Sparc/SparcRegInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.110 llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.111 --- llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.110 Mon Sep 1 15:17:13 2003 +++ llvm/lib/Target/Sparc/SparcRegInfo.cpp Fri Oct 10 12:47:23 2003 @@ -466,7 +466,7 @@ } else { - // Now the arg is coming on stack. Since the LR recieved a register, + // Now the arg is coming on stack. Since the LR received a register, // we just have to load the arg on stack into that register // const TargetFrameInfo& frameInfo = target.getFrameInfo(); @@ -522,7 +522,7 @@ else { // Now the arg is coming on stack. Since the LR did NOT - // recieved a register as well, it is allocated a stack position. We + // received a register as well, it is allocated a stack position. We // can simply change the stack position of the LR. We can do this, // since this method is called before any other method that makes // uses of the stack pos of the LR (e.g., updateMachineInstr) Index: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp diff -u llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.33 llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.34 --- llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.33 Tue Sep 30 12:49:41 2003 +++ llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp Fri Oct 10 12:47:23 2003 @@ -366,10 +366,11 @@ RestoreRegisters(DoubleFP, FSR, FPRS, CCR); - // Change the return address to reexecute the restore, then the jump. However, - // we can't just modify %i7 here, because we return to the function that will - // restore the floating-point registers for us. Thus, we just return the value - // we want it to be, and the parent will take care of setting %i7 correctly. + // Change the return address to re-execute the restore, then the jump. + // However, we can't just modify %i7 here, because we return to the function + // that will restore the floating-point registers for us. Thus, we just return + // the value we want it to be, and the parent will take care of setting %i7 + // correctly. DEBUG(std::cerr << "Callback returning to: 0x" << std::hex << (CameFrom-Offset-12) << "\n"); #if defined(sparc) || defined(__sparc__) || defined(__sparcv9) @@ -482,7 +483,7 @@ // only numbered 0-31, hence can already fit into 5 bits (and 6) DEBUG(std::cerr << "FP single reg, returning: " << fakeReg << "\n"); } else if (regType == UltraSparcRegInfo::FPDoubleRegType) { - // FIXME: This assumes that we only have 5-bit register fiels! + // FIXME: This assumes that we only have 5-bit register fields! // From Sparc Manual, page 40. // The bit layout becomes: b[4], b[3], b[2], b[1], b[5] fakeReg |= (fakeReg >> 5) & 1; @@ -624,7 +625,7 @@ int64_t CallInstTarget = (rv - CurrPC) >> 2; if (CallInstTarget >= (1<<29) || CallInstTarget <= -(1<<29)) { DEBUG(std::cerr << "Making far call!\n"); - // addresss is out of bounds for the 30-bit call, + // address is out of bounds for the 30-bit call, // make an indirect jump-and-link emitFarCall(rv); // this invalidates the instruction so that the call with an incorrect From brukman at cs.uiuc.edu Fri Oct 10 12:48:10 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:48:10 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/FloatingPoint.cpp InstSelectSimple.cpp Message-ID: <200310101747.MAA15206@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: FloatingPoint.cpp updated: 1.8 -> 1.9 InstSelectSimple.cpp updated: 1.127 -> 1.128 --- Log message: Fix spelling. --- Diffs of the changes: (+2 -2) Index: llvm/lib/Target/X86/FloatingPoint.cpp diff -u llvm/lib/Target/X86/FloatingPoint.cpp:1.8 llvm/lib/Target/X86/FloatingPoint.cpp:1.9 --- llvm/lib/Target/X86/FloatingPoint.cpp:1.8 Mon Aug 18 09:32:46 2003 +++ llvm/lib/Target/X86/FloatingPoint.cpp Fri Oct 10 12:47:36 2003 @@ -549,7 +549,7 @@ /// handleSpecialFP - Handle special instructions which behave unlike other -/// floating point instructions. This is primarily inteaded for use by pseudo +/// floating point instructions. This is primarily intended for use by pseudo /// instructions. /// void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) { Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.127 llvm/lib/Target/X86/InstSelectSimple.cpp:1.128 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.127 Sun Oct 5 14:15:46 2003 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Fri Oct 10 12:47:36 2003 @@ -1214,7 +1214,7 @@ return; } case cByte: case cShort: case cInt: - break; // Small integerals, handled below... + break; // Small integrals, handled below... default: assert(0 && "Unknown class!"); } From brukman at cs.uiuc.edu Fri Oct 10 12:49:03 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:49:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp ExtractFunction.cpp InlineSimple.cpp MutateStructTypes.cpp Parallelize.cpp Message-ID: <200310101748.MAA15235@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: DeadArgumentElimination.cpp updated: 1.5 -> 1.6 ExtractFunction.cpp updated: 1.2 -> 1.3 InlineSimple.cpp updated: 1.52 -> 1.53 MutateStructTypes.cpp updated: 1.38 -> 1.39 Parallelize.cpp updated: 1.8 -> 1.9 --- Log message: Fix spelling. --- Diffs of the changes: (+7 -7) Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.5 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.6 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.5 Thu Sep 11 10:31:17 2003 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri Oct 10 12:48:12 2003 @@ -232,7 +232,7 @@ bool DAE::run(Module &M) { // First phase: loop through the module, determining which arguments are live. // We assume all arguments are dead unless proven otherwise (allowing us to - // determing that dead arguments passed into recursive functions are dead). + // determine that dead arguments passed into recursive functions are dead). // std::set LiveArguments, MaybeLiveArguments, DeadArguments; std::multimap CallSites; Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.2 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.3 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.2 Wed Apr 16 15:28:39 2003 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Fri Oct 10 12:48:12 2003 @@ -15,7 +15,7 @@ if (Named == 0) return false; // No function to extract } - // Make sure our result is globally accessable... + // Make sure our result is globally accessible... Named->setLinkage(GlobalValue::ExternalLinkage); // Mark all global variables internal Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.52 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.53 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.52 Tue Oct 7 14:33:31 2003 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Fri Oct 10 12:48:12 2003 @@ -52,7 +52,7 @@ if (Callee->use_size() == 1 && Callee->hasInternalLinkage()) InlineCost -= 30000; - // Add to the inline quality for properties that make the call valueable to + // Add to the inline quality for properties that make the call valuable to // inline. This includes factors that indicate that the result of inlining // the function will be optimizable. Currently this just looks at arguments // passed into the function. Index: llvm/lib/Transforms/IPO/MutateStructTypes.cpp diff -u llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.38 llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.39 --- llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.38 Mon Sep 8 13:54:53 2003 +++ llvm/lib/Transforms/IPO/MutateStructTypes.cpp Fri Oct 10 12:48:12 2003 @@ -93,7 +93,7 @@ } -// AdjustIndices - Convert the indexes specifed by Idx to the new changed form +// AdjustIndices - Convert the indices specified by Idx to the new changed form // using the specified OldTy as the base type being indexed into. // void MutateStructTypes::AdjustIndices(const CompositeType *OldTy, Index: llvm/lib/Transforms/IPO/Parallelize.cpp diff -u llvm/lib/Transforms/IPO/Parallelize.cpp:1.8 llvm/lib/Transforms/IPO/Parallelize.cpp:1.9 --- llvm/lib/Transforms/IPO/Parallelize.cpp:1.8 Mon Sep 1 13:01:36 2003 +++ llvm/lib/Transforms/IPO/Parallelize.cpp Fri Oct 10 12:48:12 2003 @@ -81,7 +81,7 @@ // class Cilkifier // // Code generation pass that transforms code to identify where Cilk keywords -// should be inserted. This relies on dis -c to print out the keywords. +// should be inserted. This relies on `llvm-dis -c' to print out the keywords. //---------------------------------------------------------------------------- @@ -167,7 +167,7 @@ else syncI = new CallInst(DummySyncFunc, std::vector(), "", I); - // Remember the sync for each spawn to eliminate rendundant ones later + // Remember the sync for each spawn to eliminate redundant ones later spawnToSyncsMap[cast(root)].insert(syncI); return; @@ -494,7 +494,7 @@ #undef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS #ifdef CAN_USE_BIND1ST_ON_REFERENCE_TYPE_ARGS - // Use this undecipherable STLese because erase invalidates iterators. + // Use this indecipherable STLese because erase invalidates iterators. // Otherwise we have to copy sets as above. hash_set::iterator extrasBegin = std::remove_if(parallelFunctions.begin(), parallelFunctions.end(), From brukman at cs.uiuc.edu Fri Oct 10 12:50:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:50:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp GraphAuxiliary.cpp ProfilePaths.cpp Message-ID: <200310101749.MAA15256@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: Graph.cpp updated: 1.10 -> 1.11 GraphAuxiliary.cpp updated: 1.17 -> 1.18 ProfilePaths.cpp updated: 1.33 -> 1.34 --- Log message: Fix spelling. --- Diffs of the changes: (+11 -11) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.10 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.11 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.10 Fri Aug 1 17:15:02 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp Fri Oct 10 12:49:04 2003 @@ -174,7 +174,7 @@ //add an edge //this adds an edge ONLY when -//the edge to be added doesn not already exist +//the edge to be added does not already exist //we "equate" two edges here only with their //end points void Graph::addEdge(Edge ed, int w){ @@ -497,7 +497,7 @@ //reverse the sign of weights on edges //this way, max-spanning tree could be obtained -//usin min-spanning tree, and vice versa +//using min-spanning tree, and vice versa void Graph::reverseWts(){ vector allNodes=getAllNodes(); for(vector::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.17 llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.18 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.17 Wed Sep 10 15:35:21 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp Fri Oct 10 12:49:04 2003 @@ -1,6 +1,6 @@ -//===-- GrapAuxillary.cpp- Auxillary functions on graph ----------*- C++ -*--=// +//===-- GrapAuxiliary.cpp- Auxiliary functions on graph ----------*- C++ -*--=// // -//auxillary function associated with graph: they +//auxiliary function associated with graph: they //all operate on graph, and help in inserting //instrumentation for trace generation // @@ -132,7 +132,7 @@ } //This is a helper function to get the edge increments -//This is used in conjuntion with inc_DFS +//This is used in conjunction with inc_DFS //to get the edge increments //Edge increment implies assigning a value to all the edges in the graph //such that if we traverse along any path from root to exit, and @@ -144,7 +144,7 @@ if(e.isNull()) return 1; - //check that the edges must have atleast one common endpoint + //check that the edges must have at least one common endpoint assert(*(e.getFirst())==*(f.getFirst()) || *(e.getFirst())==*(f.getSecond()) || *(e.getSecond())==*(f.getFirst()) || Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.33 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.34 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.33 Wed Sep 24 17:06:25 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Fri Oct 10 12:49:04 2003 @@ -1,6 +1,6 @@ //===-- ProfilePaths.cpp - interface to insert instrumentation ---*- C++ -*--=// // -// This inserts intrumentation for counting +// This inserts instrumentation for counting // execution of paths though a given function // Its implemented as a "Function" Pass, and called using opt // @@ -13,7 +13,7 @@ // // The algorithms work on a Graph constructed over the nodes // made from Basic Blocks: The transformations then take place on -// the constucted graph (implementation in Graph.cpp and GraphAuxillary.cpp) +// the constructed graph (implementation in Graph.cpp and GraphAuxiliary.cpp) // and finally, appropriate instrumentation is placed over suitable edges. // (code inserted through EdgeCode.cpp). // @@ -81,7 +81,7 @@ Node *tmp; Node *exitNode = 0, *startNode = 0; - // The nodes must be uniquesly identified: + // The nodes must be uniquely identified: // That is, no two nodes must hav same BB* for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB) { @@ -93,7 +93,7 @@ startNode=nd; } - // now do it againto insert edges + // now do it again to insert edges for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB){ Node *nd=findBB(nodes, BB); assert(nd && "No node for this edge!"); @@ -174,7 +174,7 @@ if(fr->getParent()->getName() == "main"){ - //intialize threshold + //initialize threshold // FIXME: THIS IS HORRIBLY BROKEN. FUNCTION PASSES CANNOT DO THIS, EXCEPT // IN THEIR INITIALIZE METHOD!! From brukman at cs.uiuc.edu Fri Oct 10 12:52:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:52:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp CorrelatedExprs.cpp GCSE.cpp IndVarSimplify.cpp LICM.cpp LoopPreheaders.cpp PiNodeInsertion.cpp SCCP.cpp Message-ID: <200310101751.MAA15294@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.62 -> 1.63 CorrelatedExprs.cpp updated: 1.14 -> 1.15 GCSE.cpp updated: 1.28 -> 1.29 IndVarSimplify.cpp updated: 1.38 -> 1.39 LICM.cpp updated: 1.35 -> 1.36 LoopPreheaders.cpp updated: 1.16 -> 1.17 PiNodeInsertion.cpp updated: 1.10 -> 1.11 SCCP.cpp updated: 1.78 -> 1.79 --- Log message: Fix spelling. --- Diffs of the changes: (+17 -17) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.62 llvm/lib/Transforms/Scalar/ADCE.cpp:1.63 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.62 Sat Sep 20 09:38:50 2003 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Fri Oct 10 12:50:50 2003 @@ -259,7 +259,7 @@ // Loop over all of the instructions in the function, telling dead // instructions to drop their references. This is so that the next sweep // over the program can safely delete dead instructions without other dead - // instructions still refering to them. + // instructions still referring to them. // dropReferencesOfDeadInstructionsInLiveBlock(I); @@ -328,9 +328,9 @@ if (LastNode == 0) { // No postdominator! // Call RemoveSuccessor to transmogrify the terminator instruction // to not contain the outgoing branch, or to create a new - // terminator if the form fundementally changes (ie unconditional - // branch to return). Note that this will change a branch into an - // infinite loop into a return instruction! + // terminator if the form fundamentally changes (i.e., + // unconditional branch to return). Note that this will change a + // branch into an infinite loop into a return instruction! // RemoveSuccessor(TI, i); @@ -378,7 +378,7 @@ // Now loop over all of the instructions in the basic block, telling // dead instructions to drop their references. This is so that the next // sweep over the program can safely delete dead instructions without - // other dead instructions still refering to them. + // other dead instructions still referring to them. // dropReferencesOfDeadInstructionsInLiveBlock(BB); } Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.14 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.15 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.14 Sat Sep 20 09:38:50 2003 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Fri Oct 10 12:50:50 2003 @@ -121,7 +121,7 @@ void setReplacement(Value *Repl) { Replacement = Repl; } // getRelation - return the relationship entry for the specified value. - // This can invalidate references to other Relation's, so use it carefully. + // This can invalidate references to other Relations, so use it carefully. // Relation &getRelation(Value *V) { // Binary search for V's entry... @@ -896,7 +896,7 @@ return; } - // If the information propogted is new, then we want process the uses of this + // If the information propagated is new, then we want process the uses of this // instruction to propagate the information down to them. // if (Op1R.incorporate(Opcode, VI)) Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.28 llvm/lib/Transforms/Scalar/GCSE.cpp:1.29 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.28 Mon Jun 16 22:57:18 2003 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Fri Oct 10 12:50:50 2003 @@ -193,7 +193,7 @@ Instruction *Ret = 0; if (BB1 == BB2) { - // Eliminate the second occuring instruction. Add all uses of the second + // Eliminate the second occurring instruction. Add all uses of the second // instruction to the worklist. // // Scan the basic block looking for the "first" instruction @@ -242,7 +242,7 @@ // ... X+Y ... // } // - // In thiscase, the expression would be hoisted to outside the 'if' stmt, + // In this case, the expression would be hoisted to outside the 'if' stmt, // causing the expression to be evaluated, even for the if (d) path, which // could cause problems, if, for example, it caused a divide by zero. In // general the problem this case is trying to solve is better addressed with Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.38 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.39 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.38 Tue Sep 23 15:26:48 2003 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Oct 10 12:50:50 2003 @@ -50,7 +50,7 @@ BasicBlock::iterator AfterPHIIt = Header->begin(); for (; PHINode *PN = dyn_cast(AfterPHIIt); ++AfterPHIIt) IndVars.push_back(InductionVariable(PN, Loops)); - // AfterPHIIt now points to first nonphi instruction... + // AfterPHIIt now points to first non-phi instruction... // If there are no phi nodes in this basic block, there can't be indvars... if (IndVars.empty()) return Changed; Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.35 llvm/lib/Transforms/Scalar/LICM.cpp:1.36 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.35 Sun Oct 5 16:20:02 2003 +++ llvm/lib/Transforms/Scalar/LICM.cpp Fri Oct 10 12:50:50 2003 @@ -77,7 +77,7 @@ /// HoistRegion - Walk the specified region of the CFG (defined by all /// blocks dominated by the specified block, and that are in the current /// loop) in depth first order w.r.t the DominatorTree. This allows us to - /// visit defintions before uses, allowing us to hoist a loop body in one + /// visit definitions before uses, allowing us to hoist a loop body in one /// pass without iteration. /// void HoistRegion(DominatorTree::Node *N); @@ -240,7 +240,7 @@ /// HoistRegion - Walk the specified region of the CFG (defined by all blocks /// dominated by the specified block, and that are in the current loop) in depth -/// first order w.r.t the DominatorTree. This allows us to visit defintions +/// first order w.r.t the DominatorTree. This allows us to visit definitions /// before uses, allowing us to hoist a loop body in one pass without iteration. /// void LICM::HoistRegion(DominatorTree::Node *N) { Index: llvm/lib/Transforms/Scalar/LoopPreheaders.cpp diff -u llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.16 llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.17 --- llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.16 Thu Sep 11 11:26:11 2003 +++ llvm/lib/Transforms/Scalar/LoopPreheaders.cpp Fri Oct 10 12:50:50 2003 @@ -13,7 +13,7 @@ // as store-sinking that are built into LICM. // // Note that the simplifycfg pass will clean up blocks which are split out but -// end up being unnecessary, so usage of this pass does not neccesarily +// end up being unnecessary, so usage of this pass does not necessarily // pessimize generated code. // //===----------------------------------------------------------------------===// @@ -203,7 +203,7 @@ SplitBlockPredecessors(Header, ".preheader", OutsideBlocks); //===--------------------------------------------------------------------===// - // Update analysis results now that we have preformed the transformation + // Update analysis results now that we have performed the transformation // // We know that we have loop information to update... update it now. Index: llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp diff -u llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.10 llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.11 --- llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.10 Wed Sep 10 00:29:03 2003 +++ llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp Fri Oct 10 12:50:50 2003 @@ -1,7 +1,7 @@ //===- PiNodeInsertion.cpp - Insert Pi nodes into a program ---------------===// // // PiNodeInsertion - This pass inserts single entry Phi nodes into basic blocks -// that are preceeded by a conditional branch, where the branch gives +// that are preceded by a conditional branch, where the branch gives // information about the operands of the condition. For example, this C code: // if (x == 0) { ... = x + 4; // becomes: @@ -15,7 +15,7 @@ // saying that X has a value of 0 in this scope. The power of this analysis // information is that "in the scope" translates to "for all uses of x2". // -// This special form of Phi node is refered to as a Pi node, following the +// This special form of Phi node is referred to as a Pi node, following the // terminology defined in the "Array Bounds Checks on Demand" paper. // // As a really trivial example of what the Pi nodes are good for, this pass Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.78 llvm/lib/Transforms/Scalar/SCCP.cpp:1.79 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.78 Wed Oct 8 11:56:11 2003 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Oct 10 12:50:50 2003 @@ -499,7 +499,7 @@ // this is the case, the PHI remains undefined. // if (OperandVal) - markConstant(PNIV, &PN, OperandVal); // Aquire operand value + markConstant(PNIV, &PN, OperandVal); // Acquire operand value } void SCCP::visitTerminatorInst(TerminatorInst &TI) { From brukman at cs.uiuc.edu Fri Oct 10 12:52:09 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:52:09 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp BreakCriticalEdges.cpp CloneModule.cpp Linker.cpp SimplifyCFG.cpp Message-ID: <200310101751.MAA15315@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BasicBlockUtils.cpp updated: 1.6 -> 1.7 BreakCriticalEdges.cpp updated: 1.9 -> 1.10 CloneModule.cpp updated: 1.5 -> 1.6 Linker.cpp updated: 1.54 -> 1.55 SimplifyCFG.cpp updated: 1.15 -> 1.16 --- Log message: Fix spelling. --- Diffs of the changes: (+9 -9) Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp diff -u llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1.6 llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1.7 --- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1.6 Mon Aug 18 09:34:00 2003 +++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp Fri Oct 10 12:51:20 2003 @@ -64,7 +64,7 @@ // degree of the current basic block, the actual terminator instruction itself // may have to be changed. In the case where the last successor of the block is // deleted, a return instruction is inserted in its place which can cause a -// suprising change in program behavior if it is not expected. +// surprising change in program behavior if it is not expected. // void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { assert(SuccNum < TI->getNumSuccessors() && Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.9 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.10 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.9 Wed Apr 23 11:37:43 2003 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Fri Oct 10 12:51:20 2003 @@ -106,7 +106,7 @@ DS->addBasicBlock(NewBB, DomSet); } - // Should we update ImmdediateDominator information? + // Should we update ImmediateDominator information? if (ImmediateDominators *ID = P->getAnalysisToUpdate()) { // TIBB is the new immediate dominator for NewBB. NewBB doesn't dominate // anything. Index: llvm/lib/Transforms/Utils/CloneModule.cpp diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.5 llvm/lib/Transforms/Utils/CloneModule.cpp:1.6 --- llvm/lib/Transforms/Utils/CloneModule.cpp:1.5 Thu Apr 24 12:15:33 2003 +++ llvm/lib/Transforms/Utils/CloneModule.cpp Fri Oct 10 12:51:20 2003 @@ -14,7 +14,7 @@ /// CloneModule - Return an exact copy of the specified module. This is not as /// easy as it might seem because we have to worry about making copies of global -/// variables and functions, and making their (intializers and references, +/// variables and functions, and making their (initializers and references, /// respectively) refer to the right globals. /// Module *CloneModule(const Module *M) { Index: llvm/lib/Transforms/Utils/Linker.cpp diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.54 llvm/lib/Transforms/Utils/Linker.cpp:1.55 --- llvm/lib/Transforms/Utils/Linker.cpp:1.54 Thu Aug 28 11:42:50 2003 +++ llvm/lib/Transforms/Utils/Linker.cpp Fri Oct 10 12:51:20 2003 @@ -151,9 +151,9 @@ SymbolTable::const_iterator PI = SrcST->find(Type::TypeTy); if (PI == SrcST->end()) return false; // No named types, do nothing. - // Some types cannot be resolved immediately becuse they depend on other types - // being resolved to each other first. This contains a list of types we are - // waiting to recheck. + // Some types cannot be resolved immediately because they depend on other + // types being resolved to each other first. This contains a list of types we + // are waiting to recheck. std::vector DelayedTypesToResolve; const SymbolTable::VarMap &VM = PI->second; Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.15 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.16 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.15 Mon Sep 8 14:44:25 2003 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 10 12:51:20 2003 @@ -19,7 +19,7 @@ // have extra slots added to them to hold the merge edges from BB's // predecessors, and BB itself might have had PHI nodes in it. This function // returns true (failure) if the Succ BB already has a predecessor that is a -// predecessor of BB and incoming PHI arguments would not be discernable. +// predecessor of BB and incoming PHI arguments would not be discernible. // // Assumption: Succ is the single successor for BB. // @@ -269,10 +269,10 @@ // Delete the unconditional branch from the predecessor... OnlyPred->getInstList().pop_back(); - // Move all definitions in the succecessor to the predecessor... + // Move all definitions in the successor to the predecessor... OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList()); - // Make all PHI nodes that refered to BB now refer to Pred as their + // Make all PHI nodes that referred to BB now refer to Pred as their // source... BB->replaceAllUsesWith(OnlyPred); From brukman at cs.uiuc.edu Fri Oct 10 12:52:18 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:52:18 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp TransformInternals.cpp Message-ID: <200310101751.MAA15340@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.77 -> 1.78 TransformInternals.cpp updated: 1.36 -> 1.37 --- Log message: Fix spelling. --- Diffs of the changes: (+4 -4) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.77 llvm/lib/Transforms/ExprTypeConvert.cpp:1.78 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.77 Mon Aug 18 09:33:06 2003 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Fri Oct 10 12:51:40 2003 @@ -104,7 +104,7 @@ // If we have a scale, apply it first... if (Expr.Var) { - // Expr.Var is not neccesarily unsigned right now, insert a cast now. + // Expr.Var is not necessarily unsigned right now, insert a cast now. if (Expr.Var->getType() != Type::UIntTy) Expr.Var = new CastInst(Expr.Var, Type::UIntTy, Expr.Var->getName()+"-uint", It); @@ -255,7 +255,7 @@ // Do not Check to see if our incoming pointer can be converted // to be a ptr to an array of the right type... because in more cases than // not, it is simply not analyzable because of pointer/array - // discrepencies. To fix this, we will insert a cast before the GEP. + // discrepancies. To fix this, we will insert a cast before the GEP. // // Check to see if 'N' is an expression that can be converted to @@ -1169,7 +1169,7 @@ Name = ""; // Make sure not to name a void call! // Get an iterator to the call instruction so that we can insert casts for - // operands if needbe. Note that we do not require operands to be + // operands if need be. Note that we do not require operands to be // convertible, we can insert casts if they are convertible but not // compatible. The reason for this is that we prefer to have resolved // functions but casted arguments if possible. Index: llvm/lib/Transforms/TransformInternals.cpp diff -u llvm/lib/Transforms/TransformInternals.cpp:1.36 llvm/lib/Transforms/TransformInternals.cpp:1.37 --- llvm/lib/Transforms/TransformInternals.cpp:1.36 Mon Jun 23 12:36:49 2003 +++ llvm/lib/Transforms/TransformInternals.cpp Fri Oct 10 12:51:40 2003 @@ -64,7 +64,7 @@ Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize)); ThisOffset = (Offset/ChildSize)*ChildSize; } else { - Offset = 0; // Return the offset that we were able to acheive + Offset = 0; // Return the offset that we were able to achieve return Ty; // Return the leaf type } From brukman at cs.uiuc.edu Fri Oct 10 12:55:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:55:01 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Function.cpp Instruction.cpp Module.cpp SymbolTableListTraitsImpl.h Type.cpp Verifier.cpp Message-ID: <200310101754.MAA15402@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.98 -> 1.99 Function.cpp updated: 1.51 -> 1.52 Instruction.cpp updated: 1.25 -> 1.26 Module.cpp updated: 1.39 -> 1.40 SymbolTableListTraitsImpl.h updated: 1.3 -> 1.4 Type.cpp updated: 1.74 -> 1.75 Verifier.cpp updated: 1.62 -> 1.63 --- Log message: Fix spelling/grammar. --- Diffs of the changes: (+17 -17) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.98 llvm/lib/VMCore/AsmWriter.cpp:1.99 --- llvm/lib/VMCore/AsmWriter.cpp:1.98 Mon Sep 8 12:45:57 2003 +++ llvm/lib/VMCore/AsmWriter.cpp Fri Oct 10 12:54:14 2003 @@ -420,7 +420,7 @@ } if (Slot >= 0) Out << "%" << Slot; else if (PrintName) - Out << ""; // Not embeded into a location? + Out << ""; // Not embedded into a location? } } } @@ -708,7 +708,7 @@ Out << ""; } -// printBasicBlock - This member is called for each basic block in a methd. +// printBasicBlock - This member is called for each basic block in a method. // void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { if (BB->hasName()) { // Print out the label if it exists... @@ -762,7 +762,7 @@ } } -// printInstruction - This member is called for each Instruction in a methd. +// printInstruction - This member is called for each Instruction in a method. // void AssemblyWriter::printInstruction(const Instruction &I) { Out << "\t"; Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.51 llvm/lib/VMCore/Function.cpp:1.52 --- llvm/lib/VMCore/Function.cpp:1.51 Fri Sep 19 14:31:41 2003 +++ llvm/lib/VMCore/Function.cpp Fri Oct 10 12:54:14 2003 @@ -140,7 +140,7 @@ // go" of all references that they are maintaining. This allows one to // 'delete' a whole class at a time, even though there may be circular // references... first all references are dropped, and all use counts go to -// zero. Then everything is delete'd for real. Note that no operations are +// zero. Then everything is deleted for real. Note that no operations are // valid on an object that has "dropped all references", except operator // delete. // @@ -152,7 +152,7 @@ /// getIntrinsicID - This method returns the ID number of the specified /// function, or LLVMIntrinsic::not_intrinsic if the function is not an -/// instrinsic, or if the pointer is null. This value is always defined to be +/// intrinsic, or if the pointer is null. This value is always defined to be /// zero to allow easy checking for whether a function is intrinsic or not. The /// particular intrinsic functions which correspond to this value are defined in /// llvm/Intrinsics.h. Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.25 llvm/lib/VMCore/Instruction.cpp:1.26 --- llvm/lib/VMCore/Instruction.cpp:1.25 Mon Sep 8 13:54:36 2003 +++ llvm/lib/VMCore/Instruction.cpp Fri Oct 10 12:54:14 2003 @@ -119,7 +119,7 @@ /// isCommutative - Return true if the instruction is commutative: /// -/// Commutative operators satistify: (x op y) === (y op x) +/// Commutative operators satisfy: (x op y) === (y op x) /// /// In LLVM, these are the associative operators, plus SetEQ and SetNE, when /// applied to any type. Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.39 llvm/lib/VMCore/Module.cpp:1.40 --- llvm/lib/VMCore/Module.cpp:1.39 Sat Aug 30 19:19:28 2003 +++ llvm/lib/VMCore/Module.cpp Fri Oct 10 12:54:14 2003 @@ -232,7 +232,7 @@ // of all references that they are maintaining. This allows one to 'delete' a // whole module at a time, even though there may be circular references... first // all references are dropped, and all use counts go to zero. Then everything -// is delete'd for real. Note that no operations are valid on an object that +// is deleted for real. Note that no operations are valid on an object that // has "dropped all references", except operator delete. // void Module::dropAllReferences() { Index: llvm/lib/VMCore/SymbolTableListTraitsImpl.h diff -u llvm/lib/VMCore/SymbolTableListTraitsImpl.h:1.3 llvm/lib/VMCore/SymbolTableListTraitsImpl.h:1.4 --- llvm/lib/VMCore/SymbolTableListTraitsImpl.h:1.3 Wed Nov 20 12:33:41 2002 +++ llvm/lib/VMCore/SymbolTableListTraitsImpl.h Fri Oct 10 12:54:14 2003 @@ -62,11 +62,11 @@ ::transferNodesFromList(iplist > &L2, ilist_iterator first, ilist_iterator last) { - // We only have to do work here if transfering instructions between BB's + // We only have to do work here if transferring instructions between BBs ItemParentClass *NewIP = ItemParent, *OldIP = L2.ItemParent; if (NewIP == OldIP) return; // No work to do at all... - // We only have to update symbol table entries if we are transfering the + // We only have to update symbol table entries if we are transferring the // instructions to a different symtab object... SymTabClass *NewSTO = SymTabObject, *OldSTO = L2.SymTabObject; if (NewSTO != OldSTO) { @@ -80,7 +80,7 @@ NewSTO->getSymbolTable().insert(&V); } } else { - // Just transfering between blocks in the same function, simply update the + // Just transferring between blocks in the same function, simply update the // parent fields in the instructions... for (; first != last; ++first) first->setParent(NewIP); Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.74 llvm/lib/VMCore/Type.cpp:1.75 --- llvm/lib/VMCore/Type.cpp:1.74 Fri Oct 3 14:02:41 2003 +++ llvm/lib/VMCore/Type.cpp Fri Oct 10 12:54:14 2003 @@ -104,7 +104,7 @@ } } -// getPrimitiveSize - Return the basic size of this type if it is a primative +// getPrimitiveSize - Return the basic size of this type if it is a primitive // type. These are fixed by LLVM and are not target dependent. This will // return zero if the type does not have a size or is not a primitive type. // @@ -273,7 +273,7 @@ //===----------------------------------------------------------------------===// -// Auxilliary classes +// Auxiliary classes //===----------------------------------------------------------------------===// // // These classes are used to implement specialized behavior for each different @@ -452,7 +452,7 @@ if (Ty->getPrimitiveID() != Ty2->getPrimitiveID()) return false; if (Ty->isPrimitiveType()) return true; if (isa(Ty)) - return false; // Two nonequal opaque types are never equal + return false; // Two unequal opaque types are never equal std::map::iterator It = EqTypes.find(Ty); if (It != EqTypes.end()) @@ -825,7 +825,7 @@ // removeAbstractTypeUser - Notify an abstract type that a user of the class // no longer has a handle to the type. This function is called primarily by // the PATypeHandle class. When there are no users of the abstract type, it -// is anihilated, because there is no way to get a reference to it ever again. +// is annihilated, because there is no way to get a reference to it ever again. // void DerivedType::removeAbstractTypeUser(AbstractTypeUser *U) const { // Search from back to front because we will notify users from back to Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.62 llvm/lib/VMCore/Verifier.cpp:1.63 --- llvm/lib/VMCore/Verifier.cpp:1.62 Sun Oct 5 12:44:18 2003 +++ llvm/lib/VMCore/Verifier.cpp Fri Oct 10 12:54:14 2003 @@ -20,11 +20,11 @@ // * PHI nodes must have at least one entry // * All basic blocks should only end with terminator insts, not contain them // * The entry node to a function must not have predecessors -// * All Instructions must be embeded into a basic block +// * All Instructions must be embedded into a basic block // . Function's cannot take a void typed parameter // * Verify that a function's argument list agrees with it's declared type. // * It is illegal to specify a name for a void value. -// * It is illegal to have a internal global value with no intitalizer +// * It is illegal to have a internal global value with no initializer // * It is illegal to have a ret instruction that returns a value that does not // agree with the function return value type. // * Function call argument types match the function prototype @@ -325,7 +325,7 @@ void Verifier::visitPHINode(PHINode &PN) { // Ensure that the PHI nodes are all grouped together at the top of the block. // This can be tested by checking whether the instruction before this is - // either nonexistant (because this is begin()) or is a PHI node. If not, + // either nonexistent (because this is begin()) or is a PHI node. If not, // then there is some other instruction before a PHI. Assert2(&PN.getParent()->front() == &PN || isa(PN.getPrev()), "PHI nodes not grouped at top of basic block!", From lattner at cs.uiuc.edu Fri Oct 10 12:55:11 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 12:55:11 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C/globalrefs.c Message-ID: <200310101754.MAA18057@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Regression/C: globalrefs.c updated: 1.3 -> 1.4 --- Log message: Do not take pointer difference between two different GLOBALS ! --- Diffs of the changes: (+0 -1) Index: llvm/test/Programs/SingleSource/Regression/C/globalrefs.c diff -u llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.3 llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.4 --- llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.3 Thu Oct 2 14:43:08 2003 +++ llvm/test/Programs/SingleSource/Regression/C/globalrefs.c Fri Oct 10 12:54:49 2003 @@ -40,7 +40,6 @@ printf("sizeof(struct Test) = %d\n\n", (int)sizeof(struct test)); printdiff(&TestArray[3], TestArray); - printdiff(&Test1.A, &TestArray[3]); printdiff(&Test1.S.Y, &Test1.A); printdiff(&Test1.next, &Test1.S.Y); printf("\n"); From brukman at cs.uiuc.edu Fri Oct 10 12:56:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:56:00 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp OptimizerDriver.cpp Message-ID: <200310101755.MAA15423@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.18 -> 1.19 OptimizerDriver.cpp updated: 1.11 -> 1.12 --- Log message: Fix spelling. --- Diffs of the changes: (+5 -5) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.18 llvm/tools/bugpoint/CrashDebugger.cpp:1.19 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.18 Mon Aug 18 09:38:08 2003 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Oct 10 12:55:03 2003 @@ -91,7 +91,7 @@ }; bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { - // Clone the program to try hacking it appart... + // Clone the program to try hacking it apart... Module *M = CloneModule(BD.Program); // Convert list to set for fast lookup... @@ -153,7 +153,7 @@ }; bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { - // Clone the program to try hacking it appart... + // Clone the program to try hacking it apart... Module *M = CloneModule(BD.Program); // Convert list to set for fast lookup... Index: llvm/tools/bugpoint/OptimizerDriver.cpp diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.11 llvm/tools/bugpoint/OptimizerDriver.cpp:1.12 --- llvm/tools/bugpoint/OptimizerDriver.cpp:1.11 Thu Aug 7 16:42:28 2003 +++ llvm/tools/bugpoint/OptimizerDriver.cpp Fri Oct 10 12:55:03 2003 @@ -1,8 +1,8 @@ //===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===// // // This file defines an interface that allows bugpoint to run various passes -// without the threat of a buggy pass corrupting bugpoint (of course bugpoint -// may have it's own bugs, but that's another story...). It acheives this by +// without the threat of a buggy pass corrupting bugpoint (of course, bugpoint +// may have its own bugs, but that's another story...). It achieves this by // forking a copy of itself and having the child process do the optimizations. // If this client dies, we can always fork a new one. :) // @@ -95,7 +95,7 @@ } /// runPasses - Run the specified passes on Program, outputting a bytecode file -/// and writting the filename into OutputFile if successful. If the +/// and writing the filename into OutputFile if successful. If the /// optimizations fail for some reason (optimizer crashes), return true, /// otherwise return false. If DeleteOutput is set to true, the bytecode is /// deleted on success, and the filename string is undefined. This prints to From brukman at cs.uiuc.edu Fri Oct 10 12:56:09 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:56:09 2003 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200310101755.MAA15435@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.75 -> 1.76 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.75 llvm/tools/gccas/gccas.cpp:1.76 --- llvm/tools/gccas/gccas.cpp:1.75 Sat Sep 20 00:26:22 2003 +++ llvm/tools/gccas/gccas.cpp Fri Oct 10 12:55:17 2003 @@ -117,7 +117,7 @@ else { Out = new std::ofstream(OutputFilename.c_str(), std::ios::out); - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // signal RemoveFileOnSignal(OutputFilename); } From brukman at cs.uiuc.edu Fri Oct 10 12:56:18 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:56:18 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/gccld.cpp Message-ID: <200310101755.MAA15448@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: gccld.cpp updated: 1.54 -> 1.55 --- Log message: Fix spelling. --- Diffs of the changes: (+2 -1) Index: llvm/tools/gccld/gccld.cpp diff -u llvm/tools/gccld/gccld.cpp:1.54 llvm/tools/gccld/gccld.cpp:1.55 --- llvm/tools/gccld/gccld.cpp:1.54 Tue Sep 30 12:59:25 2003 +++ llvm/tools/gccld/gccld.cpp Fri Oct 10 12:55:31 2003 @@ -215,7 +215,8 @@ // We always look first in the current directory when searching for libraries. LibPaths.insert(LibPaths.begin(), "."); - // If the user specied an extra search path in their environment, respect it. + // If the user specified an extra search path in their environment, respect + // it. if (char *SearchPath = getenv("LLVM_LIB_SEARCH_PATH")) LibPaths.push_back(SearchPath); From brukman at cs.uiuc.edu Fri Oct 10 12:56:26 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:56:26 2003 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200310101755.MAA15459@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.83 -> 1.84 --- Log message: Fix grammar. --- Diffs of the changes: (+2 -2) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.83 llvm/tools/llc/llc.cpp:1.84 --- llvm/tools/llc/llc.cpp:1.83 Thu Aug 28 16:42:29 2003 +++ llvm/tools/llc/llc.cpp Fri Oct 10 12:55:45 2003 @@ -128,7 +128,7 @@ } Out = new std::ofstream(OutputFilename.c_str()); - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } else { @@ -157,7 +157,7 @@ return 1; } - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } From brukman at cs.uiuc.edu Fri Oct 10 12:57:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:57:01 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/llvm-as.cpp Message-ID: <200310101756.MAA15487@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: llvm-as.cpp updated: 1.21 -> 1.22 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-as/llvm-as.cpp diff -u llvm/tools/llvm-as/llvm-as.cpp:1.21 llvm/tools/llvm-as/llvm-as.cpp:1.22 --- llvm/tools/llvm-as/llvm-as.cpp:1.21 Thu Aug 28 16:32:57 2003 +++ llvm/tools/llvm-as/llvm-as.cpp Fri Oct 10 12:56:09 2003 @@ -92,7 +92,7 @@ } Out = new std::ofstream(OutputFilename.c_str()); - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } From brukman at cs.uiuc.edu Fri Oct 10 12:57:09 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:57:09 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-link/llvm-link.cpp Message-ID: <200310101756.MAA15508@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-link: llvm-link.cpp updated: 1.29 -> 1.30 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-link/llvm-link.cpp diff -u llvm/tools/llvm-link/llvm-link.cpp:1.29 llvm/tools/llvm-link/llvm-link.cpp:1.30 --- llvm/tools/llvm-link/llvm-link.cpp:1.29 Fri Sep 19 21:42:54 2003 +++ llvm/tools/llvm-link/llvm-link.cpp Fri Oct 10 12:56:21 2003 @@ -120,7 +120,7 @@ return 1; } - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } From brukman at cs.uiuc.edu Fri Oct 10 12:57:18 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:57:18 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200310101756.MAA15474@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.3 -> 1.4 --- Log message: Fix spelling. --- Diffs of the changes: (+2 -2) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.3 llvm/tools/llvm-ar/llvm-ar.cpp:1.4 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.3 Tue Sep 23 12:27:02 2003 +++ llvm/tools/llvm-ar/llvm-ar.cpp Fri Oct 10 12:55:59 2003 @@ -90,7 +90,7 @@ // 1) Generate the header for the symbol table. This is a normal // archive member header, but it has a zero length name. // 2) For each archive member file, stat the file and parse the bytecode -// Store cummulative offset (file size + header size). +// Store cumulative offset (file size + header size). // 3) Loop over all the symbols for the current member file, // add offset entry to offset vector, and add symbol name to its vector. // Note: The symbol name vector is a vector of chars to speed up calculating @@ -206,7 +206,7 @@ //Adjustment to offset to start files on even byte boundaries unsigned adjust = 0; - //Update offsets write symbol tabel to archive. + //Update offsets write symbol table to archive. for(unsigned i=0; i Changes in directory llvm/tools/llvm-dis: llvm-dis.cpp updated: 1.32 -> 1.33 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: llvm/tools/llvm-dis/llvm-dis.cpp diff -u llvm/tools/llvm-dis/llvm-dis.cpp:1.32 llvm/tools/llvm-dis/llvm-dis.cpp:1.33 --- llvm/tools/llvm-dis/llvm-dis.cpp:1.32 Thu Aug 28 16:34:13 2003 +++ llvm/tools/llvm-dis/llvm-dis.cpp Fri Oct 10 12:56:36 2003 @@ -92,7 +92,7 @@ } else { Out = new std::ofstream(OutputFilename.c_str()); - // Make sure that the Out file gets unlink'd from the disk if we get a + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } From lattner at cs.uiuc.edu Fri Oct 10 12:57:35 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 12:57:35 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C/globalrefs.c Message-ID: <200310101756.MAA18587@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Regression/C: globalrefs.c updated: 1.4 -> 1.5 --- Log message: Remove MORE non-portable assumptions. The backend can move globals around in memory, so offsets between globals need not be fixed! --- Diffs of the changes: (+0 -4) Index: llvm/test/Programs/SingleSource/Regression/C/globalrefs.c diff -u llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.4 llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.5 --- llvm/test/Programs/SingleSource/Regression/C/globalrefs.c:1.4 Fri Oct 10 12:54:49 2003 +++ llvm/test/Programs/SingleSource/Regression/C/globalrefs.c Fri Oct 10 12:56:10 2003 @@ -45,22 +45,18 @@ printf("\n"); diff1 = (unsigned long) &TestArray[3] - (unsigned long) TestArray; - diff2 = (unsigned long) &Test1.A - (unsigned long) &TestArray[3]; diff3 = (unsigned long) &Test1.S.Y - (unsigned long) &Test1.A; diff4 = (unsigned long) &Test1.next - (unsigned long) &Test1.S.Y; printf("&TestArray[3] - TestArray = 0x%lx\n", diff1); - printf("Aptr - &TestArray[3] = 0x%lx\n", diff2); printf("Xptr - Aptr = 0x%lx\n", diff3); printf("NextPtr - Xptr = 0x%lx\n\n", diff4); diff1 = (unsigned long) TestArrayPtr - (unsigned long) TestArray; - diff2 = (unsigned long) Aptr - (unsigned long) TestArrayPtr; diff3 = (unsigned long) Yptr - (unsigned long) Aptr; diff4 = (unsigned long) NextPtr - (unsigned long) Yptr; printf("&TestArray[3] - TestArray = 0x%lx\n", diff1); - printf("Aptr - &TestArray[3] = 0x%lx\n", diff2); printf("Xptr - Aptr = 0x%lx\n", diff3); printf("NextPtr - Xptr = 0x%lx\n\n", diff4); From brukman at cs.uiuc.edu Fri Oct 10 12:57:44 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:57:44 2003 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200310101756.MAA15547@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.82 -> 1.83 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.82 llvm/tools/opt/opt.cpp:1.83 --- llvm/tools/opt/opt.cpp:1.82 Thu May 22 15:13:16 2003 +++ llvm/tools/opt/opt.cpp Fri Oct 10 12:56:49 2003 @@ -100,7 +100,7 @@ return 1; } - // Make sure that the Output file gets unlink'd from the disk if we get a + // Make sure that the Output file gets unlinked from the disk if we get a // SIGINT RemoveFileOnSignal(OutputFilename); } From brukman at cs.uiuc.edu Fri Oct 10 12:58:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 12:58:01 2003 Subject: [llvm-commits] CVS: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Message-ID: <200310101757.MAA15579@zion.cs.uiuc.edu> Changes in directory llvm/runtime/GCCLibraries/crtend: C++-Exception.cpp updated: 1.8 -> 1.9 --- Log message: Fix spelling. --- Diffs of the changes: (+1 -1) Index: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp diff -u llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.8 llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.9 --- llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.8 Sat Aug 30 18:17:51 2003 +++ llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Fri Oct 10 12:57:28 2003 @@ -36,7 +36,7 @@ // llvm_cxx_exception *E = (llvm_cxx_exception *)malloc(NumBytes+sizeof(llvm_cxx_exception)); - E->BaseException.ExceptionType = 0; // intialize to invalid + E->BaseException.ExceptionType = 0; // initialize to invalid return E+1; // return the pointer after the header } From lattner at cs.uiuc.edu Fri Oct 10 13:20:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 13:20:02 2003 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200310101819.NAA19647@apoc.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.76 -> 1.77 --- Log message: Add a new -disable-inlining option --- Diffs of the changes: (+6 -1) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.76 llvm/tools/gccas/gccas.cpp:1.77 --- llvm/tools/gccas/gccas.cpp:1.76 Fri Oct 10 12:55:17 2003 +++ llvm/tools/gccas/gccas.cpp Fri Oct 10 13:18:53 2003 @@ -31,6 +31,9 @@ cl::opt Verify("verify", cl::desc("Verify each pass result")); + + cl::opt + DisableInline("disable-inlining", cl::desc("Do not run the inliner pass")); } @@ -50,7 +53,9 @@ addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst addPass(PM, createGlobalDCEPass()); // Remove unused globals addPass(PM, createPruneEHPass()); // Remove dead EH info - addPass(PM, createFunctionInliningPass()); // Inline small functions + + if (!DisableInline) + addPass(PM, createFunctionInliningPass()); // Inline small functions addPass(PM, createInstructionCombiningPass()); // Cleanup code for raise addPass(PM, createRaisePointerReferencesPass());// Recover type information From brukman at cs.uiuc.edu Fri Oct 10 13:20:12 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri Oct 10 13:20:12 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp Message-ID: <200310101819.NAA17329@zion.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/CustomChecked: oopack_v1p8.cpp updated: 1.2 -> 1.3 --- Log message: Fix spelling. Yeah, I know, it's not even part of our codebase... --- Diffs of the changes: (+1 -1) Index: llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp diff -u llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp:1.2 llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp:1.3 --- llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp:1.2 Sat Sep 20 13:53:24 2003 +++ llvm/test/Programs/SingleSource/CustomChecked/oopack_v1p8.cpp Fri Oct 10 13:19:24 2003 @@ -120,7 +120,7 @@ // OOPACK performance figures for KAI's C++ and some other compilers // can be found in http://www.kai.com/oopack/oopack.html. // -// Revison History +// Revision History // 9/17/93 Version 1.0 released // 10/5/93 Allow results to be printed even if checksums do not match. // 10/5/93 Increased ``Tolerance'' to allow 10-second runs on RS/6000. From criswell at cs.uiuc.edu Fri Oct 10 13:44:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 13:44:01 2003 Subject: [llvm-commits] CVS: llvm/docs/TestingGuide.html Message-ID: <200310101843.NAA03338@choi.cs.uiuc.edu> Changes in directory llvm/docs: TestingGuide.html added (r1.1) --- Log message: Initial checkin of Testing Guide. Still very rough, IMHO. --- Diffs of the changes: (+356 -0) Index: llvm/docs/TestingGuide.html diff -c /dev/null llvm/docs/TestingGuide.html:1.1 *** /dev/null Fri Oct 10 13:42:59 2003 --- llvm/docs/TestingGuide.html Fri Oct 10 13:42:49 2003 *************** *** 0 **** --- 1,356 ---- + + + + LLVM Test Suite Guide + + + + +

            LLVM Test Suite Guide

            + + +

            Overview

            + + + This document is the reference manual for the LLVM test suite. It + documents the structure of the LLVM test suite, the tools needed to + use it, and how to add and run tests. + + +

            Requirements

            + + + In order to use the LLVM test suite, you will need all of the software + required to build LLVM, plus the following: +
            +
            QMTest +
            + The LLVM test suite uses QMTest to organize and run tests. +

            + +

            Python +
            + You will need a python interpreter that works with QMTest. + Python will need zlib and SAX support enabled. +

            +

            + + +

            Quick Start

            + + + To run all of the tests in LLVM, use the Master Makefile in llvm/test: +

            + + cd test +
            + make +
            + +

            + + To run only the code fragment tests (i.e. those that do basic testing of + LLVM), run the tests organized by QMTest: +

            + + + cd test +
            + make qmtest +
            + +

            + + To run only the tests that compile and execute whole programs, run the + Programs tests: +

            + + + cd test/Programs +
            + make +
            +

            + + +

            LLVM Test Suite Organization

            + + + The LLVM test suite contains two major types of tests: +
              +
            • Code Fragments
              + Code fragments are small pieces of code that test a specific + feature of LLVM or trigger a specific bug in LLVM. They are + usually written in LLVM assembly language, but can be + written in other languages if the test targets a particular language + front end. +

              + Code fragments are not complete programs, and they are never executed + to determine correct behavior. +

              + The tests in the llvm/test/Features and llvm/test/Regression directories + contain code fragments. + +

            • Whole Programs
              + Whole Programs are pieces of code which can be compiled and + linked into a stand-alone program that can be executed. These programs + are generally written in high level languages such as C or C++, but + sometimes they are written straight in LLVM assembly. +

              + These programs are compiled and then executed using several different + methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code + generation, etc). The output of these programs is compared to ensure + that LLVM is compiling the program correctly. + +

              + In addition to compiling and executing programs, whole program tests + serve as a way of benchmarking LLVM performance, both in terms of the + efficiency of the programs generated as well as the speed with which + LLVM compiles, optimizes, and generates code. + +

              + The test/Programs directory contains all tests which compile and + benchmark whole programs. +

            + + +

            LLVM Test Suite Tree

            + + + The LLVM test suite is broken up into the following directory + hierarchy: + +
              +
            • Features
              + This directory contains sample codes that test various features + of the LLVM language. These pieces of sample code are run + through various assembler, disassembler, and optimizer passes. +

              + +

            • Regression
              + This directory contains regression tests for LLVM. When a bug + is found in LLVM, a regression test containing just enough + code to reproduce the problem should be written and placed + somewhere underneath this directory. In most cases, this + will be a small piece of LLVM assembly language code, often + distilled from an actual application or benchmark. +

              + +

            • Programs
              + The Programs directory contains programs that can be compiled + with LLVM and executed. These programs are compiled using the + native compiler and various LLVM backends. The output from the + program compiled with the native compiler is assumed correct; + the results from the other programs are compared to the native + program output and pass if they match. +

              + In addition for testing correctness, the Programs directory + also performs timing tests of various LLVM optimizations. + It also records compilation times for the compilers and the + JIT. This information can be used to compare the + effectiveness of LLVM's optimizations and code generation. +

              + The Programs directory is subdivided into several smaller + subdirectories: +

                +
              • SingleSource
                + The SingleSource directory contains test programs that + are only a single source file in size. These are + usually small benchmark programs or small programs that + calculate a particular value. Several such programs are grouped + together in each directory. +

                + +

              • MultiSource
                + The MultiSource directory contains subdirectories which contain + entire programs with multiple source files. Large benchmarks and + whole applications go here. +

                + +

              • External
                + The External directory contains Makefiles for building + code that is external to (i.e. not distributed with) + LLVM. The most prominent member of this directory is + the SPEC 2000 benchmark suite. The presence and location + of these external programs is configured by the LLVM + configure script. +
              + +

              + +

            • QMTest
              + This directory contains the QMTest information files. Inside this + directory are QMTest administration files and the Python code that + implements the LLVM test and database classes. +
            + + +

            QMTest Structure

            + + + The LLVM test suite is partially driven by QMTest and partially + driven by GNU Make. Specifically, the Features and Regression tests + are all driven by QMTest. The Programs directory is currently + driven by a set of Makefiles. +

            + + The QMTest system needs to have several pieces of information + available; these pieces of configuration information are known + collectively as the "context" in QMTest parlance. Since the context + for LLVM is relatively large, the master Makefile in llvm/test + sets it for you. + +

            + + The LLVM database class makes the directory tree underneath llvm/test a + QMTest test database. For each directory that contains tests driven by + QMTest, it knows what type of test the source file is and how to run it. + +

            + + Hence, the QMTest namespace is essentially what you see in + llvm/test/Feature and llvm/test/Regression, but there is some magic that + the database class performs (as described below). + +

            + + The QMTest namespace is currently composed of the following tests and + test suites: + +

              +
            • Feature
              + These are the feature tests found in llvm/test/Feature. They are broken + up into the following categories: +
                +
              • fad
                + Assembler/Disassembler tests. These tests verify that a piece of + LLVM assembly language can be assembled into bytecode and then + disassembled into the original assembly language code. + It does this several times to ensure that assembled + output can be disassembled and disassembler output can + be assembled. It also verifies that the give assembly language file + can be assembled correctly. +

                + +

              • fasm
                + Assembler tests. These tests verify that the code can be translated + into native assembly code. +

                + +

              • fopt
                + Optimizer tests. These tests verify that two of the + optimizer passes completely optimize a program (i.e. + after a single pass, they cannot optimize a program + any further). +

                + +

              • fmc
                + Machine code tests. These tests verify that the LLVM assembly + language file can be translated into native assembly code. +

                + +

              • fcc
                + C code tests. These tests verify that the specified LLVM assembly + code can be converted into C source code using the C backend. +
              + +

              + + The LLVM database class looks at every file in llvm/test/Feature and + creates a fake test hierarchy containing + Feature.<testtype>.<testname>. + So, if you add an LLVM assembly language file to llvm/test/Feature, it + actually creates 5 news test: assembler/disassembler, assembler, + optimizer, machine code, and C code. + +

            • Regression
              + These are the regression tests. There is one suite for each directory + in llvm/test/Regression. +

              + + If you add a new directory to llvm/test/Regression, you will need to + modify llvm/test/QMTest/llvmdb.py so that it knows what sorts of tests + are in it and how to run them. +

            + + +

            Programs Structure

            + + As mentioned previously, the Programs tree in llvm/test provides three types + of tests: MultiSource, SingleSource, and External. Each tree is then + subdivided into several categories, including applications, benchmarks, + regression tests, code that is strange grammatically, etc. These + organizations should be relatively self explanatory. +

            + In addition to the regular Programs tests, the Programs tree also provides a + mechanism for compiling the programs in different ways. If the variable TEST + is defined on the gmake command line, the test system will include a Makefile + named TEST.<value of TEST variable>.Makefile. This Makefile can modify + build rules that yield different results. +

            + For example, the LLVM nightly tester uses TEST.nightly.Makefile to create the + nightly test reports. To run the nightly tests, run gmake + TEST=nightly. +

            + There are several TEST Makefiles available in the tree. Some of them are + designed for internal LLVM research and will not work outside of the LLVM + research group. They may still be valuable, however, as a guide to writing + your own TEST Makefile for any optimization or analysis passes that you + develop with LLVM. + + +

            Running the LLVM Tests

            + + + First, all tests are executed within the LLVM object directory tree. They + are not executed inside of the LLVM source tree. This is because + the test suite creates temporary files during execution. + +

            + + The master Makefile in llvm/test is capable of running both the + QMTest driven tests and the Programs tests. By default, it will run + all of the tests. +

            + To run only the QMTest driven tests, run make qmtest at the + command line in llvm/tests. To run a specific qmtest, suffix the test name + with ".t" when running make. +

            + For example, to run the Regression.LLC tests, type + make Regression.LLC.t in llvm/tests. +

            + Note that the Makefiles in llvm/test/Features and llvm/test/Regression + are gone. You must now use QMTest from the llvm/test directory to run them. +

            + + To run the Programs test, cd into the llvm/test/Programs directory + and type make. Alternatively, you can type make + TEST=<type> test to run one of the specialized tests in + llvm/test/Programs/TEST.<type>.Makefile. For example, you could run + the nightly tester tests using the following commands: +

            + + cd llvm/test/Programs +
            + make TEST=nightly test +
            + +

            + Regardless of which test you're running, the results are printed on standard + output and standard error. You can redirect these results to a file if you + choose. +

            + Some tests are known to fail. Some are bugs that we have not fixed yet; + others are features that we haven't added yet (or may never add). In QMTest, + the result for such tests will be XFAIL (eXpected FAILure). In this way, you + can tell the difference between an expected and unexpected failure. +

            + The Programs tests have no such feature as of this time. If the test passes, + only warnings and other miscellaneous output will be generated. If a test + fails, a large <program> FAILED message will be displayed. This will + help you separate benign warnings from actual test failures. + +


            + + + From gaeke at cs.uiuc.edu Fri Oct 10 13:45:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:45:02 2003 Subject: [llvm-commits] CVS: reopt/lib/BinInterface/construct.cpp emit.cpp Message-ID: <200310101844.NAA06681@gally.cs.uiuc.edu> Changes in directory reopt/lib/BinInterface: construct.cpp updated: 1.9 -> 1.10 emit.cpp updated: 1.9 -> 1.10 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -4) Index: reopt/lib/BinInterface/construct.cpp diff -u reopt/lib/BinInterface/construct.cpp:1.9 reopt/lib/BinInterface/construct.cpp:1.10 --- reopt/lib/BinInterface/construct.cpp:1.9 Sat Sep 13 16:12:05 2003 +++ reopt/lib/BinInterface/construct.cpp Fri Oct 10 13:44:27 2003 @@ -13,8 +13,6 @@ #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC9 opcode definitions #include "reopt/BinInterface/regmask.h" // register mask allocator -#include "Config/stdio.h" -#include "Config/stdlib.h" #include #include Index: reopt/lib/BinInterface/emit.cpp diff -u reopt/lib/BinInterface/emit.cpp:1.9 reopt/lib/BinInterface/emit.cpp:1.10 --- reopt/lib/BinInterface/emit.cpp:1.9 Sat Sep 13 16:12:05 2003 +++ reopt/lib/BinInterface/emit.cpp Fri Oct 10 13:44:27 2003 @@ -11,8 +11,6 @@ #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC9 opcode definitions #include "reopt/BinInterface/regmask.h" // Register mask allocator -#include "Config/stdio.h" -#include "Config/stdlib.h" #include #include From gaeke at cs.uiuc.edu Fri Oct 10 13:46:02 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:46:02 2003 Subject: [llvm-commits] CVS: reopt/lib/Inst/rtl/pprtl.cpp Message-ID: <200310101845.NAA06764@gally.cs.uiuc.edu> Changes in directory reopt/lib/Inst/rtl: pprtl.cpp updated: 1.3 -> 1.4 --- Log message: Reflow head-of-file comment. Include and instead of and . --- Diffs of the changes: (+4 -3) Index: reopt/lib/Inst/rtl/pprtl.cpp diff -u reopt/lib/Inst/rtl/pprtl.cpp:1.3 reopt/lib/Inst/rtl/pprtl.cpp:1.4 --- reopt/lib/Inst/rtl/pprtl.cpp:1.3 Tue Jun 24 10:39:54 2003 +++ reopt/lib/Inst/rtl/pprtl.cpp Fri Oct 10 13:45:12 2003 @@ -1,11 +1,12 @@ -// Implementation of the performance primtive runtime library / "library of metrics" +// Implementation of the performance primitive runtime library, or +// "library of metrics" #include "pprtl.h" #include "papi.h" #include -#include -#include +#include +#include void pp_elapsed_time_start(double* retVal) { From gaeke at cs.uiuc.edu Fri Oct 10 13:46:11 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:46:11 2003 Subject: [llvm-commits] CVS: reopt/lib/BinInterface/select.cpp sparcbin.cpp Message-ID: <200310101845.NAA06733@gally.cs.uiuc.edu> Changes in directory reopt/lib/BinInterface: select.cpp updated: 1.10 -> 1.11 sparcbin.cpp updated: 1.13 -> 1.14 --- Log message: Don't include "Config/stdlib.h". Include instead of . Don't use std::pair. --- Diffs of the changes: (+3 -7) Index: reopt/lib/BinInterface/select.cpp diff -u reopt/lib/BinInterface/select.cpp:1.10 reopt/lib/BinInterface/select.cpp:1.11 --- reopt/lib/BinInterface/select.cpp:1.10 Sat Sep 13 16:12:05 2003 +++ reopt/lib/BinInterface/select.cpp Fri Oct 10 13:44:55 2003 @@ -11,13 +11,11 @@ #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC9 opcode definitions #include "reopt/BinInterface/regmask.h" // Register mask allocator -#include "Config/stdio.h" -#include "Config/stdlib.h" +#include #include #include -using std::pair; - +using std::vector; //***************************************************************************** // select(regalloc & regs) Index: reopt/lib/BinInterface/sparcbin.cpp diff -u reopt/lib/BinInterface/sparcbin.cpp:1.13 reopt/lib/BinInterface/sparcbin.cpp:1.14 --- reopt/lib/BinInterface/sparcbin.cpp:1.13 Sat Sep 13 16:12:06 2003 +++ reopt/lib/BinInterface/sparcbin.cpp Fri Oct 10 13:44:55 2003 @@ -14,13 +14,11 @@ #include "reopt/BinInterface/sparcdis.h" // sparc disassembler #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC 9 opcode definitions -#include "Config/stdio.h" -#include "Config/stdlib.h" +#include #include #include #include -using std::pair; using std::vector; //***************************************************************************** From gaeke at cs.uiuc.edu Fri Oct 10 13:46:21 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:46:21 2003 Subject: [llvm-commits] CVS: reopt/lib/BinInterface/analyze.cpp sparcdis.cpp Message-ID: <200310101845.NAA06773@gally.cs.uiuc.edu> Changes in directory reopt/lib/BinInterface: analyze.cpp updated: 1.14 -> 1.15 sparcdis.cpp updated: 1.16 -> 1.17 --- Log message: Don't include "Config/stdlib.h". Include instead of . --- Diffs of the changes: (+2 -4) Index: reopt/lib/BinInterface/analyze.cpp diff -u reopt/lib/BinInterface/analyze.cpp:1.14 reopt/lib/BinInterface/analyze.cpp:1.15 --- reopt/lib/BinInterface/analyze.cpp:1.14 Sat Sep 13 16:12:05 2003 +++ reopt/lib/BinInterface/analyze.cpp Fri Oct 10 13:44:43 2003 @@ -15,8 +15,7 @@ #include "reopt/BinInterface/analyze.h" // SPARC analysis library #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC9 opcode definitions -#include "Config/stdio.h" -#include "Config/stdlib.h" +#include #include //***************************************************************************** Index: reopt/lib/BinInterface/sparcdis.cpp diff -u reopt/lib/BinInterface/sparcdis.cpp:1.16 reopt/lib/BinInterface/sparcdis.cpp:1.17 --- reopt/lib/BinInterface/sparcdis.cpp:1.16 Fri Aug 22 12:43:38 2003 +++ reopt/lib/BinInterface/sparcdis.cpp Fri Oct 10 13:44:43 2003 @@ -21,8 +21,7 @@ #include "reopt/BinInterface/bitmath.h" // binary math routines #include "reopt/BinInterface/sparc9.h" // SPARC9 opcode definitions -#include "Config/stdio.h" -#include "Config/stdlib.h" +#include #include void sparc_printop_rs1(unsigned instr, int labelrs1) From gaeke at cs.uiuc.edu Fri Oct 10 13:46:30 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:46:30 2003 Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/ElfReader.cpp Message-ID: <200310101845.NAA06792@gally.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib: ElfReader.cpp updated: 1.13 -> 1.14 --- Log message: Include , , and instead of their C counterparts. --- Diffs of the changes: (+3 -3) Index: reopt/lib/Inst/lib/ElfReader.cpp diff -u reopt/lib/Inst/lib/ElfReader.cpp:1.13 reopt/lib/Inst/lib/ElfReader.cpp:1.14 --- reopt/lib/Inst/lib/ElfReader.cpp:1.13 Fri Aug 22 12:43:39 2003 +++ reopt/lib/Inst/lib/ElfReader.cpp Fri Oct 10 13:45:21 2003 @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include From gaeke at cs.uiuc.edu Fri Oct 10 13:46:39 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:46:39 2003 Subject: [llvm-commits] CVS: reopt/lib/Inst/lib/SparcInstManip.cpp Message-ID: <200310101845.NAA06812@gally.cs.uiuc.edu> Changes in directory reopt/lib/Inst/lib: SparcInstManip.cpp updated: 1.20 -> 1.21 --- Log message: Rearrange includes to make them look more like other llvm source files. Include and instead of and . Don't randomly redeclare perror and errno. --- Diffs of the changes: (+7 -15) Index: reopt/lib/Inst/lib/SparcInstManip.cpp diff -u reopt/lib/Inst/lib/SparcInstManip.cpp:1.20 reopt/lib/Inst/lib/SparcInstManip.cpp:1.21 --- reopt/lib/Inst/lib/SparcInstManip.cpp:1.20 Sat Sep 13 16:12:07 2003 +++ reopt/lib/Inst/lib/SparcInstManip.cpp Fri Oct 10 13:45:30 2003 @@ -58,29 +58,21 @@ // +-------------------------------------------------+ // [] -#include -#include -#include - -#include // mprotect() - -#include -void perror(const char* s); -#include -int errno; - -#include // valloc() - #include "reopt/TraceCache.h" #include "reopt/VirtualMem.h" #include "reopt/MemoryManager.h" #include "reopt/BinInterface/sparc9.h" #include "reopt/BinInterface/bitmath.h" - #include "reopt/InstrUtils.h" - #include "SparcInstManip.h" #include "PhaseInfo.h" +#include +#include +#include +#include // mprotect() +#include +#include +#include // valloc() // These are exported due to some inline methods in SparcInstManip.h uint64_t SparcInstManip::sm_phase4SpillRegion[SparcInstManip::SHARED_SIZE]; From gaeke at cs.uiuc.edu Fri Oct 10 13:47:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:47:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Message-ID: <200310101846.NAA06895@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: ExternalFunctions.cpp updated: 1.61 -> 1.62 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -1) Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.61 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.62 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.61 Fri Oct 10 12:42:19 2003 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri Oct 10 13:46:25 2003 @@ -22,7 +22,6 @@ #include "Config/dlfcn.h" #include "Config/link.h" #include -#include "Config/stdio.h" #include "Support/DynamicLinker.h" using std::vector; From gaeke at cs.uiuc.edu Fri Oct 10 13:47:29 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:47:29 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200310101846.NAA06902@gally.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.26 -> 1.27 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -1) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.26 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.27 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.26 Mon Oct 6 14:07:41 2003 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Fri Oct 10 13:46:26 2003 @@ -19,7 +19,6 @@ #include "Support/Statistic.h" #include "Config/unistd.h" #include "Config/sys/mman.h" -#include namespace { Statistic<> NumBytes("jello", "Number of bytes of machine code compiled"); From gaeke at cs.uiuc.edu Fri Oct 10 13:47:51 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:47:51 2003 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200310101846.NAA06910@gally.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.25 -> 1.26 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -2) Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.25 llvm/lib/Support/Timer.cpp:1.26 --- llvm/lib/Support/Timer.cpp:1.25 Mon Oct 6 10:02:31 2003 +++ llvm/lib/Support/Timer.cpp Fri Oct 10 13:46:27 2003 @@ -6,12 +6,10 @@ #include "Support/Timer.h" #include "Support/CommandLine.h" - #include "Config/sys/resource.h" #include "Config/sys/time.h" #include "Config/unistd.h" #include "Config/malloc.h" -#include "Config/stdio.h" #include #include #include From gaeke at cs.uiuc.edu Fri Oct 10 13:48:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:48:00 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp Message-ID: <200310101846.NAA06926@gally.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.47 -> 1.48 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -1) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.47 llvm/lib/VMCore/Pass.cpp:1.48 --- llvm/lib/VMCore/Pass.cpp:1.47 Mon Aug 18 09:34:26 2003 +++ llvm/lib/VMCore/Pass.cpp Fri Oct 10 13:46:29 2003 @@ -11,7 +11,6 @@ #include "llvm/Module.h" #include "Support/STLExtras.h" #include "Support/TypeInfo.h" -#include "Config/stdio.h" #include "Config/sys/resource.h" #include "Config/sys/time.h" #include "Config/unistd.h" From gaeke at cs.uiuc.edu Fri Oct 10 13:48:09 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:48:09 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp Message-ID: <200310101846.NAA06918@gally.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: EdgeCode.cpp updated: 1.23 -> 1.24 --- Log message: Don't include Config/stdio.h or . --- Diffs of the changes: (+0 -1) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.23 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.24 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.23 Sat Aug 30 19:21:05 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp Fri Oct 10 13:46:28 2003 @@ -16,7 +16,6 @@ #include "llvm/iOperators.h" #include "llvm/iPHINode.h" #include "llvm/Module.h" -#include "Config/stdio.h" #define INSERT_LOAD_COUNT #define INSERT_STORE From gaeke at cs.uiuc.edu Fri Oct 10 13:49:05 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:49:05 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.burg.in Message-ID: <200310101847.NAA06980@gally.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.burg.in updated: 1.6 -> 1.7 --- Log message: Include instead of . --- Diffs of the changes: (+1 -1) Index: llvm/lib/Target/Sparc/Sparc.burg.in diff -u llvm/lib/Target/Sparc/Sparc.burg.in:1.6 llvm/lib/Target/Sparc/Sparc.burg.in:1.7 --- llvm/lib/Target/Sparc/Sparc.burg.in:1.6 Thu Jul 10 14:47:42 2003 +++ llvm/lib/Target/Sparc/Sparc.burg.in Fri Oct 10 13:46:50 2003 @@ -1,5 +1,5 @@ %{ // -*- C++ -*- -Xinclude +Xinclude Xinclude typedef InstrTreeNode* NODEPTR_TYPE; From gaeke at cs.uiuc.edu Fri Oct 10 13:49:14 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:49:14 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Message-ID: <200310101847.NAA06982@gally.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: ProfilePaths.cpp updated: 1.34 -> 1.35 --- Log message: Include instead of . --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.34 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.35 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.34 Fri Oct 10 12:49:04 2003 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Fri Oct 10 13:46:51 2003 @@ -34,7 +34,7 @@ #include "llvm/Module.h" #include "Graph.h" #include -#include "Config/stdio.h" +#include struct ProfilePaths : public FunctionPass { bool runOnFunction(Function &F); From gaeke at cs.uiuc.edu Fri Oct 10 13:49:23 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:49:23 2003 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200310101847.NAA07011@gally.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.4 -> 1.5 --- Log message: Rewrite head-of-file comment. Include instead of . --- Diffs of the changes: (+4 -7) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.4 llvm/tools/llvm-ar/llvm-ar.cpp:1.5 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.4 Fri Oct 10 12:55:59 2003 +++ llvm/tools/llvm-ar/llvm-ar.cpp Fri Oct 10 13:47:08 2003 @@ -1,25 +1,22 @@ -//===----------------------------------------------------------------------===// -// LLVM 'ar' UTILITY +//===-- tools/llvm-ar/llvm-ar.cpp - LLVM archive librarian utility --------===// // -// This utility may be invoked in the following manner: -// llvm-ar archivename files.. +// Builds up standard unix archive files (.a) containing LLVM bytecode. // //===----------------------------------------------------------------------===// + #include "Support/CommandLine.h" #include "llvm/Bytecode/Reader.h" #include "llvm/Module.h" - #include #include #include #include #include -#include +#include #include #include #include #include - using std::string; using std::vector; From gaeke at cs.uiuc.edu Fri Oct 10 13:49:32 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:49:32 2003 Subject: [llvm-commits] CVS: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Message-ID: <200310101847.NAA06981@gally.cs.uiuc.edu> Changes in directory llvm/runtime/GCCLibraries/crtend: C++-Exception.cpp updated: 1.9 -> 1.10 --- Log message: Include instead of . --- Diffs of the changes: (+1 -1) Index: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp diff -u llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.9 llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.10 --- llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.9 Fri Oct 10 12:57:28 2003 +++ llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Fri Oct 10 13:46:52 2003 @@ -14,7 +14,7 @@ //#define DEBUG #ifdef DEBUG -#include +#include #endif // LastCaughtException - The last exception caught by this handler. This is for From criswell at cs.uiuc.edu Fri Oct 10 13:52:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 13:52:02 2003 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200310101851.NAA03387@choi.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.36 -> 1.37 --- Log message: Fixed spelling. --- Diffs of the changes: (+3 -3) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.36 llvm/docs/GettingStarted.html:1.37 --- llvm/docs/GettingStarted.html:1.36 Fri Oct 10 11:17:19 2003 +++ llvm/docs/GettingStarted.html Fri Oct 10 13:51:11 2003 @@ -472,7 +472,7 @@

            --enable-optimized
            - Enables optimized compilation by defaulat (debugging symbols are removed + Enables optimized compilation by default (debugging symbols are removed and GCC optimization flags are enabled). The default is to use an unoptimized build (also known as a debug build).

            @@ -752,7 +752,7 @@

            llvm/lib/Transforms/
            This directory contains the source code for the LLVM to LLVM program transformations, such as Aggressive Dead Code Elimination, Sparse Conditional Constant Propagation, Inlining, Loop - Invarient Code Motion, Dead Global Elimination, and many others... + Invariant Code Motion, Dead Global Elimination, and many others...
            llvm/lib/Target/
            This directory contains files that describe various target architectures for code generation. For example, @@ -882,7 +882,7 @@

            llvm/utils

            - This directory contains utilities for working with LLVM sourcecode, and some + This directory contains utilities for working with LLVM source code, and some of the utilities are actually required as part of the build process because they are code generators for parts of LLVM infrastructure. From gaeke at cs.uiuc.edu Fri Oct 10 13:59:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 13:59:01 2003 Subject: [llvm-commits] CVS: llvm/include/Config/stdio.h Message-ID: <200310101858.NAA08534@gally.cs.uiuc.edu> Changes in directory llvm/include/Config: stdio.h (r1.2) removed --- Log message: No longer used anywhere. Dead. This is a dead header. It's not pining! It's passed on! This header is no more! It has ceased to be! It's expired and gone to meet its maker! It's a stiff! Bereft of life, it rests in peace! If you hadn't nailed it to the perch it'd be pushing up the daisies! Its metabolic processes are now history! It's off the twig! It's kicked the bucket! It's shuffled off its mortal coil, run down the curtain, and joined the bleeding choir invisibile!! THIS IS AN EX-HEADER!! --- Diffs of the changes: (+0 -0) From gaeke at cs.uiuc.edu Fri Oct 10 14:13:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 14:13:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Message-ID: <200310101912.OAA10584@gally.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.39 -> 1.40 --- Log message: Include and instead of and "Config/stdlib.h". --- Diffs of the changes: (+2 -2) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.39 llvm/lib/AsmParser/Lexer.l:1.40 --- llvm/lib/AsmParser/Lexer.l:1.39 Thu Oct 9 23:54:02 2003 +++ llvm/lib/AsmParser/Lexer.l Fri Oct 10 14:12:08 2003 @@ -22,8 +22,8 @@ #include "llvm/Module.h" #include #include "llvmAsmParser.h" -#include -#include "Config/stdlib.h" +#include +#include #define RET_TOK(type, Enum, sym) \ llvmAsmlval.type = Instruction::Enum; return sym From gaeke at cs.uiuc.edu Fri Oct 10 14:13:11 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 14:13:11 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp Message-ID: <200310101912.OAA10610@gally.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrInfo.cpp updated: 1.51 -> 1.52 --- Log message: Don't include "Config/stdlib.h". --- Diffs of the changes: (+0 -1) Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.51 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.52 --- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.51 Tue Jul 29 14:58:42 2003 +++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Fri Oct 10 14:12:20 2003 @@ -13,7 +13,6 @@ #include "llvm/Function.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" -#include "Config/stdlib.h" static const uint32_t MAXLO = (1 << 10) - 1; // set bits set by %lo(*) static const uint32_t MAXSIMM = (1 << 12) - 1; // set bits in simm13 field of OR From gaeke at cs.uiuc.edu Fri Oct 10 14:13:21 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 14:13:21 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/Linker.cpp Message-ID: <200310101912.OAA10618@gally.cs.uiuc.edu> Changes in directory llvm/tools/gccld: Linker.cpp updated: 1.8 -> 1.9 --- Log message: Don't include "Config/stdlib.h". --- Diffs of the changes: (+0 -1) Index: llvm/tools/gccld/Linker.cpp diff -u llvm/tools/gccld/Linker.cpp:1.8 llvm/tools/gccld/Linker.cpp:1.9 --- llvm/tools/gccld/Linker.cpp:1.8 Wed Oct 8 14:09:30 2003 +++ llvm/tools/gccld/Linker.cpp Fri Oct 10 14:12:22 2003 @@ -18,7 +18,6 @@ #include "Support/FileUtilities.h" #include "Support/Signals.h" #include "Support/SystemUtils.h" -#include "Config/stdlib.h" #include #include #include From gaeke at cs.uiuc.edu Fri Oct 10 14:13:30 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 14:13:30 2003 Subject: [llvm-commits] CVS: reopt/include/reopt/VirtualMem.h Message-ID: <200310101912.OAA10642@gally.cs.uiuc.edu> Changes in directory reopt/include/reopt: VirtualMem.h updated: 1.10 -> 1.11 --- Log message: Don't include "Config/stdio.h". Remove some excess whitespace and commented-out code. --- Diffs of the changes: (+0 -7) Index: reopt/include/reopt/VirtualMem.h diff -u reopt/include/reopt/VirtualMem.h:1.10 reopt/include/reopt/VirtualMem.h:1.11 --- reopt/include/reopt/VirtualMem.h:1.10 Fri Aug 22 12:43:34 2003 +++ reopt/include/reopt/VirtualMem.h Fri Oct 10 14:12:34 2003 @@ -11,17 +11,12 @@ #include "Support/DataTypes.h" #include "Config/fcntl.h" #include "Config/unistd.h" - -#include "Config/stdio.h" #include - #include #include - #include "reopt/GetTraceTime.h" class TraceCache; -//class TraceCache2; class VirtualMem { int fp; //file pointer @@ -38,7 +33,6 @@ unsigned int readInstrFrmVm(uint64_t frm); unsigned int readInstrFrmVm(uint64_t frm, TraceCache *tr); - // unsigned int readInstrFrmVm(uint64_t frm, TraceCache2 *tr); unsigned int readInstrFrmVm(uint64_t frm, TraceCache *tr, TraceCache *tr2); void writeInstToVM(uint64_t dest, unsigned newInstr); @@ -55,7 +49,6 @@ void setCalls(std::map &callMap, uint64_t startAddr); unsigned int getInvertedBranch(unsigned int br1); - }; #endif // REOPT_VIRTUALMEM_H From gaeke at cs.uiuc.edu Fri Oct 10 14:13:39 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 14:13:39 2003 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/OptimizerDriver.cpp Message-ID: <200310101912.OAA10661@gally.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: OptimizerDriver.cpp updated: 1.12 -> 1.13 --- Log message: Don't include . --- Diffs of the changes: (+0 -1) Index: llvm/tools/bugpoint/OptimizerDriver.cpp diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.12 llvm/tools/bugpoint/OptimizerDriver.cpp:1.13 --- llvm/tools/bugpoint/OptimizerDriver.cpp:1.12 Fri Oct 10 12:55:03 2003 +++ llvm/tools/bugpoint/OptimizerDriver.cpp Fri Oct 10 14:12:45 2003 @@ -15,7 +15,6 @@ #include "llvm/Target/TargetData.h" #include "Support/FileUtilities.h" #include -#include #include #include #include From criswell at cs.uiuc.edu Fri Oct 10 14:52:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 14:52:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py llvmdb.py Message-ID: <200310101951.OAA27112@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.15 -> 1.16 llvmdb.py updated: 1.6 -> 1.7 --- Log message: Renamed the feature subtests so that they do not begin with 'f'. It was never necessary to do that to denote them as feature tests. Removed the Feature.asm tests as they are the same as the Feature.mc tests. Removed the AssemblyCodeTest class as it is no longer used. Improved the MachineCodeTest class so that it uses ExecProgram() and verifies that the output assembly file is actually generated.. --- Diffs of the changes: (+18 -100) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.15 llvm/test/QMTest/llvm.py:1.16 --- llvm/test/QMTest/llvm.py:1.15 Tue Oct 7 15:55:15 2003 +++ llvm/test/QMTest/llvm.py Fri Oct 10 14:51:36 2003 @@ -326,99 +326,16 @@ ############################################################################## # -# Class: MachineCodeTest -# -# Description: -# This test verifies that the specified bytecode file can be converted -# into machine code. -# -############################################################################## -class MachineCodeTest(qm.test.test.Test): - - description="Verifies that LLVM can convert a file into machine code" - - # - # List of arguments that the objects accepts for test configuration. - # - arguments = [ - qm.fields.TextField(name='srcfile', - title='LLVM Assembly Language File', - description='LLVM Assembly Language File to Convert to Machine Code'), - ] - - - devnull = ' > /dev/null 2>&1' - - def Run (self, context, result): - - # - # Set the core dump size - # - coresize=int(context['coresize']) - resource.setrlimit (resource.RLIMIT_CORE, (coresize,coresize)) - - # - # Fetch the source and build root directories from the context. - # - srcroot=context['srcroot'] - buildroot=context['buildroot'] - tmpdir=context['tmpdir'] - - # - # Construct the pathname of the source file and object file. - # - srcfile=srcroot + '/' + self.srcfile - bcfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.bc' - objfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.mc' - - # - # Construct the pathnames to the various utilities. - # - as = buildroot + '/tools/' + context['buildtype'] + '/llvm-as' - llc = buildroot + '/tools/' + context['buildtype'] + '/llc' - - # - # Use the LLVM assembler to assemble the program. - # - cmd = as + ' -f -o=' + bcfile + ' ' + srcfile + self.devnull - estatus=os.system (cmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): - result.Fail ('Failed to assemble program') - - # - # Use LLC to compile the program into native assembly code. - # - cmd = llc + ' ' + bcfile + ' -f -o=' + objfile + self.devnull - estatus=os.system (cmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): - fail = 1 - result.Fail('Failed to compile bytecode') - else: - fail = 0 - - # - # Cleanup the file if it exists. - # - if ((os.access(objfile,os.F_OK)) == 1): - os.remove (objfile) - else: - if (fail == 0): - result.Fail ('Object file not created') - - return - -############################################################################## -# # Class: AssemblyCodeTest # # Description: # This test verifies that the specified bytecode file can be converted -# into assembly code. +# into native assembly code. # ############################################################################## -class AssemblyCodeTest(qm.test.test.Test): +class MachineCodeTest(qm.test.test.Test): - description="Verifies that LLVM can convert a file into assembly code" + description="Verifies that LLVM can convert a file into native assembly code" # # List of arguments that the objects accepts for test configuration. @@ -426,11 +343,9 @@ arguments = [ qm.fields.TextField(name='srcfile', title='LLVM Assembly Code File', - description='LLVM Assembly Code File to Convert to Machine Code'), + description='LLVM Assembly Code File to Convert to Native Assembly Code'), ] - devnull = ' > /dev/null 2>&1' - def Run (self, context, result): # @@ -450,8 +365,8 @@ # Construct the pathname of the source file and object file. # srcfile=srcroot + '/' + self.srcfile - bcfile=tmpdir + '/feature-' + os.path.basename (self.srcfile) - objfile=tmpdir + '/feature-' + self.srcfile + '.s' + bcfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile) + objfile=tmpdir + '/feature-mc-' + os.path.basename (self.srcfile) + '.s' # # Construct the pathnames to the various utilities. @@ -469,15 +384,20 @@ # # Use the LLVM assembler to assemble the program. # - exstatus=os.spawnl (os.P_WAIT, llc, llc, bcfile, '-f', '-o=' + objfile) - if (exstatus != 0): + if (ExecProgram ((llc, bcfile, '-f', '-o', objfile))): + fail = 1 result.Fail('Failed to compile ' + bcfile + ' to native asm code.') + else: + fail = 0 # # Cleanup the file if it exists. # if ((os.access(objfile,os.F_OK)) == 1): os.remove (objfile) + else: + if (fail == 0): + result.Fail ('Native assembly file ' + objfile + ' was not created') return Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.6 llvm/test/QMTest/llvmdb.py:1.7 --- llvm/test/QMTest/llvmdb.py:1.6 Tue Oct 7 15:55:37 2003 +++ llvm/test/QMTest/llvmdb.py Fri Oct 10 14:51:36 2003 @@ -91,15 +91,13 @@ # If the test is a feature test, create the appropraite test for it. # if (headlabel == 'Feature'): - if (featuretypelabel == 'fopt'): + if (featuretypelabel == 'opt'): return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestOptimizer', {'srcfile':testpath}) - if (featuretypelabel == 'fasm'): - return qm.test.database.TestDescriptor(self, test_id, 'llvm.AssemblyCodeTest', {'srcfile':testpath}) - if (featuretypelabel == 'fmc'): + if (featuretypelabel == 'mc'): return qm.test.database.TestDescriptor(self, test_id, 'llvm.MachineCodeTest', {'srcfile':testpath}) - if (featuretypelabel == 'fcc'): + if (featuretypelabel == 'cc'): return qm.test.database.TestDescriptor(self, test_id, 'llvm.ConvertToCTest', {'srcfile':testpath}) - if (featuretypelabel == 'fad'): + if (featuretypelabel == 'ad'): return qm.test.database.TestDescriptor(self, test_id, 'llvm.TestAsmDisasm', {'srcfile':testpath}) # @@ -138,7 +136,7 @@ def GetDirsAndFiles (self, dirpath): # The list of feature directories - featuredirs = ['fopt', 'fasm', 'fmc', 'fcc', 'fad'] + featuredirs = ['opt', 'mc', 'cc', 'ad'] # # To perform magic on the Feature tests, adjust the pathname. From criswell at cs.uiuc.edu Fri Oct 10 14:53:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 14:53:02 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310101952.OAA27132@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.43 -> 1.44 --- Log message: Make the clean target remove the QMTest temporary directory. Remove QMTest python classes which are no longer used. --- Diffs of the changes: (+3 -2) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.43 llvm/test/Makefile:1.44 --- llvm/test/Makefile:1.43 Tue Oct 7 16:30:07 2003 +++ llvm/test/Makefile Fri Oct 10 14:52:30 2003 @@ -66,7 +66,6 @@ $(QMTEST) register test llvm.ConvertToCTest $(QMTEST) register test llvm.LLToCTest $(QMTEST) register test llvm.MachineCodeTest - $(QMTEST) register test llvm.AssemblyCodeTest $(QMTEST) register test llvm.TestOptimizer $(QMTEST) register test llvm.LLITest $(QMTEST) register test llvm.TestRunner @@ -75,11 +74,13 @@ $(QMTEST) register test llvm.CTest $(QMTEST) register test llvm.CXXTest $(QMTEST) register database llvmdb.llvmdb - $(QMTEST) register resource llvm.BytecodeResource # # Start up the QMTest GUI # gui:: $(QMTEST) gui --no-browser --daemon + +clean:: + $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp From criswell at cs.uiuc.edu Fri Oct 10 14:53:13 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 14:53:13 2003 Subject: [llvm-commits] CVS: llvm/docs/TestingGuide.html Message-ID: <200310101952.OAA27119@choi.cs.uiuc.edu> Changes in directory llvm/docs: TestingGuide.html updated: 1.1 -> 1.2 --- Log message: Renamed the feature subtests so that they do not begin with 'f'. It was never necessary to do that to denote them as feature tests. Removed the Feature.asm tests as they are the same as the Feature.mc tests. --- Diffs of the changes: (+4 -9) Index: llvm/docs/TestingGuide.html diff -u llvm/docs/TestingGuide.html:1.1 llvm/docs/TestingGuide.html:1.2 --- llvm/docs/TestingGuide.html:1.1 Fri Oct 10 13:42:49 2003 +++ llvm/docs/TestingGuide.html Fri Oct 10 14:50:53 2003 @@ -222,7 +222,7 @@ These are the feature tests found in llvm/test/Feature. They are broken up into the following categories:
              -
            • fad
              +
            • ad
              Assembler/Disassembler tests. These tests verify that a piece of LLVM assembly language can be assembled into bytecode and then disassembled into the original assembly language code. @@ -232,24 +232,19 @@ can be assembled correctly.

              -

            • fasm
              - Assembler tests. These tests verify that the code can be translated - into native assembly code. -

              - -

            • fopt
              +
            • opt
              Optimizer tests. These tests verify that two of the optimizer passes completely optimize a program (i.e. after a single pass, they cannot optimize a program any further).

              -

            • fmc
              +
            • mc
              Machine code tests. These tests verify that the LLVM assembly language file can be translated into native assembly code.

              -

            • fcc
              +
            • cc
              C code tests. These tests verify that the specified LLVM assembly code can be converted into C source code using the C backend.
            From criswell at cs.uiuc.edu Fri Oct 10 15:26:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 15:26:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200310102025.PAA06977@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.16 -> 1.17 --- Log message: Removed the AnalyzeTest class. Corrected the code that checks for the exit status of child processes. We should be able to detect program crashes much better now. --- Diffs of the changes: (+12 -74) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.16 llvm/test/QMTest/llvm.py:1.17 --- llvm/test/QMTest/llvm.py:1.16 Fri Oct 10 14:51:36 2003 +++ llvm/test/QMTest/llvm.py Fri Oct 10 15:25:27 2003 @@ -73,7 +73,7 @@ # Wait for the child process to exit. # (pid, status) = os.waitpid (child, 0) - return ((os.WIFEXITED(status)) and (os.WEXITSTATUS(status) != 0)) + return (not ((os.WIFEXITED(status)) and ((os.WEXITSTATUS(status)) == 0))) ############################################################################## # @@ -296,12 +296,12 @@ # Assemble the program into C code and then compile it. # estatus=os.system (ccmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Converting to C code failed') else: estatus=os.system (lcmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Compiling code failed') else: @@ -505,7 +505,7 @@ p=' | ' estatus = os.system (as + ' < ' + file + p + opt + ' -q -inline -dce ' + flags + p + dis + p + as + ' > ' + 'bc.1') - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): result.Fail() return; @@ -513,7 +513,7 @@ # Now, attempt to optimize the the program again. # estatus=os.system (opt + ' -q ' + flags + ' < ' + 'bc.1 > ' + 'bc.2') - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): result.Fail() return @@ -765,82 +765,20 @@ # # Assemble the program. # - estatus=os.system (as + ' -f -o ' + bcfile + ' ' + srcfile) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (ExecProgram ((as, '-f', '-o', bcfile, srcfile))): result.Fail('Failed to assemble LLVM code') # # Execute the program. # estatus=os.system (lli + ' ' + bcfile + ' < /dev/null') - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): result.Fail('LLI failed to execute bytecode') return ############################################################################## # -# Class: AnalyzeTest -# -# Description: -# This class runs an LLVM assembly language program through the analyzer. -# -############################################################################## -class AnalyzeTest(qm.test.test.Test): - - # - # Description - # - description="Verifies that LLVM can analyze a file" - - # - # List of arguments that the objects accepts for test configuration. - # - arguments = [ - qm.fields.TextField(name='srcfile', - title='LLVM Assembly File', - description='LLVM Assembly File to Analyze'), - ] - - devnull = ' > /dev/null 2>&1' - - def Run (self, context, result): - # - # Set the core dump size - # - coresize=int(context['coresize']) - resource.setrlimit (resource.RLIMIT_CORE, (coresize,coresize)) - - # - # Fetch the source and build root directories from the context. - # - srcroot=context['srcroot'] - buildroot=context['buildroot'] - tmpdir=context['tmpdir'] - - # - # Construct the pathname of the source file and object file. - # - srcfile=srcroot + '/' + self.srcfile - - # - # Construct the pathnames to the various utilities. - # - anal = buildroot + '/tools/' + context['buildtype'] + '/analyze -tddatastructure' - - # - # Use the LLVM assembler to assemble the program. - # - cmd = anal + ' ' + srcfile + self.devnull - estatus=os.system (cmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): - result.Fail() - - return - - -############################################################################## -# # Class: TestRunner # # Description: @@ -1019,12 +957,12 @@ # Assemble the program into C code and then compile it. # estatus=os.system (ccmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Compiling C code failed') else: estatus=os.system (acmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Compiling code failed') else: @@ -1107,12 +1045,12 @@ # Assemble the program into C code and then compile it. # estatus=os.system (ccmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Compiling C++ code failed') else: estatus=os.system (acmd) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): fail = 1 result.Fail('Compiling code failed') else: @@ -1198,7 +1136,7 @@ # Execute make to build the programs. # estatus=os.system (make) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + if (not ((os.WIFEXITED(estatus)) and ((os.WEXITSTATUS(estatus)) == 0))): result.Fail() # From criswell at cs.uiuc.edu Fri Oct 10 15:26:11 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 15:26:11 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310102025.PAA06968@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.44 -> 1.45 --- Log message: Removed the AnalyzeTest class. --- Diffs of the changes: (+0 -1) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.44 llvm/test/Makefile:1.45 --- llvm/test/Makefile:1.44 Fri Oct 10 14:52:30 2003 +++ llvm/test/Makefile Fri Oct 10 15:24:56 2003 @@ -70,7 +70,6 @@ $(QMTEST) register test llvm.LLITest $(QMTEST) register test llvm.TestRunner $(QMTEST) register test llvm.VerifierTest - $(QMTEST) register test llvm.AnalyzeTest $(QMTEST) register test llvm.CTest $(QMTEST) register test llvm.CXXTest $(QMTEST) register database llvmdb.llvmdb From criswell at cs.uiuc.edu Fri Oct 10 16:00:03 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 16:00:03 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200310102059.PAA15991@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.17 -> 1.18 --- Log message: Close pipes to child processes when done. This keeps us from running out of file descriptors on Solaris. --- Diffs of the changes: (+12 -0) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.17 llvm/test/QMTest/llvm.py:1.18 --- llvm/test/QMTest/llvm.py:1.17 Fri Oct 10 15:25:27 2003 +++ llvm/test/QMTest/llvm.py Fri Oct 10 15:59:33 2003 @@ -73,6 +73,18 @@ # Wait for the child process to exit. # (pid, status) = os.waitpid (child, 0) + + # + # Close our pipes to the child. + # + os.close (child_out) + if (outfile == ''): + os.close (parent_in) + + # + # Return true if the program crashed or exited with a non-zero + # exit status. + # return (not ((os.WIFEXITED(status)) and ((os.WEXITSTATUS(status)) == 0))) ############################################################################## From criswell at cs.uiuc.edu Fri Oct 10 16:47:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 16:47:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200310102146.QAA27767@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.18 -> 1.19 --- Log message: Added code that helps prevent different tests from using the same output files. --- Diffs of the changes: (+2 -2) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.18 llvm/test/QMTest/llvm.py:1.19 --- llvm/test/QMTest/llvm.py:1.18 Fri Oct 10 15:59:33 2003 +++ llvm/test/QMTest/llvm.py Fri Oct 10 16:46:35 2003 @@ -207,8 +207,8 @@ # Construct the pathname of the source file and object file. # srcfile=srcroot + '/' + self.srcfile - bcfile=tmpdir + '/' + os.path.basename (self.srcfile) - objfile=tmpdir + '/' + os.path.basename (self.srcfile) + '.tc' + bcfile=tmpdir + '/feature-cc-' + os.path.basename (self.srcfile) + objfile=tmpdir + '/feature-cc-' + os.path.basename (self.srcfile) + '.tc' # # Construct the pathnames to the various utilities. From gaeke at cs.uiuc.edu Fri Oct 10 16:56:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 16:56:01 2003 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenWrappers.cpp Message-ID: <200310102155.QAA20637@gally.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenWrappers.cpp updated: 1.3 -> 1.4 --- Log message: This seems to work around some unobvious bug in gcc on sparc which was causing the build of lib/Target/X86 to fail. --- Diffs of the changes: (+1 -1) Index: llvm/utils/TableGen/CodeGenWrappers.cpp diff -u llvm/utils/TableGen/CodeGenWrappers.cpp:1.3 llvm/utils/TableGen/CodeGenWrappers.cpp:1.4 --- llvm/utils/TableGen/CodeGenWrappers.cpp:1.3 Sun Aug 10 14:50:32 2003 +++ llvm/utils/TableGen/CodeGenWrappers.cpp Fri Oct 10 16:55:29 2003 @@ -61,7 +61,7 @@ /// getTarget - Return the current instance of the Target class. /// -CodeGenTarget::CodeGenTarget() { +CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) { std::vector Targets = Records.getAllDerivedDefinitions("Target"); if (Targets.size() != 1) throw std::string("ERROR: Multiple subclasses of Target defined!"); From lattner at cs.uiuc.edu Fri Oct 10 17:57:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 17:57:01 2003 Subject: [llvm-commits] CVS: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Message-ID: <200310102256.RAA10631@apoc.cs.uiuc.edu> Changes in directory llvm/runtime/GCCLibraries/crtend: C++-Exception.cpp updated: 1.10 -> 1.11 --- Log message: Actually pass in a pointer to the thrown object, not a pointer to the exception header. This is the final missing piece from the PR#27 puzzle. --- Diffs of the changes: (+1 -1) Index: llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp diff -u llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.10 llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.11 --- llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp:1.10 Fri Oct 10 13:46:52 2003 +++ llvm/runtime/GCCLibraries/crtend/C++-Exception.cpp Fri Oct 10 17:55:55 2003 @@ -71,7 +71,7 @@ // Run the exception object dtor if it exists. */ if (E->ExceptionObjectDestructor) - E->ExceptionObjectDestructor(E); + E->ExceptionObjectDestructor(E+1); } // __llvm_cxxeh_throw - Given a pointer to memory which has an exception object From gaeke at cs.uiuc.edu Fri Oct 10 19:11:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 19:11:01 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310110010.TAA08672@psmith.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.45 -> 1.46 --- Log message: Quote qmtest args in $(CONTEXT). I don't remember precisely what bug this fixed, but I remember that it fixed a bug. Sorry. (I think one of these args had a Funny Shell Character in it, or a space, or something, in my last build, and this seemed like the obvious fix.) --- Diffs of the changes: (+8 -8) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.45 llvm/test/Makefile:1.46 --- llvm/test/Makefile:1.45 Fri Oct 10 15:24:56 2003 +++ llvm/test/Makefile Fri Oct 10 19:10:05 2003 @@ -21,16 +21,16 @@ # This is configuration information used by the test suite. In QM Test, it's # called a 'context.' # -CONTEXT= -c srcroot=$(LLVM_SRC_ROOT) \ - -c buildroot=$(LLVM_OBJ_ROOT) \ - -c buildtype=$(CONFIGURATION) \ - -c tmpdir=$(LLVM_OBJ_ROOT)/test/tmp \ - -c coresize=0 \ - -c cc=$(CC) \ - -c cxx=$(CXX) \ +CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \ + -c "buildroot=$(LLVM_OBJ_ROOT)" \ + -c "buildtype=$(CONFIGURATION)" \ + -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \ + -c "coresize=0" \ + -c "cc=$(CC)" \ + -c "cxx=$(CXX)" \ -c "llvmgcc=$(LLVMGCC)" \ -c "llvmgxx=$(LLVMGXX)" \ - -c make=$(MAKE) + -c "make=$(MAKE)" # # Location of the QMTest program. From gaeke at cs.uiuc.edu Fri Oct 10 22:52:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Fri Oct 10 22:52:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/Emitter.cpp Message-ID: <200310110351.WAA09007@psmith.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: Emitter.cpp updated: 1.27 -> 1.28 --- Log message: Make mmap's fd for anonymous memory acquisition default to -1, except on Linux. This is consistent with what FreeBSD and Solaris both want. This makes the JIT work on FreeBSD 5.1-RELEASE. Whee. --- Diffs of the changes: (+7 -2) Index: llvm/lib/ExecutionEngine/JIT/Emitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.27 llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.28 --- llvm/lib/ExecutionEngine/JIT/Emitter.cpp:1.27 Fri Oct 10 13:46:26 2003 +++ llvm/lib/ExecutionEngine/JIT/Emitter.cpp Fri Oct 10 22:51:18 2003 @@ -56,12 +56,17 @@ #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) # define MAP_ANONYMOUS MAP_ANON #endif /* defined(MAP_ANON) && !defined(MAP_ANONYMOUS) */ -#define fd 0 #elif defined(sparc) || defined(__sparc__) || defined(__sparcv9) -#define fd -1 +/* nothing */ #else std::cerr << "This architecture is not supported by the JIT!\n"; abort(); +#endif + +#if defined(__linux__) +#define fd 0 +#else +#define fd -1 #endif unsigned mmapFlags = MAP_PRIVATE|MAP_ANONYMOUS; From gaeke at cs.uiuc.edu Sat Oct 11 00:35:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Sat Oct 11 00:35:01 2003 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl Message-ID: <200310110534.AAA09549@psmith.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.32 -> 1.33 --- Log message: Greatly expand documentation comment at head of file... I had to try to understand it; maybe this will help someone else do so too. Default CVSRootDir to $CVSROOT first, then the path in ~vadve only if $CVSROOT was not set. Checkout with -z3 if we might be checking out over ssh/rsh. Check the filename of gnuplot to see if it is executable; if not, as a last resort, try just plain "gnuplot", hoping it is in the path somewhere. Remove a little extra whitespace. --- Diffs of the changes: (+33 -9) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.32 llvm/utils/NightlyTest.pl:1.33 --- llvm/utils/NightlyTest.pl:1.32 Tue Sep 23 17:02:01 2003 +++ llvm/utils/NightlyTest.pl Sat Oct 11 00:34:00 2003 @@ -7,12 +7,34 @@ # regressions and performance changes. This generates one web page a # day which can be used to access this information. # -# Syntax: NightlyTest.pl +# Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] +# where +# OPTIONS may include one or more of the following: +# -nocheckout Do not create, checkout, update, or configure +# the source tree. +# -noremove Do not remove the BUILDDIR after it has been built. +# -notest Do not even attempt to run the test programs. Implies +# -norunningtests. +# -norunningtests Do not run the Olden benchmark suite with +# LARGE_PROBLEM_SIZE enabled. +# -parallel Run two parallel jobs with GNU Make. +# CVSROOT is the CVS repository from which the tree will be checked out, +# specified either in the full :method:user at host:/dir syntax, or +# just /dir if using a local repo. +# BUILDDIR is the directory where sources for this test run will be checked out +# AND objects for this test run will be built. This directory MUST NOT +# exist before the script is run; it will be created by the cvs checkout +# process and erased (unless -noremove is specified; see above.) +# WEBDIR is the directory into which the test results web page will be written, +# AND in which the "index.html" is assumed to be a symlink to the most recent +# copy of the results. This directory MUST exist before the script is run. # use POSIX qw(strftime); -my $HOME = $ENV{HOME}; -my $CVSRootDir = "/home/vadve/vadve/Research/DynOpt/CVSRepository"; +my $HOME = $ENV{'HOME'}; +my $CVSRootDir = $ENV{'CVSROOT'}; +my $CVSRootDir = "/home/vadve/vadve/Research/DynOpt/CVSRepository" + unless $CVSRootDir; my $BuildDir = "$HOME/buildtest"; my $WebDir = "$HOME/cvs/testresults-X86"; @@ -96,6 +118,7 @@ my $NORUNNINGTESTS = 0; my $MAKEOPTS = ""; + # Parse arguments... while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { shift; @@ -142,7 +165,9 @@ # # Check out the llvm tree, saving CVS messages to the cvs log... # -system "(time -p cvs -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1" +$CVSOPT = ""; +$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh. +system "(time -p cvs $CVSOPT -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1" if (!$NOCHECKOUT); chdir "llvm" or die "Could not change into llvm directory!"; @@ -455,16 +480,16 @@ # # Rebuild the graphs now... # -system "/usr/dcs/software/supported/bin/gnuplot " . - "$BuildDir/llvm/utils/NightlyTest.gnuplot"; +$GNUPLOT = "/usr/dcs/software/supported/bin/gnuplot"; +$GNUPLOT = "gnuplot" if ! -x $GNUPLOT; +$PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot"; +system ($GNUPLOT, $PlotScriptFilename); # # Remove the cvs tree... # system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE); - - # # Print out information... # @@ -477,7 +502,6 @@ print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n"; print "WARNINGS:\n $WarningsList\n"; - print "Users committed: $UserCommitList\n"; print "Added Files: \n $AddedFilesList\n"; From gaeke at cs.uiuc.edu Sat Oct 11 11:42:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Sat Oct 11 11:42:01 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/Trace.h Message-ID: <200310111641.LAA23668@tank.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: Trace.h updated: 1.3 -> 1.4 --- Log message: Add prototypes for "dominates" method of Trace object. --- Diffs of the changes: (+5 -0) Index: reopt/lib/LightWtProfiling/Trace.h diff -u reopt/lib/LightWtProfiling/Trace.h:1.3 reopt/lib/LightWtProfiling/Trace.h:1.4 --- reopt/lib/LightWtProfiling/Trace.h:1.3 Tue Aug 19 16:38:49 2003 +++ reopt/lib/LightWtProfiling/Trace.h Sat Oct 11 11:41:47 2003 @@ -77,6 +77,11 @@ BasicBlock *operator[] (unsigned i) const { return BasicBlocks[i]; } BasicBlock *getBlock (unsigned i) const { return BasicBlocks[i]; } + + bool dominates (const BasicBlock *B1, const BasicBlock *B2, + const BasicBlock *start); + bool dominates (const BasicBlock *B1, const BasicBlock *B2); + }; #endif // TRACE_H From gaeke at cs.uiuc.edu Sat Oct 11 11:44:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Sat Oct 11 11:44:00 2003 Subject: [llvm-commits] CVS: reopt/lib/LightWtProfiling/TraceToFunction.cpp Message-ID: <200310111643.LAA23700@tank.cs.uiuc.edu> Changes in directory reopt/lib/LightWtProfiling: TraceToFunction.cpp updated: 1.4 -> 1.5 --- Log message: Rewrite getTraceLive{Out,In}Set() in terms of DefinedInTraceBeforeUse(), which is defined in terms of Trace::dominates(). I'm not sure if this stuff is working yet, but I'm going nuts trying to keep track of the 39834 different modified versions of this file I have. Arr. --- Diffs of the changes: (+83 -26) Index: reopt/lib/LightWtProfiling/TraceToFunction.cpp diff -u reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.4 reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.5 --- reopt/lib/LightWtProfiling/TraceToFunction.cpp:1.4 Sat Sep 13 16:12:11 2003 +++ reopt/lib/LightWtProfiling/TraceToFunction.cpp Sat Oct 11 11:43:17 2003 @@ -14,6 +14,7 @@ #include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/Constants.h" +#include "llvm/Support/CFG.h" // for succ_iterator, etc. #include "Support/StringExtras.h" // for utostr() #include "Support/Debug.h" // for DEBUG() #include @@ -40,8 +41,73 @@ virtual Function *traceToFunction (Trace &T); }; -/// getTraceLiveInSet - Return the set of variables which are used in -/// the trace but which are not defined in the trace. +bool Trace::dominates (const BasicBlock *B1, const BasicBlock *B2, + const BasicBlock *start) { + if (start == B1) { + return true; // Seen B1 on this path, if we see B2 later it's OK. + } else if (start == B2) { + return false; // Seen B2, w/o seeing B1 earlier on this path. Not OK. + } else { + // If any successors are on the trace, AND not the entry BB, check them too. + // (Stop at entry BB because we don't want to loop if the CFG loops.) + for (succ_const_iterator i = succ_begin (start), e = succ_end (start); + i != e; ++i) { + const BasicBlock *succ = *i; + if (contains (succ) && (getEntryBasicBlock () != succ) + && (!dominates (B1, B2, succ))) + return false; + } + return true; // Dominates on all successors ==> dominates here too + } +} + +bool Trace::dominates (const BasicBlock *B1, const BasicBlock *B2) { + return dominates (B1, B2, getEntryBasicBlock ()); +} + +static bool DefinedInTraceBeforeUse (Value *V, Trace &T) { + Instruction *Inst = dyn_cast (V); + if (!Inst) + return false; + BasicBlock *Block = Inst->getParent (); + if (!T.contains (Block)) // Is V defined in trace? + return false; + for (Value::use_iterator ui = V->use_begin (), ue = V->use_end (); + ui != ue; ++ui) { + Instruction *UInst = dyn_cast (*ui); + if (!UInst) // Non-Instruction Users scare me, mommy + return false; + BasicBlock *UBlock = UInst->getParent (); + if (Block == UBlock) { + // Start at Block->begin() traversing next pointers; if UInst + // appears BEFORE Inst in Block's InstList, return false + for (BasicBlock::const_iterator bi = Block->begin (), be = Block->end (); + bi != be; ++bi) { + const Instruction *BlockInst = bi; + if (BlockInst == UInst) + return false; + else if (BlockInst == Inst) + break; + } + } else { + if (!T.contains (UBlock)) + return false; + else { + // If UBlock appears BEFORE Block on some path from the first + // basic block of the trace to an exit BB of the trace, return + // false. + if (!T.dominates (Block, UBlock)) + return false; + } + } + } + return true; +} + +/// getTraceLiveInSet - Return the live-in set of the trace. Any +/// variable which is used in the trace is potentially live-in, EXCEPT +/// if it's a constant or a global, OR it is defined before being used +/// in the trace. /// static LiveVariableSet getTraceLiveInSet (Trace &T) { LiveVariableSet S; @@ -54,10 +120,8 @@ for (unsigned i = 0; i < I.getNumOperands (); ++i) { Value *V = I.getOperand (i); // V is used in the trace by instruction I. - if (Instruction *VI = dyn_cast (V)) - // V is defined by an instruction; not a constant or global. - if (!T.contains (VI->getParent ())) - // V is defined by an instruction outside the trace. + if (!(isa (V) || isa (V))) + if (DefinedInTraceBeforeUse (V, T)) S.insert (V); } } @@ -65,30 +129,23 @@ return S; } -/// getTraceLiveOutSet - Return the set of variables which are defined -/// by an instruction inside the trace, and used in an instruction -/// outside the trace (but within that trace's function.) +/// getTraceLiveOutSet - Any variable defined within the trace is +/// potentially live-out, EXCEPT if its only uses are in the trace AND +/// come after the def. /// static LiveVariableSet getTraceLiveOutSet (Trace &T) { LiveVariableSet S; Function &F = *T.getFunction(); - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) { - BasicBlock &B = *FI; - if (!T.contains (&B)) { - for (BasicBlock::iterator BI = B.begin(), BE = B.end(); BI != BE; ++BI) { - Instruction &I = *BI; - // I is an instruction in the trace's function, but outside the trace. - // Check its operands for uses of values defined in the trace. - for (unsigned i = 0; i < I.getNumOperands (); ++i) { - Value *V = I.getOperand (i); - // V is used outside the trace by instruction I. - if (Instruction *VI = dyn_cast (V)) - // V is defined by an instruction; not a constant or global. - if (T.contains (VI->getParent ())) - // V is defined by an instruction inside the trace. - S.insert (V); - } - } + for (Trace::iterator TI = T.begin (), TE = T.end (); TI != TE; ++TI) { + BasicBlock *B = *TI; + // B is a basic block in the trace. + for (BasicBlock::iterator BI = B->begin (), BE = B->end (); BI != BE; ++BI){ + Instruction &I = *BI; + Value *V = &I; + // I is an instruction in B, which is in the trace. + // (Does it define a value? FIXME) + if (!DefinedInTraceBeforeUse (V, T)) + S.insert (&I); } } return S; From lattner at cs.uiuc.edu Sat Oct 11 16:18:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:18:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/ Message-ID: <200310112117.QAA20968@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/ Message-ID: <200310112118.QAA21097@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:10 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/ Message-ID: <200310112118.QAA21112@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:20 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:20 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/ Message-ID: <200310112118.QAA21102@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:30 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:30 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/ Message-ID: <200310112118.QAA21107@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:39 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:39 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/ Message-ID: <200310112118.QAA21117@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:49 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:49 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/ Message-ID: <200310112118.QAA21127@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:19:58 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:19:58 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/Makefile README_LLVM.txt Message-ID: <200310112118.QAA21166@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench: Makefile added (r1.1) README_LLVM.txt added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+16 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:51 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/Makefile Sat Oct 11 16:18:41 2003 *************** *** 0 **** --- 1,6 ---- + # MultiSource/Olden Makefile: Build all subdirectories automatically + + LEVEL = ../../../../.. + PARALLEL_DIRS := $(filter-out %-disabled/, $(sort $(filter-out CVS/, $(wildcard */)))) + + include $(LEVEL)/test/Programs/Makefile.programs Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/README_LLVM.txt diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/README_LLVM.txt:1.1 *** /dev/null Sat Oct 11 16:18:51 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/README_LLVM.txt Sat Oct 11 16:18:41 2003 *************** *** 0 **** --- 1,10 ---- + These are benchmarks from the FreeBench benchmark suite, version 1.03. + + Freebench is a freely available and redistributable suite, with a web page here: + http://www.freebench.org/ + + In default mode, the LLVM harness runs the 'test' inputs, with + LARGE_PROBLEM_SIZE, they run the full sized "ref" inputs. + + Characteristics of the individual benchmarks are described here: + http://www.freebench.org/benchmarks.shtml From lattner at cs.uiuc.edu Sat Oct 11 16:20:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:20:08 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/ Message-ID: <200310112118.QAA21122@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2 added to the repository --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Sat Oct 11 16:20:18 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:20:18 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile fourinarow.c ref.in test.in Message-ID: <200310112118.QAA21219@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow: Makefile added (r1.1) fourinarow.c added (r1.1) ref.in added (r1.1) test.in added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+716 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = fourinarow + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + #LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/fourinarow.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/fourinarow.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/fourinarow.c Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,700 ---- + /*************************************** + * This program is modified for use in * + * benchmarking puposes. The complete * + * program is used in computer systems * + * research at Chalmers University of * + * Technology, Sweden. Chalmers has * + * nothing to do with this program. * + * * + * Plese feel free to distribute this * + * program as you like. * + * * + * Peter Rundberg, biff at ce.chalmers.se * + ***************************************/ + + /****************************************** + * A simple program that plays 4 in a row. + * Peter Rundberg, biff at ce.chalmers.se + * + * TODO: * Smarter value function that can + * see blocked paths. + * * Parallel MiniMax algorithm. + * * OpenGL interface. + ******************************************/ + /****************************************** + * BUGS: + * * Alpha-Beta method 1 is not + * working, why??? + ******************************************/ + + #include + #include + #include + #include + #include + #include + + /* 64 bit type needed */ + typedef unsigned long long uint64; + + /* The size of the playing field */ + /* It might not work if they are not */ + /* set to ROWS 6 and COLS 7 */ + #define ROWS 6 + #define COLS 7 + + /* Bit patterns for finding sequences */ + /* These are calculated in init_patterns() */ + /* Patterns for finding 4 in a row */ + uint64 C4VERT; + uint64 C4HORIZ; + uint64 C4UP_R; + uint64 C4UP_L; + /* Patterns for finding 3 in a row */ + uint64 C3VERT; + uint64 C3HORIZ; + uint64 C3UP_R; + uint64 C3UP_L; + /* Patterns for finding 2 in a row */ + uint64 C2VERT; + uint64 C2HORIZ; + uint64 C2UP_R; + uint64 C2UP_L; + + /* Rewards for positions */ + #define C4REWARD 1000 + #define C3REWARD 20 + #define C2REWARD 5 + #define C1REWARD 1 + #define HUGE 100000 + + /* Recursion depth in MiniMax algorithm */ + int DEPTH=3; + + /* How offensive should the computer play. */ + /* Setting between -5 and 5 are valid and */ + /* a higher number means more aggresive play. */ + int off=0; + + /* Prototypes */ + int minimax_comp_ab(int depth, uint64 b1, uint64 b2, int *col, int alpha, int beta); + int minimax_player_ab(int depth, uint64 b1, uint64 b2, int *col, int alpha, int beta); + int minimax_comp_ab2(int depth, uint64 b1, uint64 b2, int *col, int beta); + int minimax_player_ab2(int depth, uint64 b1, uint64 b2, int *col, int alpha); + int minimax_comp(int depth, uint64 b1, uint64 b2, int *col); + int minimax_player(int depth, uint64 b1, uint64 b2, int *col); + int bit_place_piece(int col, int player, uint64 *b1, uint64 *b2); + + /* void init_patterns() */ + /* Inits mask patterns with proper bits. */ + void init_patterns() + { + int i; + + for (i=0;i<3;i++) { + C4VERT = C4VERT | 1; + C4VERT = C4VERT << (COLS); + } + C4VERT = C4VERT | 1; + C3VERT = C4VERT >> COLS; + C2VERT = C3VERT >> COLS; + /*printf("Bit patterns: 0x%llx 0x%llx 0x%llx\n",C4VERT,C3VERT,C2VERT); */ + + C4HORIZ = 0xf; + C3HORIZ = C4HORIZ >> 1; + C2HORIZ = C3HORIZ >> 1; + /*printf("Bit patterns: 0x%llx 0x%llx 0x%llx\n",C4HORIZ,C3HORIZ,C2HORIZ); */ + + for (i=0;i<3;i++) { + C4UP_R = C4UP_R | 1; + C4UP_R = C4UP_R << (COLS+1); + } + C4UP_R = C4UP_R | 1; + C3UP_R = C4UP_R >> (COLS+1); + C2UP_R = C3UP_R >> (COLS+1); + /*printf("Bit patterns: 0x%llx 0x%llx 0x%llx\n",C4UP_R,C3UP_R,C2UP_R); */ + + for (i=0;i<3;i++) { + C4UP_L = C4UP_L | 8; + C4UP_L = C4UP_L << (COLS-1); + } + C4UP_L = C4UP_L | 8; + C3UP_L = C4UP_L >> (COLS-1); + C2UP_L = C3UP_L >> (COLS-1); + /*printf("Bit patterns: 0x%llx 0x%llx 0x%llx\n",C4UP_L,C3UP_L,C2UP_L); */ + /*exit(1); */ + } + + + /* void init_board() */ + /* Inits board with dots and height info */ + /* with zeros. */ + void init_board(char b[COLS][ROWS+1]) + { + int i,j; + + for (i=0;i=0;j--) { + printf("%d ",j); + for (i=0;iCOLS-1) { + printf("ERROR: Faulty column: %d.\n",col); + return 1; + } + + if (b[col][ROWS]>=ROWS) { + /* printf("ERROR: Column %d is full.\n",col); */ + return 1; + } + + if (player==1) + b[col][(int) b[col][ROWS]]='o'; + else if (player==2) + b[col][(int) b[col][ROWS]]='x'; + else { + printf("ERROR: Unknown player.\n"); + return 1; + } + + b[col][ROWS]++; + + return 0; + } + + /* Check if board is full */ + int board_full(char b[COLS][ROWS+1]) + { + int i,temp=0; + + for (i=0;i=DEPTH) { + return value(b1, b2); + } + + for (i=0;imax) { + max=tmp; + max_col=i; + } + } + + *col=max_col; + return max; + } + + int minimax_player_ab(int depth, uint64 b1, uint64 b2, int *col, int alpha, int beta) + { + int i,min=beta,min_col=0,tmp; + uint64 tmp_b; + + if (depth>=DEPTH) { + return value(b1, b2); + } + + for (i=0;ialpha;i++) { + tmp_b=b1; + if (bit_place_piece(i,1,&tmp_b,&b2)) + continue; + tmp=minimax_comp_ab(depth+1, tmp_b, b2, col, alpha ,min); + if (tmp<=min) { + min=tmp; + min_col=i; + } + } + + *col=min_col; + return min; + } + + int minimax_comp_ab2(int depth, uint64 b1, uint64 b2, int *col, int beta) + { + int i,max=-HUGE,max_col=0,tmp; + uint64 tmp_b; + + if (depth>=DEPTH) { + return value(b1, b2); + } + + for (i=0;imax) { + max=tmp; + max_col=i; + } + if (max>beta) + return max; + } + + *col=max_col; + return max; + } + + int minimax_player_ab2(int depth, uint64 b1, uint64 b2, int *col, int alpha) + { + int i,min=HUGE,min_col=0,tmp; + uint64 tmp_b; + + if (depth>=DEPTH) { + return value(b1, b2); + } + + for (i=0;i=DEPTH) { + return value(b1, b2); + } + + for (i=0;imax) { + max=tmp; + max_col=i; + } + } + + *col=max_col; + return max; + } + + int minimax_player(int depth, uint64 b1, uint64 b2, int *col) + { + int i,min=HUGE,min_col=0,tmp; + uint64 tmp_b; + + if (depth>=DEPTH) { + return value(b1, b2); + } + + for (i=0;i Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray: Makefile added (r1.1) distray.bc added (r1.1) distray.c added (r1.1) ref.in added (r1.1) test.in added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+462 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = distray + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/distray.bc Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/distray.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/distray.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/distray.c Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,448 ---- + #include + #include + #include + #include + #include + #include + + /* Simple raytracer + * ---------------- + * Features reflections, anti-aliasing + * and soft-shadows. + * + * Written by Marcus Geelnard, benchmarkified by + * Peter Rundberg, biff at ce.chalmers.se + */ + + #define WIDTH 640 + #define HEIGHT 480 + #define EPSILON (1e-5) /* Very small value, used for coordinate-comparsions */ + #define MAXT (1e5) /* Maximum t-distance for an intersection-point */ + #define MAXREC 6 /* Maximum amount of recursions (reflection etc.) */ + /* #define DISTRIB 12 */ /* Amount of distributed rays per "virtual" ray */ + int DISTRIB; + #define DISTLEVELS 3 /* How deep in the recursion-tree to allow distribution */ + + typedef unsigned char UBYTE; + typedef struct { double x,y,z; } VECTOR; + + UBYTE memory[3*WIDTH*HEIGHT]; + + typedef struct { + VECTOR color; /* Object color (r,g,b) */ + double diffuse; /* Diffuse reflection (0-1) */ + double reflect; /* Relefction (0-1) */ + double roughness; /* How rough the reflection is (0=very sharp) */ + } TEXTURE; + + typedef struct { + VECTOR pos; /* Position (x,y,z) */ + double r; /* Radius (or size) */ + TEXTURE t; /* Texture */ + } OBJ; + + /* + * Objects ( = spheres ). Only one sphere. Add more if you like :) + */ + + OBJ objs[] = { + /* Object 1 */ + { + { 0, 4, 1.0 }, 1, + { + { 1.0, 0.4, 0.0 }, + 0.4, + 0.8, + 0.02 + } + }, + /* Object 2 */ + { + { -1, 3, 0.4 }, 0.4, + { + { 0.5, 0.3, 1.0 }, + 0.5, + 0.9, + 0.01 + } + }, + /* Object 3 */ + { + { -0.3, 1, 0.4 }, 0.4, + { + { 0.1, 0.95, 0.2 }, + 0.6, + 0.8, + 0.01 + } + }, + /* Object 4 */ + { + { 1.0, 2, 0.4 }, 0.4, + { + { 0.86, 0.83, 0 }, + 0.7, + 0.6, + 0.01 + } + } + }; + + #define NUMOBJS 4 + + + /* + * Ground position (z-pos), and textures (tiled) + */ + + double Groundpos = 0.0; + TEXTURE Groundtxt[2] = { + { + { 0.0, 0.1, 0.5 }, + 0.8, + 0.44, + 0.02 + }, + { + { 0.6, 1.0, 0.5 }, + 0.8, + 0.44, + 0.01 + }, + }; + + + /* + * Only one light-source is supported (and it's white). + */ + + VECTOR Lightpos = {-3.0, 1.0, 5.0}; + double Lightr = 0.4; /* Light-radius (for soft shadows) */ + + + /* + * The camera position (x,y,z), and orientation. + */ + + VECTOR Camerapos = {1.5, -1.4, 1.2}; + VECTOR Cameraright = {3.0, 1.0, 0.0}; + VECTOR Cameradir = {-1.0, 3.0, 0.0}; + VECTOR Cameraup = {0.0, 0.0, 2.3717}; + + + /* + * Ambient lighting (0.0-1.0) + */ + + double Ambient = 0.3; + + + /* + * Skycolors (Skycolor[0] = horizon, Skycolor[1] = zenit ) + */ + + VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } }; + + + /************************************************************************** + * + * Helpers (geometrical etc). + * + **************************************************************************/ + + long rnd = 0x52462467L; + + static double Jitter( void ) + { + rnd = (1103515245L*rnd + 12345L) & 0x7fffffffL; + return( 1.0-((double)rnd/(double)0x3fffffff) ); + } + + + static void ReflectVector( VECTOR *v2, VECTOR *v1, VECTOR *n ) + { + double a, b; + + b = n->x*n->x + n->y*n->y + n->z*n->z; /* b = |n|^2 */ + a = v1->x*n->x + v1->y*n->y + v1->z*n->z; /* a = v1?n */ + a = -2.0 * a / b; /* a = -2*(v1?n)/|n|^2 */ + v2->x = v1->x + a*n->x; /* v2 = v1 + n*a */ + v2->y = v1->y + a*n->y; + v2->z = v1->z + a*n->z; + } + + + static double VectorLength( VECTOR *v ) + { + return( sqrt( v->x*v->x + v->y*v->y + v->z*v->z ) ); + } + + + static void ScaleVector( VECTOR *v, double s ) + { + v->x *= s; v->y *= s; v->z *= s; + } + + + static void DistribVector( VECTOR *d, VECTOR *n, double sa, double sb ) + { + VECTOR a, b; + double nl; + + if( fabs( n->z ) > EPSILON ) { + a.x = n->y*n->z; a.y = -n->x*n->z; a.z = 0.0; + b.x = a.y*n->z; b.y = -a.x*n->z; b.z = a.x*n->y - a.y*n->x; + } else { + a.x = n->y; a.y = -n->x; a.z = 0.0; + b.x = b.y = 0.0; b.z = 1.0; + } + nl = VectorLength( n ); + ScaleVector( &a, sa*(nl/VectorLength( &a ))*Jitter() ); + ScaleVector( &b, sb*(nl/VectorLength( &b ))*Jitter() ); + d->x = a.x+b.x; d->y = a.y+b.y; d->z = a.z+b.z; + } + + + /************************************************************************** + * + * Object intersection calculation routines. + * + **************************************************************************/ + + static double IntersectObjs( VECTOR *LinP, VECTOR *LinD, + VECTOR *Pnt, VECTOR *Norm, TEXTURE **txt ) + { + int objn, tilenum; + double t, ttmp, A, B, C; + VECTOR Pos; + + t = -1.0; + + /* Try intersection with ground plane first */ + if( fabs(LinD->z) > EPSILON ) { + ttmp = (Groundpos - LinP->z)/LinD->z; + if( ( ttmp > EPSILON ) && ( ttmp < MAXT ) ) { + t = ttmp; + Pnt->x = LinP->x + LinD->x*t; /* Calculate intersection point */ + Pnt->y = LinP->y + LinD->y*t; + Pnt->z = LinP->z + LinD->z*t; + Norm->x = 0.0; /* Surface normal (always up) */ + Norm->y = 0.0; + Norm->z = 1.0; + tilenum = ( ((int)(Pnt->x+50000.0))+((int)(Pnt->y+50000.0)) ) & 1; + *txt = & Groundtxt[ tilenum ]; + } + } + + /* Get closest intersection (if any) */ + for( objn = 0; objn < NUMOBJS; objn++ ) { + Pos = objs[objn].pos; + Pos.x -= LinP->x; /* Translate object into "line-space" */ + Pos.y -= LinP->y; + Pos.z -= LinP->z; + A = 1.0 / (LinD->x*LinD->x + LinD->y*LinD->y + LinD->z*LinD->z); + B = (Pos.x*LinD->x + Pos.y*LinD->y + Pos.z*LinD->z) * A; + C = (objs[objn].r*objs[objn].r - Pos.x*Pos.x - Pos.y*Pos.y - Pos.z*Pos.z) * A; + if( (A = C + B*B) > 0.0 ) { /* ...else no hit */ + A = sqrt(A); + if( (ttmp = B - A) < EPSILON ) ttmp = B + A; + if( (EPSILONx = LinD->x*t; /* Calculate intersection point */ + Pnt->y = LinD->y*t; + Pnt->z = LinD->z*t; + Norm->x = Pnt->x-Pos.x; /* Calcualate surface normal */ + Norm->y = Pnt->y-Pos.y; + Norm->z = Pnt->z-Pos.z; + Pnt->x += LinP->x; /* Translate object back to "true-space" */ + Pnt->y += LinP->y; + Pnt->z += LinP->z; + *txt = &objs[objn].t; /* Get surface properties */ + } + } + } + + return( t ); + } + + + /************************************************************************** + * + * Line-tracer routine (works recursively). + * + **************************************************************************/ + + static void TraceLine( VECTOR *LinP, VECTOR *LinD, VECTOR *Color, int reccount ) + { + VECTOR Pnt, Norm, LDir, NewDir, NewDir2, TmpCol, TmpCol2; + VECTOR TmpPnt, TmpNorm, D; + double t, A, cosfi; + TEXTURE *txt, *tmptxt; + int i, shadowcount, usedist; + + Color->x = Color->y = Color->z = 0.0; + + if( reccount > 0 ) { + /* Only use distributed tracing in higher nodes of the recursion tree */ + usedist = ( (MAXREC-reccount) < DISTLEVELS ) ? 1 : 0; + + /* Try intersection with objects */ + t = IntersectObjs( LinP, LinD, &Pnt, &Norm, &txt ); + + /* Get light-intensity in intersection-point (store in cosfi) */ + if( t > EPSILON ) { + LDir.x = Lightpos.x-Pnt.x; /* Get line to light from surface */ + LDir.y = Lightpos.y-Pnt.y; + LDir.z = Lightpos.z-Pnt.z; + cosfi = LDir.x*Norm.x + LDir.y*Norm.y + LDir.z*Norm.z; + if(cosfi > 0.0) { /* If angle between lightline and normal < PI/2 */ + shadowcount = 0; + if( usedist ) { + A = Lightr / VectorLength( &LDir ); + for( i = 0; i < DISTRIB; i++ ) { + DistribVector( &D, &LDir, A, A ); + NewDir = LDir; + NewDir.x += D.x; NewDir.y += D.y; NewDir.z += D.z; + /* Check for shadows (ignore hit info, may be used though) */ + t = IntersectObjs( &Pnt, &NewDir, &TmpPnt, &TmpNorm, &tmptxt ); + if( ( t < EPSILON ) || ( t > 1.0 ) ) shadowcount++; + } + } else { + t = IntersectObjs( &Pnt, &LDir, &TmpPnt, &TmpNorm, &tmptxt ); + if( ( t < EPSILON ) || ( t > 1.0 ) ) shadowcount = DISTRIB; + } + if( shadowcount > 0 ) { + A = Norm.x*Norm.x + Norm.y*Norm.y + Norm.z*Norm.z; + A *= LDir.x*LDir.x + LDir.y*LDir.y + LDir.z*LDir.z; + cosfi = (cosfi/sqrt(A))*txt->diffuse*(double)shadowcount/DISTRIB; + } else { + cosfi = 0.0; + } + } else { + cosfi = 0.0; + } + Color->x = txt->color.x*(Ambient+cosfi); + Color->y = txt->color.y*(Ambient+cosfi); + Color->z = txt->color.z*(Ambient+cosfi); + if( txt->reflect > EPSILON ) { + ReflectVector( &NewDir, LinD, &Norm ); + TmpCol.x = TmpCol.y = TmpCol.z = 0.0; + if( usedist && ( txt->roughness > EPSILON ) ) { + for( i = 0; i < DISTRIB; i++ ) { + DistribVector( &D, &NewDir, txt->roughness, txt->roughness ); + NewDir2 = NewDir; + NewDir2.x += D.x; NewDir2.y += D.y; NewDir2.z += D.z; + TraceLine( &Pnt, &NewDir2, &TmpCol2, reccount-1 ); + TmpCol.x += TmpCol2.x; + TmpCol.y += TmpCol2.y; + TmpCol.z += TmpCol2.z; + } + ScaleVector( &TmpCol, 1.0/DISTRIB ); + } else { + TraceLine( &Pnt, &NewDir, &TmpCol, reccount-1 ); + } + Color->x += TmpCol.x * txt->reflect; + Color->y += TmpCol.y * txt->reflect; + Color->z += TmpCol.z * txt->reflect; + } + } else { + /* Get sky-color (interpolate between horizon and zenit) */ + A = sqrt( LinD->x*LinD->x + LinD->y*LinD->y ); + if( A > 0.0 ) A = atan( fabs( LinD->z ) / A )*0.63661977; + else A = 1.0; + Color->x = Skycolor[1].x*A + Skycolor[0].x*(1.0-A); + Color->y = Skycolor[1].y*A + Skycolor[0].y*(1.0-A); + Color->z = Skycolor[1].z*A + Skycolor[0].z*(1.0-A); + } + + /* Make sure that the color does not exceed the maximum level */ + if(Color->x > 1.0) Color->x = 1.0; + if(Color->y > 1.0) Color->y = 1.0; + if(Color->z > 1.0) Color->z = 1.0; + } + } + + static void TraceScene(void) + { + VECTOR PixColor, Col, LinD, Scale; + VECTOR LinD2, D; + int sx, sy, i; + + Scale.y = 1.0; + for( sy = 0; sy < HEIGHT; sy++ ) { + Scale.z = ((double)(HEIGHT/2-sy))/(double)HEIGHT; + for( sx = 0; sx < WIDTH; sx++ ) { + Scale.x = ((double)(sx-WIDTH/2))/(double)WIDTH; + + /* Calculate line-direction (from camera-center through a pixel) */ + LinD.x = Cameraright.x*Scale.x + Cameradir.x*Scale.y + Cameraup.x*Scale.z; + LinD.y = Cameraright.y*Scale.x + Cameradir.y*Scale.y + Cameraup.y*Scale.z; + LinD.z = Cameraright.z*Scale.x + Cameradir.z*Scale.y + Cameraup.z*Scale.z; + + /* Get color for pixel */ + #if (DISTLEVELS > 0) + PixColor.x = PixColor.y = PixColor.z = 0.0; + for( i = 0; i < DISTRIB; i++ ) { + DistribVector( &D, &LinD, 0.5/(double)WIDTH, 0.5/(double)HEIGHT ); + LinD2 = LinD; LinD2.x += D.x; LinD2.y += D.y; LinD2.z += D.z; + TraceLine( &Camerapos, &LinD2, &Col, MAXREC ); + PixColor.x += Col.x; + PixColor.y += Col.y; + PixColor.z += Col.z; + } + ScaleVector( &PixColor, 1.0/DISTRIB ); + #else + TraceLine( &Camerapos, &LinD, &PixColor, MAXREC ); + #endif + + memory[3*(sx+sy*WIDTH)]=(UBYTE)(PixColor.x*255.0); + memory[3*(sx+sy*WIDTH)+1]=(UBYTE)(PixColor.y*255.0); + memory[3*(sx+sy*WIDTH)+2]=(UBYTE)(PixColor.z*255.0); + } + } + } + + + /************************************************************************** + * + * main() - Camera emulation and picture output to stdout. + * + **************************************************************************/ + + int main(int c, char *v[]) + { + int i; + + FILE *in_fp; + + fprintf(stderr,"Compile date: %s\n", COMPDATE); + fprintf(stderr,"Compiler switches: %s\n", CFLAGS); + + in_fp=fopen(v[1],"r"); + if (!in_fp) { + printf("ERROR: Could not open indata file\n"); + exit(1); + } + + fscanf(in_fp,"%d",&DISTRIB); + fclose(in_fp); + /* End of Benchmark stuff */ + + + /* Write PPM header to stdout */ + fprintf( stdout, "P6" ); fputc( 10, stdout ); + fprintf( stdout, "%d %d", WIDTH, HEIGHT ); fputc( 10, stdout ); + fprintf( stdout, "255" ); fputc( 10, stdout ); + + /***...calculate image...***/ + TraceScene(); + + /***...write image to stdout...***/ + for (i=0 ; i<3*WIDTH*HEIGHT ; ) { + fputc( memory[i++], stdout); + fputc( memory[i++], stdout); + fputc( memory[i++], stdout); + } + + return 0; /***...ANSI C wants main to return an int...***/ + } Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/ref.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/ref.in:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/ref.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1 ---- + 6 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1 ---- + 1 From lattner at cs.uiuc.edu Sat Oct 11 16:20:39 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:20:39 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile neural.c ref.in test.in Message-ID: <200310112118.QAA21251@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural: Makefile added (r1.1) neural.c added (r1.1) ref.in added (r1.1) test.in added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+1810 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = neural + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/neural.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/neural.c:1.1 *** /dev/null Sat Oct 11 16:18:58 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/neural.c Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,785 ---- + /* (C) 1996, 2001 Fredrik Warg + * + * CHANGELOG + * 2001-02-06: This program was originally an assignment in a course in + * neural networks, all the way back in 1996. It has been modified for use + * with FreeBench. + * + * 1996-09-29: + * This program stores letters represented as x*y bit patterns in a Hopfield + * network using Hebbian/Delta learning. The program can be trained with all letters + * at once or step-by-step so that the progress can be studied closely. Functions + * for unlearning using random vectors and for creating generators for the + * stored patterns using the clamping method are also available. For the function + * that find the closest stable state for a probe vector, both bipolar and + * continuous versions are available. The program uses a simple menu system for + * manouvering. The letters are read from the file 'w.txt'. + * + * The program has no error-detection code. Erroneus input or failure to find + * the input file will create undefined output. So will using the functions + * in the menu in the wrong order or using a wrongly formatted input file :) + */ + + /* include files */ + #include + #include + #include + #include + + #define BENCHMARK /* Run the program as a benchmark */ + + /* flags for normal or complement hamming distance computation mode */ + #define MODE_NORMAL 1 + #define MODE_COMPLEMENT -1 + + /* flags for all at once or step by step T-matrix computation mode */ + #define MODE_ALL 1 + #define MODE_TRACE 2 + + /* flags for continuous or two-valued neuron mode */ + #define MODE_CONT 1 + #define MODE_BIN 2 + + /* Parametrizing the NN */ + + /* + #define NNWIDTH 30 + #define NNHEIGHT 42 + #define NNTOT 1260 + #define NUMPATS 10 + */ + + int NNWIDTH; + int NNHEIGHT; + int NNTOT; + int NUMPATS; + + /* Typedefs */ + typedef enum {WFALSE, WTRUE} wbool; + typedef float real; + + /* Global variables */ + + /* + char vnames[NUMPATS]; + int vectors[NUMPATS][NNTOT], newvectors[NUMPATS][NNTOT], generators[NUMPATS][NNTOT]; + real Tmatrix[NNTOT][NNTOT]; + */ + + char *vnames; + int *stored; + real **Tmatrix; + int **vectors, **newvectors, **generators; + int nmode=MODE_BIN; + unsigned long randnum; + + + /* Function Declarations */ + static int hamming(int *ny, int *orig, int mode); + static void checkham (); + static void generateT (int mode); + static void delta(real n); + static int run (signed int *source, signed int *dest); + static void readvector (FILE *fp); + static void storecheck (); + static void printT(); + static void printV(int vector, signed int *vect); + static void unlearn(int seed, int iter); + static int runcont(signed int *source, signed int *dest); + static void mysrand(unsigned long seed); + static real myrand(); + static double myexp(double in); + + #ifndef BENCHMARK + static void printvec (int vecs[][]); + static void makegenerators(int n); + static void usegenerators(int n); + #endif + + /* The main function types the menu and calls the appropriate function requested by the user + * until the user types 'q' to quit the program. */ + int main (int c, char *v[]) + { + FILE *fp; + char indata[100]; + int i; + + fprintf(stderr,"Compile date: %s\n", COMPDATE); + fprintf(stderr,"Compiler switches: %s\n", CFLAGS); + + if (c!=2) { + fprintf(stderr,"Wrong number of arguments, 1 needed, %d specified.\n",c-1); + fprintf(stderr,"USAGE: %s \n",v[0]); + exit(1); + } + + fp=fopen(v[1], "r"); + if (fp==NULL) { + fprintf(stderr,"ABORT: Could not read datafile %s\n",v[1]); + exit(1); + } + + /* Size of NeuralNet specifed in datafile. */ + fgets(indata,99,fp); + NNWIDTH = atoi(indata); + fgets(indata,99,fp); + NNHEIGHT = atoi(indata); + fgets(indata,99,fp); + NUMPATS = atoi(indata); + NNTOT = NNWIDTH*NNHEIGHT; + + printf("Matrix size is %dx%d\n",NNWIDTH,NNHEIGHT); + + /* Allocating lots of space... */ + + vnames = (char *)malloc(sizeof(char)*NUMPATS); + stored = (int *)malloc(sizeof(int)*NUMPATS); + if (!vnames || !stored) { + fprintf(stderr,"ABORT: Out of memory\n"); + exit(1); + } + + Tmatrix = (real **)malloc(sizeof(real *)*NNTOT); + if (!Tmatrix) { + fprintf(stderr,"ABORT: Out of memory\n"); + exit(1); + } + for (i=0; i "); + option=getchar(); + getchar(); + switch(option) { + case 'r' : + readvector(); + checkham(); + break; + case 'p' : + printvec(vectors); + break; + case 't' : + generateT(MODE_ALL); + break; + case 's' : + generateT(MODE_TRACE); + break; + case 'c' : + storecheck(); + break; + case 'u' : + unlearn(); + break; + case 'g' : + makegenerators(); + usegenerators(); + break; + case 'm' : + printT(); + break; + case 'z' : + nmode=MODE_CONT; + printf("Continuous meurons used!"); + break; + case 'x' : + nmode=MODE_BIN; + printf("Two-valued neurons used"); + break; + } + } while(option != 'q'); + */ + + return 0; + } /* main */ + + + /* Computes the hamming distance between ny and orig, two 35-bit vectors. + * Mode is one of MODE_NORMAL or MODE_COMPLEMENT. The latter computes the + * hamming distence between ny and the complement vector of orig. */ + static int hamming(signed int *ny, signed int *orig, int mode) + { + int hd=0, neuron; + + for(neuron=0; neuron%d!!] ", vnames[vec], vnames[comp], hd); */ hamwarn++; + else + /* printf ("%c-%c->%d ",vnames[vec], vnames[comp], hd) */ ; + if((hd=hamming(vectors[vec], vectors[comp], MODE_COMPLEMENT))<2) + /* printf ("[!!%c-%c'->%d!!] ", vnames[vec], vnames[comp], hd); */ hamwarn++; + else + /* printf ("%c-%c'->%d ",vnames[vec], vnames[comp], hd)*/ ; + } /* for */ + } /* for */ + /* printf("\n"); */ + if (hamwarn) + printf("WARNING: %d vectors have a hamming distance <2, please modify input vectors!\n",hamwarn); + + } /* checkham */ + + + /* Generates a T-matrix with Hebbian learning. Mode can be MODE_ALL or MODE_TRACE. + * MODE_ALL trains all 10 vectors at once and MODE_TRACE views the current + * learning status between each vector. */ + static void generateT(int mode) + { + int row, col, vec; + char option='0'; + + for(row=0; row=0) ? 1 : -1; + } /* for */ + for(neuron=0; neuron ",vnames[vector]); + for (neuron=0; neuron=0.5) ? 1 : -1; + for(row=0; row=n) break; + } /* if */ + } /* for */ + } /* generators */ + + + /* Proves that the generators works by computing the original vector from the + * generator and print it on the screen. */ + static void usegenerators (int n) + { + signed int genvec[NUMPATS][NNTOT]; + int vec, neuron, count=0; + + for(vec=0; vec=n) break; + } + printf("\nThe vectors recreated using the generators:\n"); + printvec(genvec); + putchar('\n'); + + } /* usegenerators */ + #endif + + /* Same as run, updates 'source' until a stable state is reached and copies the + * computed vector to 'dest'. But runcont uses continuous neurons. Number of iterations + * needed to reach a stable state is returned. */ + static int runcont (signed int source[], signed int dest[]) + { + signed int neuron, row, max=0, maxcont=0; + real *tempvecA, thesum; + signed int *tempvecC; + wbool stable=WFALSE, threshold=WFALSE; + + tempvecA = (real *)malloc((NNTOT)*sizeof(real)); + tempvecC = (signed int *)malloc((NNTOT)*sizeof(signed int)); + if (!tempvecA || !tempvecC) { + fprintf(stderr,"ABORT: Out of memory\n"); + exit(1); + } + + for(neuron=0; neuron0) ? 1 : -1; + if(hamming(dest, tempvecC, MODE_NORMAL)==0) + stable=WTRUE; + else { + neuron=0; + while((neuron2.0e2) + in=200.0; + if (in<-2.0e2) + in=-200.0; + + return exp(in); + } + + /* END OF PROGRAM */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/ref.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/ref.in:1.1 *** /dev/null Sat Oct 11 16:18:58 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/ref.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,720 ---- + 50 + 70 + 10 + F + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX.. + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + r + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .................................................. + .X....X....X....X....X....X....X....X....X....X... + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + .X....X....X....X....X....X....X....X....X....X... + e + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXX + X....X....X....X....X....X....X....X....X....X.... + X....X....X....X....X....X....X....X....X....X.... + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + d + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + ....X....X....X....X....X....X....X....X....X....X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX.XXXX + i + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + K + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + XX...XX...XX...XX...XX...XX...XX...XX...XX...XX... + X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + W + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .................................................. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + A + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + ..X....X....X....X....X....X....X....X....X....X.. + .X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X..X.X. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + G + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X....X....X....X....X....X....X....X....X....X.... + X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + X...XX...XX...XX...XX...XX...XX...XX...XX...XX...X + .XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX..XXX. + 7 + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + .................................................. + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + ....X....X....X....X....X....X....X....X....X....X + ...X....X....X....X....X....X....X....X....X....X. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. + ..X....X....X....X....X....X....X....X....X....X.. Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in:1.1 *** /dev/null Sat Oct 11 16:18:58 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,293 ---- + 20 + 28 + 10 + F + XXXXXXXXXXXXXXXXXXXX + X....X....X....X.... + X....X....X....X.... + XXX..XXX..XXX..XXX.. + X....X....X....X.... + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + X....X....X....X.... + X....X....X....X.... + XXX..XXX..XXX..XXX.. + X....X....X....X.... + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + X....X....X....X.... + X....X....X....X.... + XXX..XXX..XXX..XXX.. + X....X....X....X.... + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + X....X....X....X.... + X....X....X....X.... + XXX..XXX..XXX..XXX.. + X....X....X....X.... + X....X....X....X.... + X....X....X....X.... + r + .................... + .X....X....X....X... + .XXXX.XXXX.XXXX.XXXX + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .................... + .X....X....X....X... + .XXXX.XXXX.XXXX.XXXX + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .................... + .X....X....X....X... + .XXXX.XXXX.XXXX.XXXX + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .................... + .X....X....X....X... + .XXXX.XXXX.XXXX.XXXX + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + .X....X....X....X... + e + .................... + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXX + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + .................... + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXX + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + .................... + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXX + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + .................... + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X.XXXX.XXXX.XXXX.XXX + X....X....X....X.... + X....X....X....X.... + XXXXXXXXXXXXXXXXXXXX + d + ....X....X....X....X + ....X....X....X....X + ....X....X....X....X + .XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX + ....X....X....X....X + ....X....X....X....X + ....X....X....X....X + .XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX + ....X....X....X....X + ....X....X....X....X + ....X....X....X....X + .XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX + ....X....X....X....X + ....X....X....X....X + ....X....X....X....X + .XXXX.XXXX.XXXX.XXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXXX.XXXX.XXXX.XXXX + i + ..X....X....X....X.. + .................... + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + K + X...XX...XX...XX...X + X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X.. + XX...XX...XX...XX... + X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X. + X...XX...XX...XX...X + X...XX...XX...XX...X + X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X.. + XX...XX...XX...XX... + X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X. + X...XX...XX...XX...X + X...XX...XX...XX...X + X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X.. + XX...XX...XX...XX... + X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X. + X...XX...XX...XX...X + X...XX...XX...XX...X + X..X.X..X.X..X.X..X. + X.X..X.X..X.X..X.X.. + XX...XX...XX...XX... + X.X..X.X..X.X..X.X.. + X..X.X..X.X..X.X..X. + X...XX...XX...XX...X + W + .................... + X...XX...XX...XX...X + X...XX...XX...XX...X + X...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX. + .................... + X...XX...XX...XX...X + X...XX...XX...XX...X + X...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX. + .................... + X...XX...XX...XX...X + X...XX...XX...XX...X + X...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX. + .................... + X...XX...XX...XX...X + X...XX...XX...XX...X + X...XX...XX...XX...X + X.X.XX.X.XX.X.XX.X.X + X.X.XX.X.XX.X.XX.X.X + .XXX..XXX..XXX..XXX. + A + ..X....X....X....X.. + .X.X..X.X..X.X..X.X. + X...XX...XX...XX...X + X...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + ..X....X....X....X.. + .X.X..X.X..X.X..X.X. + X...XX...XX...XX...X + X...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + ..X....X....X....X.. + .X.X..X.X..X.X..X.X. + X...XX...XX...XX...X + X...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + ..X....X....X....X.. + .X.X..X.X..X.X..X.X. + X...XX...XX...XX...X + X...XX...XX...XX...X + XXXXXXXXXXXXXXXXXXXX + X...XX...XX...XX...X + X...XX...XX...XX...X + G + .XXX..XXX..XXX..XXX. + X...XX...XX...XX...X + X....X....X....X.... + X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX. + X...XX...XX...XX...X + X....X....X....X.... + X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX. + X...XX...XX...XX...X + X....X....X....X.... + X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXX..XXX..XXX..XXX. + .XXX..XXX..XXX..XXX. + X...XX...XX...XX...X + X....X....X....X.... + X.XX.X.XX.X.XX.X.XX. + X...XX...XX...XX...X + X...XX...XX...XX...X + .XXX..XXX..XXX..XXX. + 7 + .................... + XXXXXXXXXXXXXXXXXXXX + ....X....X....X....X + ...X....X....X....X. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + XXXXXXXXXXXXXXXXXXXX + ....X....X....X....X + ...X....X....X....X. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + XXXXXXXXXXXXXXXXXXXX + ....X....X....X....X + ...X....X....X....X. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. + .................... + XXXXXXXXXXXXXXXXXXXX + ....X....X....X....X + ...X....X....X....X. + ..X....X....X....X.. + ..X....X....X....X.. + ..X....X....X....X.. From lattner at cs.uiuc.edu Sat Oct 11 16:20:51 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:20:51 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/MIRROR.txt Makefile SOLUTION.txt mason.c ref.in test.in Message-ID: <200310112118.QAA21246@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason: MIRROR.txt added (r1.1) Makefile added (r1.1) SOLUTION.txt added (r1.1) mason.c added (r1.1) ref.in added (r1.1) test.in added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+643 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/MIRROR.txt diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/MIRROR.txt:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/MIRROR.txt Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,2 ---- + sol <-> mirror + 0 121 201 210 210 201 020 210 102 120 212 101 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = mason + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + #LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/SOLUTION.txt diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/SOLUTION.txt:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/SOLUTION.txt Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,242 ---- + Solving the Binary Arts(tm) Tripple Cross puzzle, by T. + + + There are two possible ways to move in the puzzle: + The horizontal shuttle with 3 possible positions (from left to right: 0,1,2) + The flip with 2 positions (left-up och left-down) + First move the shuttle to 1 and flip to left-down so that the shape of + the puzzle looks like this: + + X X + X X X X X X X + X X X X X X X + X X + + There are 9 squares that are marked, we will call them: + A - top left part of what should become a ball + B - top right part of ball + C - bottom left part of ball + D - bottom right part of ball + bi - the text "binary" + ar - the text "arts(tm)" + y - there are 3 yellow blobs, all the same. I just call them blobs. + + The correct solution to the puzzle looks like: + + - - + y y y - - A B + - - - - - C D + bi ar + + We will number the positions in the puzzle (with left-down flip) : + + 16 17 + 0 1 2 3 4 5 6 + 7 8 9 10 11 12 13 + 14 15 + + How to move: + Move sequences are written in compact form. + Starting position is assumed to be with flip left-down. + Each single digit means position the shuttle: + 0: leftmost, 1: middle, 2: rightmost + After each positioning of the shuttle, a toggle of the flip is assumed. + + We will solve the puzzle by doing a sequence of moves to for each of the + named squares to put it into the correct position. We will start with A. + Locate A and find the corresponding number of where it is in the + above chart. Then look up that number in the table below to + find a sequence. NOTE: move sequences are written backwards. Read them + right to left. + If A is already at the correct position (5) no moves are needed. + If A is at 3 you should do the move sequence 1202 (It's backwards, remember?) + + A + 0 2021 0102 + 1 20 2102 + 2 20 2101 + 3 2021 + 4 2010 + 5 No moves needed + 6 2101 + 7 20 2010 1020 + 8 2020 1020 + 9 2021 0120 + 10 2020 + 11 0201 + 12 02 + 13 0210 + 14 2020 1010 + 15 20 2010 + 16 20 + 17 21 + + "A" should now be at 5 (which also means B can't be at 5). + Continue with position of B, same way... + + B + 0 20 1021 0102 + 1 1021 2102 + 2 10 2121 0210 + 3 12 1010 2012 + 4 10 1010 + 5 - + 6 No moves needed + 7 1021 2010 1020 + 8 20 1020 1020 + 9 1210 2121 0120 + 10 21 2010 2121 + 11 01 0101 + 12 0101 + 13 01 + 14 20 1020 1021 + 15 21 2010 2120 + 16 1010 + 17 10 + + + C + 0 21 2021 0102 + 1 2120 2010 2010 + 2 2101 2021 0210 + 3 20 1012 0212 + 4 02 0121 2101 + 5 - + 6 - + 7 1212 0120 2121 + 8 02 1021 0120 + 9 2012 0210 1210 + 10 1021 2020 1020 + 11 1201 2120 + 12 No moves needed + 13 2102 1012 + 14 02 1012 0120 + 15 0212 0210 1020 + 16 1210 1201 2101 + 17 2121 0210 + + + D + 0 01 0201 2020 2012 + 1 0102 0120 2101 2010 + 2 1201 2020 2101 0121 + 3 2121 2020 1202 0212 + 4 20 1212 1202 0202 + 5 - + 6 - + 7 0210 2102 0210 1020 + 8 1201 0201 0201 + 9 2121 2020 1020 1012 + 10 2020 1210 2020 + 11 12 0120 1010 1201 + 12 - + 13 No moves needed + 14 1020 1020 1021 + 15 2102 0101 2010 + 16 2101 0120 1012 1010 + 17 12 0121 0202 0201 + + + bi + 0 0210 1010 2020 1020 + 1 2101 2010 1212 1010 + 2 0201 0202 0101 0120 + 3 2020 2020 1020 2020 2010 + 4 0101 2020 1210 2020 1010 + 5 - + 6 - + 7 12 0101 0120 2021 + 8 21 2021 0201 2102 0120 + 9 2010 1210 2020 2012 1010 + 10 0101 2121 0102 1012 + 11 12 0202 1010 1021 + 12 - + 13 - + 14 No moves needed + 15 20 2012 0101 2012 0201 + 16 21 2101 0102 0201 0212 + 17 1201 0202 0101 0121 + + + ar + 0 2010 1212 1010 2101 + 1 1012 1020 1202 1202 1021 + 2 10 2010 2021 0202 0201 + 3 0121 2102 1021 0210 1210 + 4 12 1021 0210 2101 + 5 - + 6 - + 7 12 1010 1202 1010 1201 + 8 0210 1020 2020 2021 0120 + 9 0121 0121 0121 0121 + 10 2102 1021 0210 + 11 1210 1210 1210 1210 + 12 - + 13 - + 14 - + 15 No moves needed + 16 12 1021 0201 2121 0102 + 17 1012 0101 2121 0102 + + + 1st blob (you may chose the blob that gives the shortest sequence here) + 0 No moves needed + 1 01 2021 2101 2101 2101 2102 0210 + 2 01 0201 2021 0202 1010 2010 + 3 02 0201 2020 1202 0120 2010 + 4 01 2010 2101 0120 2101 0121 0210 + 5 - + 6 - + 7 20 1010 1202 0202 0101 0120 2020 + 8 21 0201 0201 0202 1020 2102 1201 + 9 1201 0101 2021 0202 0101 0121 + 10 01 0201 0120 2012 0210 2010 + 11 01 2012 1010 1202 1010 1201 0210 + 12 - + 13 - + 14 - + 15 - + 16 2121 2102 1010 2012 0210 1202 + 17 10 1020 1210 2121 0121 2012 1020 + + + 2nd blob + 0 - + 1 No moves needed + 2 10 1210 2102 1021 0101 + 3 20 1201 2121 0121 0121 0101 + 4 2121 0210 2102 1012 + 5 - + 6 - + 7 21 0202 1210 1212 1021 2020 2101 + 8 20 2101 0202 0202 0210 1202 + 9 1010 1210 1210 1210 1201 + 10 21 2102 1021 0101 2101 2101 + 11 1212 1021 0201 0212 0210 1010 2120 + 12 - + 13 - + 14 - + 15 - + 16 2012 0120 1201 + 17 21 2101 2101 2101 2102 + + + Last blob + 0 - + 1 - + 2 No moves needed + 3 02 0201 2020 1202 0120 2010 + 4 2012 0121 2101 0120 1201 2121 0101 + 5 - + 6 - + 7 2101 2120 1212 1012 1020 2020 1020 + 8 2102 1210 1201 0202 0202 1201 2120 + 9 1012 1012 1012 1012 + 10 10 2102 1012 1012 1012 1010 1201 + 11 0102 1020 2012 0120 1201 0201 2010 + 12 - + 13 - + 14 - + 15 - + 16 2101 2101 2101 2101 + 17 21 2101 2101 2101 2102 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/mason.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/mason.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/mason.c Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1,385 ---- + /* Copyright (c) 2000 Tord Hansson */ + + #define BENCHMARK + + #include + #include + + typedef struct { int a,b,c,d,bi,ar,g1,g2,g3; } p_type; + + static p_type m0u(p_type p) { + int m[]={0, + 8, + 1, + 2, + 16, + 5, + 13, + 7, + 14, + 9, + 3, + 4, + 11, + 12, + 15, + 10, + 17, + 6}; + p_type pu; + + pu.a = m[p.a]; + pu.b = m[p.b]; + pu.c = m[p.c]; + pu.d = m[p.d]; + pu.bi = m[p.bi]; + pu.ar = m[p.ar]; + pu.g1 = m[p.g1]; + pu.g2 = m[p.g2]; + pu.g3 = m[p.g3]; + return pu; + } + + static p_type m1u(p_type p) { + return p; + } + + static p_type m2u(p_type p) { + int m[]={1, + 2, + 9, + 10, + 4, + 17, + 6, + 0, + 8, + 15, + 11, + 12, + 5, + 13, + 7, + 14, + 3, + 16}; + p_type pu; + + pu.a = m[p.a]; + pu.b = m[p.b]; + pu.c = m[p.c]; + pu.d = m[p.d]; + pu.bi = m[p.bi]; + pu.ar = m[p.ar]; + pu.g1 = m[p.g1]; + pu.g2 = m[p.g2]; + pu.g3 = m[p.g3]; + return pu; + + } + + static p_type m0d(p_type p) { + int m[]={0, + 2, + 3, + 10, + 11, + 5, + 17, + 7, + 1, + 9, + 15, + 12, + 13, + 6, + 8, + 14, + 4, + 16}; + p_type pu; + + pu.a = m[p.a]; + pu.b = m[p.b]; + pu.c = m[p.c]; + pu.d = m[p.d]; + pu.bi = m[p.bi]; + pu.ar = m[p.ar]; + pu.g1 = m[p.g1]; + pu.g2 = m[p.g2]; + pu.g3 = m[p.g3]; + return pu; + + } + + static p_type m1d(p_type p) { + return p; + } + + static p_type m2d(p_type p) { + int m[]={7, + 0, + 1, + 16, + 4, + 12, + 6, + 14, + 8, + 2, + 3, + 10, + 11, + 13, + 15, + 9, + 17, + 5}; + p_type pu; + + pu.a = m[p.a]; + pu.b = m[p.b]; + pu.c = m[p.c]; + pu.d = m[p.d]; + pu.bi = m[p.bi]; + pu.ar = m[p.ar]; + pu.g1 = m[p.g1]; + pu.g2 = m[p.g2]; + pu.g3 = m[p.g3]; + return pu; + } + + #define A 0x1 + #define B 0x2 + #define C 0x4 + #define D 0x8 + #define BI 0x10 + #define AR 0x20 + #define G 0x40 + + static int md(p_type p,int maxdep,int dep,int last); + static int mu(p_type p,int maxdep,int dep,int last) { + static int near[] = {0x50,0x70,0x70,0x75,0xf,0xf,0xf,0x70,0x70,0x70,0x7d,0x2b,0x2f,0xf,0x50,0x64,0x67,0xf}; + #define KKK 4 + /* 2 : {0x40,0x40,0x40,0x60,0x0,0x5,0xa,0x50,0x70,0x70,0x24,0xc,0x9,0xe,0x20,0x10,0x1,0x3}; */ + /* {0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,1};*/ + + int win; + if( dep == maxdep - KKK ) { + if(( B & near[p.b]) == 0) return 0; + if(( D & near[p.d]) == 0) return 0; + if(( BI & near[p.bi]) == 0) return 0; + if(( AR & near[p.ar]) == 0) return 0; + if(( A & near[p.a]) == 0) return 0; + if(( C & near[p.c]) == 0) return 0; + if(( G & near[p.g1]) == 0) return 0; + if(( G & near[p.g2]) == 0) return 0; + if(( G & near[p.g3]) == 0) return 0; + } + if((p.a == 5) && (p.b == 6) && (p.c == 12) && (p.d == 13) && (p.bi == 14) && (p.ar == 15) && ((p.g1+p.g2+p.g3) == 3) ) { + printf("Gul: %d %d %d\n",p.g1,p.g2,p.g3); + printf("bin+art: %d %d\n",p.bi,p.ar); + return 1; + } else { + if(maxdep <= dep) return 0; + + win = (last == 0 ? 0 : md(m0u(p),maxdep,dep+1,0)); + if(win == 1) { + putchar('0'); + if((dep % 4) == 0)putchar(' '); + return win; + } else { + win = (last == 1 ? 0 : md(m1u(p),maxdep,dep+1,1)); + if(win == 1) { + putchar('1'); + if((dep % 4) == 0)putchar(' '); + return win; + } else { + win = (last == 2 ? 0 : md(m2u(p),maxdep,dep+1,2)); + if(win == 1) { + putchar('2'); + if((dep % 4) == 0)putchar(' '); + } + return win; + } + } + } + } + + + static int md(p_type p,int maxdep,int dep,int last) { + int win; + + if(maxdep <= dep) return 0; + + win = (last == 0 ? 0 : mu(m0d(p),maxdep,dep+1,0)); + if(win == 1) { + putchar('0'); + if((dep % 4) == 0)putchar(' '); + return win; + } else { + win = (last == 1 ? 0 : mu(m1d(p),maxdep,dep+1,1)); + if(win == 1) { + putchar('1'); + if((dep % 4) == 0)putchar(' '); + return win; + } else { + win = (last == 2 ? 0 : mu(m2d(p),maxdep,dep+1,2)); + if(win == 1) { + putchar('2'); + if((dep % 4) == 0)putchar(' '); + } + return win; + } + } + } + + #ifndef BENCHMARK + static void prnear(int k); + #endif + + int main(int argc,char *argv[]) { + int k; + p_type p; + #ifdef BENCHMARK + FILE *fp; + #endif + + fprintf(stderr,"Compile date: %s\n", COMPDATE); + fprintf(stderr,"Compiler switches: %s\n", CFLAGS); + + #ifndef BENCHMARK + if(argc < 10) { + if(argc == 2) { + prnear(atoi(argv[1])); + } else { + printf(" 16 17\n"); + printf("0 1 2 3 4 5 6\n"); + printf("7 8 9 10 11 12 13\n"); + printf(" 14 15\n\nEnter A B C D e f G G G :\n"); + printf("G G G A B\n"); + printf("e f C D\n"); + } + } else { + p.a = atoi(argv[1]); + p.b = atoi(argv[2]); + p.c = atoi(argv[3]); + p.d = atoi(argv[4]); + p.bi = atoi(argv[5]); + p.ar = atoi(argv[6]); + p.g1 = atoi(argv[7]); + p.g2 = atoi(argv[8]); + p.g3 = atoi(argv[9]); + + for(k=2;;k+=2) { + printf("Trying %d\n",k); + if(mu(p,k,0,-1) == 1) { + putchar('\n'); + exit(0); + } + } + } + #else /* Run it as a benchmark */ + fp=fopen(argv[1],"r"); + if (fp==NULL) { + fprintf(stderr,"ERROR in %s: Could not open datafile %s\n",argv[0],argv[1]); + exit(1); + } + + fscanf(fp,"%d %d %d %d %d %d %d %d %d", + &p.a, &p.b, &p.c, &p.d, &p.bi, &p.ar, &p.g1, &p.g2, &p.g3); + + for(k=2;;k+=2) { + printf("Trying %d\n",k); + if(mu(p,k,0,-1) == 1) { + putchar('\n'); + break; + } + } + #endif + + return 0; + } + + static int neard(p_type p,int maxdep,int dep,int last,int near[]); + static int nearu(p_type p,int maxdep,int dep,int last,int near[]) { + if(maxdep == dep) { + near[p.a] |= A; + near[p.b] |= B; + near[p.c] |= C; + near[p.d] |= D; + near[p.bi] |= BI; + near[p.ar] |= AR; + near[p.g1] |= G; + near[p.g2] |= G; + near[p.g3] |= G; + return 0; + } + + if(last != 0 ) neard(m0u(p),maxdep,dep+1,0,near); + if(last != 1 ) neard(m1u(p),maxdep,dep+1,1,near); + if(last != 2 ) neard(m2u(p),maxdep,dep+1,2,near); + + return 0; /* To quiet the compiler... */ + } + + static int neard(p_type p,int maxdep,int dep,int last,int near[]) { + if(last != 0 ) nearu(m0d(p),maxdep,dep+1,0,near); + if(last != 1 ) nearu(m1d(p),maxdep,dep+1,1,near); + if(last != 2 ) nearu(m2d(p),maxdep,dep+1,2,near); + return 0; + } + + #ifndef BENCHMARK + static void prnear(int k) { + int i; + int near[18]; + p_type correct = {5,6,12,13,14,15,0,1,2}; + + for(i=0;i<18;i++) near[i] = 0; + nearu(correct,k,0,-1,near); + printf("{0x%x",near[0]); + for(i=1;i<18;i++) printf(",0x%x",near[i]); + printf("}\n"); + } + #endif + + /* + normall?ge : skidan i mitten + v?nsterflepp ned?t + numrering : b?rja p? 0; skidan f?rst radvis, sedan vflepp + hflepp + + 16 17 + 00 01 02 03 04 05 06 + 07 08 09 10 11 12 13 + 14 15 + + + Vinst : + G G G A B + E F C D + + Vinster: + 0 1 7 8 + 1 2 8 9 + 2 3 9 10 + 3 4 10 11 + 4 5 11 12 + 5 6 12 13 + + 01 02 + 00 08 09 03 16 17 06 + 07 14 15 10 04 05 13 + 11 12 + + Vinster: + 0 8 7 14 + 8 9 14 15 + 9 3 15 10 + 3 16 10 4 + 16 17 4 5 + 17 6 5 13 + + */ + + + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/ref.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/ref.in:1.1 *** /dev/null Sat Oct 11 16:18:58 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/ref.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1 ---- + 0 1 2 3 4 5 6 7 8 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in:1.1 *** /dev/null Sat Oct 11 16:18:58 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in Sat Oct 11 16:18:47 2003 *************** *** 0 **** --- 1 ---- + 6 5 12 13 14 15 0 1 2 From lattner at cs.uiuc.edu Sat Oct 11 16:21:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:21:03 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile fftsg.c pifft.c ref.in test.in Message-ID: <200310112118.QAA21284@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft: Makefile added (r1.1) fftsg.c added (r1.1) pifft.c added (r1.1) ref.in added (r1.1) test.in added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+4199 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:59 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile Sat Oct 11 16:18:48 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = pifft + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/fftsg.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/fftsg.c:1.1 *** /dev/null Sat Oct 11 16:18:59 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/fftsg.c Sat Oct 11 16:18:48 2003 *************** *** 0 **** --- 1,2641 ---- + /* + Fast Fourier/Cosine/Sine Transform + dimension :one + data length :power of 2 + decimation :frequency + radix :split-radix + data :inplace + table :use + functions + cdft: Complex Discrete Fourier Transform + rdft: Real Discrete Fourier Transform + ddct: Discrete Cosine Transform + ddst: Discrete Sine Transform + dfct: Cosine Transform of RDFT (Real Symmetric DFT) + dfst: Sine Transform of RDFT (Real Anti-symmetric DFT) + function prototypes + void cdft(int, int, double *, int *, double *); + void rdft(int, int, double *, int *, double *); + void ddct(int, int, double *, int *, double *); + void ddst(int, int, double *, int *, double *); + void dfct(int, double *, double *, int *, double *); + void dfst(int, double *, double *, int *, double *); + + + -------- Complex DFT (Discrete Fourier Transform) -------- + [definition] + + X[k] = sum_j=0^n-1 x[j]*exp(2*pi*i*j*k/n), 0<=k + X[k] = sum_j=0^n-1 x[j]*exp(-2*pi*i*j*k/n), 0<=k + ip[0] = 0; // first time only + cdft(2*n, 1, a, ip, w); + + ip[0] = 0; // first time only + cdft(2*n, -1, a, ip, w); + [parameters] + 2*n :data length (int) + n >= 1, n = power of 2 + a[0...2*n-1] :input/output data (double *) + input data + a[2*j] = Re(x[j]), + a[2*j+1] = Im(x[j]), 0<=j= 2+sqrt(n) + strictly, + length of ip >= + 2+(1<<(int)(log(n+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n/2-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + cdft(2*n, -1, a, ip, w); + is + cdft(2*n, 1, a, ip, w); + for (j = 0; j <= 2 * n - 1; j++) { + a[j] *= 1.0 / n; + } + . + + + -------- Real DFT / Inverse of Real DFT -------- + [definition] + RDFT + R[k] = sum_j=0^n-1 a[j]*cos(2*pi*j*k/n), 0<=k<=n/2 + I[k] = sum_j=0^n-1 a[j]*sin(2*pi*j*k/n), 0 IRDFT (excluding scale) + a[k] = (R[0] + R[n/2]*cos(pi*k))/2 + + sum_j=1^n/2-1 R[j]*cos(2*pi*j*k/n) + + sum_j=1^n/2-1 I[j]*sin(2*pi*j*k/n), 0<=k + ip[0] = 0; // first time only + rdft(n, 1, a, ip, w); + + ip[0] = 0; // first time only + rdft(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + + output data + a[2*k] = R[k], 0<=k + input data + a[2*j] = R[j], 0<=j= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n/2-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + rdft(n, 1, a, ip, w); + is + rdft(n, -1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + + -------- DCT (Discrete Cosine Transform) / Inverse of DCT -------- + [definition] + IDCT (excluding scale) + C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k DCT + C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k + ip[0] = 0; // first time only + ddct(n, 1, a, ip, w); + + ip[0] = 0; // first time only + ddct(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + output data + a[k] = C[k], 0<=k= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/4-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + ddct(n, -1, a, ip, w); + is + a[0] *= 0.5; + ddct(n, 1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + + -------- DST (Discrete Sine Transform) / Inverse of DST -------- + [definition] + IDST (excluding scale) + S[k] = sum_j=1^n A[j]*sin(pi*j*(k+1/2)/n), 0<=k DST + S[k] = sum_j=0^n-1 a[j]*sin(pi*(j+1/2)*k/n), 0 + ip[0] = 0; // first time only + ddst(n, 1, a, ip, w); + + ip[0] = 0; // first time only + ddst(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + + input data + a[j] = A[j], 0 + output data + a[k] = S[k], 0= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/4-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + ddst(n, -1, a, ip, w); + is + a[0] *= 0.5; + ddst(n, 1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + + -------- Cosine Transform of RDFT (Real Symmetric DFT) -------- + [definition] + C[k] = sum_j=0^n a[j]*cos(pi*j*k/n), 0<=k<=n + [usage] + ip[0] = 0; // first time only + dfct(n, a, t, ip, w); + [parameters] + n :data length - 1 (int) + n >= 2, n = power of 2 + a[0...n] :input/output data (double *) + output data + a[k] = C[k], 0<=k<=n + t[0...n/2] :work area (double *) + ip[0...*] :work area for bit reversal (int *) + length of ip >= 2+sqrt(n/4) + strictly, + length of ip >= + 2+(1<<(int)(log(n/4+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/8-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + a[0] *= 0.5; + a[n] *= 0.5; + dfct(n, a, t, ip, w); + is + a[0] *= 0.5; + a[n] *= 0.5; + dfct(n, a, t, ip, w); + for (j = 0; j <= n; j++) { + a[j] *= 2.0 / n; + } + . + + + -------- Sine Transform of RDFT (Real Anti-symmetric DFT) -------- + [definition] + S[k] = sum_j=1^n-1 a[j]*sin(pi*j*k/n), 0= 2, n = power of 2 + a[0...n-1] :input/output data (double *) + output data + a[k] = S[k], 0= 2+sqrt(n/4) + strictly, + length of ip >= + 2+(1<<(int)(log(n/4+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/8-1] :cos/sin table (double *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + dfst(n, a, t, ip, w); + is + dfst(n, a, t, ip, w); + for (j = 1; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + . + + + Appendix : + The cos/sin table is recalculated when the larger table required. + w[] and ip[] are compatible with all routines. + */ + + + void cdft(int n, int isgn, double *a, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void cftbsub(int n, double *a, int *ip, int nw, double *w); + int nw; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + if (isgn >= 0) { + cftfsub(n, a, ip + 2, nw, w); + } else { + cftbsub(n, a, ip + 2, nw, w); + } + } + + + void rdft(int n, int isgn, double *a, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void cftbsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void rftbsub(int n, double *a, int nc, double *c); + int nw, nc; + double xi; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > (nc << 2)) { + nc = n >> 2; + makect(nc, ip, w + nw); + } + if (isgn >= 0) { + if (n > 4) { + cftfsub(n, a, ip + 2, nw, w); + rftfsub(n, a, nc, w + nw); + } else if (n == 4) { + cftfsub(n, a, ip + 2, nw, w); + } + xi = a[0] - a[1]; + a[0] += a[1]; + a[1] = xi; + } else { + a[1] = 0.5 * (a[0] - a[1]); + a[0] -= a[1]; + if (n > 4) { + rftbsub(n, a, nc, w + nw); + cftbsub(n, a, ip + 2, nw, w); + } else if (n == 4) { + cftbsub(n, a, ip + 2, nw, w); + } + } + } + + + void ddct(int n, int isgn, double *a, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void cftbsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void rftbsub(int n, double *a, int nc, double *c); + void dctsub(int n, double *a, int nc, double *c); + int j, nw, nc; + double xr; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > nc) { + nc = n; + makect(nc, ip, w + nw); + } + if (isgn < 0) { + xr = a[n - 1]; + for (j = n - 2; j >= 2; j -= 2) { + a[j + 1] = a[j] - a[j - 1]; + a[j] += a[j - 1]; + } + a[1] = a[0] - xr; + a[0] += xr; + if (n > 4) { + rftbsub(n, a, nc, w + nw); + cftbsub(n, a, ip + 2, nw, w); + } else if (n == 4) { + cftbsub(n, a, ip + 2, nw, w); + } + } + dctsub(n, a, nc, w + nw); + if (isgn >= 0) { + if (n > 4) { + cftfsub(n, a, ip + 2, nw, w); + rftfsub(n, a, nc, w + nw); + } else if (n == 4) { + cftfsub(n, a, ip + 2, nw, w); + } + xr = a[0] - a[1]; + a[0] += a[1]; + for (j = 2; j < n; j += 2) { + a[j - 1] = a[j] - a[j + 1]; + a[j] += a[j + 1]; + } + a[n - 1] = xr; + } + } + + + void ddst(int n, int isgn, double *a, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void cftbsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void rftbsub(int n, double *a, int nc, double *c); + void dstsub(int n, double *a, int nc, double *c); + int j, nw, nc; + double xr; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > nc) { + nc = n; + makect(nc, ip, w + nw); + } + if (isgn < 0) { + xr = a[n - 1]; + for (j = n - 2; j >= 2; j -= 2) { + a[j + 1] = -a[j] - a[j - 1]; + a[j] -= a[j - 1]; + } + a[1] = a[0] + xr; + a[0] -= xr; + if (n > 4) { + rftbsub(n, a, nc, w + nw); + cftbsub(n, a, ip + 2, nw, w); + } else if (n == 4) { + cftbsub(n, a, ip + 2, nw, w); + } + } + dstsub(n, a, nc, w + nw); + if (isgn >= 0) { + if (n > 4) { + cftfsub(n, a, ip + 2, nw, w); + rftfsub(n, a, nc, w + nw); + } else if (n == 4) { + cftfsub(n, a, ip + 2, nw, w); + } + xr = a[0] - a[1]; + a[0] += a[1]; + for (j = 2; j < n; j += 2) { + a[j - 1] = -a[j] - a[j + 1]; + a[j] -= a[j + 1]; + } + a[n - 1] = -xr; + } + } + + + void dfct(int n, double *a, double *t, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void dctsub(int n, double *a, int nc, double *c); + int j, k, l, m, mh, nw, nc; + double xr, xi, yr, yi; + + nw = ip[0]; + if (n > (nw << 3)) { + nw = n >> 3; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > (nc << 1)) { + nc = n >> 1; + makect(nc, ip, w + nw); + } + m = n >> 1; + yi = a[m]; + xi = a[0] + a[n]; + a[0] -= a[n]; + t[0] = xi - yi; + t[m] = xi + yi; + if (n > 2) { + mh = m >> 1; + for (j = 1; j < mh; j++) { + k = m - j; + xr = a[j] - a[n - j]; + xi = a[j] + a[n - j]; + yr = a[k] - a[n - k]; + yi = a[k] + a[n - k]; + a[j] = xr; + a[k] = yr; + t[j] = xi - yi; + t[k] = xi + yi; + } + t[mh] = a[mh] + a[n - mh]; + a[mh] -= a[n - mh]; + dctsub(m, a, nc, w + nw); + if (m > 4) { + cftfsub(m, a, ip + 2, nw, w); + rftfsub(m, a, nc, w + nw); + } else if (m == 4) { + cftfsub(m, a, ip + 2, nw, w); + } + a[n - 1] = a[0] - a[1]; + a[1] = a[0] + a[1]; + for (j = m - 2; j >= 2; j -= 2) { + a[2 * j + 1] = a[j] + a[j + 1]; + a[2 * j - 1] = a[j] - a[j + 1]; + } + l = 2; + m = mh; + while (m >= 2) { + dctsub(m, t, nc, w + nw); + if (m > 4) { + cftfsub(m, t, ip + 2, nw, w); + rftfsub(m, t, nc, w + nw); + } else if (m == 4) { + cftfsub(m, t, ip + 2, nw, w); + } + a[n - l] = t[0] - t[1]; + a[l] = t[0] + t[1]; + k = 0; + for (j = 2; j < m; j += 2) { + k += l << 2; + a[k - l] = t[j] - t[j + 1]; + a[k + l] = t[j] + t[j + 1]; + } + l <<= 1; + mh = m >> 1; + for (j = 0; j < mh; j++) { + k = m - j; + t[j] = t[m + k] - t[m + j]; + t[k] = t[m + k] + t[m + j]; + } + t[mh] = t[m + mh]; + m = mh; + } + a[l] = t[0]; + a[n] = t[2] - t[1]; + a[0] = t[2] + t[1]; + } else { + a[1] = a[0]; + a[2] = t[0]; + a[0] = t[1]; + } + } + + + void dfst(int n, double *a, double *t, int *ip, double *w) + { + void makewt(int nw, int *ip, double *w); + void makect(int nc, int *ip, double *c); + void cftfsub(int n, double *a, int *ip, int nw, double *w); + void rftfsub(int n, double *a, int nc, double *c); + void dstsub(int n, double *a, int nc, double *c); + int j, k, l, m, mh, nw, nc; + double xr, xi, yr, yi; + + nw = ip[0]; + if (n > (nw << 3)) { + nw = n >> 3; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > (nc << 1)) { + nc = n >> 1; + makect(nc, ip, w + nw); + } + if (n > 2) { + m = n >> 1; + mh = m >> 1; + for (j = 1; j < mh; j++) { + k = m - j; + xr = a[j] + a[n - j]; + xi = a[j] - a[n - j]; + yr = a[k] + a[n - k]; + yi = a[k] - a[n - k]; + a[j] = xr; + a[k] = yr; + t[j] = xi + yi; + t[k] = xi - yi; + } + t[0] = a[mh] - a[n - mh]; + a[mh] += a[n - mh]; + a[0] = a[m]; + dstsub(m, a, nc, w + nw); + if (m > 4) { + cftfsub(m, a, ip + 2, nw, w); + rftfsub(m, a, nc, w + nw); + } else if (m == 4) { + cftfsub(m, a, ip + 2, nw, w); + } + a[n - 1] = a[1] - a[0]; + a[1] = a[0] + a[1]; + for (j = m - 2; j >= 2; j -= 2) { + a[2 * j + 1] = a[j] - a[j + 1]; + a[2 * j - 1] = -a[j] - a[j + 1]; + } + l = 2; + m = mh; + while (m >= 2) { + dstsub(m, t, nc, w + nw); + if (m > 4) { + cftfsub(m, t, ip + 2, nw, w); + rftfsub(m, t, nc, w + nw); + } else if (m == 4) { + cftfsub(m, t, ip + 2, nw, w); + } + a[n - l] = t[1] - t[0]; + a[l] = t[0] + t[1]; + k = 0; + for (j = 2; j < m; j += 2) { + k += l << 2; + a[k - l] = -t[j] - t[j + 1]; + a[k + l] = t[j] - t[j + 1]; + } + l <<= 1; + mh = m >> 1; + for (j = 1; j < mh; j++) { + k = m - j; + t[j] = t[m + k] + t[m + j]; + t[k] = t[m + k] - t[m + j]; + } + t[0] = t[m + mh]; + m = mh; + } + a[l] = t[0]; + } + a[0] = 0; + } + + + /* -------- initializing routines -------- */ + + + #include + + void makewt(int nw, int *ip, double *w) + { + int j, nwh, nw0, nw1; + double delta, wn4r, wk1r, wk1i, wk3r, wk3i; + + ip[0] = nw; + ip[1] = 1; + if (nw > 2) { + nwh = nw >> 1; + delta = atan(1.0) / nwh; + wn4r = cos(delta * nwh); + w[0] = 1; + w[1] = wn4r; + if (nwh >= 4) { + w[2] = 0.5 / cos(delta * 2); + w[3] = 0.5 / cos(delta * 6); + } + for (j = 4; j < nwh; j += 4) { + w[j] = cos(delta * j); + w[j + 1] = sin(delta * j); + w[j + 2] = cos(3 * delta * j); + w[j + 3] = sin(3 * delta * j); + } + nw0 = 0; + while (nwh > 2) { + nw1 = nw0 + nwh; + nwh >>= 1; + w[nw1] = 1; + w[nw1 + 1] = wn4r; + if (nwh >= 4) { + wk1r = w[nw0 + 4]; + wk3r = w[nw0 + 6]; + w[nw1 + 2] = 0.5 / wk1r; + w[nw1 + 3] = 0.5 / wk3r; + } + for (j = 4; j < nwh; j += 4) { + wk1r = w[nw0 + 2 * j]; + wk1i = w[nw0 + 2 * j + 1]; + wk3r = w[nw0 + 2 * j + 2]; + wk3i = w[nw0 + 2 * j + 3]; + w[nw1 + j] = wk1r; + w[nw1 + j + 1] = wk1i; + w[nw1 + j + 2] = wk3r; + w[nw1 + j + 3] = wk3i; + } + nw0 = nw1; + } + } + } + + + void makect(int nc, int *ip, double *c) + { + int j, nch; + double delta; + + ip[1] = nc; + if (nc > 1) { + nch = nc >> 1; + delta = atan(1.0) / nch; + c[0] = cos(delta * nch); + c[nch] = 0.5 * c[0]; + for (j = 1; j < nch; j++) { + c[j] = 0.5 * cos(delta * j); + c[nc - j] = 0.5 * sin(delta * j); + } + } + } + + + /* -------- child routines -------- */ + + + #ifndef CDFT_RECURSIVE_N /* length of the recursive FFT mode */ + #define CDFT_RECURSIVE_N 512 /* <= (L1 cache size) / 16 */ + #endif + + + void cftfsub(int n, double *a, int *ip, int nw, double *w) + { + void bitrv2(int n, int *ip, double *a); + void bitrv216(double *a); + void bitrv208(double *a); + void cftf1st(int n, double *a, double *w); + void cftrec1(int n, double *a, int nw, double *w); + void cftrec2(int n, double *a, int nw, double *w); + void cftexp1(int n, double *a, int nw, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftf161(double *a, double *w); + void cftf081(double *a, double *w); + void cftf040(double *a); + void cftx020(double *a); + int m; + + if (n > 32) { + m = n >> 2; + cftf1st(n, a, &w[nw - m]); + if (n > CDFT_RECURSIVE_N) { + cftrec1(m, a, nw, w); + cftrec2(m, &a[m], nw, w); + cftrec1(m, &a[2 * m], nw, w); + cftrec1(m, &a[3 * m], nw, w); + } else if (m > 32) { + cftexp1(n, a, nw, w); + } else { + cftfx41(n, a, nw, w); + } + bitrv2(n, ip, a); + } else if (n > 8) { + if (n == 32) { + cftf161(a, &w[nw - 8]); + bitrv216(a); + } else { + cftf081(a, w); + bitrv208(a); + } + } else if (n == 8) { + cftf040(a); + } else if (n == 4) { + cftx020(a); + } + } + + + void cftbsub(int n, double *a, int *ip, int nw, double *w) + { + void bitrv2conj(int n, int *ip, double *a); + void bitrv216neg(double *a); + void bitrv208neg(double *a); + void cftb1st(int n, double *a, double *w); + void cftrec1(int n, double *a, int nw, double *w); + void cftrec2(int n, double *a, int nw, double *w); + void cftexp1(int n, double *a, int nw, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftf161(double *a, double *w); + void cftf081(double *a, double *w); + void cftb040(double *a); + void cftx020(double *a); + int m; + + if (n > 32) { + m = n >> 2; + cftb1st(n, a, &w[nw - m]); + if (n > CDFT_RECURSIVE_N) { + cftrec1(m, a, nw, w); + cftrec2(m, &a[m], nw, w); + cftrec1(m, &a[2 * m], nw, w); + cftrec1(m, &a[3 * m], nw, w); + } else if (m > 32) { + cftexp1(n, a, nw, w); + } else { + cftfx41(n, a, nw, w); + } + bitrv2conj(n, ip, a); + } else if (n > 8) { + if (n == 32) { + cftf161(a, &w[nw - 8]); + bitrv216neg(a); + } else { + cftf081(a, w); + bitrv208neg(a); + } + } else if (n == 8) { + cftb040(a); + } else if (n == 4) { + cftx020(a); + } + } + + + void bitrv2(int n, int *ip, double *a) + { + int j, j1, k, k1, l, m, m2; + double xr, xi, yr, yi; + + ip[0] = 0; + l = n; + m = 1; + while ((m << 3) < l) { + l >>= 1; + for (j = 0; j < m; j++) { + ip[m + j] = ip[j] + l; + } + m <<= 1; + } + m2 = 2 * m; + if ((m << 3) == l) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 -= m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + j1 = 2 * k + m2 + ip[k]; + k1 = j1 + m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } else { + for (k = 1; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } + } + } + + + void bitrv2conj(int n, int *ip, double *a) + { + int j, j1, k, k1, l, m, m2; + double xr, xi, yr, yi; + + ip[0] = 0; + l = n; + m = 1; + while ((m << 3) < l) { + l >>= 1; + for (j = 0; j < m; j++) { + ip[m + j] = ip[j] + l; + } + m <<= 1; + } + m2 = 2 * m; + if ((m << 3) == l) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 -= m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 2 * k + ip[k]; + a[k1 + 1] = -a[k1 + 1]; + j1 = k1 + m2; + k1 = j1 + m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + k1 += m2; + a[k1 + 1] = -a[k1 + 1]; + } + } else { + a[1] = -a[1]; + a[m2 + 1] = -a[m2 + 1]; + for (k = 1; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 2 * k + ip[k]; + a[k1 + 1] = -a[k1 + 1]; + a[k1 + m2 + 1] = -a[k1 + m2 + 1]; + } + } + } + + + void bitrv216(double *a) + { + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x7r, x7i, x8r, x8i, x10r, x10i, + x11r, x11i, x12r, x12i, x13r, x13i, x14r, x14i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x7r = a[14]; + x7i = a[15]; + x8r = a[16]; + x8i = a[17]; + x10r = a[20]; + x10i = a[21]; + x11r = a[22]; + x11i = a[23]; + x12r = a[24]; + x12i = a[25]; + x13r = a[26]; + x13i = a[27]; + x14r = a[28]; + x14i = a[29]; + a[2] = x8r; + a[3] = x8i; + a[4] = x4r; + a[5] = x4i; + a[6] = x12r; + a[7] = x12i; + a[8] = x2r; + a[9] = x2i; + a[10] = x10r; + a[11] = x10i; + a[14] = x14r; + a[15] = x14i; + a[16] = x1r; + a[17] = x1i; + a[20] = x5r; + a[21] = x5i; + a[22] = x13r; + a[23] = x13i; + a[24] = x3r; + a[25] = x3i; + a[26] = x11r; + a[27] = x11i; + a[28] = x7r; + a[29] = x7i; + } + + + void bitrv216neg(double *a) + { + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x6r, x6i, x7r, x7i, x8r, x8i, + x9r, x9i, x10r, x10i, x11r, x11i, x12r, x12i, + x13r, x13i, x14r, x14i, x15r, x15i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x6r = a[12]; + x6i = a[13]; + x7r = a[14]; + x7i = a[15]; + x8r = a[16]; + x8i = a[17]; + x9r = a[18]; + x9i = a[19]; + x10r = a[20]; + x10i = a[21]; + x11r = a[22]; + x11i = a[23]; + x12r = a[24]; + x12i = a[25]; + x13r = a[26]; + x13i = a[27]; + x14r = a[28]; + x14i = a[29]; + x15r = a[30]; + x15i = a[31]; + a[2] = x15r; + a[3] = x15i; + a[4] = x7r; + a[5] = x7i; + a[6] = x11r; + a[7] = x11i; + a[8] = x3r; + a[9] = x3i; + a[10] = x13r; + a[11] = x13i; + a[12] = x5r; + a[13] = x5i; + a[14] = x9r; + a[15] = x9i; + a[16] = x1r; + a[17] = x1i; + a[18] = x14r; + a[19] = x14i; + a[20] = x6r; + a[21] = x6i; + a[22] = x10r; + a[23] = x10i; + a[24] = x2r; + a[25] = x2i; + a[26] = x12r; + a[27] = x12i; + a[28] = x4r; + a[29] = x4i; + a[30] = x8r; + a[31] = x8i; + } + + + void bitrv208(double *a) + { + double x1r, x1i, x3r, x3i, x4r, x4i, x6r, x6i; + + x1r = a[2]; + x1i = a[3]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x6r = a[12]; + x6i = a[13]; + a[2] = x4r; + a[3] = x4i; + a[6] = x6r; + a[7] = x6i; + a[8] = x1r; + a[9] = x1i; + a[12] = x3r; + a[13] = x3i; + } + + + void bitrv208neg(double *a) + { + double x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, + x5r, x5i, x6r, x6i, x7r, x7i; + + x1r = a[2]; + x1i = a[3]; + x2r = a[4]; + x2i = a[5]; + x3r = a[6]; + x3i = a[7]; + x4r = a[8]; + x4i = a[9]; + x5r = a[10]; + x5i = a[11]; + x6r = a[12]; + x6i = a[13]; + x7r = a[14]; + x7i = a[15]; + a[2] = x7r; + a[3] = x7i; + a[4] = x3r; + a[5] = x3i; + a[6] = x5r; + a[7] = x5i; + a[8] = x1r; + a[9] = x1i; + a[10] = x6r; + a[11] = x6i; + a[12] = x2r; + a[13] = x2i; + a[14] = x4r; + a[15] = x4i; + } + + + void cftf1st(int n, double *a, double *w) + { + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, csc1, csc3, wk1r, wk1i, wk3r, wk3i, + wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = a[1] + a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = a[1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j2] = x1r - x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + csc1 = w[2]; + csc3 = w[3]; + wd1r = 1; + wd1i = 0; + wd3r = 1; + wd3i = 0; + k = 0; + for (j = 2; j < mh - 2; j += 4) { + k += 4; + wk1r = csc1 * (wd1r + w[k]); + wk1i = csc1 * (wd1i + w[k + 1]); + wk3r = csc3 * (wd3r + w[k + 2]); + wk3i = csc3 * (wd3i - w[k + 3]); + wd1r = w[k]; + wd1i = w[k + 1]; + wd3r = w[k + 2]; + wd3i = -w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = a[j + 1] + a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = a[j + 1] - a[j2 + 1]; + y0r = a[j + 2] + a[j2 + 2]; + y0i = a[j + 3] + a[j2 + 3]; + y1r = a[j + 2] - a[j2 + 2]; + y1i = a[j + 3] - a[j2 + 3]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 + 2] + a[j3 + 2]; + y2i = a[j1 + 3] + a[j3 + 3]; + y3r = a[j1 + 2] - a[j3 + 2]; + y3i = a[j1 + 3] - a[j3 + 3]; + a[j] = x0r + x2r; + a[j + 1] = x0i + x2i; + a[j + 2] = y0r + y2r; + a[j + 3] = y0i + y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j1 + 2] = y0r - y2r; + a[j1 + 3] = y0i - y2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = y1r - y3i; + x0i = y1i + y3r; + a[j2 + 2] = wd1r * x0r - wd1i * x0i; + a[j2 + 3] = wd1r * x0i + wd1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + x0r = y1r + y3i; + x0i = y1i - y3r; + a[j3 + 2] = wd3r * x0r + wd3i * x0i; + a[j3 + 3] = wd3r * x0i - wd3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + y0r = a[j0 - 2] + a[j2 - 2]; + y0i = a[j0 - 1] + a[j2 - 1]; + y1r = a[j0 - 2] - a[j2 - 2]; + y1i = a[j0 - 1] - a[j2 - 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 - 2] + a[j3 - 2]; + y2i = a[j1 - 1] + a[j3 - 1]; + y3r = a[j1 - 2] - a[j3 - 2]; + y3i = a[j1 - 1] - a[j3 - 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j0 - 2] = y0r + y2r; + a[j0 - 1] = y0i + y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j1 - 2] = y0r - y2r; + a[j1 - 1] = y0i - y2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = y1r - y3i; + x0i = y1i + y3r; + a[j2 - 2] = wd1i * x0r - wd1r * x0i; + a[j2 - 1] = wd1i * x0i + wd1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + x0r = y1r + y3i; + x0i = y1i - y3r; + a[j3 - 2] = wd3i * x0r + wd3r * x0i; + a[j3 - 1] = wd3i * x0i - wd3r * x0r; + } + wk1r = csc1 * (wd1r + wn4r); + wk1i = csc1 * (wd1i + wn4r); + wk3r = csc3 * (wd3r - wn4r); + wk3i = csc3 * (wd3i - wn4r); + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0 - 2] + a[j2 - 2]; + x0i = a[j0 - 1] + a[j2 - 1]; + x1r = a[j0 - 2] - a[j2 - 2]; + x1i = a[j0 - 1] - a[j2 - 1]; + x2r = a[j1 - 2] + a[j3 - 2]; + x2i = a[j1 - 1] + a[j3 - 1]; + x3r = a[j1 - 2] - a[j3 - 2]; + x3i = a[j1 - 1] - a[j3 - 1]; + a[j0 - 2] = x0r + x2r; + a[j0 - 1] = x0i + x2i; + a[j1 - 2] = x0r - x2r; + a[j1 - 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2 - 2] = wk1r * x0r - wk1i * x0i; + a[j2 - 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3 - 2] = wk3r * x0r + wk3i * x0i; + a[j3 - 1] = wk3r * x0i - wk3i * x0r; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); + x0r = a[j0 + 2] + a[j2 + 2]; + x0i = a[j0 + 3] + a[j2 + 3]; + x1r = a[j0 + 2] - a[j2 + 2]; + x1i = a[j0 + 3] - a[j2 + 3]; + x2r = a[j1 + 2] + a[j3 + 2]; + x2i = a[j1 + 3] + a[j3 + 3]; + x3r = a[j1 + 2] - a[j3 + 2]; + x3i = a[j1 + 3] - a[j3 + 3]; + a[j0 + 2] = x0r + x2r; + a[j0 + 3] = x0i + x2i; + a[j1 + 2] = x0r - x2r; + a[j1 + 3] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2 + 2] = wk1i * x0r - wk1r * x0i; + a[j2 + 3] = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3 + 2] = wk3i * x0r + wk3r * x0i; + a[j3 + 3] = wk3i * x0i - wk3r * x0r; + } + + + void cftb1st(int n, double *a, double *w) + { + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, csc1, csc3, wk1r, wk1i, wk3r, wk3i, + wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = -a[1] - a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = -a[1] + a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i - x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j2] = x1r + x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r - x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + csc1 = w[2]; + csc3 = w[3]; + wd1r = 1; + wd1i = 0; + wd3r = 1; + wd3i = 0; + k = 0; + for (j = 2; j < mh - 2; j += 4) { + k += 4; + wk1r = csc1 * (wd1r + w[k]); + wk1i = csc1 * (wd1i + w[k + 1]); + wk3r = csc3 * (wd3r + w[k + 2]); + wk3i = csc3 * (wd3i - w[k + 3]); + wd1r = w[k]; + wd1i = w[k + 1]; + wd3r = w[k + 2]; + wd3i = -w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = -a[j + 1] - a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = -a[j + 1] + a[j2 + 1]; + y0r = a[j + 2] + a[j2 + 2]; + y0i = -a[j + 3] - a[j2 + 3]; + y1r = a[j + 2] - a[j2 + 2]; + y1i = -a[j + 3] + a[j2 + 3]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 + 2] + a[j3 + 2]; + y2i = a[j1 + 3] + a[j3 + 3]; + y3r = a[j1 + 2] - a[j3 + 2]; + y3i = a[j1 + 3] - a[j3 + 3]; + a[j] = x0r + x2r; + a[j + 1] = x0i - x2i; + a[j + 2] = y0r + y2r; + a[j + 3] = y0i - y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j1 + 2] = y0r - y2r; + a[j1 + 3] = y0i + y2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = y1r + y3i; + x0i = y1i + y3r; + a[j2 + 2] = wd1r * x0r - wd1i * x0i; + a[j2 + 3] = wd1r * x0i + wd1i * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + x0r = y1r - y3i; + x0i = y1i - y3r; + a[j3 + 2] = wd3r * x0r + wd3i * x0i; + a[j3 + 3] = wd3r * x0i - wd3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = -a[j0 + 1] - a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = -a[j0 + 1] + a[j2 + 1]; + y0r = a[j0 - 2] + a[j2 - 2]; + y0i = -a[j0 - 1] - a[j2 - 1]; + y1r = a[j0 - 2] - a[j2 - 2]; + y1i = -a[j0 - 1] + a[j2 - 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + y2r = a[j1 - 2] + a[j3 - 2]; + y2i = a[j1 - 1] + a[j3 - 1]; + y3r = a[j1 - 2] - a[j3 - 2]; + y3i = a[j1 - 1] - a[j3 - 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i - x2i; + a[j0 - 2] = y0r + y2r; + a[j0 - 1] = y0i - y2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + a[j1 - 2] = y0r - y2r; + a[j1 - 1] = y0i + y2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = y1r + y3i; + x0i = y1i + y3r; + a[j2 - 2] = wd1i * x0r - wd1r * x0i; + a[j2 - 1] = wd1i * x0i + wd1r * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + x0r = y1r - y3i; + x0i = y1i - y3r; + a[j3 - 2] = wd3i * x0r + wd3r * x0i; + a[j3 - 1] = wd3i * x0i - wd3r * x0r; + } + wk1r = csc1 * (wd1r + wn4r); + wk1i = csc1 * (wd1i + wn4r); + wk3r = csc3 * (wd3r - wn4r); + wk3i = csc3 * (wd3i - wn4r); + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0 - 2] + a[j2 - 2]; + x0i = -a[j0 - 1] - a[j2 - 1]; + x1r = a[j0 - 2] - a[j2 - 2]; + x1i = -a[j0 - 1] + a[j2 - 1]; + x2r = a[j1 - 2] + a[j3 - 2]; + x2i = a[j1 - 1] + a[j3 - 1]; + x3r = a[j1 - 2] - a[j3 - 2]; + x3i = a[j1 - 1] - a[j3 - 1]; + a[j0 - 2] = x0r + x2r; + a[j0 - 1] = x0i - x2i; + a[j1 - 2] = x0r - x2r; + a[j1 - 1] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2 - 2] = wk1r * x0r - wk1i * x0i; + a[j2 - 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3 - 2] = wk3r * x0r + wk3i * x0i; + a[j3 - 1] = wk3r * x0i - wk3i * x0r; + x0r = a[j0] + a[j2]; + x0i = -a[j0 + 1] - a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = -a[j0 + 1] + a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i - x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); + x0r = a[j0 + 2] + a[j2 + 2]; + x0i = -a[j0 + 3] - a[j2 + 3]; + x1r = a[j0 + 2] - a[j2 + 2]; + x1i = -a[j0 + 3] + a[j2 + 3]; + x2r = a[j1 + 2] + a[j3 + 2]; + x2i = a[j1 + 3] + a[j3 + 3]; + x3r = a[j1 + 2] - a[j3 + 2]; + x3i = a[j1 + 3] - a[j3 + 3]; + a[j0 + 2] = x0r + x2r; + a[j0 + 3] = x0i - x2i; + a[j1 + 2] = x0r - x2r; + a[j1 + 3] = x0i + x2i; + x0r = x1r + x3i; + x0i = x1i + x3r; + a[j2 + 2] = wk1i * x0r - wk1r * x0i; + a[j2 + 3] = wk1i * x0i + wk1r * x0r; + x0r = x1r - x3i; + x0i = x1i - x3r; + a[j3 + 2] = wk3i * x0r + wk3r * x0i; + a[j3 + 3] = wk3i * x0i - wk3r * x0r; + } + + + void cftrec1(int n, double *a, int nw, double *w) + { + void cftrec1(int n, double *a, int nw, double *w); + void cftrec2(int n, double *a, int nw, double *w); + void cftmdl1(int n, double *a, double *w); + void cftexp1(int n, double *a, int nw, double *w); + int m; + + m = n >> 2; + cftmdl1(n, a, &w[nw - 2 * m]); + if (n > CDFT_RECURSIVE_N) { + cftrec1(m, a, nw, w); + cftrec2(m, &a[m], nw, w); + cftrec1(m, &a[2 * m], nw, w); + cftrec1(m, &a[3 * m], nw, w); + } else { + cftexp1(n, a, nw, w); + } + } + + + void cftrec2(int n, double *a, int nw, double *w) + { + void cftrec1(int n, double *a, int nw, double *w); + void cftrec2(int n, double *a, int nw, double *w); + void cftmdl2(int n, double *a, double *w); + void cftexp2(int n, double *a, int nw, double *w); + int m; + + m = n >> 2; + cftmdl2(n, a, &w[nw - n]); + if (n > CDFT_RECURSIVE_N) { + cftrec1(m, a, nw, w); + cftrec2(m, &a[m], nw, w); + cftrec1(m, &a[2 * m], nw, w); + cftrec2(m, &a[3 * m], nw, w); + } else { + cftexp2(n, a, nw, w); + } + } + + + void cftexp1(int n, double *a, int nw, double *w) + { + void cftmdl1(int n, double *a, double *w); + void cftmdl2(int n, double *a, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftfx42(int n, double *a, int nw, double *w); + int j, k, l; + + l = n >> 2; + while (l > 128) { + for (k = l; k < n; k <<= 2) { + for (j = k - l; j < n; j += 4 * k) { + cftmdl1(l, &a[j], &w[nw - (l >> 1)]); + cftmdl2(l, &a[k + j], &w[nw - l]); + cftmdl1(l, &a[2 * k + j], &w[nw - (l >> 1)]); + } + } + cftmdl1(l, &a[n - l], &w[nw - (l >> 1)]); + l >>= 2; + } + for (k = l; k < n; k <<= 2) { + for (j = k - l; j < n; j += 4 * k) { + cftmdl1(l, &a[j], &w[nw - (l >> 1)]); + cftfx41(l, &a[j], nw, w); + cftmdl2(l, &a[k + j], &w[nw - l]); + cftfx42(l, &a[k + j], nw, w); + cftmdl1(l, &a[2 * k + j], &w[nw - (l >> 1)]); + cftfx41(l, &a[2 * k + j], nw, w); + } + } + cftmdl1(l, &a[n - l], &w[nw - (l >> 1)]); + cftfx41(l, &a[n - l], nw, w); + } + + + void cftexp2(int n, double *a, int nw, double *w) + { + void cftmdl1(int n, double *a, double *w); + void cftmdl2(int n, double *a, double *w); + void cftfx41(int n, double *a, int nw, double *w); + void cftfx42(int n, double *a, int nw, double *w); + int j, k, l, m; + + m = n >> 1; + l = n >> 2; + while (l > 128) { + for (k = l; k < m; k <<= 2) { + for (j = k - l; j < m; j += 2 * k) { + cftmdl1(l, &a[j], &w[nw - (l >> 1)]); + cftmdl1(l, &a[m + j], &w[nw - (l >> 1)]); + } + for (j = 2 * k - l; j < m; j += 4 * k) { + cftmdl2(l, &a[j], &w[nw - l]); + cftmdl2(l, &a[m + j], &w[nw - l]); + } + } + l >>= 2; + } + for (k = l; k < m; k <<= 2) { + for (j = k - l; j < m; j += 2 * k) { + cftmdl1(l, &a[j], &w[nw - (l >> 1)]); + cftfx41(l, &a[j], nw, w); + cftmdl1(l, &a[m + j], &w[nw - (l >> 1)]); + cftfx41(l, &a[m + j], nw, w); + } + for (j = 2 * k - l; j < m; j += 4 * k) { + cftmdl2(l, &a[j], &w[nw - l]); + cftfx42(l, &a[j], nw, w); + cftmdl2(l, &a[m + j], &w[nw - l]); + cftfx42(l, &a[m + j], nw, w); + } + } + } + + + void cftmdl1(int n, double *a, double *w) + { + int j, j0, j1, j2, j3, k, m, mh; + double wn4r, wk1r, wk1i, wk3r, wk3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + mh = n >> 3; + m = 2 * mh; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] + a[j2]; + x0i = a[1] + a[j2 + 1]; + x1r = a[0] - a[j2]; + x1i = a[1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + a[j2] = x1r - x3i; + a[j2 + 1] = x1i + x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i - x3r; + wn4r = w[1]; + k = 0; + for (j = 2; j < mh; j += 2) { + k += 4; + wk1r = w[k]; + wk1i = w[k + 1]; + wk3r = w[k + 2]; + wk3i = -w[k + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] + a[j2]; + x0i = a[j + 1] + a[j2 + 1]; + x1r = a[j] - a[j2]; + x1i = a[j + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j] = x0r + x2r; + a[j + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1r * x0r - wk1i * x0i; + a[j2 + 1] = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3r * x0r + wk3i * x0i; + a[j3 + 1] = wk3r * x0i - wk3i * x0r; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wk1i * x0r - wk1r * x0i; + a[j2 + 1] = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = wk3i * x0r + wk3r * x0i; + a[j3 + 1] = wk3i * x0i - wk3r * x0r; + } + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] + a[j2]; + x0i = a[j0 + 1] + a[j2 + 1]; + x1r = a[j0] - a[j2]; + x1i = a[j0 + 1] - a[j2 + 1]; + x2r = a[j1] + a[j3]; + x2i = a[j1 + 1] + a[j3 + 1]; + x3r = a[j1] - a[j3]; + x3i = a[j1 + 1] - a[j3 + 1]; + a[j0] = x0r + x2r; + a[j0 + 1] = x0i + x2i; + a[j1] = x0r - x2r; + a[j1 + 1] = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + a[j3] = -wn4r * (x0r + x0i); + a[j3 + 1] = -wn4r * (x0i - x0r); + } + + + void cftmdl2(int n, double *a, double *w) + { + int j, j0, j1, j2, j3, k, kr, m, mh; + double wn4r, wk1r, wk1i, wk3r, wk3i, wd1r, wd1i, wd3r, wd3i; + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, y0r, y0i, y2r, y2i; + + mh = n >> 3; + m = 2 * mh; + wn4r = w[1]; + j1 = m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[0] - a[j2 + 1]; + x0i = a[1] + a[j2]; + x1r = a[0] + a[j2 + 1]; + x1i = a[1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wn4r * (x2r - x2i); + y0i = wn4r * (x2i + x2r); + a[0] = x0r + y0r; + a[1] = x0i + y0i; + a[j1] = x0r - y0r; + a[j1 + 1] = x0i - y0i; + y0r = wn4r * (x3r - x3i); + y0i = wn4r * (x3i + x3r); + a[j2] = x1r - y0i; + a[j2 + 1] = x1i + y0r; + a[j3] = x1r + y0i; + a[j3 + 1] = x1i - y0r; + k = 0; + kr = 2 * m; + for (j = 2; j < mh; j += 2) { + k += 4; + wk1r = w[k]; + wk1i = w[k + 1]; + wk3r = w[k + 2]; + wk3i = -w[k + 3]; + kr -= 4; + wd1i = w[kr]; + wd1r = w[kr + 1]; + wd3i = w[kr + 2]; + wd3r = -w[kr + 3]; + j1 = j + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j] - a[j2 + 1]; + x0i = a[j + 1] + a[j2]; + x1r = a[j] + a[j2 + 1]; + x1i = a[j + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wk1r * x0r - wk1i * x0i; + y0i = wk1r * x0i + wk1i * x0r; + y2r = wd1r * x2r - wd1i * x2i; + y2i = wd1r * x2i + wd1i * x2r; + a[j] = y0r + y2r; + a[j + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wk3r * x1r + wk3i * x1i; + y0i = wk3r * x1i - wk3i * x1r; + y2r = wd3r * x3r + wd3i * x3i; + y2i = wd3r * x3i - wd3i * x3r; + a[j2] = y0r + y2r; + a[j2 + 1] = y0i + y2i; + a[j3] = y0r - y2r; + a[j3 + 1] = y0i - y2i; + j0 = m - j; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] - a[j2 + 1]; + x0i = a[j0 + 1] + a[j2]; + x1r = a[j0] + a[j2 + 1]; + x1i = a[j0 + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wd1i * x0r - wd1r * x0i; + y0i = wd1i * x0i + wd1r * x0r; + y2r = wk1i * x2r - wk1r * x2i; + y2i = wk1i * x2i + wk1r * x2r; + a[j0] = y0r + y2r; + a[j0 + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wd3i * x1r + wd3r * x1i; + y0i = wd3i * x1i - wd3r * x1r; + y2r = wk3i * x3r + wk3r * x3i; + y2i = wk3i * x3i - wk3r * x3r; + a[j2] = y0r + y2r; + a[j2 + 1] = y0i + y2i; + a[j3] = y0r - y2r; + a[j3 + 1] = y0i - y2i; + } + wk1r = w[m]; + wk1i = w[m + 1]; + j0 = mh; + j1 = j0 + m; + j2 = j1 + m; + j3 = j2 + m; + x0r = a[j0] - a[j2 + 1]; + x0i = a[j0 + 1] + a[j2]; + x1r = a[j0] + a[j2 + 1]; + x1i = a[j0 + 1] - a[j2]; + x2r = a[j1] - a[j3 + 1]; + x2i = a[j1 + 1] + a[j3]; + x3r = a[j1] + a[j3 + 1]; + x3i = a[j1 + 1] - a[j3]; + y0r = wk1r * x0r - wk1i * x0i; + y0i = wk1r * x0i + wk1i * x0r; + y2r = wk1i * x2r - wk1r * x2i; + y2i = wk1i * x2i + wk1r * x2r; + a[j0] = y0r + y2r; + a[j0 + 1] = y0i + y2i; + a[j1] = y0r - y2r; + a[j1 + 1] = y0i - y2i; + y0r = wk1i * x1r - wk1r * x1i; + y0i = wk1i * x1i + wk1r * x1r; + y2r = wk1r * x3r - wk1i * x3i; + y2i = wk1r * x3i + wk1i * x3r; + a[j2] = y0r - y2r; + a[j2 + 1] = y0i - y2i; + a[j3] = y0r + y2r; + a[j3 + 1] = y0i + y2i; + } + + + void cftfx41(int n, double *a, int nw, double *w) + { + void cftf161(double *a, double *w); + void cftf162(double *a, double *w); + void cftf081(double *a, double *w); + void cftf082(double *a, double *w); + + if (n == 128) { + cftf161(a, &w[nw - 8]); + cftf162(&a[32], &w[nw - 32]); + cftf161(&a[64], &w[nw - 8]); + cftf161(&a[96], &w[nw - 8]); + } else { + cftf081(a, &w[nw - 16]); + cftf082(&a[16], &w[nw - 16]); + cftf081(&a[32], &w[nw - 16]); + cftf081(&a[48], &w[nw - 16]); + } + } + + + void cftfx42(int n, double *a, int nw, double *w) + { + void cftf161(double *a, double *w); + void cftf162(double *a, double *w); + void cftf081(double *a, double *w); + void cftf082(double *a, double *w); + + if (n == 128) { + cftf161(a, &w[nw - 8]); + cftf162(&a[32], &w[nw - 32]); + cftf161(&a[64], &w[nw - 8]); + cftf162(&a[96], &w[nw - 32]); + } else { + cftf081(a, &w[nw - 16]); + cftf082(&a[16], &w[nw - 16]); + cftf081(&a[32], &w[nw - 16]); + cftf082(&a[48], &w[nw - 16]); + } + } + + + void cftf161(double *a, double *w) + { + double wn4r, wk1r, wk1i, + x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i, + y8r, y8i, y9r, y9i, y10r, y10i, y11r, y11i, + y12r, y12i, y13r, y13i, y14r, y14i, y15r, y15i; + + wn4r = w[1]; + wk1i = wn4r * w[2]; + wk1r = wk1i + w[2]; + x0r = a[0] + a[16]; + x0i = a[1] + a[17]; + x1r = a[0] - a[16]; + x1i = a[1] - a[17]; + x2r = a[8] + a[24]; + x2i = a[9] + a[25]; + x3r = a[8] - a[24]; + x3i = a[9] - a[25]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y4r = x0r - x2r; + y4i = x0i - x2i; + y8r = x1r - x3i; + y8i = x1i + x3r; + y12r = x1r + x3i; + y12i = x1i - x3r; + x0r = a[2] + a[18]; + x0i = a[3] + a[19]; + x1r = a[2] - a[18]; + x1i = a[3] - a[19]; + x2r = a[10] + a[26]; + x2i = a[11] + a[27]; + x3r = a[10] - a[26]; + x3i = a[11] - a[27]; + y1r = x0r + x2r; + y1i = x0i + x2i; + y5r = x0r - x2r; + y5i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y9r = wk1r * x0r - wk1i * x0i; + y9i = wk1r * x0i + wk1i * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + y13r = wk1i * x0r - wk1r * x0i; + y13i = wk1i * x0i + wk1r * x0r; + x0r = a[4] + a[20]; + x0i = a[5] + a[21]; + x1r = a[4] - a[20]; + x1i = a[5] - a[21]; + x2r = a[12] + a[28]; + x2i = a[13] + a[29]; + x3r = a[12] - a[28]; + x3i = a[13] - a[29]; + y2r = x0r + x2r; + y2i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y10r = wn4r * (x0r - x0i); + y10i = wn4r * (x0i + x0r); + x0r = x1r + x3i; + x0i = x1i - x3r; + y14r = wn4r * (x0r + x0i); + y14i = wn4r * (x0i - x0r); + x0r = a[6] + a[22]; + x0i = a[7] + a[23]; + x1r = a[6] - a[22]; + x1i = a[7] - a[23]; + x2r = a[14] + a[30]; + x2i = a[15] + a[31]; + x3r = a[14] - a[30]; + x3i = a[15] - a[31]; + y3r = x0r + x2r; + y3i = x0i + x2i; + y7r = x0r - x2r; + y7i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + y11r = wk1i * x0r - wk1r * x0i; + y11i = wk1i * x0i + wk1r * x0r; + x0r = x1r + x3i; + x0i = x1i - x3r; + y15r = wk1r * x0r - wk1i * x0i; + y15i = wk1r * x0i + wk1i * x0r; + x0r = y12r - y14r; + x0i = y12i - y14i; + x1r = y12r + y14r; + x1i = y12i + y14i; + x2r = y13r - y15r; + x2i = y13i - y15i; + x3r = y13r + y15r; + x3i = y13i + y15i; + a[24] = x0r + x2r; + a[25] = x0i + x2i; + a[26] = x0r - x2r; + a[27] = x0i - x2i; + a[28] = x1r - x3i; + a[29] = x1i + x3r; + a[30] = x1r + x3i; + a[31] = x1i - x3r; + x0r = y8r + y10r; + x0i = y8i + y10i; + x1r = y8r - y10r; + x1i = y8i - y10i; + x2r = y9r + y11r; + x2i = y9i + y11i; + x3r = y9r - y11r; + x3i = y9i - y11i; + a[16] = x0r + x2r; + a[17] = x0i + x2i; + a[18] = x0r - x2r; + a[19] = x0i - x2i; + a[20] = x1r - x3i; + a[21] = x1i + x3r; + a[22] = x1r + x3i; + a[23] = x1i - x3r; + x0r = y5r - y7i; + x0i = y5i + y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + x0r = y5r + y7i; + x0i = y5i - y7r; + x3r = wn4r * (x0r - x0i); + x3i = wn4r * (x0i + x0r); + x0r = y4r - y6i; + x0i = y4i + y6r; + x1r = y4r + y6i; + x1i = y4i - y6r; + a[8] = x0r + x2r; + a[9] = x0i + x2i; + a[10] = x0r - x2r; + a[11] = x0i - x2i; + a[12] = x1r - x3i; + a[13] = x1i + x3r; + a[14] = x1r + x3i; + a[15] = x1i - x3r; + x0r = y0r + y2r; + x0i = y0i + y2i; + x1r = y0r - y2r; + x1i = y0i - y2i; + x2r = y1r + y3r; + x2i = y1i + y3i; + x3r = y1r - y3r; + x3i = y1i - y3i; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[2] = x0r - x2r; + a[3] = x0i - x2i; + a[4] = x1r - x3i; + a[5] = x1i + x3r; + a[6] = x1r + x3i; + a[7] = x1i - x3r; + } + + + void cftf162(double *a, double *w) + { + double wn4r, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, + x0r, x0i, x1r, x1i, x2r, x2i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i, + y8r, y8i, y9r, y9i, y10r, y10i, y11r, y11i, + y12r, y12i, y13r, y13i, y14r, y14i, y15r, y15i; + + wn4r = w[1]; + wk1r = w[4]; + wk1i = w[5]; + wk3r = w[6]; + wk3i = w[7]; + wk2r = w[8]; + wk2i = w[9]; + x1r = a[0] - a[17]; + x1i = a[1] + a[16]; + x0r = a[8] - a[25]; + x0i = a[9] + a[24]; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + y0r = x1r + x2r; + y0i = x1i + x2i; + y4r = x1r - x2r; + y4i = x1i - x2i; + x1r = a[0] + a[17]; + x1i = a[1] - a[16]; + x0r = a[8] + a[25]; + x0i = a[9] - a[24]; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + y8r = x1r - x2i; + y8i = x1i + x2r; + y12r = x1r + x2i; + y12i = x1i - x2r; + x0r = a[2] - a[19]; + x0i = a[3] + a[18]; + x1r = wk1r * x0r - wk1i * x0i; + x1i = wk1r * x0i + wk1i * x0r; + x0r = a[10] - a[27]; + x0i = a[11] + a[26]; + x2r = wk3i * x0r - wk3r * x0i; + x2i = wk3i * x0i + wk3r * x0r; + y1r = x1r + x2r; + y1i = x1i + x2i; + y5r = x1r - x2r; + y5i = x1i - x2i; + x0r = a[2] + a[19]; + x0i = a[3] - a[18]; + x1r = wk3r * x0r - wk3i * x0i; + x1i = wk3r * x0i + wk3i * x0r; + x0r = a[10] + a[27]; + x0i = a[11] - a[26]; + x2r = wk1r * x0r + wk1i * x0i; + x2i = wk1r * x0i - wk1i * x0r; + y9r = x1r - x2r; + y9i = x1i - x2i; + y13r = x1r + x2r; + y13i = x1i + x2i; + x0r = a[4] - a[21]; + x0i = a[5] + a[20]; + x1r = wk2r * x0r - wk2i * x0i; + x1i = wk2r * x0i + wk2i * x0r; + x0r = a[12] - a[29]; + x0i = a[13] + a[28]; + x2r = wk2i * x0r - wk2r * x0i; + x2i = wk2i * x0i + wk2r * x0r; + y2r = x1r + x2r; + y2i = x1i + x2i; + y6r = x1r - x2r; + y6i = x1i - x2i; + x0r = a[4] + a[21]; + x0i = a[5] - a[20]; + x1r = wk2i * x0r - wk2r * x0i; + x1i = wk2i * x0i + wk2r * x0r; + x0r = a[12] + a[29]; + x0i = a[13] - a[28]; + x2r = wk2r * x0r - wk2i * x0i; + x2i = wk2r * x0i + wk2i * x0r; + y10r = x1r - x2r; + y10i = x1i - x2i; + y14r = x1r + x2r; + y14i = x1i + x2i; + x0r = a[6] - a[23]; + x0i = a[7] + a[22]; + x1r = wk3r * x0r - wk3i * x0i; + x1i = wk3r * x0i + wk3i * x0r; + x0r = a[14] - a[31]; + x0i = a[15] + a[30]; + x2r = wk1i * x0r - wk1r * x0i; + x2i = wk1i * x0i + wk1r * x0r; + y3r = x1r + x2r; + y3i = x1i + x2i; + y7r = x1r - x2r; + y7i = x1i - x2i; + x0r = a[6] + a[23]; + x0i = a[7] - a[22]; + x1r = wk1i * x0r + wk1r * x0i; + x1i = wk1i * x0i - wk1r * x0r; + x0r = a[14] + a[31]; + x0i = a[15] - a[30]; + x2r = wk3i * x0r - wk3r * x0i; + x2i = wk3i * x0i + wk3r * x0r; + y11r = x1r + x2r; + y11i = x1i + x2i; + y15r = x1r - x2r; + y15i = x1i - x2i; + x1r = y0r + y2r; + x1i = y0i + y2i; + x2r = y1r + y3r; + x2i = y1i + y3i; + a[0] = x1r + x2r; + a[1] = x1i + x2i; + a[2] = x1r - x2r; + a[3] = x1i - x2i; + x1r = y0r - y2r; + x1i = y0i - y2i; + x2r = y1r - y3r; + x2i = y1i - y3i; + a[4] = x1r - x2i; + a[5] = x1i + x2r; + a[6] = x1r + x2i; + a[7] = x1i - x2r; + x1r = y4r - y6i; + x1i = y4i + y6r; + x0r = y5r - y7i; + x0i = y5i + y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[8] = x1r + x2r; + a[9] = x1i + x2i; + a[10] = x1r - x2r; + a[11] = x1i - x2i; + x1r = y4r + y6i; + x1i = y4i - y6r; + x0r = y5r + y7i; + x0i = y5i - y7r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[12] = x1r - x2i; + a[13] = x1i + x2r; + a[14] = x1r + x2i; + a[15] = x1i - x2r; + x1r = y8r + y10r; + x1i = y8i + y10i; + x2r = y9r - y11r; + x2i = y9i - y11i; + a[16] = x1r + x2r; + a[17] = x1i + x2i; + a[18] = x1r - x2r; + a[19] = x1i - x2i; + x1r = y8r - y10r; + x1i = y8i - y10i; + x2r = y9r + y11r; + x2i = y9i + y11i; + a[20] = x1r - x2i; + a[21] = x1i + x2r; + a[22] = x1r + x2i; + a[23] = x1i - x2r; + x1r = y12r - y14i; + x1i = y12i + y14r; + x0r = y13r + y15i; + x0i = y13i - y15r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[24] = x1r + x2r; + a[25] = x1i + x2i; + a[26] = x1r - x2r; + a[27] = x1i - x2i; + x1r = y12r + y14i; + x1i = y12i - y14r; + x0r = y13r - y15i; + x0i = y13i + y15r; + x2r = wn4r * (x0r - x0i); + x2i = wn4r * (x0i + x0r); + a[28] = x1r - x2i; + a[29] = x1i + x2r; + a[30] = x1r + x2i; + a[31] = x1i - x2r; + } + + + void cftf081(double *a, double *w) + { + double wn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; + + wn4r = w[1]; + x0r = a[0] + a[8]; + x0i = a[1] + a[9]; + x1r = a[0] - a[8]; + x1i = a[1] - a[9]; + x2r = a[4] + a[12]; + x2i = a[5] + a[13]; + x3r = a[4] - a[12]; + x3i = a[5] - a[13]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[2] + a[10]; + x0i = a[3] + a[11]; + x1r = a[2] - a[10]; + x1i = a[3] - a[11]; + x2r = a[6] + a[14]; + x2i = a[7] + a[15]; + x3r = a[6] - a[14]; + x3i = a[7] - a[15]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + a[8] = y1r + y5r; + a[9] = y1i + y5i; + a[10] = y1r - y5r; + a[11] = y1i - y5i; + a[12] = y3r - y7i; + a[13] = y3i + y7r; + a[14] = y3r + y7i; + a[15] = y3i - y7r; + a[0] = y0r + y4r; + a[1] = y0i + y4i; + a[2] = y0r - y4r; + a[3] = y0i - y4i; + a[4] = y2r - y6i; + a[5] = y2i + y6r; + a[6] = y2r + y6i; + a[7] = y2i - y6r; + } + + + void cftf082(double *a, double *w) + { + double wn4r, wk1r, wk1i, x0r, x0i, x1r, x1i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; + + wn4r = w[1]; + wk1r = w[4]; + wk1i = w[5]; + y0r = a[0] - a[9]; + y0i = a[1] + a[8]; + y1r = a[0] + a[9]; + y1i = a[1] - a[8]; + x0r = a[4] - a[13]; + x0i = a[5] + a[12]; + y2r = wn4r * (x0r - x0i); + y2i = wn4r * (x0i + x0r); + x0r = a[4] + a[13]; + x0i = a[5] - a[12]; + y3r = wn4r * (x0r - x0i); + y3i = wn4r * (x0i + x0r); + x0r = a[2] - a[11]; + x0i = a[3] + a[10]; + y4r = wk1r * x0r - wk1i * x0i; + y4i = wk1r * x0i + wk1i * x0r; + x0r = a[2] + a[11]; + x0i = a[3] - a[10]; + y5r = wk1i * x0r - wk1r * x0i; + y5i = wk1i * x0i + wk1r * x0r; + x0r = a[6] - a[15]; + x0i = a[7] + a[14]; + y6r = wk1i * x0r - wk1r * x0i; + y6i = wk1i * x0i + wk1r * x0r; + x0r = a[6] + a[15]; + x0i = a[7] - a[14]; + y7r = wk1r * x0r - wk1i * x0i; + y7i = wk1r * x0i + wk1i * x0r; + x0r = y0r + y2r; + x0i = y0i + y2i; + x1r = y4r + y6r; + x1i = y4i + y6i; + a[0] = x0r + x1r; + a[1] = x0i + x1i; + a[2] = x0r - x1r; + a[3] = x0i - x1i; + x0r = y0r - y2r; + x0i = y0i - y2i; + x1r = y4r - y6r; + x1i = y4i - y6i; + a[4] = x0r - x1i; + a[5] = x0i + x1r; + a[6] = x0r + x1i; + a[7] = x0i - x1r; + x0r = y1r - y3i; + x0i = y1i + y3r; + x1r = y5r - y7r; + x1i = y5i - y7i; + a[8] = x0r + x1r; + a[9] = x0i + x1i; + a[10] = x0r - x1r; + a[11] = x0i - x1i; + x0r = y1r + y3i; + x0i = y1i - y3r; + x1r = y5r + y7r; + x1i = y5i + y7i; + a[12] = x0r - x1i; + a[13] = x0i + x1r; + a[14] = x0r + x1i; + a[15] = x0i - x1r; + } + + + void cftf040(double *a) + { + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + x0r = a[0] + a[4]; + x0i = a[1] + a[5]; + x1r = a[0] - a[4]; + x1i = a[1] - a[5]; + x2r = a[2] + a[6]; + x2i = a[3] + a[7]; + x3r = a[2] - a[6]; + x3i = a[3] - a[7]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[4] = x0r - x2r; + a[5] = x0i - x2i; + a[2] = x1r - x3i; + a[3] = x1i + x3r; + a[6] = x1r + x3i; + a[7] = x1i - x3r; + } + + + void cftb040(double *a) + { + double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; + + x0r = a[0] + a[4]; + x0i = a[1] + a[5]; + x1r = a[0] - a[4]; + x1i = a[1] - a[5]; + x2r = a[2] + a[6]; + x2i = a[3] + a[7]; + x3r = a[2] - a[6]; + x3i = a[3] - a[7]; + a[0] = x0r + x2r; + a[1] = x0i + x2i; + a[4] = x0r - x2r; + a[5] = x0i - x2i; + a[2] = x1r + x3i; + a[3] = x1i - x3r; + a[6] = x1r - x3i; + a[7] = x1i + x3r; + } + + + void cftx020(double *a) + { + double x0r, x0i; + + x0r = a[0] - a[2]; + x0i = a[1] - a[3]; + a[0] += a[2]; + a[1] += a[3]; + a[2] = x0r; + a[3] = x0i; + } + + + void rftfsub(int n, double *a, int nc, double *c) + { + int j, k, kk, ks, m; + double wkr, wki, xr, xi, yr, yi; + + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = 0.5 - c[nc - kk]; + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr - wki * xi; + yi = wkr * xi + wki * xr; + a[j] -= yr; + a[j + 1] -= yi; + a[k] += yr; + a[k + 1] -= yi; + } + } + + + void rftbsub(int n, double *a, int nc, double *c) + { + int j, k, kk, ks, m; + double wkr, wki, xr, xi, yr, yi; + + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = 0.5 - c[nc - kk]; + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr + wki * xi; + yi = wkr * xi - wki * xr; + a[j] -= yr; + a[j + 1] -= yi; + a[k] += yr; + a[k + 1] -= yi; + } + } + + + void dctsub(int n, double *a, int nc, double *c) + { + int j, k, kk, ks, m; + double wkr, wki, xr; + + m = n >> 1; + ks = nc / n; + kk = 0; + for (j = 1; j < m; j++) { + k = n - j; + kk += ks; + wkr = c[kk] - c[nc - kk]; + wki = c[kk] + c[nc - kk]; + xr = wki * a[j] - wkr * a[k]; + a[j] = wkr * a[j] + wki * a[k]; + a[k] = xr; + } + a[m] *= c[0]; + } + + + void dstsub(int n, double *a, int nc, double *c) + { + int j, k, kk, ks, m; + double wkr, wki, xr; + + m = n >> 1; + ks = nc / n; + kk = 0; + for (j = 1; j < m; j++) { + k = n - j; + kk += ks; + wkr = c[kk] - c[nc - kk]; + wki = c[kk] + c[nc - kk]; + xr = wki * a[k] - wkr * a[j]; + a[k] = wkr * a[k] + wki * a[j]; + a[j] = xr; + } + a[m] *= c[0]; + } + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/pifft.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/pifft.c:1.1 *** /dev/null Sat Oct 11 16:18:59 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/pifft.c Sat Oct 11 16:18:48 2003 *************** *** 0 **** --- 1,1544 ---- + /* + ---- calculation of PI(= 3.14159...) using FFT ---- + by T.Ooura, ver. LG1.1.2-MP1.5 Mar. 1999. + + This is a test program to estimate the performance of + the FFT routines: fft4g.c, fft8g.c. + + Example compilation: + GNU : gcc -O6 -ffast-math pi_fft.c fftsg.c -lm -o pi_fftsg + SUN : cc -fast -xO5 pi_fft.c fft8g.c -lm -o pi_fft8g + Microsoft: cl /O2 /G6 pi_fft.c fft4g.c /Fepi_fft4g.exe + ... + etc. + */ + + /* Please check the following macros before compiling */ + #ifndef DBL_ERROR_MARGIN + #define DBL_ERROR_MARGIN 0.3 /* must be < 0.5 */ + #endif + + + #include + #include + #include + #include + #include + #include + + + void mp_load_0(int n, int radix, int out[]); + void mp_load_1(int n, int radix, int out[]); + void mp_round(int n, int radix, int m, int inout[]); + int mp_cmp(int n, int radix, int in1[], int in2[]); + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void mp_sub(int n, int radix, int in1[], int in2[], int out[]); + void mp_imul(int n, int radix, int in1[], int in2, int out[]); + int mp_idiv(int n, int radix, int in1[], int in2, int out[]); + void mp_idiv_2(int n, int radix, int in[], int out[]); + double mp_mul_radix_test(int n, int radix, int nfft, + double tmpfft[], int ip[], double w[]); + void mp_mul(int n, int radix, int in1[], int in2[], int out[], + int tmp[], int nfft, double tmp1fft[], double tmp2fft[], + double tmp3fft[], int ip[], double w[]); + void mp_squ(int n, int radix, int in[], int out[], int tmp[], + int nfft, double tmp1fft[], double tmp2fft[], + int ip[], double w[]); + void mp_mulh(int n, int radix, int in1[], int in2[], int out[], + int nfft, double in1fft[], double outfft[], + int ip[], double w[]); + void mp_squh(int n, int radix, int in[], int out[], + int nfft, double inoutfft[], int ip[], double w[]); + int mp_inv(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]); + int mp_sqrt(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]); + void mp_sprintf(int n, int log10_radix, int in[], char out[]); + void mp_sscanf(int n, int log10_radix, char in[], int out[]); + + + int main(int argc, char *argv[]) + { + int nfft, log2_nfft, radix, log10_radix, n, npow, nprc; + double err, n_op; + int *a, *b, *c, *e, *i1, *i2, *ip; + double *d1, *d2, *d3, *w; + char *dgt; + FILE *f_in; + + fprintf(stderr,"Compile date: %s\n", COMPDATE); + fprintf(stderr,"Compiler switches: %s\n", CFLAGS); + + if (argc!=2) + exit(1); + + printf("PI calculation to estimate the FFT benchmarks\n"); + + f_in = fopen(argv[1], "r"); + if (f_in==NULL) { + fprintf(stderr,"ERROR: Could not open indata file.\n"); + exit(1); + } + fscanf(f_in, "%d", &nfft); + + printf("initializing...\n"); + for (log2_nfft = 1; (1 << log2_nfft) < nfft; log2_nfft++); + nfft = 1 << log2_nfft; + n = nfft + 2; + ip = (int *) malloc((3 + (int) sqrt(0.5 * nfft)) * sizeof(int)); + w = (double *) malloc(nfft / 2 * sizeof(double)); + a = (int *) malloc((n + 2) * sizeof(int)); + b = (int *) malloc((n + 2) * sizeof(int)); + c = (int *) malloc((n + 2) * sizeof(int)); + e = (int *) malloc((n + 2) * sizeof(int)); + i1 = (int *) malloc((n + 2) * sizeof(int)); + i2 = (int *) malloc((n + 2) * sizeof(int)); + d1 = (double *) malloc((nfft + 2) * sizeof(double)); + d2 = (double *) malloc((nfft + 2) * sizeof(double)); + d3 = (double *) malloc((nfft + 2) * sizeof(double)); + if (d3 == NULL) { + fprintf(stderr,"Allocation Failure!\n"); + exit(1); + } + ip[0] = 0; + /* ---- radix test ---- */ + log10_radix = 1; + radix = 10; + err = mp_mul_radix_test(n, radix, nfft, d1, ip, w); + err += DBL_EPSILON * (n * radix * radix / 4); + while (100 * err < DBL_ERROR_MARGIN && radix <= INT_MAX / 20) { + err *= 100; + log10_radix++; + radix *= 10; + } + printf("nfft= %d\nradix= %d\n", nfft, radix); + printf("calculating %d digits of PI...\n", log10_radix * (n - 2)); + + /* + * ---- a formula based on the AGM (Arithmetic-Geometric Mean) ---- + * c = sqrt(0.125); + * a = 1 + 3 * c; + * b = sqrt(a); + * e = b - 0.625; + * b = 2 * b; + * c = e - c; + * a = a + e; + * npow = 4; + * do { + * npow = 2 * npow; + * e = (a + b) / 2; + * b = sqrt(a * b); + * e = e - b; + * b = 2 * b; + * c = c - e; + * a = e + b; + * } while (e > SQRT_SQRT_EPSILON); + * e = e * e / 4; + * a = a + b; + * pi = (a * a - e - e / 2) / (a * c - e) / npow; + * ---- modification ---- + * This is a modified version of Gauss-Legendre formula + * (by T.Ooura). It is faster than original version. + * ---- reference ---- + * 1. E.Salamin, + * Computation of PI Using Arithmetic-Geometric Mean, + * Mathematics of Computation, Vol.30 1976. + * 2. R.P.Brent, + * Fast Multiple-Precision Evaluation of Elementary Functions, + * J. ACM 23 1976. + * 3. D.Takahasi, Y.Kanada, + * Calculation of PI to 51.5 Billion Decimal Digits on + * Distributed Memoriy Parallel Processors, + * Transactions of Information Processing Society of Japan, + * Vol.39 No.7 1998. + * 4. T.Ooura, + * Improvement of the PI Calculation Algorithm and + * Implementation of Fast Multiple-Precision Computation, + * Information Processing Society of Japan SIG Notes, + * 98-HPC-74, 1998. + */ + /* ---- c = sqrt(0.125) ---- */ + mp_sscanf(n, log10_radix, "0.125", a); + mp_sqrt(n, radix, a, c, i1, i2, nfft, d1, d2, ip, w); + /* ---- a = 1 + 3 * c ---- */ + mp_imul(n, radix, c, 3, e); + mp_sscanf(n, log10_radix, "1", a); + mp_add(n, radix, a, e, a); + /* ---- b = sqrt(a) ---- */ + mp_sqrt(n, radix, a, b, i1, i2, nfft, d1, d2, ip, w); + /* ---- e = b - 0.625 ---- */ + mp_sscanf(n, log10_radix, "0.625", e); + mp_sub(n, radix, b, e, e); + /* ---- b = 2 * b ---- */ + mp_add(n, radix, b, b, b); + /* ---- c = e - c ---- */ + mp_sub(n, radix, e, c, c); + /* ---- a = a + e ---- */ + mp_add(n, radix, a, e, a); + printf("AGM iteration\n"); + npow = 4; + do { + npow *= 2; + /* ---- e = (a + b) / 2 ---- */ + mp_add(n, radix, a, b, e); + mp_idiv_2(n, radix, e, e); + /* ---- b = sqrt(a * b) ---- */ + mp_mul(n, radix, a, b, a, i1, nfft, d1, d2, d3, ip, w); + mp_sqrt(n, radix, a, b, i1, i2, nfft, d1, d2, ip, w); + /* ---- e = e - b ---- */ + mp_sub(n, radix, e, b, e); + /* ---- b = 2 * b ---- */ + mp_add(n, radix, b, b, b); + /* ---- c = c - e ---- */ + mp_sub(n, radix, c, e, c); + /* ---- a = e + b ---- */ + mp_add(n, radix, e, b, a); + /* ---- convergence check ---- */ + nprc = -e[1]; + if (e[0] == 0) { + nprc = n; + } + printf("precision= %d\n", 4 * nprc * log10_radix); + } while (4 * nprc <= n); + /* ---- e = e * e / 4 (half precision) ---- */ + mp_idiv_2(n, radix, e, e); + mp_squh(n, radix, e, e, nfft, d1, ip, w); + /* ---- a = a + b ---- */ + mp_add(n, radix, a, b, a); + /* ---- a = (a * a - e - e / 2) / (a * c - e) / npow ---- */ + mp_mul(n, radix, a, c, c, i1, nfft, d1, d2, d3, ip, w); + mp_sub(n, radix, c, e, c); + mp_inv(n, radix, c, b, i1, i2, nfft, d1, d2, ip, w); + mp_squ(n, radix, a, a, i1, nfft, d1, d2, ip, w); + mp_sub(n, radix, a, e, a); + mp_idiv_2(n, radix, e, e); + mp_sub(n, radix, a, e, a); + mp_mul(n, radix, a, b, a, i1, nfft, d1, d2, d3, ip, w); + mp_idiv(n, radix, a, npow, a); + + /* ---- output ---- */ + free(d3); + free(d2); + free(d1); + dgt = (char *) malloc((log10_radix * n + 32) * sizeof(char)); + mp_sprintf(n - 1, log10_radix, a, dgt); + + printf("%s\n", dgt); + + free(dgt); + free(i2); + free(i1); + free(e); + free(c); + free(b); + free(a); + free(w); + free(ip); + /* ---- benchmark ---- */ + n_op = 50.0 * nfft * log2_nfft * log2_nfft; + printf("floating point operation: %g op.\n", n_op); + + return 0; + } + + + /* -------- multiple precision routines -------- */ + + + #include + #include + #include + + /* ---- floating point format ---- + data := data[0] * pow(radix, data[1]) * + (data[2] + data[3]/radix + data[4]/radix/radix + ...), + data[0] : sign (1;data>0, -1;data<0, 0;data==0) + data[1] : exponent (0;data==0) + data[2...n+1] : digits + ---- function prototypes ---- + void mp_load_0(int n, int radix, int out[]); + void mp_load_1(int n, int radix, int out[]); + void mp_round(int n, int radix, int m, int inout[]); + int mp_cmp(int n, int radix, int in1[], int in2[]); + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void mp_sub(int n, int radix, int in1[], int in2[], int out[]); + void mp_imul(int n, int radix, int in1[], int in2, int out[]); + int mp_idiv(int n, int radix, int in1[], int in2, int out[]); + void mp_idiv_2(int n, int radix, int in[], int out[]); + double mp_mul_radix_test(int n, int radix, int nfft, + double tmpfft[], int ip[], double w[]); + void mp_mul(int n, int radix, int in1[], int in2[], int out[], + int tmp[], int nfft, double tmp1fft[], double tmp2fft[], + double tmp3fft[], int ip[], double w[]); + void mp_squ(int n, int radix, int in[], int out[], int tmp[], + int nfft, double tmp1fft[], double tmp2fft[], + int ip[], double w[]); + void mp_mulh(int n, int radix, int in1[], int in2[], int out[], + int nfft, double in1fft[], double outfft[], + int ip[], double w[]); + void mp_squh(int n, int radix, int in[], int out[], + int nfft, double inoutfft[], int ip[], double w[]); + int mp_inv(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]); + int mp_sqrt(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]); + void mp_sprintf(int n, int log10_radix, int in[], char out[]); + void mp_sscanf(int n, int log10_radix, char in[], int out[]); + ---- + */ + + + /* -------- mp_load routines -------- */ + + + void mp_load_0(int n, int radix, int out[]) + { + int j; + + for (j = 0; j <= n + 1; j++) { + out[j] = 0; + } + } + + + void mp_load_1(int n, int radix, int out[]) + { + int j; + + out[0] = 1; + out[1] = 0; + out[2] = 1; + for (j = 3; j <= n + 1; j++) { + out[j] = 0; + } + } + + + void mp_round(int n, int radix, int m, int inout[]) + { + int j, x; + + if (m < n) { + for (j = n + 1; j > m + 2; j--) { + inout[j] = 0; + } + x = 2 * inout[m + 2]; + inout[m + 2] = 0; + if (x >= radix) { + for (j = m + 1; j >= 2; j--) { + x = inout[j] + 1; + if (x < radix) { + inout[j] = x; + break; + } + inout[j] = 0; + } + if (x >= radix) { + inout[2] = 1; + inout[1]++; + } + } + } + } + + + /* -------- mp_add routines -------- */ + + + int mp_cmp(int n, int radix, int in1[], int in2[]) + { + int mp_unsgn_cmp(int n, int in1[], int in2[]); + + if (in1[0] > in2[0]) { + return 1; + } else if (in1[0] < in2[0]) { + return -1; + } + return in1[0] * mp_unsgn_cmp(n, &in1[1], &in2[1]); + } + + + void mp_add(int n, int radix, int in1[], int in2[], int out[]) + { + int mp_unsgn_cmp(int n, int in1[], int in2[]); + int mp_unexp_add(int n, int radix, int expdif, + int in1[], int in2[], int out[]); + int mp_unexp_sub(int n, int radix, int expdif, + int in1[], int in2[], int out[]); + int outsgn, outexp, expdif; + + expdif = in1[1] - in2[1]; + outexp = in1[1]; + if (expdif < 0) { + outexp = in2[1]; + } + outsgn = in1[0] * in2[0]; + if (outsgn >= 0) { + if (outsgn > 0) { + outsgn = in1[0]; + } else { + outsgn = in1[0] + in2[0]; + outexp = in1[1] + in2[1]; + expdif = 0; + } + if (expdif >= 0) { + outexp += mp_unexp_add(n, radix, expdif, + &in1[2], &in2[2], &out[2]); + } else { + outexp += mp_unexp_add(n, radix, -expdif, + &in2[2], &in1[2], &out[2]); + } + } else { + outsgn = mp_unsgn_cmp(n, &in1[1], &in2[1]); + if (outsgn >= 0) { + expdif = mp_unexp_sub(n, radix, expdif, + &in1[2], &in2[2], &out[2]); + } else { + expdif = mp_unexp_sub(n, radix, -expdif, + &in2[2], &in1[2], &out[2]); + } + outexp -= expdif; + outsgn *= in1[0]; + if (expdif == n) { + outsgn = 0; + } + } + if (outsgn == 0) { + outexp = 0; + } + out[0] = outsgn; + out[1] = outexp; + } + + + void mp_sub(int n, int radix, int in1[], int in2[], int out[]) + { + int mp_unsgn_cmp(int n, int in1[], int in2[]); + int mp_unexp_add(int n, int radix, int expdif, + int in1[], int in2[], int out[]); + int mp_unexp_sub(int n, int radix, int expdif, + int in1[], int in2[], int out[]); + int outsgn, outexp, expdif; + + expdif = in1[1] - in2[1]; + outexp = in1[1]; + if (expdif < 0) { + outexp = in2[1]; + } + outsgn = in1[0] * in2[0]; + if (outsgn <= 0) { + if (outsgn < 0) { + outsgn = in1[0]; + } else { + outsgn = in1[0] - in2[0]; + outexp = in1[1] + in2[1]; + expdif = 0; + } + if (expdif >= 0) { + outexp += mp_unexp_add(n, radix, expdif, + &in1[2], &in2[2], &out[2]); + } else { + outexp += mp_unexp_add(n, radix, -expdif, + &in2[2], &in1[2], &out[2]); + } + } else { + outsgn = mp_unsgn_cmp(n, &in1[1], &in2[1]); + if (outsgn >= 0) { + expdif = mp_unexp_sub(n, radix, expdif, + &in1[2], &in2[2], &out[2]); + } else { + expdif = mp_unexp_sub(n, radix, -expdif, + &in2[2], &in1[2], &out[2]); + } + outexp -= expdif; + outsgn *= in1[0]; + if (expdif == n) { + outsgn = 0; + } + } + if (outsgn == 0) { + outexp = 0; + } + out[0] = outsgn; + out[1] = outexp; + } + + + /* -------- mp_add child routines -------- */ + + + int mp_unsgn_cmp(int n, int in1[], int in2[]) + { + int j, cmp; + + cmp = 0; + for (j = 0; j <= n && cmp == 0; j++) { + cmp = in1[j] - in2[j]; + } + if (cmp > 0) { + cmp = 1; + } else if (cmp < 0) { + cmp = -1; + } + return cmp; + } + + + int mp_unexp_add(int n, int radix, int expdif, + int in1[], int in2[], int out[]) + { + int j, x, carry; + + carry = 0; + if (expdif == 0 && in1[0] + in2[0] >= radix) { + x = in1[n - 1] + in2[n - 1]; + carry = x >= radix ? -1 : 0; + for (j = n - 1; j > 0; j--) { + x = in1[j - 1] + in2[j - 1] - carry; + carry = x >= radix ? -1 : 0; + out[j] = x - (radix & carry); + } + out[0] = -carry; + } else { + if (expdif > n) { + expdif = n; + } + for (j = n - 1; j >= expdif; j--) { + x = in1[j] + in2[j - expdif] - carry; + carry = x >= radix ? -1 : 0; + out[j] = x - (radix & carry); + } + for (j = expdif - 1; j >= 0; j--) { + x = in1[j] - carry; + carry = x >= radix ? -1 : 0; + out[j] = x - (radix & carry); + } + if (carry != 0) { + for (j = n - 1; j > 0; j--) { + out[j] = out[j - 1]; + } + out[0] = -carry; + } + } + return -carry; + } + + + int mp_unexp_sub(int n, int radix, int expdif, + int in1[], int in2[], int out[]) + { + int j, x, borrow, ncancel; + + if (expdif > n) { + expdif = n; + } + borrow = 0; + for (j = n - 1; j >= expdif; j--) { + x = in1[j] - in2[j - expdif] + borrow; + borrow = x < 0 ? -1 : 0; + out[j] = x + (radix & borrow); + } + for (j = expdif - 1; j >= 0; j--) { + x = in1[j] + borrow; + borrow = x < 0 ? -1 : 0; + out[j] = x + (radix & borrow); + } + ncancel = 0; + for (j = 0; j < n && out[j] == 0; j++) { + ncancel = j + 1; + } + if (ncancel > 0 && ncancel < n) { + for (j = 0; j < n - ncancel; j++) { + out[j] = out[j + ncancel]; + } + for (j = n - ncancel; j < n; j++) { + out[j] = 0; + } + } + return ncancel; + } + + + /* -------- mp_imul routines -------- */ + + + void mp_imul(int n, int radix, int in1[], int in2, int out[]) + { + void mp_unsgn_imul(int n, double dradix, int in1[], double din2, int out[]); + + if (in2 > 0) { + out[0] = in1[0]; + } else if (in2 < 0) { + out[0] = -in1[0]; + in2 = -in2; + } else { + out[0] = 0; + } + mp_unsgn_imul(n, radix, &in1[1], in2, &out[1]); + if (out[0] == 0) { + out[1] = 0; + } + } + + + int mp_idiv(int n, int radix, int in1[], int in2, int out[]) + { + void mp_load_0(int n, int radix, int out[]); + void mp_unsgn_idiv(int n, double dradix, int in1[], double din2, + int out[]); + + if (in2 == 0) { + return -1; + } + if (in2 > 0) { + out[0] = in1[0]; + } else { + out[0] = -in1[0]; + in2 = -in2; + } + if (in1[0] == 0) { + mp_load_0(n, radix, out); + return 0; + } + mp_unsgn_idiv(n, radix, &in1[1], in2, &out[1]); + return 0; + } + + + void mp_idiv_2(int n, int radix, int in[], int out[]) + { + int j, ix, carry, shift; + + out[0] = in[0]; + shift = 0; + if (in[2] == 1) { + shift = 1; + } + out[1] = in[1] - shift; + carry = -shift; + for (j = 2; j <= n + 1 - shift; j++) { + ix = in[j + shift] + (radix & carry); + carry = -(ix & 1); + out[j] = ix >> 1; + } + if (shift > 0) { + out[n + 1] = (radix & carry) >> 1; + } + } + + + /* -------- mp_imul child routines -------- */ + + + void mp_unsgn_imul(int n, double dradix, int in1[], double din2, + int out[]) + { + int j, carry, shift; + double x, d1_radix; + + d1_radix = 1.0 / dradix; + carry = 0; + for (j = n; j >= 1; j--) { + x = din2 * in1[j] + carry + 0.5; + carry = (int) (d1_radix * x); + out[j] = (int) (x - dradix * carry); + } + shift = 0; + x = carry + 0.5; + while (x > 1) { + x *= d1_radix; + shift++; + } + out[0] = in1[0] + shift; + if (shift > 0) { + while (shift > n) { + carry = (int) (d1_radix * carry + 0.5); + shift--; + } + for (j = n; j >= shift + 1; j--) { + out[j] = out[j - shift]; + } + for (j = shift; j >= 1; j--) { + x = carry + 0.5; + carry = (int) (d1_radix * x); + out[j] = (int) (x - dradix * carry); + } + } + } + + + void mp_unsgn_idiv(int n, double dradix, int in1[], double din2, int out[]) + { + int j, ix, carry, shift; + double x, d1_in2; + + d1_in2 = 1.0 / din2; + shift = 0; + x = 0; + do { + shift++; + x *= dradix; + if (shift <= n) { + x += in1[shift]; + } + } while (x < din2 - 0.5); + x += 0.5; + ix = (int) (d1_in2 * x); + carry = (int) (x - din2 * ix); + out[1] = ix; + shift--; + out[0] = in1[0] - shift; + if (shift >= n) { + shift = n - 1; + } + for (j = 2; j <= n - shift; j++) { + x = in1[j + shift] + dradix * carry + 0.5; + ix = (int) (d1_in2 * x); + carry = (int) (x - din2 * ix); + out[j] = ix; + } + for (j = n - shift + 1; j <= n; j++) { + x = dradix * carry + 0.5; + ix = (int) (d1_in2 * x); + carry = (int) (x - din2 * ix); + out[j] = ix; + } + } + + + /* -------- mp_mul routines -------- */ + + + double mp_mul_radix_test(int n, int radix, int nfft, + double tmpfft[], int ip[], double w[]) + { + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_csqu(int nfft, double dinout[]); + double mp_mul_d2i_test(int radix, int nfft, double din[]); + int j, ndata, radix_2; + + ndata = (nfft >> 1) + 1; + if (ndata > n) { + ndata = n; + } + tmpfft[nfft + 1] = radix - 1; + for (j = nfft; j > ndata; j--) { + tmpfft[j] = 0; + } + radix_2 = (radix + 1) / 2; + for (j = ndata; j > 2; j--) { + tmpfft[j] = radix_2; + } + tmpfft[2] = radix; + tmpfft[1] = radix - 1; tmpfft[0] = 0; + rdft(nfft, 1, &tmpfft[1], ip, w); + mp_mul_csqu(nfft, tmpfft); + rdft(nfft, -1, &tmpfft[1], ip, w); + return 2 * mp_mul_d2i_test(radix, nfft, tmpfft); + } + + + void mp_mul(int n, int radix, int in1[], int in2[], int out[], + int tmp[], int nfft, double tmp1fft[], double tmp2fft[], + double tmp3fft[], int ip[], double w[]) + { + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]); + void mp_mul_cmul(int nfft, double din[], double dinout[]); + void mp_mul_cmuladd(int nfft, double din1[], double din2[], + double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + int n_h, shift; + + shift = (nfft >> 1) + 1; + while (n > shift) { + if (in1[shift + 2] + in2[shift + 2] != 0) { + break; + } + shift++; + } + n_h = n / 2 + 1; + if (n_h < n - shift) { + n_h = n - shift; + } + /* ---- tmp3fft = (upper) in1 * (lower) in2 ---- */ + mp_mul_i2d(n, radix, nfft, 0, in1, tmp1fft); + rdft(nfft, 1, &tmp1fft[1], ip, w); + mp_mul_i2d(n, radix, nfft, shift, in2, tmp3fft); + rdft(nfft, 1, &tmp3fft[1], ip, w); + mp_mul_cmul(nfft, tmp1fft, tmp3fft); + /* ---- tmp = (upper) in1 * (upper) in2 ---- */ + mp_mul_i2d(n, radix, nfft, 0, in2, tmp2fft); + rdft(nfft, 1, &tmp2fft[1], ip, w); + mp_mul_cmul(nfft, tmp2fft, tmp1fft); + rdft(nfft, -1, &tmp1fft[1], ip, w); + mp_mul_d2i(n, radix, nfft, tmp1fft, tmp); + /* ---- tmp3fft += (upper) in2 * (lower) in1 ---- */ + mp_mul_i2d(n, radix, nfft, shift, in1, tmp1fft); + rdft(nfft, 1, &tmp1fft[1], ip, w); + mp_mul_cmuladd(nfft, tmp1fft, tmp2fft, tmp3fft); + /* ---- out = tmp + tmp3fft ---- */ + rdft(nfft, -1, &tmp3fft[1], ip, w); + mp_mul_d2i(n_h, radix, nfft, tmp3fft, out); + mp_add(n, radix, out, tmp, out); + } + + + void mp_squ(int n, int radix, int in[], int out[], int tmp[], + int nfft, double tmp1fft[], double tmp2fft[], + int ip[], double w[]) + { + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]); + void mp_mul_cmul(int nfft, double din[], double dinout[]); + void mp_mul_csqu(int nfft, double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + int n_h, shift; + + shift = (nfft >> 1) + 1; + while (n > shift) { + if (in[shift + 2] != 0) { + break; + } + shift++; + } + n_h = n / 2 + 1; + if (n_h < n - shift) { + n_h = n - shift; + } + /* ---- tmp = 2 * (upper) in * (lower) in ---- */ + mp_mul_i2d(n, radix, nfft, 0, in, tmp1fft); + rdft(nfft, 1, &tmp1fft[1], ip, w); + mp_mul_i2d(n, radix, nfft, shift, in, tmp2fft); + rdft(nfft, 1, &tmp2fft[1], ip, w); + mp_mul_cmul(nfft, tmp1fft, tmp2fft); + rdft(nfft, -1, &tmp2fft[1], ip, w); + mp_mul_d2i(n_h, radix, nfft, tmp2fft, tmp); + mp_add(n_h, radix, tmp, tmp, tmp); + /* ---- out = tmp + ((upper) in)^2 ---- */ + mp_mul_csqu(nfft, tmp1fft); + rdft(nfft, -1, &tmp1fft[1], ip, w); + mp_mul_d2i(n, radix, nfft, tmp1fft, out); + mp_add(n, radix, out, tmp, out); + } + + + void mp_mulh(int n, int radix, int in1[], int in2[], int out[], + int nfft, double in1fft[], double outfft[], int ip[], double w[]) + { + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]); + void mp_mul_cmul(int nfft, double din[], double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + + mp_mul_i2d(n, radix, nfft, 0, in1, in1fft); + rdft(nfft, 1, &in1fft[1], ip, w); + mp_mul_i2d(n, radix, nfft, 0, in2, outfft); + rdft(nfft, 1, &outfft[1], ip, w); + mp_mul_cmul(nfft, in1fft, outfft); + rdft(nfft, -1, &outfft[1], ip, w); + mp_mul_d2i(n, radix, nfft, outfft, out); + } + + + void mp_mulh_use_in1fft(int n, int radix, double in1fft[], + int shift, int in2[], int out[], int nfft, double outfft[], + int ip[], double w[]) + { + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]); + void mp_mul_cmul(int nfft, double din[], double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + + while (n > shift) { + if (in2[shift + 2] != 0) { + break; + } + shift++; + } + mp_mul_i2d(n, radix, nfft, shift, in2, outfft); + rdft(nfft, 1, &outfft[1], ip, w); + mp_mul_cmul(nfft, in1fft, outfft); + rdft(nfft, -1, &outfft[1], ip, w); + mp_mul_d2i(n, radix, nfft, outfft, out); + } + + + void mp_squh(int n, int radix, int in[], int out[], + int nfft, double inoutfft[], int ip[], double w[]) + { + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]); + void mp_mul_csqu(int nfft, double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + + mp_mul_i2d(n, radix, nfft, 0, in, inoutfft); + rdft(nfft, 1, &inoutfft[1], ip, w); + mp_mul_csqu(nfft, inoutfft); + rdft(nfft, -1, &inoutfft[1], ip, w); + mp_mul_d2i(n, radix, nfft, inoutfft, out); + } + + + void mp_squh_use_in1fft(int n, int radix, double inoutfft[], int out[], + int nfft, int ip[], double w[]) + { + void rdft(int n, int isgn, double *a, int *ip, double *w); + void mp_mul_csqu(int nfft, double dinout[]); + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]); + + mp_mul_csqu(nfft, inoutfft); + rdft(nfft, -1, &inoutfft[1], ip, w); + mp_mul_d2i(n, radix, nfft, inoutfft, out); + } + + + /* -------- mp_mul child routines -------- */ + + + void mp_mul_i2d(int n, int radix, int nfft, int shift, + int in[], double dout[]) + { + int j, x, carry, ndata, radix_2, topdgt; + + ndata = 0; + topdgt = 0; + if (n > shift) { + topdgt = in[shift + 2]; + ndata = (nfft >> 1) + 1; + if (ndata > n - shift) { + ndata = n - shift; + } + } + dout[nfft + 1] = in[0] * topdgt; + for (j = nfft; j > ndata; j--) { + dout[j] = 0; + } + /* ---- abs(dout[j]) <= radix/2 (to keep FFT precision) ---- */ + if (ndata > 1) { + radix_2 = radix / 2; + carry = 0; + for (j = ndata + 1; j > 3; j--) { + x = in[j + shift] - carry; + carry = x >= radix_2 ? -1 : 0; + dout[j - 1] = x - (radix & carry); + } + dout[2] = in[shift + 3] - carry; + } + dout[1] = topdgt; + dout[0] = in[1] - shift; + } + + + void mp_mul_cmul(int nfft, double din[], double dinout[]) + { + int j; + double xr, xi, yr, yi; + + dinout[0] += din[0]; + dinout[1] *= din[1]; + dinout[2] *= din[2]; + for (j = 3; j < nfft; j += 2) { + xr = din[j]; + xi = din[j + 1]; + yr = dinout[j]; + yi = dinout[j + 1]; + dinout[j] = xr * yr - xi * yi; + dinout[j + 1] = xr * yi + xi * yr; + } + dinout[nfft + 1] *= din[nfft + 1]; + } + + + void mp_mul_cmuladd(int nfft, double din1[], double din2[], + double dinout[]) + { + int j; + double xr, xi, yr, yi; + + dinout[1] += din1[1] * din2[1]; + dinout[2] += din1[2] * din2[2]; + for (j = 3; j < nfft; j += 2) { + xr = din1[j]; + xi = din1[j + 1]; + yr = din2[j]; + yi = din2[j + 1]; + dinout[j] += xr * yr - xi * yi; + dinout[j + 1] += xr * yi + xi * yr; + } + dinout[nfft + 1] += din1[nfft + 1] * din2[nfft + 1]; + } + + + void mp_mul_csqu(int nfft, double dinout[]) + { + int j; + double xr, xi; + + dinout[0] *= 2; + dinout[1] *= dinout[1]; + dinout[2] *= dinout[2]; + for (j = 3; j < nfft; j += 2) { + xr = dinout[j]; + xi = dinout[j + 1]; + dinout[j] = xr * xr - xi * xi; + dinout[j + 1] = 2 * xr * xi; + } + dinout[nfft + 1] *= dinout[nfft + 1]; + } + + + void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]) + { + int j, carry, carry1, carry2, shift, ndata; + double x, scale, d1_radix, d1_radix2, pow_radix, topdgt; + + scale = 2.0 / nfft; + d1_radix = 1.0 / radix; + d1_radix2 = d1_radix * d1_radix; + topdgt = din[nfft + 1]; + x = topdgt < 0 ? -topdgt : topdgt; + shift = x + 0.5 >= radix ? 1 : 0; + /* ---- correction of cyclic convolution of din[1] ---- */ + x *= nfft * 0.5; + din[nfft + 1] = din[1] - x; + din[1] = x; + /* ---- output of digits ---- */ + ndata = n; + if (n > nfft + 1 + shift) { + ndata = nfft + 1 + shift; + for (j = n + 1; j > ndata + 1; j--) { + out[j] = 0; + } + } + x = 0; + pow_radix = 1; + for (j = ndata + 1 - shift; j <= nfft + 1; j++) { + x += pow_radix * din[j]; + pow_radix *= d1_radix; + if (pow_radix < DBL_EPSILON) { + break; + } + } + x = d1_radix2 * (scale * x + 0.5); + carry2 = ((int) x) - 1; + carry = (int) (radix * (x - carry2) + 0.5); + for (j = ndata; j > 1; j--) { + x = d1_radix2 * (scale * din[j - shift] + carry + 0.5); + carry = carry2; + carry2 = ((int) x) - 1; + x = radix * (x - carry2); + carry1 = (int) x; + out[j + 1] = (int) (radix * (x - carry1)); + carry += carry1; + } + x = carry + ((double) radix) * carry2 + 0.5; + if (shift == 0) { + x += scale * din[1]; + } + carry = (int) (d1_radix * x); + out[2] = (int) (x - ((double) radix) * carry); + if (carry > 0) { + for (j = n + 1; j > 2; j--) { + out[j] = out[j - 1]; + } + out[2] = carry; + shift++; + } + /* ---- output of exp, sgn ---- */ + x = din[0] + shift + 0.5; + shift = ((int) x) - 1; + out[1] = shift + ((int) (x - shift)); + out[0] = topdgt > 0.5 ? 1 : -1; + if (out[2] == 0) { + out[0] = 0; + out[1] = 0; + } + } + + + double mp_mul_d2i_test(int radix, int nfft, double din[]) + { + int j, carry, carry1, carry2; + double x, scale, d1_radix, d1_radix2, err; + + scale = 2.0 / nfft; + d1_radix = 1.0 / radix; + d1_radix2 = d1_radix * d1_radix; + /* ---- correction of cyclic convolution of din[1] ---- */ + x = din[nfft + 1] * nfft * 0.5; + if (x < 0) { + x = -x; + } + din[nfft + 1] = din[1] - x; + /* ---- check of digits ---- */ + err = 0; + carry = 0; + carry2 = 0; + for (j = nfft + 1; j > 1; j--) { + x = d1_radix2 * (scale * din[j] + carry + 0.5); + carry = carry2; + carry2 = ((int) x) - 1; + x = radix * (x - carry2); + carry1 = (int) x; + x = radix * (x - carry1); + carry += carry1; + x = x - 0.5 - ((int) x); + if (x > err) { + err = x; + } else if (-x > err) { + err = -x; + } + } + return err; + } + + + /* -------- mp_inv routines -------- */ + + + int mp_inv(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]) + { + int mp_get_nfft_init(int radix, int nfft_max); + void mp_inv_init(int n, int radix, int in[], int out[]); + int mp_inv_newton(int n, int radix, int in[], int inout[], + int tmp1[], int tmp2[], int nfft, double tmp1fft[], + double tmp2fft[], int ip[], double w[]); + int n_nwt, nfft_nwt, thr, prc; + + if (in[0] == 0) { + return -1; + } + nfft_nwt = mp_get_nfft_init(radix, nfft); + n_nwt = nfft_nwt + 2; + if (n_nwt > n) { + n_nwt = n; + } + mp_inv_init(n_nwt, radix, in, out); + thr = 8; + do { + n_nwt = nfft_nwt + 2; + if (n_nwt > n) { + n_nwt = n; + } + prc = mp_inv_newton(n_nwt, radix, in, out, + tmp1, tmp2, nfft_nwt, tmp1fft, tmp2fft, ip, w); + #ifdef DEBUG + printf("n=%d, nfft=%d, prc=%d\n", n_nwt, nfft_nwt, prc); + #endif + if (thr * nfft_nwt >= nfft) { + thr = 0; + if (2 * prc <= n_nwt - 2) { + nfft_nwt >>= 1; + } + } else { + if (3 * prc < n_nwt - 2) { + nfft_nwt >>= 1; + } + } + nfft_nwt <<= 1; + } while (nfft_nwt <= nfft); + return 0; + } + + + int mp_sqrt(int n, int radix, int in[], int out[], + int tmp1[], int tmp2[], int nfft, + double tmp1fft[], double tmp2fft[], int ip[], double w[]) + { + void mp_load_0(int n, int radix, int out[]); + int mp_get_nfft_init(int radix, int nfft_max); + void mp_sqrt_init(int n, int radix, int in[], int out[], int out_rev[]); + int mp_sqrt_newton(int n, int radix, int in[], int inout[], + int inout_rev[], int tmp[], int nfft, double tmp1fft[], + double tmp2fft[], int ip[], double w[], int *n_tmp1fft); + int n_nwt, nfft_nwt, thr, prc, n_tmp1fft; + + if (in[0] < 0) { + return -1; + } else if (in[0] == 0) { + mp_load_0(n, radix, out); + return 0; + } + nfft_nwt = mp_get_nfft_init(radix, nfft); + n_nwt = nfft_nwt + 2; + if (n_nwt > n) { + n_nwt = n; + } + mp_sqrt_init(n_nwt, radix, in, out, tmp1); + n_tmp1fft = 0; + thr = 8; + do { + n_nwt = nfft_nwt + 2; + if (n_nwt > n) { + n_nwt = n; + } + prc = mp_sqrt_newton(n_nwt, radix, in, out, + tmp1, tmp2, nfft_nwt, tmp1fft, tmp2fft, + ip, w, &n_tmp1fft); + #ifdef DEBUG + printf("n=%d, nfft=%d, prc=%d\n", n_nwt, nfft_nwt, prc); + #endif + if (thr * nfft_nwt >= nfft) { + thr = 0; + if (2 * prc <= n_nwt - 2) { + nfft_nwt >>= 1; + } + } else { + if (3 * prc < n_nwt - 2) { + nfft_nwt >>= 1; + } + } + nfft_nwt <<= 1; + } while (nfft_nwt <= nfft); + return 0; + } + + + /* -------- mp_inv child routines -------- */ + + + int mp_get_nfft_init(int radix, int nfft_max) + { + int nfft_init; + double r; + + r = radix; + nfft_init = 1; + do { + r *= r; + nfft_init <<= 1; + } while (DBL_EPSILON * r < 1 && nfft_init < nfft_max); + return nfft_init; + } + + + void mp_inv_init(int n, int radix, int in[], int out[]) + { + void mp_unexp_d2mp(int n, int radix, double din, int out[]); + double mp_unexp_mp2d(int n, int radix, int in[]); + int outexp; + double din; + + out[0] = in[0]; + outexp = -in[1]; + din = 1.0 / mp_unexp_mp2d(n, radix, &in[2]); + while (din < 1) { + din *= radix; + outexp--; + } + out[1] = outexp; + mp_unexp_d2mp(n, radix, din, &out[2]); + } + + + void mp_sqrt_init(int n, int radix, int in[], int out[], int out_rev[]) + { + void mp_unexp_d2mp(int n, int radix, double din, int out[]); + double mp_unexp_mp2d(int n, int radix, int in[]); + int outexp; + double din; + + out[0] = 1; + out_rev[0] = 1; + outexp = in[1]; + din = mp_unexp_mp2d(n, radix, &in[2]); + if (outexp % 2 != 0) { + din *= radix; + outexp--; + } + outexp /= 2; + din = sqrt(din); + if (din < 1) { + din *= radix; + outexp--; + } + out[1] = outexp; + mp_unexp_d2mp(n, radix, din, &out[2]); + outexp = -outexp; + din = 1.0 / din; + while (din < 1) { + din *= radix; + outexp--; + } + out_rev[1] = outexp; + mp_unexp_d2mp(n, radix, din, &out_rev[2]); + } + + + void mp_unexp_d2mp(int n, int radix, double din, int out[]) + { + int j, x; + + for (j = 0; j < n; j++) { + x = (int) din; + if (x >= radix) { + x = radix - 1; + din = radix; + } + din = radix * (din - x); + out[j] = x; + } + } + + + double mp_unexp_mp2d(int n, int radix, int in[]) + { + int j; + double d1_radix, dout; + + d1_radix = 1.0 / radix; + dout = 0; + for (j = n - 1; j >= 0; j--) { + dout = d1_radix * dout + in[j]; + } + return dout; + } + + + int mp_inv_newton(int n, int radix, int in[], int inout[], + int tmp1[], int tmp2[], int nfft, double tmp1fft[], + double tmp2fft[], int ip[], double w[]) + { + void mp_load_1(int n, int radix, int out[]); + void mp_round(int n, int radix, int m, int inout[]); + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void mp_sub(int n, int radix, int in1[], int in2[], int out[]); + void mp_mulh(int n, int radix, int in1[], int in2[], int out[], + int nfft, double in1fft[], double outfft[], + int ip[], double w[]); + void mp_mulh_use_in1fft(int n, int radix, double in1fft[], + int shift, int in2[], int out[], int nfft, double outfft[], + int ip[], double w[]); + int n_h, shift, prc; + + shift = (nfft >> 1) + 1; + n_h = n / 2 + 1; + if (n_h < n - shift) { + n_h = n - shift; + } + /* ---- tmp1 = inout * (upper) in (half to normal precision) ---- */ + mp_round(n, radix, shift, inout); + mp_mulh(n, radix, inout, in, tmp1, + nfft, tmp1fft, tmp2fft, ip, w); + /* ---- tmp2 = 1 - tmp1 ---- */ + mp_load_1(n, radix, tmp2); + mp_sub(n, radix, tmp2, tmp1, tmp2); + /* ---- tmp2 -= inout * (lower) in (half precision) ---- */ + mp_mulh_use_in1fft(n, radix, tmp1fft, shift, in, tmp1, + nfft, tmp2fft, ip, w); + mp_sub(n_h, radix, tmp2, tmp1, tmp2); + /* ---- get precision ---- */ + prc = -tmp2[1]; + if (tmp2[0] == 0) { + prc = nfft + 1; + } + /* ---- tmp2 *= inout (half precision) ---- */ + mp_mulh_use_in1fft(n_h, radix, tmp1fft, 0, tmp2, tmp2, + nfft, tmp2fft, ip, w); + /* ---- inout += tmp2 ---- */ + mp_add(n, radix, inout, tmp2, inout); + return prc; + } + + + int mp_sqrt_newton(int n, int radix, int in[], int inout[], + int inout_rev[], int tmp[], int nfft, double tmp1fft[], + double tmp2fft[], int ip[], double w[], int *n_tmp1fft) + { + void mp_round(int n, int radix, int m, int inout[]); + void mp_add(int n, int radix, int in1[], int in2[], int out[]); + void mp_sub(int n, int radix, int in1[], int in2[], int out[]); + void mp_idiv_2(int n, int radix, int in[], int out[]); + void mp_mulh(int n, int radix, int in1[], int in2[], int out[], + int nfft, double in1fft[], double outfft[], int ip[], double w[]); + void mp_squh(int n, int radix, int in[], int out[], + int nfft, double inoutfft[], int ip[], double w[]); + void mp_squh_use_in1fft(int n, int radix, double inoutfft[], int out[], + int nfft, int ip[], double w[]); + int n_h, nfft_h, shift, prc; + + nfft_h = nfft >> 1; + shift = nfft_h + 1; + if (nfft_h < 2) { + nfft_h = 2; + } + n_h = n / 2 + 1; + if (n_h < n - shift) { + n_h = n - shift; + } + /* ---- tmp = inout_rev^2 (1/4 to half precision) ---- */ + mp_round(n_h, radix, (nfft_h >> 1) + 1, inout_rev); + if (*n_tmp1fft != nfft_h) { + mp_squh(n_h, radix, inout_rev, tmp, + nfft_h, tmp1fft, ip, w); + } else { + mp_squh_use_in1fft(n_h, radix, tmp1fft, tmp, + nfft_h, ip, w); + } + /* ---- tmp = inout_rev - inout * tmp (half precision) ---- */ + mp_round(n, radix, shift, inout); + mp_mulh(n_h, radix, inout, tmp, tmp, + nfft, tmp1fft, tmp2fft, ip, w); + mp_sub(n_h, radix, inout_rev, tmp, tmp); + /* ---- inout_rev += tmp ---- */ + mp_add(n_h, radix, inout_rev, tmp, inout_rev); + /* ---- tmp = in - inout^2 (half to normal precision) ---- */ + mp_squh_use_in1fft(n, radix, tmp1fft, tmp, + nfft, ip, w); + mp_sub(n, radix, in, tmp, tmp); + /* ---- get precision ---- */ + prc = in[1] - tmp[1]; + if (in[2] > tmp[2]) { + prc++; + } + if (tmp[0] == 0) { + prc = nfft + 1; + } + /* ---- tmp = tmp * inout_rev / 2 (half precision) ---- */ + mp_round(n_h, radix, shift, inout_rev); + mp_mulh(n_h, radix, inout_rev, tmp, tmp, + nfft, tmp1fft, tmp2fft, ip, w); + *n_tmp1fft = nfft; + mp_idiv_2(n_h, radix, tmp, tmp); + /* ---- inout += tmp ---- */ + mp_add(n, radix, inout, tmp, inout); + return prc; + } + + + /* -------- mp_io routines -------- */ + + + void mp_sprintf(int n, int log10_radix, int in[], char out[]) + { + int j, k, x, y, outexp, shift; + + if (in[0] < 0) { + *out++ = '-'; + } + x = in[2]; + shift = log10_radix; + for (k = log10_radix; k > 0; k--) { + y = x % 10; + x /= 10; + out[k] = '0' + y; + if (y != 0) { + shift = k; + } + } + out[0] = out[shift]; + out[1] = '.'; + for (k = 1; k <= log10_radix - shift; k++) { + out[k + 1] = out[k + shift]; + } + outexp = log10_radix - shift; + out += outexp + 2; + for (j = 3; j <= n + 1; j++) { + x = in[j]; + for (k = log10_radix - 1; k >= 0; k--) { + y = x % 10; + x /= 10; + out[k] = '0' + y; + } + out += log10_radix; + } + *out++ = 'e'; + outexp += log10_radix * in[1]; + sprintf(out, "%d", outexp); + } + + + void mp_sscanf(int n, int log10_radix, char in[], int out[]) + { + char *s; + int j, x, outexp, outexp_mod; + + while (*in == ' ') { + in++; + } + out[0] = 1; + if (*in == '-') { + out[0] = -1; + in++; + } else if (*in == '+') { + in++; + } + while (*in == ' ' || *in == '0') { + in++; + } + outexp = 0; + for (s = in; *s != '\0'; s++) { + if (*s == 'e' || *s == 'E' || *s == 'd' || *s == 'D') { + if (sscanf(++s, "%d", &outexp) != 1) { + outexp = 0; + } + break; + } + } + if (*in == '.') { + do { + outexp--; + while (*++in == ' '); + } while (*in == '0' && *in != '\0'); + } else if (*in != '\0') { + s = in; + while (*++s == ' '); + while (*s >= '0' && *s <= '9' && *s != '\0') { + outexp++; + while (*++s == ' '); + } + } + x = outexp / log10_radix; + outexp_mod = outexp - log10_radix * x; + if (outexp_mod < 0) { + x--; + outexp_mod += log10_radix; + } + out[1] = x; + x = 0; + j = 2; + for (s = in; *s != '\0'; s++) { + if (*s == '.' || *s == ' ') { + continue; + } + if (*s < '0' || *s > '9') { + break; + } + x = 10 * x + (*s - '0'); + if (--outexp_mod < 0) { + if (j > n + 1) { + break; + } + out[j++] = x; + x = 0; + outexp_mod = log10_radix - 1; + } + } + while (outexp_mod-- >= 0) { + x *= 10; + } + while (j <= n + 1) { + out[j++] = x; + x = 0; + } + if (out[2] == 0) { + out[0] = 0; + out[1] = 0; + } + } + + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/ref.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/ref.in:1.1 *** /dev/null Sat Oct 11 16:18:59 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/ref.in Sat Oct 11 16:18:48 2003 *************** *** 0 **** --- 1 ---- + 1048576 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in:1.1 *** /dev/null Sat Oct 11 16:18:59 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in Sat Oct 11 16:18:49 2003 *************** *** 0 **** --- 1 ---- + 16384 From lattner at cs.uiuc.edu Sat Oct 11 16:22:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat Oct 11 16:22:10 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/Makefile analyzer.c analyzer.conf functs.c functs.h help.c help.h parse_settings.c parse_settings.h ref.in test.in types.c types.h version.h Message-ID: <200310112118.QAA21258@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer: Makefile added (r1.1) analyzer.c added (r1.1) analyzer.conf added (r1.1) functs.c added (r1.1) functs.h added (r1.1) help.c added (r1.1) help.h added (r1.1) parse_settings.c added (r1.1) parse_settings.h added (r1.1) ref.in added (r1.1) test.in added (r1.1) types.c added (r1.1) types.h added (r1.1) version.h added (r1.1) --- Log message: Initial checkin of the FreeBench benchmark suite --- Diffs of the changes: (+117652 -0) Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/Makefile diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/Makefile:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/Makefile Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,12 ---- + LEVEL = ../../../../../.. + + PROG = analyzer + CPPFLAGS = -DVERSION='"1.00"' -DCOMPDATE="\"today\"" -DCFLAGS='""' -DHOSTNAME="\"thishost\"" + #LDFLAGS = -lm + ifdef LARGE_PROBLEM_SIZE + RUN_OPTIONS = ref.in + else + RUN_OPTIONS = test.in + endif + include $(LEVEL)/test/Programs/MultiSource/Makefile.multisrc + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.c Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,353 ---- + #include + #include + #include + #include + #include + #include + #include "version.h" + #include "types.h" + #include "functs.h" + #include "help.h" + #include "parse_settings.h" + + #define TOP_LIST_LEN 10 + #define EPOCH_LENGTH 1 + + int list_len=0; + int top_list_len=TOP_LIST_LEN; + int epoch_length=EPOCH_LENGTH; + int def_table_size=10007; + + extern int settings[]; + + /*************************************** + * This program is modified for use in * + * benchmarking puposes. The complete * + * program was used in computer system * + * research at Chalmers University of * + * Technology, Sweden. Chalmers has * + * nothing to do with this program. * + * * + * Plese feel free to distribute this * + * program as you like. * + * * + * Peter Rundberg, biff at ce.chalmers.se * + ***************************************/ + + + conf_list_t *list=NULL; + int first=1; + def_list_t **def_table=NULL; + hard_raw_t *hard_raw_list=NULL; + + + void init_def_table(int def_size) + { + int i; + + def_table=(def_list_t **)malloc(def_size*sizeof(def_list_t *)); + + if (def_table==NULL) { + fprintf(stderr,"Out of memory...\n"); + exit(1); + } + + for (i=0;iload_store=load_op; + trans->address=address; + trans->issue_no=issue_no-epoch[varv/epoch_length].start_time; + trans->next=NULL; + if (epoch[varv/epoch_length].first_trans) { + epoch[varv/epoch_length].trans=trans; + epoch[varv/epoch_length].last=trans; + epoch[varv/epoch_length].first_trans=0; + } else { + epoch[varv/epoch_length].last->next=trans; + epoch[varv/epoch_length].last=trans; + } + } else if (!strcmp(string,"ST:")) { + data_pen_tot+=(uint32)store_pen; + load_store=store_op; + trans=(trans_t *)malloc(sizeof(trans_t)); + trans->load_store=store_op; + trans->address=address; + trans->issue_no=issue_no-epoch[varv/epoch_length].start_time; + trans->next=NULL; + def_list_mod(address,varv/epoch_length,place_in_varv); + if (epoch[varv/epoch_length].first_trans) { + epoch[varv/epoch_length].trans=trans; + epoch[varv/epoch_length].last=trans; + epoch[varv/epoch_length].first_trans=0; + } else { + epoch[varv/epoch_length].last->next=trans; + epoch[varv/epoch_length].last=trans; + } + } else { + break; + } + /* Place to put processing... */ + if (data || speed) { + /* Search the epochs read so far for RAW conflicts */ + if (load_store==load_op) { + for (i=0;iload_store==store_op && trans->address==address) { + def_list_t *def_placeholder=NULL; + def_placeholder=def_list_lookup(address); + if (def_placeholder!=NULL) { + if ((def_placeholder->epoch==i) && + (def_placeholder->place_in_epoch==place_in_epoch)) { + conflict_list(address); + hard_raw_mod(address, i, place_in_epoch, trans->issue_no, varv/epoch_length, place_in_varv, issue_no-epoch[varv/epoch_length].start_time); + } + } + } + trans=(trans_t *)trans->next; + } + } + } else { + + } + } + if (name) { + fprintf(stderr,"ALERT: \tName dependecy testing not implemented\n"); + exit(1); + } + if (verbose && !(varv%10)) + fprintf(stderr,"\rProcessing %3.2f %% ", 100*(float)varv/(float)loops); + place_in_varv++; + } + } else if (!strcmp(string,"END:")) { + if (verbose) + fprintf(stderr,"\rProcessing 100.00 %% \n"); + break; + } else { + if (verbose) + fprintf(stderr,"\n"); + fprintf(stderr,"ERROR: \tWrong format on file %s\n",v[c-1]); + exit(1); + } + } + } + + + if (data) { + conf_list_t *conf_iterator=list; + while (conf_iterator!=NULL) { + printf("%d RAW:s for 0x%lx\n",conf_iterator->accesser, conf_iterator->address); + conf_iterator=(conf_list_t *)conf_iterator->next; + } + } + + if (speed) { + epoch[varv/epoch_length].end_time=epoch[varv/epoch_length].start_time+epoch[varv/epoch_length].last->issue_no; + + if (forward) + find_hard_raws(); + + speedup_test(fp); + + if (kernel ==1) { + specul_time_o(epoch, num_epochs,graphfile,show_speedup,thread_pen,commit_pen); + } else if (kernel == 2) { + specul_time_r(epoch, num_epochs, cpulimit,graphfile,show_speedup,thread_pen,commit_pen); + if (configs) { + for (i=1;i<=configs;) { + specul_time_r(epoch, num_epochs, i,graphfile,show_speedup,thread_pen,commit_pen); + i=i*2; + } + } + } else if (kernel == 3) { + specul_time_o(epoch, num_epochs,graphfile,show_speedup,thread_pen,commit_pen); + specul_time_r(epoch, num_epochs, cpulimit,graphfile,show_speedup,thread_pen,commit_pen); + if (configs) { + for (i=1;i<=configs;) { + specul_time_r(epoch, num_epochs, i,graphfile,show_speedup,thread_pen,commit_pen); + i=i*2; + } + } + } else { + fprintf(stderr,"ALERT: \tNo such kernel present\n"); + exit(1); + } + + } + + + return 0; + } + + + + Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.conf diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.conf:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/analyzer.conf Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,40 ---- + # The overhead associated with a load (in cycles) + LOAD_PENALTY 0 + + # The overhead associated with a store (in cycles) + STORE_PENALTY 0 + + # These settings can be overridden by flags + # Check for data dependencies + DATA 1 + # Check for name dependencies + NAME 0 + # Analyze for maximum SpeedUp + SPEED 1 + # Do SpeedUp test before dependency tests + EARLY_SPEED 0 + # Disable the use of forwarding in dependency tests + NO_FORWARDING 0 + # Analyze instructionmix + INST_MIX 1 + # Do not print progress info + QUIET 1 + # The number of loop iterations in an epoch + EPOCH_LENGTH 1 + # What test kernel to be used in tests + # 1 -- Optimum SpeedUp analyzer + # 2 -- Realistic SpeedUp analyzer + # 3 -- Both + KERNEL 3 + # The number of simulated CPUs in realistic analyzer + CPULIMIT 0 + # Test several CPU configurations, up to # of CPUs + CONFIGS 0 + # Show SpeedUp for 1 - Loop, 2 - Program, 3 - Both + SHOW_SPEEDUP 3 + # Penalty for starting a (one) thread (in cycles) + THREAD_PEN 0 + # Penalty for commiting a (one) thread to MM (in cycles) + COMMIT_PEN 0 + # Use the setting of EPOCH_LENGTH as number of epochs in program + EPOCH_LENGTH_AS_NUM_EPOCHS 0 Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.c Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,220 ---- + #include + #include + #include "types.h" + #include "functs.h" + + extern hard_raw_t *hard_raw_list; + + uint32 prog_time, loop_time; + + void speedup_test(FILE *fp) + { + char string[100],ostring[100],slask[100]; + uint32 address; + uint32 issue_no1, issue_no2, issue_no3; + + rewind(fp); + + fscanf(fp,"%s %lu",string,&issue_no1); + + do { + strcpy(ostring,string); + fgets(string,100,fp); + } while (string[0]!='E'); + + sscanf(ostring,"%s %lx %lu",slask,&address,&issue_no2); + sscanf(string,"%s %lu %lu",slask,&address,&issue_no3); + + loop_time=issue_no2-issue_no1; + printf("Time for loop: %lu issues\n",loop_time); + prog_time=issue_no3; + printf("Time for program: %lu issues\n",prog_time); + + printf("Loop is %0.3g %% of program\n",(double)(issue_no2-issue_no1)/(double)issue_no3*100); + rewind(fp); + } + + uint32 imix_test(FILE *fp) + { + char string[100],ostring[100],slask[100]; + uint32 address; + uint32 issue_no1, issue_no2; + uint32 data_access=0; + + rewind(fp); + + fgets(string, 100, fp); + + fscanf(fp,"%s %lu",string,&issue_no1); + do { + if (string[2]==':') + data_access++; + strcpy(ostring,string); + fgets(string,100,fp); + } while (string[0]!='E'); + + sscanf(ostring,"%s %lx %lu",slask,&address,&issue_no2); + + /* printf("Instuction mix: Data accesses are %0.3g %% of loop\n",(double)data_access/(double)(issue_no2-issue_no1)*100); */ + rewind(fp); + return data_access; + } + + void find_hard_raws() + { + hard_raw_t *iter=NULL; + + iter=hard_raw_list; + while (iter!=NULL) { + if (iter->r_issue>iter->w_issue) { + if (iter->prev!=NULL) { + iter->prev->next=iter->next; + } + iter=iter->next; + } else { + iter=iter->next; + } + } + } + + /* This function calculates the "optimal" execution time with speculation */ + void specul_time_o(epoch_t *epoch, int num_epochs, FILE *graphfile, int show_speedup, int thread_pen, int commit_pen) + { + int i; + uint32 max; + uint32 restarts=0; + + for (i=0;iw_issue+epoch[iter->w_epoch].stall_time) > epoch[iter->r_epoch].stall_time) { + epoch[iter->r_epoch].stall_time=iter->w_issue+epoch[iter->w_epoch].stall_time; + restarts++; + } + iter=iter->next; + } + } + + for (i=0;imax) + max=epoch[i].run_time; + } + + printf("OPTIMUM RESTART RESULTS\n"); + max+=(restarts+num_epochs)*thread_pen+num_epochs*commit_pen; + + printf("Time for speculative loop is %lu issues\n",max); + + if (show_speedup == 1 || show_speedup == 3) + printf("Potential speedup for loop: %0.3g times\n", (double)loop_time/(double)max); + if (show_speedup == 2 || show_speedup == 3) + printf("Potential speedup for program: %0.3g times\n", (double)prog_time/(max+prog_time-loop_time)); + if (graphfile!=NULL) { + if (show_speedup == 1 || show_speedup == 3) + fprintf(graphfile,"optloop: %0.3g\n", (double)loop_time/(double)max); + if (show_speedup == 2 || show_speedup == 3) + fprintf(graphfile,"optprog: %0.3g\n", (double)prog_time/(double)(max+prog_time-loop_time)); + } + } + + /* These functions calculates the "realistic" execution time with speculation */ + void specul_time_r(epoch_t *epoch, int num_epochs, int cpulimit, FILE *graphfile, int show_speedup, int thread_pen, int commit_pen) + { + int i; + uint32 max=0; + uint32 restarts=0; + + if (cpulimit==0) { /* "Unlimited" amount of CPUs simulated */ + printf("REALISTIC RESTART RESULTS -- Unlimited amount of CPUs\n"); + for (i=0;iw_issue+epoch[iter->w_epoch].stall_time) > epoch[iter->r_epoch].stall_time) { + epoch[iter->r_epoch].stall_time=epoch[iter->w_epoch].run_time+epoch[iter->w_epoch].stall_time; + restarts++; + } + iter=iter->next; + } + } + + for (i=0;imax) + max=epoch[i].run_time; + } + } else { /* Limited amount of CPUs simulated */ + int j; + uint32 current_stall=0; + printf("REALISTIC RESTART RESULTS -- %d CPUs\n",cpulimit); + for (i=0;icurrent_stall) + current_stall=epoch[j].run_time+epoch[j].stall_time; + } + for (j=i;jw_issue+epoch[iter->w_epoch].stall_time) > epoch[iter->r_epoch].stall_time) { + epoch[iter->r_epoch].stall_time+=epoch[iter->w_epoch].run_time+epoch[iter->w_epoch].stall_time; + restarts++; + } + iter=iter->next; + } + } + for (i=0;imax) + max=epoch[i].run_time; + } + + } + max+=(restarts+num_epochs)*thread_pen+num_epochs*commit_pen; + + printf("Time for speculative loop is %lu issues\n",max); + + if (show_speedup == 1 || show_speedup == 3) + printf("Potential speedup for loop: %0.3g times\n", (double)loop_time/(double)max); + if (show_speedup == 2 || show_speedup == 3) + printf("Potential speedup for program: %0.3g times\n", (double)prog_time/(double)(max+prog_time-loop_time)); + if (graphfile!=NULL) { + if (show_speedup == 1 || show_speedup == 3) + fprintf(graphfile,"realloop: %d %0.3g\n", cpulimit, (double)loop_time/(double)max); + if (show_speedup == 2 || show_speedup == 3) + fprintf(graphfile,"realprog: %d %0.3g\n", cpulimit, (double)prog_time/(double)(max+prog_time-loop_time)); + } + } Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.h diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.h:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/functs.h Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,12 ---- + #ifndef __FUNCTS_H + #define __FUNCTS_H + + #include "types.h" + + void speedup_test(FILE *fp); + uint32 imix_test(FILE *fp); + void specul_time_o(epoch_t *epoch, int num_epochs, FILE *graphfile, int show_speedup, int thread_pen, int commit_pen); + void specul_time_r(epoch_t *epoch, int num_epochs, int cpulimit, FILE *graphfile, int show_speedup, int thread_pen, int commit_pen); + void find_hard_raws(); + + #endif /* __FUNCTS_H */ Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.c Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,41 ---- + #include + + #define p(x) fprintf(stderr,x); + + void show_help(char *prog_name) + { + fprintf(stderr,"Help/Manual for Dependency Analyzer"); + p("\nThis program is written by Peter Rundberg, Chalmers University of Technology\n") + p("Questions about this software should be directed to biff at ce.chalmers.se\n\n") + p("To determine the data hazards between loop iterations this program analyzes\n") + p("trace data from a run of the program examined. The program also analyzes the\n") + p("potential speedup obtainable from running the loop iterations in parallel.\n\n") + p("The program requires a number of settings to be done either on the\n") + p("command line or in the settings file.\n\n") + p("Available flags. Many of these can be set in the settings file.\n"); + p("-c # : CPU limit. Only effective with 'realistic restart'. 0==unlimited.\n"); + p("-C # : CPU limit for run through several configurations.\n"); + p("-d : Check for DATA dependencies (RAW)\n"); + p("-e # : Epoch length (number of loop iterations per epoch).\n"); + p("-E : Use epoch length as total number of epochs\n"); + p("-f : Do NOT use forwarding in speedup analysis\n"); + p("-g # : Specify Thread start penalty\n"); + p("-G # : Specify Commit penalty\n"); + p("-h : Show complete help message\n"); + p("-i # : Print SpeedUp for 1 - Loop, 2 - Program, 3 - Both.\n"); + p("-k # : The test kernel to be used in the test.\n"); + p(" 1 - Optimum restart. 2 - Realistic restart. 3 - Both\n"); + p("-l # : Max length of hazard top-list. -- NOT IMPLEMENTED --\n"); + p("-m : Analyze instruction mix\n"); + p("-n : Check for NAME dependencies (WAR & WAW) -- NOT IMPLEMENTED --\n"); + p("-o : Output graphing data to FILE\n"); + p("-p # : Specify load penalty\n"); + p("-P # : Specify store penalty\n"); + p("-q : Quiet mode (do not print processing status)\n"); + p("-s : Do speedup analysis\n"); + p("-S : Do speedup analysis, start early\n"); + p("-t # : Specify the size of the def_hash_table.\n"); + p("-x : Use other settings file. DEFAULT: analyzer.conf\n"); + p("-X : Do not read settings from a file\n"); + p("\n"); + } Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.h diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.h:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/help.h Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,6 ---- + #ifndef __HELP_H + #define __HELP_H + + void show_help(char *prog_name); + + #endif /* __HELP_H */ Index: llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/parse_settings.c diff -c /dev/null llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/parse_settings.c:1.1 *** /dev/null Sat Oct 11 16:18:57 2003 --- llvm/test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/parse_settings.c Sat Oct 11 16:18:46 2003 *************** *** 0 **** --- 1,51 ---- + #include + #include + #include + #include "parse_settings.h" + + #define NUM_TOKENS 17 + char *pattern[NUM_TOKENS]={"LOAD_PENALTY","STORE_PENALTY", + "DATA","NAME", + "SPEED","EARLY_SPEED", + "NO_FORWARDING","INST_MIX", + "QUIET","EPOCH_LENGTH", + "KERNEL","CPULIMIT", + "CONFIGS","SHOW_SPEEDUP", + "THREAD_PEN","COMMIT_PEN", + "EPOCH_LENGTH_AS_NUM_EPOCHS"}; + int settings[NUM_TOKENS]; + + int parse_settings(char *filename) + { + FILE *fp; + char *line; + int i=0; + + line=(char *)malloc(100*sizeof(char)); + for (i=0;i
          • +

            Basic Commands

            @@ -59,7 +59,7 @@

            -

            +

            C and C++ Front-end Commands

            @@ -109,7 +109,7 @@ LLVM Team.
            -Last modified: Tue Oct 7 15:04:55 CDT 2003 +Last modified: Tue Oct 7 15:34:17 CDT 2003 From lattner at cs.uiuc.edu Tue Oct 7 15:37:05 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:37:05 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/analyze.html Message-ID: <200310072036.PAA21468@tank.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: analyze.html updated: 1.7 -> 1.8 --- Log message: cleanup analyze documents --- Diffs of the changes: (+28 -39) Index: llvm/www/docs/CommandGuide/analyze.html diff -u llvm/www/docs/CommandGuide/analyze.html:1.7 llvm/www/docs/CommandGuide/analyze.html:1.8 --- llvm/www/docs/CommandGuide/analyze.html:1.7 Tue Oct 7 15:12:03 2003 +++ llvm/www/docs/CommandGuide/analyze.html Tue Oct 7 15:36:00 2003 @@ -5,38 +5,29 @@ -
            -

            LLVM: analyze tool

            -
            +

            LLVM: analyze tool


            -

            -NAME -

            - -analyze - -

            -SYNOPSIS -

            - -analyze [options] [filename] -

            -DESCRIPTION -

            +

            NAME

            +analyze -The analyze command performs various analysis of LLVM assembly code or +

            SYNOPSIS

            +analyze [options] [filename] + +

            DESCRIPTION

            + +The analyze command performs various analysis of LLVM assembly code or bytecode. It will usually print the results on standard output, but in a few cases, it will print output to standard error or generate a file with the analysis output (which is usually done when the output is meant for another program).

            -If filename is omitted or is -, analyze reads its input from standard input. -It first attempts to interpret its input as LLVM bytecode. If it encounters an -error, it then attempts to parse the input as LLVM assembly language. -

            -OPTIONS -

            +If filename is omitted or is -, analyze reads its input from standard +input. It first attempts to interpret its input as LLVM bytecode. If it +encounters an error, it then attempts to parse the input as LLVM assembly +language. + +

            OPTIONS

            • -help @@ -64,26 +55,24 @@
              Load the specified dynamic object with name plugin.so. This file should contain additional analysis passes that register themselves with - the analyze program after being loaded. + the analyze program after being loaded.

              + After being loaded, additional command line options are made available - for running the passes made available by plugin.so. Use 'analyze - -load <plugin.so> -help' to see the new list of available - analysis passes. + for running the passes made available by plugin.so. Use + 'analyze -load <plugin.so> -help' to see the new + list of available analysis passes.

            -

            -EXIT STATUS -

            - -If analyze succeeds, it will exit with 0. Otherwise, if an error occurs, it -will exit with a non-zero value. - -

            -SEE ALSO -

            -opt +

            EXIT STATUS

            + +If analyze succeeds, it will exit with 0. Otherwise, if an error +occurs, it will exit with a non-zero value. + +

            SEE ALSO

            + +opt
            Maintained by the LLVM Team. From lattner at cs.uiuc.edu Tue Oct 7 15:51:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 15:51:00 2003 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200310072050.PAA10586@apoc.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.2 -> 1.3 --- Log message: Add more credits --- Diffs of the changes: (+1 -1) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.2 llvm/CREDITS.TXT:1.3 --- llvm/CREDITS.TXT:1.2 Tue Sep 23 15:59:28 2003 +++ llvm/CREDITS.TXT Tue Oct 7 15:50:29 2003 @@ -42,4 +42,4 @@ N: Bill Wendling E: wendling at isanbard.org -D: The Lower Setjmp/Longjmp pass +D: The Lower Setjmp/Longjmp pass, improvements to the -lowerswitch pass. From criswell at cs.uiuc.edu Tue Oct 7 15:56:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 15:56:01 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvm.py Message-ID: <200310072055.PAA13327@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvm.py updated: 1.14 -> 1.15 --- Log message: Added an option to ExecProgram() that allows a caller to specify an output filename. This is useful for TestRunner tests. Modified TestRunner so that it uses ExecProgram. Errors should be easier to catch now, and fork/exec time should be smaller. Renamed the output files of TestRunner tests so that they don't conflict with Feature tests with similar names (i.e. basictest). --- Diffs of the changes: (+13 -9) Index: llvm/test/QMTest/llvm.py diff -u llvm/test/QMTest/llvm.py:1.14 llvm/test/QMTest/llvm.py:1.15 --- llvm/test/QMTest/llvm.py:1.14 Tue Oct 7 14:12:32 2003 +++ llvm/test/QMTest/llvm.py Tue Oct 7 15:55:15 2003 @@ -34,12 +34,15 @@ # 0 - The program executed successfully. # 1 - The program failed. # -def ExecProgram (args, env = os.environ): +def ExecProgram (args, env = os.environ, outfile=''): # # Create a pipe to the new program. # - (parent_in, child_out) = os.pipe () + if (outfile == ''): + (parent_in, child_out) = os.pipe () + else: + child_out = os.open (outfile, os.O_WRONLY | os.O_CREAT, 0700) # # Create a new child process. @@ -49,8 +52,8 @@ # # Construct new stdout, and stderr. # - os.dup2 (1, child_out); - os.dup2 (2, child_out); + os.dup2 (child_out, 1); + os.dup2 (child_out, 2); # # Execute the specified program. @@ -958,7 +961,7 @@ # # Create a new directory based upon the test's name. # - tmpdir = tmpdir + '/' + os.path.basename (self.srcfile) + tmpdir = tmpdir + '/tr' + os.path.basename (self.srcfile) if ((os.access(tmpdir,os.F_OK)) == 0): try: os.mkdir (tmpdir) @@ -1012,11 +1015,12 @@ # # Execute the script using TestRunner. # - command = 'cd ' + tmpdir + ';/bin/sh ' + scriptfile + ' > ' + outputfile + ' 2>&1' - - estatus=os.system (command) - if ((os.WIFEXITED(estatus)) and (os.WEXITSTATUS(estatus) != 0)): + mypath = os.getcwd () + os.chdir (tmpdir) + if (ExecProgram (('/bin/sh', scriptfile), environment, outputfile)): result.Fail('Script: ' + scriptfile + '\n Output: ' + outputfile) + + os.chdir (mypath) # # Restore the PATH environment variable From criswell at cs.uiuc.edu Tue Oct 7 15:56:06 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 15:56:06 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/llvmdb.py Message-ID: <200310072055.PAA13343@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: llvmdb.py updated: 1.5 -> 1.6 --- Log message: Added the Reoptimizer directory to the list of tests to ignore. --- Diffs of the changes: (+1 -1) Index: llvm/test/QMTest/llvmdb.py diff -u llvm/test/QMTest/llvmdb.py:1.5 llvm/test/QMTest/llvmdb.py:1.6 --- llvm/test/QMTest/llvmdb.py:1.5 Tue Oct 7 14:13:56 2003 +++ llvm/test/QMTest/llvmdb.py Tue Oct 7 15:55:37 2003 @@ -159,7 +159,7 @@ # Record names of invalid directories and files. # invalid_dirs = ['CVS', 'QMTest', 'QMTestDB', 'Scripts', 'Programs', - 'Fragments'] + 'Fragments', 'Reoptimizer'] invalid_files = ['Makefile', 'README.txt', '.cvsignore', 'opaquetypes.ll'] From criswell at cs.uiuc.edu Tue Oct 7 16:14:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 16:14:02 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200310072113.QAA28115@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.41 -> 1.42 --- Log message: Switching over to the new test database. Adding new qmt files should no longer be necessary. QMTest should know just "magically" know what sort of test each file is. --- Diffs of the changes: (+38 -32) Index: llvm/configure diff -u llvm/configure:1.41 llvm/configure:1.42 --- llvm/configure:1.41 Tue Oct 7 01:01:34 2003 +++ llvm/configure Tue Oct 7 16:13:43 2003 @@ -1692,7 +1692,10 @@ ac_config_commands="$ac_config_commands test/Makefile.tests" - ac_config_commands="$ac_config_commands test/QMTestDB/QMTest/llvm.py" + ac_config_commands="$ac_config_commands test/QMTest/llvm.py" + + + ac_config_commands="$ac_config_commands test/QMTest/llvmdb.py" ac_config_commands="$ac_config_commands test/Programs/Makefile" @@ -4420,7 +4423,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4423 "configure"' > conftest.$ac_ext + echo '#line 4426 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5261,7 +5264,7 @@ # Provide some information about the compiler. -echo "$as_me:5264:" \ +echo "$as_me:5267:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6270,11 +6273,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6273: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6276: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6277: \$? = $ac_status" >&5 + echo "$as_me:6280: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6502,11 +6505,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6505: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6508: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6509: \$? = $ac_status" >&5 + echo "$as_me:6512: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6569,11 +6572,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6572: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6575: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6576: \$? = $ac_status" >&5 + echo "$as_me:6579: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8581,7 +8584,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10821: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10822: \$? = $ac_status" >&5 + echo "$as_me:10825: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10882,11 +10885,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10885: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10888: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10889: \$? = $ac_status" >&5 + echo "$as_me:10892: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12125,7 +12128,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13051: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13052: \$? = $ac_status" >&5 + echo "$as_me:13055: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13112,11 +13115,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13115: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13118: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13119: \$? = $ac_status" >&5 + echo "$as_me:13122: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15056,11 +15059,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15059: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15062: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15063: \$? = $ac_status" >&5 + echo "$as_me:15066: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15288,11 +15291,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15291: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15294: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15295: \$? = $ac_status" >&5 + echo "$as_me:15298: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15355,11 +15358,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15358: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15361: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15362: \$? = $ac_status" >&5 + echo "$as_me:15365: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17367,7 +17370,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/autoconf: configure.ac updated: 1.34 -> 1.35 --- Log message: Switching over to the new test database. Adding new qmt files should no longer be necessary. QMTest should know just "magically" know what sort of test each file is. --- Diffs of the changes: (+2 -1) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.34 llvm/autoconf/configure.ac:1.35 --- llvm/autoconf/configure.ac:1.34 Tue Oct 7 00:03:36 2003 +++ llvm/autoconf/configure.ac Tue Oct 7 16:13:46 2003 @@ -93,7 +93,8 @@ AC_CONFIG_MAKEFILE(runtime/libtrace/Makefile) AC_CONFIG_MAKEFILE(test/Makefile) AC_CONFIG_MAKEFILE(test/Makefile.tests) -AC_CONFIG_MAKEFILE(test/QMTestDB/QMTest/llvm.py) +AC_CONFIG_MAKEFILE(test/QMTest/llvm.py) +AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py) AC_CONFIG_MAKEFILE(test/Programs/Makefile) AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs) AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile) From criswell at cs.uiuc.edu Tue Oct 7 16:14:11 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 16:14:11 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310072113.QAA28130@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.41 -> 1.42 --- Log message: Switching over to the new test database. Adding new qmt files should no longer be necessary. QMTest should know just "magically" know what sort of test each file is. --- Diffs of the changes: (+4 -4) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.41 llvm/test/Makefile:1.42 --- llvm/test/Makefile:1.41 Tue Sep 30 14:04:08 2003 +++ llvm/test/Makefile Tue Oct 7 16:13:47 2003 @@ -14,8 +14,8 @@ # # QMTest option specifying the location of the QMTest database. -QMDB= -D $(LLVM_SRC_ROOT)/test/QMTestDB -QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTestDB/QMTest +QMDB= -D $(LLVM_SRC_ROOT)/test +QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest # # This is configuration information used by the test suite. In QM Test, it's @@ -42,10 +42,10 @@ # Execute the tests # qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTestDB/expectations.qmr $(CONTEXT) + $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/expectations.qmr $(CONTEXT) %.t:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTestDB/expectations.qmr $(CONTEXT) $* + $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/expectations.qmr $(CONTEXT) $* # # Create the temporary directory used by the test suite. From criswell at cs.uiuc.edu Tue Oct 7 16:31:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 16:31:02 2003 Subject: [llvm-commits] CVS: llvm/test/QMTest/expectations.qmr Message-ID: <200310072130.QAA08850@choi.cs.uiuc.edu> Changes in directory llvm/test/QMTest: expectations.qmr added (r1.1) --- Log message: Expectations file for the LLVM tests. --- Diffs of the changes: (+6 -0) Index: llvm/test/QMTest/expectations.qmr diff -c /dev/null llvm/test/QMTest/expectations.qmr:1.1 *** /dev/null Tue Oct 7 16:30:32 2003 --- llvm/test/QMTest/expectations.qmr Tue Oct 7 16:30:22 2003 *************** *** 0 **** --- 1,15 ---- + (cqm.test.result + Result + qoq}q(U _Result__kindqUtestqU_Result__outcomeqUPASSqU_Result__annotationsq}U _Result__idq U0Regression.Assembler.2002-08-16-ConstExprInlinedq + U_Result__contextq (cqm.test.context + Context + q o}q (U_Context__propertiesq}U_Context__temporariesq}ubub.(hoq}q(hhhhh}h U%Regression.Transforms.InstCombine.addqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h U/Regression.CBackend.2002-08-19-HardConstantExprqh (h o}q(h}h}ubub.(hoq}q(hhhhh}h URegression.Jello.test-shiftqh (h o}q(h}h}ubub.(hoq}q(hhhUFAILqh}h U.Regression.Transforms.CorrelatedExprs.looptestqh (h o}q (h}h}ubub.(hoq!}q"(hhhhh}h U-Regression.Linker.2003-08-23-GlobalVarLinkingq#h (h o}q$(h}h}ubub.(hoq%}q&(hhhhh}h U?Regression.Transforms.Inline.2003-09-22-PHINodesInExceptionDestq'h (h o}q((h}h}ubub.(hoq)}q*(hhhhh}h U,Regression.CFrontend.2003-02-12-NonlocalGotoq+h (h o}q,(h}h}ubub.(hoq-}q.(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch1q/h (h o}q0(h}h}ubub.(hoq1}q2(hhhhh}h U>Regression.Transforms.LevelRaise.2002-05-02-BadCastEliminationq3h (h o}q4(h}h}ubub.(hoq5}q6(hhhhh}h U8Regression.Transforms.ADCE.2003-01-22-Pr! edecessorProblemq7h (h o}q8(h}h}ubub.(hoq9}q:(hhhhh}h U=Regression.Transforms.LevelRaise.2002-10-08-VarArgCallInfLoopq;h (h o}q<(h}h}ubub.(hoq=}q>(hhhhh}h U5Regression.CFrontend.2003-07-22-ArrayAccessTypeSafetyq?h (h o}q@(h}h}ubub.(hoqA}qB(hhhhh}h U8Regression.C++Frontend.2003-09-29-ArgumentNumberMismatchqCh (h o}qD(h}h}ubub.(hoqE}qF(hhhhh}h U+Regression.CFrontend.2002-09-19-StarInLabelqGh (h o}qH(h}h}ubub.(hoqI}qJ(hhhhh}h U.Regression.CFrontend.2003-08-23-LocalUnionTestqKh (h o}qL(h}h}ubub.(hoqM}qN(hhhhh}h U/Regression.Linker.2003-04-26-NullPtrLinkProblemqOh (h o}qP(h}h}ubub.(hoqQ}qR(hhhhh}h U)Regression.Transforms.Reassociate.subtestqSh (h o}qT(h}h}ubub.(hoqU}qV(hhhhh}h U)Regression.Linker.2002-08-20-ConstantExprqWh (h o}qX(h}h}ubub.(hoqY}qZ(hhhhh}h U=Regression.Transforms.Reassociate.2002-05-15-AgressiveSubMoveq[h (h o}q\(h}h}ubub.(hoq]}q^(hhhhh}h UARegression.Transforms.CorrelatedExprs.2002-! 10-07-DominatorProblemq_h (h o}q`(h}h}ubub.(hoqa}qb(hhhhh}h U3 Regression.Transforms.PiNodeInserter.substitutetestqch (h o}qd(h}h}ubub.(hoqe}qf(hhhhh}h U%Regression.Transforms.InstCombine.andqgh (h o}qh(h}h}ubub.(hoqi}qj(hhhhh}h U-Regression.CFrontend.2002-02-18-64bitConstantqkh (h o}ql(h}h}ubub.(hoqm}qn(hhhhh}h U1Regression.Assembler.2002-04-04-PureVirtMethCall2qoh (h o}qp(h}h}ubub.(hoqq}qr(hhhhh}h U(Regression.Reoptimizer.BinInterface.testqsh (h o}qt(h}h}ubub.(hoqu}qv(hhhhh}h URegression.Transforms.CorrelatedExprs.2002-10-08-DominatorTestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.Linker.testlink2q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.Linker.testlink1q?h (h o}q?(h}h}ubub.(ho! q?}q?(hhhhh}h U4Regression.C++Frontend.2003-09-30-NestedFunctionDeclq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U=Regression.Transforms.CorrelatedExprs.2002-09-23-PHIUpdateBugq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U7Regression.Transforms.LowerSwitch.2003-05-01-PHIProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U2Regression.Transforms.ADCE.2003-09-15-InfLoopCrashq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U4Regression.Transforms.SimplifyCFG.2002-06-24-PHINodeq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U*Regression.Transforms.DSAnalysis.recursionq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U)Regression.Jello.2003-01-15-AlignmentTestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U*Regression.CFrontend.2002-04-07-SwitchStmtq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U!Regression.Jello.2003-01-10-FUCOMq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.CFrontend.2003-08-21-StmtExprq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h URegression.LLC.badC! allArgLRLLVMq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression .Transforms.LevelRaise.2002-02-11-ArrayShapeq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U1Regression.Assembler.2003-03-03-DuplicateConstantq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U.Regression.Transforms.ModuloSched.arith-simpleq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U/Regression.CBackend.2002-09-20-VarArgPrototypesq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U)Regression.Other.2002-08-02-DomSetProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression.Assembler.2002-07-25-ParserAssertionFailureq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U6Regression.Transforms.LevelRaise.2002-03-20-BadCodegenq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U%Regression.Transforms.ADCE.basictest1q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U$Regression.Transforms.InstCombine.orq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhUPASSq?h}h U'Regression.Transforms.TailDup.basictestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U'Regression.Analysis.DSGraph.constantizeq?h (h o}q?(h}h! }ubub.(hoq?}q?(hhhhh}h U6Regression.Transforms.GlobalDCE.2002-08-17-FunctionDGEq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U:Regression.Transforms.LICM.2003-02-26-LoopExitNotDominatedq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.Linker.2003-05-15-TypeProblemq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U#Regression.Transforms.SCCP.sccptestq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U2Regression.Transforms.FunctionResolve.retmismatch3q?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U=Regression.Transforms.CorrelatedExprs.2002-10-03-PHIPropogateq?h (h o}q?(h}h}ubub.(hoq?}q?(hhhhh}h U(Regression.Transforms.PruneEH.simpletestr+ + + + + + + + + \ No newline at end of file From criswell at cs.uiuc.edu Tue Oct 7 16:31:07 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 16:31:07 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200310072130.QAA08945@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.42 -> 1.43 --- Log message: Fixed the location of the expectations file. Added the registration of the LLVM Database class. --- Diffs of the changes: (+3 -2) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.42 llvm/test/Makefile:1.43 --- llvm/test/Makefile:1.42 Tue Oct 7 16:13:47 2003 +++ llvm/test/Makefile Tue Oct 7 16:30:07 2003 @@ -42,10 +42,10 @@ # Execute the tests # qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/expectations.qmr $(CONTEXT) + $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) %.t:: $(LLVM_OBJ_ROOT)/test/tmp register - $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/expectations.qmr $(CONTEXT) $* + $(QMTEST) run -O $(LLVM_SRC_ROOT)/test/QMTest/expectations.qmr $(CONTEXT) $* # # Create the temporary directory used by the test suite. @@ -74,6 +74,7 @@ $(QMTEST) register test llvm.AnalyzeTest $(QMTEST) register test llvm.CTest $(QMTEST) register test llvm.CXXTest + $(QMTEST) register database llvmdb.llvmdb $(QMTEST) register resource llvm.BytecodeResource # From gaeke at cs.uiuc.edu Tue Oct 7 16:34:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 16:34:00 2003 Subject: [llvm-commits] CVS: llvm/autoconf/aclocal.m4 Message-ID: <200310072133.QAA31528@psmith.cs.uiuc.edu> Changes in directory llvm/autoconf: aclocal.m4 updated: 1.4 -> 1.5 --- Log message: Fix bugs in mmap()-of-files test program on Mac OS X: 1) MAP_FAILED is declared to be a pointer 2) can't include sys/mman.h before sys/types.h without getting an error :-( --- Diffs of the changes: (+5 -5) Index: llvm/autoconf/aclocal.m4 diff -u llvm/autoconf/aclocal.m4:1.4 llvm/autoconf/aclocal.m4:1.5 --- llvm/autoconf/aclocal.m4:1.4 Sat Sep 6 09:46:19 2003 +++ llvm/autoconf/aclocal.m4 Tue Oct 7 16:33:27 2003 @@ -6111,21 +6111,21 @@ [AC_LANG_SAVE AC_LANG_C AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif + #ifdef HAVE_FCNTL_H #include #endif int fd; int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], + fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != (int) MAP_FAILED);}], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) AC_LANG_RESTORE ]) From lattner at cs.uiuc.edu Tue Oct 7 16:39:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 16:39:01 2003 Subject: [llvm-commits] CVS: llvm/www/releases/1.0/ReleaseNotes.html Message-ID: <200310072138.QAA21968@tank.cs.uiuc.edu> Changes in directory llvm/www/releases/1.0: ReleaseNotes.html updated: 1.5 -> 1.6 --- Log message: Cleanups, include a list of passes --- Diffs of the changes: (+53 -8) Index: llvm/www/releases/1.0/ReleaseNotes.html diff -u llvm/www/releases/1.0/ReleaseNotes.html:1.5 llvm/www/releases/1.0/ReleaseNotes.html:1.6 --- llvm/www/releases/1.0/ReleaseNotes.html:1.5 Sun Oct 5 14:17:10 2003 +++ llvm/www/releases/1.0/ReleaseNotes.html Tue Oct 7 16:38:31 2003 @@ -36,12 +36,17 @@ This document contains the release notes for the LLVM compiler infrastructure, -release 1.0. The most up-to-date version of this document can be found on the -LLVM web -site. If you are not reading this on the LLVM web pages, you should -probably go there, because this document may be updated after the release.

            - -FIXME: What is this document? Where do I find other documents?

            +release 1.0. Here we describe how to install LLVM, as well as any known +problems. The most up-to-date version of this document can be found on the LLVM 1.0 web site. If you are +not reading this on the LLVM web pages, you should probably go there, because +this document may be updated after the release.

            + +For more information about LLVM, including information about potentially more +current releases, please check out the main +web site. If you have questions or comments, the LLVM developer's mailing +list is a good place to send them.

            @@ -56,6 +61,46 @@ compiler, a C back-end, stable X86 and Sparc V9 static and JIT code generators, as well as a large suite of scalar and interprocedural optimizations.

            +The default optimizer sequence used by the C/C++ front-ends is:

            + +

              +
            1. Interprocedural dead code elimination (-globaldce) +
            2. Exception handling pruning (-prune-eh) +
            3. Function inlining (-inline) +
            4. Instruction combining (-instcombine) +
            5. Cast elimination (-raise) +
            6. Tail duplication (-tailduplicate) +
            7. CFG simplification (-simplifycfg) +
            8. Scalar replacement of aggregates (-scalarrepl) +
            9. Tail call elimination (-tailcallelim) +
            10. Instruction combining (-instcombine) +
            11. Reassociation (-reassociate) +
            12. Instruction combining (-instcombine) +
            13. CFG simplification (-simplifycfg) +
            14. Loop canonnicalization (-preheaders) +
            15. Loop invariant code motion, with scalar promotion (-licm) +
            16. Global common subexpression elimination, with load elimination (-gcse) +
            17. Sparse conditional constant propagation (-sccp) +
            18. Instruction combining (-instcombine) +
            19. Induction variable canonicalization (-indvars) +
            20. Aggressive dead code elimination (-adce) +
            21. CFG simplication (-simplifycfg) +
            22. Dead type elimination (-deadtypeelim) +
            23. Global constant merging (-constmerge) +

            + +At link-time, the following optimizations are run:

            + +

              +
            1. Global constant merging (-constmerge) +
            2. [optional] Internalization [which marks most functions and global variables static] (-internalize) +
            3. Interprocedural dead argument elimination (-deadargelim) +
            4. Instruction combining (-instcombine) +
            5. CFG simplification (-simplifycfg) +
            6. Interprocedural dead code elimination (-globaldce) +

            + + TODO: Works on: SPEC CPU 2000

            TODO: Works on: Olden/Ptrdist benchmarks

            @@ -342,9 +387,9 @@


            -
            By: Chris Lattner
            +Maintained By: The LLVM Team
            -Last modified: Sun Oct 5 14:01:10 CDT 2003 +Last modified: Tue Oct 7 16:32:37 CDT 2003 From criswell at cs.uiuc.edu Tue Oct 7 16:58:09 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue Oct 7 16:58:09 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200310072157.QAA16907@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.42 -> 1.43 --- Log message: Renamed -use-spec to -use-spec2000. The pathname to SPEC2000 is now given with the -use-spec2000 option. On our machines, SPEC2000 will be enabled by default. --- Diffs of the changes: (+52 -47) Index: llvm/configure diff -u llvm/configure:1.42 llvm/configure:1.43 --- llvm/configure:1.42 Tue Oct 7 16:13:43 2003 +++ llvm/configure Tue Oct 7 16:57:37 2003 @@ -466,7 +466,7 @@ #endif" ac_unique_file=""Makefile.config.in"" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT YACC EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RPWD SED RM MKDIR DATE MV DOT ETAGS PYTHON QMTEST ALLOCA LIBOBJS MMAP_FILE ENABLE_PURIFY ENABLE_OPTIMIZED USE_SPEC UPB DISABLE_LLC_DIFFS JIT SPEC_ROOT BCR PAPIDIR PURIFY LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OS LLVMGCCDIR ARCH CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP ifGNUmake LEX LEXLIB LEX_OUTPUT_ROOT YACC EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RPWD SED RM MKDIR DATE MV DOT ETAGS PYTHON QMTEST ALLOCA LIBOBJS MMAP_FILE ENABLE_PURIFY ENABLE_OPTIMIZED SPEC_ROOT USE_SPEC UPB DISABLE_LLC_DIFFS JIT BCR PAPIDIR PURIFY LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1033,7 +1033,7 @@ --disable-libtool-lock avoid locking (might break parallel builds) --enable-purify Compile with purify (default is NO) --enable-optimized Compile with optimizations enabled (default is NO) - --enable-spec Compile SPEC benchmarks (default is NO) + --enable-spec Compile SPEC 2000 benchmarks (default is NO) --enable-precompiled_bytecode Use pre-compiled bytecode (default is NO) --enable-llc_diffs Enable LLC Diffs when testing (default is YES) @@ -1047,7 +1047,6 @@ both] --with-tags[=TAGS] include additional configurations [automatic] - --with-spec Location of SPEC benchmarks --with-llvmgccdir Location of LLVM GCC front-end --with-bcrepos Location of Bytecode Repository --with-papi Location of PAPI @@ -4423,7 +4422,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4426 "configure"' > conftest.$ac_ext + echo '#line 4425 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5264,7 +5263,7 @@ # Provide some information about the compiler. -echo "$as_me:5267:" \ +echo "$as_me:5266:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6273,11 +6272,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6276: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6275: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6280: \$? = $ac_status" >&5 + echo "$as_me:6279: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6505,11 +6504,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6508: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6507: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6512: \$? = $ac_status" >&5 + echo "$as_me:6511: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6572,11 +6571,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6575: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6574: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6579: \$? = $ac_status" >&5 + echo "$as_me:6578: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8584,7 +8583,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10820: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10825: \$? = $ac_status" >&5 + echo "$as_me:10824: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10885,11 +10884,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10888: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10887: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10892: \$? = $ac_status" >&5 + echo "$as_me:10891: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12128,7 +12127,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13050: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13055: \$? = $ac_status" >&5 + echo "$as_me:13054: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13115,11 +13114,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13118: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13117: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13122: \$? = $ac_status" >&5 + echo "$as_me:13121: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15059,11 +15058,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15062: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15061: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15066: \$? = $ac_status" >&5 + echo "$as_me:15065: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15291,11 +15290,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15294: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15293: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15298: \$? = $ac_status" >&5 + echo "$as_me:15297: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15358,11 +15357,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15361: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15360: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15365: \$? = $ac_status" >&5 + echo "$as_me:15364: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17370,7 +17369,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/autoconf: configure.ac updated: 1.35 -> 1.36 --- Log message: Renamed -use-spec to -use-spec2000. The pathname to SPEC2000 is now given with the -use-spec2000 option. On our machines, SPEC2000 will be enabled by default. --- Diffs of the changes: (+15 -5) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.35 llvm/autoconf/configure.ac:1.36 --- llvm/autoconf/configure.ac:1.35 Tue Oct 7 16:13:46 2003 +++ llvm/autoconf/configure.ac Tue Oct 7 16:57:39 2003 @@ -521,11 +521,24 @@ fi dnl Spec Benchmarks -AC_ARG_ENABLE(spec,AC_HELP_STRING([--enable-spec],[Compile SPEC benchmarks (default is NO)]),,enableval=no) +AC_ARG_ENABLE(spec2000,AC_HELP_STRING([--enable-spec],[Compile SPEC 2000 benchmarks (default is NO)]),,enableval=no) if test ${enableval} = "no" then - AC_SUBST(USE_SPEC,[[]]) + if test -d /home/vadve/shared/benchmarks/speccpu2000/benchspec + then + AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) + AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) + else + AC_SUBST(USE_SPEC,[[]]) + AC_SUBST(SPEC_ROOT,[]) + fi else + if test ${enableval} = "" + then + AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) + else + AC_SUBST(SPEC_ROOT,[${enableval}]) + fi AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) fi @@ -571,9 +584,6 @@ dnl ************************************************************************** dnl * Set the location of various third-party software packages dnl ************************************************************************** - -dnl Location of SPEC benchmarks -AC_ARG_WITH(spec,AC_HELP_STRING([--with-spec],[Location of SPEC benchmarks]),AC_SUBST(SPEC_ROOT,[$withval]),AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec])) dnl Location of the LLVM C front end AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval])) From lattner at cs.uiuc.edu Tue Oct 7 17:15:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:15:01 2003 Subject: [llvm-commits] CVS: llvm/www/releases/1.0/ReleaseNotes.html Message-ID: <200310072214.RAA22144@tank.cs.uiuc.edu> Changes in directory llvm/www/releases/1.0: ReleaseNotes.html updated: 1.6 -> 1.7 --- Log message: Add links to bugzilla --- Diffs of the changes: (+22 -11) Index: llvm/www/releases/1.0/ReleaseNotes.html diff -u llvm/www/releases/1.0/ReleaseNotes.html:1.6 llvm/www/releases/1.0/ReleaseNotes.html:1.7 --- llvm/www/releases/1.0/ReleaseNotes.html:1.6 Tue Oct 7 16:38:31 2003 +++ llvm/www/releases/1.0/ReleaseNotes.html Tue Oct 7 17:14:37 2003 @@ -190,6 +190,11 @@ - These functions have not been tested.

            +

          • Bugs:
            + Oversized integer bitfields cause crash.
            + LLVM needs explicit support for weak variables.
            +

            +

          • Although many GCC extensions are supported, some are not. In particular, the following extensions are known to not be supported:
              @@ -324,24 +329,30 @@ different from the model used in the Itanium ABI, so exceptions will not interact correctly . +
            1. Code for executing +destructors when unwinding is not shared. + +


              Known problems with the X86 back-end


              Known problems with the Sparc back-end

                -
              • The Sparc code generator does not currently support the unwind -instruction, so code that throws a C++ exception or calls the C longjmp -function will abort.

                +

              • The Sparc code generator does not currently +support the unwind instruction, so code that throws a C++ exception +or calls the C longjmp function will abort.

                @@ -390,6 +401,6 @@ Maintained By: The LLVM Team
                -Last modified: Tue Oct 7 16:32:37 CDT 2003 +Last modified: Tue Oct 7 17:10:14 CDT 2003 From lattner at cs.uiuc.edu Tue Oct 7 17:20:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:20:00 2003 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200310072219.RAA11211@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.56 -> 1.57 --- Log message: Add a sanity check for constant expression casts --- Diffs of the changes: (+2 -0) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.56 llvm/lib/VMCore/Constants.cpp:1.57 --- llvm/lib/VMCore/Constants.cpp:1.56 Sat Oct 4 19:17:43 2003 +++ llvm/lib/VMCore/Constants.cpp Tue Oct 7 17:19:19 2003 @@ -897,6 +897,8 @@ static ValueMap ExprConstants; Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) { + assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!"); + if (Constant *FC = ConstantFoldCastInstruction(C, Ty)) return FC; // Fold a few common cases... From lattner at cs.uiuc.edu Tue Oct 7 17:33:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:33:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200310072232.RAA17457@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.126 -> 1.127 --- Log message: Refactor code a bit --- Diffs of the changes: (+12 -4) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.126 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.127 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.126 Tue Oct 7 10:17:02 2003 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 7 17:32:43 2003 @@ -99,6 +99,7 @@ Instruction *visitInstruction(Instruction &I) { return 0; } private: + Instruction *visitCallSite(CallSite CS); bool transformConstExprCastCall(CallSite CS); // InsertNewInstBefore - insert an instruction New before instruction Old @@ -1581,15 +1582,13 @@ // CallInst simplification // Instruction *InstCombiner::visitCallInst(CallInst &CI) { - if (transformConstExprCastCall(&CI)) return 0; - return 0; + return visitCallSite(&CI); } // InvokeInst simplification // Instruction *InstCombiner::visitInvokeInst(InvokeInst &II) { - if (transformConstExprCastCall(&II)) return 0; - return 0; + return visitCallSite(&II); } // getPromotedType - Return the specified type promoted as it would be to pass @@ -1603,6 +1602,15 @@ case Type::FloatTyID: return Type::DoubleTy; default: return Ty; } +} + +// visitCallSite - Improvements for call and invoke instructions. +// +Instruction *InstCombiner::visitCallSite(CallSite CS) { + if (transformConstExprCastCall(CS)) return 0; + + + return 0; } // transformConstExprCastCall - If the callee is a constexpr cast of a function, From lattner at cs.uiuc.edu Tue Oct 7 17:54:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:54:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/cast.ll Message-ID: <200310072253.RAA17992@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: cast.ll updated: 1.14 -> 1.15 --- Log message: new testcase --- Diffs of the changes: (+7 -0) Index: llvm/test/Regression/Transforms/InstCombine/cast.ll diff -u llvm/test/Regression/Transforms/InstCombine/cast.ll:1.14 llvm/test/Regression/Transforms/InstCombine/cast.ll:1.15 --- llvm/test/Regression/Transforms/InstCombine/cast.ll:1.14 Tue Sep 16 10:29:34 2003 +++ llvm/test/Regression/Transforms/InstCombine/cast.ll Tue Oct 7 17:53:46 2003 @@ -66,3 +66,10 @@ ret short %c2 } +declare void %varargs(int, ...) + +void %test11(int* %P) { + %c = cast int* %P to short* + call void(int, ...)* %varargs(int 5, short* %c) + ret void +} From lattner at cs.uiuc.edu Tue Oct 7 17:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:55:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200310072254.RAA18001@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.127 -> 1.128 --- Log message: Fix bug: InstCombine/cast.ll:test11 / PR#7 --- Diffs of the changes: (+23 -1) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.127 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.128 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.127 Tue Oct 7 17:32:43 2003 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 7 17:54:13 2003 @@ -1607,10 +1607,32 @@ // visitCallSite - Improvements for call and invoke instructions. // Instruction *InstCombiner::visitCallSite(CallSite CS) { + bool Changed = false; + + // If the callee is a constexpr cast of a function, attempt to move the cast + // to the arguments of the call/invoke. if (transformConstExprCastCall(CS)) return 0; + Value *Callee = CS.getCalledValue(); + const PointerType *PTy = cast(Callee->getType()); + const FunctionType *FTy = cast(PTy->getElementType()); + if (FTy->isVarArg()) { + // See if we can optimize any arguments passed through the varargs area of + // the call. + for (CallSite::arg_iterator I = CS.arg_begin()+FTy->getNumParams(), + E = CS.arg_end(); I != E; ++I) + if (CastInst *CI = dyn_cast(*I)) { + // If this cast does not effect the value passed through the varargs + // area, we can eliminate the use of the cast. + Value *Op = CI->getOperand(0); + if (CI->getType()->isLosslesslyConvertibleTo(Op->getType())) { + *I = Op; + Changed = true; + } + } + } - return 0; + return Changed ? CS.getInstruction() : 0; } // transformConstExprCastCall - If the callee is a constexpr cast of a function, From lattner at cs.uiuc.edu Tue Oct 7 17:59:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 7 17:59:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200310072258.RAA18349@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.128 -> 1.129 --- Log message: whoops, don't accidentally lose variable names --- Diffs of the changes: (+1 -1) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.128 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.129 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.128 Tue Oct 7 17:54:13 2003 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 7 17:58:41 2003 @@ -2005,7 +2005,7 @@ // Move the name to the new instruction first... std::string OldName = I->getName(); I->setName(""); - Result->setName(I->getName()); + Result->setName(OldName); // Insert the new instruction into the basic block... BasicBlock *InstParent = I->getParent(); From gaeke at cs.uiuc.edu Tue Oct 7 18:41:00 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 18:41:00 2003 Subject: [llvm-commits] CVS: llvm/include/Config/config.h.in Message-ID: <200310072340.SAA31823@psmith.cs.uiuc.edu> Changes in directory llvm/include/Config: config.h.in updated: 1.3 -> 1.4 --- Log message: Regenerated with (at top-level llvm directory): % autoheader -I autoconf autoconf/configure.ac --- Diffs of the changes: (+82 -66) Index: llvm/include/Config/config.h.in diff -u llvm/include/Config/config.h.in:1.3 llvm/include/Config/config.h.in:1.4 --- llvm/include/Config/config.h.in:1.3 Tue Jul 29 14:11:54 2003 +++ llvm/include/Config/config.h.in Tue Oct 7 18:39:51 2003 @@ -1,4 +1,4 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ +/* include/Config/config.h.in. Generated from autoconf/configure.ac by autoheader. */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. @@ -8,6 +8,12 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define if the machine is Big-Endian */ +#undef ENDIAN_BIG + +/* Define if the machine is Little-Endian */ +#undef ENDIAN_LITTLE + /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA @@ -15,12 +21,30 @@ */ #undef HAVE_ALLOCA_H -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* define if the compiler has bidirectional iterator */ +#undef HAVE_BI_ITERATOR + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if dlopen() is available on this platform. */ +#undef HAVE_DLOPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* define if the compiler has ext/slist */ +#undef HAVE_EXT_SLIST /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* define if the compiler has STL iterators */ +#undef HAVE_FWD_ITERATOR + /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD @@ -30,39 +54,70 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* define if the compiler has ext/hash_map */ +#undef HAVE_GNU_EXT_HASH_MAP + +/* define if the compiler has ext/hash_set in __gnu_cc */ +#undef HAVE_GNU_EXT_HASH_SET + +/* Define to 1 if the system has the type `int64_t'. */ +#undef HAVE_INT64_T + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - /* Define to 1 if you have the `elf' library (-lelf). */ #undef HAVE_LIBELF -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `papi' library (-lpapi). */ -#undef HAVE_LIBPAPI - /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINK_H + +/* Define if mallinfo() is available on this platform. */ +#undef HAVE_MALLINFO + /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP +/* Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if + it uses MAP_ANON */ +#undef HAVE_MMAP_ANONYMOUS + +/* Define if mmap() can map files into memory */ +#undef HAVE_MMAP_FILE + +/* define if the compiler implements namespaces */ +#undef HAVE_NAMESPACES + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H +/* define if the compiler has ext/hash_map */ +#undef HAVE_STD_EXT_HASH_MAP + +/* define if the compiler has ext/hash_set in std */ +#undef HAVE_STD_EXT_HASH_SET + +/* define if the compiler has STL iterators */ +#undef HAVE_STD_ITERATOR + /* Define to 1 if you have the `strcspn' function. */ #undef HAVE_STRCSPN @@ -90,6 +145,18 @@ /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if you have the `strtoq' function. */ +#undef HAVE_STRTOQ + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -102,12 +169,12 @@ /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H +/* Define to 1 if the system has the type `uint64_t'. */ +#undef HAVE_UINT64_T + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -126,11 +193,6 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE -/* Define to 1 if the `setvbuf' function takes the buffering type as its - second argument and the buffer pointer as the third, as on System V before - release 3. */ -#undef SETVBUF_REVERSED - /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -164,49 +226,3 @@ /* Define to `unsigned' if does not define. */ #undef size_t - -/* Define to mark the machine as having little endian */ -#ifndef ENDIAN_LITTLE -#undef ENDIAN_LITTLE -#endif - -/* Define to mark the machine as having big endian */ -#ifndef ENDIAN_BIG -#undef ENDIAN_BIG -#endif - -/* Define to indicate how to include hash_map */ -#undef HAVE_STD_EXT_HASH_MAP -#undef HAVE_GNU_EXT_HASH_MAP - -/* Define to incdicate how to include has_set */ -#undef HAVE_STD_EXT_HASH_SET -#undef HAVE_GNU_EXT_HASH_SET - -/* Indicates whether we have STL iterators */ -#undef HAVE_STD_ITERATOR -#undef HAVE_BI_ITERATOR -#undef HAVE_FWD_ITERATOR - -/* Indicates which slist we should use */ -#undef HAVE_EXT_SLIST - -/* Indicates whether we have the MALLINFO functionality */ -#undef HAVE_MALLINFO - -/* Indicates if we have MAP_ANONYMOUS */ -#undef HAVE_MMAP_ANONYMOUS - -/* Indicates whether we have MMAP header file */ -#undef HAVE_SYS_MMAN_H - -/* Indicates that we have assert.h */ -#undef HAVE_ASSERT_H - -/* Macros for various header files */ -#undef HAVE_SIGNAL_H -#undef HAVE_ERRNO_H -#undef HAVE_SYS_RESOURCE_H -#undef HAVE_MATH_H -#undef HAVE_DLFCN_H -#undef HAVE_LINK_H From gaeke at cs.uiuc.edu Tue Oct 7 18:45:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Tue Oct 7 18:45:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200310072344.SAA31892@psmith.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.9 -> 1.10 --- Log message: Add rule for regenerating config.h.in using autoheader. --- Diffs of the changes: (+5 -1) Index: llvm/Makefile diff -u llvm/Makefile:1.9 llvm/Makefile:1.10 --- llvm/Makefile:1.9 Tue Oct 7 12:12:11 2003 +++ llvm/Makefile Tue Oct 7 18:44:10 2003 @@ -15,7 +15,11 @@ $(LEVEL)/TAGS AUTOCONF = autoconf +AUTOHEADER = autoheader -configure: autoconf/configure.ac +configure: autoconf/configure.ac autoconf/aclocal.m4 cd autoconf && $(AUTOCONF) -o ../configure configure.ac + +include/Config/config.h.in: autoconf/configure.ac autoconf/aclocal.m4 + autoheader -I autoconf autoconf/configure.ac From alkis at cs.uiuc.edu Tue Oct 7 23:46:01 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue Oct 7 23:46:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200310080445.XAA10460@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFrameInfo.h updated: 1.6 -> 1.7 --- Log message: Forward declare class Type since it is used in this class and Type.h is not included --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/CodeGen/MachineFrameInfo.h diff -u llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.6 llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.7 --- llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.6 Mon Jun 30 16:58:30 2003 +++ llvm/include/llvm/CodeGen/MachineFrameInfo.h Tue Oct 7 23:45:45 2003 @@ -33,6 +33,7 @@ class TargetData; class TargetRegisterClass; +class Type; class MachineFunction; #include From alkis at cs.uiuc.edu Wed Oct 8 00:11:02 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed Oct 8 00:11:02 2003 Subject: [llvm-commits] CVS: llvm/utils/NightlyTestTemplate.html Message-ID: <200310080510.AAA10571@morpheus.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTestTemplate.html updated: 1.20 -> 1.21 --- Log message: Properly close anchor tags in column descriptions --- Diffs of the changes: (+4 -4) Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.20 llvm/utils/NightlyTestTemplate.html:1.21 --- llvm/utils/NightlyTestTemplate.html:1.20 Mon Oct 6 10:30:00 2003 +++ llvm/utils/NightlyTestTemplate.html Wed Oct 8 00:09:52 2003 @@ -153,10 +153,10 @@

              • JIT - The amount of time spent running the program with the JIT; this includes the code generation phase (listed above) and actually running the program.
              • -
              • GCC/LLC - The speed-up of the LLC output vs the native - GCC output: greater than 1 is a speedup, less than 1 is a slowdown. -
              • GCC/CBE - The speed-up of the CBE output vs the native - GCC output: greater than 1 is a speedup, less than 1 is a slowdown. +
              • GCC/LLC - The speed-up of the LLC output vs the native + GCC output: greater than 1 is a speedup, less than 1 is a slowdown.
              • +
              • GCC/CBE - The speed-up of the CBE output vs the native + GCC output: greater than 1 is a speedup, less than 1 is a slowdown.

            A complete log of testing From alkis at cs.uiuc.edu Wed Oct 8 00:21:02 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed Oct 8 00:21:02 2003 Subject: [llvm-commits] CVS: llvm/utils/TableGen/RegisterInfoEmitter.cpp InstrInfoEmitter.cpp Message-ID: <200310080520.AAA10616@morpheus.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: RegisterInfoEmitter.cpp updated: 1.12 -> 1.13 InstrInfoEmitter.cpp updated: 1.4 -> 1.5 --- Log message: Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs and TargetInstrDescriptor::ImplicitUses to always point to a null terminated array and never be null. So there is no need to check for pointer validity when iterating over those sets. Code that looked like: if (const unsigned* AS = TID.ImplicitDefs) { for (int i = 0; AS[i]; ++i) { // use AS[i] } } was changed to: for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) { // use *AS } --- Diffs of the changes: (+10 -4) Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.12 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.13 --- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.12 Thu Aug 14 23:36:19 2003 +++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Wed Oct 8 00:20:08 2003 @@ -138,7 +138,7 @@ std::vector RegisterAliasesRecs = Records.getAllDerivedDefinitions("RegisterAliases"); std::map > RegisterAliases; - + for (unsigned i = 0, e = RegisterAliasesRecs.size(); i != e; ++i) { Record *AS = RegisterAliasesRecs[i]; Record *R = AS->getValueAsDef("Reg"); @@ -166,6 +166,8 @@ if (!RegisterAliases.empty()) OS << "\n\n // Register Alias Sets...\n"; + // Emit the empty alias list + OS << " const unsigned Empty_AliasSet[] = { 0 };\n"; // Loop over all of the registers which have aliases, emitting the alias list // to memory. for (std::map >::iterator @@ -192,7 +194,7 @@ if (RegisterAliases.count(Reg)) OS << Reg->getName() << "_AliasSet,\t"; else - OS << "0,\t\t"; + OS << "Empty_AliasSet,\t"; OS << "0, 0 },\n"; } OS << " };\n"; // End of register descriptors... Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.4 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.5 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.4 Thu Aug 7 00:39:09 2003 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Wed Oct 8 00:20:08 2003 @@ -65,6 +65,10 @@ std::vector Instructions = Records.getAllDerivedDefinitions("Instruction"); + // Emit empty implicit uses and defs lists + OS << "static const unsigned EmptyImpUses[] = { 0 };\n" + << "static const unsigned EmptyImpDefs[] = { 0 };\n"; + // Emit all of the instruction's implicit uses and defs... for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { Record *Inst = Instructions[i]; @@ -113,13 +117,13 @@ // Emit the implicit uses and defs lists... LI = R->getValueAsListInit("Uses"); if (!LI->getSize()) - OS << "0, "; + OS << "EmptyImpUses, "; else OS << R->getName() << "ImpUses, "; LI = R->getValueAsListInit("Defs"); if (!LI->getSize()) - OS << "0 "; + OS << "EmptyImpDefs "; else OS << R->getName() << "ImpDefs "; From alkis at cs.uiuc.edu Wed Oct 8 00:21:16 2003 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed Oct 8 00:21:16 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocSimple.cpp RegAllocLocal.cpp PrologEpilogInserter.cpp LiveVariables.cpp Message-ID: <200310080520.AAA10631@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocSimple.cpp updated: 1.43 -> 1.44 RegAllocLocal.cpp updated: 1.27 -> 1.28 PrologEpilogInserter.cpp updated: 1.12 -> 1.13 LiveVariables.cpp updated: 1.8 -> 1.9 --- Log message: Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs and TargetInstrDescriptor::ImplicitUses to always point to a null terminated array and never be null. So there is no need to check for pointer validity when iterating over those sets. Code that looked like: if (const unsigned* AS = TID.ImplicitDefs) { for (int i = 0; AS[i]; ++i) { // use AS[i] } } was changed to: for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) { // use *AS } --- Diffs of the changes: (+54 -44) Index: llvm/lib/CodeGen/RegAllocSimple.cpp diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.43 llvm/lib/CodeGen/RegAllocSimple.cpp:1.44 --- llvm/lib/CodeGen/RegAllocSimple.cpp:1.43 Mon Aug 18 09:31:23 2003 +++ llvm/lib/CodeGen/RegAllocSimple.cpp Wed Oct 8 00:20:08 2003 @@ -153,13 +153,13 @@ // are used by the instruction (including implicit uses) unsigned Opcode = MI->getOpcode(); const TargetInstrDescriptor &Desc = TM->getInstrInfo().get(Opcode); - if (const unsigned *Regs = Desc.ImplicitUses) - while (*Regs) - RegsUsed[*Regs++] = true; + const unsigned *Regs = Desc.ImplicitUses; + while (*Regs) + RegsUsed[*Regs++] = true; - if (const unsigned *Regs = Desc.ImplicitDefs) - while (*Regs) - RegsUsed[*Regs++] = true; + Regs = Desc.ImplicitDefs; + while (*Regs) + RegsUsed[*Regs++] = true; // Loop over uses, move from memory into registers for (int i = MI->getNumOperands() - 1; i >= 0; --i) { Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.27 llvm/lib/CodeGen/RegAllocLocal.cpp:1.28 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.27 Sat Aug 23 18:49:42 2003 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Wed Oct 8 00:20:08 2003 @@ -120,9 +120,10 @@ /// bool areRegsEqual(unsigned R1, unsigned R2) const { if (R1 == R2) return true; - if (const unsigned *AliasSet = RegInfo->getAliasSet(R2)) - for (unsigned i = 0; AliasSet[i]; ++i) - if (AliasSet[i] == R1) return true; + for (const unsigned *AliasSet = RegInfo->getAliasSet(R2); + *AliasSet; ++AliasSet) { + if (*AliasSet == R1) return true; + } return false; } @@ -271,14 +272,15 @@ if (PI != PhysRegsUsed.end()) { // Only spill it if it's used! if (PI->second || !OnlyVirtRegs) spillVirtReg(MBB, I, PI->second, PhysReg); - } else if (const unsigned *AliasSet = RegInfo->getAliasSet(PhysReg)) { + } else { // If the selected register aliases any other registers, we must make // sure that one of the aliases isn't alive... - for (unsigned i = 0; AliasSet[i]; ++i) { - PI = PhysRegsUsed.find(AliasSet[i]); + for (const unsigned *AliasSet = RegInfo->getAliasSet(PhysReg); + *AliasSet; ++AliasSet) { + PI = PhysRegsUsed.find(*AliasSet); if (PI != PhysRegsUsed.end()) // Spill aliased register... if (PI->second || !OnlyVirtRegs) - spillVirtReg(MBB, I, PI->second, AliasSet[i]); + spillVirtReg(MBB, I, PI->second, *AliasSet); } } } @@ -308,10 +310,10 @@ // If the selected register aliases any other allocated registers, it is // not free! - if (const unsigned *AliasSet = RegInfo->getAliasSet(PhysReg)) - for (unsigned i = 0; AliasSet[i]; ++i) - if (PhysRegsUsed.count(AliasSet[i])) // Aliased register in use? - return false; // Can't use this reg then. + for (const unsigned *AliasSet = RegInfo->getAliasSet(PhysReg); + *AliasSet; ++AliasSet) + if (PhysRegsUsed.count(*AliasSet)) // Aliased register in use? + return false; // Can't use this reg then. return true; } @@ -414,12 +416,13 @@ } else { // If one of the registers aliased to the current register is // compatible, use it. - if (const unsigned *AliasSet = RegInfo->getAliasSet(R)) - for (unsigned a = 0; AliasSet[a]; ++a) - if (RegInfo->getRegClass(AliasSet[a]) == RC) { - PhysReg = AliasSet[a]; // Take an aliased register - break; - } + for (const unsigned *AliasSet = RegInfo->getAliasSet(R); + *AliasSet; ++AliasSet) { + if (RegInfo->getRegClass(*AliasSet) == RC) { + PhysReg = *AliasSet; // Take an aliased register + break; + } + } } } } @@ -485,9 +488,9 @@ // Loop over the implicit uses, making sure that they are at the head of the // use order list, so they don't get reallocated. - if (const unsigned *ImplicitUses = TID.ImplicitUses) - for (unsigned i = 0; ImplicitUses[i]; ++i) - MarkPhysRegRecentlyUsed(ImplicitUses[i]); + for (const unsigned *ImplicitUses = TID.ImplicitUses; + *ImplicitUses; ++ImplicitUses) + MarkPhysRegRecentlyUsed(*ImplicitUses); // Get the used operands into registers. This has the potential to spill // incoming values if we are out of registers. Note that we completely Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.12 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.13 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.12 Wed Aug 13 13:18:12 2003 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Wed Oct 8 00:20:08 2003 @@ -127,12 +127,15 @@ unsigned Reg = CSRegs[i]; if (ModifiedRegs[Reg]) { RegsToSave.push_back(Reg); // If modified register... - } else if (const unsigned *AliasSet = RegInfo->getAliasSet(Reg)) - for (unsigned j = 0; AliasSet[j]; ++j) // Check alias registers too... - if (ModifiedRegs[AliasSet[j]]) { + } else { + for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); + *AliasSet; ++AliasSet) { // Check alias registers too... + if (ModifiedRegs[*AliasSet]) { RegsToSave.push_back(Reg); break; } + } + } } if (RegsToSave.empty()) Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.8 llvm/lib/CodeGen/LiveVariables.cpp:1.9 --- llvm/lib/CodeGen/LiveVariables.cpp:1.8 Mon May 26 19:05:17 2003 +++ llvm/lib/CodeGen/LiveVariables.cpp Wed Oct 8 00:20:08 2003 @@ -108,12 +108,14 @@ if (PhysRegInfo[Reg]) { PhysRegInfo[Reg] = MI; PhysRegUsed[Reg] = true; - } else if (const unsigned *AliasSet = RegInfo->getAliasSet(Reg)) { - for (; unsigned NReg = AliasSet[0]; ++AliasSet) - if (MachineInstr *LastUse = PhysRegInfo[NReg]) { - PhysRegInfo[NReg] = MI; - PhysRegUsed[NReg] = true; + } else { + for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); + *AliasSet; ++AliasSet) { + if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) { + PhysRegInfo[*AliasSet] = MI; + PhysRegUsed[*AliasSet] = true; } + } } } @@ -124,15 +126,17 @@ RegistersKilled.insert(std::make_pair(LastUse, Reg)); else RegistersDead.insert(std::make_pair(LastUse, Reg)); - } else if (const unsigned *AliasSet = RegInfo->getAliasSet(Reg)) { - for (; unsigned NReg = AliasSet[0]; ++AliasSet) - if (MachineInstr *LastUse = PhysRegInfo[NReg]) { - if (PhysRegUsed[NReg]) - RegistersKilled.insert(std::make_pair(LastUse, NReg)); + } else { + for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); + *AliasSet; ++AliasSet) { + if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) { + if (PhysRegUsed[*AliasSet]) + RegistersKilled.insert(std::make_pair(LastUse, *AliasSet)); else - RegistersDead.insert(std::make_pair(LastUse, NReg)); - PhysRegInfo[NReg] = 0; // Kill the aliased register + RegistersDead.insert(std::make_pair(LastUse, *AliasSet)); + PhysRegInfo[*AliasSet] = 0; // Kill the aliased register } + } } PhysRegInfo[Reg] = MI; PhysRegUsed[Reg] = false; @@ -206,9 +210,9 @@ NumOperandsToProcess = 1; // Loop over implicit uses, using them. - if (const unsigned *ImplicitUses = MID.ImplicitUses) - for (unsigned i = 0; ImplicitUses[i]; ++i) - HandlePhysRegUse(ImplicitUses[i], MI); + for (const unsigned *ImplicitUses = MID.ImplicitUses; + *ImplicitUses; ++ImplicitUses) + HandlePhysRegUse(*ImplicitUses, MI); // Process all explicit uses... for (unsigned i = 0; i != NumOperandsToProcess; ++i) { From lattner at cs.uiuc.edu Wed Oct 8 00:45:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 00:45:03 2003 Subject: [llvm-commits] CVS: llvm/www/www-index.html Message-ID: <200310080544.AAA23738@tank.cs.uiuc.edu> Changes in directory llvm/www: www-index.html updated: 1.58 -> 1.59 --- Log message: Add new status update --- Diffs of the changes: (+1 -0) Index: llvm/www/www-index.html diff -u llvm/www/www-index.html:1.58 llvm/www/www-index.html:1.59 --- llvm/www/www-index.html:1.58 Tue Oct 7 14:37:07 2003 +++ llvm/www/www-index.html Wed Oct 8 00:44:16 2003 @@ -209,6 +209,7 @@

          • Status Updates:


            Known problems with the X86 back-end


            Known problems with the Sparc back-end

            • The Sparc code generator does not currently +href="http://llvm.cs.uiuc.edu/PR15">does not currently support the unwind instruction, so code that throws a C++ exception or calls the C longjmp function will abort.

              From lattner at cs.uiuc.edu Wed Oct 8 10:48:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 10:48:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200310081547.KAA23432@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.74 -> 1.75 --- Log message: Avoid building data structures we don't really need. This improves the runtime of a test that Bill Wendling sent me from 228.5s to 105s. Obviously there is more improvement to be had, but this is a nice speedup which should be "felt" by many programs. --- Diffs of the changes: (+39 -10) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.74 llvm/lib/Transforms/Scalar/SCCP.cpp:1.75 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.74 Mon Sep 8 13:54:55 2003 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Wed Oct 8 10:47:41 2003 @@ -381,17 +381,46 @@ if (!BBExecutable.count(From)) return false; // Check to make sure this edge itself is actually feasible now... - TerminatorInst *FT = From->getTerminator(); - std::vector SuccFeasible; - getFeasibleSuccessors(*FT, SuccFeasible); - - // Check all edges from From to To. If any are feasible, return true. - for (unsigned i = 0, e = SuccFeasible.size(); i != e; ++i) - if (FT->getSuccessor(i) == To && SuccFeasible[i]) + TerminatorInst *TI = From->getTerminator(); + if (BranchInst *BI = dyn_cast(TI)) { + if (BI->isUnconditional()) + return true; + else { + InstVal &BCValue = getValueState(BI->getCondition()); + if (BCValue.isOverdefined()) { + // Overdefined condition variables mean the branch could go either way. + return true; + } else if (BCValue.isConstant()) { + // Constant condition variables mean the branch can only go a single way + return BI->getSuccessor(BCValue.getConstant() == + ConstantBool::False) == To; + } + return false; + } + } else if (InvokeInst *II = dyn_cast(TI)) { + // Invoke instructions successors are always executable. + return true; + } else if (SwitchInst *SI = dyn_cast(TI)) { + InstVal &SCValue = getValueState(SI->getCondition()); + if (SCValue.isOverdefined()) { // Overdefined condition? + // All destinations are executable! return true; - - // Otherwise, none of the edges are actually feasible at this time... - return false; + } else if (SCValue.isConstant()) { + Constant *CPV = SCValue.getConstant(); + // Make sure to skip the "default value" which isn't a value + for (unsigned i = 1, E = SI->getNumSuccessors(); i != E; ++i) + if (SI->getSuccessorValue(i) == CPV) // Found the taken branch... + return SI->getSuccessor(i) == To; + + // Constant value not equal to any of the branches... must execute + // default branch then... + return SI->getDefaultDest() == To; + } + return false; + } else { + std::cerr << "Unknown terminator instruction: " << *TI; + abort(); + } } // visit Implementations - Something changed in this instruction... Either an From lattner at cs.uiuc.edu Wed Oct 8 11:22:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 11:22:04 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200310081621.LAA25106@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.75 -> 1.76 --- Log message: Minor fixes here and there --- Diffs of the changes: (+21 -22) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.75 llvm/lib/Transforms/Scalar/SCCP.cpp:1.76 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.75 Wed Oct 8 10:47:41 2003 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Wed Oct 8 11:21:03 2003 @@ -107,28 +107,28 @@ // is not already a constant, add it to the instruction work list so that // the users of the instruction are updated later. // - inline bool markConstant(Instruction *I, Constant *V) { - if (ValueState[I].markConstant(V)) { - DEBUG(std::cerr << "markConstant: " << V << " = " << I); + inline void markConstant(InstVal &IV, Instruction *I, Constant *C) { + if (IV.markConstant(C)) { + DEBUG(std::cerr << "markConstant: " << *C << ": " << *I); InstWorkList.push_back(I); - return true; } - return false; + } + inline void markConstant(Instruction *I, Constant *C) { + markConstant(ValueState[I], I, C); } // markValueOverdefined - Make a value be marked as "overdefined". If the // value is not already overdefined, add it to the instruction work list so // that the users of the instruction are updated later. // - inline bool markOverdefined(Value *V) { - if (ValueState[V].markOverdefined()) { - if (Instruction *I = dyn_cast(V)) { - DEBUG(std::cerr << "markOverdefined: " << V); - InstWorkList.push_back(I); // Only instructions go on the work list - } - return true; + inline void markOverdefined(InstVal &IV, Instruction *I) { + if (IV.markOverdefined()) { + DEBUG(std::cerr << "markOverdefined: " << *I); + InstWorkList.push_back(I); // Only instructions go on the work list } - return false; + } + inline void markOverdefined(Instruction *I) { + markOverdefined(ValueState[I], I); } // getValueState - Return the InstVal object that corresponds to the value. @@ -193,7 +193,7 @@ void visitGetElementPtrInst(GetElementPtrInst &I); void visitCallInst (Instruction &I) { markOverdefined(&I); } void visitInvokeInst (TerminatorInst &I) { - markOverdefined(&I); + if (I.getType() != Type::VoidTy) markOverdefined(&I); visitTerminatorInst(I); } void visitUnwindInst (TerminatorInst &I) { /*returns void*/ } @@ -442,7 +442,8 @@ // successors executable. // void SCCP::visitPHINode(PHINode &PN) { - if (getValueState(&PN).isOverdefined()) return; // Quick exit + InstVal &PNIV = getValueState(&PN); + if (PNIV.isOverdefined()) return; // Quick exit // Look at all of the executable operands of the PHI node. If any of them // are overdefined, the PHI becomes overdefined as well. If they are all @@ -457,7 +458,7 @@ if (isEdgeFeasible(PN.getIncomingBlock(i), PN.getParent())) { if (IV.isOverdefined()) { // PHI node becomes overdefined! - markOverdefined(&PN); + markOverdefined(PNIV, &PN); return; } @@ -473,7 +474,7 @@ // Yes there is. This means the PHI node is not constant. // You must be overdefined poor PHI. // - markOverdefined(&PN); // The PHI node now becomes overdefined + markOverdefined(PNIV, &PN); // The PHI node now becomes overdefined return; // I'm done analyzing you } } @@ -486,7 +487,7 @@ // this is the case, the PHI remains undefined. // if (OperandVal) - markConstant(&PN, OperandVal); // Aquire operand value + markConstant(PNIV, &PN, OperandVal); // Aquire operand value } void SCCP::visitTerminatorInst(TerminatorInst &TI) { @@ -510,12 +511,10 @@ Constant *Result = ConstantFoldCastInstruction(VState.getConstant(), I.getType()); - if (Result) { - // This instruction constant folds! + if (Result) // If this instruction constant folds! markConstant(&I, Result); - } else { + else markOverdefined(&I); // Don't know how to fold this instruction. :( - } } } From lattner at cs.uiuc.edu Wed Oct 8 11:56:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 11:56:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200310081655.LAA27353@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.76 -> 1.77 --- Log message: Use a set to keep track of which edges have been noticed as executable already to avoid reprocessing PHI nodes needlessly. This speeds up the big bad PHI testcase 43%: from 104.9826 to 73.5157s --- Diffs of the changes: (+27 -15) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.76 llvm/lib/Transforms/Scalar/SCCP.cpp:1.77 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.76 Wed Oct 8 11:21:03 2003 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Wed Oct 8 11:55:34 2003 @@ -85,6 +85,11 @@ std::vector InstWorkList;// The instruction work list std::vector BBWorkList; // The BasicBlock work list + + /// KnownFeasibleEdges - Entries in this set are edges which have already had + /// PHI nodes retriggered. + typedef std::pair Edge; + std::set KnownFeasibleEdges; public: // runOnFunction - Run the Sparse Conditional Constant Propagation algorithm, @@ -153,22 +158,28 @@ return ValueState[V]; } - // markExecutable - Mark a basic block as executable, adding it to the BB + // markEdgeExecutable - Mark a basic block as executable, adding it to the BB // work list if it is not already executable... // - void markExecutable(BasicBlock *BB) { - if (BBExecutable.count(BB)) { - // BB is already executable, but we may have just made an edge feasible - // that wasn't before. Add the PHI nodes to the work list so that they - // can be rechecked. - for (BasicBlock::iterator I = BB->begin(); + void markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest) { + if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second) + return; // This edge is already known to be executable! + + if (BBExecutable.count(Dest)) { + DEBUG(std::cerr << "Marking Edge Executable: " << Source->getName() + << " -> " << Dest->getName() << "\n"); + + // The destination is already executable, but we just made an edge + // feasible that wasn't before. Add the PHI nodes to the work list so + // that they can be rechecked. + for (BasicBlock::iterator I = Dest->begin(); PHINode *PN = dyn_cast(I); ++I) visitPHINode(*PN); } else { - DEBUG(std::cerr << "Marking BB Executable: " << *BB); - BBExecutable.insert(BB); // Basic block is executable! - BBWorkList.push_back(BB); // Add the block to the work list! + DEBUG(std::cerr << "Marking Block Executable: " << Dest->getName()<<"\n"); + BBExecutable.insert(Dest); // Basic block is executable! + BBWorkList.push_back(Dest); // Add the block to the work list! } } @@ -249,7 +260,8 @@ // bool SCCP::runOnFunction(Function &F) { // Mark the first block of the function as being executable... - markExecutable(&F.front()); + BBExecutable.insert(F.begin()); // Basic block is executable! + BBWorkList.push_back(F.begin()); // Add the block to the work list! // Process the work lists until their are empty! while (!BBWorkList.empty() || !InstWorkList.empty()) { @@ -494,12 +506,12 @@ std::vector SuccFeasible; getFeasibleSuccessors(TI, SuccFeasible); + BasicBlock *BB = TI.getParent(); + // Mark all feasible successors executable... for (unsigned i = 0, e = SuccFeasible.size(); i != e; ++i) - if (SuccFeasible[i]) { - BasicBlock *Succ = TI.getSuccessor(i); - markExecutable(Succ); - } + if (SuccFeasible[i]) + markEdgeExecutable(BB, TI.getSuccessor(i)); } void SCCP::visitCastInst(CastInst &I) { From lattner at cs.uiuc.edu Wed Oct 8 11:57:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 11:57:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200310081656.LAA27388@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.77 -> 1.78 --- Log message: Update comment --- Diffs of the changes: (+2 -2) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.77 llvm/lib/Transforms/Scalar/SCCP.cpp:1.78 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.77 Wed Oct 8 11:55:34 2003 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Wed Oct 8 11:56:11 2003 @@ -170,8 +170,8 @@ << " -> " << Dest->getName() << "\n"); // The destination is already executable, but we just made an edge - // feasible that wasn't before. Add the PHI nodes to the work list so - // that they can be rechecked. + // feasible that wasn't before. Revisit the PHI nodes in the block + // because they have potentially new operands. for (BasicBlock::iterator I = Dest->begin(); PHINode *PN = dyn_cast(I); ++I) visitPHINode(*PN); From lattner at cs.uiuc.edu Wed Oct 8 13:27:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:27:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll Message-ID: <200310081826.NAA27762@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/Inline: 2003-09-22-PHINodeInlineFail.ll added (r1.1) --- Log message: Checkin an old bug, which appears to be fixed --- Diffs of the changes: (+17 -0) Index: llvm/test/Regression/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll diff -c /dev/null llvm/test/Regression/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll:1.1 *** /dev/null Wed Oct 8 13:26:20 2003 --- llvm/test/Regression/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll Wed Oct 8 13:26:10 2003 *************** *** 0 **** --- 1,17 ---- + ; RUN: llvm-as < %s | opt -inline -disable-output + implementation + + int %main() { + entry: + invoke void %__main( ) + to label %LongJmpBlkPre except label %LongJmpBlkPre + + LongJmpBlkPre: + %i.3 = phi uint [ 0, %entry ], [ 0, %entry] + ret int 0 + } + + void %__main() { + ret void + } + From lattner at cs.uiuc.edu Wed Oct 8 13:29:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:29:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll Message-ID: <200310081828.NAA27808@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/FunctionResolve: 2003-06-18-TypePromotion.ll added (r1.1) --- Log message: old testcase --- Diffs of the changes: (+12 -0) Index: llvm/test/Regression/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll diff -c /dev/null llvm/test/Regression/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll:1.1 *** /dev/null Wed Oct 8 13:28:20 2003 --- llvm/test/Regression/Transforms/FunctionResolve/2003-06-18-TypePromotion.ll Wed Oct 8 13:28:10 2003 *************** *** 0 **** --- 1,12 ---- + ; RUN: llvm-as < %s | opt -funcresolve | dis | not grep declare + + declare void %test(int) + + int %callee(int %X) { + call void %test(int %X) + ret int 2 + } + + internal void %test(sbyte) { + ret void + } From brukman at cs.uiuc.edu Wed Oct 8 13:30:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 8 13:30:01 2003 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200310081829.NAA02753@zion.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.33 -> 1.34 --- Log message: Stop updating from llvm/www because it's going away. --- Diffs of the changes: (+1 -1) Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.33 CVSROOT/loginfo:1.34 --- CVSROOT/loginfo:1.33 Thu Aug 21 15:47:53 2003 +++ CVSROOT/loginfo Wed Oct 8 13:29:44 2003 @@ -27,7 +27,7 @@ #^CVSROOT mailx -s 'CVSROOT commit %s' llvm-commits at cs.uiuc.edu #^llvm mailx -s 'LLVM CVS: %s' llvm-commits at cs.uiuc.edu -^llvm/www ( /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/update-www.sh &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu +#^llvm/www ( /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/update-www.sh &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^poolalloc /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu ^reopt /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Wed Oct 8 13:36:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:02 2003 Subject: [llvm-commits] CVS: llvm/www/oldnews.html www-index.html Message-ID: <200310081835.NAA27917@apoc.cs.uiuc.edu> Changes in directory llvm/www: oldnews.html (r1.1) removed www-index.html (r1.59) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:36:07 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:07 2003 Subject: [llvm-commits] CVS: llvm/www/docs/AliasAnalysis.html ChrisNotes.txt CodingStandards.html CommandLine.html DSGraphStatus.html Debugging.gif GettingStarted.html HowToSubmitABug.html LangRef.html Makefile OpenProjects.html ProgrammersManual.html Projects.html RegisterAllocatorInfo.txt ReleaseTasks.html WritingAnLLVMPass.html doxygen.cfg Message-ID: <200310081835.NAA27924@apoc.cs.uiuc.edu> Changes in directory llvm/www/docs: AliasAnalysis.html (r1.3) removed ChrisNotes.txt (r1.29) removed CodingStandards.html (r1.11) removed CommandLine.html (r1.15) removed DSGraphStatus.html (r1.15) removed Debugging.gif (r1.1) removed GettingStarted.html (r1.34) removed HowToSubmitABug.html (r1.5) removed LangRef.html (r1.31) removed Makefile (r1.3) removed OpenProjects.html (r1.11) removed ProgrammersManual.html (r1.47) removed Projects.html (r1.1) removed RegisterAllocatorInfo.txt (r1.4) removed ReleaseTasks.html (r1.11) removed WritingAnLLVMPass.html (r1.19) removed doxygen.cfg (r1.5) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:36:13 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:13 2003 Subject: [llvm-commits] CVS: llvm/www/pubs/2002-06-AutomaticPoolAllocation.html 2002-08-08-CASES02-ControlC.html 2002-08-09-LLVMCompilationStrategy.html 2002-12-LattnerMSThesis.html 2003-04-29-DataStructureAnalysisTR.html 2003-05-01-GCCSummit2003.html 2003-05-05-LCTES03-CodeSafety.html 2003-09-30-LifelongOptimizationTR.html 2003-10-01-LLVA.html Message-ID: <200310081835.NAA27932@apoc.cs.uiuc.edu> Changes in directory llvm/www/pubs: 2002-06-AutomaticPoolAllocation.html (r1.3) removed 2002-08-08-CASES02-ControlC.html (r1.5) removed 2002-08-09-LLVMCompilationStrategy.html (r1.4) removed 2002-12-LattnerMSThesis.html (r1.2) removed 2003-04-29-DataStructureAnalysisTR.html (r1.2) removed 2003-05-01-GCCSummit2003.html (r1.6) removed 2003-05-05-LCTES03-CodeSafety.html (r1.3) removed 2003-09-30-LifelongOptimizationTR.html (r1.1) removed 2003-10-01-LLVA.html (r1.2) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:36:18 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:18 2003 Subject: [llvm-commits] CVS: llvm/www/releases/index.html Message-ID: <200310081835.NAA27933@apoc.cs.uiuc.edu> Changes in directory llvm/www/releases: index.html (r1.1) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:36:23 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:23 2003 Subject: [llvm-commits] CVS: llvm/www/releases/1.0/ReleaseNotes.html index.html Message-ID: <200310081835.NAA27942@apoc.cs.uiuc.edu> Changes in directory llvm/www/releases/1.0: ReleaseNotes.html (r1.8) removed index.html (r1.1) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:36:29 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:36:29 2003 Subject: [llvm-commits] CVS: llvm/www/testresults/index.html Message-ID: <200310081835.NAA27943@apoc.cs.uiuc.edu> Changes in directory llvm/www/testresults: index.html (r1.3) removed --- Log message: All the web pages are moving to the www-root repo --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:37:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:37:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/CommandGuide/analyze.html bugpoint.html extract.html gccas.html gccld.html index.html llc.html lli.html llvm-as.html llvm-dis.html llvm-link.html llvmgcc.html llvmgxx.html opt.html Message-ID: <200310081836.NAA27985@apoc.cs.uiuc.edu> Changes in directory llvm/www/docs/CommandGuide: analyze.html (r1.8) removed bugpoint.html (r1.2) removed extract.html (r1.5) removed gccas.html (r1.5) removed gccld.html (r1.7) removed index.html (r1.7) removed llc.html (r1.6) removed lli.html (r1.6) removed llvm-as.html (r1.6) removed llvm-dis.html (r1.6) removed llvm-link.html (r1.5) removed llvmgcc.html (r1.3) removed llvmgxx.html (r1.3) removed opt.html (r1.7) removed --- Log message: Remove web pages, which now belong in llvm-www --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:38:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:38:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeas.txt 2000-11-18-EarlyDesignIdeasResp.txt 2000-12-06-EncodingIdea.txt 2000-12-06-MeetingSummary.txt 2001-01-31-UniversalIRIdea.txt 2001-02-06-TypeNotationDebate.txt 2001-02-06-TypeNotationDebateResp1.txt 2001-02-06-TypeNotationDebateResp2.txt 2001-02-06-TypeNotationDebateResp4.txt 2001-02-09-AdveComments.txt 2001-02-09-AdveCommentsResponse.txt 2001-02-13-Reference-Memory.txt 2001-02-13-Reference-MemoryResponse.txt 2001-04-16-DynamicCompilation.txt 2001-05-18-ExceptionHandling.txt 2001-05-19-ExceptionResponse.txt 2001-06-01-GCCOptimizations.txt 2001-06-01-GCCOptimizations2.txt 2001-06-20-.NET-Differences.txt 2001-07-06-LoweringIRForCodeGen.txt 2001-07-08-InstructionSelection.txt 2001-07-08-InstructionSelection2.txt 2001-09-18-OptimizeExceptions.txt 2002-05-12-InstListChange.txt 2002-06-25-MegaPatchInfo.txt 2003-01-23-CygwinNotes.txt 2003-06-25-Reoptimizer1.txt 2003-06-26-Reoptimizer2.txt Message-ID: <200310081837.NAA27991@apoc.cs.uiuc.edu> Changes in directory llvm/www/docs/HistoricalNotes: 2000-11-18-EarlyDesignIdeas.txt (r1.1.1.1) removed 2000-11-18-EarlyDesignIdeasResp.txt (r1.1.1.1) removed 2000-12-06-EncodingIdea.txt (r1.1.1.1) removed 2000-12-06-MeetingSummary.txt (r1.1.1.1) removed 2001-01-31-UniversalIRIdea.txt (r1.1.1.1) removed 2001-02-06-TypeNotationDebate.txt (r1.1.1.1) removed 2001-02-06-TypeNotationDebateResp1.txt (r1.1.1.1) removed 2001-02-06-TypeNotationDebateResp2.txt (r1.1.1.1) removed 2001-02-06-TypeNotationDebateResp4.txt (r1.1.1.1) removed 2001-02-09-AdveComments.txt (r1.1.1.1) removed 2001-02-09-AdveCommentsResponse.txt (r1.2) removed 2001-02-13-Reference-Memory.txt (r1.1.1.1) removed 2001-02-13-Reference-MemoryResponse.txt (r1.1.1.1) removed 2001-04-16-DynamicCompilation.txt (r1.1.1.1) removed 2001-05-18-ExceptionHandling.txt (r1.2) removed 2001-05-19-ExceptionResponse.txt (r1.1.1.1) removed 2001-06-01-GCCOptimizations.txt (r1.2) removed 2001-06-01-GCCOptimizations2.txt (r1.1.1.1) removed 2001-06-20-.NET-Differences.txt (r1.1) removed 2001-07-06-LoweringIRForCodeGen.txt (r1.1) removed 2001-07-08-InstructionSelection.txt (r1.1) removed 2001-07-08-InstructionSelection2.txt (r1.1) removed 2001-09-18-OptimizeExceptions.txt (r1.1) removed 2002-05-12-InstListChange.txt (r1.1) removed 2002-06-25-MegaPatchInfo.txt (r1.2) removed 2003-01-23-CygwinNotes.txt (r1.1) removed 2003-06-25-Reoptimizer1.txt (r1.1) removed 2003-06-26-Reoptimizer2.txt (r1.1) removed --- Log message: Remove web pages, which now belong in llvm-www --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 13:38:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 13:38:08 2003 Subject: [llvm-commits] CVS: llvm/www/safecode/impl.jpg index.html Message-ID: <200310081837.NAA27997@apoc.cs.uiuc.edu> Changes in directory llvm/www/safecode: impl.jpg (r1.1) removed index.html (r1.7) removed --- Log message: Remove web pages, which now belong in llvm-www --- Diffs of the changes: (+0 -0) From brukman at cs.uiuc.edu Wed Oct 8 13:58:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 8 13:58:02 2003 Subject: [llvm-commits] CVS: CVSROOT/update-www.sh Message-ID: <200310081857.NAA03330@zion.cs.uiuc.edu> Changes in directory CVSROOT: update-www.sh updated: 1.2 -> 1.3 --- Log message: Fix grammar. --- Diffs of the changes: (+1 -1) Index: CVSROOT/update-www.sh diff -u CVSROOT/update-www.sh:1.2 CVSROOT/update-www.sh:1.3 --- CVSROOT/update-www.sh:1.2 Tue May 20 16:05:24 2003 +++ CVSROOT/update-www.sh Wed Oct 8 13:57:02 2003 @@ -1,6 +1,6 @@ #!/bin/sh -# Let the CVS commit process unlock it's lock +# Let the CVS commit process unlock its lock sleep 2 # Go into the web directory From gaeke at cs.uiuc.edu Wed Oct 8 14:10:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 8 14:10:01 2003 Subject: [llvm-commits] CVS: llvm/tools/gccld/Linker.cpp Message-ID: <200310081909.OAA03206@gally.cs.uiuc.edu> Changes in directory llvm/tools/gccld: Linker.cpp updated: 1.7 -> 1.8 --- Log message: Make more error messages have gccld's name in them. Add a newline after "Cannot find ". --- Diffs of the changes: (+6 -4) Index: llvm/tools/gccld/Linker.cpp diff -u llvm/tools/gccld/Linker.cpp:1.7 llvm/tools/gccld/Linker.cpp:1.8 --- llvm/tools/gccld/Linker.cpp:1.7 Tue Sep 30 13:09:32 2003 +++ llvm/tools/gccld/Linker.cpp Wed Oct 8 14:09:30 2003 @@ -354,13 +354,15 @@ Pathname = Files[i]; } else { if (SearchPath == NULL) { - std::cerr << "Cannot find linker input file '" << Files[i] << "'"; + std::cerr << progname << ": Cannot find linker input file '" + << Files[i] << "'\n"; return true; } Pathname = std::string(SearchPath)+"/"+Files[i]; if (!FileExists(Pathname)) { - std::cerr << "Cannot find linker input file '" << Files[i] << "'"; + std::cerr << progname << ": Cannot find linker input file '" + << Files[i] << "'\n"; return true; } } @@ -382,7 +384,7 @@ if (LinkInFile(HeadModule, Pathname, ErrorMessage, Verbose)) { PrintAndReturn(progname, ErrorMessage, - ": error linking in '" + Files[i] + "'"); + ": Error linking in '" + Files[i] + "'"); return true; } } @@ -427,7 +429,7 @@ // we're doing a native link and give an error if we're doing a bytecode // link. if (!Native) { - PrintAndReturn(progname, "Cannot find " + Libraries[i]); + PrintAndReturn(progname, "Cannot find " + Libraries[i] + "\n"); return true; } } From brukman at cs.uiuc.edu Wed Oct 8 14:38:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 8 14:38:01 2003 Subject: [llvm-commits] CVS: CVSROOT/checkoutlist Message-ID: <200310081937.OAA04580@zion.cs.uiuc.edu> Changes in directory CVSROOT: checkoutlist updated: 1.1 -> 1.2 --- Log message: Check out update-www.sh script, we use it! --- Diffs of the changes: (+2 -0) Index: CVSROOT/checkoutlist diff -u CVSROOT/checkoutlist:1.1 CVSROOT/checkoutlist:1.2 --- CVSROOT/checkoutlist:1.1 Mon Oct 6 15:25:57 2003 +++ CVSROOT/checkoutlist Wed Oct 8 14:37:24 2003 @@ -11,3 +11,5 @@ # [] # # comment lines begin with '#' + +update-www.sh From brukman at cs.uiuc.edu Wed Oct 8 14:56:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed Oct 8 14:56:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Message-ID: <200310081955.OAA16776@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ReaderWrappers.cpp updated: 1.12 -> 1.13 --- Log message: Destroy allocated resources on exception. --- Diffs of the changes: (+13 -3) Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.12 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.13 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.12 Sun Oct 5 22:30:28 2003 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Wed Oct 8 14:55:47 2003 @@ -59,8 +59,13 @@ if (Buffer == (unsigned char*)MAP_FAILED) throw std::string("Error mmapping file!"); - // Parse the bytecode we mmapped in - ParseBytecode(Buffer, Length, Filename); + try { + // Parse the bytecode we mmapped in + ParseBytecode(Buffer, Length, Filename); + } catch (...) { + munmap((char*)Buffer, Length); + throw; + } } BytecodeFileReader::~BytecodeFileReader() { @@ -106,7 +111,12 @@ ParseBegin = Buffer = Buf; MustDelete = false; } - ParseBytecode(ParseBegin, Length, ModuleID); + try { + ParseBytecode(ParseBegin, Length, ModuleID); + } catch (...) { + if (MustDelete) delete [] Buffer; + throw; + } } BytecodeBufferReader::~BytecodeBufferReader() { From criswell at cs.uiuc.edu Wed Oct 8 15:00:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:00:01 2003 Subject: [llvm-commits] CVS: llvm/test/Fragments/NullStone/AliasOptimizationBA.c AliasOptimizationBT.c AliasOptimizationCQ.c BitfieldOptimization.c BlockMerging.c ConstantFolding.c DeadCodeElimination.c ExpressionSimplification.c ForwardStore.c FunctionInlining.c Hoisting.c IfOptimization1.c IfOptimization2.c InductionVariableElimination.c InstructionCombining.c IntegerDivideOptimization.c IntegerModOptimization.c IntegerMultiplyOptimization.c LoopCollapsing.c LoopFusion.c LoopUnrolling.c Makefile Narrowing.c PrintfOptimization.c README.txt StaticOptimization.c TailRecursion.c Unswitching.c ValueRangeOptimization.c Message-ID: <200310081959.OAA19796@choi.cs.uiuc.edu> Changes in directory llvm/test/Fragments/NullStone: AliasOptimizationBA.c (r1.2) removed AliasOptimizationBT.c (r1.1) removed AliasOptimizationCQ.c (r1.1) removed BitfieldOptimization.c (r1.1) removed BlockMerging.c (r1.1) removed ConstantFolding.c (r1.1) removed DeadCodeElimination.c (r1.1) removed ExpressionSimplification.c (r1.1) removed ForwardStore.c (r1.2) removed FunctionInlining.c (r1.1) removed Hoisting.c (r1.1) removed IfOptimization1.c (r1.1) removed IfOptimization2.c (r1.1) removed InductionVariableElimination.c (r1.1) removed InstructionCombining.c (r1.1) removed IntegerDivideOptimization.c (r1.1) removed IntegerModOptimization.c (r1.1) removed IntegerMultiplyOptimization.c (r1.1) removed LoopCollapsing.c (r1.1) removed LoopFusion.c (r1.2) removed LoopUnrolling.c (r1.1) removed Makefile (r1.1) removed Narrowing.c (r1.1) removed PrintfOptimization.c (r1.1) removed README.txt (r1.1) removed StaticOptimization.c (r1.1) removed TailRecursion.c (r1.1) removed Unswitching.c (r1.1) removed ValueRangeOptimization.c (r1.1) removed --- Log message: Removing Nullstone; we no longer use it. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:04 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:04 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/Flex/Makefile Message-ID: <200310082009.PAA19871@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource/Flex: Makefile (r1.2) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:12 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:12 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/Larn/Makefile Message-ID: <200310082009.PAA19876@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource/Larn: Makefile (r1.1) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:19 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:19 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/Moria-5.5.2/Makefile Message-ID: <200310082009.PAA19882@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource/Moria-5.5.2: Makefile (r1.2) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:25 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:25 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/Makefile Makefile.nosource Message-ID: <200310082009.PAA19865@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource: Makefile (r1.3) removed Makefile.nosource (r1.2) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:32 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:32 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/Povray31/Makefile Message-ID: <200310082009.PAA19887@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource/Povray31: Makefile (r1.2) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From criswell at cs.uiuc.edu Wed Oct 8 15:10:38 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Oct 8 15:10:38 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/NoSource/m4/Makefile Message-ID: <200310082009.PAA19893@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/NoSource/m4: Makefile (r1.1) removed --- Log message: Removing these files. We no longer use them. If we want to benchmark these guys in the future, we can get their source and recompile with the newest version of the LLVM tools. --- Diffs of the changes: (+0 -0) From lattner at cs.uiuc.edu Wed Oct 8 16:20:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 16:20:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200310082119.QAA24148@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.52 -> 1.53 Reader.cpp updated: 1.66 -> 1.67 ReaderInternals.h updated: 1.47 -> 1.48 --- Log message: Various cleanups and simplifications. This speeds up reading a bytecode file Bill gave me from 8.69s to 6.90s. --- Diffs of the changes: (+58 -62) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.52 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.53 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.52 Tue Sep 23 11:17:50 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Wed Oct 8 16:18:57 2003 @@ -161,12 +161,12 @@ delete PN; return true; case 2: PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTy, + cast(getValue(Type::LabelTyID, Raw->Arg2))); break; default: PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTy, Raw->Arg2))); + cast(getValue(Type::LabelTyID, Raw->Arg2))); if (Raw->VarArgs->size() & 1) { std::cerr << "PHI Node with ODD number of arguments!\n"; delete PN; @@ -175,7 +175,7 @@ std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i+=2) PN->addIncoming(getValue(Raw->Ty, args[i]), - cast(getValue(Type::LabelTy, args[i+1]))); + cast(getValue(Type::LabelTyID, args[i+1]))); } delete Raw->VarArgs; break; @@ -188,7 +188,7 @@ case Instruction::Shr: Res = new ShiftInst((Instruction::OtherOps)Raw->Opcode, getValue(Raw->Ty, Raw->Arg1), - getValue(Type::UByteTy, Raw->Arg2)); + getValue(Type::UByteTyID, Raw->Arg2)); return false; case Instruction::Ret: if (Raw->NumOperands == 0) { @@ -200,12 +200,12 @@ case Instruction::Br: if (Raw->NumOperands == 1) { - Res = new BranchInst(cast(getValue(Type::LabelTy,Raw->Arg1))); + Res = new BranchInst(cast(getValue(Type::LabelTyID,Raw->Arg1))); return false; } else if (Raw->NumOperands == 3) { - Res = new BranchInst(cast(getValue(Type::LabelTy, Raw->Arg1)), - cast(getValue(Type::LabelTy, Raw->Arg2)), - getValue(Type::BoolTy , Raw->Arg3)); + Res = new BranchInst(cast(getValue(Type::LabelTyID, Raw->Arg1)), + cast(getValue(Type::LabelTyID, Raw->Arg2)), + getValue(Type::BoolTyID , Raw->Arg3)); return false; } break; @@ -213,7 +213,7 @@ case Instruction::Switch: { SwitchInst *I = new SwitchInst(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTy, Raw->Arg2))); + cast(getValue(Type::LabelTyID, Raw->Arg2))); Res = I; if (Raw->NumOperands < 3) return false; // No destinations? Weird. @@ -226,7 +226,7 @@ std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i += 2) I->addCase(cast(getValue(Raw->Ty, args[i])), - cast(getValue(Type::LabelTy, args[i+1]))); + cast(getValue(Type::LabelTyID, args[i+1]))); delete Raw->VarArgs; return false; @@ -311,11 +311,11 @@ if (!FTy->isVarArg()) { if (Raw->NumOperands < 3) return true; - Normal = cast(getValue(Type::LabelTy, Raw->Arg2)); + Normal = cast(getValue(Type::LabelTyID, Raw->Arg2)); if (Raw->NumOperands == 3) - Except = cast(getValue(Type::LabelTy, Raw->Arg3)); + Except = cast(getValue(Type::LabelTyID, Raw->Arg3)); else { - Except = cast(getValue(Type::LabelTy, args[0])); + Except = cast(getValue(Type::LabelTyID, args[0])); FunctionType::ParamTypes::const_iterator It = PL.begin(); for (unsigned i = 1; i < args.size(); i++) { @@ -329,13 +329,13 @@ if (args.size() < 4) return true; if (getType(args[0]) != Type::LabelTy || getType(args[2]) != Type::LabelTy) return true; - Normal = cast(getValue(Type::LabelTy, args[1])); - Except = cast(getValue(Type::LabelTy, args[3])); + Normal = cast(getValue(Type::LabelTyID, args[1])); + Except = cast(getValue(Type::LabelTyID, args[3])); if ((args.size() & 1) != 0) return true; // Must be pairs of type/value for (unsigned i = 4; i < args.size(); i+=2) { - Params.push_back(getValue(getType(args[i]), args[i+1])); + Params.push_back(getValue(args[i], args[i+1])); if (Params.back() == 0) return true; } } @@ -347,7 +347,7 @@ } case Instruction::Malloc: if (Raw->NumOperands > 2) return true; - V = Raw->NumOperands ? getValue(Type::UIntTy, Raw->Arg1) : 0; + V = Raw->NumOperands ? getValue(Type::UIntTyID, Raw->Arg1) : 0; if (const PointerType *PTy = dyn_cast(Raw->Ty)) Res = new MallocInst(PTy->getElementType(), V); else @@ -356,7 +356,7 @@ case Instruction::Alloca: if (Raw->NumOperands > 2) return true; - V = Raw->NumOperands ? getValue(Type::UIntTy, Raw->Arg1) : 0; + V = Raw->NumOperands ? getValue(Type::UIntTyID, Raw->Arg1) : 0; if (const PointerType *PTy = dyn_cast(Raw->Ty)) Res = new AllocaInst(PTy->getElementType(), V); else Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.66 llvm/lib/Bytecode/Reader/Reader.cpp:1.67 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.66 Sat Oct 4 15:00:03 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Oct 8 16:18:57 2003 @@ -55,8 +55,25 @@ } //cerr << "Looking up Type ID: " << ID << "\n"; - const Value *V = getValue(Type::TypeTy, ID, false); - return cast_or_null(V); + + if (ID < Type::NumPrimitiveIDs) { + const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); + if (T) return T; // Asked for a primitive type... + } + + // Otherwise, derived types need offset... + ID -= FirstDerivedTyID; + + // Is it a module-level type? + if (ID < ModuleTypeValues.size()) + return ModuleTypeValues[ID].get(); + + // Nope, is it a function-level type? + ID -= ModuleTypeValues.size(); + if (ID < FunctionTypeValues.size()) + return FunctionTypeValues[ID].get(); + + return 0; } int BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) { @@ -95,35 +112,18 @@ ValueTab[type]->setOperand(Slot-HasImplicitZeroInitializer, Val); } -Value *BytecodeParser::getValue(const Type *Ty, unsigned oNum, bool Create) { - unsigned Num = oNum; - unsigned type = getTypeSlot(Ty); // The type plane it lives in... - if (type == Type::TypeTyID) { // The 'type' plane has implicit values - assert(Create == false); - if (Num < Type::NumPrimitiveIDs) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)Num); - if (T) return (Value*)T; // Asked for a primitive type... - } - - // Otherwise, derived types need offset... - Num -= FirstDerivedTyID; - - // Is it a module-level type? - if (Num < ModuleTypeValues.size()) - return (Value*)ModuleTypeValues[Num].get(); - - // Nope, is it a function-level type? - Num -= ModuleTypeValues.size(); - if (Num < FunctionTypeValues.size()) - return (Value*)FunctionTypeValues[Num].get(); +Value *BytecodeParser::getValue(const Type *Ty, unsigned oNum, bool Create) { + return getValue(getTypeSlot(Ty), oNum, Create); +} - return 0; - } +Value *BytecodeParser::getValue(unsigned type, unsigned oNum, bool Create) { + assert(type != Type::TypeTyID && "getValue() cannot get types!"); + unsigned Num = oNum; if (HasImplicitZeroInitializer && type >= FirstDerivedTyID) { if (Num == 0) - return Constant::getNullValue(Ty); + return Constant::getNullValue(getType(type)); --Num; } @@ -138,19 +138,13 @@ if (!Create) return 0; // Do not create a placeholder? - Value *d = 0; - switch (Ty->getPrimitiveID()) { - case Type::LabelTyID: - d = new BBPHolder(Ty, oNum); - break; - default: - d = new ValPHolder(Ty, oNum); - break; - } - - assert(d != 0 && "How did we not make something?"); - if (insertValue(d, LateResolveValues) == -1) return 0; - return d; + const Type *Ty = getType(type); + Value *Val = type == Type::LabelTyID ? (Value*)new BBPHolder(Ty, oNum) : + (Value*)new ValPHolder(Ty, oNum); + + assert(Val != 0 && "How did we not make something?"); + if (insertValue(Val, LateResolveValues) == -1) return 0; + return Val; } /// getConstantValue - Just like getValue, except that it returns a null pointer @@ -252,11 +246,12 @@ if (read(Buf, EndBuf, Name, false)) // Not aligned... throw std::string("Buffer not aligned."); - Value *V = getValue(Ty, slot, false); // Find mapping... - if (V == 0) { - BCR_TRACE(3, "FAILED LOOKUP: Slot #" << slot << "\n"); - throw std::string("Failed value look-up."); - } + Value *V; + if (Typ == Type::TypeTyID) + V = (Value*)getType(slot); + else + V = getValue(Typ, slot, false); // Find mapping... + if (V == 0) throw std::string("Failed value look-up."); BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << *V; if (!isa(V)) std::cerr << "\n"); Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.47 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.48 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.47 Sat Oct 4 15:14:40 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Oct 8 16:18:57 2003 @@ -179,6 +179,7 @@ const unsigned char *EndBuf); Value *getValue(const Type *Ty, unsigned num, bool Create = true); + Value *getValue(unsigned TypeID, unsigned num, bool Create = true); const Type *getType(unsigned ID); Constant *getConstantValue(const Type *Ty, unsigned num); From gaeke at cs.uiuc.edu Wed Oct 8 16:39:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 8 16:39:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile Message-ID: <200310082138.QAA05673@psmith.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.10 -> 1.11 --- Log message: I really meant to use that AUTOHEADER variable I put in there. --- Diffs of the changes: (+1 -1) Index: llvm/Makefile diff -u llvm/Makefile:1.10 llvm/Makefile:1.11 --- llvm/Makefile:1.10 Tue Oct 7 18:44:10 2003 +++ llvm/Makefile Wed Oct 8 16:38:35 2003 @@ -21,5 +21,5 @@ cd autoconf && $(AUTOCONF) -o ../configure configure.ac include/Config/config.h.in: autoconf/configure.ac autoconf/aclocal.m4 - autoheader -I autoconf autoconf/configure.ac + $(AUTOHEADER) -I autoconf autoconf/configure.ac From gaeke at cs.uiuc.edu Wed Oct 8 16:45:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 8 16:45:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310082144.QAA05808@psmith.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.36 -> 1.37 --- Log message: Use 3-arg form of AC_DEFINE. Check for strsignal(), which isn't found everywhere, and sys_siglist, which can be used to implement it. --- Diffs of the changes: (+8 -4) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.36 llvm/autoconf/configure.ac:1.37 --- llvm/autoconf/configure.ac:1.36 Tue Oct 7 16:57:39 2003 +++ llvm/autoconf/configure.ac Wed Oct 8 16:44:07 2003 @@ -407,10 +407,10 @@ AC_CHECK_LIB(elf, elf_begin) dnl dlopen() is required for plugin support. -AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1]),AC_MSG_WARN([dlopen() not found - disabling plugin support])) +AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],[Define if dlopen() is available on this platform.]),AC_MSG_WARN([dlopen() not found - disabling plugin support])) dnl mallinfo is optional; the code can compile (minus features) without it -AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1])) +AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.])) dnl dnl The math libraries are used by the test code, but not by the actual LLVM @@ -449,7 +449,7 @@ AC_C_INLINE dnl Check for machine endian-ness -AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG]),AC_DEFINE(ENDIAN_LITTLE)) +AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG],[],[Define if the machine is Big-Endian]),AC_DEFINE([ENDIAN_LITTLE],[],[Define if the machine is Little-Endian])) dnl Check for types AC_TYPE_PID_T @@ -481,7 +481,11 @@ fi AC_HEADER_MMAP_ANONYMOUS AC_TYPE_SIGNAL -AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll) +AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll strsignal) +AC_CHECK_DECLS([sys_siglist],[],[],[ +#if HAVE_SIGNAL_H +#include +#endif]) dnl dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED From gaeke at cs.uiuc.edu Wed Oct 8 16:47:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 8 16:47:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/aclocal.m4 Message-ID: <200310082146.QAA05913@psmith.cs.uiuc.edu> Changes in directory llvm/autoconf: aclocal.m4 updated: 1.5 -> 1.6 --- Log message: Use 3-arg form of AC_DEFINE. --- Diffs of the changes: (+2 -2) Index: llvm/autoconf/aclocal.m4 diff -u llvm/autoconf/aclocal.m4:1.5 llvm/autoconf/aclocal.m4:1.6 --- llvm/autoconf/aclocal.m4:1.5 Tue Oct 7 16:33:27 2003 +++ llvm/autoconf/aclocal.m4 Wed Oct 8 16:45:58 2003 @@ -6130,7 +6130,7 @@ AC_LANG_RESTORE ]) if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) + AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory]) AC_SUBST(MMAP_FILE,[yes]) fi ]) @@ -6152,7 +6152,7 @@ AC_LANG_RESTORE ]) if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) + AC_DEFINE([HAVE_MMAP_ANONYMOUS],[],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON]) fi ]) From gaeke at cs.uiuc.edu Wed Oct 8 16:49:01 2003 From: gaeke at cs.uiuc.edu (Brian Gaeke) Date: Wed Oct 8 16:49:01 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310082148.QAA13251@gally.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.37 -> 1.38 --- Log message: test/Programs/NoSource and www are gone from the tree; don't try to configure their Makefiles. --- Diffs of the changes: (+0 -7) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.37 llvm/autoconf/configure.ac:1.38 --- llvm/autoconf/configure.ac:1.37 Wed Oct 8 16:44:07 2003 +++ llvm/autoconf/configure.ac Wed Oct 8 16:48:26 2003 @@ -169,12 +169,6 @@ AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile) AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile) AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/sim/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/Flex/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/Larn/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/Moria-5.5.2/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/Povray31/Makefile) -AC_CONFIG_MAKEFILE(test/Programs/NoSource/m4/Makefile) AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile) AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc) AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Gizmos/Makefile) @@ -208,7 +202,6 @@ AC_CONFIG_MAKEFILE(utils/Burg/Makefile) AC_CONFIG_MAKEFILE(utils/Burg/Doc/Makefile) AC_CONFIG_MAKEFILE(utils/TableGen/Makefile) -AC_CONFIG_MAKEFILE(www/docs/Makefile) AC_CONFIG_MAKEFILE(projects/Makefile) AC_CONFIG_MAKEFILE(projects/sample/Makefile) AC_CONFIG_MAKEFILE(projects/sample/Makefile.common) From lattner at cs.uiuc.edu Wed Oct 8 16:52:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 16:52:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h Message-ID: <200310082151.QAA26428@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.67 -> 1.68 ReaderInternals.h updated: 1.48 -> 1.49 --- Log message: Inline the postResolveValues method. It was poorly named anyway --- Diffs of the changes: (+26 -34) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.67 llvm/lib/Bytecode/Reader/Reader.cpp:1.68 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.67 Wed Oct 8 16:18:57 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Oct 8 16:51:46 2003 @@ -176,33 +176,6 @@ } -void BytecodeParser::postResolveValues(ValueTable &ValTab) { - while (!ValTab.empty()) { - ValueList &VL = *ValTab.back(); - ValTab.pop_back(); - - while (!VL.empty()) { - Value *V = VL.back(); - unsigned IDNumber = getValueIDNumberFromPlaceHolder(V); - VL.pop_back(); - - Value *NewVal = getValue(V->getType(), IDNumber, false); - if (NewVal == 0) - throw std::string("Unresolvable reference found: <" + - V->getType()->getDescription() + ">:" + - utostr(IDNumber) + "."); - - // Fixup all of the uses of this placeholder def... - V->replaceAllUsesWith(NewVal); - - // Now that all the uses are gone, delete the placeholder... - // If we couldn't find a def (error case), then leak a little - delete V; // memory, 'cause otherwise we can't remove all uses! - } - delete &VL; - } -} - std::auto_ptr BytecodeParser::ParseBasicBlock(const unsigned char *&Buf, const unsigned char *EndBuf) { @@ -381,9 +354,31 @@ } // Check for unresolvable references - postResolveValues(LateResolveValues); + while (!LateResolveValues.empty()) { + ValueList &VL = *LateResolveValues.back(); + LateResolveValues.pop_back(); + + while (!VL.empty()) { + Value *V = VL.back(); + unsigned IDNumber = getValueIDNumberFromPlaceHolder(V); + VL.pop_back(); + + Value *NewVal = getValue(V->getType(), IDNumber, false); + if (NewVal == 0) + throw std::string("Unresolvable reference found: <" + + V->getType()->getDescription() + ">:" + + utostr(IDNumber) + "."); - //ResolveReferencesToValue(F, FunctionSlot); + // Fixup all of the uses of this placeholder def... + V->replaceAllUsesWith(NewVal); + + // Now that all the uses are gone, delete the placeholder... + // If we couldn't find a def (error case), then leak a little + // memory, because otherwise we can't remove all uses! + delete V; + } + delete &VL; + } // Clear out function-level types... FunctionTypeValues.clear(); Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.48 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.49 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.48 Wed Oct 8 16:18:57 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Oct 8 16:51:46 2003 @@ -77,11 +77,9 @@ std::cerr << "BytecodeParser instance!\n"; } -private: // All of this data is transient across calls to ParseBytecode +private: struct ValueList : public User { - ValueList() : User(Type::TypeTy, Value::TypeVal) { - } - ~ValueList() {} + ValueList() : User(Type::TypeTy, Value::TypeVal) {} // vector compatibility methods unsigned size() const { return getNumOperands(); } @@ -185,7 +183,6 @@ int insertValue(Value *V, ValueTable &Table); // -1 = Failure void setValueTo(ValueTable &D, unsigned Slot, Value *V); - void postResolveValues(ValueTable &ValTab); unsigned getTypeSlot(const Type *Ty); From lattner at cs.uiuc.edu Wed Oct 8 17:54:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Oct 8 17:54:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200310082253.RAA25628@neo.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.53 -> 1.54 Reader.cpp updated: 1.68 -> 1.69 ReaderInternals.h updated: 1.49 -> 1.50 --- Log message: This patch substantially simplifies and cleans up handling of basic blocks in the bytecode parser. Before we tried to shoehorn basic blocks into the "getValue" code path with other types of values. For a variety of reasons this was a bad idea, so this patch separates it out into its own data structure. This simplifies the code, makes it fit in 80 columns, and is also much faster. In a testcase provided by Bill, which has lots of PHI nodes, this patch speeds up bytecode parsing from taking 6.9s to taking 2.32s. More speedups to follow later. --- Diffs of the changes: (+84 -60) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.53 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.54 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.53 Wed Oct 8 16:18:57 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Wed Oct 8 17:52:53 2003 @@ -161,12 +161,11 @@ delete PN; return true; case 2: PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTyID, - Raw->Arg2))); + getBasicBlock(Raw->Arg2)); break; default: - PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTyID, Raw->Arg2))); + PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), + getBasicBlock(Raw->Arg2)); if (Raw->VarArgs->size() & 1) { std::cerr << "PHI Node with ODD number of arguments!\n"; delete PN; @@ -174,8 +173,7 @@ } else { std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i+=2) - PN->addIncoming(getValue(Raw->Ty, args[i]), - cast(getValue(Type::LabelTyID, args[i+1]))); + PN->addIncoming(getValue(Raw->Ty, args[i]), getBasicBlock(args[i+1])); } delete Raw->VarArgs; break; @@ -200,20 +198,18 @@ case Instruction::Br: if (Raw->NumOperands == 1) { - Res = new BranchInst(cast(getValue(Type::LabelTyID,Raw->Arg1))); + Res = new BranchInst(getBasicBlock(Raw->Arg1)); return false; } else if (Raw->NumOperands == 3) { - Res = new BranchInst(cast(getValue(Type::LabelTyID, Raw->Arg1)), - cast(getValue(Type::LabelTyID, Raw->Arg2)), - getValue(Type::BoolTyID , Raw->Arg3)); + Res = new BranchInst(getBasicBlock(Raw->Arg1), getBasicBlock(Raw->Arg2), + getValue(Type::BoolTyID , Raw->Arg3)); return false; } break; case Instruction::Switch: { SwitchInst *I = - new SwitchInst(getValue(Raw->Ty, Raw->Arg1), - cast(getValue(Type::LabelTyID, Raw->Arg2))); + new SwitchInst(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); Res = I; if (Raw->NumOperands < 3) return false; // No destinations? Weird. @@ -226,7 +222,7 @@ std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i += 2) I->addCase(cast(getValue(Raw->Ty, args[i])), - cast(getValue(Type::LabelTyID, args[i+1]))); + getBasicBlock(args[i+1])); delete Raw->VarArgs; return false; @@ -311,11 +307,11 @@ if (!FTy->isVarArg()) { if (Raw->NumOperands < 3) return true; - Normal = cast(getValue(Type::LabelTyID, Raw->Arg2)); + Normal = getBasicBlock(Raw->Arg2); if (Raw->NumOperands == 3) - Except = cast(getValue(Type::LabelTyID, Raw->Arg3)); + Except = getBasicBlock(Raw->Arg3); else { - Except = cast(getValue(Type::LabelTyID, args[0])); + Except = getBasicBlock(args[0]); FunctionType::ParamTypes::const_iterator It = PL.begin(); for (unsigned i = 1; i < args.size(); i++) { @@ -327,10 +323,11 @@ } } else { if (args.size() < 4) return true; - if (getType(args[0]) != Type::LabelTy || - getType(args[2]) != Type::LabelTy) return true; - Normal = cast(getValue(Type::LabelTyID, args[1])); - Except = cast(getValue(Type::LabelTyID, args[3])); + if (args[0] != Type::LabelTyID || args[2] != Type::LabelTyID) + return true; + + Normal = getBasicBlock(args[1]); + Except = getBasicBlock(args[3]); if ((args.size() & 1) != 0) return true; // Must be pairs of type/value Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.68 llvm/lib/Bytecode/Reader/Reader.cpp:1.69 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.68 Wed Oct 8 16:51:46 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Oct 8 17:52:54 2003 @@ -119,6 +119,7 @@ Value *BytecodeParser::getValue(unsigned type, unsigned oNum, bool Create) { assert(type != Type::TypeTyID && "getValue() cannot get types!"); + assert(type != Type::LabelTyID && "getValue() cannot get blocks!"); unsigned Num = oNum; if (HasImplicitZeroInitializer && type >= FirstDerivedTyID) { @@ -138,15 +139,30 @@ if (!Create) return 0; // Do not create a placeholder? - const Type *Ty = getType(type); - Value *Val = type == Type::LabelTyID ? (Value*)new BBPHolder(Ty, oNum) : - (Value*)new ValPHolder(Ty, oNum); - - assert(Val != 0 && "How did we not make something?"); + Value *Val = new ValPHolder(getType(type), oNum); if (insertValue(Val, LateResolveValues) == -1) return 0; return Val; } +/// getBasicBlock - Get a particular numbered basic block, which might be a +/// forward reference. This works together with ParseBasicBlock to handle these +/// forward references in a clean manner. +/// +BasicBlock *BytecodeParser::getBasicBlock(unsigned ID) { + // Make sure there is room in the table... + if (ParsedBasicBlocks.size() <= ID) ParsedBasicBlocks.resize(ID+1); + + // First check to see if this is a backwards reference, i.e., ParseBasicBlock + // has already created this block, or if the forward reference has already + // been created. + if (ParsedBasicBlocks[ID]) + return ParsedBasicBlocks[ID]; + + // Otherwise, the basic block has not yet been created. Do so and add it to + // the ParsedBasicBlocks list. + return ParsedBasicBlocks[ID] = new BasicBlock(); +} + /// getConstantValue - Just like getValue, except that it returns a null pointer /// only on error. It always returns a constant (meaning that if the value is /// defined, but is not a constant, that is an error). If the specified @@ -176,10 +192,16 @@ } -std::auto_ptr -BytecodeParser::ParseBasicBlock(const unsigned char *&Buf, - const unsigned char *EndBuf) { - std::auto_ptr BB(new BasicBlock()); +BasicBlock *BytecodeParser::ParseBasicBlock(const unsigned char *&Buf, + const unsigned char *EndBuf, + unsigned BlockNo) { + BasicBlock *BB; + if (ParsedBasicBlocks.size() == BlockNo) + ParsedBasicBlocks.push_back(BB = new BasicBlock()); + else if (ParsedBasicBlocks[BlockNo] == 0) + BB = ParsedBasicBlocks[BlockNo] = new BasicBlock(); + else + BB = ParsedBasicBlocks[BlockNo]; while (Buf < EndBuf) { Instruction *Inst; @@ -199,7 +221,8 @@ void BytecodeParser::ParseSymbolTable(const unsigned char *&Buf, const unsigned char *EndBuf, - SymbolTable *ST) { + SymbolTable *ST, + Function *CurrentFunction) { while (Buf < EndBuf) { // Symtab block header: [num entries][type id number] unsigned NumEntries, Typ; @@ -219,10 +242,17 @@ if (read(Buf, EndBuf, Name, false)) // Not aligned... throw std::string("Buffer not aligned."); - Value *V; + Value *V = 0; if (Typ == Type::TypeTyID) V = (Value*)getType(slot); - else + else if (Typ == Type::LabelTyID) { + if (CurrentFunction) { + // FIXME: THIS IS N^2!!! + Function::iterator BlockIterator = CurrentFunction->begin(); + std::advance(BlockIterator, slot); + V = BlockIterator; + } + } else V = getValue(Typ, slot, false); // Find mapping... if (V == 0) throw std::string("Failed value look-up."); BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << *V; @@ -254,9 +284,8 @@ GlobalRefs.erase(I); // Remove the map entry for it } -void -BytecodeParser::ParseFunction(const unsigned char *&Buf, - const unsigned char *EndBuf) { +void BytecodeParser::ParseFunction(const unsigned char *&Buf, + const unsigned char *EndBuf) { if (FunctionSignatureList.empty()) throw std::string("FunctionSignatureList empty!"); @@ -312,6 +341,9 @@ throw std::string("Error reading function arguments!"); } + // Keep track of how many basic blocks we have read in... + unsigned BlockNum = 0; + while (Buf < EndBuf) { unsigned Type, Size; const unsigned char *OldBuf = Buf; @@ -326,17 +358,14 @@ case BytecodeFormat::BasicBlock: { BCR_TRACE(2, "BLOCK BytecodeFormat::BasicBlock: {\n"); - std::auto_ptr BB = ParseBasicBlock(Buf, Buf+Size); - if (!BB.get() || insertValue(BB.get(), Values) == -1) - throw std::string("Parse error: BasicBlock"); - - F->getBasicBlockList().push_back(BB.release()); + BasicBlock *BB = ParseBasicBlock(Buf, Buf+Size, BlockNum++); + F->getBasicBlockList().push_back(BB); break; } case BytecodeFormat::SymbolTable: { BCR_TRACE(2, "BLOCK BytecodeFormat::SymbolTable: {\n"); - ParseSymbolTable(Buf, Buf+Size, &F->getSymbolTable()); + ParseSymbolTable(Buf, Buf+Size, &F->getSymbolTable(), F); break; } @@ -353,6 +382,12 @@ ALIGN32(Buf, EndBuf); } + // Make sure there were no references to non-existant basic blocks. + if (BlockNum != ParsedBasicBlocks.size()) + throw std::string("Illegal basic block operand reference"); + ParsedBasicBlocks.clear(); + + // Check for unresolvable references while (!LateResolveValues.empty()) { ValueList &VL = *LateResolveValues.back(); @@ -582,7 +617,7 @@ case BytecodeFormat::SymbolTable: BCR_TRACE(1, "BLOCK BytecodeFormat::SymbolTable: {\n"); - ParseSymbolTable(Buf, Buf+Size, &TheModule->getSymbolTable()); + ParseSymbolTable(Buf, Buf+Size, &TheModule->getSymbolTable(), 0); break; default: Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.49 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.50 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.49 Wed Oct 8 16:51:46 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Wed Oct 8 17:52:54 2003 @@ -103,6 +103,8 @@ ValueTable Values, LateResolveValues; ValueTable ModuleValues; + std::vector ParsedBasicBlocks; + // GlobalRefs - This maintains a mapping between 's and forward // references to global values or constants. Such values may be referenced // before they are defined, and if so, the temporary object that they @@ -153,15 +155,16 @@ void ParseVersionInfo (const unsigned char *&Buf, const unsigned char *End); void ParseModuleGlobalInfo(const unsigned char *&Buf, const unsigned char *E); void ParseSymbolTable(const unsigned char *&Buf, const unsigned char *End, - SymbolTable *); + SymbolTable *, Function *CurrentFunction); void ParseFunction(const unsigned char *&Buf, const unsigned char *End); void ParseGlobalTypes(const unsigned char *&Buf, const unsigned char *EndBuf); - std::auto_ptr - ParseBasicBlock(const unsigned char *&Buf, const unsigned char *End); + BasicBlock *ParseBasicBlock(const unsigned char *&Buf, + const unsigned char *End, + unsigned BlockNo); - bool ParseInstruction (const unsigned char *&Buf, const unsigned char *End, - Instruction *&); + bool ParseInstruction(const unsigned char *&Buf, const unsigned char *End, + Instruction *&); std::auto_ptr ParseRawInst(const unsigned char *&Buf, const unsigned char *End); @@ -179,6 +182,7 @@ Value *getValue(const Type *Ty, unsigned num, bool Create = true); Value *getValue(unsigned TypeID, unsigned num, bool Create = true); const Type *getType(unsigned ID); + BasicBlock *getBasicBlock(unsigned ID); Constant *getConstantValue(const Type *Ty, unsigned num); int insertValue(Value *V, ValueTable &Table); // -1 = Failure @@ -207,12 +211,6 @@ virtual Instruction *clone() const { abort(); return 0; } }; -struct BBPlaceHolderHelper : public BasicBlock { - BBPlaceHolderHelper(const Type *Ty) : BasicBlock() { - assert(Ty == Type::LabelTy); - } -}; - struct ConstantPlaceHolderHelper : public Constant { ConstantPlaceHolderHelper(const Type *Ty) : Constant(Ty) {} @@ -220,7 +218,6 @@ }; typedef PlaceholderDef ValPHolder; -typedef PlaceholderDef BBPHolder; typedef PlaceholderDef ConstPHolder; // Some common errors we find @@ -232,12 +229,7 @@ static inline unsigned getValueIDNumberFromPlaceHolder(Value *Val) { if (isa(Val)) return ((ConstPHolder*)Val)->getID(); - - // else discriminate by type - switch (Val->getType()->getPrimitiveID()) { - case Type::LabelTyID: return ((BBPHolder*)Val)->getID(); - default: return ((ValPHolder*)Val)->getID(); - } + return ((ValPHolder*)Val)->getID(); } static inline void readBlock(const unsigned char *&Buf, From lattner at cs.uiuc.edu Thu Oct 9 00:26:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 00:26:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h Message-ID: <200310090525.AAA17768@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.69 -> 1.70 ReaderInternals.h updated: 1.50 -> 1.51 --- Log message: Remove a dead method --- Diffs of the changes: (+0 -12) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.69 llvm/lib/Bytecode/Reader/Reader.cpp:1.70 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.69 Wed Oct 8 17:52:54 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 00:25:34 2003 @@ -102,17 +102,6 @@ } -void BytecodeParser::setValueTo(ValueTable &ValueTab, unsigned Slot, - Value *Val) { - assert(&ValueTab == &ModuleValues && "Can only setValueTo on Module values!"); - assert((!HasImplicitZeroInitializer || Slot != 0) && - "Cannot change zero init"); - unsigned type = getTypeSlot(Val->getType()); - assert(type < ValueTab.size() && Slot <= ValueTab[type]->size()); - ValueTab[type]->setOperand(Slot-HasImplicitZeroInitializer, Val); -} - - Value *BytecodeParser::getValue(const Type *Ty, unsigned oNum, bool Create) { return getValue(getTypeSlot(Ty), oNum, Create); } Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.50 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.51 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.50 Wed Oct 8 17:52:54 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 00:25:34 2003 @@ -186,7 +186,6 @@ Constant *getConstantValue(const Type *Ty, unsigned num); int insertValue(Value *V, ValueTable &Table); // -1 = Failure - void setValueTo(ValueTable &D, unsigned Slot, Value *V); unsigned getTypeSlot(const Type *Ty); From lattner at cs.uiuc.edu Thu Oct 9 01:06:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 01:06:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h Message-ID: <200310090605.BAA21317@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.70 -> 1.71 ReaderInternals.h updated: 1.51 -> 1.52 --- Log message: Eliminate the old LateResolveValues data structure, replacing it with a new, simpler, ForwardReferences data structure. This is just the first simple replacement, subsequent changes will improve the code more. This simple change improves the performance of loading a file from HDF5 (contributed by Bill) from 2.36s to 1.93s, a 22% improvement. This presumably has to do with the fact that we only create ONE placeholder for a particular forward referenced values, and also may be because the data structure is much simpler. --- Diffs of the changes: (+28 -26) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.70 llvm/lib/Bytecode/Reader/Reader.cpp:1.71 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.70 Thu Oct 9 00:25:34 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 01:05:39 2003 @@ -128,8 +128,14 @@ if (!Create) return 0; // Do not create a placeholder? + std::pair KeyValue(type, oNum); + std::map, Value*>::iterator I = + ForwardReferences.lower_bound(KeyValue); + if (I != ForwardReferences.end() && I->first == KeyValue) + return I->second; // We have already created this placeholder + Value *Val = new ValPHolder(getType(type), oNum); - if (insertValue(Val, LateResolveValues) == -1) return 0; + ForwardReferences.insert(I, std::make_pair(KeyValue, Val)); return Val; } @@ -377,31 +383,27 @@ ParsedBasicBlocks.clear(); - // Check for unresolvable references - while (!LateResolveValues.empty()) { - ValueList &VL = *LateResolveValues.back(); - LateResolveValues.pop_back(); - - while (!VL.empty()) { - Value *V = VL.back(); - unsigned IDNumber = getValueIDNumberFromPlaceHolder(V); - VL.pop_back(); - - Value *NewVal = getValue(V->getType(), IDNumber, false); - if (NewVal == 0) - throw std::string("Unresolvable reference found: <" + - V->getType()->getDescription() + ">:" + - utostr(IDNumber) + "."); + // Resolve forward references + while (!ForwardReferences.empty()) { + std::map, Value*>::iterator I = ForwardReferences.begin(); + unsigned type = I->first.first; + unsigned Slot = I->first.second; + Value *PlaceHolder = I->second; + ForwardReferences.erase(I); + + Value *NewVal = getValue(type, Slot, false); + if (NewVal == 0) + throw std::string("Unresolvable reference found: <" + + PlaceHolder->getType()->getDescription() + ">:" + + utostr(Slot) + "."); - // Fixup all of the uses of this placeholder def... - V->replaceAllUsesWith(NewVal); + // Fixup all of the uses of this placeholder def... + PlaceHolder->replaceAllUsesWith(NewVal); - // Now that all the uses are gone, delete the placeholder... - // If we couldn't find a def (error case), then leak a little - // memory, because otherwise we can't remove all uses! - delete V; - } - delete &VL; + // Now that all the uses are gone, delete the placeholder... + // If we couldn't find a def (error case), then leak a little + // memory, because otherwise we can't remove all uses! + delete PlaceHolder; } // Clear out function-level types... Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.51 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.52 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.51 Thu Oct 9 00:25:34 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 01:05:40 2003 @@ -57,7 +57,6 @@ } void freeState() { freeTable(Values); - freeTable(LateResolveValues); freeTable(ModuleValues); } @@ -100,8 +99,9 @@ bool hasInternalMarkerOnly; // Only types of linkage are intern/external typedef std::vector ValueTable; - ValueTable Values, LateResolveValues; + ValueTable Values; ValueTable ModuleValues; + std::map, Value*> ForwardReferences; std::vector ParsedBasicBlocks; From lattner at cs.uiuc.edu Thu Oct 9 01:15:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 01:15:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderInternals.h Message-ID: <200310090614.BAA23172@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.71 -> 1.72 ReaderInternals.h updated: 1.52 -> 1.53 --- Log message: Eliminate the instruction placeholder. Simplify a bunch of code. This results in no significant speedup, but does provide simpler code --- Diffs of the changes: (+1 -15) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.71 llvm/lib/Bytecode/Reader/Reader.cpp:1.72 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.71 Thu Oct 9 01:05:39 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 01:14:26 2003 @@ -134,7 +134,7 @@ if (I != ForwardReferences.end() && I->first == KeyValue) return I->second; // We have already created this placeholder - Value *Val = new ValPHolder(getType(type), oNum); + Value *Val = new Argument(getType(type)); ForwardReferences.insert(I, std::make_pair(KeyValue, Val)); return Val; } Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.52 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.53 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.52 Thu Oct 9 01:05:40 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 01:14:26 2003 @@ -203,20 +203,12 @@ unsigned getID() { return ID; } }; -struct InstPlaceHolderHelper : public Instruction { - InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {} - virtual const char *getOpcodeName() const { return "placeholder"; } - - virtual Instruction *clone() const { abort(); return 0; } -}; - struct ConstantPlaceHolderHelper : public Constant { ConstantPlaceHolderHelper(const Type *Ty) : Constant(Ty) {} virtual bool isNullValue() const { return false; } }; -typedef PlaceholderDef ValPHolder; typedef PlaceholderDef ConstPHolder; // Some common errors we find @@ -224,12 +216,6 @@ static const std::string Error_read = "read(): error reading."; static const std::string Error_inputdata = "input_data(): error reading."; static const std::string Error_DestSlot = "No destination slot found."; - -static inline unsigned getValueIDNumberFromPlaceHolder(Value *Val) { - if (isa(Val)) - return ((ConstPHolder*)Val)->getID(); - return ((ValPHolder*)Val)->getID(); -} static inline void readBlock(const unsigned char *&Buf, const unsigned char *EndBuf, From criswell at cs.uiuc.edu Thu Oct 9 10:45:03 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 9 10:45:03 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200310091544.KAA12844@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.43 -> 1.44 --- Log message: Added 177.mesa to the list of Makefiles to propogate to the object root. --- Diffs of the changes: (+124 -86) Index: llvm/configure diff -u llvm/configure:1.43 llvm/configure:1.44 --- llvm/configure:1.43 Tue Oct 7 16:57:37 2003 +++ llvm/configure Thu Oct 9 10:44:26 2003 @@ -1757,6 +1757,9 @@ ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CFP2000/Makefile" + ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CFP2000/177.mesa/Makefile" + + ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CFP2000/179.art/Makefile" @@ -1919,24 +1922,6 @@ ac_config_commands="$ac_config_commands test/Programs/MultiSource/Benchmarks/sim/Makefile" - ac_config_commands="$ac_config_commands test/Programs/NoSource/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/NoSource/Flex/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/NoSource/Larn/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/NoSource/Moria-5.5.2/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/NoSource/Povray31/Makefile" - - - ac_config_commands="$ac_config_commands test/Programs/NoSource/m4/Makefile" - - ac_config_commands="$ac_config_commands test/Programs/SingleSource/Makefile" @@ -2036,9 +2021,6 @@ ac_config_commands="$ac_config_commands utils/TableGen/Makefile" - ac_config_commands="$ac_config_commands www/docs/Makefile" - - ac_config_commands="$ac_config_commands projects/Makefile" @@ -4422,7 +4404,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4425 "configure"' > conftest.$ac_ext + echo '#line 4407 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5263,7 +5245,7 @@ # Provide some information about the compiler. -echo "$as_me:5266:" \ +echo "$as_me:5248:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6272,11 +6254,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6275: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6257: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6279: \$? = $ac_status" >&5 + echo "$as_me:6261: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6504,11 +6486,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6507: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6489: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6511: \$? = $ac_status" >&5 + echo "$as_me:6493: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6571,11 +6553,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6574: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6556: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6578: \$? = $ac_status" >&5 + echo "$as_me:6560: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8583,7 +8565,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10802: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10824: \$? = $ac_status" >&5 + echo "$as_me:10806: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10884,11 +10866,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10887: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10869: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10891: \$? = $ac_status" >&5 + echo "$as_me:10873: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12127,7 +12109,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13032: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13054: \$? = $ac_status" >&5 + echo "$as_me:13036: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13114,11 +13096,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13117: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13099: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13121: \$? = $ac_status" >&5 + echo "$as_me:13103: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15058,11 +15040,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15061: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15043: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15065: \$? = $ac_status" >&5 + echo "$as_me:15047: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15290,11 +15272,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15293: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15275: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15297: \$? = $ac_status" >&5 + echo "$as_me:15279: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15357,11 +15339,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15360: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15342: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15364: \$? = $ac_status" >&5 + echo "$as_me:15346: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17369,7 +17351,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 if test "$ac_cv_search_dlopen" != no; then test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS" - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -19329,7 +19312,8 @@ echo "${ECHO_T}$ac_cv_search_mallinfo" >&6 if test "$ac_cv_search_mallinfo" != no; then test "$ac_cv_search_mallinfo" = "none required" || LIBS="$ac_cv_search_mallinfo $LIBS" - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MALLINFO 1 _ACEOF @@ -20347,13 +20331,15 @@ echo "${ECHO_T}$ac_cv_c_bigendian" >&6 case $ac_cv_c_bigendian in yes) - cat >>confdefs.h <<\_ACEOF -#define ENDIAN_BIG 1 + +cat >>confdefs.h <<\_ACEOF +#define ENDIAN_BIG _ACEOF ;; no) - cat >>confdefs.h <<\_ACEOF -#define ENDIAN_LITTLE 1 + +cat >>confdefs.h <<\_ACEOF +#define ENDIAN_LITTLE _ACEOF ;; *) @@ -22224,21 +22210,21 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif + #ifdef HAVE_FCNTL_H #include #endif int fd; int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);} + fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != (int) MAP_FAILED);} _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -22273,8 +22259,9 @@ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5 echo "${ECHO_T}$ac_cv_func_mmap_file" >&6 if test "$ac_cv_func_mmap_file" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_FILE 1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP_FILE _ACEOF MMAP_FILE=yes @@ -22349,8 +22336,9 @@ echo "$as_me:$LINENO: result: $ac_cv_header_mmap_anon" >&5 echo "${ECHO_T}$ac_cv_header_mmap_anon" >&6 if test "$ac_cv_header_mmap_anon" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_ANONYMOUS 1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP_ANONYMOUS _ACEOF fi @@ -22426,7 +22414,8 @@ -for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll + +for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll strsignal do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -22509,6 +22498,73 @@ fi done +echo "$as_me:$LINENO: checking whether sys_siglist is declared" >&5 +echo $ECHO_N "checking whether sys_siglist is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_sys_siglist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_SIGNAL_H +#include +#endif + +int +main () +{ +#ifndef sys_siglist + char *p = (char *) sys_siglist; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_sys_siglist=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_sys_siglist=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_siglist" >&5 +echo "${ECHO_T}$ac_cv_have_decl_sys_siglist" >&6 +if test $ac_cv_have_decl_sys_siglist = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYS_SIGLIST 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYS_SIGLIST 0 +_ACEOF + + +fi + + echo "$as_me:$LINENO: checking for mmap" >&5 @@ -23437,6 +23493,7 @@ ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/Makefile.spec` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/CFP2000/Makefile` +${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/CFP2000/177.mesa/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/CFP2000/179.art/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/CFP2000/183.equake/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/External/SPEC/CFP2000/188.ammp/Makefile` @@ -23491,12 +23548,6 @@ ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/MultiSource/Benchmarks/sim/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/Flex/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/Larn/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/Moria-5.5.2/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/Povray31/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/NoSource/m4/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Makefile.singlesrc` ${srcdir}/autoconf/mkinstalldirs `dirname test/Programs/SingleSource/Gizmos/Makefile` @@ -23530,7 +23581,6 @@ ${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname utils/Burg/Doc/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname utils/TableGen/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname www/docs/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/sample/Makefile` ${srcdir}/autoconf/mkinstalldirs `dirname projects/sample/Makefile.common` @@ -23627,6 +23677,7 @@ "test/Programs/External/SPEC/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/Makefile" ;; "test/Programs/External/SPEC/Makefile.spec" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/Makefile.spec" ;; "test/Programs/External/SPEC/CFP2000/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/CFP2000/Makefile" ;; + "test/Programs/External/SPEC/CFP2000/177.mesa/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/CFP2000/177.mesa/Makefile" ;; "test/Programs/External/SPEC/CFP2000/179.art/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/CFP2000/179.art/Makefile" ;; "test/Programs/External/SPEC/CFP2000/183.equake/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/CFP2000/183.equake/Makefile" ;; "test/Programs/External/SPEC/CFP2000/188.ammp/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/External/SPEC/CFP2000/188.ammp/Makefile" ;; @@ -23681,12 +23732,6 @@ "test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile" ;; "test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile" ;; "test/Programs/MultiSource/Benchmarks/sim/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/MultiSource/Benchmarks/sim/Makefile" ;; - "test/Programs/NoSource/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/Makefile" ;; - "test/Programs/NoSource/Flex/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/Flex/Makefile" ;; - "test/Programs/NoSource/Larn/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/Larn/Makefile" ;; - "test/Programs/NoSource/Moria-5.5.2/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/Moria-5.5.2/Makefile" ;; - "test/Programs/NoSource/Povray31/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/Povray31/Makefile" ;; - "test/Programs/NoSource/m4/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/NoSource/m4/Makefile" ;; "test/Programs/SingleSource/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/Makefile" ;; "test/Programs/SingleSource/Makefile.singlesrc" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/Makefile.singlesrc" ;; "test/Programs/SingleSource/Gizmos/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS test/Programs/SingleSource/Gizmos/Makefile" ;; @@ -23720,7 +23765,6 @@ "utils/Burg/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Makefile" ;; "utils/Burg/Doc/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Burg/Doc/Makefile" ;; "utils/TableGen/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS utils/TableGen/Makefile" ;; - "www/docs/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS www/docs/Makefile" ;; "projects/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/Makefile" ;; "projects/sample/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/sample/Makefile" ;; "projects/sample/Makefile.common" ) CONFIG_COMMANDS="$CONFIG_COMMANDS projects/sample/Makefile.common" ;; @@ -24448,6 +24492,7 @@ test/Programs/External/SPEC/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/Makefile test/Programs/External/SPEC/Makefile ;; test/Programs/External/SPEC/Makefile.spec ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/Makefile.spec test/Programs/External/SPEC/Makefile.spec ;; test/Programs/External/SPEC/CFP2000/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/CFP2000/Makefile test/Programs/External/SPEC/CFP2000/Makefile ;; + test/Programs/External/SPEC/CFP2000/177.mesa/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/CFP2000/177.mesa/Makefile test/Programs/External/SPEC/CFP2000/177.mesa/Makefile ;; test/Programs/External/SPEC/CFP2000/179.art/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/CFP2000/179.art/Makefile test/Programs/External/SPEC/CFP2000/179.art/Makefile ;; test/Programs/External/SPEC/CFP2000/183.equake/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/CFP2000/183.equake/Makefile test/Programs/External/SPEC/CFP2000/183.equake/Makefile ;; test/Programs/External/SPEC/CFP2000/188.ammp/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/External/SPEC/CFP2000/188.ammp/Makefile test/Programs/External/SPEC/CFP2000/188.ammp/Makefile ;; @@ -24502,12 +24547,6 @@ test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile test/Programs/MultiSource/Benchmarks/Ptrdist/yacr2/Makefile ;; test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile test/Programs/MultiSource/Benchmarks/llubenchmark/Makefile ;; test/Programs/MultiSource/Benchmarks/sim/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/MultiSource/Benchmarks/sim/Makefile test/Programs/MultiSource/Benchmarks/sim/Makefile ;; - test/Programs/NoSource/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/Makefile test/Programs/NoSource/Makefile ;; - test/Programs/NoSource/Flex/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/Flex/Makefile test/Programs/NoSource/Flex/Makefile ;; - test/Programs/NoSource/Larn/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/Larn/Makefile test/Programs/NoSource/Larn/Makefile ;; - test/Programs/NoSource/Moria-5.5.2/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/Moria-5.5.2/Makefile test/Programs/NoSource/Moria-5.5.2/Makefile ;; - test/Programs/NoSource/Povray31/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/Povray31/Makefile test/Programs/NoSource/Povray31/Makefile ;; - test/Programs/NoSource/m4/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/NoSource/m4/Makefile test/Programs/NoSource/m4/Makefile ;; test/Programs/SingleSource/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile test/Programs/SingleSource/Makefile ;; test/Programs/SingleSource/Makefile.singlesrc ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Makefile.singlesrc test/Programs/SingleSource/Makefile.singlesrc ;; test/Programs/SingleSource/Gizmos/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Programs/SingleSource/Gizmos/Makefile test/Programs/SingleSource/Gizmos/Makefile ;; @@ -24541,7 +24580,6 @@ utils/Burg/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Makefile utils/Burg/Makefile ;; utils/Burg/Doc/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/Burg/Doc/Makefile utils/Burg/Doc/Makefile ;; utils/TableGen/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/utils/TableGen/Makefile utils/TableGen/Makefile ;; - www/docs/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/www/docs/Makefile www/docs/Makefile ;; projects/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; projects/sample/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/sample/Makefile projects/sample/Makefile ;; projects/sample/Makefile.common ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/projects/sample/Makefile.common projects/sample/Makefile.common ;; From criswell at cs.uiuc.edu Thu Oct 9 10:45:10 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 9 10:45:10 2003 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200310091544.KAA12853@choi.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.38 -> 1.39 --- Log message: Added 177.mesa to the list of Makefiles to propogate to the object root. --- Diffs of the changes: (+1 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.38 llvm/autoconf/configure.ac:1.39 --- llvm/autoconf/configure.ac:1.38 Wed Oct 8 16:48:26 2003 +++ llvm/autoconf/configure.ac Thu Oct 9 10:44:28 2003 @@ -115,6 +115,7 @@ AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CFP2000/Makefile) +AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CFP2000/177.mesa/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CFP2000/179.art/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CFP2000/183.equake/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CFP2000/188.ammp/Makefile) From lattner at cs.uiuc.edu Thu Oct 9 11:11:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 11:11:03 2003 Subject: [llvm-commits] CVS: llvm/utils/getsrcs.sh Message-ID: <200310091610.LAA25214@apoc.cs.uiuc.edu> Changes in directory llvm/utils: getsrcs.sh updated: 1.11 -> 1.12 --- Log message: Include the new docs directory, whenever it gets added. www is gone --- Diffs of the changes: (+1 -1) Index: llvm/utils/getsrcs.sh diff -u llvm/utils/getsrcs.sh:1.11 llvm/utils/getsrcs.sh:1.12 --- llvm/utils/getsrcs.sh:1.11 Sun Oct 5 14:33:27 2003 +++ llvm/utils/getsrcs.sh Thu Oct 9 11:10:15 2003 @@ -1,7 +1,7 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. -find www include lib tools utils -name \*.\[cdhyl\]\* | grep -v Lexer.cpp | \ +find docs include lib tools utils -name \*.\[cdhyl\]\* | grep -v Lexer.cpp | \ grep -v llvmAsmParser.cpp | grep -v llvmAsmParser.h | grep -v '~$' | \ grep -v '\.ll$' | grep -v .flc | grep -v Sparc.burm.c | grep -v '\.d$' |\ grep -v '\.dir$' | grep -v www/docs/doxygen | grep -v include/boost | \ From lattner at cs.uiuc.edu Thu Oct 9 13:26:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 13:26:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200310091825.NAA02708@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.54 -> 1.55 Reader.cpp updated: 1.72 -> 1.73 ReaderInternals.h updated: 1.53 -> 1.54 --- Log message: Significantly clean up parsing of instructions. This exceptionizes and simplifies the control flow a bit. This provides a small (~3%) speedup, but it's primarily a cleanup exercise. --- Diffs of the changes: (+107 -145) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.54 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.55 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.54 Wed Oct 8 17:52:53 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 13:25:19 2003 @@ -126,50 +126,43 @@ } -bool BytecodeParser::ParseInstruction(const unsigned char *&Buf, - const unsigned char *EndBuf, - Instruction *&Res) { +Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf, + const unsigned char *EndBuf) { std::auto_ptr Raw = ParseRawInst(Buf, EndBuf); if (Raw->Opcode >= Instruction::BinaryOpsBegin && - Raw->Opcode < Instruction::BinaryOpsEnd && Raw->NumOperands == 2) { - Res = BinaryOperator::create((Instruction::BinaryOps)Raw->Opcode, - getValue(Raw->Ty, Raw->Arg1), - getValue(Raw->Ty, Raw->Arg2)); - return false; - } + Raw->Opcode < Instruction::BinaryOpsEnd && Raw->NumOperands == 2) + return BinaryOperator::create((Instruction::BinaryOps)Raw->Opcode, + getValue(Raw->Ty, Raw->Arg1), + getValue(Raw->Ty, Raw->Arg2)); - Value *V; switch (Raw->Opcode) { case Instruction::VarArg: case Instruction::Cast: { - V = getValue(Raw->Ty, Raw->Arg1); + Value *V = getValue(Raw->Ty, Raw->Arg1); const Type *Ty = getType(Raw->Arg2); - if (V == 0 || Ty == 0) { std::cerr << "Invalid cast!\n"; return true; } + if (Ty == 0) throw std::string("Invalid cast!\n"); if (Raw->Opcode == Instruction::Cast) - Res = new CastInst(V, Ty); + return new CastInst(V, Ty); else - Res = new VarArgInst(V, Ty); - return false; + return new VarArgInst(V, Ty); } case Instruction::PHINode: { PHINode *PN = new PHINode(Raw->Ty); switch (Raw->NumOperands) { case 0: case 1: - case 3: std::cerr << "Invalid phi node encountered!\n"; - delete PN; - return true; - case 2: PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - getBasicBlock(Raw->Arg2)); + case 3: + delete PN; + throw std::string("Invalid phi node encountered!\n"); + case 2: + PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); break; default: - PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), - getBasicBlock(Raw->Arg2)); + PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); if (Raw->VarArgs->size() & 1) { - std::cerr << "PHI Node with ODD number of arguments!\n"; delete PN; - return true; + throw std::string("PHI Node with ODD number of arguments!\n"); } else { std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i+=2) @@ -178,46 +171,39 @@ delete Raw->VarArgs; break; } - Res = PN; - return false; + return PN; } case Instruction::Shl: case Instruction::Shr: - Res = new ShiftInst((Instruction::OtherOps)Raw->Opcode, - getValue(Raw->Ty, Raw->Arg1), - getValue(Type::UByteTyID, Raw->Arg2)); - return false; + return new ShiftInst((Instruction::OtherOps)Raw->Opcode, + getValue(Raw->Ty, Raw->Arg1), + getValue(Type::UByteTyID, Raw->Arg2)); case Instruction::Ret: - if (Raw->NumOperands == 0) { - Res = new ReturnInst(); return false; - } else if (Raw->NumOperands == 1) { - Res = new ReturnInst(getValue(Raw->Ty, Raw->Arg1)); return false; - } + if (Raw->NumOperands == 0) + return new ReturnInst(); + else if (Raw->NumOperands == 1) + return new ReturnInst(getValue(Raw->Ty, Raw->Arg1)); break; case Instruction::Br: - if (Raw->NumOperands == 1) { - Res = new BranchInst(getBasicBlock(Raw->Arg1)); - return false; - } else if (Raw->NumOperands == 3) { - Res = new BranchInst(getBasicBlock(Raw->Arg1), getBasicBlock(Raw->Arg2), - getValue(Type::BoolTyID , Raw->Arg3)); - return false; - } - break; + if (Raw->NumOperands == 1) + return new BranchInst(getBasicBlock(Raw->Arg1)); + else if (Raw->NumOperands == 3) + return new BranchInst(getBasicBlock(Raw->Arg1), getBasicBlock(Raw->Arg2), + getValue(Type::BoolTyID , Raw->Arg3)); + throw std::string("Invalid number of operands for a 'br' instruction!"); case Instruction::Switch: { - SwitchInst *I = - new SwitchInst(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); - Res = I; - if (Raw->NumOperands < 3) return false; // No destinations? Weird. + SwitchInst *I = new SwitchInst(getValue(Raw->Ty, Raw->Arg1), + getBasicBlock(Raw->Arg2)); + if (Raw->NumOperands < 3) + return I; if (Raw->NumOperands == 3 || Raw->VarArgs->size() & 1) { - std::cerr << "Switch statement with odd number of arguments!\n"; delete I; - return true; - } + throw std::string("Switch statement with odd number of arguments!"); + } std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i += 2) @@ -225,18 +211,17 @@ getBasicBlock(args[i+1])); delete Raw->VarArgs; - return false; + return I; } case Instruction::Call: { Value *F = getValue(Raw->Ty, Raw->Arg1); - if (F == 0) return true; - // Check to make sure we have a pointer to method type + // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) return true; + if (PTy == 0) throw std::string("Call to non function pointer value!"); const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) return true; + if (FTy == 0) throw std::string("Call to non function pointer value!"); std::vector Params; const FunctionType::ParamTypes &PL = FTy->getParamTypes(); @@ -245,58 +230,50 @@ FunctionType::ParamTypes::const_iterator It = PL.begin(); switch (Raw->NumOperands) { - case 0: std::cerr << "Invalid call instruction encountered!\n"; - return true; + case 0: throw std::string("Invalid call instruction encountered!"); case 1: break; case 2: Params.push_back(getValue(*It++, Raw->Arg2)); break; case 3: Params.push_back(getValue(*It++, Raw->Arg2)); - if (It == PL.end()) return true; + if (It == PL.end()) throw std::string("Invalid call instruction!"); Params.push_back(getValue(*It++, Raw->Arg3)); break; default: Params.push_back(getValue(*It++, Raw->Arg2)); { std::vector &args = *Raw->VarArgs; for (unsigned i = 0; i < args.size(); i++) { - if (It == PL.end()) return true; + if (It == PL.end()) throw std::string("Invalid call instruction!"); Params.push_back(getValue(*It++, args[i])); - if (Params.back() == 0) return true; } } delete Raw->VarArgs; } - if (It != PL.end()) return true; + if (It != PL.end()) throw std::string("Invalid call instruction!"); } else { if (Raw->NumOperands > 2) { std::vector &args = *Raw->VarArgs; - if (args.size() < 1) return true; + if (args.size() < 1) throw std::string("Invalid call instruction!"); - if ((args.size() & 1) != 0) - return true; // Must be pairs of type/value + if ((args.size() & 1) != 0) // Must be pairs of type/value + throw std::string("Invalid call instruction!"); for (unsigned i = 0; i < args.size(); i+=2) { const Type *Ty = getType(args[i]); - if (Ty == 0) - return true; - - Value *V = getValue(Ty, args[i+1]); - if (V == 0) return true; - Params.push_back(V); + if (Ty == 0) throw std::string("Invalid call instruction!"); + Params.push_back(getValue(Ty, args[i+1])); } delete Raw->VarArgs; } } - Res = new CallInst(F, Params); - return false; + return new CallInst(F, Params); } case Instruction::Invoke: { Value *F = getValue(Raw->Ty, Raw->Arg1); - if (F == 0) return true; - // Check to make sure we have a pointer to method type + // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) return true; + if (PTy == 0) throw std::string("Invoke to non function pointer value!"); const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) return true; + if (FTy == 0) throw std::string("Invoke to non function pointer value!"); std::vector Params; const FunctionType::ParamTypes &PL = FTy->getParamTypes(); @@ -305,7 +282,7 @@ BasicBlock *Normal, *Except; if (!FTy->isVarArg()) { - if (Raw->NumOperands < 3) return true; + if (Raw->NumOperands < 3) throw std::string("Invalid call instruction!"); Normal = getBasicBlock(Raw->Arg2); if (Raw->NumOperands == 3) @@ -315,127 +292,115 @@ FunctionType::ParamTypes::const_iterator It = PL.begin(); for (unsigned i = 1; i < args.size(); i++) { - if (It == PL.end()) return true; + if (It == PL.end()) throw std::string("Invalid invoke instruction!"); Params.push_back(getValue(*It++, args[i])); - if (Params.back() == 0) return true; } - if (It != PL.end()) return true; + if (It != PL.end()) throw std::string("Invalid invoke instruction!"); } } else { - if (args.size() < 4) return true; + if (args.size() < 4) throw std::string("Invalid invoke instruction!"); if (args[0] != Type::LabelTyID || args[2] != Type::LabelTyID) - return true; + throw std::string("Invalid invoke instruction!"); Normal = getBasicBlock(args[1]); Except = getBasicBlock(args[3]); - if ((args.size() & 1) != 0) - return true; // Must be pairs of type/value - for (unsigned i = 4; i < args.size(); i+=2) { + if ((args.size() & 1) != 0) // Must be pairs of type/value + throw std::string("Invalid invoke instruction!"); + + for (unsigned i = 4; i < args.size(); i += 2) Params.push_back(getValue(args[i], args[i+1])); - if (Params.back() == 0) return true; - } } if (Raw->NumOperands > 3) delete Raw->VarArgs; - Res = new InvokeInst(F, Normal, Except, Params); - return false; + return new InvokeInst(F, Normal, Except, Params); } case Instruction::Malloc: - if (Raw->NumOperands > 2) return true; - V = Raw->NumOperands ? getValue(Type::UIntTyID, Raw->Arg1) : 0; - if (const PointerType *PTy = dyn_cast(Raw->Ty)) - Res = new MallocInst(PTy->getElementType(), V); - else - return true; - return false; + if (Raw->NumOperands > 2) throw std::string("Invalid malloc instruction!"); + if (!isa(Raw->Ty)) + throw std::string("Invalid malloc instruction!"); + + return new MallocInst(cast(Raw->Ty)->getElementType(), + Raw->NumOperands ? getValue(Type::UIntTyID, + Raw->Arg1) : 0); case Instruction::Alloca: - if (Raw->NumOperands > 2) return true; - V = Raw->NumOperands ? getValue(Type::UIntTyID, Raw->Arg1) : 0; - if (const PointerType *PTy = dyn_cast(Raw->Ty)) - Res = new AllocaInst(PTy->getElementType(), V); - else - return true; - return false; - + if (Raw->NumOperands > 2) throw std::string("Invalid alloca instruction!"); + if (!isa(Raw->Ty)) + throw std::string("Invalid alloca instruction!"); + + return new AllocaInst(cast(Raw->Ty)->getElementType(), + Raw->NumOperands ? getValue(Type::UIntTyID, + Raw->Arg1) : 0); case Instruction::Free: - V = getValue(Raw->Ty, Raw->Arg1); - if (!isa(V->getType())) return true; - Res = new FreeInst(V); - return false; + if (!isa(Raw->Ty)) + throw std::string("Invalid free instruction!"); + return new FreeInst(getValue(Raw->Ty, Raw->Arg1)); case Instruction::GetElementPtr: { std::vector Idx; - if (!isa(Raw->Ty)) return true; + if (!isa(Raw->Ty)) + throw std::string("Invalid getelementptr instruction!"); const CompositeType *TopTy = dyn_cast(Raw->Ty); switch (Raw->NumOperands) { - case 0: std::cerr << "Invalid getelementptr encountered!\n"; return true; + case 0: throw std::string("Invalid getelementptr instruction!"); case 1: break; case 2: - if (!TopTy) return true; - Idx.push_back(V = getValue(TopTy->getIndexType(), Raw->Arg2)); - if (!V) return true; + if (!TopTy) throw std::string("Invalid getelementptr instruction!"); + Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); break; case 3: { - if (!TopTy) return true; - Idx.push_back(V = getValue(TopTy->getIndexType(), Raw->Arg2)); - if (!V) return true; + if (!TopTy) throw std::string("Invalid getelementptr instruction!"); + Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); const Type *ETy = GetElementPtrInst::getIndexedType(TopTy, Idx, true); const CompositeType *ElTy = dyn_cast_or_null(ETy); - if (!ElTy) return true; + if (!ElTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(V = getValue(ElTy->getIndexType(), Raw->Arg3)); - if (!V) return true; + Idx.push_back(getValue(ElTy->getIndexType(), Raw->Arg3)); break; } default: - if (!TopTy) return true; - Idx.push_back(V = getValue(TopTy->getIndexType(), Raw->Arg2)); - if (!V) return true; + if (!TopTy) throw std::string("Invalid getelementptr instruction!"); + Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); std::vector &args = *Raw->VarArgs; for (unsigned i = 0, E = args.size(); i != E; ++i) { const Type *ETy = GetElementPtrInst::getIndexedType(Raw->Ty, Idx, true); const CompositeType *ElTy = dyn_cast_or_null(ETy); - if (!ElTy) return true; - Idx.push_back(V = getValue(ElTy->getIndexType(), args[i])); - if (!V) return true; + if (!ElTy) throw std::string("Invalid getelementptr instruction!"); + Idx.push_back(getValue(ElTy->getIndexType(), args[i])); } delete Raw->VarArgs; break; } - Res = new GetElementPtrInst(getValue(Raw->Ty, Raw->Arg1), Idx); - return false; + return new GetElementPtrInst(getValue(Raw->Ty, Raw->Arg1), Idx); } case 62: // volatile load case Instruction::Load: - if (Raw->NumOperands != 1) return true; - if (!isa(Raw->Ty)) return true; - Res = new LoadInst(getValue(Raw->Ty, Raw->Arg1), "", Raw->Opcode == 62); - return false; + if (Raw->NumOperands != 1 || !isa(Raw->Ty)) + throw std::string("Invalid load instruction!"); + return new LoadInst(getValue(Raw->Ty, Raw->Arg1), "", Raw->Opcode == 62); case 63: // volatile store case Instruction::Store: { - if (!isa(Raw->Ty) || Raw->NumOperands != 2) return true; + if (!isa(Raw->Ty) || Raw->NumOperands != 2) + throw std::string("Invalid store instruction!"); Value *Ptr = getValue(Raw->Ty, Raw->Arg2); const Type *ValTy = cast(Ptr->getType())->getElementType(); - Res = new StoreInst(getValue(ValTy, Raw->Arg1), Ptr, Raw->Opcode == 63); - return false; + return new StoreInst(getValue(ValTy, Raw->Arg1), Ptr, Raw->Opcode == 63); } case Instruction::Unwind: - if (Raw->NumOperands != 0) return true; - Res = new UnwindInst(); - return false; + if (Raw->NumOperands != 0) throw std::string("Invalid unwind instruction!"); + return new UnwindInst(); } // end switch(Raw->Opcode) std::cerr << "Unrecognized instruction! " << Raw->Opcode << " ADDR = 0x" << (void*)Buf << "\n"; - return true; + throw std::string("Unrecognized instruction!"); } Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.72 llvm/lib/Bytecode/Reader/Reader.cpp:1.73 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.72 Thu Oct 9 01:14:26 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 13:25:19 2003 @@ -199,10 +199,7 @@ BB = ParsedBasicBlocks[BlockNo]; while (Buf < EndBuf) { - Instruction *Inst; - ParseInstruction(Buf, EndBuf, Inst); - - if (Inst == 0) { throw std::string("Could not parse Instruction."); } + Instruction *Inst = ParseInstruction(Buf, EndBuf); if (insertValue(Inst, Values) == -1) { throw std::string("Could not insert value."); } Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.53 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.54 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.53 Thu Oct 9 01:14:26 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 13:25:19 2003 @@ -163,8 +163,8 @@ const unsigned char *End, unsigned BlockNo); - bool ParseInstruction(const unsigned char *&Buf, const unsigned char *End, - Instruction *&); + Instruction *ParseInstruction(const unsigned char *&Buf, + const unsigned char *End); std::auto_ptr ParseRawInst(const unsigned char *&Buf, const unsigned char *End); From lattner at cs.uiuc.edu Thu Oct 9 13:37:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 13:37:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp InstructionReader.cpp Reader.cpp Message-ID: <200310091836.NAA03500@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.55 -> 1.56 InstructionReader.cpp updated: 1.55 -> 1.56 Reader.cpp updated: 1.73 -> 1.74 --- Log message: Another cleanup: BytecodeReader::getType(...) used to return a null pointer on error. This was only checked about half the time. Now we convert it to throw an exception, and delete the half that checked for error. --- Diffs of the changes: (+24 -50) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.55 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.56 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.55 Sat Oct 4 15:00:03 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Thu Oct 9 13:36:26 2003 @@ -27,7 +27,6 @@ unsigned Typ; if (read_vbr(Buf, EndBuf, Typ)) return Val; const Type *RetType = getType(Typ); - if (RetType == 0) return Val; unsigned NumParams; if (read_vbr(Buf, EndBuf, NumParams)) return Val; @@ -35,9 +34,7 @@ std::vector Params; while (NumParams--) { if (read_vbr(Buf, EndBuf, Typ)) return Val; - const Type *Ty = getType(Typ); - if (Ty == 0) return Val; - Params.push_back(Ty); + Params.push_back(getType(Typ)); } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; @@ -49,7 +46,6 @@ unsigned ElTyp; if (read_vbr(Buf, EndBuf, ElTyp)) return Val; const Type *ElementType = getType(ElTyp); - if (ElementType == 0) return Val; unsigned NumElements; if (read_vbr(Buf, EndBuf, NumElements)) return Val; @@ -64,10 +60,7 @@ if (read_vbr(Buf, EndBuf, Typ)) return Val; while (Typ) { // List is terminated by void/0 typeid - const Type *Ty = getType(Typ); - if (Ty == 0) return Val; - Elements.push_back(Ty); - + Elements.push_back(getType(Typ)); if (read_vbr(Buf, EndBuf, Typ)) return Val; } @@ -77,9 +70,7 @@ unsigned ElTyp; if (read_vbr(Buf, EndBuf, ElTyp)) return Val; BCR_TRACE(5, "Pointer Type Constant #" << ElTyp << "\n"); - const Type *ElementType = getType(ElTyp); - if (ElementType == 0) return Val; - return PointerType::get(ElementType); + return PointerType::get(getType(ElTyp)); } case Type::OpaqueTyID: { @@ -169,9 +160,8 @@ if (read_vbr(Buf, EndBuf, ArgValSlot)) throw Error_readvbr; if (read_vbr(Buf, EndBuf, ArgTypeSlot)) throw Error_readvbr; const Type *ArgTy = getType(ArgTypeSlot); - if (ArgTy == 0) throw std::string("Argument type slot not found."); - BCR_TRACE(4, "CE Arg " << i << ": Type: '" << ArgTy << "' slot: " + BCR_TRACE(4, "CE Arg " << i << ": Type: '" << *ArgTy << "' slot: " << ArgValSlot << "\n"); // Get the arg value from its slot if it exists, otherwise a placeholder @@ -355,13 +345,13 @@ if (read_vbr(Buf, EndBuf, NumEntries) || read_vbr(Buf, EndBuf, Typ)) throw Error_readvbr; - const Type *Ty = getType(Typ); - if (Ty == 0) throw std::string("Invalid type read."); - BCR_TRACE(3, "Type: '" << Ty << "' NumEntries: " << NumEntries << "\n"); - if (Typ == Type::TypeTyID) { + BCR_TRACE(3, "Type: 'type' NumEntries: " << NumEntries << "\n"); parseTypeConstants(Buf, EndBuf, TypeTab, NumEntries); } else { + const Type *Ty = getType(Typ); + BCR_TRACE(3, "Type: '" << *Ty << "' NumEntries: " << NumEntries << "\n"); + for (unsigned i = 0; i < NumEntries; ++i) { Constant *C = parseConstantValue(Buf, EndBuf, Ty); assert(C && "parseConstantValue returned NULL!"); Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.55 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.55 Thu Oct 9 13:25:19 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 13:36:26 2003 @@ -76,8 +76,6 @@ if (read_vbr(Buf, EndBuf, Typ)) throw std::string("Error reading from buffer."); Result->Ty = getType(Typ); - if (Result->Ty == 0) - throw std::string("Invalid type read in instruction."); if (read_vbr(Buf, EndBuf, Result->NumOperands)) throw std::string("Error reading from buffer."); @@ -138,15 +136,9 @@ switch (Raw->Opcode) { case Instruction::VarArg: - case Instruction::Cast: { - Value *V = getValue(Raw->Ty, Raw->Arg1); - const Type *Ty = getType(Raw->Arg2); - if (Ty == 0) throw std::string("Invalid cast!\n"); - if (Raw->Opcode == Instruction::Cast) - return new CastInst(V, Ty); - else - return new VarArgInst(V, Ty); - } + return new VarArgInst(getValue(Raw->Ty, Raw->Arg1), getType(Raw->Arg2)); + case Instruction::Cast: + return new CastInst(getValue(Raw->Ty, Raw->Arg1), getType(Raw->Arg2)); case Instruction::PHINode: { PHINode *PN = new PHINode(Raw->Ty); switch (Raw->NumOperands) { @@ -255,11 +247,8 @@ if ((args.size() & 1) != 0) // Must be pairs of type/value throw std::string("Invalid call instruction!"); - for (unsigned i = 0; i < args.size(); i+=2) { - const Type *Ty = getType(args[i]); - if (Ty == 0) throw std::string("Invalid call instruction!"); - Params.push_back(getValue(Ty, args[i+1])); - } + for (unsigned i = 0; i < args.size(); i += 2) + Params.push_back(getValue(getType(args[i]), args[i+1])); delete Raw->VarArgs; } } Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.73 llvm/lib/Bytecode/Reader/Reader.cpp:1.74 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.73 Thu Oct 9 13:25:19 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 13:36:26 2003 @@ -49,17 +49,15 @@ } const Type *BytecodeParser::getType(unsigned ID) { - if (ID < Type::NumPrimitiveIDs) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); - if (T) return T; - } + if (ID < Type::NumPrimitiveIDs) + if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + return T; //cerr << "Looking up Type ID: " << ID << "\n"; - if (ID < Type::NumPrimitiveIDs) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); - if (T) return T; // Asked for a primitive type... - } + if (ID < Type::NumPrimitiveIDs) + if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + return T; // Asked for a primitive type... // Otherwise, derived types need offset... ID -= FirstDerivedTyID; @@ -73,7 +71,7 @@ if (ID < FunctionTypeValues.size()) return FunctionTypeValues[ID].get(); - return 0; + throw std::string("Illegal type reference!"); } int BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) { @@ -221,9 +219,7 @@ if (read_vbr(Buf, EndBuf, NumEntries) || read_vbr(Buf, EndBuf, Typ)) throw Error_readvbr; const Type *Ty = getType(Typ); - if (Ty == 0) throw std::string("Invalid type read in symbol table."); - - BCR_TRACE(3, "Plane Type: '" << Ty << "' with " << NumEntries << + BCR_TRACE(3, "Plane Type: '" << *Ty << "' with " << NumEntries << " entries\n"); for (unsigned i = 0; i < NumEntries; ++i) { @@ -435,7 +431,7 @@ } const Type *Ty = getType(SlotNo); - if (!Ty || !isa(Ty)) + if (!isa(Ty)) throw std::string("Global not pointer type! Ty = " + Ty->getDescription()); @@ -462,11 +458,10 @@ if (read_vbr(Buf, End, FnSignature)) throw Error_readvbr; while (FnSignature != Type::VoidTyID) { // List is terminated by Void const Type *Ty = getType(FnSignature); - if (!Ty || !isa(Ty) || - !isa(cast(Ty)->getElementType())) { + if (!isa(Ty) || + !isa(cast(Ty)->getElementType())) throw std::string("Function not ptr to func type! Ty = " + Ty->getDescription()); - } // We create functions by passing the underlying FunctionType to create... Ty = cast(Ty)->getElementType(); From lattner at cs.uiuc.edu Thu Oct 9 15:23:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:23:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp InstructionReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200310092022.PAA13645@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.55 -> 1.56 InstructionReader.cpp updated: 1.55 -> 1.56 Reader.cpp updated: 1.73 -> 1.74 ReaderInternals.h updated: 1.54 -> 1.55 --- Log message: Major refactoring of the bytecode reader. This includes the following changes: * BytecodeReader::getType(...) used to return a null pointer on error. This was only checked about half the time. Now we convert it to throw an exception, and delete the half that checked for error. This was checked in before, but psmith crashed and lost the change :( * insertValue no longer returns -1 on error, so callers don't need to check for it. * Substantial rewrite of InstructionReader.cpp, to use more efficient, simpler, data structures. This provides another 5% speedup. This also makes the code much easier to read and understand. --- Diffs of the changes: (+169 -313) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.55 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.56 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.55 Sat Oct 4 15:00:03 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Thu Oct 9 15:22:47 2003 @@ -27,7 +27,6 @@ unsigned Typ; if (read_vbr(Buf, EndBuf, Typ)) return Val; const Type *RetType = getType(Typ); - if (RetType == 0) return Val; unsigned NumParams; if (read_vbr(Buf, EndBuf, NumParams)) return Val; @@ -35,9 +34,7 @@ std::vector Params; while (NumParams--) { if (read_vbr(Buf, EndBuf, Typ)) return Val; - const Type *Ty = getType(Typ); - if (Ty == 0) return Val; - Params.push_back(Ty); + Params.push_back(getType(Typ)); } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; @@ -49,7 +46,6 @@ unsigned ElTyp; if (read_vbr(Buf, EndBuf, ElTyp)) return Val; const Type *ElementType = getType(ElTyp); - if (ElementType == 0) return Val; unsigned NumElements; if (read_vbr(Buf, EndBuf, NumElements)) return Val; @@ -64,10 +60,7 @@ if (read_vbr(Buf, EndBuf, Typ)) return Val; while (Typ) { // List is terminated by void/0 typeid - const Type *Ty = getType(Typ); - if (Ty == 0) return Val; - Elements.push_back(Ty); - + Elements.push_back(getType(Typ)); if (read_vbr(Buf, EndBuf, Typ)) return Val; } @@ -77,9 +70,7 @@ unsigned ElTyp; if (read_vbr(Buf, EndBuf, ElTyp)) return Val; BCR_TRACE(5, "Pointer Type Constant #" << ElTyp << "\n"); - const Type *ElementType = getType(ElTyp); - if (ElementType == 0) return Val; - return PointerType::get(ElementType); + return PointerType::get(getType(ElTyp)); } case Type::OpaqueTyID: { @@ -169,9 +160,8 @@ if (read_vbr(Buf, EndBuf, ArgValSlot)) throw Error_readvbr; if (read_vbr(Buf, EndBuf, ArgTypeSlot)) throw Error_readvbr; const Type *ArgTy = getType(ArgTypeSlot); - if (ArgTy == 0) throw std::string("Argument type slot not found."); - BCR_TRACE(4, "CE Arg " << i << ": Type: '" << ArgTy << "' slot: " + BCR_TRACE(4, "CE Arg " << i << ": Type: '" << *ArgTy << "' slot: " << ArgValSlot << "\n"); // Get the arg value from its slot if it exists, otherwise a placeholder @@ -355,27 +345,25 @@ if (read_vbr(Buf, EndBuf, NumEntries) || read_vbr(Buf, EndBuf, Typ)) throw Error_readvbr; - const Type *Ty = getType(Typ); - if (Ty == 0) throw std::string("Invalid type read."); - BCR_TRACE(3, "Type: '" << Ty << "' NumEntries: " << NumEntries << "\n"); - if (Typ == Type::TypeTyID) { + BCR_TRACE(3, "Type: 'type' NumEntries: " << NumEntries << "\n"); parseTypeConstants(Buf, EndBuf, TypeTab, NumEntries); } else { + const Type *Ty = getType(Typ); + BCR_TRACE(3, "Type: '" << *Ty << "' NumEntries: " << NumEntries << "\n"); + for (unsigned i = 0; i < NumEntries; ++i) { Constant *C = parseConstantValue(Buf, EndBuf, Ty); assert(C && "parseConstantValue returned NULL!"); BCR_TRACE(4, "Read Constant: '" << *C << "'\n"); - int Slot; - if ((Slot = insertValue(C, Tab)) == -1) - throw std::string("Could not insert value into ValueTable."); + unsigned Slot = insertValue(C, Tab); // If we are reading a function constant table, make sure that we adjust // the slot number to be the real global constant number. // if (&Tab != &ModuleValues && Typ < ModuleValues.size()) Slot += ModuleValues[Typ]->size(); - ResolveReferencesToValue(C, (unsigned)Slot); + ResolveReferencesToValue(C, Slot); } } } Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.55 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.55 Thu Oct 9 13:25:19 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 15:22:47 2003 @@ -6,9 +6,6 @@ // Note that this library should be as fast as possible, reentrant, and // threadsafe!! // -// TODO: Change from getValue(Raw.Arg1) etc, to getArg(Raw, 1) -// Make it check type, so that casts are checked. -// //===----------------------------------------------------------------------===// #include "ReaderInternals.h" @@ -17,11 +14,21 @@ #include "llvm/iPHINode.h" #include "llvm/iOther.h" -std::auto_ptr -BytecodeParser::ParseRawInst(const unsigned char *&Buf, - const unsigned char *EndBuf) { +struct RawInst { // The raw fields out of the bytecode stream... + unsigned NumOperands; + unsigned Opcode; + unsigned Type; + + RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, + std::vector &Args); + +}; + + + +RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, + std::vector &Args) { unsigned Op, Typ; - std::auto_ptr Result = std::auto_ptr(new RawInst()); if (read(Buf, EndBuf, Op)) throw std::string("Error reading from buffer."); @@ -29,20 +36,20 @@ // -------------------------- // 01-00: Opcode type, fixed to 1. // 07-02: Opcode - Result->NumOperands = (Op >> 0) & 03; - Result->Opcode = (Op >> 2) & 63; + Opcode = (Op >> 2) & 63; + Args.resize((Op >> 0) & 03); - switch (Result->NumOperands) { + switch (Args.size()) { case 1: // bits Instruction format: // -------------------------- // 19-08: Resulting type plane // 31-20: Operand #1 (if set to (2^12-1), then zero operands) // - Result->Ty = getType((Op >> 8) & 4095); - Result->Arg1 = (Op >> 20) & 4095; - if (Result->Arg1 == 4095) // Handle special encoding for 0 operands... - Result->NumOperands = 0; + Type = (Op >> 8) & 4095; + Args[0] = (Op >> 20) & 4095; + if (Args[0] == 4095) // Handle special encoding for 0 operands... + Args.resize(0); break; case 2: // bits Instruction format: @@ -51,9 +58,9 @@ // 23-16: Operand #1 // 31-24: Operand #2 // - Result->Ty = getType((Op >> 8) & 255); - Result->Arg1 = (Op >> 16) & 255; - Result->Arg2 = (Op >> 24) & 255; + Type = (Op >> 8) & 255; + Args[0] = (Op >> 16) & 255; + Args[1] = (Op >> 24) & 255; break; case 3: // bits Instruction format: @@ -63,159 +70,101 @@ // 25-20: Operand #2 // 31-26: Operand #3 // - Result->Ty = getType((Op >> 8) & 63); - Result->Arg1 = (Op >> 14) & 63; - Result->Arg2 = (Op >> 20) & 63; - Result->Arg3 = (Op >> 26) & 63; + Type = (Op >> 8) & 63; + Args[0] = (Op >> 14) & 63; + Args[1] = (Op >> 20) & 63; + Args[2] = (Op >> 26) & 63; break; case 0: Buf -= 4; // Hrm, try this again... - if (read_vbr(Buf, EndBuf, Result->Opcode)) + if (read_vbr(Buf, EndBuf, Opcode)) throw std::string("Error reading from buffer."); - Result->Opcode >>= 2; - if (read_vbr(Buf, EndBuf, Typ)) + Opcode >>= 2; + if (read_vbr(Buf, EndBuf, Type)) throw std::string("Error reading from buffer."); - Result->Ty = getType(Typ); - if (Result->Ty == 0) - throw std::string("Invalid type read in instruction."); - if (read_vbr(Buf, EndBuf, Result->NumOperands)) + + unsigned NumOperands; + if (read_vbr(Buf, EndBuf, NumOperands)) throw std::string("Error reading from buffer."); + Args.resize(NumOperands); - switch (Result->NumOperands) { - case 0: + if (NumOperands == 0) throw std::string("Zero-argument instruction found; this is invalid."); - case 1: - if (read_vbr(Buf, EndBuf, Result->Arg1)) - throw std::string("Error reading from buffer"); - break; - case 2: - if (read_vbr(Buf, EndBuf, Result->Arg1) || - read_vbr(Buf, EndBuf, Result->Arg2)) - throw std::string("Error reading from buffer"); - break; - case 3: - if (read_vbr(Buf, EndBuf, Result->Arg1) || - read_vbr(Buf, EndBuf, Result->Arg2) || - read_vbr(Buf, EndBuf, Result->Arg3)) - throw std::string("Error reading from buffer"); - break; - default: - if (read_vbr(Buf, EndBuf, Result->Arg1) || - read_vbr(Buf, EndBuf, Result->Arg2)) - throw std::string("Error reading from buffer"); - - // Allocate a vector to hold arguments 3, 4, 5, 6 ... - Result->VarArgs = new std::vector(Result->NumOperands-2); - for (unsigned a = 0; a < Result->NumOperands-2; a++) - if (read_vbr(Buf, EndBuf, (*Result->VarArgs)[a])) - throw std::string("Error reading from buffer"); - break; - } - if (align32(Buf, EndBuf)) + for (unsigned i = 0; i != NumOperands; ++i) + if (read_vbr(Buf, EndBuf, Args[i])) + throw std::string("Error reading from buffer"); + if (align32(Buf, EndBuf)) throw std::string("Unaligned bytecode buffer."); break; } - -#if 0 - std::cerr << "NO: " << Result->NumOperands << " opcode: " << Result->Opcode - << " Ty: "<< Result->Ty->getDescription()<< " arg1: "<< Result->Arg1 - << " arg2: " << Result->Arg2 << " arg3: " << Result->Arg3 << "\n"; -#endif - return Result; } Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf, const unsigned char *EndBuf) { - std::auto_ptr Raw = ParseRawInst(Buf, EndBuf); + std::vector Args; + RawInst RI(Buf, EndBuf, Args); + const Type *InstTy = getType(RI.Type); + + if (RI.Opcode >= Instruction::BinaryOpsBegin && + RI.Opcode < Instruction::BinaryOpsEnd && Args.size() == 2) + return BinaryOperator::create((Instruction::BinaryOps)RI.Opcode, + getValue(InstTy, Args[0]), + getValue(InstTy, Args[1])); - if (Raw->Opcode >= Instruction::BinaryOpsBegin && - Raw->Opcode < Instruction::BinaryOpsEnd && Raw->NumOperands == 2) - return BinaryOperator::create((Instruction::BinaryOps)Raw->Opcode, - getValue(Raw->Ty, Raw->Arg1), - getValue(Raw->Ty, Raw->Arg2)); - - switch (Raw->Opcode) { + switch (RI.Opcode) { case Instruction::VarArg: - case Instruction::Cast: { - Value *V = getValue(Raw->Ty, Raw->Arg1); - const Type *Ty = getType(Raw->Arg2); - if (Ty == 0) throw std::string("Invalid cast!\n"); - if (Raw->Opcode == Instruction::Cast) - return new CastInst(V, Ty); - else - return new VarArgInst(V, Ty); - } + return new VarArgInst(getValue(InstTy, Args[0]), getType(Args[1])); + case Instruction::Cast: + return new CastInst(getValue(InstTy, Args[0]), getType(Args[1])); case Instruction::PHINode: { - PHINode *PN = new PHINode(Raw->Ty); - switch (Raw->NumOperands) { - case 0: - case 1: - case 3: - delete PN; + if (Args.size() == 0 || (Args.size() & 1)) throw std::string("Invalid phi node encountered!\n"); - case 2: - PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); - break; - default: - PN->addIncoming(getValue(Raw->Ty, Raw->Arg1), getBasicBlock(Raw->Arg2)); - if (Raw->VarArgs->size() & 1) { - delete PN; - throw std::string("PHI Node with ODD number of arguments!\n"); - } else { - std::vector &args = *Raw->VarArgs; - for (unsigned i = 0; i < args.size(); i+=2) - PN->addIncoming(getValue(Raw->Ty, args[i]), getBasicBlock(args[i+1])); - } - delete Raw->VarArgs; - break; - } + + PHINode *PN = new PHINode(InstTy); + for (unsigned i = 0, e = Args.size(); i != e; i += 2) + PN->addIncoming(getValue(InstTy, Args[i]), getBasicBlock(Args[i+1])); return PN; } case Instruction::Shl: case Instruction::Shr: - return new ShiftInst((Instruction::OtherOps)Raw->Opcode, - getValue(Raw->Ty, Raw->Arg1), - getValue(Type::UByteTyID, Raw->Arg2)); + return new ShiftInst((Instruction::OtherOps)RI.Opcode, + getValue(InstTy, Args[0]), + getValue(Type::UByteTyID, Args[1])); case Instruction::Ret: - if (Raw->NumOperands == 0) + if (Args.size() == 0) return new ReturnInst(); - else if (Raw->NumOperands == 1) - return new ReturnInst(getValue(Raw->Ty, Raw->Arg1)); + else if (Args.size() == 1) + return new ReturnInst(getValue(InstTy, Args[0])); break; case Instruction::Br: - if (Raw->NumOperands == 1) - return new BranchInst(getBasicBlock(Raw->Arg1)); - else if (Raw->NumOperands == 3) - return new BranchInst(getBasicBlock(Raw->Arg1), getBasicBlock(Raw->Arg2), - getValue(Type::BoolTyID , Raw->Arg3)); + if (Args.size() == 1) + return new BranchInst(getBasicBlock(Args[0])); + else if (Args.size() == 3) + return new BranchInst(getBasicBlock(Args[0]), getBasicBlock(Args[1]), + getValue(Type::BoolTyID , Args[2])); throw std::string("Invalid number of operands for a 'br' instruction!"); case Instruction::Switch: { - SwitchInst *I = new SwitchInst(getValue(Raw->Ty, Raw->Arg1), - getBasicBlock(Raw->Arg2)); - if (Raw->NumOperands < 3) - return I; - - if (Raw->NumOperands == 3 || Raw->VarArgs->size() & 1) { - delete I; + if (Args.size() & 1) throw std::string("Switch statement with odd number of arguments!"); - } - - std::vector &args = *Raw->VarArgs; - for (unsigned i = 0; i < args.size(); i += 2) - I->addCase(cast(getValue(Raw->Ty, args[i])), - getBasicBlock(args[i+1])); - delete Raw->VarArgs; + SwitchInst *I = new SwitchInst(getValue(InstTy, Args[0]), + getBasicBlock(Args[1])); + for (unsigned i = 2, e = Args.size(); i != e; i += 2) + I->addCase(cast(getValue(InstTy, Args[i])), + getBasicBlock(Args[i+1])); return I; } case Instruction::Call: { - Value *F = getValue(Raw->Ty, Raw->Arg1); + if (Args.size() == 0) + throw std::string("Invalid call instruction encountered!"); + + Value *F = getValue(InstTy, Args[0]); // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); @@ -229,45 +178,26 @@ if (!FTy->isVarArg()) { FunctionType::ParamTypes::const_iterator It = PL.begin(); - switch (Raw->NumOperands) { - case 0: throw std::string("Invalid call instruction encountered!"); - case 1: break; - case 2: Params.push_back(getValue(*It++, Raw->Arg2)); break; - case 3: Params.push_back(getValue(*It++, Raw->Arg2)); - if (It == PL.end()) throw std::string("Invalid call instruction!"); - Params.push_back(getValue(*It++, Raw->Arg3)); break; - default: - Params.push_back(getValue(*It++, Raw->Arg2)); - { - std::vector &args = *Raw->VarArgs; - for (unsigned i = 0; i < args.size(); i++) { - if (It == PL.end()) throw std::string("Invalid call instruction!"); - Params.push_back(getValue(*It++, args[i])); - } - } - delete Raw->VarArgs; + for (unsigned i = 1, e = Args.size(); i != e; ++i) { + if (It == PL.end()) throw std::string("Invalid call instruction!"); + Params.push_back(getValue(*It++, Args[i])); } if (It != PL.end()) throw std::string("Invalid call instruction!"); } else { - if (Raw->NumOperands > 2) { - std::vector &args = *Raw->VarArgs; - if (args.size() < 1) throw std::string("Invalid call instruction!"); - - if ((args.size() & 1) != 0) // Must be pairs of type/value - throw std::string("Invalid call instruction!"); - for (unsigned i = 0; i < args.size(); i+=2) { - const Type *Ty = getType(args[i]); - if (Ty == 0) throw std::string("Invalid call instruction!"); - Params.push_back(getValue(Ty, args[i+1])); - } - delete Raw->VarArgs; - } + // FIXME: Args[1] is currently just a dummy padding field! + + if (Args.size() & 1) // Must be pairs of type/value + throw std::string("Invalid call instruction!"); + + for (unsigned i = 2, e = Args.size(); i != e; i += 2) + Params.push_back(getValue(getType(Args[i]), Args[i+1])); } return new CallInst(F, Params); } case Instruction::Invoke: { - Value *F = getValue(Raw->Ty, Raw->Arg1); + if (Args.size() < 3) throw std::string("Invalid invoke instruction!"); + Value *F = getValue(InstTy, Args[0]); // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); @@ -276,131 +206,99 @@ if (FTy == 0) throw std::string("Invoke to non function pointer value!"); std::vector Params; - const FunctionType::ParamTypes &PL = FTy->getParamTypes(); - std::vector &args = *Raw->VarArgs; - BasicBlock *Normal, *Except; + const FunctionType::ParamTypes &PL = FTy->getParamTypes(); + if (!FTy->isVarArg()) { - if (Raw->NumOperands < 3) throw std::string("Invalid call instruction!"); + Normal = getBasicBlock(Args[1]); + Except = getBasicBlock(Args[2]); - Normal = getBasicBlock(Raw->Arg2); - if (Raw->NumOperands == 3) - Except = getBasicBlock(Raw->Arg3); - else { - Except = getBasicBlock(args[0]); - - FunctionType::ParamTypes::const_iterator It = PL.begin(); - for (unsigned i = 1; i < args.size(); i++) { - if (It == PL.end()) throw std::string("Invalid invoke instruction!"); - Params.push_back(getValue(*It++, args[i])); - } - if (It != PL.end()) throw std::string("Invalid invoke instruction!"); + FunctionType::ParamTypes::const_iterator It = PL.begin(); + for (unsigned i = 3, e = Args.size(); i != e; ++i) { + if (It == PL.end()) throw std::string("Invalid invoke instruction!"); + Params.push_back(getValue(*It++, Args[i])); } + if (It != PL.end()) throw std::string("Invalid invoke instruction!"); } else { - if (args.size() < 4) throw std::string("Invalid invoke instruction!"); - if (args[0] != Type::LabelTyID || args[2] != Type::LabelTyID) + // FIXME: Args[1] is a dummy padding field + + if (Args.size() < 6) throw std::string("Invalid invoke instruction!"); + if (Args[2] != Type::LabelTyID || Args[4] != Type::LabelTyID) throw std::string("Invalid invoke instruction!"); - Normal = getBasicBlock(args[1]); - Except = getBasicBlock(args[3]); + Normal = getBasicBlock(Args[3]); + Except = getBasicBlock(Args[5]); - if ((args.size() & 1) != 0) // Must be pairs of type/value + if (Args.size() & 1) // Must be pairs of type/value throw std::string("Invalid invoke instruction!"); - for (unsigned i = 4; i < args.size(); i += 2) - Params.push_back(getValue(args[i], args[i+1])); + for (unsigned i = 6; i < Args.size(); i += 2) + Params.push_back(getValue(Args[i], Args[i+1])); } - if (Raw->NumOperands > 3) - delete Raw->VarArgs; return new InvokeInst(F, Normal, Except, Params); } case Instruction::Malloc: - if (Raw->NumOperands > 2) throw std::string("Invalid malloc instruction!"); - if (!isa(Raw->Ty)) + if (Args.size() > 2) throw std::string("Invalid malloc instruction!"); + if (!isa(InstTy)) throw std::string("Invalid malloc instruction!"); - return new MallocInst(cast(Raw->Ty)->getElementType(), - Raw->NumOperands ? getValue(Type::UIntTyID, - Raw->Arg1) : 0); + return new MallocInst(cast(InstTy)->getElementType(), + Args.size() ? getValue(Type::UIntTyID, + Args[0]) : 0); case Instruction::Alloca: - if (Raw->NumOperands > 2) throw std::string("Invalid alloca instruction!"); - if (!isa(Raw->Ty)) + if (Args.size() > 2) throw std::string("Invalid alloca instruction!"); + if (!isa(InstTy)) throw std::string("Invalid alloca instruction!"); - return new AllocaInst(cast(Raw->Ty)->getElementType(), - Raw->NumOperands ? getValue(Type::UIntTyID, - Raw->Arg1) : 0); + return new AllocaInst(cast(InstTy)->getElementType(), + Args.size() ? getValue(Type::UIntTyID, + Args[0]) : 0); case Instruction::Free: - if (!isa(Raw->Ty)) + if (!isa(InstTy)) throw std::string("Invalid free instruction!"); - return new FreeInst(getValue(Raw->Ty, Raw->Arg1)); + return new FreeInst(getValue(InstTy, Args[0])); case Instruction::GetElementPtr: { - std::vector Idx; - if (!isa(Raw->Ty)) + if (Args.size() == 0 || !isa(InstTy)) throw std::string("Invalid getelementptr instruction!"); - const CompositeType *TopTy = dyn_cast(Raw->Ty); - switch (Raw->NumOperands) { - case 0: throw std::string("Invalid getelementptr instruction!"); - case 1: break; - case 2: - if (!TopTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); - break; - case 3: { - if (!TopTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); - - const Type *ETy = GetElementPtrInst::getIndexedType(TopTy, Idx, true); - const CompositeType *ElTy = dyn_cast_or_null(ETy); - if (!ElTy) throw std::string("Invalid getelementptr instruction!"); + std::vector Idx; - Idx.push_back(getValue(ElTy->getIndexType(), Raw->Arg3)); - break; - } - default: - if (!TopTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(getValue(TopTy->getIndexType(), Raw->Arg2)); - - std::vector &args = *Raw->VarArgs; - for (unsigned i = 0, E = args.size(); i != E; ++i) { - const Type *ETy = GetElementPtrInst::getIndexedType(Raw->Ty, Idx, true); - const CompositeType *ElTy = dyn_cast_or_null(ETy); - if (!ElTy) throw std::string("Invalid getelementptr instruction!"); - Idx.push_back(getValue(ElTy->getIndexType(), args[i])); - } - delete Raw->VarArgs; - break; + const Type *NextTy = InstTy; + for (unsigned i = 1, e = Args.size(); i != e; ++i) { + const CompositeType *TopTy = dyn_cast_or_null(NextTy); + if (!TopTy) throw std::string("Invalid getelementptr instruction!"); + Idx.push_back(getValue(TopTy->getIndexType(), Args[i])); + NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); } - return new GetElementPtrInst(getValue(Raw->Ty, Raw->Arg1), Idx); + return new GetElementPtrInst(getValue(InstTy, Args[0]), Idx); } case 62: // volatile load case Instruction::Load: - if (Raw->NumOperands != 1 || !isa(Raw->Ty)) + if (Args.size() != 1 || !isa(InstTy)) throw std::string("Invalid load instruction!"); - return new LoadInst(getValue(Raw->Ty, Raw->Arg1), "", Raw->Opcode == 62); + return new LoadInst(getValue(InstTy, Args[0]), "", RI.Opcode == 62); case 63: // volatile store case Instruction::Store: { - if (!isa(Raw->Ty) || Raw->NumOperands != 2) + if (!isa(InstTy) || Args.size() != 2) throw std::string("Invalid store instruction!"); - Value *Ptr = getValue(Raw->Ty, Raw->Arg2); + Value *Ptr = getValue(InstTy, Args[1]); const Type *ValTy = cast(Ptr->getType())->getElementType(); - return new StoreInst(getValue(ValTy, Raw->Arg1), Ptr, Raw->Opcode == 63); + return new StoreInst(getValue(ValTy, Args[0]), Ptr, RI.Opcode == 63); } case Instruction::Unwind: - if (Raw->NumOperands != 0) throw std::string("Invalid unwind instruction!"); + if (Args.size() != 0) throw std::string("Invalid unwind instruction!"); return new UnwindInst(); - } // end switch(Raw->Opcode) + } // end switch(RI.Opcode) - std::cerr << "Unrecognized instruction! " << Raw->Opcode + std::cerr << "Unrecognized instruction! " << RI.Opcode << " ADDR = 0x" << (void*)Buf << "\n"; throw std::string("Unrecognized instruction!"); } Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.73 llvm/lib/Bytecode/Reader/Reader.cpp:1.74 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.73 Thu Oct 9 13:25:19 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 15:22:47 2003 @@ -49,17 +49,15 @@ } const Type *BytecodeParser::getType(unsigned ID) { - if (ID < Type::NumPrimitiveIDs) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); - if (T) return T; - } + if (ID < Type::NumPrimitiveIDs) + if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + return T; //cerr << "Looking up Type ID: " << ID << "\n"; - if (ID < Type::NumPrimitiveIDs) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); - if (T) return T; // Asked for a primitive type... - } + if (ID < Type::NumPrimitiveIDs) + if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + return T; // Asked for a primitive type... // Otherwise, derived types need offset... ID -= FirstDerivedTyID; @@ -73,10 +71,10 @@ if (ID < FunctionTypeValues.size()) return FunctionTypeValues[ID].get(); - return 0; + throw std::string("Illegal type reference!"); } -int BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) { +unsigned BytecodeParser::insertValue(Value *Val, ValueTable &ValueTab) { assert((!HasImplicitZeroInitializer || !isa(Val) || Val->getType()->isPrimitiveType() || !cast(Val)->isNullValue()) && @@ -200,10 +198,7 @@ while (Buf < EndBuf) { Instruction *Inst = ParseInstruction(Buf, EndBuf); - if (insertValue(Inst, Values) == -1) { - throw std::string("Could not insert value."); - } - + insertValue(Inst, Values); BB->getInstList().push_back(Inst); BCR_TRACE(4, Inst); } @@ -221,9 +216,7 @@ if (read_vbr(Buf, EndBuf, NumEntries) || read_vbr(Buf, EndBuf, Typ)) throw Error_readvbr; const Type *Ty = getType(Typ); - if (Ty == 0) throw std::string("Invalid type read in symbol table."); - - BCR_TRACE(3, "Plane Type: '" << Ty << "' with " << NumEntries << + BCR_TRACE(3, "Plane Type: '" << *Ty << "' with " << NumEntries << " entries\n"); for (unsigned i = 0; i < NumEntries; ++i) { @@ -328,10 +321,8 @@ const FunctionType::ParamTypes &Params =F->getFunctionType()->getParamTypes(); Function::aiterator AI = F->abegin(); for (FunctionType::ParamTypes::const_iterator It = Params.begin(); - It != Params.end(); ++It, ++AI) { - if (insertValue(AI, Values) == -1) - throw std::string("Error reading function arguments!"); - } + It != Params.end(); ++It, ++AI) + insertValue(AI, Values); // Keep track of how many basic blocks we have read in... unsigned BlockNum = 0; @@ -435,7 +426,7 @@ } const Type *Ty = getType(SlotNo); - if (!Ty || !isa(Ty)) + if (!isa(Ty)) throw std::string("Global not pointer type! Ty = " + Ty->getDescription()); @@ -444,10 +435,8 @@ // Create the global variable... GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Linkage, 0, "", TheModule); - int DestSlot = insertValue(GV, ModuleValues); - if (DestSlot == -1) throw Error_DestSlot; BCR_TRACE(2, "Global Variable of type: " << *Ty << "\n"); - ResolveReferencesToValue(GV, (unsigned)DestSlot); + ResolveReferencesToValue(GV, insertValue(GV, ModuleValues)); if (VarType & 2) { // Does it have an initializer? unsigned InitSlot; @@ -462,11 +451,10 @@ if (read_vbr(Buf, End, FnSignature)) throw Error_readvbr; while (FnSignature != Type::VoidTyID) { // List is terminated by Void const Type *Ty = getType(FnSignature); - if (!Ty || !isa(Ty) || - !isa(cast(Ty)->getElementType())) { + if (!isa(Ty) || + !isa(cast(Ty)->getElementType())) throw std::string("Function not ptr to func type! Ty = " + Ty->getDescription()); - } // We create functions by passing the underlying FunctionType to create... Ty = cast(Ty)->getElementType(); @@ -479,9 +467,8 @@ // Insert the placeholder... Function *Func = new Function(cast(Ty), GlobalValue::InternalLinkage, "", TheModule); - int DestSlot = insertValue(Func, ModuleValues); - if (DestSlot == -1) throw Error_DestSlot; - ResolveReferencesToValue(Func, (unsigned)DestSlot); + unsigned DestSlot = insertValue(Func, ModuleValues); + ResolveReferencesToValue(Func, DestSlot); // Keep track of this information in a list that is emptied as functions are // loaded... Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.54 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.55 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.54 Thu Oct 9 13:25:19 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 15:22:47 2003 @@ -14,8 +14,6 @@ #include "llvm/Bytecode/Primitives.h" #include #include -#include -class Module; // Enable to trace to figure out what the heck is going on when parsing fails //#define TRACE_LEVEL 10 @@ -27,17 +25,6 @@ #define BCR_TRACE(n, X) #endif -struct RawInst { // The raw fields out of the bytecode stream... - unsigned NumOperands; - unsigned Opcode; - const Type *Ty; - unsigned Arg1, Arg2; - union { - unsigned Arg3; - std::vector *VarArgs; // Contains arg #3,4,5... if NumOperands > 3 - }; -}; - struct LazyFunctionInfo { const unsigned char *Buf, *EndBuf; unsigned FunctionSlot; @@ -62,11 +49,9 @@ Module* releaseModule() { // Since we're losing control of this Module, we must hand it back complete - materializeModule(); + Module *M = ModuleProvider::releaseModule(); freeState(); - Module *tempM = TheModule; - TheModule = 0; - return tempM; + return M; } void ParseBytecode(const unsigned char *Buf, unsigned Length, @@ -165,8 +150,6 @@ Instruction *ParseInstruction(const unsigned char *&Buf, const unsigned char *End); - std::auto_ptr ParseRawInst(const unsigned char *&Buf, - const unsigned char *End); void ParseConstantPool(const unsigned char *&Buf, const unsigned char *EndBuf, ValueTable &Tab, TypeValuesListTy &TypeTab); @@ -185,7 +168,7 @@ BasicBlock *getBasicBlock(unsigned ID); Constant *getConstantValue(const Type *Ty, unsigned num); - int insertValue(Value *V, ValueTable &Table); // -1 = Failure + unsigned insertValue(Value *V, ValueTable &Table); unsigned getTypeSlot(const Type *Ty); From lattner at cs.uiuc.edu Thu Oct 9 15:31:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:31:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200310092030.PAA14456@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.74 -> 1.75 --- Log message: Remove potentially N^2 algorithm from symbol table reader. No speedup in practice though --- Diffs of the changes: (+13 -5) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.74 llvm/lib/Bytecode/Reader/Reader.cpp:1.75 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.74 Thu Oct 9 15:22:47 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 15:30:04 2003 @@ -219,6 +219,9 @@ BCR_TRACE(3, "Plane Type: '" << *Ty << "' with " << NumEntries << " entries\n"); + Function::iterator BlockIterator; + unsigned CurBlockIteratorIdx = ~0; + for (unsigned i = 0; i < NumEntries; ++i) { // Symtab entry: [def slot #][name] unsigned slot; @@ -231,12 +234,17 @@ if (Typ == Type::TypeTyID) V = (Value*)getType(slot); else if (Typ == Type::LabelTyID) { - if (CurrentFunction) { - // FIXME: THIS IS N^2!!! - Function::iterator BlockIterator = CurrentFunction->begin(); - std::advance(BlockIterator, slot); - V = BlockIterator; + if (!CurrentFunction) + throw std::string("Basic blocks don't exist at global scope!"); + + if (slot < CurBlockIteratorIdx) { + CurBlockIteratorIdx = 0; + BlockIterator = CurrentFunction->begin(); } + + std::advance(BlockIterator, slot-CurBlockIteratorIdx); + CurBlockIteratorIdx = slot; + V = BlockIterator; } else V = getValue(Typ, slot, false); // Find mapping... if (V == 0) throw std::string("Failed value look-up."); From lattner at cs.uiuc.edu Thu Oct 9 15:32:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:32:01 2003 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Message-ID: <200310092031.PAA14633@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: ExternalFunctions.cpp updated: 1.58 -> 1.59 --- Log message: Do not read past the end of the contained type list --- Diffs of the changes: (+2 -2) Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.58 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.59 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.58 Fri Sep 5 13:42:00 2003 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Thu Oct 9 15:31:18 2003 @@ -57,8 +57,8 @@ // composite function name should be. std::string ExtName = "lle_"; const FunctionType *MT = M->getFunctionType(); - for (unsigned i = 0; const Type *Ty = MT->getContainedType(i); ++i) - ExtName += getTypeID(Ty); + for (unsigned i = 0, e = MT->getNumContainedTypes(); i != e; ++i) + ExtName += getTypeID(MT->getContainedType(i)); ExtName += "_" + M->getName(); //std::cout << "Tried: '" << ExtName << "'\n"; From lattner at cs.uiuc.edu Thu Oct 9 15:36:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:36:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h Message-ID: <200310092035.PAA20084@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: DerivedTypes.h updated: 1.43 -> 1.44 --- Log message: Make getContainedType more efficient by not returning null if out of range! --- Diffs of the changes: (+3 -4) Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.43 llvm/include/llvm/DerivedTypes.h:1.44 --- llvm/include/llvm/DerivedTypes.h:1.43 Fri Oct 3 13:57:52 2003 +++ llvm/include/llvm/DerivedTypes.h Thu Oct 9 15:35:09 2003 @@ -156,8 +156,7 @@ virtual const Type *getContainedType(unsigned i) const { - return i == 0 ? ResultType : - (i <= ParamTys.size() ? ParamTys[i-1].get() : 0); + return i == 0 ? ResultType.get() : ParamTys[i-1].get(); } virtual unsigned getNumContainedTypes() const { return ParamTys.size()+1; } @@ -239,7 +238,7 @@ inline const ElementTypes &getElementTypes() const { return ETypes; } virtual const Type *getContainedType(unsigned i) const { - return i < ETypes.size() ? ETypes[i].get() : 0; + return ETypes[i].get(); } virtual unsigned getNumContainedTypes() const { return ETypes.size(); } @@ -289,7 +288,7 @@ inline const Type *getElementType() const { return ElementType; } virtual const Type *getContainedType(unsigned i) const { - return i == 0 ? ElementType.get() : 0; + return ElementType.get(); } virtual unsigned getNumContainedTypes() const { return 1; } From lattner at cs.uiuc.edu Thu Oct 9 15:36:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:36:08 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200310092035.PAA20427@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.30 -> 1.31 --- Log message: Make getContainedType more efficient by not returning null if out of range! --- Diffs of the changes: (+4 -4) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.30 llvm/include/llvm/Type.h:1.31 --- llvm/include/llvm/Type.h:1.30 Thu Oct 2 18:35:45 2003 +++ llvm/include/llvm/Type.h Thu Oct 9 15:35:15 2003 @@ -202,11 +202,11 @@ /// getContainedType - This method is used to implement the type iterator /// (defined a the end of the file). For derived types, this returns the - /// types 'contained' in the derived type, returning 0 when 'i' becomes - /// invalid. This allows the user to iterate over the types in a struct, for - /// example, really easily. + /// types 'contained' in the derived type. /// - virtual const Type *getContainedType(unsigned i) const { return 0; } + virtual const Type *getContainedType(unsigned i) const { + assert(0 && "No contained types!"); + } /// getNumContainedTypes - Return the number of types in the derived type virtual unsigned getNumContainedTypes() const { return 0; } From lattner at cs.uiuc.edu Thu Oct 9 15:42:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:42:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/ConstantReader.cpp Reader.cpp Message-ID: <200310092041.PAA28505@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: ConstantReader.cpp updated: 1.56 -> 1.57 Reader.cpp updated: 1.75 -> 1.76 --- Log message: Change getConstantValue to throw an exception on error, not return null --- Diffs of the changes: (+7 -10) Index: llvm/lib/Bytecode/Reader/ConstantReader.cpp diff -u llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.56 llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.57 --- llvm/lib/Bytecode/Reader/ConstantReader.cpp:1.56 Thu Oct 9 15:22:47 2003 +++ llvm/lib/Bytecode/Reader/ConstantReader.cpp Thu Oct 9 15:41:16 2003 @@ -165,9 +165,7 @@ << ArgValSlot << "\n"); // Get the arg value from its slot if it exists, otherwise a placeholder - Constant *C = getConstantValue(ArgTy, ArgValSlot); - if (C == 0) throw std::string("No arg value or placeholder found."); - ArgVec.push_back(C); + ArgVec.push_back(getConstantValue(ArgTy, ArgValSlot)); } // Construct a ConstantExpr of the appropriate kind @@ -241,9 +239,7 @@ while (NumElements--) { // Read all of the elements of the constant. unsigned Slot; if (read_vbr(Buf, EndBuf, Slot)) throw Error_readvbr; - Constant *C = getConstantValue(AT->getElementType(), Slot); - if (!C) throw std::string("Unable to get const value of array slot."); - Elements.push_back(C); + Elements.push_back(getConstantValue(AT->getElementType(), Slot)); } return ConstantArray::get(AT, Elements); } @@ -256,9 +252,7 @@ for (unsigned i = 0; i < ET.size(); ++i) { unsigned Slot; if (read_vbr(Buf, EndBuf, Slot)) throw Error_readvbr; - Constant *C = getConstantValue(ET[i], Slot); - if (!C) throw std::string("Could not read const value in struct slot."); - Elements.push_back(C); + Elements.push_back(getConstantValue(ET[i], Slot)); } return ConstantStruct::get(ST, Elements); Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.75 llvm/lib/Bytecode/Reader/Reader.cpp:1.76 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.75 Thu Oct 9 15:30:04 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 15:41:16 2003 @@ -164,7 +164,10 @@ /// Constant *BytecodeParser::getConstantValue(const Type *Ty, unsigned Slot) { if (Value *V = getValue(Ty, Slot, false)) - return dyn_cast(V); // If we already have the value parsed... + if (Constant *C = dyn_cast(V)) + return C; // If we already have the value parsed, just return it + else + throw std::string("Reference of a value is expected to be a constant!"); std::pair Key(Ty, Slot); GlobalRefsType::iterator I = GlobalRefs.lower_bound(Key); From lattner at cs.uiuc.edu Thu Oct 9 15:45:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:45:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200310092044.PAA32137@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.31 -> 1.32 --- Log message: Kill warning when compiling in optimized mode --- Diffs of the changes: (+1 -0) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.31 llvm/include/llvm/Type.h:1.32 --- llvm/include/llvm/Type.h:1.31 Thu Oct 9 15:35:15 2003 +++ llvm/include/llvm/Type.h Thu Oct 9 15:43:55 2003 @@ -206,6 +206,7 @@ /// virtual const Type *getContainedType(unsigned i) const { assert(0 && "No contained types!"); + return 0; } /// getNumContainedTypes - Return the number of types in the derived type From lattner at cs.uiuc.edu Thu Oct 9 15:46:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 15:46:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp ReaderInternals.h Message-ID: <200310092045.PAA04079@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.56 -> 1.57 Reader.cpp updated: 1.76 -> 1.77 ReaderInternals.h updated: 1.55 -> 1.56 --- Log message: Pass a vector around to reduce dynamic allocation Throw the RawInst class in an anon namespace --- Diffs of the changes: (+17 -13) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.57 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 Thu Oct 9 15:22:47 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 15:45:42 2003 @@ -14,15 +14,16 @@ #include "llvm/iPHINode.h" #include "llvm/iOther.h" -struct RawInst { // The raw fields out of the bytecode stream... - unsigned NumOperands; - unsigned Opcode; - unsigned Type; - - RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, - std::vector &Args); - -}; +namespace { + struct RawInst { // The raw fields out of the bytecode stream... + unsigned NumOperands; + unsigned Opcode; + unsigned Type; + + RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, + std::vector &Args); + }; +} @@ -102,8 +103,9 @@ Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf, - const unsigned char *EndBuf) { - std::vector Args; + const unsigned char *EndBuf, + std::vector &Args) { + Args.clear(); RawInst RI(Buf, EndBuf, Args); const Type *InstTy = getType(RI.Type); Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.76 llvm/lib/Bytecode/Reader/Reader.cpp:1.77 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.76 Thu Oct 9 15:41:16 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 15:45:42 2003 @@ -200,7 +200,8 @@ BB = ParsedBasicBlocks[BlockNo]; while (Buf < EndBuf) { - Instruction *Inst = ParseInstruction(Buf, EndBuf); + std::vector Args; + Instruction *Inst = ParseInstruction(Buf, EndBuf, Args); insertValue(Inst, Values); BB->getInstList().push_back(Inst); BCR_TRACE(4, Inst); Index: llvm/lib/Bytecode/Reader/ReaderInternals.h diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.55 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.56 --- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.55 Thu Oct 9 15:22:47 2003 +++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 15:45:42 2003 @@ -149,7 +149,8 @@ unsigned BlockNo); Instruction *ParseInstruction(const unsigned char *&Buf, - const unsigned char *End); + const unsigned char *End, + std::vector &Args); void ParseConstantPool(const unsigned char *&Buf, const unsigned char *EndBuf, ValueTable &Tab, TypeValuesListTy &TypeTab); From lattner at cs.uiuc.edu Thu Oct 9 17:40:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 17:40:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp Message-ID: <200310092239.RAA21018@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.57 -> 1.58 Reader.cpp updated: 1.77 -> 1.78 --- Log message: Use the version of getValue that takes the type plane instead of the type if possible. This provides a consistent 8.5% speedup. --- Diffs of the changes: (+18 -17) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.57 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.58 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.57 Thu Oct 9 15:45:42 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 17:39:30 2003 @@ -112,34 +112,34 @@ if (RI.Opcode >= Instruction::BinaryOpsBegin && RI.Opcode < Instruction::BinaryOpsEnd && Args.size() == 2) return BinaryOperator::create((Instruction::BinaryOps)RI.Opcode, - getValue(InstTy, Args[0]), - getValue(InstTy, Args[1])); + getValue(RI.Type, Args[0]), + getValue(RI.Type, Args[1])); switch (RI.Opcode) { case Instruction::VarArg: - return new VarArgInst(getValue(InstTy, Args[0]), getType(Args[1])); + return new VarArgInst(getValue(RI.Type, Args[0]), getType(Args[1])); case Instruction::Cast: - return new CastInst(getValue(InstTy, Args[0]), getType(Args[1])); + return new CastInst(getValue(RI.Type, Args[0]), getType(Args[1])); case Instruction::PHINode: { if (Args.size() == 0 || (Args.size() & 1)) throw std::string("Invalid phi node encountered!\n"); PHINode *PN = new PHINode(InstTy); for (unsigned i = 0, e = Args.size(); i != e; i += 2) - PN->addIncoming(getValue(InstTy, Args[i]), getBasicBlock(Args[i+1])); + PN->addIncoming(getValue(RI.Type, Args[i]), getBasicBlock(Args[i+1])); return PN; } case Instruction::Shl: case Instruction::Shr: return new ShiftInst((Instruction::OtherOps)RI.Opcode, - getValue(InstTy, Args[0]), + getValue(RI.Type, Args[0]), getValue(Type::UByteTyID, Args[1])); case Instruction::Ret: if (Args.size() == 0) return new ReturnInst(); else if (Args.size() == 1) - return new ReturnInst(getValue(InstTy, Args[0])); + return new ReturnInst(getValue(RI.Type, Args[0])); break; case Instruction::Br: @@ -154,10 +154,10 @@ if (Args.size() & 1) throw std::string("Switch statement with odd number of arguments!"); - SwitchInst *I = new SwitchInst(getValue(InstTy, Args[0]), + SwitchInst *I = new SwitchInst(getValue(RI.Type, Args[0]), getBasicBlock(Args[1])); for (unsigned i = 2, e = Args.size(); i != e; i += 2) - I->addCase(cast(getValue(InstTy, Args[i])), + I->addCase(cast(getValue(RI.Type, Args[i])), getBasicBlock(Args[i+1])); return I; } @@ -166,7 +166,7 @@ if (Args.size() == 0) throw std::string("Invalid call instruction encountered!"); - Value *F = getValue(InstTy, Args[0]); + Value *F = getValue(RI.Type, Args[0]); // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); @@ -192,14 +192,14 @@ throw std::string("Invalid call instruction!"); for (unsigned i = 2, e = Args.size(); i != e; i += 2) - Params.push_back(getValue(getType(Args[i]), Args[i+1])); + Params.push_back(getValue(Args[i], Args[i+1])); } return new CallInst(F, Params); } case Instruction::Invoke: { if (Args.size() < 3) throw std::string("Invalid invoke instruction!"); - Value *F = getValue(InstTy, Args[0]); + Value *F = getValue(RI.Type, Args[0]); // Check to make sure we have a pointer to function type const PointerType *PTy = dyn_cast(F->getType()); @@ -261,7 +261,7 @@ case Instruction::Free: if (!isa(InstTy)) throw std::string("Invalid free instruction!"); - return new FreeInst(getValue(InstTy, Args[0])); + return new FreeInst(getValue(RI.Type, Args[0])); case Instruction::GetElementPtr: { if (Args.size() == 0 || !isa(InstTy)) @@ -277,21 +277,21 @@ NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); } - return new GetElementPtrInst(getValue(InstTy, Args[0]), Idx); + return new GetElementPtrInst(getValue(RI.Type, Args[0]), Idx); } case 62: // volatile load case Instruction::Load: if (Args.size() != 1 || !isa(InstTy)) throw std::string("Invalid load instruction!"); - return new LoadInst(getValue(InstTy, Args[0]), "", RI.Opcode == 62); + return new LoadInst(getValue(RI.Type, Args[0]), "", RI.Opcode == 62); case 63: // volatile store case Instruction::Store: { if (!isa(InstTy) || Args.size() != 2) throw std::string("Invalid store instruction!"); - Value *Ptr = getValue(InstTy, Args[1]); + Value *Ptr = getValue(RI.Type, Args[1]); const Type *ValTy = cast(Ptr->getType())->getElementType(); return new StoreInst(getValue(ValTy, Args[0]), Ptr, RI.Opcode == 63); } Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.77 llvm/lib/Bytecode/Reader/Reader.cpp:1.78 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.77 Thu Oct 9 15:45:42 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 17:39:30 2003 @@ -385,7 +385,8 @@ // Resolve forward references while (!ForwardReferences.empty()) { - std::map, Value*>::iterator I = ForwardReferences.begin(); + std::map, Value*>::iterator I = + ForwardReferences.begin(); unsigned type = I->first.first; unsigned Slot = I->first.second; Value *PlaceHolder = I->second; From lattner at cs.uiuc.edu Thu Oct 9 17:47:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 17:47:03 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/User.h Message-ID: <200310092246.RAA22242@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: User.h updated: 1.22 -> 1.23 --- Log message: Add a method to reserve space for operands --- Diffs of the changes: (+2 -0) Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.22 llvm/include/llvm/User.h:1.23 --- llvm/include/llvm/User.h:1.22 Mon Oct 6 12:36:49 2003 +++ llvm/include/llvm/User.h Thu Oct 9 17:45:59 2003 @@ -41,6 +41,8 @@ typedef std::vector::iterator op_iterator; typedef std::vector::const_iterator const_op_iterator; + void op_reserve(unsigned NumElements) { Operands.reserve(NumElements); } + inline op_iterator op_begin() { return Operands.begin(); } inline const_op_iterator op_begin() const { return Operands.begin(); } inline op_iterator op_end() { return Operands.end(); } From lattner at cs.uiuc.edu Thu Oct 9 17:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 17:48:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Message-ID: <200310092247.RAA22255@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: InstructionReader.cpp updated: 1.58 -> 1.59 --- Log message: Reserve space for PHI nodes when we read them in. This provides a VERY tasty 15% speedup on the testcase from Bill. --- Diffs of the changes: (+1 -0) Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.58 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.59 --- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.58 Thu Oct 9 17:39:30 2003 +++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 17:46:58 2003 @@ -125,6 +125,7 @@ throw std::string("Invalid phi node encountered!\n"); PHINode *PN = new PHINode(InstTy); + PN->op_reserve(Args.size()); for (unsigned i = 0, e = Args.size(); i != e; i += 2) PN->addIncoming(getValue(RI.Type, Args[i]), getBasicBlock(Args[i+1])); return PN; From lattner at cs.uiuc.edu Thu Oct 9 18:11:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 18:11:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200310092310.SAA26148@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.78 -> 1.79 --- Log message: Another 10% performance improvement by not using replaceAllUsesWith --- Diffs of the changes: (+20 -13) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.78 llvm/lib/Bytecode/Reader/Reader.cpp:1.79 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.78 Thu Oct 9 17:39:30 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 18:10:14 2003 @@ -269,7 +269,6 @@ BCR_TRACE(3, "Mutating forward refs!\n"); Value *VPH = I->second; // Get the placeholder... - VPH->replaceAllUsesWith(NewV); // If this is a global variable being resolved, remove the placeholder from @@ -382,25 +381,33 @@ throw std::string("Illegal basic block operand reference"); ParsedBasicBlocks.clear(); + // Resolve forward references. Replace any uses of a forward reference value + // with the real value. + + // replaceAllUsesWith is very inefficient for instructions which have a LARGE + // number of operands. PHI nodes often have forward references, and can also + // often have a very large number of operands. + std::map ForwardRefMapping; + for (std::map, Value*>::iterator + I = ForwardReferences.begin(), E = ForwardReferences.end(); + I != E; ++I) + ForwardRefMapping[I->second] = getValue(I->first.first, I->first.second, + false); + + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (Argument *A = dyn_cast(I->getOperand(i))) { + std::map::iterator It = ForwardRefMapping.find(A); + if (It != ForwardRefMapping.end()) I->setOperand(i, It->second); + } - // Resolve forward references while (!ForwardReferences.empty()) { std::map, Value*>::iterator I = ForwardReferences.begin(); - unsigned type = I->first.first; - unsigned Slot = I->first.second; Value *PlaceHolder = I->second; ForwardReferences.erase(I); - Value *NewVal = getValue(type, Slot, false); - if (NewVal == 0) - throw std::string("Unresolvable reference found: <" + - PlaceHolder->getType()->getDescription() + ">:" + - utostr(Slot) + "."); - - // Fixup all of the uses of this placeholder def... - PlaceHolder->replaceAllUsesWith(NewVal); - // Now that all the uses are gone, delete the placeholder... // If we couldn't find a def (error case), then leak a little // memory, because otherwise we can't remove all uses! From criswell at cs.uiuc.edu Thu Oct 9 20:13:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Oct 9 20:13:02 2003 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200310100112.UAA05694@choi.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.44 -> 1.45 --- Log message: Added the eon and perlbmk benchmarks. --- Diffs of the changes: (+40 -28) Index: llvm/configure diff -u llvm/configure:1.44 llvm/configure:1.45 --- llvm/configure:1.44 Thu Oct 9 10:44:26 2003 +++ llvm/configure Thu Oct 9 20:11:51 2003 @@ -1790,6 +1790,12 @@ ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CINT2000/197.parser/Makefile" + ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CINT2000/252.eon/Makefile" + + + ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CINT2000/253.perlbmk/Makefile" + + ac_config_commands="$ac_config_commands test/Programs/External/SPEC/CINT2000/254.gap/Makefile" @@ -4404,7 +4410,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4407 "configure"' > conftest.$ac_ext + echo '#line 4413 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5245,7 +5251,7 @@ # Provide some information about the compiler. -echo "$as_me:5248:" \ +echo "$as_me:5254:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6254,11 +6260,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6257: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6263: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6261: \$? = $ac_status" >&5 + echo "$as_me:6267: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6486,11 +6492,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6489: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6495: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6493: \$? = $ac_status" >&5 + echo "$as_me:6499: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6553,11 +6559,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6556: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6562: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6560: \$? = $ac_status" >&5 + echo "$as_me:6566: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8565,7 +8571,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10808: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10806: \$? = $ac_status" >&5 + echo "$as_me:10812: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10866,11 +10872,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10869: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10875: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10873: \$? = $ac_status" >&5 + echo "$as_me:10879: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12109,7 +12115,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13038: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13036: \$? = $ac_status" >&5 + echo "$as_me:13042: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13096,11 +13102,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13099: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13105: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13103: \$? = $ac_status" >&5 + echo "$as_me:13109: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15040,11 +15046,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15043: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15049: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15047: \$? = $ac_status" >&5 + echo "$as_me:15053: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15272,11 +15278,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15275: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15281: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15279: \$? = $ac_status" >&5 + echo "$as_me:15285: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15339,11 +15345,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15342: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15348: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15346: \$? = $ac_status" >&5 + echo "$as_me:15352: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17351,7 +17357,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Changes in directory llvm/autoconf: configure.ac updated: 1.39 -> 1.40 --- Log message: Added the eon and perlbmk benchmarks. --- Diffs of the changes: (+2 -0) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.39 llvm/autoconf/configure.ac:1.40 --- llvm/autoconf/configure.ac:1.39 Thu Oct 9 10:44:28 2003 +++ llvm/autoconf/configure.ac Thu Oct 9 20:11:54 2003 @@ -126,6 +126,8 @@ AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/181.mcf/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/186.crafty/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/197.parser/Makefile) +AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/252.eon/Makefile) +AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/253.perlbmk/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/254.gap/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/255.vortex/Makefile) AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/CINT2000/256.bzip2/Makefile) From lattner at cs.uiuc.edu Thu Oct 9 22:57:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 22:57:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200310100356.WAA27476@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.125 -> 1.126 --- Log message: Add better checking --- Diffs of the changes: (+6 -0) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.125 llvm/lib/AsmParser/llvmAsmParser.y:1.126 --- llvm/lib/AsmParser/llvmAsmParser.y:1.125 Thu Oct 2 14:00:34 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Oct 9 22:56:01 2003 @@ -1060,6 +1060,9 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { + if (!$5->get()->isFirstClassType()) + ThrowException("cast constant expression to a non-primitive type: '" + + $5->get()->getDescription() + "'!"); $$ = ConstantExpr::getCast($3, $5->get()); delete $5; } @@ -1632,6 +1635,9 @@ $$ = new ShiftInst($1, $2, $4); } | CAST ResolvedVal TO Types { + if (!$4->get()->isFirstClassType()) + ThrowException("cast instruction to a non-primitive type: '" + + $4->get()->getDescription() + "'!"); $$ = new CastInst($2, *$4); delete $4; } From lattner at cs.uiuc.edu Thu Oct 9 23:06:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 23:06:01 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2003-10-09-UnionInitializerBug.c Message-ID: <200310100405.XAA27587@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2003-10-09-UnionInitializerBug.c added (r1.1) --- Log message: New testcase --- Diffs of the changes: (+15 -0) Index: llvm/test/Regression/CFrontend/2003-10-09-UnionInitializerBug.c diff -c /dev/null llvm/test/Regression/CFrontend/2003-10-09-UnionInitializerBug.c:1.1 *** /dev/null Thu Oct 9 23:05:39 2003 --- llvm/test/Regression/CFrontend/2003-10-09-UnionInitializerBug.c Thu Oct 9 23:05:29 2003 *************** *** 0 **** --- 1,15 ---- + struct Foo { + unsigned a; + unsigned b; + unsigned c; + }; + + struct Bar { + union { + void **a; + struct Foo b; + }u; + }; + + struct Bar test = {0}; + From lattner at cs.uiuc.edu Thu Oct 9 23:55:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 23:55:01 2003 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y Message-ID: <200310100454.XAA30171@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.38 -> 1.39 llvmAsmParser.y updated: 1.126 -> 1.127 --- Log message: Accept 'weak' as a linkage type. For now, just turn it into linkonce linkage --- Diffs of the changes: (+3 -1) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.38 llvm/lib/AsmParser/Lexer.l:1.39 --- llvm/lib/AsmParser/Lexer.l:1.38 Mon Sep 8 13:54:47 2003 +++ llvm/lib/AsmParser/Lexer.l Thu Oct 9 23:54:02 2003 @@ -170,6 +170,7 @@ const { return CONST; } internal { return INTERNAL; } linkonce { return LINKONCE; } +weak { return WEAK; } appending { return APPENDING; } uninitialized { return EXTERNAL; } /* Deprecated, turn into external */ external { return EXTERNAL; } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.126 llvm/lib/AsmParser/llvmAsmParser.y:1.127 --- llvm/lib/AsmParser/llvmAsmParser.y:1.126 Thu Oct 9 22:56:01 2003 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Oct 9 23:54:02 2003 @@ -697,7 +697,7 @@ %token IMPLEMENTATION ZEROINITIALIZER TRUE FALSE BEGINTOK ENDTOK %token DECLARE GLOBAL CONSTANT VOLATILE -%token TO EXCEPT DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE APPENDING +%token TO EXCEPT DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE WEAK APPENDING %token OPAQUE NOT EXTERNAL TARGET ENDIAN POINTERSIZE LITTLE BIG // Basic Block Terminating Operators @@ -763,6 +763,7 @@ OptLinkage : INTERNAL { $$ = GlobalValue::InternalLinkage; } | LINKONCE { $$ = GlobalValue::LinkOnceLinkage; } | + WEAK { $$ = GlobalValue::LinkOnceLinkage; /* FIXME */ } | APPENDING { $$ = GlobalValue::AppendingLinkage; } | /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; From lattner at cs.uiuc.edu Thu Oct 9 23:55:10 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 23:55:10 2003 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll Message-ID: <200310100454.XAA30180@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalDCE: 2003-10-09-PreserveWeakGlobals.ll added (r1.1) --- Log message: new testcase. globaldce should not delete the global --- Diffs of the changes: (+6 -0) Index: llvm/test/Regression/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll diff -c /dev/null llvm/test/Regression/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll:1.1 *** /dev/null Thu Oct 9 23:54:33 2003 --- llvm/test/Regression/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll Thu Oct 9 23:54:23 2003 *************** *** 0 **** --- 1,6 ---- + ; Weak variables should be preserved by global DCE! + + ; RUN: llvm-as < %s | opt -globaldce | llvm-dis | grep %A + + + %A = weak global int 54 From lattner at cs.uiuc.edu Thu Oct 9 23:57:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 23:57:01 2003 Subject: [llvm-commits] CVS: llvm/utils/emacs/llvm-mode.el Message-ID: <200310100456.XAA30207@apoc.cs.uiuc.edu> Changes in directory llvm/utils/emacs: llvm-mode.el updated: 1.8 -> 1.9 --- Log message: Add support for the weak linkage specifier --- Diffs of the changes: (+1 -1) Index: llvm/utils/emacs/llvm-mode.el diff -u llvm/utils/emacs/llvm-mode.el:1.8 llvm/utils/emacs/llvm-mode.el:1.9 --- llvm/utils/emacs/llvm-mode.el:1.8 Mon Sep 8 13:07:57 2003 +++ llvm/utils/emacs/llvm-mode.el Thu Oct 9 23:56:23 2003 @@ -25,7 +25,7 @@ ;; Hex constants '("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face) ;; Keywords - '("begin\\|end\\|true\\|false\\|declare\\|global\\|constant\\|const\\|internal\\|linkonce\\|appending\\|uninitialized\\|implementation\\|\\.\\.\\.\\|null\\|to\\|except\\|not\\|target\\|endian\\|little\\|big\\|pointersize\\|volatile" . font-lock-keyword-face) + '("begin\\|end\\|true\\|false\\|declare\\|global\\|constant\\|const\\|internal\\|linkonce\\|weak\\|appending\\|uninitialized\\|implementation\\|\\.\\.\\.\\|null\\|to\\|except\\|not\\|target\\|endian\\|little\\|big\\|pointersize\\|volatile" . font-lock-keyword-face) ;; Types '("void\\|bool\\|sbyte\\|ubyte\\|u?short\\|u?int\\|u?long\\|float\\|double\\|type\\|label\\|opaque" . font-lock-type-face) ;; Arithmetic and Logical Operators From lattner at cs.uiuc.edu Thu Oct 9 23:57:08 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 9 23:57:08 2003 Subject: [llvm-commits] CVS: llvm/utils/vim/llvm.vim Message-ID: <200310100456.XAA30214@apoc.cs.uiuc.edu> Changes in directory llvm/utils/vim: llvm.vim updated: 1.6 -> 1.7 --- Log message: Add support for the weak linkage specifier --- Diffs of the changes: (+1 -1) Index: llvm/utils/vim/llvm.vim diff -u llvm/utils/vim/llvm.vim:1.6 llvm/utils/vim/llvm.vim:1.7 --- llvm/utils/vim/llvm.vim:1.6 Mon Sep 8 13:08:11 2003 +++ llvm/utils/vim/llvm.vim Thu Oct 9 23:56:26 2003 @@ -27,7 +27,7 @@ syn keyword llvmStatement begin end true false syn keyword llvmStatement declare global constant const syn keyword llvmStatement internal uninitialized external implementation -syn keyword llvmStatement linkonce appending +syn keyword llvmStatement linkonce weak appending syn keyword llvmStatement null to except not target endian pointersize syn keyword llvmStatement big little volatile From lattner at cs.uiuc.edu Fri Oct 10 00:02:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 00:02:01 2003 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200310100501.AAA13546@tank.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.31 -> 1.32 --- Log message: Add documentation for weak variables --- Diffs of the changes: (+10 -2) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.31 llvm/docs/LangRef.html:1.32 --- llvm/docs/LangRef.html:1.31 Mon Sep 8 13:27:49 2003 +++ llvm/docs/LangRef.html Fri Oct 10 00:01:39 2003 @@ -541,7 +541,15 @@

              "linkonce" linkage is similar to internal linkage, with the twist that linking together two modules defining the same linkonce globals will cause one of the globals to be discarded. This is typically used -to implement inline functions.

              +to implement inline functions. Unreferenced linkonce globals are +allowed to be discarded.

              + + +

              weak: + +
              "weak" linkage is exactly the same as linkonce linkage, +except that unreferenced weak globals may not be discarded. This is +used to implement constructs in C such as "int X;" at global scope.

              appending: @@ -1905,7 +1913,7 @@
              Chris Lattner
              -Last modified: Mon Sep 8 13:27:14 CDT 2003 +Last modified: Thu Oct 9 23:58:41 CDT 2003 From lattner at cs.uiuc.edu Fri Oct 10 00:44:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 00:44:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200310100543.AAA00302@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.79 -> 1.80 --- Log message: Ok, the "fix" for this is to do a real associative container. Symbol tables are ordered by name, not by slot, so the previous solution wasn't any good. On a large testcase, this reduces time to parse from 2.17s to 1.58s. --- Diffs of the changes: (+11 -15) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.79 llvm/lib/Bytecode/Reader/Reader.cpp:1.80 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.79 Thu Oct 9 18:10:14 2003 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Oct 10 00:43:47 2003 @@ -214,6 +214,13 @@ const unsigned char *EndBuf, SymbolTable *ST, Function *CurrentFunction) { + // Allow efficient basic block lookup by number. + std::vector BBMap; + if (CurrentFunction) + for (Function::iterator I = CurrentFunction->begin(), + E = CurrentFunction->end(); I != E; ++I) + BBMap.push_back(I); + while (Buf < EndBuf) { // Symtab block header: [num entries][type id number] unsigned NumEntries, Typ; @@ -223,9 +230,6 @@ BCR_TRACE(3, "Plane Type: '" << *Ty << "' with " << NumEntries << " entries\n"); - Function::iterator BlockIterator; - unsigned CurBlockIteratorIdx = ~0; - for (unsigned i = 0; i < NumEntries; ++i) { // Symtab entry: [def slot #][name] unsigned slot; @@ -238,19 +242,11 @@ if (Typ == Type::TypeTyID) V = (Value*)getType(slot); else if (Typ == Type::LabelTyID) { - if (!CurrentFunction) - throw std::string("Basic blocks don't exist at global scope!"); - - if (slot < CurBlockIteratorIdx) { - CurBlockIteratorIdx = 0; - BlockIterator = CurrentFunction->begin(); - } - - std::advance(BlockIterator, slot-CurBlockIteratorIdx); - CurBlockIteratorIdx = slot; - V = BlockIterator; - } else + if (slot < BBMap.size()) + V = BBMap[slot]; + } else { V = getValue(Typ, slot, false); // Find mapping... + } if (V == 0) throw std::string("Failed value look-up."); BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << *V; if (!isa(V)) std::cerr << "\n"); From criswell at cs.uiuc.edu Fri Oct 10 09:27:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 09:27:01 2003 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200310101426.JAA32346@choi.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.34 -> 1.35 --- Log message: Re-did some of the text wrapping (sorry). Made the "Getting Started Quickly" material its own section. I think this makes the document easier to read. Added bars after every major section heading (to distinguish them more easily from sub-section headings). Renamed C front end to GCC front end, as we now support C and C++. Updated material to reflect the new autoconf-style object root. Added material about the llvm/runtime directory and the fact that you need to install the GCC front end before building LLVM (before, it was optional). --- Diffs of the changes: (+167 -143) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.34 llvm/docs/GettingStarted.html:1.35 --- llvm/docs/GettingStarted.html:1.34 Mon Oct 6 14:23:34 2003 +++ llvm/docs/GettingStarted.html Fri Oct 10 09:26:14 2003 @@ -26,9 +26,9 @@
            • Software +
            • Getting Started Quickly (A Summary)
            • Getting started with LLVM
                -
              1. Getting Started Quickly (A Summary)
              2. Terminology and Notation
              3. Setting Up Your Environment
              4. Unpacking the LLVM Archives @@ -47,7 +47,7 @@
              5. llvm/tools
              6. llvm/utils
              -
            • Compiling the LLVM C Front End +
            • Compiling the LLVM GCC Front End
            • An Example Using the LLVM Tool Chain
            • Common Problems
            • Links @@ -58,6 +58,7 @@

              Overview

              +
              Welcome to LLVM! In order to get started, you first need to know some @@ -67,13 +68,13 @@ First, LLVM comes in two pieces. The first piece is the LLVM suite. This contains all of the tools, libraries, and header files needed to use the low level virtual machine. It also contains a test suite that can be used - to test the LLVM tools and the C front end. + to test the LLVM tools and the GCC front end.

              - The second piece is the C front end. This component provides a version - of GCC that compiles C code into LLVM bytecode. Currently, the C front end - is a modified version of GCC 3.4 (we track the GCC 3.4 development). - Once compiled into LLVM bytecode, a program can be manipulated with the - LLVM tools from the LLVM suite. + The second piece is the GCC front end. This component provides a version + of GCC that compiles C and C++ code into LLVM bytecode. Currently, the + GCC front end is a modified version of GCC 3.4 (we track the GCC 3.4 + development). Once compiled into LLVM bytecode, a program can be + manipulated with the LLVM tools from the LLVM suite.

              Requirements

              @@ -94,7 +95,7 @@
              • Source code: 30 MB
              • Object code: 670 MB -
              • C front end: 60 MB +
              • GCC front end: 60 MB
            @@ -106,13 +107,13 @@
            • Source code: 30 MB
            • Object code: 1000 MB -
            • C front end: 210 MB +
            • GCC front end: 210 MB

            - If you want to compile your own version of the C front end, you will need + If you want to compile your own version of the GCC front end, you will need additional disk space:

            @@ -210,11 +211,11 @@ -

            The next section of this guide is meant to get - you up and running with LLVM and to give you some basic information about - the LLVM environment. The first subsection gives - a short summary for those who are already familiar with the system and - want to get started as quickly as possible. +

            The remainder of this guide is meant to get you up and running with + LLVM and to give you some basic information about the LLVM environment. + The next section gives a short summary for those + who are already familiar with the system and want to get started as quickly + as possible. A more complete description is provided after that.

            The later sections of this guide describe the general layout of the the LLVM source-tree, a

            -

            Getting Started with LLVM

            +

            Getting Started Quickly (A Summary)

            - - - -

            Getting Started Quickly (A Summary)

            +
            Here's the short story for getting up and running quickly with LLVM:
              -
            1. Install the C front end: +
            2. Install the GCC front end:
              1. cd where-you-want-the-C-front-end-to-live
              2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf @@ -249,8 +247,6 @@
                1. cd where-you-want-llvm-to-live
                2. gunzip --stdout llvm.tar.gz | tar -xvf - -
                3. gunzip --stdout cfrontend.platform.tar.gz | tar - -xvf -
                4. cd llvm
                @@ -271,18 +267,14 @@
              3. Configure the LLVM Build Environment
                  -
                1. Run configure to configure the Makefiles and header - files for the default platform. +
                2. Change directory to where you want to store the LLVM object + files and run configure to configure the Makefiles and + header files for the default platform. Useful options include:
                    -
                  • --with-objroot=directory -
                    - Specify where object files should be placed during the - build. -
                  • --with-llvmgccdir=directory
                    - Specify where the LLVM C frontend is going to be installed. + Specify where the LLVM GCC frontend is installed.
                @@ -301,12 +293,19 @@

                See Setting Up Your Environment on tips to simplify working with the LLVM front-end and compiled tools. See the - other sub-sections below for other useful details in working with LLVM, + next section for other useful details in working with LLVM, or go straight to Program Layout to learn about the - layout of the source code tree. For information on building the C front - end yourself, see Compiling the LLVM C Front End for + layout of the source code tree. For information on building the GCC front + end yourself, see Compiling the LLVM GCC Front End for information. + +

                +

                Getting Started with LLVM

                +
                +
                + +

                Terminology and Notation

                @@ -325,33 +324,36 @@ give you this path.

                +

                SRC_ROOT +
                + This is the top level directory of the LLVM source tree. +

                +

                OBJ_ROOT
                - This is the top level directory for where the LLVM suite object files - will be placed during the build. + This is the top level directory of the LLVM object tree (i.e. the + tree where object files and compiled programs will be placed. It + can be the same as SRC_ROOT).

                LLVMGCCDIR
                - This is the pathname to the location where the LLVM C Front End will - be installed. Note that the C front end does not need to be installed - during the LLVM suite build; you will just need to know where it will - go for configuring the build system and running the test suite later. + This is the where the LLVM GCC Front End is installed.

                - For the pre-built C front end binaries, the LLVMGCCDIR is + For the pre-built GCC front end binaries, the LLVMGCCDIR is the cfrontend/platform/llvm-gcc.

                GCCSRC
                - This is the pathname of the directory where the LLVM C front end source - code can be found. + This is the location of the LLVM GCC front end source code (used + only if the LLVM GCC front end is being compiled).

                GCCOBJ
                - This is the pathname of the directory where the LLVM C front end object - code will be placed during the build. It can be safely removed once - the build is complete. + This is the location of the LLVM GCC front end object code (used + only if the LLVM GCC front end is being compiled). It can be + safely removed once the LLVM GCC front end is built and installed. @@ -367,14 +369,15 @@
                LLVM_LIB_SEARCH_PATH=LLVMGCCDIR/llvm-gcc/bytecode-libs
                - This environment variable helps the LLVM C front end find bytecode + This environment variable helps the LLVM GCC front end find bytecode libraries that it will need for compilation.

                alias llvmgcc LLVMGCCDIR/bin/llvm-gcc +
                alias llvmg++ LLVMGCCDIR/bin/llvm-g++
                - This alias allows you to use the LLVM C front end without putting it in - your PATH or typing in its complete pathname. + This alias allows you to use the LLVM C and C++ front ends without putting + them in your PATH or typing in their complete pathnames.
                @@ -394,15 +397,15 @@

                cfrontend.sparc.tar.gz -
                This is the binary release of the C front end for Solaris/Sparc. +
                This is the binary release of the GCC front end for Solaris/Sparc.

                cfrontend.x86.tar.gz -
                This is the binary release of the C front end for Linux/x86. +
                This is the binary release of the GCC front end for Linux/x86.

                cfrontend-src.tar.gz -
                This is the source code release of the C front end. +
                This is the source code release of the GCC front end.

                @@ -423,24 +426,24 @@ test directories, and local copies of documentation files.

                - Note that the C front end is not included in the CVS repository. You + Note that the GCC front end is not included in the CVS repository. You should have either downloaded the source, or better yet, downloaded the binary distribution for your platform.

                -

                Install the C Front End

                +

                Install the GCC Front End

                - Before configuring and compiling the LLVM suite, it is best to extract the - LLVM C front end. While not used in building, the C front end is used by - the LLVM test suite, and its location must be given to the - configure script before the LLVM suite can be built. + Before configuring and compiling the LLVM suite, you need to extract the + LLVM GCC front end from the binary distribution. It is used for building the + bytecode libraries later used by the GCC front end for linking programs, and + its location must be specified when the LLVM suite is configured.

                - To install the C front end, do the following: + To install the GCC front end, do the following:

                1. cd where-you-want-the-front-end-to-live
                2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf @@ -454,7 +457,8 @@

                  Once checked out from the CVS repository, the LLVM suite source code must be configured via the configure script. This script sets variables in llvm/Makefile.config and - llvm/include/Config/config.h. + llvm/include/Config/config.h. It also populates OBJ_ROOT with + the Makefiles needed to build LLVM.

                  The following environment variables are used by the configure @@ -495,26 +499,6 @@

                  -
                  --with-objroot=OBJ_ROOT -
                  - Path to the directory where - object files, libraries, and executables should be placed. - If this is set to ., then the object files will be placed - within the source code tree. If left unspecified, the default value is - the following: -
                    -
                  • - If the USER environment variable is specified and the directory - /localhome/$USER exists, then the default value is - /localhome/$USER. - -
                  • - Otherwise, the default value is .. -
                  - (See the Section on - The Location of LLVM Object Files - for more information.) -

                  --with-llvmgccdir=LLVMGCCDIR
                  Path to the location where the LLVM C front end binaries and @@ -522,22 +506,47 @@

                  --enable-optimized
                  - Enables optimized compilation (debugging symbols are removed and GCC - optimization flags are enabled). The default is to use an unoptimized - build (also known as a debug build). + Enables optimized compilation by defaulat (debugging symbols are removed + and GCC optimization flags are enabled). The default is to use an + unoptimized build (also known as a debug build).

                  --enable-jit
                  Compile the Just In Time (JIT) functionality. This is not available on all platforms. The default is dependent on platform, so it is best to explicitly enable it if you want it. +

                  +

                  --enable-spec2000 +
                  --enable-spec2000=<directory> +
                  + Enable the use of SPEC2000 when testing LLVM. This is disabled by default + (unless configure find SPEC2000 installed). By specifying + directory, you can tell configure where to find the SPEC2000 + benchmarks. If directory is left unspecified, it + configure uses a default value for our internal + installation of SPEC2000.
                  +

                  + To configure LLVM, follow these steps: +

                    +
                  1. Change directory into the object root directory: +
                    + cd OBJ_ROOT +

                    + +

                  2. Run the script located in the LLVM source tree: +
                    + SRC_ROOT/configure +

                    +

                  +

                  + In addition to running configure, you must set the LLVM_LIB_SEARCH_PATH environment variable in your startup scripts. This environment variable is used to locate "system" libraries like "-lc" and "-lm" when linking. This variable should be set - to the absolute path for the bytecode-libs subdirectory of the C front-end + to the absolute path for the bytecode-libs subdirectory of the GCC front end install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might set LLVM_LIB_SEARCH_PATH to /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 @@ -553,14 +562,16 @@
                  Debug Builds
                  - These builds are the default. They compile the tools and libraries - with debugging information. + These builds are the default when one types gmake (unless the + --enable-optimized option was used during configuration). They + compile the tools and libraries with debugging information.

                  Release (Optimized) Builds
                  These builds are enabled with the --enable-optimized option to - configure. They compile the tools and libraries with GCC + configure or by specifying ENABLE_OPTIMIZED=1 on the + gmake command line. They compile the tools and libraries with GCC optimizer flags on and strip debugging information from the libraries and executables it generates.

                  @@ -569,12 +580,12 @@

                  These builds are for use with profiling. They compile profiling information into the code for use with programs like gprof. - Profile builds must be started by setting variables on the - gmake command line. + Profile builds must be started by specifying ENABLE_PROFILING=1 + on the gmake command line.
                  - Once you have LLVM configured, you can build it by entering the top level - llvm directory and issuing the following command: + Once you have LLVM configured, you can build it by entering the OBJ_ROOT + directory and issuing the following command:

                  gmake @@ -588,7 +599,7 @@ gmake -j2

                  - There are several other targets which are useful when working with the LLVM + There are several special targets which are useful when working with the LLVM source code:

                  @@ -604,6 +615,16 @@ files generated by configure. It attempts to return the source tree to the original state in which it was shipped.

                  + +

                  gmake install +
                  + Installs LLVM files into the proper location. For the most part, + this does nothing, but it does install bytecode libraries into the + GCC front end's bytecode library directory. If you need to update + your bytecode libraries, this is the target to use once you've built + them. +

                  +

                  It is also possible to override default values from configure by @@ -626,47 +647,30 @@

                  - Every directory in the LLVM source tree includes a Makefile to + Every directory in the LLVM object tree includes a Makefile to build it and any subdirectories that it contains. Entering any directory - inside the LLVM source tree and typing gmake should rebuild + inside the LLVM object tree and typing gmake should rebuild anything in or below that directory that is out of date.

                  The Location of LLVM Object Files

                  -

                  The LLVM build system sends most output files generated during the build - into the directory defined by the variable OBJ_ROOT in - llvm/Makefile.config, which is set by the --with-objroot - option in configure. This can be either just your normal LLVM - source tree or some other directory writable by you. You may wish to put - object files on a different filesystem either to keep them from being backed - up or to speed up local builds. -

                  - If OBJ_ROOT is specified, then the build system will create a - directory tree underneath it that resembles the source code's pathname - relative to your home directory (unless OBJ_ROOT is set to - ., in which case object files are placed within the LLVM source - tree). -

                  - + The LLVM build system is capable of sharing a single LLVM source tree among + several LLVM builds. Hence, it is possible to build LLVM for several + different platforms or configurations using the same source tree.

                  - Note that - --with-objroot=. - and - --with-objroot=`pwd` - are not the same thing. The former will simply place object files within - the source tree, while the latter will set the location of object files - using the source tree's relative path from the home directory. -

                  + This is accomplished in the typical autoconf manner: +
                    +
                  • Change directory to where the LLVM object files should live: +

                    + cd OBJ_ROOT -

                    - For example, suppose that OBJ_ROOT is set to /tmp and the - LLVM suite source code is located in /usr/home/joe/src/llvm, where - /usr/home/joe is the home directory of a user named Joe. Then, - the object files will be placed in /tmp/src/llvm. -

                    +
                  • Run the configure script found in the LLVM source directory: +

                    + SRC_ROOT/configure +

                  The LLVM build will place files underneath OBJ_ROOT in directories @@ -678,9 +682,9 @@

                  Tools -
                  OBJ_ROOT/llvm/tools/Debug +
                  OBJ_ROOT/tools/Debug
                  Libraries -
                  OBJ_ROOT/llvm/lib/Debug +
                  OBJ_ROOT/lib/Debug

                  @@ -688,9 +692,9 @@

                  Tools -
                  OBJ_ROOT/llvm/tools/Release +
                  OBJ_ROOT/tools/Release
                  Libraries -
                  OBJ_ROOT/llvm/lib/Release +
                  OBJ_ROOT/lib/Release

                  @@ -698,9 +702,9 @@

                  Tools -
                  OBJ_ROOT/llvm/tools/Profile +
                  OBJ_ROOT/tools/Profile
                  Libraries -
                  OBJ_ROOT/llvm/lib/Profile +
                  OBJ_ROOT/lib/Profile
                  @@ -708,13 +712,15 @@

                  Program Layout

                  +
                  -

                  One useful source of information about the LLVM source base is the LLVM + One useful source of information about the LLVM source base is the LLVM doxygen documentation, available at http://llvm.cs.uiuc.edu/doxygen/. The - following is a brief introduction to code layout:

                  - + href="http://llvm.cs.uiuc.edu/doxygen/">http://llvm.cs.uiuc.edu/doxygen/
                  . + The following is a brief introduction to code layout: +

                  CVS directories

                  @@ -735,7 +741,7 @@
                3. llvm/include/llvm - This directory contains all of the LLVM specific header files. This directory also has subdirectories for different portions of LLVM: Analysis, CodeGen, - Reoptimizer, Target, Transforms, etc... + Target, Transforms, etc...
                4. llvm/include/Support - This directory contains generic support libraries that are independent of LLVM, but are used by LLVM. @@ -790,20 +796,34 @@ of the code generator: Instruction Selector, Instruction Scheduling, and Register Allocation. -
                  llvm/lib/Reoptimizer/
                  This directory holds code related - to the runtime reoptimizer framework that is currently under development. -
                  llvm/lib/Support/
                  This directory contains the source code that corresponds to the header files located in llvm/include/Support/. +

                  llvm/runtime

                  + + +

                  + This directory contains libraries which are compiled into LLVM bytecode and + used when linking programs with the GCC front end. Most of these libraries + are skeleton versions of real libraries; for example, libc is a stripped down + version of glibc. +

                  + +

                  + Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front end + to compile. +

                  + +

                  llvm/test

                  This directory contains regression tests and source code that is used to - test the LLVM infrastructure...

                  + test the LLVM infrastructure. +

                  llvm/tools

                  @@ -960,20 +980,21 @@ -

                  Compiling the LLVM C Front End

                  +

                  Compiling the LLVM GCC Front End

                  +

                  - This step is optional if you have the C front end binary distribution for + This step is optional if you have the GCC front end binary distribution for your platform.

                  - Now that you have the LLVM suite built, you can build the C front end. For + Now that you have the LLVM suite built, you can build the GCC front end. For those of you that have built GCC before, the process is very similar.

                  - Be forewarned, though: the build system for the C front end is not as + Be forewarned, though: the build system for the GCC front end is not as polished as the rest of the LLVM code, so there will be many warnings and errors that you will need to ignore for now: @@ -1018,6 +1039,7 @@

                  An Example Using the LLVM Tool Chain

                  +
                    @@ -1074,6 +1096,7 @@

                    Common Problems

                    +
                    Below are common problems and their remedies: @@ -1139,6 +1162,7 @@

                    Links

                    +

                    This document is just an introduction to how to use LLVM to do From lattner at cs.uiuc.edu Fri Oct 10 10:56:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 10:56:01 2003 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200310101555.KAA09321@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.144 -> 1.145 --- Log message: Make the message stand out more --- Diffs of the changes: (+4 -2) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.144 llvm/Makefile.rules:1.145 --- llvm/Makefile.rules:1.144 Tue Oct 7 10:24:23 2003 +++ llvm/Makefile.rules Fri Oct 10 10:55:43 2003 @@ -781,8 +781,10 @@ # Autoconf Dependencies. # $(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure - @${ECHO} "You need to re-run $(LLVM_SRC_ROOT)/configure" - @${ECHO} "inside the directory $(LLVM_OBJ_ROOT)" + @${ECHO} "****************************************************************" + @${ECHO} " You need to re-run $(LLVM_SRC_ROOT)/configure" + @${ECHO} " in directory $(LLVM_OBJ_ROOT)" + @${ECHO} "****************************************************************" $(VERB) exit 1 # From lattner at cs.uiuc.edu Fri Oct 10 11:07:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 10 11:07:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp Message-ID: <200310101606.LAA07488@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource/Regression/C++/EH: ctor_dtor_count-2.cpp added (r1.1) --- Log message: Checkin testcase for PR#27 --- Diffs of the changes: (+36 -0) Index: llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp diff -c /dev/null llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp:1.1 *** /dev/null Fri Oct 10 11:06:30 2003 --- llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp Fri Oct 10 11:06:20 2003 *************** *** 0 **** --- 1,36 ---- + // Testcase for proper handling of + // c++ type, constructors and destructors. + + #include + + int c, d; + + struct A + { + int i; + A () { i = ++c; printf ("A() %d\n", i); } + A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } + ~A() { printf ("~A() %d\n", i); ++d; } + }; + + void + f() + { + printf ("Throwing 1...\n"); + throw A(); + } + + + int main() { + try + { + f(); + } + catch (A) + { + printf ("Caught.\n"); + } + printf ("c == %d, d == %d\n", c, d); + return c != d; + } + From criswell at cs.uiuc.edu Fri Oct 10 11:18:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri Oct 10 11:18:02 2003 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200310101617.LAA18697@choi.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.35 -> 1.36 --- Log message: Removed information about compiling the GCC front end. This will be in a separate document that we will provide to people who request the source. Updated the support architecture information to be a little more precise. Added hyperlinks for all of the tools which are required for building LLVM. This should make it easier for people to find and install these required tools. Italicized some of the "variables" that we use in place of absolute paths. Added the --enable-spec2000 option to the quick start section. Other minor changes/corrections/clarifications. --- Diffs of the changes: (+60 -149) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.35 llvm/docs/GettingStarted.html:1.36 --- llvm/docs/GettingStarted.html:1.35 Fri Oct 10 09:26:14 2003 +++ llvm/docs/GettingStarted.html Fri Oct 10 11:17:19 2003 @@ -27,13 +27,13 @@

              4. Getting Started Quickly (A Summary) -
              5. Getting started with LLVM +
              6. Getting Started with LLVM
                1. Terminology and Notation
                2. Setting Up Your Environment
                3. Unpacking the LLVM Archives
                4. Checkout LLVM from CVS -
                5. Install the C Front End +
                6. Install the GCC Front End
                7. Local LLVM Configuration
                8. Compiling the LLVM Suite Source Code
                9. The Location of LLVM Object Files @@ -43,11 +43,11 @@
                10. CVS directories
                11. llvm/include
                12. llvm/lib +
                13. llvm/runtime
                14. llvm/test
                15. llvm/tools
                16. llvm/utils
                -
              7. Compiling the LLVM GCC Front End
              8. An Example Using the LLVM Tool Chain
              9. Common Problems
              10. Links @@ -89,7 +89,7 @@ LLVM is known to work on the following platforms:
                  -
                • Linux on x86 +
                • Linux on x86 (Pentium and above)
                  • Approximately 760 MB of Free Disk Space
                      @@ -112,36 +112,6 @@
                  -

                  - If you want to compile your own version of the GCC front end, you will need - additional disk space: -

                  - -
                    -
                  • Linux on x86 -
                      -
                    • Approximately 249 MB of Free Disk Space -
                        -
                      • Source code: 146 MB -
                      • Object code: 82 MB -
                      • Installed binaries: 21 MB -
                      -
                    - -

                    - -

                  • Solaris on Sparc -
                      -
                    • Approximately 264 MB of Free Disk Space -
                        -
                      • Source code: 146 MB -
                      • Object code: 93 MB -
                      • Installed binaries: 25 MB -
                      -
                    -
                  - -

                  LLVM may compile on other platforms. The LLVM utilities should work on other platforms, so it should be possible to generate and produce LLVM bytecode on unsupported platforms (although bytecode generated on one @@ -156,8 +126,9 @@ Unpacking the distribution requires the following tools:

                  -
                  GNU Zip (gzip) -
                  GNU Tar +
                  + GNU Zip (gzip) +
                  GNU Tar
                  These tools are needed to uncompress and unarchive the software. Regular Solaris tar may work for unpacking the TAR archive but @@ -168,7 +139,7 @@ installed:
                  -
                  GCC +
                  GCC
                  The GNU Compiler Collection must be installed with C and C++ language support. GCC 3.2.x works, and GCC 3.x is generally supported. @@ -177,19 +148,21 @@ Note that we currently do not support any other C++ compiler.

                  -
                  GNU Make +
                  GNU Make
                  The LLVM build system relies upon GNU Make extensions. Therefore, you will need GNU Make (sometimes known as gmake) to build LLVM.

                  -

                  Flex and Bison +
                  Flex + and + Bison
                  The LLVM source code is built using flex and bison. You will not be able to configure and compile LLVM without them.

                  -

                  GNU M4 +
                  GNU M4
                  If you are installing Bison on your machine for the first time, you will need GNU M4 (version 1.4 or higher). @@ -201,13 +174,19 @@

                    -
                  • GNU Autoconf -
                  • GNU M4 +
                  • GNU Autoconf +
                  • GNU M4

                    If you want to make changes to the configure scripts, you will need GNU autoconf (2.53 or higher), and consequently, GNU M4 (version 1.4 or higher).

                    + +
                  • QMTest +
                  • Python +

                    + In order to run the tests in the LLVM test suite, you will need QMTest and + a version of the Python interpreter that works with QMTest.

                  @@ -215,7 +194,8 @@ LLVM and to give you some basic information about the LLVM environment. The next section gives a short summary for those who are already familiar with the system and want to get started as quickly - as possible. A more complete description is provided after that. + as possible. A complete guide to installation is + provided in the subsequent section.

                  The later sections of this guide describe the general layout of the the LLVM source-tree, a --with-llvmgccdir=directory
                  Specify where the LLVM GCC frontend is installed. +

                  + +

                • --enable-spec2000=directory +
                  + Enable the SPEC2000 benchmarks for testing. The SPEC2000 + benchmarks should be available in directory.
              @@ -295,9 +281,7 @@ simplify working with the LLVM front-end and compiled tools. See the next section for other useful details in working with LLVM, or go straight to Program Layout to learn about the - layout of the source code tree. For information on building the GCC front - end yourself, see Compiling the LLVM GCC Front End for - information. + layout of the source code tree.
              @@ -340,20 +324,8 @@
              This is the where the LLVM GCC Front End is installed.

              - For the pre-built GCC front end binaries, the LLVMGCCDIR is the + For the pre-built GCC front end binaries, the LLVMGCCDIR is cfrontend/platform/llvm-gcc. - -

              GCCSRC -
              - This is the location of the LLVM GCC front end source code (used - only if the LLVM GCC front end is being compiled). -

              - -

              GCCOBJ -
              - This is the location of the LLVM GCC front end object code (used - only if the LLVM GCC front end is being compiled). It can be - safely removed once the LLVM GCC front end is built and installed. @@ -373,8 +345,8 @@ libraries that it will need for compilation.

              -

              alias llvmgcc LLVMGCCDIR/bin/llvm-gcc -
              alias llvmg++ LLVMGCCDIR/bin/llvm-g++ +
              alias llvmgcc LLVMGCCDIR/llvm-gcc/bin/gcc +
              alias llvmg++ LLVMGCCDIR/llvm-gcc/bin/g++
              This alias allows you to use the LLVM C and C++ front ends without putting them in your PATH or typing in their complete pathnames. @@ -386,11 +358,11 @@

              If you have the LLVM distribution, you will need to unpack it before you - can begin to compile it. LLVM is distributed as a set of four files. Each + can begin to compile it. LLVM is distributed as a set of three files. Each file is a TAR archive that is compressed with the gzip program.

              -

              The four files are as follows: +

              The three files are as follows:

              llvm.tar.gz
              This is the source code to the LLVM suite. @@ -402,11 +374,6 @@
              cfrontend.x86.tar.gz
              This is the binary release of the GCC front end for Linux/x86. -

              - -

              cfrontend-src.tar.gz -
              This is the source code release of the GCC front end. -

              @@ -427,8 +394,7 @@

              Note that the GCC front end is not included in the CVS repository. You - should have either downloaded the source, or better yet, downloaded the - binary distribution for your platform. + should have downloaded the binary distribution for your platform.

              @@ -457,7 +423,7 @@

              Once checked out from the CVS repository, the LLVM suite source code must be configured via the configure script. This script sets variables in llvm/Makefile.config and - llvm/include/Config/config.h. It also populates OBJ_ROOT with + llvm/include/Config/config.h. It also populates OBJ_ROOT with the Makefiles needed to build LLVM.

              @@ -477,7 +443,7 @@

            CC Tells configure which C compiler to use. By default, - configure will look for the first GCC compiler in + configure will look for the first GCC C compiler in PATH. Use this variable to override configure's default behavior. CXX Tells configure which C++ compiler to use. By default, - configure will look for the first GCC compiler in + configure will look for the first GCC C++ compiler in PATH. Use this variable to override configure's default behavior.