Commit Graph

316 Commits

Author SHA1 Message Date
John Criswell bae1c0b23b Fixed compilation warning on Linux by fixing the type of a return value.
llvm-svn: 137913
2011-08-18 01:19:05 +00:00
Jim Grosbach 345768c9ff Remove unused Target argument from AsmParser construction methods.
The argument is unused, and is a layering violation in any case.

llvm-svn: 137735
2011-08-16 18:33:49 +00:00
Rafael Espindola 3ea478b7ac Move methods in PassManagerBuilder offline.
llvm-svn: 136727
2011-08-02 21:50:27 +00:00
Rafael Espindola 591eaa481e 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
Evan Cheng 1142444565 Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser.
llvm-svn: 136027
2011-07-26 00:24:13 +00:00
Nick Lewycky 85a19aa333 Fix typo.
llvm-svn: 135971
2011-07-25 21:12:44 +00:00
Evan Cheng f2596bc62a Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
llvm-svn: 135833
2011-07-23 00:45:41 +00:00
Evan Cheng 8c886a40d2 Combine all MC initialization routines into one. e.g. InitializeX86MCAsmInfo,
InitializeX86MCInstrInfo, etc. are combined into InitializeX86TargetMC.

llvm-svn: 135812
2011-07-22 21:58:54 +00:00
Evan Cheng bbf3b0de8b Goodbye TargetAsmInfo. This eliminate last bit of CodeGen and Target in llvm-mc.
There is still a bit more refactoring left to do in Targets. But we are now very
close to fixing all the layering issues in MC.

llvm-svn: 135611
2011-07-20 19:50:42 +00:00
Evan Cheng 76792992d6 Add MCObjectFileInfo and sink the MCSections initialization code from
TargetLoweringObjectFileImpl down to MCObjectFileInfo.

TargetAsmInfo is done to one last method. It's *almost* gone!

llvm-svn: 135569
2011-07-20 05:58:47 +00:00
Evan Cheng 2129f59637 Introduce MCCodeGenInfo, which keeps information that can affect codegen
(including compilation, assembly). Move relocation model Reloc::Model from
TargetMachine to MCCodeGenInfo so it's accessible even without TargetMachine.

llvm-svn: 135468
2011-07-19 06:37:02 +00:00
Evan Cheng d60fa58ba1 Sink getDwarfRegNum, getLLVMRegNum, getSEHRegNum from TargetRegisterInfo down
to MCRegisterInfo. Also initialize the mapping at construction time.

This patch eliminate TargetRegisterInfo from TargetAsmInfo. It's another step
towards fixing the layering violation.

llvm-svn: 135424
2011-07-18 20:57:22 +00:00
Chris Lattner 229907cd11 land David Blaikie's patch to de-constify Type, with a few tweaks.
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Evan Cheng 1705ab00ab Rename createAsmInfo to createMCAsmInfo and move registration code to MCTargetDesc to prepare for next round of changes.
llvm-svn: 135219
2011-07-14 23:50:31 +00:00
Evan Cheng c7ac690ba2 Unfortunately several files in MC are badly violating layering rule by using
TargetAsmInfo, which in turn pulls in TargetRegisterInfo, etc. :-( There are
other cases of violations, but this is probably the worst.

This patch is but one small step towards fixing this. 500 more steps to go. :-(

llvm-svn: 135131
2011-07-14 05:43:07 +00:00
Cameron Zwarich 4d4b022478 Fix LTO after the recent MC subtarget refactoring.
llvm-svn: 134930
2011-07-11 22:19:51 +00:00
Evan Cheng 91111d2706 Change createAsmParser to take a MCSubtargetInfo instead of triple,
CPU, and feature string. Parsing some asm directives can change
subtarget state (e.g. .code 16) and it must be reflected in other
modules (e.g. MCCodeEmitter). That is, the MCSubtargetInfo instance
must be shared.

llvm-svn: 134795
2011-07-09 05:47:46 +00:00
Evan Cheng 4d1ca96bfc Eliminate asm parser's dependency on TargetMachine:
- Each target asm parser now creates its own MCSubtatgetInfo (if needed).
- Changed AssemblerPredicate to take subtarget features which tablegen uses
  to generate asm matcher subtarget feature queries. e.g.
  "ModeThumb,FeatureThumb2" is translated to
  "(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0".

llvm-svn: 134678
2011-07-08 01:53:10 +00:00
Evan Cheng fe6e405e8c Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
be the first encoded as the first feature. It then uses the CPU name to look up
features / scheduling itineray even though clients know full well the CPU name
being used to query these properties.

The fix is to just have the clients explictly pass the CPU name!

llvm-svn: 134127
2011-06-30 01:53:36 +00:00
Evan Cheng 8264e272a9 Sink SubtargetFeature and TargetInstrItineraries (renamed MCInstrItineraries) into MC.
llvm-svn: 134049
2011-06-29 01:14:12 +00:00
Chad Rosier 772a91f8e4 Reinstate r133516 "Remove some unnecessary uses of c_str()." A trailing null
character in std::string was causing failures for a few ObjC and Obj-C++ tests
when -flto was enabled.  Revision 133999 resolved this issue. Thanks Jay!
rdar://9685235
PR10210

llvm-svn: 134017
2011-06-28 18:26:12 +00:00
Jay Foad 2a31eb49c7 PR10210: New method ConstantArray::getAsCString(). Use it in LTO to
avoid getting embedded trailing null bytes in std::strings.

llvm-svn: 133999
2011-06-28 08:24:19 +00:00
Chad Rosier e967eefa00 Revert r133516 "Remove some unnecessary uses of c_str()."
This was causing compile-time failures for some of the Objc and Obj-C++
benchmarks.  The specific errors were of the form: "ld: duplicate symbol …"
rdar://9660124

llvm-svn: 133955
2011-06-27 22:54:29 +00:00
Jay Foad 7a8a5f7f1d Remove some unnecessary uses of c_str().
llvm-svn: 133516
2011-06-21 15:36:24 +00:00
Chris Lattner f200a0af58 switch bugpoint and liblto to PassManagerBuilder.
llvm-svn: 131821
2011-05-22 00:20:07 +00:00
Rafael Espindola fd05785324 Simplify the handling of pcrel relocations on ELF. Now we do the right thing
for all symbol differences and can drop the old EmitPCRelSymbolValue
method.

This also make getExprForFDESymbol on ELF equal to the one on MachO, and it
can be made non-virtual.

llvm-svn: 130634
2011-05-01 03:50:49 +00:00
Rafael Espindola 6aea59268a Remove unused argument.
llvm-svn: 129955
2011-04-21 23:39:26 +00:00
Nick Lewycky 364c04ae01 Fix typo in comment.
llvm-svn: 129902
2011-04-21 01:54:08 +00:00
Chris Lattner 0ab5e2cded Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Devang Patel 22430f4141 Update CMakeLists.txt
Patch by arrowdoger.

llvm-svn: 128719
2011-04-01 18:03:58 +00:00
Devang Patel 4a2737aa26 Expoert c interface for disassembler.
llvm-svn: 128440
2011-03-29 00:01:39 +00:00
Rafael Espindola 26b57ffa27 Add a lto_codegen_compile_to_file to avoid producing a file, reading it to
memory and writing it back to disk.

llvm-svn: 128108
2011-03-22 20:57:13 +00:00
Rafael Espindola 2475adce37 We don't need a null terminator for the output file.
llvm-svn: 128098
2011-03-22 19:20:47 +00:00
Rafael Espindola 5b778b2e60 Use lazy parsing in LTO. Unfortunately this is only a 3% time saving for
'ar'. Have to figure out how to make libLTO even lazier.

llvm-svn: 127901
2011-03-18 19:51:00 +00:00
Rafael Espindola c78f65775a Simplify the computation of undefined symbols. Instead of walking
functions and initializers, just report the declarations present in
the module.

The motivation is to open the way for using the lazy module parsing,
which should speed up clients that just want a symbol list (nm, ar).

This is slightly less precise, but since both -strip-dead-prototypes
and -globaldce are part of the standard pipeline, this shouldn't
change the result for clang/dragonegg produced binaries.

Any decl in an IL file was also put there because a FE expected it
to be necessary, so this should not be a problem for "-O0 -emit-llvm".

As a sanity check, I have bootstrapped clang on linux and built
firefox on both linux and darwin. A clang bootstrap on darwin
with LTO fails with or without this patch because, ironically,
the linker doesn't like the combination of dead_strip and LTO
when building libLTO.so :-)

llvm-svn: 127870
2011-03-18 05:12:38 +00:00
NAKAMURA Takumi f4d5346fb4 tools/lto/LTOModule.cpp: Eliminate an unused variable.
llvm-svn: 127859
2011-03-18 03:21:11 +00:00
Rafael Espindola ab959a2e68 Use RequiresNullTerminator to create buffers without a null terminator
instead of copying.

llvm-svn: 127835
2011-03-17 22:18:42 +00:00
Rafael Espindola b39c7c7b17 Add support in the LTO library for loading an object from the middle
of an file.

llvm-svn: 127781
2011-03-17 00:36:11 +00:00
Oscar Fuentes 02c446a73a Build LTO as a static library too.
llvm-svn: 127553
2011-03-12 22:01:36 +00:00
Oscar Fuentes 68c1f55fdc Build LTO as a static library too.
llvm-svn: 127549
2011-03-12 17:32:30 +00:00
Oscar Fuentes 1fc0c8ab78 Update link components for llvm-dis and LTO.
llvm-svn: 127545
2011-03-12 16:48:49 +00:00
Oscar Fuentes 64d05bc281 Add LTO and gold plugin to the CMake build. Linux-only, support for
other systems pending.

PR9456.

llvm-svn: 127466
2011-03-11 15:44:24 +00:00
Rafael Espindola 1e49a6d9bc Add a special streamer to libLTO that just records symbols definitions and
uses.

The result produced by the streamer is used to give the linker more accurate
information and to add to llvm.compiler.used. The second improvement removes
the need for the user to add __attribute__((used)) to functions only used in
inline asm. The first one lets us build firefox with LTO on Darwin :-)

llvm-svn: 126830
2011-03-02 04:14:42 +00:00
Rafael Espindola fac373cacb Switch LTO to use MC. This takes the linking of libxul.so from about 7m to
6m30.

llvm-svn: 126426
2011-02-24 21:04:06 +00:00
Rafael Espindola 477d11f9a0 Fix some memory leaks and avoid looking in the hash tables twice.
libxul links in 7m0.403s.

llvm-svn: 126085
2011-02-20 16:27:25 +00:00
Rafael Espindola 8cc5910dbc Preserve aliases if needed.
llvm-svn: 125439
2011-02-12 18:03:13 +00:00
Rafael Espindola 3937ded624 Fix a silly bug I introduced when dropping std::string.
llvm-svn: 125420
2011-02-12 00:19:56 +00:00
Rafael Espindola 34b59389ea Remove std::string version of getNameWithPrefix.
llvm-svn: 125363
2011-02-11 05:23:09 +00:00
Rafael Espindola 56e41f7f0b Don't open the file again in the gold plugin. To be able to do this, update
MemoryBuffer::getOpenFile to not close the file descriptor.

llvm-svn: 125128
2011-02-08 22:40:47 +00:00
Rafael Espindola 08bccdad19 Don't tell the linker about available_externally definitions. If we do, it will
complain about duplicated definitions.

llvm-svn: 124634
2011-02-01 00:41:51 +00:00
Devang Patel 39bd6cebcd Do not include DataTypes.h in llvm-c/lto.h.
This means avoid using uint32_t. This patch reverts r112200 and fixes original  problem by fixing argument type in lto.cpp.

llvm-svn: 123038
2011-01-07 22:26:25 +00:00
Michael J. Spencer 39a0ffc394 MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
llvm-svn: 121958
2010-12-16 03:29:14 +00:00
Rafael Espindola 0a017a6db2 Fixed version of 121434 with no new memory leaks.
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola a945a34c73 Revert my previous patch to make the valgrind bots happy.
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola 56eb741237 Initial support for the cfi directives. This is just enough to get
f:
        .cfi_startproc
        nop
        .cfi_endproc

assembled (on ELF).

llvm-svn: 121434
2010-12-09 23:48:29 +00:00
Michael J. Spencer d422723721 More code not compiled by CMake. :(.
llvm-svn: 121387
2010-12-09 18:06:07 +00:00
Devang Patel 2379f3abd5 Do not try luck by using given name to create temporary file. In parallel builds it may not work.
This time for .s file.

llvm-svn: 121016
2010-12-06 18:04:39 +00:00
Devang Patel 6b5d5b5c3b Do not try luck by using given name to create temporary file. In parallel builds it may not work.
llvm-svn: 120860
2010-12-03 23:58:31 +00:00
Michael J. Spencer ab425d8360 I swear I did a make clean and make before committing all this...
llvm-svn: 120304
2010-11-29 18:47:54 +00:00
Rafael Espindola a8a74ece08 Record sysbols created by aliases. Fixes PR8414.
llvm-svn: 116910
2010-10-20 04:57:22 +00:00
Daniel Dunbar ef47b66d52 lto: Respect LLVM_VERSION_INFO make variable, since setting CC arguments with
spaces gives tests fits and shell escaping is an art best left to jabberwockies.

llvm-svn: 116632
2010-10-15 22:46:15 +00:00
Dan Gohman a6769bb993 This file needs ToolOutputFile.h too.
llvm-svn: 115976
2010-10-07 20:48:46 +00:00
Bill Wendling 0198ce06fc Provide a fast "get me the target triple from the module" API. This can
drastically reduce the linking time during LTO.

Patch by Shantonu Sen!

llvm-svn: 115728
2010-10-06 01:22:42 +00:00
Bill Wendling dcd7c2b833 Add a new scope type "LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN" for the
"linker_private_weak_auto_def" linkage type for LTO.

llvm-svn: 114868
2010-09-27 20:17:45 +00:00
Bill Wendling 2776d465ee The "linker_private_weak*" linkages should set the LTO_SYMBOL_DEFINITION_WEAK
during LTO.

llvm-svn: 114850
2010-09-27 18:05:19 +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
Devang Patel 7b888fbd91 Fix prototypes.
llvm-svn: 112200
2010-08-26 17:47:45 +00:00
Dan Gohman 74328ab826 lto_codegen_set_gcc_path was removed.
llvm-svn: 112069
2010-08-25 18:37:04 +00:00
Dan Gohman c894a7f942 Fix a few missing entries in lto.exports.
llvm-svn: 112068
2010-08-25 18:22:12 +00:00
Dan Gohman 8525fe7155 Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it.

llvm-svn: 111651
2010-08-20 16:59:15 +00:00
Rafael Espindola ccab1dddd1 Make it possible to set the cpu used for codegen.
llvm-svn: 110759
2010-08-11 00:15:13 +00:00
Daniel Dunbar a8272596bc lto: Fix an inverted conditional which prevented the addition of symbols scraped
from inline assembly, except in cases where they had already been seen (in which
case they would get added twice).
 - I can't see how this ever worked...

llvm-svn: 110757
2010-08-11 00:11:19 +00:00
Daniel Dunbar 4493c7e550 lto: Fix gratuitous memory leaks.
llvm-svn: 110756
2010-08-11 00:11:17 +00:00
Daniel Dunbar 919660b2ed lto: Reduce nesting.
llvm-svn: 110752
2010-08-10 23:46:46 +00:00
Daniel Dunbar 5657e7b667 LTOModule.cpp: Fix numerous style issues.
llvm-svn: 110751
2010-08-10 23:46:39 +00:00
Rafael Espindola 0045646633 Make it possible to set the flags passed to the assembler.
Nick, please review.

llvm-svn: 110705
2010-08-10 18:55:09 +00:00
Rafael Espindola 4ef89f5200 Make it possible to set the target triple and expose that with an option in the
gold plugin.

llvm-svn: 110604
2010-08-09 21:09:46 +00:00
Daniel Dunbar 40842fa2ee build: Don't pass -avoid-version or -no-undefined on Darwin, they don't do
anything.

llvm-svn: 109957
2010-07-31 21:32:56 +00:00
Daniel Dunbar bdb298912b build/Darwin: Add an LLVM_LTO_VERSION_OFFSET make variable to allow offsetting
the libLTO library version from the actual build version.

llvm-svn: 108495
2010-07-16 01:41:38 +00:00
Dan Gohman 6debf89587 Eliminate some unnessary Path::exists() calls.
llvm-svn: 104888
2010-05-27 20:51:54 +00:00
Dan Gohman ab366f055a When handling raw_ostream errors manually, use clear_error() so that
raw_ostream doesn't try to do its own error handling.

Also, close the raw_ostream before checking for errors so that any
errors that occur during closing are caught by the manual check.

llvm-svn: 104882
2010-05-27 20:19:47 +00:00
Bill Wendling a12c1ff25a The getDefaultSubtargetFeatures method of SubtargetFeature did actually return a
string of features for that target. However LTO was using that string to pass
into the "create target machine" stuff. That stuff needed the feature string to
be in a particular form. In particular, it needed the CPU specified first and
then the attributes. If there isn't a CPU specified, it required it to be blank
-- e.g., ",+altivec". Yuck.

Modify the getDefaultSubtargetFeatures method to be a non-static member
function. For all attributes for a specific subtarget, it will add them in like
normal. It will also take a CPU string so that it can satisfy this horrible
syntax.

llvm-svn: 103451
2010-05-11 00:30:02 +00:00
Duncan Sands 211427bda9 Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.

llvm-svn: 102865
2010-05-02 15:36:26 +00:00
Bill Wendling 633c48ec1d r98363 deleted a '!' when cleaning up whitespace. This caused globals which are
*not* declarations to *not* be placed in the "preserve" list.
<rdar://problem/7870735>

llvm-svn: 102405
2010-04-27 00:55:25 +00:00
Dan Gohman 7a0fde90f5 Fix more -Wcast-qual warnings.
llvm-svn: 101656
2010-04-17 17:44:03 +00:00
Dan Gohman ff9ecb2824 Make the export files absolute paths, and change Makefile.rules
to expect them this way, to fix srcdir!=objdir builds.

llvm-svn: 101414
2010-04-15 23:08:00 +00:00
Dan Gohman 473a53f7b1 Generalize the EXPORTED_SYMBOL_FILE concept in the Makefiles to work with
native linking export files, including running sed to prepend underscores
on darwin, and make use of it in libLTO and libEnhancedDisassembly.

Remove the leading underscores from library export files so that they
work with the new EXPORTED_SYMBOL_FILE support.

llvm-svn: 101399
2010-04-15 20:54:25 +00:00
Chris Lattner 0e45d24a4e stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Dan Gohman 8e404fe769 Trim #includes.
llvm-svn: 99416
2010-03-24 19:56:17 +00:00
Chris Lattner c7b46f9d9c give Mangler access to TargetData.
llvm-svn: 98378
2010-03-12 20:47:28 +00:00
Chris Lattner 2eff505fba make the mangler take an MCContext instead of an MAI.
No functionality change.

llvm-svn: 98363
2010-03-12 18:44:54 +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 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
Chris Lattner 57992e2da6 remove dead code, we're requesting TargetMachine::AssemblyFile here.
llvm-svn: 95105
2010-02-02 19:03:39 +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
Chris Lattner b4ffc894e6 now that mangler is in libtarget, it can use MCAsmInfo instead of clients
having to pass various fields from it in.  Simplify.

llvm-svn: 93686
2010-01-17 18:22:35 +00:00