Commit Graph

323 Commits

Author SHA1 Message Date
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Dan Gohman 0df7ea4c24 Move tool_output_file into its own file.
llvm-svn: 115973
2010-10-07 20:32:40 +00:00
Michael J. Spencer 93c9b2ea93 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Michael J. Spencer dc38d36ccb CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Dan Gohman a2233f2801 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 60bcc102d7 Fix llc to run the verifier once, not twice.
llvm-svn: 112532
2010-08-30 21:41:20 +00:00
Duncan Sands 3bd97fec8f Straighten out any triple strings passed on the command line before
they hit the rest of the system.

llvm-svn: 112344
2010-08-28 01:30:02 +00:00
Dan Gohman 268b0f4781 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 7ba6f22b47 Eliminate some redundancy by relying on raw_fd_ostream to handle "-"
properly.

llvm-svn: 111373
2010-08-18 17:55:15 +00:00
Dan Gohman 80f9de4bb5 Don't translate "-" to outs() manually; raw_ostream does that
automatically.

llvm-svn: 111370
2010-08-18 17:26:50 +00:00
Michael J. Spencer 4c0895893b llc: Fix help typo as pointed out by Nick Lewycky.
llvm-svn: 110556
2010-08-08 23:26:49 +00:00
Michael J. Spencer 4f50b97fd8 llc: Clarify -mc-relax-all description.
llvm-svn: 110477
2010-08-06 21:37:45 +00:00
Michael J. Spencer f695f8f9ed llc: Add -mc-relax-all.
llvm-svn: 109954
2010-07-31 19:57:02 +00:00
Dan Gohman 174f57668f 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 4cfccb801c Remove the "WantsWholeFile" concept, as it's no longer needed. CBE
and the others use the regular addPassesToEmitFile hook now, and
llc no longer needs a bunch of redundant code to handle the
whole-file case.

llvm-svn: 103492
2010-05-11 19:57:55 +00:00
Chris Lattner b903a15807 make -filetype=obj default to emitting its output to foo.obj
when on windows instead of foo.o.  Patch by Nathan Jeffords!

llvm-svn: 103150
2010-05-06 00:54:20 +00:00
Daniel Dunbar c1626e3317 Remove dead option.
llvm-svn: 102621
2010-04-29 16:29:02 +00:00
Chris Lattner 8900ef1931 add .o file writing for inline asm in llc. Here's a silly
demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
<inline asm>:1:2: error: unrecognized instruction
	abc incl    %eax
	^
LLVM ERROR: Error parsing inline asm

Only problem seems to be that the parser finalizes OutStreamer 
at the end of the first inline asm, which isn't what we want.
For example:

$ cat asm.c
int foo(int X) {
 __asm__ ("incl    %0" : "+r" (X));
 return X;
}
$ clang asm.c -S -o - -emit-llvm | llc
...
	subq	$8, %rsp
	movl	%edi, (%rsp)
	movl	%edi, %eax
	## InlineAsm Start
	incl    %eax
	## InlineAsm End
	movl	%eax, (%rsp)
	movl	%eax, 4(%rsp)
	addq	$8, %rsp
	ret
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
$ 

don't stop at inc!

llvm-svn: 100491
2010-04-05 23:11:24 +00:00
Dan Gohman 8e404fe769 Trim #includes.
llvm-svn: 99416
2010-03-24 19:56:17 +00:00
Dan Gohman e5732c63c4 llc doesn't need LinkAllVMCore.
llvm-svn: 99186
2010-03-22 16:59:44 +00:00
Dan Gohman 5341a86450 Make llc opt into the addPassesToEmitFile verify pass.
llvm-svn: 97502
2010-03-01 21:45:21 +00:00
Chris Lattner edcf065a29 change addPassesToEmitFile to return true on failure instead of its input,
add -filetype=null for performance testing and remove -filetype=dynlib,
which isn't planned to be implemented.

llvm-svn: 95202
2010-02-03 05:55:08 +00:00
Chris Lattner 8856a67e41 Hook up -filetype=obj through the MachO streamer. Here's a demo:
$ cat t.ll 
@g = global i32 42
$ llc t.ll -o t.o -filetype=obj
$ nm t.o
00000000 D _g

There is still a ton of work left.  Instructions are not being encoded
yet apparently.

llvm-svn: 95162
2010-02-02 23:57:42 +00:00
Chris Lattner 919b97436e Remove a bunch of stuff around the edges of the ELF writer.
Now the only use of the ELF writer is the JIT, which won't be
easy to fix in the short term. :( :(

llvm-svn: 95148
2010-02-02 22:31:11 +00:00
Chris Lattner f0cb12acf2 eliminate FileModel::Model, just use CodeGenFileType. The client
of the code generator shouldn't care what object format a target
uses.

llvm-svn: 95124
2010-02-02 21:06:45 +00:00
Chris Lattner 03dc0f7077 eliminate all forms of addPassesToEmitMachineCode except
the one used by the JIT.  Remove all forms of
addPassesToEmitFileFinish except the one used by the static
code generator.  Inline the remaining version of
addPassesToEmitFileFinish into its only caller.

llvm-svn: 95109
2010-02-02 19:14:27 +00:00
Nate Begeman 0b810279c8 Kill the Mach-O writer, and temporarily make filetype=obj an error.
The MCStreamer based assemblers will take over for this functionality.

llvm-svn: 95033
2010-02-01 23:56:58 +00:00
Jeffrey Yasskin 091217be6f 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 823aed16f9 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner 7ba0661f27 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Nate Begeman d232150b83 Hook up llc's -filetype=obj to use MCStreamer if an MCCodeEmitter is available.
Remove most of old Mach-O Writer support, it has been replaced by MCMachOStreamer

Further refactoring to completely remove MachOWriter and drive the object file
writer with the AsmPrinter MCInst/MCSection logic is forthcoming.

llvm-svn: 93527
2010-01-15 18:51:18 +00:00
David Greene 6e55be681e Enable debug buffering.
llvm-svn: 92666
2010-01-05 01:30:21 +00:00
Evan Cheng 5a28638560 Add a CodeGenOpt::Less level to match -O1. It'll be used by clients which do not want post-regalloc scheduling.
llvm-svn: 84272
2009-10-16 21:02:20 +00:00
Dan Gohman e8d0150398 Now that llc can read .ll files directly, teach it to recognize .ll as
an extension, so that the default output filename for foo.ll is foo.s,
not foo.ll.s

llvm-svn: 82071
2009-09-16 19:18:41 +00:00
Daniel Dunbar 76628def06 Tweak comment.
llvm-svn: 80891
2009-09-03 05:47:22 +00:00
Douglas Gregor ef7c1fd909 Unbreak my CMake build. Say you'll link again.
llvm-svn: 80842
2009-09-02 22:45:31 +00:00
Dan Gohman c76bfb777e Switch llc from ParseBitcodeFile to ParseIRFile. This lets llc
transparently read either LLVM Assembly or LLVM Bitcode files.

llvm-svn: 80829
2009-09-02 19:35:19 +00:00
Dan Gohman 896ef2be35 Delete some unnecessary flushes.
llvm-svn: 80013
2009-08-25 17:48:17 +00:00
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
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
Daniel Dunbar ad9a6c4855 No really, it's unused.
llvm-svn: 78047
2009-08-04 04:08:40 +00:00
Daniel Dunbar c0deed3263 Provide target data from the module if the target machine doesn't have any.
llvm-svn: 77973
2009-08-03 17:34:19 +00:00
Daniel Dunbar 719d235520 Remove now unused arguments from TargetRegistry::lookupTarget.
llvm-svn: 77950
2009-08-03 04:20:57 +00:00
Daniel Dunbar 0f16ea5c30 Pass target triple string in to TargetMachine constructor.
This is not just a matter of passing in the target triple from the module;
currently backends are making decisions based on the build and host
architecture. The goal is to migrate to making these decisions based off of the
triple (in conjunction with the feature string). Thus most clients pass in the
target triple, or the host triple if that is empty.

This has one important change in the way behavior of the JIT and llc.

For the JIT, it was previously selecting the Target based on the host
(naturally), but it was setting the target machine features based on the triple
from the module. Now it is setting the target machine features based on the
triple of the host.

For LLC, -march was previously only used to select the target, the target
machine features were initialized from the module's triple (which may have been
empty). Now the target triple is taken from the module, or the host's triple is
used if that is empty. Then the triple is adjusted to match -march.

The take away is that -march for llc is now used in conjunction with the host
triple to initialize the subtarget. If users want more deterministic behavior
from llc, they should use -mtriple, or set the triple in the input module.

llvm-svn: 77946
2009-08-03 04:03:51 +00:00
Daniel Dunbar 47d679151b Add TargetRegistry::lookupTarget.
- This is a simplified mechanism which just looks up a target based on the
   target triple, with a few additional flags.

 - Remove getClosestStaticTargetForModule, the moral equivalent is now:
     lookupTarget(Mod->getTargetTriple, true, false, ...);

 - This no longer does the fuzzy matching with target data (based on endianness
   and pointer width) that getClosestStaticTargetForModule was doing, but this
   was deemed unnecessary.

llvm-svn: 77111
2009-07-26 02:12:58 +00:00
Daniel Dunbar d3706458df Switch llc and createJIT to use simpler command line parsing for -march.
llvm-svn: 75890
2009-07-16 02:23:53 +00:00
Daniel Dunbar 3d92d936b9 Make sure targets are initialized before we do anything, even command line
processing.

llvm-svn: 75888
2009-07-16 02:04:54 +00:00
Owen Anderson 19251ec836 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
Daniel Dunbar e833810a5e Reapply TargetRegistry refactoring commits.
--- Reverse-merging r75799 into '.':
 U   test/Analysis/PointerTracking
U    include/llvm/Target/TargetMachineRegistry.h
U    include/llvm/Target/TargetMachine.h
U    include/llvm/Target/TargetRegistry.h
U    include/llvm/Target/TargetSelect.h
U    tools/lto/LTOCodeGenerator.cpp
U    tools/lto/LTOModule.cpp
U    tools/llc/llc.cpp
U    lib/Target/PowerPC/PPCTargetMachine.h
U    lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
U    lib/Target/PowerPC/PPCTargetMachine.cpp
U    lib/Target/PowerPC/PPC.h
U    lib/Target/ARM/ARMTargetMachine.cpp
U    lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
U    lib/Target/ARM/ARMTargetMachine.h
U    lib/Target/ARM/ARM.h
U    lib/Target/XCore/XCoreTargetMachine.cpp
U    lib/Target/XCore/XCoreTargetMachine.h
U    lib/Target/PIC16/PIC16TargetMachine.cpp
U    lib/Target/PIC16/PIC16TargetMachine.h
U    lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
U    lib/Target/Alpha/AlphaTargetMachine.cpp
U    lib/Target/Alpha/AlphaTargetMachine.h
U    lib/Target/X86/X86TargetMachine.h
U    lib/Target/X86/X86.h
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
U    lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h
U    lib/Target/X86/X86TargetMachine.cpp
U    lib/Target/MSP430/MSP430TargetMachine.cpp
U    lib/Target/MSP430/MSP430TargetMachine.h
U    lib/Target/CppBackend/CPPTargetMachine.h
U    lib/Target/CppBackend/CPPBackend.cpp
U    lib/Target/CBackend/CTargetMachine.h
U    lib/Target/CBackend/CBackend.cpp
U    lib/Target/TargetMachine.cpp
U    lib/Target/IA64/IA64TargetMachine.cpp
U    lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
U    lib/Target/IA64/IA64TargetMachine.h
U    lib/Target/IA64/IA64.h
U    lib/Target/MSIL/MSILWriter.cpp
U    lib/Target/CellSPU/SPUTargetMachine.h
U    lib/Target/CellSPU/SPU.h
U    lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
U    lib/Target/CellSPU/SPUTargetMachine.cpp
U    lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
U    lib/Target/Mips/MipsTargetMachine.cpp
U    lib/Target/Mips/MipsTargetMachine.h
U    lib/Target/Mips/Mips.h
U    lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
U    lib/Target/Sparc/SparcTargetMachine.cpp
U    lib/Target/Sparc/SparcTargetMachine.h
U    lib/ExecutionEngine/JIT/TargetSelect.cpp
U    lib/Support/TargetRegistry.cpp

llvm-svn: 75820
2009-07-15 20:24:03 +00:00
Dan Gohman 607818a2c1 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