Commit Graph

2692 Commits

Author SHA1 Message Date
Dan Gohman 61a8796ddb 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
Duncan Sands 54dd438394 Fix the build when using gcc-4.4 on linux. Header needed
for stderr and fprintf.

llvm-svn: 79909
2009-08-24 10:59:01 +00:00
Chris Lattner c143023bac remove the last *stream> #include from a public header.
llvm-svn: 79892
2009-08-24 04:14:03 +00:00
Dan Gohman 2ebc96ae95 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 06fa176862 prune the #includes in raw_ostream.h by moving a
member out of line. ftostr is not particularly speedy,
so that method is presumably not perf sensitive.

llvm-svn: 79885
2009-08-24 03:52:50 +00:00
Chris Lattner c521f54198 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Chris Lattner b9f25f9e19 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 6973395cc7 eliminate the std::ostream forms of the bitcode writing APIs.
llvm-svn: 79840
2009-08-23 07:49:08 +00:00
Chris Lattner d04d9102ab 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 1362602eb2 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 3924bb5792 remove the std::ostream version of module and type printing.
llvm-svn: 79823
2009-08-23 04:52:46 +00:00
Chris Lattner b25de3ff60 eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.

llvm-svn: 79819
2009-08-23 04:37:46 +00:00
Chris Lattner abd1736998 simplify output file selection, fixing two FIXMEs about binary output
llvm-svn: 79808
2009-08-23 02:56:05 +00:00
Chris Lattner 9e6f1f160a 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
Chris Lattner 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Daniel Dunbar 6860ac7375 llvm-mc: Clean up some handling of symbol/section association to be more correct
(external was really undefined and there wasn't an explicit representation for
absolute symbols).
 - This still needs some cleanup to how the absolute "pseudo" section is dealt
   with, but I haven't figured out the nicest approach yet.

llvm-svn: 79733
2009-08-22 07:22:36 +00:00
Eric Christopher c8f625b1eb 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
Daniel Dunbar 67dfb1de23 llvm-mc: Improve handling of implicit alignment for magic section directives
(e.g., .objc_message_refs).
 - Just emit a .align when we see the directive; this isn't exactly what 'as'
   does but in practice it should be ok, at least for now. See FIXME.

llvm-svn: 79697
2009-08-21 23:30:15 +00:00
Eric Christopher e64061f675 Kill trailing whitespace.
llvm-svn: 79696
2009-08-21 23:29:40 +00:00
Daniel Dunbar 4abcccb965 llvm-mc: In a .fill directive, still honor .align even if invalid maximum bytes
count is given (this matches 'as').

llvm-svn: 79683
2009-08-21 23:01:53 +00:00
Daniel Dunbar 8e5edd81bb llvm-mc: Accept .fill size of 8.
llvm-svn: 79635
2009-08-21 15:43:35 +00:00
Daniel Dunbar 3016db39dd llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.

 - MCAssembler is the actual assembler backend, which is designed to have a
   reasonable API. This will eventually grow to support multiple object file
   implementations, but for now its Mach-O/i386 only.

 - MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
   e.g. converting the various directives into fragments, managing state like
   the current section, and so on.

 - llvm-mc will use the new backend via '-filetype=obj', which may eventually
   be, but is not yet, since I hear that people like assemblers which actually
   assemble.

 - The only thing that works at the moment is changing sections. For the time
   being I have a Python Mach-O dumping tool in test/scripts so this stuff can
   be easily tested, eventually I expect to replace this with a real LLVM tool.

 - More doxyments to come.

I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.

llvm-svn: 79612
2009-08-21 09:11:24 +00:00
Daniel Dunbar 9df5f33818 llvm-mc: Various section parsing fixes.
- Add missing flags for various Objective-C sections.

 - Fix names for [non_]lazy_symbol_pointer (these are misspelled in the manual).

 - .symbol_stub does not have the self modifying code flag set (this appears to
   be wrong in the manual?).

 - Add implicit alignment values; not yet used.

Also, call MCStreamer::Finish at the end of a successful parse.

llvm-svn: 79611
2009-08-21 08:34:18 +00:00
Daniel Dunbar ad8b653f93 Don't install llvm-mc by default.
llvm-svn: 79604
2009-08-21 07:28:33 +00:00
Daniel Dunbar 5c947db79c Fix a commento.
llvm-svn: 79427
2009-08-19 16:25:53 +00:00
Benjamin Kramer 47f6943a95 Proper MSVC build fix (and remove my hack again). Patch by Yonggang Luo.
llvm-svn: 79418
2009-08-19 12:38:51 +00:00
Benjamin Kramer 9d908589d3 Add a hack to unbreak MSVC builds. str(n)casecmp are POSIX functions and aren't available on windows (mingw defines them though).
llvm-svn: 79417
2009-08-19 12:16:17 +00:00
Nick Lewycky e6e82b8480 Include valgrind in the steps to reproduce if valgrind was used to reproduce
the problem.

llvm-svn: 79322
2009-08-18 06:08:01 +00:00
Chris Lattner dd1db9cc81 "-" should write to stdout, not stderr.
llvm-svn: 79310
2009-08-18 04:03:24 +00:00
Daniel Dunbar 8575a60d33 Change bugpoint to use Triple to make runtime decisions.
- This is cleaner, and makes bugpoint match the host instead of the build
   architecture.

 - Patch by Sandeep Patel!

llvm-svn: 79309
2009-08-18 03:35:57 +00:00
Anton Korobeynikov 90e17e787f The attached patches attempt to fix cross builds. For example, if you
try to use i686-darwin to build for arm-eabi, you'll quickly run into
several false assumptions that the target OS must be the same as the
host OS. These patches split $(OS) into $(HOST_OS) and $(TARGET_OS) to
help builds like "make check" and the test-suite able to cross
compile. Along the way a target of *-unknown-eabi is defined as
"Freestanding" so that TARGET_OS checks have something to work with.

Patch by Sandeep Patel!

llvm-svn: 79296
2009-08-18 00:40:33 +00:00
Chris Lattner a61e93d4b5 give MCAsmStreamer a TargetAsmInfo.
llvm-svn: 79222
2009-08-17 04:23:44 +00:00
Oscar Fuentes 91bd6c922d CMake: Discriminate MINGW, MSYS, CYGWIN: does not try to build llvm-config under mingw without msys.
llvm-svn: 79202
2009-08-16 20:50:41 +00:00
Daniel Dunbar ef668c169b llvm-mc: Support escaped characters in string literals (for .ascii and .asciz)
llvm-svn: 79010
2009-08-14 18:19:52 +00:00
Oscar Fuentes 1ea4b3a4b5 CMake: Automatic regeneration of the library dependencies file.
It doesn't stop or reconfigure the build, though, so the user will see
a broken build that magically succeeds at the next attempt. It is
technically possible to halt the build with a helpful message, and
even to automatically restart the build using the new dependencies as
it we did when llvm-config was used by cmake for learning
dependencies. This is left on the TODO list.

llvm-svn: 79004
2009-08-14 16:59:41 +00:00
Oscar Fuentes 5444cb13ab CMake: propagate to the parent scope LLVM_COMMON_DEPENDS. This is
necessary for the changes being effective on the successive targets

llvm-svn: 78989
2009-08-14 04:29:33 +00:00
Daniel Dunbar 80d484e7cc Update llvm-mc / MCAsmStreamer to print the instruction using the actual target
specific printer (this only works on x86, for now).
 - This makes it possible to do some correctness checking of the parsing and
   matching, since we can compare the results of 'as' on the original input, to
   those of 'as' on the output from llvm-mc.

 - In theory, we could now have an easy ATT -> Intel syntax converter. :)

llvm-svn: 78986
2009-08-14 03:48:55 +00:00
Daniel Dunbar cbf4faf48d llvm-mc: Move MCAsmToken::getLoc() into MC library where it belongs.
llvm-svn: 78980
2009-08-14 02:18:40 +00:00
Oscar Fuentes 9082c71057 CMake: build llvm-config before the other tools.
llvm-svn: 78975
2009-08-14 01:55:05 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman 6dd7cb5dfe Simplify this code so that it doesn't depend on raw_ostream being copyable.
llvm-svn: 78915
2009-08-13 16:51:51 +00:00
Daniel Dunbar 7ee9649097 Update llvm-prof for ProfileInfo API changes.
- Patch by Erick Tryzelaar

llvm-svn: 78880
2009-08-13 01:55:43 +00:00
Dan Gohman 1432ef864e This void is implicit in C++.
llvm-svn: 78848
2009-08-12 22:10:57 +00:00
Oscar Fuentes 06eef1c2fe CMake: Localized dependency on Perl.
llvm-svn: 78788
2009-08-12 04:16:19 +00:00
Oscar Fuentes c1341ea9de CMake: Re-enabled build of llvm-config. Removed recursive invocation
of cmake.

llvm-svn: 78768
2009-08-12 01:36:27 +00:00
Daniel Dunbar 7f8a9ebc8d llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation.

llvm-svn: 78692
2009-08-11 17:47:52 +00:00
Benjamin Kramer 78c3bcb582 Make LLVMContext and LLVMContextImpl classes instead of structs.
llvm-svn: 78690
2009-08-11 17:45:13 +00:00
Benjamin Kramer 6d78d69586 Silence MSVC warning.
llvm-svn: 78660
2009-08-11 11:01:19 +00:00
Daniel Dunbar ba95a7cd8d llvm-mc: Accept .word as a synonym for .short
llvm-svn: 78641
2009-08-11 04:44:00 +00:00
Daniel Dunbar cd4eee5443 llvm-mc: Honor -o option (and add -f).
llvm-svn: 78640
2009-08-11 04:34:48 +00:00