From sabre at nondot.org Wed Sep 4 11:37:01 2002 From: sabre at nondot.org (Chris Lattner) Date: Wed Sep 4 11:37:01 2002 Subject: [llvm-commits] test Message-ID: foo -Chris http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/ From brukman at cs.uiuc.edu Wed Sep 4 17:19:00 2002 From: brukman at cs.uiuc.edu (brukman at cs.uiuc.edu) Date: Wed Sep 4 17:19:00 2002 Subject: [llvm-commits] CVSROOT commit "CVSROOT commit-diffs.pl loginfo" Message-ID: <200209042218.RAA04678@morpheus.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT In directory morpheus.cs.uiuc.edu:/home/vadve/brukman/research/CVSROOT Modified Files: loginfo Added Files: commit-diffs.pl Log Message: Integrating the diffs for each commit into the commit messages... From vadve at cs.uiuc.edu Thu Sep 5 13:29:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Sep 5 13:29:01 2002 Subject: [llvm-commits] LLVM CVS: "llvm/lib/Target/Sparc EmitAssembly.cpp" Message-ID: <200209051828.NAA23041@trinity.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/Target/Sparc In directory trinity.cs.uiuc.edu:/home/vadve/vadve/Research/DynOpt/LLVM/llvm/lib/Target/Sparc Modified Files: EmitAssembly.cpp Log Message: -- Bug fix: use byte offsets not typed offsets in output assembly! -- Add support for ConstantExpr constants (only cast and add operators so far) -- Avoid generating label Bbss.bss, which sometimes came out twice. From vadve at cs.uiuc.edu Thu Sep 5 13:33:00 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Sep 5 13:33:00 2002 Subject: [llvm-commits] LLVM CVS: "llvm/lib/Target/Sparc SparcInstrSelection.cpp" Message-ID: <200209051832.NAA23068@trinity.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/Target/Sparc In directory trinity.cs.uiuc.edu:/home/vadve/vadve/Research/DynOpt/LLVM/llvm/lib/Target/Sparc Modified Files: SparcInstrSelection.cpp Log Message: -- Use size of pointer element type instead of pointer type in array offsets! -- A few bug fixes in casting between floats and ints. -- Use SRL reg, 0 instead of AND reg, 0xffffffff to clear high 32 bits. From vadve at cs.uiuc.edu Thu Sep 5 13:35:00 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Sep 5 13:35:00 2002 Subject: [llvm-commits] LLVM CVS: "llvm/lib/Target/Sparc SparcInstrInfo.cpp" Message-ID: <200209051833.NAA23080@trinity.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/Target/Sparc In directory trinity.cs.uiuc.edu:/home/vadve/vadve/Research/DynOpt/LLVM/llvm/lib/Target/Sparc Modified Files: SparcInstrInfo.cpp Log Message: Bug fixes in casting between floats and ints smaller than 64 bits. Add UltraSparcInstrInfo::CreateZeroExtensionInstructions to help with that. From vadve at cs.uiuc.edu Thu Sep 5 13:35:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Sep 5 13:35:01 2002 Subject: [llvm-commits] LLVM CVS: "llvm/lib/Target/Sparc SparcInternals.h" Message-ID: <200209051834.NAA23112@trinity.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/Target/Sparc In directory trinity.cs.uiuc.edu:/home/vadve/vadve/Research/DynOpt/LLVM/llvm/lib/Target/Sparc Modified Files: SparcInternals.h Log Message: Add new function UltraSparcInstrInfo::CreateZeroExtensionInstructions. From vadve at cs.uiuc.edu Thu Sep 5 13:37:00 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Thu Sep 5 13:37:00 2002 Subject: [llvm-commits] LLVM CVS: "llvm/include/llvm/Target MachineInstrInfo.h" Message-ID: <200209051836.NAA23158@trinity.cs.uiuc.edu> Update of /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/include/llvm/Target In directory trinity.cs.uiuc.edu:/home/vadve/vadve/Research/DynOpt/LLVM/llvm/include/llvm/Target Modified Files: MachineInstrInfo.h Log Message: Add new function MachineInstrInfo::CreateZeroExtensionInstructions. From llvm-commits at cs.uiuc.edu Thu Sep 5 20:42:01 2002 From: llvm-commits at cs.uiuc.edu (llvm-commits at cs.uiuc.edu) Date: Thu Sep 5 20:42:01 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060141.UAA26550@trinity.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.20 -> 1.21 --- Log message: Checkins to LLVM module should include diff information as well --- Diffs of the changes: Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.20 CVSROOT/loginfo:1.21 --- CVSROOT/loginfo:1.20 Thu Sep 5 12:23:24 2002 +++ CVSROOT/loginfo Thu Sep 5 20:41:00 2002 @@ -26,5 +26,6 @@ #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog #^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 mailx -s 'LLVM CVS: %s' llvm-commits at cs.uiuc.edu +^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu From llvm-commits at cs.uiuc.edu Thu Sep 5 20:44:01 2002 From: llvm-commits at cs.uiuc.edu (llvm-commits at cs.uiuc.edu) Date: Thu Sep 5 20:44:01 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060143.UAA26570@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.11 -> 1.12 --- Log message: Clean up the commit-diffs script, turn off debugging output --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.11 CVSROOT/commit-diffs.pl:1.12 --- CVSROOT/commit-diffs.pl:1.11 Thu Sep 5 12:23:23 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 20:43:50 2002 @@ -7,18 +7,13 @@ $DEFAULT_ADMIN = 'brukman\@cs.uiuc.edu'; $DEFAULT_USERNAME = 'brukman'; -$DEBUG = 1; +$DEBUG = 0; $TEMPFILE = "/tmp/cvsmailtmp.$$"; # A trivial script example to send mail on every CVS commit. # The mail sent includes change summary, log message and a unidiff # about the changes. -# This perl script is intended to be run under Windows. Under unix, -# you can do the same thing a bit easier by using a fork() call. -# This script requires mailbe.pl to exist in the same directory. -# For further documentation, please see the www page mentioned later. - # The original author of this script is Jouni Heikniemi # Feel free to do whatever you wish with this. # The home page of this script is @@ -51,7 +46,7 @@ # Do a small delay so that the main CVS task finishes and # releases locks first. -sleep 5; +sleep 3; if ($DEBUG) { for ($i=0; $i<8; $i++) { @@ -84,7 +79,7 @@ } my @loginfodata = ; -print "loginfo: ". join("\n--\n", @loginfodata) if $DEBUG; +#print "loginfo: ". join("\n--\n", @loginfodata) if $DEBUG; # Pick up the committer's log message from the loginfo we received my @logmessage; @@ -123,15 +118,6 @@ # Send the mail. -# Note: this section uses NTSendmail, but feel free to use whatever mail server you like. -# -#use NTsendmail; -#$ENV{'NTsendmail'} = 'your.smtp.server'; -#$ENV{'NTsendmail_max_tries'} = 5; -#my $mail = new NTsendmail; -# -#$mail->send('cvs at yourdomain.com', $target, "CVS Commits ($changedir, $user)", $msg); -# # use mailx instead open TEMP, ">$TEMPFILE"; From llvm-commits at cs.uiuc.edu Thu Sep 5 20:48:01 2002 From: llvm-commits at cs.uiuc.edu (llvm-commits at cs.uiuc.edu) Date: Thu Sep 5 20:48:01 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060147.UAA26688@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.12 -> 1.13 --- Log message: Make sure to remove temporary file. --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.12 CVSROOT/commit-diffs.pl:1.13 --- CVSROOT/commit-diffs.pl:1.12 Thu Sep 5 20:43:50 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 20:47:43 2002 @@ -124,4 +124,4 @@ print TEMP $msg; close TEMP; system("mailx -r $target -s 'CVS: $changedir' $target < $TEMPFILE"); -#unlink "$TEMPFILE"; +unlink "$TEMPFILE"; From llvm-commits at cs.uiuc.edu Thu Sep 5 20:52:00 2002 From: llvm-commits at cs.uiuc.edu (llvm-commits at cs.uiuc.edu) Date: Thu Sep 5 20:52:00 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060151.UAA26754@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.13 -> 1.14 --- Log message: Lets see if this fixes the "from" issue --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.13 CVSROOT/commit-diffs.pl:1.14 --- CVSROOT/commit-diffs.pl:1.13 Thu Sep 5 20:47:43 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 20:51:35 2002 @@ -123,5 +123,5 @@ open TEMP, ">$TEMPFILE"; print TEMP $msg; close TEMP; -system("mailx -r $target -s 'CVS: $changedir' $target < $TEMPFILE"); +system("mailx -s 'CVS: $changedir' $target < $TEMPFILE"); unlink "$TEMPFILE"; From lattner at cs.uiuc.edu Thu Sep 5 20:54:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 20:54:01 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060153.UAA26848@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.14 -> 1.15 --- Log message: Kill debug info output --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.14 CVSROOT/commit-diffs.pl:1.15 --- CVSROOT/commit-diffs.pl:1.14 Thu Sep 5 20:51:35 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 20:53:30 2002 @@ -109,7 +109,7 @@ $msg .= "$m->{'filename'} (r$m->{'oldrev'}) removed\n"; } else { $msg .= "$m->{'filename'} updated: $m->{'oldrev'} -> $m->{'newrev'}\n"; - print "cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}"; + #print "cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}"; $diffs .= `cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}` . "\n\n"; } } From lattner at cs.uiuc.edu Thu Sep 5 21:00:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:00:01 2002 Subject: [llvm-commits] CVS: CVSROOT Message-ID: <200209060159.UAA27394@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.15 -> 1.16 --- Log message: This will hopefully cause the subject line of messages sent to be more useful. --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.15 CVSROOT/commit-diffs.pl:1.16 --- CVSROOT/commit-diffs.pl:1.15 Thu Sep 5 20:53:30 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 20:59:42 2002 @@ -101,8 +101,10 @@ my $msg = "\n\nChanges in directory $changedir:\n\n"; my $diffs = ""; +my $subject = $changedir; foreach $m (@changeItems) { + $subject .= " $m->{'filename'}"; if ($m->{'type'} eq 'add') { $msg .= "$m->{'filename'} added (r$m->{'newrev'})\n"; } elsif ($m->{'type'} eq 'rm') { @@ -123,5 +125,5 @@ open TEMP, ">$TEMPFILE"; print TEMP $msg; close TEMP; -system("mailx -s 'CVS: $changedir' $target < $TEMPFILE"); +system("mailx -s 'CVS: $subject' $target < $TEMPFILE"); unlink "$TEMPFILE"; From lattner at cs.uiuc.edu Thu Sep 5 21:01:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:01:01 2002 Subject: [llvm-commits] CVS: CVSROOT commit-diffs.pl Message-ID: <200209060200.VAA27487@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.16 -> 1.17 --- Log message: Give credit where it is due. Just a silly test to see if things work. --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.16 CVSROOT/commit-diffs.pl:1.17 --- CVSROOT/commit-diffs.pl:1.16 Thu Sep 5 20:59:42 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 21:00:35 2002 @@ -19,6 +19,10 @@ # The home page of this script is # . +# +# This script was hacked by Misha & Chris to work under unix +# + ###################################################################### # CVS loginfo format specifier '%{sVv}' produces items like # 'source.c,1.2,1.3', 'source2.c,NONE,1.1' and 'source3.c,1.5,NONE' From lattner at cs.uiuc.edu Thu Sep 5 21:03:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:03:01 2002 Subject: [llvm-commits] CVS: CVSROOT commit-diffs.pl Message-ID: <200209060202.VAA27585@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.17 -> 1.18 --- Log message: Make sure it's obvious that the first part is the directory! --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.17 CVSROOT/commit-diffs.pl:1.18 --- CVSROOT/commit-diffs.pl:1.17 Thu Sep 5 21:00:35 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 21:02:08 2002 @@ -105,7 +105,7 @@ my $msg = "\n\nChanges in directory $changedir:\n\n"; my $diffs = ""; -my $subject = $changedir; +my $subject = "$changedir/"; foreach $m (@changeItems) { $subject .= " $m->{'filename'}"; From lattner at cs.uiuc.edu Thu Sep 5 21:04:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:04:01 2002 Subject: [llvm-commits] CVS: llvm/docs/ WritingAnLLVMPass.html Message-ID: <200209060203.VAA27729@trinity.cs.uiuc.edu> Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.5 -> 1.6 --- Log message: * Remove notes at the top of the file * Add information about how to debug a dynamically loaded pass. --- Diffs of the changes: Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.5 llvm/docs/WritingAnLLVMPass.html:1.6 --- llvm/docs/WritingAnLLVMPass.html:1.5 Thu Aug 22 14:21:04 2002 +++ llvm/docs/WritingAnLLVMPass.html Thu Sep 5 21:02:58 2002 @@ -1,34 +1,6 @@ Writing an LLVM Pass - - @@ -80,6 +52,11 @@ +
  • Using GDB with dynamically loaded passes +
  • Future extensions planned
  • +Using GDB with dynamically loaded passes +
      + + +Unfortunately, using GDB with dynamically loaded passes is not as easy as it +should be. First of all, you can't set a breakpoint in a shared object that has +not been loaded yet, and second of all there are problems with inlined functions +in shared objects. Here are some suggestions to debugging your pass with +GDB.

      + +For sake of discussion, I'm going to assume that you are debugging a +transformation invoked by opt, although nothing described here depends +on that.

      + + +


    Setting a breakpoint in your pass


    Miscellaneous Problems

    +
    Future extensions planned
      @@ -1098,9 +1161,9 @@
      -
      Christopher Lattner
      +
      Chris Lattner
      -Last modified: Thu Aug 22 14:19:43 CDT 2002 +Last modified: Thu Sep 5 15:06:01 CDT 2002
      From lattner at cs.uiuc.edu Thu Sep 5 21:15:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:15:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/ Pass.h Message-ID: <200209060214.VAA28892@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.25 -> 1.26 --- Log message: Make getAnalysisToUpdate() public so that transformation APIs can update analysis information. --- Diffs of the changes: Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.25 llvm/include/llvm/Pass.h:1.26 --- llvm/include/llvm/Pass.h:1.25 Fri Aug 30 15:19:49 2002 +++ llvm/include/llvm/Pass.h Thu Sep 5 21:14:47 2002 @@ -125,6 +125,22 @@ // or null if it is not known. static const PassInfo *lookupPassInfo(const std::type_info &TI); + /// getAnalysisToUpdate() - This function is used by subclasses + /// to get to the analysis information that might be around that needs to be + /// updated. This is different than getAnalysis in that it can fail (ie the + /// analysis results haven't been computed), so should only be used if you + /// provide the capability to update an analysis that exists. This method is + /// often used by transformation APIs to update analysis results for a pass + /// automatically as the transform is performed. + /// + template + AnalysisType *getAnalysisToUpdate() const { + assert(Resolver && "Pass not resident in a PassManager object!"); + const PassInfo *PI = getClassPassInfo(); + if (PI == 0) return 0; + return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); + } + protected: /// getAnalysis() - This function is used by subclasses to get @@ -166,21 +182,6 @@ assert(Result && "Pass does not implement interface required!"); return *Result; } - - /// getAnalysisToUpdate() - This function is used by subclasses - /// to get to the analysis information that might be around that needs to be - /// updated. This is different than getAnalysis in that it can fail (ie the - /// analysis results haven't been computed), so should only be used if you - /// provide the capability to update an analysis that exists. - /// - template - AnalysisType *getAnalysisToUpdate() const { - assert(Resolver && "Pass not resident in a PassManager object!"); - const PassInfo *PI = getClassPassInfo(); - if (PI == 0) return 0; - return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); - } - private: friend class PassManagerT; From lattner at cs.uiuc.edu Thu Sep 5 21:17:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:17:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ Dominators.h Message-ID: <200209060216.VAA29137@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Dominators.h updated: 1.22 -> 1.23 --- Log message: - Doxygenize comments - Add new method to dominatorset: properlyDominates - Add synonmys for operator[] to classes so that pointers to dominator information can be used more easily. - Add API's to update dominator information --- Diffs of the changes: Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.22 llvm/include/llvm/Analysis/Dominators.h:1.23 --- llvm/include/llvm/Analysis/Dominators.h:1.22 Thu Aug 22 15:39:27 2002 +++ llvm/include/llvm/Analysis/Dominators.h Thu Sep 5 21:16:27 2002 @@ -67,28 +67,46 @@ inline const_iterator find(BasicBlock* B) const { return Doms.find(B); } inline iterator find(BasicBlock* B) { return Doms.find(B); } - // getDominators - Return the set of basic blocks that dominate the specified - // block. - // + + /// getDominators - Return the set of basic blocks that dominate the specified + /// block. + /// inline const DomSetType &getDominators(BasicBlock *BB) const { const_iterator I = find(BB); assert(I != end() && "BB not in function!"); return I->second; } - // dominates - Return true if A dominates B. - // + /// dominates - Return true if A dominates B. + /// inline bool dominates(BasicBlock *A, BasicBlock *B) const { return getDominators(B).count(A) != 0; } - // print - Convert to human readable form + /// properlyDominates - Return true if A dominates B and A != B. + /// + bool properlyDominates(BasicBlock *A, BasicBlock *B) const { + return dominates(A, B) && A != B; + } + + /// print - Convert to human readable form virtual void print(std::ostream &OS) const; - // dominates - Return true if A dominates B. This performs the special checks - // neccesary if A and B are in the same basic block. - // + /// dominates - Return true if A dominates B. This performs the special + /// checks neccesary if A and B are in the same basic block. + /// bool dominates(Instruction *A, Instruction *B) const; + + //===--------------------------------------------------------------------===// + // API to update (Post)DominatorSet information based on modifications to + // the CFG... + + /// addBasicBlock - Call to update the dominator set with information about a + /// new block that was inserted into the function. + void addBasicBlock(BasicBlock *BB, const DomSetType &Dominators) { + assert(find(BB) == end() && "Block already in DominatorSet!"); + Doms.insert(std::make_pair(BB, Dominators)); + } }; @@ -135,10 +153,28 @@ // node returns null, because it does not have an immediate dominator. // inline BasicBlock *operator[](BasicBlock *BB) const { + return get(BB); + } + + // get() - Synonym for operator[]. + inline BasicBlock *get(BasicBlock *BB) const { std::map::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } + //===--------------------------------------------------------------------===// + // API to update Immediate(Post)Dominators information based on modifications + // to the CFG... + + /// addNewBlock - Add a new block to the CFG, with the specified immediate + /// dominator. + /// + void addNewBlock(BasicBlock *BB, BasicBlock *IDom) { + assert(get(BB) == 0 && "BasicBlock already in idom info!"); + IDoms[BB] = IDom; + } + + // print - Convert to human readable form virtual void print(std::ostream &OS) const; }; @@ -182,6 +218,7 @@ class Node2 : public std::vector { friend class DominatorTree; friend class PostDominatorTree; + friend class DominatorTreeBase; BasicBlock *TheNode; Node2 *IDom; public: @@ -210,12 +247,33 @@ virtual void releaseMemory() { reset(); } - inline Node *operator[](BasicBlock *BB) const { + /// getNode - return the (Post)DominatorTree node for the specified basic + /// block. This is the same as using operator[] on this class. + /// + inline Node *getNode(BasicBlock *BB) const { NodeMapType::const_iterator i = Nodes.find(BB); return (i != Nodes.end()) ? i->second : 0; } - // print - Convert to human readable form + inline Node *operator[](BasicBlock *BB) const { + return getNode(BB); + } + + // API to update (Post)DominatorTree information based on modifications to + // the CFG... + + /// createNewNode - Add a new node to the dominator tree information. This + /// creates a new node as a child of IDomNode, linking it into the children + /// list of the immediate dominator. + /// + Node *createNewNode(BasicBlock *BB, Node *IDomNode) { + assert(getNode(BB) == 0 && "Block already in dominator tree!"); + Node *New = Nodes[BB] = new Node(BB, IDomNode); + if (IDomNode) IDomNode->addChild(New); + return New; + } + + /// print - Convert to human readable form virtual void print(std::ostream &OS) const; }; From lattner at cs.uiuc.edu Thu Sep 5 21:20:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:20:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/ Local.h Message-ID: <200209060219.VAA29395@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Utils: Local.h updated: 1.5 -> 1.6 --- Log message: * Doxygenize API * Add new functions for identifying and breaking critical edges --- Diffs of the changes: Index: llvm/include/llvm/Transforms/Utils/Local.h diff -u llvm/include/llvm/Transforms/Utils/Local.h:1.5 llvm/include/llvm/Transforms/Utils/Local.h:1.6 --- llvm/include/llvm/Transforms/Utils/Local.h:1.5 Sun Sep 1 23:04:11 2002 +++ llvm/include/llvm/Transforms/Utils/Local.h Thu Sep 5 21:19:25 2002 @@ -9,21 +9,22 @@ #define LLVM_TRANSFORMS_UTILS_LOCAL_H #include "llvm/Function.h" +class Pass; //===----------------------------------------------------------------------===// // Local constant propogation... // -// doConstantPropogation - Constant prop a specific instruction. Returns true -// and potentially moves the iterator if constant propogation was performed. -// +/// doConstantPropogation - Constant prop a specific instruction. Returns true +/// and potentially moves the iterator if constant propogation was performed. +/// bool doConstantPropogation(BasicBlock::iterator &I); -// ConstantFoldTerminator - If a terminator instruction is predicated on a -// constant value, convert it into an unconditional branch to the constant -// destination. This is a nontrivial operation because the successors of this -// basic block must have their PHI nodes updated. -// +/// ConstantFoldTerminator - If a terminator instruction is predicated on a +/// constant value, convert it into an unconditional branch to the constant +/// destination. This is a nontrivial operation because the successors of this +/// basic block must have their PHI nodes updated. +/// bool ConstantFoldTerminator(BasicBlock *BB); @@ -31,16 +32,17 @@ // Local dead code elimination... // -// isInstructionTriviallyDead - Return true if the result produced by the -// instruction is not used, and the instruction has no side effects. -// +/// isInstructionTriviallyDead - Return true if the result produced by the +/// instruction is not used, and the instruction has no side effects. +/// bool isInstructionTriviallyDead(Instruction *I); -// dceInstruction - Inspect the instruction at *BBI and figure out if it -// isTriviallyDead. If so, remove the instruction and update the iterator to -// point to the instruction that immediately succeeded the original instruction. -// +/// dceInstruction - Inspect the instruction at *BBI and figure out if it +/// isTriviallyDead. If so, remove the instruction and update the iterator to +/// point to the instruction that immediately succeeded the original +/// instruction. +/// bool dceInstruction(BasicBlock::iterator &BBI); @@ -48,14 +50,28 @@ // Control Flow Graph Restructuring... // -// SimplifyCFG - This function is used to do simplification of a CFG. For -// example, it adjusts branches to branches to eliminate the extra hop, it -// eliminates unreachable basic blocks, and does other "peephole" optimization -// of the CFG. It returns true if a modification was made, possibly deleting -// the basic block that was pointed to. -// -// WARNING: The entry node of a method may not be simplified. -// +/// SimplifyCFG - This function is used to do simplification of a CFG. For +/// example, it adjusts branches to branches to eliminate the extra hop, it +/// eliminates unreachable basic blocks, and does other "peephole" optimization +/// of the CFG. It returns true if a modification was made, possibly deleting +/// the basic block that was pointed to. +/// +/// WARNING: The entry node of a method may not be simplified. +/// bool SimplifyCFG(BasicBlock *BB); + + +/// isCriticalEdge - Return true if the specified edge is a critical edge. +/// Critical edges are edges from a block with multiple successors to a block +/// with multiple predecessors. +/// +/// +bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum); + +/// BreakCriticalEdge - Insert a new node node to split the critical edge. This +/// will update DominatorSet and DominatorTree information if it is available, +/// thus calling this pass will not invalidate either of them. +/// +void BreakCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0); #endif From lattner at cs.uiuc.edu Thu Sep 5 21:36:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:36:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/ CriticalEdge.cpp Message-ID: <200209060235.VAA00005@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CriticalEdge.cpp added (r1.1) --- Log message: Check in the implementation of critical edge detection and splitting --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 21:36:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:36:02 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/ Local.h Message-ID: <200209060235.VAA00014@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Utils: Local.h updated: 1.6 -> 1.7 --- Log message: - Rename BreakCriticalEdge to the slightly more standard SplitCriticalEdge --- Diffs of the changes: Index: llvm/include/llvm/Transforms/Utils/Local.h diff -u llvm/include/llvm/Transforms/Utils/Local.h:1.6 llvm/include/llvm/Transforms/Utils/Local.h:1.7 --- llvm/include/llvm/Transforms/Utils/Local.h:1.6 Thu Sep 5 21:19:25 2002 +++ llvm/include/llvm/Transforms/Utils/Local.h Thu Sep 5 21:35:11 2002 @@ -68,10 +68,11 @@ /// bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum); -/// BreakCriticalEdge - Insert a new node node to split the critical edge. This -/// will update DominatorSet and DominatorTree information if it is available, -/// thus calling this pass will not invalidate either of them. +/// SplitCriticalEdge - Insert a new node node to split the critical edge. This +/// will update DominatorSet, ImmediateDominator and DominatorTree information +/// if it is available, thus calling this pass will not invalidate either of +/// them. /// -void BreakCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0); +void SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0); #endif From lattner at cs.uiuc.edu Thu Sep 5 21:40:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:40:01 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060239.VAA00142@trinity.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.18 -> 1.19 --- Log message: When commiting new files, make sure to print the contents of the file checked in --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.18 CVSROOT/commit-diffs.pl:1.19 --- CVSROOT/commit-diffs.pl:1.18 Thu Sep 5 21:02:08 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 21:39:19 2002 @@ -116,7 +116,7 @@ } else { $msg .= "$m->{'filename'} updated: $m->{'oldrev'} -> $m->{'newrev'}\n"; #print "cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}"; - $diffs .= `cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}` . "\n\n"; + $diffs .= `cvs -Qf rdiff -N -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}` . "\n\n"; } } $msg .= "\n---\nLog message:\n\n" . join('', at logmessage); From lattner at cs.uiuc.edu Thu Sep 5 21:52:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 21:52:01 2002 Subject: [llvm-commits] CVS: llvm/docs/ ProgrammersManual.html Message-ID: <200209060251.VAA00948@trinity.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html added (r1.1) --- Log message: Initial checkin of the first part of the Programmer's Manual There is still much to be done, but it's a good start. --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 22:09:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:09:01 2002 Subject: [llvm-commits] CVS: llvm/docs/ www-index.html Message-ID: <200209060308.WAA01537@trinity.cs.uiuc.edu> Changes in directory llvm/docs: www-index.html updated: 1.5 -> 1.6 --- Log message: Add links to the prototype Programmers Manual --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 22:14:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:14:01 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060313.WAA26819@tank.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.19 -> 1.20 --- Log message: Using -N completely killed the diff capability. Don't worry about new files for now I guess. --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 22:15:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:15:02 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060314.WAA26841@tank.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.20 -> 1.21 --- Log message: Ok, try the -N option again, using cvs diff instead of cvs rdiff --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.20 CVSROOT/commit-diffs.pl:1.21 --- CVSROOT/commit-diffs.pl:1.20 Thu Sep 5 22:13:16 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 22:14:28 2002 @@ -115,8 +115,7 @@ $msg .= "$m->{'filename'} (r$m->{'oldrev'}) removed\n"; } else { $msg .= "$m->{'filename'} updated: $m->{'oldrev'} -> $m->{'newrev'}\n"; - #print "cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}"; - $diffs .= `cvs -Qf rdiff -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}` . "\n\n"; + $diffs .= `cvs -Qf diff -N -u -r $m->{'oldrev'} -r $m->{'newrev'} $changedir/$m->{'filename'}` . "\n\n"; } } $msg .= "\n---\nLog message:\n\n" . join('', at logmessage); From lattner at cs.uiuc.edu Thu Sep 5 22:17:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:17:01 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060316.WAA26867@tank.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.21 -> 1.22 --- Log message: Add a diff regardless of whether the file was simply updated or whether it was added or removed from the repository. --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 22:19:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:19:01 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060318.WAA26892@tank.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.22 -> 1.23 --- Log message: Ok, give up on trying to get newly added files to be included in the diffs --- Diffs of the changes: From lattner at cs.uiuc.edu Thu Sep 5 22:20:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:20:02 2002 Subject: [llvm-commits] CVS: CVSROOT/ commit-diffs.pl Message-ID: <200209060319.WAA26911@tank.cs.uiuc.edu> Changes in directory CVSROOT: commit-diffs.pl updated: 1.23 -> 1.24 --- Log message: Extremely minor change so that a space is not inserted between the directory and the file list. --- Diffs of the changes: Index: CVSROOT/commit-diffs.pl diff -u CVSROOT/commit-diffs.pl:1.23 CVSROOT/commit-diffs.pl:1.24 --- CVSROOT/commit-diffs.pl:1.23 Thu Sep 5 22:18:15 2002 +++ CVSROOT/commit-diffs.pl Thu Sep 5 22:19:11 2002 @@ -108,7 +108,7 @@ my $subject = "$changedir/"; foreach $m (@changeItems) { - $subject .= " $m->{'filename'}"; + $subject .= "$m->{'filename'} "; if ($m->{'type'} eq 'add') { $msg .= "$m->{'filename'} added (r$m->{'newrev'})\n"; } elsif ($m->{'type'} eq 'rm') { From lattner at cs.uiuc.edu Thu Sep 5 22:52:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 22:52:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CriticalEdge.cpp Message-ID: <200209060351.WAA02480@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CriticalEdge.cpp updated: 1.1 -> 1.2 --- Log message: Fix bug with critical edge splitting code where it wouldn't update PHI nodes in the old destination block to indicate that the value flows from the new edge splitting block, not from the original multi-successor block. --- Diffs of the changes: Index: llvm/lib/Transforms/Utils/CriticalEdge.cpp diff -u llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.1 llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.2 --- llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.1 Thu Sep 5 21:35:34 2002 +++ llvm/lib/Transforms/Utils/CriticalEdge.cpp Thu Sep 5 22:51:45 2002 @@ -7,6 +7,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/iTerminators.h" +#include "llvm/iPHINode.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" @@ -38,9 +39,9 @@ // Create a new basic block, linking it into the CFG. BasicBlock *NewBB = new BasicBlock(TIBB->getName()+"_crit_edge"); - + BasicBlock *DestBB = TI->getSuccessor(SuccNum); // Create our unconditional branch... - BranchInst *BI = new BranchInst(TI->getSuccessor(SuccNum)); + BranchInst *BI = new BranchInst(DestBB); NewBB->getInstList().push_back(BI); // Branch to the new block, breaking the edge... @@ -49,6 +50,15 @@ // Insert the block into the function... right after the block TI lives in. Function &F = *TIBB->getParent(); F.getBasicBlockList().insert(TIBB->getNext(), NewBB); + + // If there are any PHI nodes in DestBB, we need to update them so that they + // merge incoming values from NewBB instead of from TIBB. + // + for (BasicBlock::iterator I = DestBB->begin(); + PHINode *PN = dyn_cast(&*I); ++I) { + // We no longer enter through TIBB, now we come in through NewBB. + PN->replaceUsesOfWith(TIBB, NewBB); + } // Now if we have a pass object, update analysis information. Currently we // update DominatorSet and DominatorTree information if it's available. From lattner at cs.uiuc.edu Thu Sep 5 23:00:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Thu Sep 5 23:00:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CriticalEdge.cpp Message-ID: <200209060359.WAA02574@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CriticalEdge.cpp updated: 1.2 -> 1.3 --- Log message: Fix file header to be accurate, instead of something I just copied and pasted. --- Diffs of the changes: Index: llvm/lib/Transforms/Utils/CriticalEdge.cpp diff -u llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.2 llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.3 --- llvm/lib/Transforms/Utils/CriticalEdge.cpp:1.2 Thu Sep 5 22:51:45 2002 +++ llvm/lib/Transforms/Utils/CriticalEdge.cpp Thu Sep 5 22:59:56 2002 @@ -1,7 +1,6 @@ -//===-- Local.h - Functions to perform local transformations -----*- C++ -*--=// +//===-- CriticalEdge.cpp - Functions to detect and split critical edges ---===// // -// This family of functions perform various local transformations to the -// program. +// These functions are here to detect and split critical edges in the CFG. // //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Fri Sep 6 09:51:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 09:51:01 2002 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200209061450.JAA12459@tank.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.1 -> 1.2 --- Log message: Add information about the GlobalVariable and Module classes --- Diffs of the changes: Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.1 llvm/docs/ProgrammersManual.html:1.2 --- llvm/docs/ProgrammersManual.html:1.1 Thu Sep 5 21:50:58 2002 +++ llvm/docs/ProgrammersManual.html Fri Sep 6 09:50:55 2002 @@ -676,34 +676,164 @@ Superclasses: GlobalValue, User, Value

      - -A GlobalVariable is a subclass of GlobalValue and defines the interface to -global variables in the SSA program. It can have a name and an -initializer. (initial constant Value) - -Can be constant. +Global variables are represented with the (suprise suprise) +GlobalVariable class. Like functions, GlobalVariables are +also subclasses of GlobalValue, and as such +are always referenced by their address (global values must live in memory, so +their "name" refers to their address). Global variables may have an initial +value (which must be a Constant), and if they +have an initializer, they may be marked as "constant" themselves (indicating +that their contents never change at runtime).

      -


    Important Public Members of -the GlobalVariable class


    Important Public Members of the +GlobalVariable class

    • GlobalVariable(const Type *Ty, bool isConstant, bool isInternal, Constant *Initializer = 0, const std::string &Name = "")

      +Create a new global variable of the specified type. If isConstant is +true then the global variable will be marked as unchanging for the program, and +if isInternal is true the resultant global variable will have internal +linkage. Optionally an initializer and name may be specified for the global variable as well.

      + +

    • bool isConstant() const

      Returns true if this is a global variable is known not to be modified at runtime.

      +

    • bool hasInitializer()

      Returns true if this GlobalVariable has an intializer.

      +

    • Constant *getInitializer()

      -Returns the intializer

      +Returns the intial value for a GlobalVariable. It is not legal to call +this method if there is no initializer.

      + + + +

    +
       + +The Module class +
      + +#include "llvm/Module.h"
      +doxygen info: Module Class

      + +The Module class represents the top level structure present in LLVM +programs. An LLVM module is effectively either a translation unit of the +original program or a combination of several translation units merged by the +linker. The Module class keeps track of a list of Functions, a list of GlobalVariables, and a SymbolTable. Additionally, it contains a few +helpful member functions that try to make common operations easy.

      + + + +


    Important Public Members of the +Module class

    @@ -842,6 +972,6 @@ Chris Lattner -Last modified: Thu Sep 5 21:49:34 CDT 2002 +Last modified: Fri Sep 6 09:47:35 CDT 2002 From lattner at cs.uiuc.edu Fri Sep 6 09:53:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 09:53:01 2002 Subject: [llvm-commits] CVS: llvm/www/- New directory Message-ID: <200209061452.JAA12616@tank.cs.uiuc.edu> Changes in directory llvm/www: - updated: -> New updated: -> directory updated: -> --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/www added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Sep 6 11:27:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 11:27:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200209061626.LAA18525@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.5 -> 1.6 --- Log message: Commit Vikram's changes for 426 class --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.5 llvm/www/docs/GettingStarted.html:1.6 --- llvm/www/docs/GettingStarted.html:1.5 Tue Aug 13 16:10:30 2002 +++ llvm/www/docs/GettingStarted.html Fri Sep 6 11:26:13 2002 @@ -5,17 +5,27 @@ -

    Getting Started with the LLVM System
    By: Guochun Shi and Chris Lattner

    +

    Getting Started with the LLVM System
    By: Guochun Shi, + Chris Lattner and + Vikram Adve +

    + + +

    Contents

    + + +
    +

    Overview

    +
    + + +

    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 later sections of this guide describe the general layout of the the llvm source tree, a simple example using the LLVM tool chain, and links to find more information about LLVM or to get + help via e-mail. -

    Getting Started with LLVM

    +
    +

    Getting Started

    +
    -

    This guide is meant to get you up and running with LLVM as quickly as - possible. Once you get the basic system running you can choose an area to - dive into and learn more about. If you get stuck or something is missing - from this document, please email Chris.

    - + + +

    Getting Started Quickly (A Summary)

    + + + Here's the short story for getting up and running quickly with LLVM: +
      +
    • Find the path to the CVS repository containing LLVM (we'll call this CVSROOTDIR). +
    • cd where-you-want-llvm-to-live +
    • cvs -d CVSROOTDIR checkout llvm +
    • Edit llvm/Makefile.config to set local paths if necessary. +
    • cd llvm +
    • gmake -k |& tee gnumake.out +    # this is csh or tcsh syntax +
    + +

    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, + or go straight to Program Layout to learn about the + layout of the source code tree. + + +

    Terminology and Notation

    + + +

    Through this manual, the following names are used to denote paths + specific to the local system and working environment. These are not + environment variables you need to set, but just strings used in the rest + of this document below.. In any of the examples below, simply replace + each of these names with the appropriate pathname on your local system. + All these paths are absolute:

    +
      +
    -

    Checkout LLVM from CVS

    +

    Checkout LLVM from CVS

    -

    First step is to get the actual source code. To do this, all you need to - do is check it out from CVS. From your home directory, just enter:

    +

    Before checking out the source code, you will need to know the path to + CVS repository containing LLVM source code (we'll call this + CVSROOTDIR below). Ask the person responsible for your local LLVM + installation to give you this path. -

    cvs -d /home/vadve/vadve/Research/DynOpt/CVSRepository checkout - llvm

    - -

    This will create an 'llvm' directory in your home directory and - fully populate it with the source code for LLVM.

    +

    To get a fresh copy of the entire source code, all you + need to do is check it out from CVS as follows: +

      +
    • cd where-you-want-llvm-to-live +
    • cvs -d CVSROOTDIR checkout llvm

      +
    +

    This will create an 'llvm' directory in the current + directory and fully populate it with the LLVM source code, Makefiles, + test directories, and local copies of documentation files.

    -

    Access to /shared

    +

    Local Configuration Options

    - By default, LLVM is configured to send all compiled files into the - /shared/[yourloginname]/ directory. The idea is that this - directory is local to the machine you're working on, so the huge libraries - and .o files you will be compiling will not have to be sent over - NFS. If you are in a situation where this setup is correct, you don't have - to do anything. If you don't have a /shared directory, you will - have to make a couple of modifications to your setup.

    - - The first modification is that you need to enable the "BUILD_ROOT = - . line in the top level Makefile.common. This will instruct - LLVM to build into the current directory tree instead of - /shared.

    +

    The file llvm/Makefile.config + defines the following path variables, + which are specific to a particular installation of LLVM. + These should need to be modified only once after checking out a copy + of LLVM (if the default values do not already match your system): +

      +

    • LLVM_OBJ_DIR = Path to the llvm directory where + object files should be placed. + (See the Section on + The location for LLVM object files + for more information.) +

    • LLVMGCCDIR = Path to the location of the LLVM front-end + binaries and associated libraries. +

    • BURG = Path to the burg program used for instruction + selection. +

    • PURIFY = Path to the purify program. +
    -

    Set up your environment

    +

    The location for LLVM object files

    - -

    Now that you have the source code available, you should set up your - environment to be able to use the LLVM tools (once compiled) with as little - hassle as possible. To do this, we recommend that you add the following - lines to your .cshrc (or the corresponding lines to your - .profile if you use a bourne shell derivative): -

    -       # Make the C frontend easy to use...
    -       alias llvmgcc /home/vadve/lattner/cvs/gcc_install/bin/gcc
    +    

    The LLVM make system sends most output files generated during the build + into the directory defined by the variable LLVM_OBJ_DIR in + llvm/Makefile.config. + 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. - # Make the LLVM tools easy to use... - setenv PATH /shared/[yourloginname]/llvm/tools/Debug:${PATH} -

    +

    If you do not wish to use a different location for object files, + just set this variable to ".". -

    The C compiler is not included in the CVS tree you just checked out, so - we just point to the cannonical location, and access it with the - llvmgcc command. The rest of the LLVM tools - will be built into the llvm/tools/Debug directory. If you do not - have access to /shared, use this line instead:

    + +

    Setting up your environment

    + -
    -       setenv PATH ~/llvm/tools/Debug:${PATH}
    -    
    + NOTE: This step is optional but will set up your environment so you + can use the compiled LLVM tools with as little hassle as possible.) + +

    Add the following lines to your .cshrc (or the corresponding + lines to your .profile if you use a bourne shell derivative). - Adding these two lines to your path will make it much easier to use the LLVM - tools.

    +
    +       # Make the C front end easy to use...
    +       alias llvmgcc LLVMGCCDIR/bin/gcc
     
    +       # Make the LLVM tools easy to use...
    +       setenv PATH LLVM_OBJ_DIR/tools/Debug:${PATH}
    +    
    + The llvmgcc alias is useful because the C compiler is not + included in the CVS tree you just checked out. + +

    The other LLVM LLVM tools are part of the LLVM + source base, and built when compiling LLVM. They will be built into the + LLVM_OBJ_DIR/tools/Debug directory.

    -

    Compiling the Source Code

    +

    Compiling the source code

    Every directory in the LLVM source tree includes a Makefile to build it, @@ -121,17 +196,16 @@ in llvm/tools/Debug. If you want to look at the libraries that were compiled, look in llvm/lib/Debug.

    -

    By default, the LLVM build process sends all temporary (.o, - .so, .a) files into a /shared/[your login - name]/... directory, which is supposed to be on a disk local to the - current machine. If you get an error talking about a /shared - directory, follow the instructions in the section about - /shared.

    + If you get an error talking about a /shared directory, follow the + instructions in the section about Setting Up Your + Environment. -

    Program Layout

    +
    +

    Program Layout

    +

    One useful source of infomation about the LLVM sourcebase is the LLVM

      -
      gccas
      This took is invoked by the +
      gccas
      This tool is invoked by the llvmgcc frontend as the "assembler" part of the compiler. This - tool actually assembles its input, performs a variety of optimizations, + 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 @@ -380,9 +455,9 @@
      If you have any questions or run into any snags (or you have any - additions...), please send an email to
      Chris Lattner or Guochun Shi.

      + additions...), please send an email to + Nicholas Hildenbrandt or + Chris Lattner.

      From lattner at cs.uiuc.edu Fri Sep 6 11:34:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 11:34:01 2002 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200209061633.LAA19002@tank.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.21 -> 1.22 --- Log message: First attempt to make the web pages auto checkout to the real web page when they are commited. Maybe this will be the only try required? --- Diffs of the changes: Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.21 CVSROOT/loginfo:1.22 --- CVSROOT/loginfo:1.21 Thu Sep 5 20:41:00 2002 +++ CVSROOT/loginfo Fri Sep 6 11:33:23 2002 @@ -27,5 +27,6 @@ #^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 ( (sleep 2; cd /usr/dcs/www/www-root; cvs -q update -d) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Fri Sep 6 11:34:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 11:34:02 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209061633.LAA19090@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.2 -> 1.3 --- Log message: Trivial change to test CVS checkout scripts --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.2 llvm/www/docs/ProgrammersManual.html:1.3 --- llvm/www/docs/ProgrammersManual.html:1.2 Fri Sep 6 09:50:55 2002 +++ llvm/www/docs/ProgrammersManual.html Fri Sep 6 11:33:54 2002 @@ -3,7 +3,6 @@ -
      LLVM Programmer's Manual
    @@ -15,7 +14,7 @@
  • The C++ Standard Template Library
  • The isa<>, cast<> and dyn_cast<> templates -
  • The Core LLVM Class Heirarchy +
  • The Core LLVM Class Heirarchy Reference
    • The Value class
        @@ -150,7 +149,7 @@
      -The Core LLVM Class Heirarchy +The Core LLVM Class Heirarchy Reference
        @@ -972,6 +971,6 @@ Chris Lattner -Last modified: Fri Sep 6 09:47:35 CDT 2002 +Last modified: Fri Sep 6 11:21:49 CDT 2002 From lattner at cs.uiuc.edu Fri Sep 6 11:37:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 11:37:00 2002 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200209061636.LAA19232@tank.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.22 -> 1.23 --- Log message: Try to make the output quieter. This really actually worked on the first try, absolutely amazing! --- Diffs of the changes: Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.22 CVSROOT/loginfo:1.23 --- CVSROOT/loginfo:1.22 Fri Sep 6 11:33:23 2002 +++ CVSROOT/loginfo Fri Sep 6 11:36:33 2002 @@ -27,6 +27,6 @@ #^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 ( (sleep 2; cd /usr/dcs/www/www-root; cvs -q update -d) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu +^llvm/www ( (sleep 2; cd /usr/dcs/www/www-root; cvs -Q update -Pd) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Fri Sep 6 11:41:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 11:41:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209061640.LAA19505@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.3 -> 1.4 --- Log message: Add new section --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.3 llvm/www/docs/ProgrammersManual.html:1.4 --- llvm/www/docs/ProgrammersManual.html:1.3 Fri Sep 6 11:33:54 2002 +++ llvm/www/docs/ProgrammersManual.html Fri Sep 6 11:40:10 2002 @@ -9,6 +9,7 @@
        1. Introduction +
        2. Helpful Hints for Common Operations
        3. General Information +
          +Helpful Hints for Common Operations +
            + + +
          @@ -971,6 +980,6 @@ Chris Lattner -Last modified: Fri Sep 6 11:21:49 CDT 2002 +Last modified: Fri Sep 6 11:39:58 CDT 2002 From lattner at cs.uiuc.edu Fri Sep 6 13:32:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 13:32:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209061831.NAA26686@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.4 -> 1.5 --- Log message: Add skeleton to the section contents so that Joel knows what to fill in --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.4 llvm/www/docs/ProgrammersManual.html:1.5 --- llvm/www/docs/ProgrammersManual.html:1.4 Fri Sep 6 11:40:10 2002 +++ llvm/www/docs/ProgrammersManual.html Fri Sep 6 13:31:18 2002 @@ -9,12 +9,56 @@
          1. Introduction -
          2. Helpful Hints for Common Operations
          3. General Information +
          4. Helpful Hints for Common Operations +
          5. The Core LLVM Class Heirarchy Reference
            • The Value class @@ -50,20 +94,6 @@
            • Important iterator invalidation semantics to be aware of
            - -

            Written by Dinakar Dhurjati and Chris Lattner

          @@ -146,6 +176,7 @@ to write maintainable code more than where to put your curly braces.

          +

          @@ -153,6 +184,66 @@
            +This section describes how to perform some very simple transformations of LLVM +code. This is meant to give examples of common idioms used, showing the +practical side of LLVM transformations.

            + +Because this is a "howto" section, you should also read about the main classes +that you will be working with. The Core LLVM Class +Heirarchy Reference contains details and descriptions of the main classes +that you should know about.

            + + + + + +

          +
             + +Basic Inspection and Traversal Routines +
            + + + + + +


          Iterating over the +BasicBlocks in a Function


          Iterating over the +Instructions in a BasicBlock


          Turning an iterator into a class +pointer

          +
             + +Making simple changes +
            + + @@ -980,6 +1071,6 @@ Chris Lattner -Last modified: Fri Sep 6 11:39:58 CDT 2002 +Last modified: Fri Sep 6 13:30:36 CDT 2002 From lattner at cs.uiuc.edu Fri Sep 6 13:39:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 13:39:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/CorrelatedExprs/- New directory Message-ID: <200209061838.NAA16709@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/CorrelatedExprs: - updated: -> New updated: -> directory updated: -> --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Regression/Transforms/CorrelatedExprs added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Sep 6 13:40:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 13:40:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h Message-ID: <200209061839.NAA17892@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Scalar.h updated: 1.7 -> 1.8 --- Log message: Include stub for correlated expression elimination pass --- Diffs of the changes: Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.7 llvm/include/llvm/Transforms/Scalar.h:1.8 --- llvm/include/llvm/Transforms/Scalar.h:1.7 Tue Jul 23 14:37:38 2002 +++ llvm/include/llvm/Transforms/Scalar.h Fri Sep 6 13:39:29 2002 @@ -151,6 +151,15 @@ // Pass *createReassociatePass(); +//===----------------------------------------------------------------------===// +// +// This pass eliminates correlated conditions, such as these: +// if (X == 0) +// if (X > 2) // Known false +// else +// Y = X * Z; // = 0 +// +Pass *createCorrelatedExpressionEliminationPass(); //===----------------------------------------------------------------------===// // From lattner at cs.uiuc.edu Fri Sep 6 13:42:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 13:42:00 2002 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200209061841.NAA18083@trinity.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.50 -> 1.51 --- Log message: * No longer need to run die after instcombine * Run new correlated expressions pass * Simplify the CFG (removing dead blocks, merging blocks, eliminating branches on constant booleans, etc) after correlated exprs pass. --- Diffs of the changes: Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.50 llvm/tools/gccas/gccas.cpp:1.51 --- llvm/tools/gccas/gccas.cpp:1.50 Fri Aug 30 17:55:32 2002 +++ llvm/tools/gccas/gccas.cpp Fri Sep 6 13:41:33 2002 @@ -86,7 +86,9 @@ // Disabling until this is fixed -- Vikram, 7/7/02. // addPass(PM, createReassociatePass()); // Reassociate expressions addPass(PM, createInstructionCombiningPass()); // Combine silly seq's - addPass(PM, createDeadInstEliminationPass()); // Kill InstCombine remnants + addPass(PM, createCorrelatedExpressionEliminationPass()); + addPass(PM, createInstructionCombiningPass()); // Combine silly seq's + addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs addPass(PM, createLICMPass()); // Hoist loop invariants addPass(PM, createLoadValueNumberingPass()); // GVN for load instructions addPass(PM, createGCSEPass()); // Remove common subexprs @@ -95,8 +97,8 @@ // Run instcombine after redundancy elimination to exploit opportunities // opened up by them. addPass(PM, createInstructionCombiningPass()); - addPass(PM, createAggressiveDCEPass()); // SSA based 'Agressive DCE' - addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs + addPass(PM, createAggressiveDCEPass()); // SSA based 'Agressive DCE' + addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs } From lattner at cs.uiuc.edu Fri Sep 6 13:43:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 13:43:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Message-ID: <200209061841.NAA18112@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp added (r1.1) --- Log message: Initial checkin of Correlated Expression Elimination Pass --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Sep 6 15:47:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 15:47:01 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Message-ID: <200209062046.PAA02310@tank.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Function.cpp updated: 1.28 -> 1.29 --- Log message: * Remove extraneous #includes * Add extra argument to Function ctor to allow automatic insertion into module --- Diffs of the changes: Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.28 llvm/lib/VMCore/Function.cpp:1.29 --- llvm/lib/VMCore/Function.cpp:1.28 Wed Jul 24 17:08:49 2002 +++ llvm/lib/VMCore/Function.cpp Fri Sep 6 15:46:32 2002 @@ -5,13 +5,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Function.h" -#include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/GlobalVariable.h" -#include "llvm/BasicBlock.h" +#include "llvm/DerivedTypes.h" #include "llvm/iOther.h" -#include "llvm/Argument.h" #include "SymbolTableListTraitsImpl.h" iplist &ilist_traits::getList(Function *F) { @@ -51,13 +47,16 @@ Function::Function(const FunctionType *Ty, bool isInternal, - const std::string &name) + const std::string &name, Module *ParentModule) : GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name) { BasicBlocks.setItemParent(this); BasicBlocks.setParent(this); ArgumentList.setItemParent(this); ArgumentList.setParent(this); ParentSymTab = SymTab = 0; + + if (ParentModule) + ParentModule->getFunctionList().push_back(this); } Function::~Function() { From lattner at cs.uiuc.edu Fri Sep 6 15:48:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 15:48:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Function.h Message-ID: <200209062047.PAA02423@tank.cs.uiuc.edu> Changes in directory llvm/include/llvm: Function.h updated: 1.34 -> 1.35 --- Log message: * Clean up indentation a bit * Fix broken comments (copy and pasto) * Remove irrelevant comment * Add extra argument to function that causes it to get inserted into a module automatically. --- Diffs of the changes: Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.34 llvm/include/llvm/Function.h:1.35 --- llvm/include/llvm/Function.h:1.34 Sun Aug 25 17:54:54 2002 +++ llvm/include/llvm/Function.h Fri Sep 6 15:47:31 2002 @@ -1,11 +1,10 @@ -//===-- llvm/Function.h - Class to represent a single VM function -*- C++ -*-=// +//===-- llvm/Function.h - Class to represent a single function --*- C++ -*-===// // // This file contains the declaration of the Function class, which represents a -// single function/procedure in the VM. +// single function/procedure in LLVM. // -// Note that BasicBlock's in the Function are Value's, because they are -// referenced by instructions like calls and can go into virtual function tables -// and stuff. +// A function basically consists of a list of basic blocks, a list of arguments, +// and a symbol table. // //===----------------------------------------------------------------------===// @@ -55,7 +54,7 @@ private: // Important things that make up a function! - BasicBlockListType BasicBlocks; // The basic blocks + BasicBlockListType BasicBlocks; // The basic blocks ArgumentListType ArgumentList; // The formal arguments SymbolTable *SymTab, *ParentSymTab; @@ -68,7 +67,12 @@ void setPrev(Function *N) { Prev = N; } public: - Function(const FunctionType *Ty, bool isInternal, const std::string &N = ""); + /// Function ctor - If the (optional) Module argument is specified, the + /// function is automatically inserted into the end of the function list for + /// the module. + /// + Function(const FunctionType *Ty, bool isInternal, const std::string &N = "", + Module *M = 0); ~Function(); // Specialize setName to handle symbol table majik... @@ -83,8 +87,10 @@ /// bool isExternal() const { return BasicBlocks.empty(); } - // getNext/Prev - Return the next or previous instruction in the list. The - // last node in the list is a terminator instruction. + // getNext/Prev - Return the next or previous function in the list. These + // methods should never be used directly, and are only used to implement the + // function list as part of the module. + // Function *getNext() { return Next; } const Function *getNext() const { return Next; } Function *getPrev() { return Prev; } @@ -156,12 +162,12 @@ reverse_aiterator arend () { return ArgumentList.rend(); } const_reverse_aiterator arend () const { return ArgumentList.rend(); } - unsigned asize() const { return ArgumentList.size(); } - bool aempty() const { return ArgumentList.empty(); } - const Argument &afront() const { return ArgumentList.front(); } - Argument &afront() { return ArgumentList.front(); } - const Argument &aback() const { return ArgumentList.back(); } - Argument &aback() { return ArgumentList.back(); } + unsigned asize() const { return ArgumentList.size(); } + bool aempty() const { return ArgumentList.empty(); } + const Argument &afront() const { return ArgumentList.front(); } + Argument &afront() { return ArgumentList.front(); } + const Argument &aback() const { return ArgumentList.back(); } + Argument &aback() { return ArgumentList.back(); } virtual void print(std::ostream &OS) const; From lattner at cs.uiuc.edu Fri Sep 6 16:05:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 16:05:01 2002 Subject: [llvm-commits] CVS: llvm/getsomesrcs.sh Message-ID: <200209062104.QAA05009@tank.cs.uiuc.edu> Changes in directory llvm: getsomesrcs.sh (r1.7) removed --- Log message: Remove obsolete script --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Sep 6 16:05:03 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 16:05:03 2002 Subject: [llvm-commits] CVS: llvm/getsrcs.sh Message-ID: <200209062104.QAA05082@tank.cs.uiuc.edu> Changes in directory llvm: getsrcs.sh updated: 1.6 -> 1.7 --- Log message: Fix script due to new www/ top level directory --- Diffs of the changes: Index: llvm/getsrcs.sh diff -u llvm/getsrcs.sh:1.6 llvm/getsrcs.sh:1.7 --- llvm/getsrcs.sh:1.6 Tue Jul 23 12:56:32 2002 +++ llvm/getsrcs.sh Fri Sep 6 16:04:36 2002 @@ -1,5 +1,5 @@ #!/bin/sh # This is useful because it prints out all of the source files. Useful for # greps. -find docs include lib tools -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 docs/doxygen | grep -v include/boost +find www include lib tools -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 Fri Sep 6 16:33:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 16:33:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Argument.h BasicBlock.h Function.h GlobalValue.h GlobalVariable.h Instruction.h Message-ID: <200209062132.QAA08502@tank.cs.uiuc.edu> Changes in directory llvm/include/llvm: Argument.h updated: 1.3 -> 1.4 BasicBlock.h updated: 1.26 -> 1.27 Function.h updated: 1.35 -> 1.36 GlobalValue.h updated: 1.6 -> 1.7 GlobalVariable.h updated: 1.14 -> 1.15 Instruction.h updated: 1.32 -> 1.33 --- Log message: * Clean up some comments * Move code out of header file to .cpp files, to make future changes easier * Add arguments to classes so that they can be automatically inserted into their parent structure upon creation. --- Diffs of the changes: Index: llvm/include/llvm/Argument.h diff -u llvm/include/llvm/Argument.h:1.3 llvm/include/llvm/Argument.h:1.4 --- llvm/include/llvm/Argument.h:1.3 Sun Aug 25 17:54:54 2002 +++ llvm/include/llvm/Argument.h Fri Sep 6 16:31:57 2002 @@ -1,7 +1,7 @@ //===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=// // // This file defines the Argument class, which represents and incoming formal -// argument to a function. +// argument to a Function. // //===----------------------------------------------------------------------===// @@ -10,20 +10,20 @@ #include "llvm/Value.h" -class Argument : public Value { // Defined in the InstrType.cpp file +class Argument : public Value { // Defined in the Function.cpp file Function *Parent; Argument *Prev, *Next; // Next and Prev links for our intrusive linked list void setNext(Argument *N) { Next = N; } void setPrev(Argument *N) { Prev = N; } friend class SymbolTableListTraits; - inline void setParent(Function *parent) { Parent = parent; } + void setParent(Function *parent); public: - Argument(const Type *Ty, const std::string &Name = "") - : Value(Ty, Value::ArgumentVal, Name) { - Parent = 0; - } + /// Argument ctor - If Function argument is specified, this argument is + /// inserted at the end of the argument list for the function. + /// + Argument(const Type *Ty, const std::string &Name = "", Function *F = 0); /// setName - Specialize setName to handle symbol table majik... virtual void setName(const std::string &name, SymbolTable *ST = 0); Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.26 llvm/include/llvm/BasicBlock.h:1.27 --- llvm/include/llvm/BasicBlock.h:1.26 Sun Aug 25 17:54:54 2002 +++ llvm/include/llvm/BasicBlock.h Fri Sep 6 16:31:57 2002 @@ -44,7 +44,7 @@ InstListType InstList; BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list - void setParent(Function *parent) { InstList.setParent(parent); } + void setParent(Function *parent); void setNext(BasicBlock *N) { Next = N; } void setPrev(BasicBlock *N) { Prev = N; } friend class SymbolTableListTraits; @@ -53,20 +53,23 @@ void operator=(const BasicBlock &); // Do not implement public: - // Instruction iterators... + /// Instruction iterators... typedef InstListType::iterator iterator; typedef InstListType::const_iterator const_iterator; typedef std::reverse_iterator const_reverse_iterator; typedef std::reverse_iterator reverse_iterator; - // Ctor, dtor + /// BasicBlock ctor - If the function parameter is specified, the basic block + /// is automatically inserted at the end of the function. + /// BasicBlock(const std::string &Name = "", Function *Parent = 0); ~BasicBlock(); // Specialize setName to take care of symbol table majik virtual void setName(const std::string &name, SymbolTable *ST = 0); - // getParent - Return the enclosing method, or null if none + /// getParent - Return the enclosing method, or null if none + /// const Function *getParent() const { return InstList.getParent(); } Function *getParent() { return InstList.getParent(); } @@ -94,8 +97,8 @@ //===--------------------------------------------------------------------===// - // Instruction iterator methods - // + /// Instruction iterator methods + /// inline iterator begin() { return InstList.begin(); } inline const_iterator begin() const { return InstList.begin(); } inline iterator end () { return InstList.end(); } Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.35 llvm/include/llvm/Function.h:1.36 --- llvm/include/llvm/Function.h:1.35 Fri Sep 6 15:47:31 2002 +++ llvm/include/llvm/Function.h Fri Sep 6 16:31:57 2002 @@ -22,7 +22,7 @@ : public SymbolTableListTraits { // createNode is used to create a node that marks the end of the list... - static BasicBlock *createNode() { return new BasicBlock(); } + static BasicBlock *createNode(); static iplist &getList(Function *F); }; Index: llvm/include/llvm/GlobalValue.h diff -u llvm/include/llvm/GlobalValue.h:1.6 llvm/include/llvm/GlobalValue.h:1.7 --- llvm/include/llvm/GlobalValue.h:1.6 Sat Apr 27 23:45:05 2002 +++ llvm/include/llvm/GlobalValue.h Fri Sep 6 16:31:57 2002 @@ -1,7 +1,7 @@ //===-- llvm/GlobalValue.h - Class to represent a global value ---*- C++ -*--=// // // This file is a common base class of all globally definable objects. As such, -// it is subclassed by GlobalVariable and by Method. This is used because you +// it is subclassed by GlobalVariable and by Function. This is used because you // can do certain things with these global objects that you can't do to anything // else. For example, use the address of one as a constant. // Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.14 llvm/include/llvm/GlobalVariable.h:1.15 --- llvm/include/llvm/GlobalVariable.h:1.14 Tue Jun 25 11:10:40 2002 +++ llvm/include/llvm/GlobalVariable.h Fri Sep 6 16:31:57 2002 @@ -24,7 +24,7 @@ class GlobalVariable : public GlobalValue { friend class SymbolTableListTraits >; - void setParent(Module *parent) { Parent = parent; } + void setParent(Module *parent); GlobalVariable *Prev, *Next; void setNext(GlobalVariable *N) { Next = N; } @@ -32,9 +32,12 @@ bool isConstantGlobal; // Is this a global constant? public: + /// GlobalVariable ctor - If a parent module is specified, the global is + /// automatically inserted into the end of the specified modules global list. + /// GlobalVariable(const Type *Ty, bool isConstant, bool isInternal, - Constant *Initializer = 0, const std::string &Name = ""); - ~GlobalVariable() {} + Constant *Initializer = 0, const std::string &Name = "", + Module *Parent = 0); // Specialize setName to handle symbol table majik... virtual void setName(const std::string &name, SymbolTable *ST = 0); Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.32 llvm/include/llvm/Instruction.h:1.33 --- llvm/include/llvm/Instruction.h:1.32 Sun Aug 25 17:54:55 2002 +++ llvm/include/llvm/Instruction.h Fri Sep 6 16:31:57 2002 @@ -1,7 +1,7 @@ //===-- llvm/Instruction.h - Instruction class definition --------*- C++ -*--=// // // This file contains the declaration of the Instruction class, which is the -// base class for all of the VM instructions. +// base class for all of the LLVM instructions. // //===----------------------------------------------------------------------===// @@ -22,9 +22,9 @@ friend class SymbolTableListTraits >; - inline void setParent(BasicBlock *P) { Parent = P; } + void setParent(BasicBlock *P); protected: - unsigned iType; // InstructionType + unsigned iType; // InstructionType: The opcode of the instruction public: Instruction(const Type *Ty, unsigned iType, const std::string &Name = ""); virtual ~Instruction() { From lattner at cs.uiuc.edu Fri Sep 6 16:34:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Fri Sep 6 16:34:01 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Function.cpp Instruction.cpp Message-ID: <200209062133.QAA08578@tank.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.23 -> 1.24 Function.cpp updated: 1.29 -> 1.30 Instruction.cpp updated: 1.16 -> 1.17 --- Log message: Move code out of header files into .cpp files to make future changes easier --- Diffs of the changes: Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.23 llvm/lib/VMCore/BasicBlock.cpp:1.24 --- llvm/lib/VMCore/BasicBlock.cpp:1.23 Thu Jul 25 10:38:43 2002 +++ llvm/lib/VMCore/BasicBlock.cpp Fri Sep 6 16:33:15 2002 @@ -48,6 +48,9 @@ template SymbolTableListTraits; +// BasicBlock ctor - If the function parameter is specified, the basic block is +// automatically inserted at the end of the function. +// BasicBlock::BasicBlock(const std::string &name, Function *Parent) : Value(Type::LabelTy, Value::BasicBlockVal, name) { // Initialize the instlist... @@ -60,6 +63,10 @@ BasicBlock::~BasicBlock() { dropAllReferences(); InstList.clear(); +} + +void BasicBlock::setParent(Function *parent) { + InstList.setParent(parent); } // Specialize setName to take care of symbol table majik Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.29 llvm/lib/VMCore/Function.cpp:1.30 --- llvm/lib/VMCore/Function.cpp:1.29 Fri Sep 6 15:46:32 2002 +++ llvm/lib/VMCore/Function.cpp Fri Sep 6 16:33:15 2002 @@ -10,6 +10,10 @@ #include "llvm/iOther.h" #include "SymbolTableListTraitsImpl.h" +BasicBlock *ilist_traits::createNode() { + return new BasicBlock(); +} + iplist &ilist_traits::getList(Function *F) { return F->getBasicBlockList(); } @@ -31,6 +35,14 @@ // Argument Implementation //===----------------------------------------------------------------------===// +Argument::Argument(const Type *Ty, const std::string &Name = "", Function *Par) + : Value(Ty, Value::ArgumentVal, Name) { + Parent = 0; + if (Par) + Par->getArgumentList().push_back(this); +} + + // Specialize setName to take care of symbol table majik void Argument::setName(const std::string &name, SymbolTable *ST) { Function *P; @@ -41,11 +53,15 @@ if (P && hasName()) P->getSymbolTable()->insert(this); } +void Argument::setParent(Function *parent) { + Parent = parent; +} + + //===----------------------------------------------------------------------===// // Function Implementation //===----------------------------------------------------------------------===// - Function::Function(const FunctionType *Ty, bool isInternal, const std::string &name, Module *ParentModule) : GlobalValue(PointerType::get(Ty), Value::FunctionVal, isInternal, name) { @@ -136,10 +152,17 @@ GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern, Constant *Initializer, - const std::string &Name) + const std::string &Name, Module *ParentModule) : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name), isConstantGlobal(constant) { if (Initializer) Operands.push_back(Use((Value*)Initializer, this)); + + if (ParentModule) + ParentModule->getGlobalList().push_back(this); +} + +void GlobalVariable::setParent(Module *parent) { + Parent = parent; } // Specialize setName to take care of symbol table majik Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.16 llvm/lib/VMCore/Instruction.cpp:1.17 --- llvm/lib/VMCore/Instruction.cpp:1.16 Wed Aug 14 13:18:02 2002 +++ llvm/lib/VMCore/Instruction.cpp Fri Sep 6 16:33:15 2002 @@ -14,6 +14,10 @@ iType = it; } +void Instruction::setParent(BasicBlock *P) { + Parent = P; +} + // Specialize setName to take care of symbol table majik void Instruction::setName(const std::string &name, SymbolTable *ST) { BasicBlock *P = 0; Function *PP = 0; From jstanley at cs.uiuc.edu Fri Sep 6 16:56:01 2002 From: jstanley at cs.uiuc.edu (Joel Stanley) Date: Fri Sep 6 16:56:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209062155.QAA11268@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.5 -> 1.6 --- Log message: Added subsections to 'Basic Inspection and Traversal Routines': * Iterating over the BasicBlocks in a Function * Iterating over the Instructions in a BasicBlock * Turning an iterator into a class pointer * Finding call sites: a more complex example --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.5 llvm/www/docs/ProgrammersManual.html:1.6 --- llvm/www/docs/ProgrammersManual.html:1.5 Fri Sep 6 13:31:18 2002 +++ llvm/www/docs/ProgrammersManual.html Fri Sep 6 16:55:13 2002 @@ -24,6 +24,7 @@ in a BasicBlock
          • Turning an iterator into a class pointer +
          • Finding call sites: a more complex example
        4. Making simple changes
            @@ -59,7 +60,7 @@
          -->
      -
    • The Core LLVM Class Heirarchy Reference +
    • The Core LLVM Class Hierarchy Reference


      Iterating over the Instructions in a BasicBlock

         @@ -1243,6 +1236,10 @@ Chris Lattner +<<<<<<< ProgrammersManual.html +Last modified: Fri Sep 6 18:24:38 EDT 2002 +======= Last modified: Fri Sep 6 18:03:31 EDT 2002 +>>>>>>> 1.10 From lattner at cs.uiuc.edu Sat Sep 7 00:32:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 00:32:02 2002 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200209070531.AAA21860@tank.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.26 -> 1.27 --- Log message: Hopefully this will finally get the access stuff right. --- Diffs of the changes: Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.26 CVSROOT/loginfo:1.27 --- CVSROOT/loginfo:1.26 Fri Sep 6 17:53:22 2002 +++ CVSROOT/loginfo Sat Sep 7 00:31:42 2002 @@ -27,6 +27,6 @@ #^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 ( (sleep 2; cd /usr/dcs/www/www-root; cvs -Q update -Pd; chmod -R g+w *) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu +^llvm/www ( (sleep 2; cd /usr/dcs/www/www-root; cvs -Q update -Pd; LOGIN=`whoami`; chmod -R g+w `find . -user $LOGIN`) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Sat Sep 7 00:40:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 00:40:01 2002 Subject: [llvm-commits] CVS: CVSROOT/update-www.sh checkoutlist Message-ID: <200209070539.AAA21935@trinity.cs.uiuc.edu> Changes in directory CVSROOT: update-www.sh added (r1.1) checkoutlist updated: 1.2 -> 1.3 --- Log message: Add new script to update the web page automatically when a commit happens --- Diffs of the changes: Index: CVSROOT/checkoutlist diff -u CVSROOT/checkoutlist:1.2 CVSROOT/checkoutlist:1.3 --- CVSROOT/checkoutlist:1.2 Wed Sep 4 17:24:39 2002 +++ CVSROOT/checkoutlist Sat Sep 7 00:39:21 2002 @@ -13,4 +13,5 @@ # comment lines begin with '#' commit-diffs.pl +update-www.sh From lattner at cs.uiuc.edu Sat Sep 7 00:42:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 00:42:00 2002 Subject: [llvm-commits] CVS: CVSROOT/loginfo Message-ID: <200209070541.AAA21952@trinity.cs.uiuc.edu> Changes in directory CVSROOT: loginfo updated: 1.27 -> 1.28 --- Log message: Convert to using an external script to do the permission change to make it a bit easier to track --- Diffs of the changes: Index: CVSROOT/loginfo diff -u CVSROOT/loginfo:1.27 CVSROOT/loginfo:1.28 --- CVSROOT/loginfo:1.27 Sat Sep 7 00:31:42 2002 +++ CVSROOT/loginfo Sat Sep 7 00:40:56 2002 @@ -27,6 +27,6 @@ #^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 ( (sleep 2; cd /usr/dcs/www/www-root; cvs -Q update -Pd; LOGIN=`whoami`; chmod -R g+w `find . -user $LOGIN`) &); /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` 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} `whoami` llvm-commits at cs.uiuc.edu ^llvm /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu ^CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository/CVSROOT/commit-diffs.pl %{sVv} `whoami` llvm-commits at cs.uiuc.edu From lattner at cs.uiuc.edu Sat Sep 7 00:42:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 00:42:02 2002 Subject: [llvm-commits] CVS: llvm/www/www-index.html Message-ID: <200209070541.AAA21938@tank.cs.uiuc.edu> Changes in directory llvm/www: www-index.html updated: 1.6 -> 1.7 --- Log message: Test change --- Diffs of the changes: Index: llvm/www/www-index.html diff -u llvm/www/www-index.html:1.6 llvm/www/www-index.html:1.7 --- llvm/www/www-index.html:1.6 Thu Sep 5 22:08:08 2002 +++ llvm/www/www-index.html Sat Sep 7 00:41:23 2002 @@ -7,8 +7,7 @@ The LLVM Compiler Infrastructure Project - + From lattner at cs.uiuc.edu Sat Sep 7 17:49:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 17:49:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BasicAA/licmtest.ll Message-ID: <200209072248.RAA24850@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BasicAA: licmtest.ll updated: 1.1 -> 1.2 --- Log message: Fix broken test --- Diffs of the changes: Index: llvm/test/Regression/Transforms/BasicAA/licmtest.ll diff -u llvm/test/Regression/Transforms/BasicAA/licmtest.ll:1.1 llvm/test/Regression/Transforms/BasicAA/licmtest.ll:1.2 --- llvm/test/Regression/Transforms/BasicAA/licmtest.ll:1.1 Thu Aug 22 15:22:55 2002 +++ llvm/test/Regression/Transforms/BasicAA/licmtest.ll Sat Sep 7 17:48:30 2002 @@ -14,11 +14,11 @@ implementation int %test(bool %c) { - %Atmp = load int* %A + %ToRemove = load int* %A br label %Loop Loop: - %ToRemove = load int* %A - store int %ToRemove, int* %B ; Store cannot alias %A + %Atmp = load int* %A + store int %Atmp, int* %B ; Store cannot alias %A br bool %c, label %Out, label %Loop Out: From lattner at cs.uiuc.edu Sat Sep 7 17:51:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sat Sep 7 17:51:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BasicAA/gcsetest.ll Message-ID: <200209072250.RAA24999@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BasicAA: gcsetest.ll updated: 1.2 -> 1.3 --- Log message: Fix bug in testcase now that load-vn is not built into gcse --- Diffs of the changes: Index: llvm/test/Regression/Transforms/BasicAA/gcsetest.ll diff -u llvm/test/Regression/Transforms/BasicAA/gcsetest.ll:1.2 llvm/test/Regression/Transforms/BasicAA/gcsetest.ll:1.3 --- llvm/test/Regression/Transforms/BasicAA/gcsetest.ll:1.2 Thu Aug 22 15:22:55 2002 +++ llvm/test/Regression/Transforms/BasicAA/gcsetest.ll Sat Sep 7 17:50:41 2002 @@ -2,7 +2,7 @@ ; disambiguating some obvious cases. All loads should be removable in ; this testcase. -; RUN: if as < %s | opt -basicaa -gcse -instcombine -dce | dis | grep load +; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep load ; RUN: then exit 1 ; RUN: else exit 0 ; RUN: fi From lattner at cs.uiuc.edu Sun Sep 8 13:09:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 13:09:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BasicAA/featuretest.ll Message-ID: <200209081808.NAA05086@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BasicAA: featuretest.ll added (r1.1) --- Log message: New testcase that tests for array pointer analysis type stuff --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Sep 8 13:46:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 13:46:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysis.cpp Message-ID: <200209081845.NAA05447@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: AliasAnalysis.cpp updated: 1.4 -> 1.5 --- Log message: * Add capability to recognize alias properties of the following common cases: - A[c1] cannot alias A[c2] where constants c1 != c2 - A[i] cannot alias B[j] if A & B are provably different arrays This should help out array based codes. For example, from bzip2 from spec, 3 additional loads can be GCSE'd, and _21_ additional loads can be LICMd due to this change. In a test example from the Spec GAP benchmark (vecffe.c), this change allows _52_ additional loads to be GCSE'd and _224_ additional LICM'd loads. Not bad for such a simple change. Other testcases show no change at all because they just don't use arrays. Not too suprising there. --- Diffs of the changes: Index: llvm/lib/Analysis/AliasAnalysis.cpp diff -u llvm/lib/Analysis/AliasAnalysis.cpp:1.4 llvm/lib/Analysis/AliasAnalysis.cpp:1.5 --- llvm/lib/Analysis/AliasAnalysis.cpp:1.4 Thu Aug 29 15:08:55 2002 +++ llvm/lib/Analysis/AliasAnalysis.cpp Sun Sep 8 13:45:18 2002 @@ -21,6 +21,7 @@ #include "llvm/BasicBlock.h" #include "llvm/Support/InstVisitor.h" #include "llvm/iMemory.h" +#include "llvm/iOther.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/DerivedTypes.h" @@ -124,6 +125,24 @@ return isa(V) || isa(V) || isa(V); } +static const Value *getUnderlyingObject(const Value *V) { + if (!isa(V->getType())) return 0; + + // If we are at some type of object... return it. + if (hasUniqueAddress(V)) return V; + + // Traverse through different addressing mechanisms... + if (const Instruction *I = dyn_cast(V)) { + if (isa(I) || isa(I)) + return getUnderlyingObject(I->getOperand(0)); + } + return 0; +} + +// alias - Provide a bunch of ad-hoc rules to disambiguate in common cases, such +// as array references. Note that this function is heavily tail recursive. +// Hopefully we have a smart C++ compiler. :) +// AliasAnalysis::Result BasicAliasAnalysis::alias(const Value *V1, const Value *V2) const { // Strip off constant pointer refs if they exist @@ -135,20 +154,68 @@ // Are we checking for alias of the same value? if (V1 == V2) return MustAlias; - if (!isa(V1->getType()) || !isa(V2->getType())) + if ((!isa(V1->getType()) || !isa(V2->getType())) && + V1->getType() != Type::LongTy && V2->getType() != Type::LongTy) return NoAlias; // Scalars cannot alias each other - bool V1Unique = hasUniqueAddress(V1); - bool V2Unique = hasUniqueAddress(V2); - - if (V1Unique && V2Unique) - return NoAlias; // Can't alias if they are different unique values - - if ((V1Unique && isa(V2)) || - (V2Unique && isa(V1))) - return NoAlias; // Unique values don't alias null - - // TODO: Handle getelementptr with nonzero offset + // Strip off cast instructions... + if (const Instruction *I = dyn_cast(V1)) + return alias(I->getOperand(0), V2); + if (const Instruction *I = dyn_cast(V2)) + return alias(I->getOperand(0), V1); + + // If we have two gep instructions with identical indices, return an alias + // result equal to the alias result of the original pointer... + // + if (const GetElementPtrInst *GEP1 = dyn_cast(V1)) + if (const GetElementPtrInst *GEP2 = dyn_cast(V2)) + if (GEP1->getNumOperands() == GEP2->getNumOperands() && + GEP1->getOperand(0)->getType() == GEP2->getOperand(0)->getType()) { + if (std::equal(GEP1->op_begin()+1, GEP1->op_end(), GEP2->op_begin()+1)) + return alias(GEP1->getOperand(0), GEP2->getOperand(0)); + + // If all of the indexes to the getelementptr are constant, but + // different (well we already know they are different), then we know + // that there cannot be an alias here if the two base pointers DO alias. + // + bool AllConstant = true; + for (unsigned i = 1, e = GEP1->getNumOperands(); i != e; ++i) + if (!isa(GEP1->getOperand(i)) || + !isa(GEP2->getOperand(i))) { + AllConstant = false; + break; + } + + // If we are all constant, then look at where the the base pointers + // alias. If they are known not to alias, then we are dealing with two + // different arrays or something, so no alias is possible. If they are + // known to be the same object, then we cannot alias because we are + // indexing into a different part of the object. As usual, MayAlias + // doesn't tell us anything. + // + if (AllConstant && + alias(GEP1->getOperand(0), GEP2->getOperand(1)) != MayAlias) + return NoAlias; + } + + // Figure out what objects these things are pointing to if we can... + const Value *O1 = getUnderlyingObject(V1); + const Value *O2 = getUnderlyingObject(V2); + + // Pointing at a discernable object? + if (O1 && O2) { + // If they are two different objects, we know that we have no alias... + if (O1 != O2) return NoAlias; + + // If they are the same object, they we can look at the indexes. If they + // index off of the object is the same for both pointers, they must alias. + // If they are provably different, they must not alias. Otherwise, we can't + // tell anything. + } else if (O1 && isa(V2)) { + return NoAlias; // Unique values don't alias null + } else if (O2 && isa(V1)) { + return NoAlias; // Unique values don't alias null + } return MayAlias; } From lattner at cs.uiuc.edu Sun Sep 8 13:52:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 13:52:00 2002 Subject: [llvm-commits] CVS: llvm/include/Support/LeakDetector.h Message-ID: <200209081851.NAA05515@trinity.cs.uiuc.edu> Changes in directory llvm/include/Support: LeakDetector.h added (r1.1) --- Log message: Checkin initial support for automatic memory leak detection routines --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Sep 8 13:52:02 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 13:52:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/LeakDetector.cpp Message-ID: <200209081851.NAA05526@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Support: LeakDetector.cpp added (r1.1) --- Log message: Checkin initial support for automatic memory leak detection routines --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Sep 8 13:56:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 13:56:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Message-ID: <200209081855.NAA05541@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.1 -> 1.2 --- Log message: Minor simplification --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.1 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.2 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.1 Fri Sep 6 13:41:55 2002 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Sun Sep 8 13:55:04 2002 @@ -212,11 +212,6 @@ // information. virtual void print(std::ostream &O, const Module *M) const; - virtual void releaseMemory() { - RegionInfoMap.clear(); - RankMap.clear(); - } - private: RegionInfo &getRegionInfo(BasicBlock *BB) { std::map::iterator I @@ -272,7 +267,11 @@ DT = &getAnalysis(); std::set VisitedBlocks; - return TransformRegion(&F.getEntryNode(), VisitedBlocks); + bool Changed = TransformRegion(&F.getEntryNode(), VisitedBlocks); + + RegionInfoMap.clear(); + RankMap.clear(); + return Changed; } // TransformRegion - Transform the region starting with BB according to the From lattner at cs.uiuc.edu Sun Sep 8 14:00:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 14:00:01 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Function.cpp Instruction.cpp Module.cpp Value.cpp Message-ID: <200209081859.NAA05563@trinity.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: BasicBlock.cpp updated: 1.24 -> 1.25 Function.cpp updated: 1.30 -> 1.31 Instruction.cpp updated: 1.17 -> 1.18 Module.cpp updated: 1.28 -> 1.29 Value.cpp updated: 1.26 -> 1.27 --- Log message: Enable "garbage detection" of LLVM objects. Now users should be obnoxious warnings. If they accidentally leak LLVM Value's. --- Diffs of the changes: Index: llvm/lib/VMCore/BasicBlock.cpp diff -u llvm/lib/VMCore/BasicBlock.cpp:1.24 llvm/lib/VMCore/BasicBlock.cpp:1.25 --- llvm/lib/VMCore/BasicBlock.cpp:1.24 Fri Sep 6 16:33:15 2002 +++ llvm/lib/VMCore/BasicBlock.cpp Sun Sep 8 13:59:34 2002 @@ -1,4 +1,4 @@ -//===-- BasicBlock.cpp - Implement BasicBlock related functions --*- C++ -*--=// +//===-- BasicBlock.cpp - Implement BasicBlock related methods -------------===// // // This file implements the BasicBlock class for the VMCore library. // @@ -11,6 +11,7 @@ #include "llvm/Constant.h" #include "llvm/iPHINode.h" #include "llvm/SymbolTable.h" +#include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" #include @@ -18,7 +19,10 @@ // instruction list. This is not a real instruction. // struct DummyInst : public Instruction { - DummyInst() : Instruction(Type::VoidTy, NumOtherOps) {} + DummyInst() : Instruction(Type::VoidTy, NumOtherOps) { + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(this); + } virtual Instruction *clone() const { assert(0 && "Cannot clone EOL");abort(); @@ -56,6 +60,9 @@ // Initialize the instlist... InstList.setItemParent(this); + // Make sure that we get added to a function + LeakDetector::addGarbageObject(this); + if (Parent) Parent->getBasicBlockList().push_back(this); } @@ -66,7 +73,13 @@ } void BasicBlock::setParent(Function *parent) { + if (getParent()) + LeakDetector::addGarbageObject(this); + InstList.setParent(parent); + + if (getParent()) + LeakDetector::removeGarbageObject(this); } // Specialize setName to take care of symbol table majik Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.30 llvm/lib/VMCore/Function.cpp:1.31 --- llvm/lib/VMCore/Function.cpp:1.30 Fri Sep 6 16:33:15 2002 +++ llvm/lib/VMCore/Function.cpp Sun Sep 8 13:59:35 2002 @@ -8,10 +8,14 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/iOther.h" +#include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" BasicBlock *ilist_traits::createNode() { - return new BasicBlock(); + BasicBlock *Ret = new BasicBlock(); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } iplist &ilist_traits::getList(Function *F) { @@ -19,7 +23,10 @@ } Argument *ilist_traits::createNode() { - return new Argument(Type::IntTy); + Argument *Ret = new Argument(Type::IntTy); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } iplist &ilist_traits::getList(Function *F) { @@ -38,6 +45,10 @@ Argument::Argument(const Type *Ty, const std::string &Name = "", Function *Par) : Value(Ty, Value::ArgumentVal, Name) { Parent = 0; + + // Make sure that we get added to a function + LeakDetector::addGarbageObject(this); + if (Par) Par->getArgumentList().push_back(this); } @@ -54,7 +65,11 @@ } void Argument::setParent(Function *parent) { + if (getParent()) + LeakDetector::addGarbageObject(this); Parent = parent; + if (getParent()) + LeakDetector::removeGarbageObject(this); } @@ -71,6 +86,9 @@ ArgumentList.setParent(this); ParentSymTab = SymTab = 0; + // Make sure that we get added to a function + LeakDetector::addGarbageObject(this); + if (ParentModule) ParentModule->getFunctionList().push_back(this); } @@ -97,7 +115,11 @@ } void Function::setParent(Module *parent) { + if (getParent()) + LeakDetector::addGarbageObject(this); Parent = parent; + if (getParent()) + LeakDetector::removeGarbageObject(this); // Relink symbol tables together... ParentSymTab = Parent ? Parent->getSymbolTableSure() : 0; @@ -157,12 +179,18 @@ isConstantGlobal(constant) { if (Initializer) Operands.push_back(Use((Value*)Initializer, this)); + LeakDetector::addGarbageObject(this); + if (ParentModule) ParentModule->getGlobalList().push_back(this); } void GlobalVariable::setParent(Module *parent) { + if (getParent()) + LeakDetector::addGarbageObject(this); Parent = parent; + if (getParent()) + LeakDetector::removeGarbageObject(this); } // Specialize setName to take care of symbol table majik Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.17 llvm/lib/VMCore/Instruction.cpp:1.18 --- llvm/lib/VMCore/Instruction.cpp:1.17 Fri Sep 6 16:33:15 2002 +++ llvm/lib/VMCore/Instruction.cpp Sun Sep 8 13:59:35 2002 @@ -7,15 +7,25 @@ #include "llvm/Function.h" #include "llvm/SymbolTable.h" #include "llvm/Type.h" +#include "Support/LeakDetector.h" Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name) : User(ty, Value::InstructionVal, Name) { Parent = 0; iType = it; + + // Make sure that we get added to a basicblock + LeakDetector::addGarbageObject(this); } void Instruction::setParent(BasicBlock *P) { + if (getParent()) + LeakDetector::addGarbageObject(this); + Parent = P; + + if (getParent()) + LeakDetector::removeGarbageObject(this); } // Specialize setName to take care of symbol table majik Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.28 llvm/lib/VMCore/Module.cpp:1.29 --- llvm/lib/VMCore/Module.cpp:1.28 Sat Aug 17 19:40:04 2002 +++ llvm/lib/VMCore/Module.cpp Sun Sep 8 13:59:35 2002 @@ -9,16 +9,24 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "Support/STLExtras.h" +#include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" #include #include Function *ilist_traits::createNode() { - return new Function(FunctionType::get(Type::VoidTy,std::vector(), - false), false); + FunctionType *FTy = + FunctionType::get(Type::VoidTy, std::vector(), false); + Function *Ret = new Function(FTy, false); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } GlobalVariable *ilist_traits::createNode() { - return new GlobalVariable(Type::IntTy, false, false); + GlobalVariable *Ret = new GlobalVariable(Type::IntTy, false, false); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } iplist &ilist_traits::getList(Module *M) { Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.26 llvm/lib/VMCore/Value.cpp:1.27 --- llvm/lib/VMCore/Value.cpp:1.26 Wed Jul 24 17:08:53 2002 +++ llvm/lib/VMCore/Value.cpp Sun Sep 8 13:59:35 2002 @@ -7,6 +7,7 @@ #include "llvm/InstrTypes.h" #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" +#include "Support/LeakDetector.h" #include //===----------------------------------------------------------------------===// @@ -39,6 +40,9 @@ } #endif assert(Uses.begin() == Uses.end()); + + // There should be no uses of this object anymore, remove it. + LeakDetector::removeGarbageObject(this); } void Value::replaceAllUsesWith(Value *D) { From lattner at cs.uiuc.edu Sun Sep 8 14:01:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 14:01:01 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManagerT.h Message-ID: <200209081900.OAA05577@trinity.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManagerT.h updated: 1.25 -> 1.26 --- Log message: Enable "garbage detection" of LLVM objects. Check for leaks after running every pass. --- Diffs of the changes: Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.25 llvm/lib/VMCore/PassManagerT.h:1.26 --- llvm/lib/VMCore/PassManagerT.h:1.25 Fri Aug 30 15:25:01 2002 +++ llvm/lib/VMCore/PassManagerT.h Sun Sep 8 14:00:07 2002 @@ -17,6 +17,7 @@ #include "llvm/Pass.h" #include "Support/CommandLine.h" +#include "Support/LeakDetector.h" #include #include class Annotable; @@ -216,6 +217,10 @@ bool Changed = runPass(P, M); endPass(P); MadeChanges |= Changed; + + // Check for memory leaks by the pass... + LeakDetector::checkForGarbage(std::string("after running pass '") + + P->getPassName() + "'"); if (Changed) PMDebug::PrintPassInformation(getDepth()+1, "Made Modification", P, From ashukla at cs.uiuc.edu Sun Sep 8 15:27:01 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Sun Sep 8 15:27:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp Message-ID: <200209082026.PAA06400@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/Mapping: getLLVMinfo.cpp updated: 1.4 -> 1.5 --- Log message: Some bugs fixed in map interface --- Diffs of the changes: Index: llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp diff -u llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.4 llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.5 --- llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp:1.4 Tue Aug 27 17:42:34 2002 +++ llvm/lib/Reoptimizer/Mapping/getLLVMinfo.cpp Sun Sep 8 15:26:15 2002 @@ -67,7 +67,7 @@ } -vector getLLVMInstrInfo(Instruction *LI){ +vector getLLVMInstrInfo(Instruction *LI){ //std::cerr<<"BBMimaplength: "< BBnoVec = getBasicBlockInfo(BB); + pair BBnoVec = getBasicBlockInfo(BB); //std::cerr<<"got BBnoVec\n"; unsigned Fno = getFunctionNo(F); @@ -95,19 +95,19 @@ vector &MInoVec = getLLVMInstrInfo(Fno, BBno, LIno); //std::cerr<<"got MInoVec\n"; - unsigned *BBadd = BBnoVec.first; + uint64_t BBadd = BBnoVec.first; //std::cerr<<"added BBadd: "< MIaddVec; + vector MIaddVec; for(unsigned i = 0; i < MInoVec.size(); ++i) { - MIaddVec.push_back(BBadd+MInoVec[i]); + MIaddVec.push_back(BBadd+MInoVec[i]*4); } //std::cerr<"done\n"; return MIaddVec; } -pair getBasicBlockInfo(BasicBlock *BB){ +pair getBasicBlockInfo(BasicBlock *BB){ //std::cerr<<"BBMimaplength: "< &BBnoVec = getBasicBlockInfo(Fno, BBno); //std::cerr<<"got BBnoVec\n"; - unsigned *Fadd = (unsigned *)llvmFunctionTable[Fno]; - //std::cerr<<"got Fadd\n"; - unsigned *BBstartAdd = Fadd + BBnoVec.first; + //unsigned *Fadd = (unsigned *)llvmFunctionTable[Fno]; + uint64_t Fadd = (uint64_t)llvmFunctionTable[Fno]; + std::cerr<<"########### Function add:"<<(void *)Fadd<<"\n"; + + uint64_t BBstartAdd = Fadd + BBnoVec.first*4;//anand-- added *4 //std::cerr<<"added BBstartAdd: "< &MIList = MImapF[FunctionNo][BasicBlockNo]; + vector &MIList = MImapF[BasicBlockNo][LLVMInstrNo];//MImapF[FunctionNo][BasicBlockNo]; + std::cerr<<"************* BB#"<::iterator MI = MIList.begin(), ME = MIList.end(); + MI!=ME; ++MI) + std::cerr<<*MI<<"\n"; + return MIList; } @@ -228,22 +236,22 @@ assert(LIi < LIend && "Trying to read off the end of list of LMIMap"); unsigned BasicBlockNumber = readNumber(LIi); - //std::cerr<<"BasicBlockNumber= "< > LImap; for(unsigned j=0; j oneLI; for(unsigned k=0; k Changes in directory llvm/include/llvm/Reoptimizer/Mapping: LLVMinfo.h updated: 1.2 -> 1.3 --- Log message: Changed address data type to uint64_t --- Diffs of the changes: Index: llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h diff -u llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.2 llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.3 --- llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.2 Thu Aug 1 02:20:24 2002 +++ llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h Sun Sep 8 15:32:11 2002 @@ -6,6 +6,5 @@ //BasicBlockNo); //vector getLLVMInstrInfo(int FunctionNo, int BasicBlockNo, // int LLVMInstrNo); -vector getLLVMInstrInfo(Instruction *LI); -std::pair getBasicBlockInfo(BasicBlock *BB); - +vector getLLVMInstrInfo(Instruction *LI); +std::pair getBasicBlockInfo(BasicBlock *BB); From lattner at cs.uiuc.edu Sun Sep 8 16:08:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:08:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/InstrSelection.h Message-ID: <200209082107.QAA07187@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: InstrSelection.h updated: 1.20 -> 1.21 --- Log message: Move TmpInstruction ctor to InstrSelection.cpp file --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/InstrSelection.h diff -u llvm/include/llvm/CodeGen/InstrSelection.h:1.20 llvm/include/llvm/CodeGen/InstrSelection.h:1.21 --- llvm/include/llvm/CodeGen/InstrSelection.h:1.20 Fri Aug 9 15:07:29 2002 +++ llvm/include/llvm/CodeGen/InstrSelection.h Sun Sep 8 16:07:51 2002 @@ -68,22 +68,12 @@ public: // Constructor that uses the type of S1 as the type of the temporary. // s1 must be a valid value. s2 may be NULL. - TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = "") - : Instruction(s1->getType(), Instruction::UserOp1, name) { - Operands.push_back(Use(s1, this)); // s1 must be nonnull - if (s2) { - Operands.push_back(Use(s2, this)); - } - } + TmpInstruction(Value *s1, Value *s2 = 0, const std::string &name = ""); // Constructor that requires the type of the temporary to be specified. // Both S1 and S2 may be NULL. TmpInstruction(const Type *Ty, Value *s1 = 0, Value* s2 = 0, - const std::string &name = "") - : Instruction(Ty, Instruction::UserOp1, name) { - if (s1) { Operands.push_back(Use(s1, this)); } - if (s2) { Operands.push_back(Use(s2, this)); } - } + const std::string &name = ""); virtual Instruction *clone() const { return new TmpInstruction(*this); } virtual const char *getOpcodeName() const { From lattner at cs.uiuc.edu Sun Sep 8 16:09:00 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:09:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200209082108.QAA07206@trinity.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.45 -> 1.46 --- Log message: Inform the memory leak detector that TmpInstruction objects should not be subject to memory leak checking. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.45 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.46 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.45 Fri Aug 9 15:05:34 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sun Sep 8 16:08:43 2002 @@ -19,6 +19,7 @@ #include "llvm/iPHINode.h" #include "llvm/Pass.h" #include "Support/CommandLine.h" +#include "Support/LeakDetector.h" using std::cerr; using std::vector; @@ -70,6 +71,29 @@ // Register the pass... static RegisterLLC X("instselect", "Instruction Selection", createInstructionSelectionPass); + +TmpInstruction::TmpInstruction(Value *s1, Value *s2, const std::string &name) + : Instruction(s1->getType(), Instruction::UserOp1, name) { + Operands.push_back(Use(s1, this)); // s1 must be nonnull + if (s2) { + Operands.push_back(Use(s2, this)); + } + + // TmpInstructions should not be garbage checked. + LeakDetector::removeGarbageObject(this); +} + +// Constructor that requires the type of the temporary to be specified. +// Both S1 and S2 may be NULL.( +TmpInstruction::TmpInstruction(const Type *Ty, Value *s1, Value* s2, + const std::string &name) + : Instruction(Ty, Instruction::UserOp1, name) { + if (s1) { Operands.push_back(Use(s1, this)); } + if (s2) { Operands.push_back(Use(s2, this)); } + + // TmpInstructions should not be garbage checked. + LeakDetector::removeGarbageObject(this); +} bool InstructionSelection::runOnFunction(Function &F) From lattner at cs.uiuc.edu Sun Sep 8 16:20:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:20:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200209082119.QAA07581@trinity.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.46 -> 1.47 --- Log message: Make sure the leakdetector is told about temporary Phi nodes also, so it doesn't erroneously report them as leaks --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.46 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.47 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.46 Sun Sep 8 16:08:43 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sun Sep 8 16:19:29 2002 @@ -173,7 +173,12 @@ PHINode *PN = dyn_cast(&*IIt); ++IIt) { // FIXME: This is probably wrong... Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:"); - + + // The leak detector shouldn't track these nodes. They are not garbage, + // even though their parent field is never filled in. + // + LeakDetector::removeGarbageObject(PhiCpRes); + // for each incoming value of the phi, insert phi elimination // for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) { From lattner at cs.uiuc.edu Sun Sep 8 16:38:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:38:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll Message-ID: <200209082137.QAA08328@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2002-09-08-PointerShiftBug.ll added (r1.1) --- Log message: New testcase for a bug identified by Vikram --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Sep 8 16:40:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:40:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200209082139.QAA08540@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.52 -> 1.53 --- Log message: Fix Bug: test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.52 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.53 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.52 Mon Sep 2 20:07:49 2002 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Sep 8 16:39:07 2002 @@ -492,6 +492,7 @@ if (ConstantUInt *CUI = dyn_cast(Op1)) { unsigned TypeBits = Op0->getType()->getPrimitiveSize()*8; if (CUI->getValue() >= TypeBits && + TypeBits && // FIXME: Handle pointer operands here. This should go away !(Op0->getType()->isSigned() && I.getOpcode() == Instruction::Shr)) return ReplaceInstUsesWith(I, Constant::getNullValue(Op0->getType())); } From lattner at cs.uiuc.edu Sun Sep 8 16:48:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 16:48:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Message-ID: <200209082147.QAA08653@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: DeadTypeElimination.cpp updated: 1.39 -> 1.40 --- Log message: Factor silly code duplication out --- Diffs of the changes: Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.39 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.40 --- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.39 Thu Aug 8 14:01:21 2002 +++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Sun Sep 8 16:47:54 2002 @@ -74,21 +74,16 @@ // Loop over all entries in the type plane... SymbolTable::VarMap &Plane = STI->second; for (SymbolTable::VarMap::iterator PI = Plane.begin(); PI != Plane.end();) - if (ShouldNukeSymtabEntry(*PI)) { // Should we remove this entry? + // If this entry should be unconditionally removed, or if we detect that + // the type is not used, remove it. + // + if (ShouldNukeSymtabEntry(*PI) || + !UsedTypes.count(cast(PI->second))) { #if MAP_IS_NOT_BRAINDEAD PI = Plane.erase(PI); // STD C++ Map should support this! #else Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH* PI = Plane.begin(); -#endif - ++NumKilled; - Changed = true; - } else if (!UsedTypes.count(cast(PI->second))) { -#if MAP_IS_NOT_BRAINDEAD - PI = Plane.erase(PI); // STD C++ Map should support this! -#else - Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH* - PI = Plane.begin(); // N^2 algorithms are fun. :( #endif ++NumKilled; Changed = true; From lattner at cs.uiuc.edu Sun Sep 8 22:43:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 22:43:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll Message-ID: <200209090342.WAA21644@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2002-05-14-TouchDeletedInst.ll updated: 1.2 -> 1.3 --- Log message: Eliminate multiply of pointer type --- Diffs of the changes: Index: llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll diff -u llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll:1.2 llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll:1.3 --- llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll:1.2 Thu Aug 22 11:39:12 2002 +++ llvm/test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll Sun Sep 8 22:42:14 2002 @@ -375,7 +375,8 @@ %reg632 = phi uint [ %reg634, %bb36 ], [ %cast948, %bb35 ] ; [#uses=1] %reg633 = phi uint [ %reg635, %bb36 ], [ 0, %bb35 ] ; [#uses=2] %reg633-casted = cast uint %reg633 to sbyte* ; [#uses=1] - %reg631-scale = mul sbyte* %reg633-casted, null ; [#uses=1] + %reg631-scale = mul uint %reg633, 0 ; [#uses=1] + %reg631-scale = cast uint %reg631-scale to sbyte* %reg6311 = getelementptr sbyte* %reg631-scale, uint %parent-idxcast ; [#uses=2] %reg632-scale = mul uint %reg632, 4 ; [#uses=1] %reg5581 = getelementptr sbyte* %reg6311, uint %reg632-scale ; [#uses=1] From lattner at cs.uiuc.edu Sun Sep 8 22:44:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 22:44:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll Message-ID: <200209090343.WAA21702@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2002-09-08-PointerShiftBug.ll (r1.1) removed --- Log message: Testcase no longer applicable since shifts of pointers are no longer allowed --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Sep 8 22:49:01 2002 From: lattner at cs.uiuc.edu (Christopher Lattner) Date: Sun Sep 8 22:49:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/WritingAnLLVMPass.html Message-ID: <200209090348.WAA21734@trinity.cs.uiuc.edu> Changes in directory llvm/www/docs: WritingAnLLVMPass.html updated: 1.6 -> 1.7 --- Log message: Fix minor typo --- Diffs of the changes: Index: llvm/www/docs/WritingAnLLVMPass.html diff -u llvm/www/docs/WritingAnLLVMPass.html:1.6 llvm/www/docs/WritingAnLLVMPass.html:1.7 --- llvm/www/docs/WritingAnLLVMPass.html:1.6 Thu Sep 5 21:02:58 2002 +++ llvm/www/docs/WritingAnLLVMPass.html Sun Sep 8 22:48:46 2002 @@ -194,7 +194,7 @@ This declares a "Hello" class that is a subclass of FunctionPass. -The different builting pass subclasses are described in detail later, but for now, know that FunctionPass's operate a function at a time.