Commit Graph

93 Commits

Author SHA1 Message Date
Duncan Sands 12da8ce3d2 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Anton Korobeynikov 70d4c08cfe Treat [1 x i8] zeroinitializer as a C string, placing such stuff into
mergeable string section. I don't see any bad impact of such decision
(rather then placing it into mergeable const section, as it was before),
but at least Darwin linker won't complain anymore.

The problem in LLVM is that we don't have special type for string constants
(like gcc does). Even more, we have two separate types: ConstatArray for non-null
strings and ConstantAggregateZero for null stuff.... It's a bit weird :)

llvm-svn: 63142
2009-01-27 22:29:24 +00:00
Scott Michel 3789a13c30 Make the Dwarf macro information section optional; CellSPU's assembler
doesn't support it. The default is set to 'true', so this should not
impact any other target backends.

llvm-svn: 63058
2009-01-26 22:32:51 +00:00
Bill Wendling f9b5ba7bcb Revert r61415 and r61484. Duncan was correct that these weren't needed.
llvm-svn: 61765
2009-01-05 22:53:45 +00:00
Devang Patel 56a8bb670f squash warnings.
llvm-svn: 61707
2009-01-05 17:31:22 +00:00
Bill Wendling 03f2af79b8 Linux wants the FDE initial location and address range to be forced to 32-bit.
Darwin doesn't. Make this optional for platforms.

llvm-svn: 61484
2008-12-29 22:12:11 +00:00
Bill Wendling d6bd7e9372 Darwin likes for the EH frame to be non-local.
llvm-svn: 61420
2008-12-24 08:05:17 +00:00
Bill Wendling 066b5f6724 GCC doesn't emit DW_EH_PE_sdata4 for the FDE encoding on Darwin. I'm not sure
about other platforms.

llvm-svn: 61415
2008-12-24 05:25:49 +00:00
Rafael Espindola cda011b5ad Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.

llvm-svn: 60480
2008-12-03 11:01:37 +00:00
Dan Gohman ac41d9f5d8 Refactor various TargetAsmInfo subclasses' TargetMachine members away
adding a TargetMachine member to the base TargetAsmInfo class instead.

llvm-svn: 58624
2008-11-03 18:22:42 +00:00
Duncan Sands 08d91178e9 Rename isWeakForLinker to mayBeOverridden. Use it
instead of hasWeakLinkage in a bunch of optimization
passes.

llvm-svn: 56782
2008-09-29 11:25:42 +00:00
Anton Korobeynikov 87001fd6fd Reapply 56585:56589 with proper fix for some gcc versions
llvm-svn: 56621
2008-09-25 21:00:33 +00:00
Evan Cheng 84301390ae Temporarily backing out 56585:56589 to unbreak the build.
llvm-svn: 56607
2008-09-25 07:38:08 +00:00
Anton Korobeynikov 77aa975bdd Use crazy template-based inheritance instead of virtual one.
llvm-svn: 56585
2008-09-24 22:21:39 +00:00
Anton Korobeynikov 8e7b93938d Get rid of ReadOnlySection duplicate
llvm-svn: 56582
2008-09-24 22:20:27 +00:00
Anton Korobeynikov 5906234c1d Get rid of now unused {Four,Eight,Sixteen}ByteConstantSection
llvm-svn: 56580
2008-09-24 22:18:54 +00:00
Anton Korobeynikov 22db30548d Get rid of duplicate char*/Section* stuff for TLS sections
llvm-svn: 56577
2008-09-24 22:17:06 +00:00
Anton Korobeynikov 7497762606 Get rid of duplicate char*/Section* DataSection
llvm-svn: 56575
2008-09-24 22:16:16 +00:00
Anton Korobeynikov f8dc8aac3c Get rid of duplicate char*/Section* TextSection
llvm-svn: 56574
2008-09-24 22:15:21 +00:00
Anton Korobeynikov 076e905b94 Move actual section printing stuff to AsmPrinter from TAI reducing heap traffic.
llvm-svn: 56573
2008-09-24 22:14:23 +00:00
Dale Johannesen f080225490 Fix logic for not emitting no-dead-strip for some
objects in llvm.used (thanks Anton).  Makes visible
the magic 'l' prefix for symbols on Darwin which are
to be passed through the assembler, then removed at
linktime (previously all references to this had been
hidden in the ObjC FE code, oh well).

llvm-svn: 55973
2008-09-09 01:21:22 +00:00
Anton Korobeynikov 2ae5446b62 Add interface for section override. Use this for Sparc, since it should use named BSS section.
llvm-svn: 54844
2008-08-16 12:58:12 +00:00
Anton Korobeynikov bd890b1faf Move SLEB/ULEB size calculation routines from AsmPrinter to TargetAsmInfo. This makes JIT asmprinter-free.
llvm-svn: 54843
2008-08-16 12:57:46 +00:00
Anton Korobeynikov 44b4a9a05d Reduce heap trashing due to std::string construction / concatenation via caching of section flags string representations
llvm-svn: 54842
2008-08-16 12:57:07 +00:00
Evan Cheng df8c7faf60 Undo most of r54519.
llvm-svn: 54534
2008-08-08 17:56:50 +00:00
Evan Cheng 655fa0fec4 It's not legal to output a GV in a coalesced section if it's used in an ARM PIC relative constantpool.
llvm-svn: 54519
2008-08-08 06:56:16 +00:00
Anton Korobeynikov 8ab2f49536 Provide convenient helpers
llvm-svn: 54451
2008-08-07 09:51:54 +00:00
Anton Korobeynikov ef643a4850 Select section for constant pool entries
llvm-svn: 54448
2008-08-07 09:50:34 +00:00
Anton Korobeynikov 4fdeb9b2d3 Provide default implementation of different small-sections related stuff
llvm-svn: 53920
2008-07-22 17:09:59 +00:00
Bruno Cardoso Lopes 9cfd2f8e57 Basic support for small sections
llvm-svn: 53907
2008-07-22 15:26:53 +00:00
Dan Gohman efa4160fcc TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
llvm-svn: 53639
2008-07-15 18:37:51 +00:00
Anton Korobeynikov 56827c1b60 Use only 'subset' of flags
llvm-svn: 53323
2008-07-09 13:29:44 +00:00
Anton Korobeynikov daee281590 First sketch of special section objects
llvm-svn: 53320
2008-07-09 13:28:49 +00:00
Anton Korobeynikov 577c45dd74 Use isWeakForLinker() hook
llvm-svn: 53318
2008-07-09 13:27:59 +00:00
Anton Korobeynikov 13b9a22fb0 Fix several bugs in named sections handling
llvm-svn: 53312
2008-07-09 13:25:46 +00:00
Anton Korobeynikov 60919583b3 Add hacky way to distinguish named and named sections. This will be generalized in the future.
llvm-svn: 53311
2008-07-09 13:25:26 +00:00
Anton Korobeynikov d789b7c196 Use 'gnu.linkonce', where needed
llvm-svn: 53310
2008-07-09 13:24:55 +00:00
Anton Korobeynikov 7504c283f2 Fix thinko
llvm-svn: 53309
2008-07-09 13:24:38 +00:00
Anton Korobeynikov 4c37c3ad5b Provide section selection for X86 ELF targets
llvm-svn: 53305
2008-07-09 13:23:08 +00:00
Anton Korobeynikov 9d6939b5fc Provide general hook for section name calculation
llvm-svn: 53304
2008-07-09 13:22:46 +00:00
Anton Korobeynikov ab778022d5 Properly handle linkonce stuff
llvm-svn: 53296
2008-07-09 13:19:38 +00:00
Anton Korobeynikov 7680198798 Provide skeletone code for calculation of section, where global should be emitted into
llvm-svn: 53295
2008-07-09 13:19:08 +00:00
Anton Korobeynikov 3ee57868a5 Use 'llvm-linkonce' consistently
llvm-svn: 53294
2008-07-09 13:18:38 +00:00
Anton Korobeynikov 21539c6d1e Add default section name resolution routine
llvm-svn: 53292
2008-07-09 13:18:02 +00:00
Anton Korobeynikov aab504fb19 Constify
llvm-svn: 53291
2008-07-09 13:17:36 +00:00
Anton Korobeynikov 9e4ab5023a Add code for default section falgs computation
llvm-svn: 53290
2008-07-09 13:16:59 +00:00
Duncan Sands 04fb6bf468 Linux also does not require exception handling
moves in order to get correct debug info.  Since
I can't imagine how any target could possibly
be any different, I've just stripped out the
option: now all the world's like Darwin!

llvm-svn: 53134
2008-07-04 09:55:48 +00:00
Bill Wendling b7bd02be57 Darwin doesn't need exception handling information for the "move" info when
debug information is being output, because it's leet!

llvm-svn: 52994
2008-07-01 23:34:48 +00:00
Anton Korobeynikov 2e052a81fd Start refactoring of asmprinters: provide a TAI hook, which will select a 'section kind' for a global.
llvm-svn: 52868
2008-06-28 13:45:57 +00:00
Dale Johannesen 355b74acc2 Add StringConstantPrefix to control what the
assembler names of string constants look like.

llvm-svn: 51909
2008-06-03 18:09:06 +00:00