1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

392 Commits

Author SHA1 Message Date
Eric Christopher
2f014c4d8d Revert "Recommit r179497 after fixing uninitialized variable." until
I can fix the testcases here:

http://lab.llvm.org:8011/builders/clang-native-arm-cortex-a9/builds/6952

This reverts commit r179512 due to testcases specifying triples
that they didn't actually mean and causing failures on other platforms.

llvm-svn: 179513
2013-04-15 07:31:37 +00:00
Eric Christopher
d78f751bfe Recommit r179497 after fixing uninitialized variable.
llvm-svn: 179512
2013-04-15 07:07:21 +00:00
Eric Christopher
d4e829416f Revert "Remove some unused triple and data layout."
This reverts commit r179497 and the accompanying commit as it broke random platforms that aren't osx.

llvm-svn: 179499
2013-04-14 23:35:36 +00:00
Eric Christopher
e186ac3fd1 If we've specified a triple on the command line then go ahead
and use that as the default triple for the module and target
data layout.

llvm-svn: 179497
2013-04-14 23:32:40 +00:00
Andy Gibbs
651d32efb2 Replace uses of the deprecated std::auto_ptr with OwningPtr.
llvm-svn: 179373
2013-04-12 10:56:28 +00:00
Chandler Carruth
5bf5043e5b Split out the IRReader header and the utility functions it provides into
its own library. These functions are bridging between the bitcode reader
and the ll parser which are in different libraries. Previously we didn't
have any good library to do this, and instead played fast and loose with
a "header only" set of interfaces in the Support library. This really
doesn't work well as evidenced by the recent attempt to add timing logic
to the these routines.

As part of this, make them normal functions rather than weird inline
functions, and sink the implementation into the library. Also clean up
the header to be nice and minimal.

This requires updating lots of build system dependencies to specify that
the IRReader library is needed, and several source files to not
implicitly rely upon the header file to transitively include all manner
of other headers.

If you are using IRReader.h, this commit will break you (the header
moved) and you'll need to also update your library usage to include
'irreader'. I will commit the corresponding change to Clang momentarily.

llvm-svn: 177971
2013-03-26 02:25:37 +00:00
Michael Gottesman
3d8ed99b1f Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer.
llvm-svn: 173647
2013-01-28 01:35:51 +00:00
Chandler Carruth
7c0d682f47 Sort all of the includes. Several files got checked in with mis-sorted
includes.

llvm-svn: 172891
2013-01-19 08:03:47 +00:00
Jakub Staszak
31e75c8016 Fix #includes after my last commit.
llvm-svn: 172114
2013-01-10 21:56:40 +00:00
Chandler Carruth
4c4c8c33e1 Move CallGraphSCCPass.h into the Analysis tree; that's where the
implementation lives already.

llvm-svn: 171746
2013-01-07 15:26:48 +00:00
Chandler Carruth
30bd563e01 Switch TargetTransformInfo from an immutable analysis pass that requires
a TargetMachine to construct (and thus isn't always available), to an
analysis group that supports layered implementations much like
AliasAnalysis does. This is a pretty massive change, with a few parts
that I was unable to easily separate (sorry), so I'll walk through it.

The first step of this conversion was to make TargetTransformInfo an
analysis group, and to sink the nonce implementations in
ScalarTargetTransformInfo and VectorTargetTranformInfo into
a NoTargetTransformInfo pass. This allows other passes to add a hard
requirement on TTI, and assume they will always get at least on
implementation.

The TargetTransformInfo analysis group leverages the delegation chaining
trick that AliasAnalysis uses, where the base class for the analysis
group delegates to the previous analysis *pass*, allowing all but tho
NoFoo analysis passes to only implement the parts of the interfaces they
support. It also introduces a new trick where each pass in the group
retains a pointer to the top-most pass that has been initialized. This
allows passes to implement one API in terms of another API and benefit
when some other pass above them in the stack has more precise results
for the second API.

The second step of this conversion is to create a pass that implements
the TargetTransformInfo analysis using the target-independent
abstractions in the code generator. This replaces the
ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
lib/Target with a single pass in lib/CodeGen called
BasicTargetTransformInfo. This class actually provides most of the TTI
functionality, basing it upon the TargetLowering abstraction and other
information in the target independent code generator.

The third step of the conversion adds support to all TargetMachines to
register custom analysis passes. This allows building those passes with
access to TargetLowering or other target-specific classes, and it also
allows each target to customize the set of analysis passes desired in
the pass manager. The baseline LLVMTargetMachine implements this
interface to add the BasicTTI pass to the pass manager, and all of the
tools that want to support target-aware TTI passes call this routine on
whatever target machine they end up with to add the appropriate passes.

The fourth step of the conversion created target-specific TTI analysis
passes for the X86 and ARM backends. These passes contain the custom
logic that was previously in their extensions of the
ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
I separated them into their own file, as now all of the interface bits
are private and they just expose a function to create the pass itself.
Then I extended these target machines to set up a custom set of analysis
passes, first adding BasicTTI as a fallback, and then adding their
customized TTI implementations.

The fourth step required logic that was shared between the target
independent layer and the specific targets to move to a different
interface, as they no longer derive from each other. As a consequence,
a helper functions were added to TargetLowering representing the common
logic needed both in the target implementation and the codegen
implementation of the TTI pass. While technically this is the only
change that could have been committed separately, it would have been
a nightmare to extract.

The final step of the conversion was just to delete all the old
boilerplate. This got rid of the ScalarTargetTransformInfo and
VectorTargetTransformInfo classes, all of the support in all of the
targets for producing instances of them, and all of the support in the
tools for manually constructing a pass based around them.

Now that TTI is a relatively normal analysis group, two things become
straightforward. First, we can sink it into lib/Analysis which is a more
natural layer for it to live. Second, clients of this interface can
depend on it *always* being available which will simplify their code and
behavior. These (and other) simplifications will follow in subsequent
commits, this one is clearly big enough.

Finally, I'm very aware that much of the comments and documentation
needs to be updated. As soon as I had this working, and plausibly well
commented, I wanted to get it committed and in front of the build bots.
I'll be doing a few passes over documentation later if it sticks.

Commits to update DragonEgg and Clang will be made presently.

llvm-svn: 171681
2013-01-07 01:37:14 +00:00
Chandler Carruth
43148d2e6e Convert the TargetTransformInfo from an immutable pass with dynamic
interfaces which could be extracted from it, and must be provided on
construction, to a chained analysis group.

The end goal here is that TTI works much like AA -- there is a baseline
"no-op" and target independent pass which is in the group, and each
target can expose a target-specific pass in the group. These passes will
naturally chain allowing each target-specific pass to delegate to the
generic pass as needed.

In particular, this will allow a much simpler interface for passes that
would like to use TTI -- they can have a hard dependency on TTI and it
will just be satisfied by the stub implementation when that is all that
is available.

This patch is a WIP however. In particular, the "stub" pass is actually
the one and only pass, and everything there is implemented by delegating
to the target-provided interfaces. As a consequence the tools still have
to explicitly construct the pass. Switching targets to provide custom
passes and sinking the stub behavior into the NoTTI pass is the next
step.

llvm-svn: 171621
2013-01-05 11:43:11 +00:00
Chandler Carruth
4c1f3c24db Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00
Chandler Carruth
03fda8f594 Sort a few more #include lines in tools/... unittests/... and utils/...
llvm-svn: 171363
2013-01-02 10:26:28 +00:00
Nadav Rotem
8952ef0071 Make opt grab the triple from the module and use it to initialize the target machine.
llvm-svn: 171341
2013-01-01 08:00:32 +00:00
NAKAMURA Takumi
3e21082d83 llvm/tools: Add #include "llvm/TargetTransformInfo.h"
llvm-svn: 169817
2012-12-11 05:53:37 +00:00
Chandler Carruth
800daa7d3d Sort the #include lines for tools/...
Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

llvm-svn: 169252
2012-12-04 10:44:52 +00:00
Pedro Artigas
a84c753671 One more step towards making doInitialization and doFinalization useful for
start up and clean up module passes, now that ASAN and TSAN are fixed the
tests pass

llvm-svn: 168905
2012-11-29 17:47:05 +00:00
Owen Anderson
ef8881a314 Revert r168635 "Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model".
It appears to have broken at least one buildbot.

llvm-svn: 168654
2012-11-27 00:53:24 +00:00
Owen Anderson
4f32762479 Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model
Patch by Pedro Artigas, with feedback from by Chandler Carruth.

llvm-svn: 168635
2012-11-26 23:54:47 +00:00
Owen Anderson
c7fb54baff Add doInitialization and doFinalization methods to ModulePass's, to allow them to be re-initialized and reused on multiple Module's.
Patch by Pedro Artigas.

llvm-svn: 168008
2012-11-15 00:14:15 +00:00
Nadav Rotem
02f4e63bef Opt does not need to initialize the Asm printer/parser
llvm-svn: 166602
2012-10-24 17:55:53 +00:00
Nadav Rotem
9a7ae2437a Opt needs to initialize the different targets.
llvm-svn: 166595
2012-10-24 17:23:50 +00:00
Nadav Rotem
3cce3abf28 Reapply the TargerTransformInfo changes, minus the changes to LSR and Lowerinvoke.
llvm-svn: 166248
2012-10-18 23:22:48 +00:00
Bob Wilson
b6adb70bdd Temporarily revert the TargetTransform changes.
The TargetTransform changes are breaking LTO bootstraps of clang.  I am
working with Nadav to figure out the problem, but I am reverting it for now
to get our buildbots working.

This reverts svn commits: 165665 165669 165670 165786 165787 165997
and I have also reverted clang svn 165741

llvm-svn: 166168
2012-10-18 05:43:52 +00:00
Nadav Rotem
b82a3821f7 Add a new interface to allow IR-level passes to access codegen-specific information.
llvm-svn: 165665
2012-10-10 22:04:55 +00:00
Micah Villmow
fe3338a7eb Move TargetData to DataLayout.
llvm-svn: 165403
2012-10-08 16:39:34 +00:00
Logan Chien
817a6787d8 Code cleanup: tools/opt/opt.cpp
Remove unused local variable.

llvm-svn: 163061
2012-09-01 14:43:30 +00:00
Bill Wendling
e8949ecfa6 Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and
include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h.

The reasoning is because the DebugInfo module is simply an interface to the
debug info MDNodes and has nothing to do with analysis.

llvm-svn: 159312
2012-06-28 00:05:13 +00:00
Chandler Carruth
6bc19df503 Teach the 'opt' tool about '-Os' and '-Oz', corresponding to the Clang
options, to enable easier testing of the innards of LLVM that are
enabled by such optimization strategies.

Note that this doesn't provide the (much needed) function attribute
support for -Oz (as opposed to -Os), but still seems like a positive
step to better test the logic that Clang currently relies on.

Patch by Patrik Hägglund.

llvm-svn: 156913
2012-05-16 08:32:49 +00:00
Joe Groff
b514a28573 allow opt to take a -mtriple option
llvm-svn: 154959
2012-04-17 23:05:48 +00:00
Hal Finkel
8cf5de5774 Add a basic-block autovectorization pass.
This is the initial checkin of the basic-block autovectorization pass along with some supporting vectorization infrastructure.
Special thanks to everyone who helped review this code over the last several months (especially Tobias Grosser).

llvm-svn: 149468
2012-02-01 03:51:43 +00:00
Duncan Sands
b5e4020ddb When doing "opt -O2" verify the bitcode like is done for
"opt -std-compile-opts".

llvm-svn: 146036
2011-12-07 17:14:20 +00:00
Benjamin Kramer
a2f57dee6d Remove all remaining uses of Value::getNameStr().
llvm-svn: 144648
2011-11-15 16:27:03 +00:00
Chris Lattner
321335142c Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang does. Enhance
the X86 asmparser to produce ranges in the one case that was annoying me, for example:

test.s:10:15: error: invalid operand for instruction
movl 0(%rax), 0(%edx)
              ^~~~~~~

It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use 
ranges where appropriate if someone is interested.

llvm-svn: 142106
2011-10-16 04:47:35 +00:00
Bill Wendling
fdea9930ac Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
This is some of my original LLVM code. *wipes tear*

llvm-svn: 136821
2011-08-03 22:18:20 +00:00
Rafael Espindola
73efcf56f6 move PassManagerBuilder.h to IPO. This is a non intuitive place to put it,
but it solves a layering violation since things in Support are not supposed to
use things in Transforms.

llvm-svn: 136726
2011-08-02 21:50:24 +00:00
Eli Friedman
2d681a2ec9 We only do always-inlining at -O1; make opt reflect that.
llvm-svn: 132693
2011-06-06 22:13:27 +00:00
Chris Lattner
84d1d4b89c initialize and finalize function passes, pointed out by Cameron.
llvm-svn: 131843
2011-05-22 06:44:19 +00:00
Chris Lattner
dd750b0404 switch opt to using PassManagerBuilder.h
llvm-svn: 131824
2011-05-22 00:21:33 +00:00
Andrew Trick
7e2e555075 Added *hidden* flags -print-options and -print-all-options so
developers can see if their driver changed any cl::Option's. The
current implementation isn't perfect but handles most kinds of
options. This is nice to have when decomposing the stages of
compilation and moving between different drivers. It's also a good
sanity check when comparing results produced by different command line
invocations that are expected to produce the comparable results.

Note: This is not an attempt to prolong the life of cl::Option. On the
contrary, it's a placeholder for a feature that must exist when
cl::Option is replaced by a more appropriate framework. A new
framework needs: a central option registry, dynamic name lookup,
non-global containers of option values (e.g. per-module,
per-function), *and* the ability to print options values and their defaults at
any point during compilation.

llvm-svn: 128910
2011-04-05 18:54:36 +00:00
Andrew Trick
b7629d86a7 whitespace
llvm-svn: 128905
2011-04-05 18:41:31 +00:00
Devang Patel
05887f77ea Update BreakpointPrinter to emit original function names only.
llvm-svn: 128839
2011-04-04 19:51:17 +00:00
Chris Lattner
a0dede2c21 add a way to disable all builtins, wire it up to opt's -disable-simplifylibcalls flag.
llvm-svn: 125978
2011-02-18 22:34:03 +00:00
Chris Lattner
e86dec3eb2 Have opt set up a specific TargetLibraryInfo for modules
with a triple.

llvm-svn: 125970
2011-02-18 22:13:01 +00:00
Peter Collingbourne
77a70485d9 Make -disable-simplify-libcalls work with -std-compile-opts
llvm-svn: 125824
2011-02-18 02:59:21 +00:00
Devang Patel
23d0acc520 While printing "interesting" breakpoint locations for debug info quality test harness, focus only on entry block's terminator for now.
llvm-svn: 124610
2011-01-31 21:36:24 +00:00
Tobias Grosser
20de2f52d0 RegionPassPrinter should contain the name of the pass printed
llvm-svn: 123941
2011-01-20 21:03:20 +00:00
Devang Patel
a8fa89a39c Print breakpoints for call instructions. This is used by optimized debug info test harness.
llvm-svn: 121432
2010-12-09 23:37:07 +00:00
Devang Patel
81b06f0d93 Add a simple breakpoint location printer. This will be used by upcoming "debug info in optimized code" quality test harness to set breakpoints at "interesting" locations.
llvm-svn: 121078
2010-12-07 00:33:43 +00:00
Tobias Grosser
a4ebf65d00 Move check of command line options after command line parsing.
The check to not allow -analyze and -disable-output at the same time was done
before parsing the command line flags. Therefore it never triggered, and in case
both options where used opt segfaulted. Fix this by moving this check a after
command line parsing.

llvm-svn: 120732
2010-12-02 20:35:16 +00:00
Michael J. Spencer
d5ec932c3a Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Jakob Stoklund Olesen
1172cd6d88 Tweak the opt -O2 / opt -O3 inliner thresholds to be the same as llvm-gcc and
clang are using.

llvm-svn: 118118
2010-11-02 23:40:28 +00:00
Tobias Grosser
88ce93b0eb Add RegionPass support.
A RegionPass is executed like a LoopPass but on the regions detected by the
RegionInfo pass instead of the loops detected by the LoopInfo pass.

llvm-svn: 116905
2010-10-20 01:54:44 +00:00
Owen Anderson
46990c17f7 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Dan Gohman
6645ce3f75 Move tool_output_file into its own file.
llvm-svn: 115973
2010-10-07 20:32:40 +00:00
Tobias Grosser
001e8a9350 Execute all Pass Printers even if -quiet is set.
Follow the same logic in the LoopPass, ModulePass and CallGraphSCCPass printers,
as it was already used in the BasicBlockPass and FunctionPass printers. This is
more consistent.

The other option would have been to completely disable dumping the analysis
information. However, as this information is the only information printed if the
-analysis flag is set, calling opt would not do anything at all.

llvm-svn: 113360
2010-09-08 15:02:51 +00:00
Tobias Grosser
184dc25d98 Include original pass name in the PassPrinter's name.
llvm-svn: 113359
2010-09-08 15:02:47 +00:00
Dan Gohman
f9e09104f1 Make tool_output_file's raw_ostream instance a member variable instead
of a base class.

This makes it possible to unregister the file from FilesToRemove when
the file is done. Also, this eliminates the need for
formatted_tool_output_file.

llvm-svn: 112706
2010-09-01 14:20:41 +00:00
Dan Gohman
bef725be86 Use the new tool_output_file in several tools. This fixes a variety
of problems with output files being left behind or output streams
being left unclosed. Fix llvm-mc to respect the -o option in all
modes, rather than hardcoding outs() in some cases.

llvm-svn: 111603
2010-08-20 01:07:01 +00:00
Dan Gohman
3c43d4a9b6 Allow the -analyze option to follow the -o option, which defaults to
standard output, instead of just hardcoding outs().

llvm-svn: 111372
2010-08-18 17:42:59 +00:00
Dan Gohman
72143a0fc2 Don't translate "-" to outs() manually; raw_ostream does that automatically.
llvm-svn: 111371
2010-08-18 17:40:10 +00:00
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Dan Gohman
d13e45d0ec Don't special-case stdout in llvm::WriteBitcodeToFile; just consider
it to be the caller's responsibility to provide a stream in binary
mode. This fixes a layering violation and avoids an outs() call.

llvm-svn: 104878
2010-05-27 20:06:51 +00:00
Dan Gohman
5dc7fed6ab Don't create an output stream when output is disabled.
llvm-svn: 104875
2010-05-27 19:52:20 +00:00
Dan Gohman
bf0dac1735 Avoid calling outs() and fouts() when the stream isn't really needed.
llvm-svn: 104873
2010-05-27 19:47:36 +00:00
Dan Gohman
79033132d7 Use regular PassManager instead of FunctionPassManager in opt, since it
isn't doing lazy streaming. This also fixes a missing doFinalization call.

llvm-svn: 103774
2010-05-14 15:36:54 +00:00
Chris Lattner
6a038be777 introduce a new CallGraphSCC class, and pass it around
to CallGraphSCCPass's instead of passing around a
std::vector<CallGraphNode*>.  No functionality change,
but now we have a much tidier interface.

llvm-svn: 101558
2010-04-16 22:42:17 +00:00
Dan Gohman
7f76052c8c Trim #includes.
llvm-svn: 99416
2010-03-24 19:56:17 +00:00
Jeffrey Yasskin
da98ae0163 Avoid leaking the FunctionPassManager from opt.
llvm-svn: 99180
2010-03-22 15:56:04 +00:00
Benjamin Kramer
c855708633 Avoid a dangling pointer dereference, PassManager::add can delete the Pass.
llvm-svn: 96576
2010-02-18 12:57:05 +00:00
Jeffrey Yasskin
fb10587e50 Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Chris Lattner
c07d7f41e3 elimiante the dynamic_cast's from opt.
llvm-svn: 94160
2010-01-22 06:03:06 +00:00
Chris Lattner
8b02bfe487 simplify code.
llvm-svn: 94159
2010-01-22 05:54:03 +00:00
Eli Friedman
45d605c120 Make opt -O3 act more like clang -O3 etc., by making the inlining thresholds
match.

llvm-svn: 93798
2010-01-18 22:38:31 +00:00
Dan Gohman
5e3b993a86 Don't create a (empty) output file, and don't warn about bitcode output
to a console, when --analyze is used.

Similarly, avoid creating an empty output file when --disable-output is used.

Print a warning when the -o option appears with either --analyze or
--disable-output, to indicate that the option is being ignored.

llvm-svn: 93685
2010-01-17 17:47:24 +00:00
David Greene
4c591a29fd Enable debug buffering.
llvm-svn: 92667
2010-01-05 01:30:32 +00:00
Chris Lattner
26c6e3ba7d when opt crashes, print its command line arguments as a pretty stack trace.
Somehow opt was missed when this was added.

llvm-svn: 90912
2009-12-09 00:41:28 +00:00
Kenneth Uildriks
e711736014 Make opt default to not adding a target data string and update tests that depend on target data to supply it within the test
llvm-svn: 85900
2009-11-03 15:29:06 +00:00
Chris Lattner
824a67ab25 nothing opt uses can throw, remove the try block and -fexceptions when
building opt.

llvm-svn: 84816
2009-10-22 00:46:41 +00:00
Chris Lattner
381a6ff95c Add some command line options for twiddling the default data layout
used by opt when a module doesn't specify one.  Patch from Kenneth Uildriks!

llvm-svn: 84814
2009-10-22 00:44:10 +00:00
Duncan Sands
08d519c2b7 There seems to be no reason for opt's -S option to be hidden.
Make it visible.

llvm-svn: 84127
2009-10-14 20:01:39 +00:00
Dan Gohman
149ac38d37 Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't
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.

llvm-svn: 81568
2009-09-11 20:46:33 +00:00
Daniel Dunbar
9690cc9913 opt: Add -S option to print output as LLVM assembly.
llvm-svn: 81082
2009-09-05 11:34:53 +00:00
Dan Gohman
7a60ef0f45 Use IRReader.h in opt, to support reading of LLVM Assembly files directly.
llvm-svn: 80922
2009-09-03 16:00:08 +00:00
Chris Lattner
085c521fe2 Fix some nasty callgraph dangling pointer problems in
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.

llvm-svn: 80527
2009-08-31 00:19:58 +00:00
Dan Gohman
53f0d68f87 Make LLVM command-line tools overwrite their output files without -f.
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.

llvm-svn: 79990
2009-08-25 15:34:52 +00:00
Dan Gohman
1d440b353e These flushes were only needed when the code was transitioning between
std::cout and outs().

llvm-svn: 79891
2009-08-24 04:13:48 +00:00
Chris Lattner
d6a9cc484b eliminate the ostream version of CheckBitcodeOutputToConsole,
change the raw_ostream one to take the raw_ostream byref instead
of byptr.  Prune #includes, eliminate a use of Streams.h

llvm-svn: 79863
2009-08-23 21:36:09 +00:00
Chris Lattner
0ac224bf1a use raw_fd_ostream instead of fstream with graphwriter,
flush the right stream in opt.cpp.

llvm-svn: 79837
2009-08-23 07:31:22 +00:00
Chris Lattner
1c0452caeb Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Chris Lattner
f16d8ade4f Change raw_fd_ostream to take flags as an optional bitmask
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).

llvm-svn: 79807
2009-08-23 02:51:22 +00:00
Eric Christopher
d24c28aef3 Make unit-at-a-time on by default to match the behavior of llvm-gcc.
llvm-svn: 79698
2009-08-21 23:30:30 +00:00
Eric Christopher
63ce9dc3a8 Kill trailing whitespace.
llvm-svn: 79696
2009-08-21 23:29:40 +00:00
Bob Wilson
7c323a8936 Fix a crash in SROA. The FunctionPass::doInitialization method was never
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.

llvm-svn: 76220
2009-07-17 19:05:13 +00:00
Daniel Dunbar
d4143bc1d8 opt: Add -std-link-opts argument, matches llvm-ld's optimizations.
llvm-svn: 76199
2009-07-17 18:09:39 +00:00
Dan Gohman
6abbc537f4 Convert more tools code from cerr and cout to errs() and outs().
llvm-svn: 76070
2009-07-16 15:30:09 +00:00
Owen Anderson
5c64fb5a80 To simplify the upcoming context-on-type change, switch all command line 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.

llvm-svn: 75846
2009-07-15 22:16:10 +00:00
Dan Gohman
9ced780576 Add a Force option to raw_fd_ostream to specify whether opening
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.

llvm-svn: 75801
2009-07-15 17:29:42 +00:00
Owen Anderson
cf112e59c3 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Owen Anderson
81b8dabb53 Add a pointer to the owning LLVMContext to Module. This requires threading 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.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Daniel Dunbar
fe1e04f85a Switch opt to using StandardPasses.h
- No functionality change, but please check if you don't believe me.

llvm-svn: 72789
2009-06-03 18:22:15 +00:00
Dan Gohman
0e73582689 Eliminate several more unnecessary intptr_t casts.
llvm-svn: 64888
2009-02-18 05:09:16 +00:00
Duncan Sands
36db5853cb Rename AddReadAttrs to FunctionAttrs, and teach it how
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'.

llvm-svn: 61525
2008-12-31 16:14:43 +00:00
Devang Patel
508dc0b548 Enable LoopIndexSplit pass.
llvm-svn: 60555
2008-12-04 21:40:31 +00:00
Devang Patel
c17a1f06f3 Disable -loop-index-split for now.
llvm-svn: 60087
2008-11-26 04:58:14 +00:00
Zhongxing Xu
985967aa25 Adjust indent.
llvm-svn: 60081
2008-11-26 02:57:24 +00:00
Nuno Lopes
a5d766c285 fix memory leak in pass manager when adding an analysis pass that already 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

llvm-svn: 58730
2008-11-04 23:03:58 +00:00
Daniel Dunbar
d1169ccaf2 Move Print*Pass to use raw_ostream.
llvm-svn: 57946
2008-10-22 03:25:22 +00:00
Daniel Dunbar
919ce3c16a Privatize PrintModulePass and PrintFunctionPass and add
createPrintModulePass and createPrintFunctionPass.
 - So clients who compile w/o RTTI can use them.

llvm-svn: 57933
2008-10-21 23:33:38 +00:00
Duncan Sands
317cef874d Turn on the AddReadAttrs pass.
llvm-svn: 56345
2008-09-19 14:34:36 +00:00
Devang Patel
f08b10b15d Fix comments, help messages.
llvm-svn: 56282
2008-09-17 16:01:39 +00:00
Devang Patel
65b85f3049 Fix cut-n-pasto.
llvm-svn: 56265
2008-09-17 00:01:04 +00:00
Devang Patel
e2702c8994 Add -O1, -O2 and -O3 that matches llvm-gcc's -O1, -O2 and -O3 respectively.
llvm-svn: 56255
2008-09-16 22:25:14 +00:00
Duncan Sands
1f456b0b4a End of the GlobalsModRef experiment.
llvm-svn: 56222
2008-09-15 18:42:38 +00:00
Duncan Sands
05a3e3ea40 Give GlobalsModRef a whirl in the nightly testers.
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.

llvm-svn: 56144
2008-09-12 08:23:37 +00:00
Devang Patel
c4040a69b7 Backout 55429
llvm-svn: 55432
2008-08-27 20:51:49 +00:00
Devang Patel
369cc38542 Add facility to create a target.
llvm-svn: 55429
2008-08-27 20:00:27 +00:00
Evan Cheng
91029f36ff Goodbye tail duplication (for good this time).
llvm-svn: 53574
2008-07-14 22:29:15 +00:00
Duncan Sands
2513505573 Fix comment.
llvm-svn: 53525
2008-07-13 20:14:38 +00:00
Chris Lattner
540afcff82 Fix PR2231 - opt -internalize -std-compile-opts should run internalize first
llvm-svn: 53523
2008-07-13 19:35:21 +00:00
Owen Anderson
15538467ae Re-enable the newly simplified ADCE. This fixes a regression on
Dhrystone introduced by its removal.

llvm-svn: 51669
2008-05-29 08:48:21 +00:00
Owen Anderson
9a9030f206 Remove ADCE from the optimization pipeline.
llvm-svn: 51581
2008-05-27 04:27:27 +00:00
Evan Cheng
2ad66b343d Re-enable tail duplication pass (now with default threshold down to 1 instruction).
llvm-svn: 51184
2008-05-16 07:57:10 +00:00
Evan Cheng
0a854f3b63 Remove tail duplication pass.
llvm-svn: 51139
2008-05-15 07:43:15 +00:00
Devang Patel
61c4c1d7a1 Recover nestedloop regression reported by nightly tester.
llvm-svn: 51110
2008-05-14 18:04:30 +00:00
Devang Patel
06f96f31ce Do not run instruction combiner in middle of loop optimization passes.
llvm-svn: 51084
2008-05-14 00:26:11 +00:00
Owen Anderson
e34787f5c0 Re-enable loop deletion by default.
llvm-svn: 50941
2008-05-10 07:10:24 +00:00
Owen Anderson
3743bcf042 Disable loop deletion until the release branch.
llvm-svn: 50787
2008-05-06 23:56:34 +00:00
Owen Anderson
6f1d91a6c5 Enable dead loop elimination.
llvm-svn: 50682
2008-05-05 23:38:07 +00:00
Chris Lattner
7b9b1fe01a move libcalls to the same place llvm-gcc has it.
llvm-svn: 50593
2008-05-02 22:05:06 +00:00
Chris Lattner
c9547a13e5 enable jump threading pass by default. This causes no miscompilations
and can significantly shrinkify some code, particularly from C++ land.

llvm-svn: 50025
2008-04-21 04:22:09 +00:00
Duncan Sands
55efcf86e9 Run SimplifyLibCalls near the beginning, not at
the end.  It is now run at the same moment as in
llvm-gcc.  Also, run StripDeadPrototypes at the
end, just before running DeadTypeElimination.
This may be useful when doing LTO.  Note that
llvm-gcc runs StripDeadPrototypes but not
DeadTypeElimination.

llvm-svn: 49848
2008-04-17 12:03:38 +00:00
Evan Cheng
c0aac87374 Move memcpy / memset optimization pass after GVN.
llvm-svn: 49457
2008-04-10 01:33:05 +00:00
Owen Anderson
ca7e0e21f3 Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.

llvm-svn: 49419
2008-04-09 08:23:16 +00:00
Chris Lattner
309aeb140b remove attributions from tools.
llvm-svn: 45421
2007-12-29 20:44:31 +00:00
Dan Gohman
2e8245a376 Move the space in overview output for commands out of each of the
commands and into the common code.

llvm-svn: 42752
2007-10-08 15:45:12 +00:00
Owen Anderson
b1388b7afb Turn GVN on by default.
llvm-svn: 41787
2007-09-08 22:23:52 +00:00
Devang Patel
db7970eac9 Enable loop index split pass.
llvm-svn: 41714
2007-09-04 20:46:58 +00:00
Owen Anderson
58e64df595 Rename FastDSE to just DSE.
llvm-svn: 40668
2007-08-01 06:36:51 +00:00
Dan Gohman
db1974dd16 Remove a FIXME comment that wasn't removed when the code it accompanied
was removed.

llvm-svn: 40591
2007-07-30 15:01:09 +00:00
Owen Anderson
3a6871f519 Turn on FastDSE by default.
Note: FastDSE now equals or exceeds the results of old DSE on all of SPEC2000 and SPEC2006. Unless major problems
show up in the testers, it will likely completely replace old DSE in the near future.

llvm-svn: 39986
2007-07-17 21:59:21 +00:00
Evan Cheng
b01b386dd4 Change sroa threshold back.
llvm-svn: 39980
2007-07-17 20:07:21 +00:00
Evan Cheng
49c8647315 Temporarily set SROA threshold to 512.
llvm-svn: 39950
2007-07-17 01:52:05 +00:00
Gabor Greif
5f705671e4 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Devang Patel
aba2f3de85 Fix PR1539. Add LoopPassPrinter.
llvm-svn: 37909
2007-07-05 15:32:03 +00:00
Devang Patel
9eeed9a5bd Fix PR 1526.
llvm-svn: 37780
2007-06-28 23:09:25 +00:00