summaryrefslogtreecommitdiff
path: root/tools/opt/opt.cpp
Commit message (Collapse)AuthorAge
...
* Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn'tDan Gohman2009-09-11
| | | | | | | | | | | | | | | | working. To support this, add an is_displayed() function to raw_ostream, and generalize Process::StandardOutIsDisplayed and friends in order to support it. Also, call RemoveFileOnSignal before creating a file instead of after, so that the file isn't left behind if the program is interrupted between when the file is created and RemoveFileOnSignal is called. While here, add a -S to llvm-extract and port it to IRReader so that it supports assembly input. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81568 91177308-0d34-0410-b5e6-96231b3b80d8
* opt: Add -S option to print output as LLVM assembly.Daniel Dunbar2009-09-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81082 91177308-0d34-0410-b5e6-96231b3b80d8
* Use IRReader.h in opt, to support reading of LLVM Assembly files directly.Dan Gohman2009-09-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80922 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some nasty callgraph dangling pointer problems in Chris Lattner2009-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | argpromotion and structretpromote. Basically, when replacing a function, they used the 'changeFunction' api which changes the entry in the function map (and steals/reuses the callgraph node). This has some interesting effects: first, the problem is that it doesn't update the "callee" edges in any callees of the function in the call graph. Second, this covers for a major problem in all the CGSCC pass stuff, which is that it is completely broken when functions are deleted if they *don't* reuse a CGN. (there is a cute little fixme about this though :). This patch changes the protocol that CGSCC passes must obey: now the CGSCC pass manager copies the SCC and preincrements its iterator to avoid passes invalidating it. This allows CGSCC passes to mutate the current SCC. However multiple passes may be run on that SCC, so if passes do this, they are now required to *update* the SCC to be current when they return. Other less interesting parts of this patch are that it makes passes update the CG more directly, eliminates changeFunction, and requires clients of replaceCallSite to specify the new callee CGN if they are changing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LLVM command-line tools overwrite their output files without -f.Dan Gohman2009-08-25
| | | | | | | | | | | | | | | | | This is conventional command-line tool behavior. -f now just means "enable binary output on terminals". Add a -f option to llvm-extract and llvm-link, for consistency. Remove F_Force from raw_fd_ostream and enable overwriting and truncating by default. Introduce an F_Excl flag to permit users to enable a failure when the file already exists. This flag is currently unused. Update Makefiles and documentation accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8
* These flushes were only needed when the code was transitioning betweenDan Gohman2009-08-24
| | | | | | | std::cout and outs(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79891 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate the ostream version of CheckBitcodeOutputToConsole,Chris Lattner2009-08-23
| | | | | | | | change the raw_ostream one to take the raw_ostream byref instead of byptr. Prune #includes, eliminate a use of Streams.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79863 91177308-0d34-0410-b5e6-96231b3b80d8
* use raw_fd_ostream instead of fstream with graphwriter,Chris Lattner2009-08-23
| | | | | | | flush the right stream in opt.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79837 91177308-0d34-0410-b5e6-96231b3b80d8
* Change Pass::print to take a raw ostream instead of std::ostream,Chris Lattner2009-08-23
| | | | | | | update all code that this affects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
* Change raw_fd_ostream to take flags as an optional bitmask Chris Lattner2009-08-23
| | | | | | | | | | | | | | | | | | | instead of as two bools. Use this to add a F_Append flag which has the obvious behavior. Other unrelated changes conflated into this patch: 1. REmove EH stuff from llvm-dis and llvm-as, the try blocks are dead. 2. Simplify the filename inference code in llvm-as/llvm-dis, because raw_fd_ostream does the right thing with '-'. 3. Switch machine verifier to use raw_ostream instead of ostream (Which is the thing that needed append in the first place). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79807 91177308-0d34-0410-b5e6-96231b3b80d8
* Make unit-at-a-time on by default to match the behavior of llvm-gcc.Eric Christopher2009-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79698 91177308-0d34-0410-b5e6-96231b3b80d8
* Kill trailing whitespace.Eric Christopher2009-08-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79696 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash in SROA. The FunctionPass::doInitialization method was neverBob Wilson2009-07-17
| | | | | | | | being called so that Context was never initialized. I'm not sure if this is the right fix but at least it keeps opt from crashing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76220 91177308-0d34-0410-b5e6-96231b3b80d8
* opt: Add -std-link-opts argument, matches llvm-ld's optimizations.Daniel Dunbar2009-07-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76199 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert more tools code from cerr and cout to errs() and outs().Dan Gohman2009-07-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76070 91177308-0d34-0410-b5e6-96231b3b80d8
* To simplify the upcoming context-on-type change, switch all command line ↵Owen Anderson2009-07-15
| | | | | | | | | tools to using the default global context for now. This will let us to hardwire stuff to the global context in the short term while the API is sorted out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75846 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a Force option to raw_fd_ostream to specify whether openingDan Gohman2009-07-15
| | | | | | | | | an existing file is considered an error. Convert several tools to use raw_fd_ostream instead of std::ostream, and to use this new option instead of doing a manual check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75801 91177308-0d34-0410-b5e6-96231b3b80d8
* Hold the LLVMContext by reference rather than by pointer.Owen Anderson2009-07-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a pointer to the owning LLVMContext to Module. This requires threading ↵Owen Anderson2009-07-01
| | | | | | | | | | | LLVMContext through a lot of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch opt to using StandardPasses.hDaniel Dunbar2009-06-03
| | | | | | | - No functionality change, but please check if you don't believe me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72789 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate several more unnecessary intptr_t casts.Dan Gohman2009-02-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64888 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename AddReadAttrs to FunctionAttrs, and teach it howDuncan Sands2008-12-31
| | | | | | | | | to work out (in a very simplistic way) which function arguments (pointer arguments only) are only dereferenced and so do not escape. Mark such arguments 'nocapture'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61525 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable LoopIndexSplit pass.Devang Patel2008-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60555 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable -loop-index-split for now.Devang Patel2008-11-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60087 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust indent.Zhongxing Xu2008-11-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60081 91177308-0d34-0410-b5e6-96231b3b80d8
* fix memory leak in pass manager when adding an analysis pass that already ↵Nuno Lopes2008-11-04
| | | | | | | | existed. as pass manager takes ownership of the added passes, it has to delete the pass if it isnt added to the pass list tweak the opt tool so that it doesnt access a Pass after the ownership was taken by the pass manager git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58730 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Print*Pass to use raw_ostream.Daniel Dunbar2008-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57946 91177308-0d34-0410-b5e6-96231b3b80d8
* Privatize PrintModulePass and PrintFunctionPass and addDaniel Dunbar2008-10-21
| | | | | | | | createPrintModulePass and createPrintFunctionPass. - So clients who compile w/o RTTI can use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57933 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn on the AddReadAttrs pass.Duncan Sands2008-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56345 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comments, help messages.Devang Patel2008-09-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56282 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix cut-n-pasto.Devang Patel2008-09-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56265 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -O1, -O2 and -O3 that matches llvm-gcc's -O1, -O2 and -O3 respectively.Devang Patel2008-09-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56255 91177308-0d34-0410-b5e6-96231b3b80d8
* End of the GlobalsModRef experiment.Duncan Sands2008-09-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56222 91177308-0d34-0410-b5e6-96231b3b80d8
* Give GlobalsModRef a whirl in the nightly testers.Duncan Sands2008-09-12
| | | | | | | | | | I placed it just before GVN because that it is the pass most likely to benefit from it. Some quick and dirty testing confirms that this is a decent place for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56144 91177308-0d34-0410-b5e6-96231b3b80d8
* Backout 55429Devang Patel2008-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55432 91177308-0d34-0410-b5e6-96231b3b80d8
* Add facility to create a target.Devang Patel2008-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55429 91177308-0d34-0410-b5e6-96231b3b80d8
* Goodbye tail duplication (for good this time).Evan Cheng2008-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53574 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment.Duncan Sands2008-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53525 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2231 - opt -internalize -std-compile-opts should run internalize firstChris Lattner2008-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53523 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-enable the newly simplified ADCE. This fixes a regression onOwen Anderson2008-05-29
| | | | | | | Dhrystone introduced by its removal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51669 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove ADCE from the optimization pipeline.Owen Anderson2008-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51581 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-enable tail duplication pass (now with default threshold down to 1 ↵Evan Cheng2008-05-16
| | | | | | instruction). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51184 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tail duplication pass.Evan Cheng2008-05-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51139 91177308-0d34-0410-b5e6-96231b3b80d8
* Recover nestedloop regression reported by nightly tester.Devang Patel2008-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51110 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not run instruction combiner in middle of loop optimization passes.Devang Patel2008-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51084 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-enable loop deletion by default.Owen Anderson2008-05-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50941 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable loop deletion until the release branch.Owen Anderson2008-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50787 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable dead loop elimination.Owen Anderson2008-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50682 91177308-0d34-0410-b5e6-96231b3b80d8
* move libcalls to the same place llvm-gcc has it.Chris Lattner2008-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50593 91177308-0d34-0410-b5e6-96231b3b80d8
* enable jump threading pass by default. This causes no miscompilations Chris Lattner2008-04-21
| | | | | | | and can significantly shrinkify some code, particularly from C++ land. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50025 91177308-0d34-0410-b5e6-96231b3b80d8