Commit Graph

171 Commits

Author SHA1 Message Date
Chris Lattner
18a4c16726 move dwarf debug info section selection stuff from TAI to
TLOF, unifying all the dwarf targets at the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 07:24:22 +00:00
Chris Lattner
35039ac241 convert EHFrameSection to be managed by TLOF instead of TAI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 06:52:36 +00:00
Chris Lattner
d90183d25d Move the getInlineAsmLength virtual method from TAI to TII, where
the only real caller (GetFunctionSizeInBytes) uses it.

The custom ARM implementation of this is basically reimplementing
an assembler poorly for negligible gain.  It should be removed 
IMNSHO, but I'll leave that to ARMish folks to decide.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 05:20:37 +00:00
Chris Lattner
8d4a0a328a remove TargetAsmInfo::TM, which is now dead. The basic TAI class now
no longer depends on TM!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 04:27:24 +00:00
Chris Lattner
5e62147e07 clean up #includes of TargetAsmInfo.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 04:09:22 +00:00
Chris Lattner
b6d667403f remove the dead PreferredEHDataFormat TAI hook: its now dead
even considering #if 0 code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 04:02:52 +00:00
Chris Lattner
d5bbb07ec8 move getDwarfExceptionSection from TAI to TLOF and rename it to
getLSDASection() to be more specific.  This makes it pretty obvious
that the ELF LSDA section is being specified wrong in PIC mode.  We're
probably getting a lot of startup-time relocations to a readonly page,
which is expensive and bad.

Someone who cares about ELF C++ should investigate this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 01:34:32 +00:00
Chris Lattner
80ec2792b2 convert ctors/dtors section to be in TLOF instead of
TAI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 00:34:36 +00:00
Chris Lattner
83d77faf6e Remove "JumpTableDataSection" from TAI, instead, have AsmPrinter
compute it based on what it knows.  As part of this, rename getSectionForMergeableConstant
to getSectionForConstant because it works for non-mergable constants also.

The only functionality change from this is that Xcore will start dropping
its jump tables into readonly section instead of data section in -static mode.
This should be fine as the linker resolves the relocations.  If this is a
problem, let me know and we'll come up with another solution.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 23:46:12 +00:00
Chris Lattner
b80610cd13 REmove dead fields of TAI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-01 22:40:22 +00:00
Chris Lattner
7a01e95915 PreferredEHDataFormat is always call with data and global, but this whole
thing is #if0'd out anyway.  Just simplify the code by reducing the interface.
Not deleting this is essential for Bill's continuing happiness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 21:39:55 +00:00
Chris Lattner
f0144127b9 Rip all of the global variable lowering logic out of TargetAsmInfo. Since
it is highly specific to the object file that will be generated in the end,
this introduces a new TargetLoweringObjectFile interface that is implemented
for each of ELF/MachO/COFF/Alpha/PIC16 and XCore.

Though still is still a brutal and ugly refactoring, this is a major step
towards goodness.

This patch also:
1. fixes a bunch of dangling pointer problems in the PIC16 backend.
2. disables the TargetLowering copy ctor which PIC16 was accidentally using.
3. gets us closer to xcore having its own crazy target section flags and
   pic16 not having to shadow sections with its own objects.
4. fixes wierdness where ELF targets would set CStringSection but not
   CStringSection_.  Factor the code better.
5. fixes some bugs in string lowering on ELF targets.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 03:13:23 +00:00
Chris Lattner
3b07b5214c Sink getSectionPrefixForUniqueGlobal down into the TAI
implementations that need it, rearrange ELFTAI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 19:14:14 +00:00
Chris Lattner
a7defb7150 add an explanatory comment about why we drop these in readonly and
not in mergable


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 17:39:40 +00:00
Chris Lattner
afcb70bc73 don't create default text/data sections for all targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 16:44:04 +00:00
Chris Lattner
e346694a81 Eliminate getNamed/getUnnamedSection, adding a new and unified getOrCreateSection
instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 06:17:14 +00:00
Chris Lattner
5fe575ff4f Eliminate SectionFlags, just embed a SectionKind into Section
instead and drive things based off of that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 05:32:16 +00:00
Chris Lattner
0fcf4dc6d3 untangle a TargetAsmInfo hack where ELFTargetAsmInfo would create a
'unnamed' bss section, but some impls would want a named one.  Since
they don't have consistent behavior, just make each target do their
own thing, instead of doing something "sortof common" then having
targets change immutable objects later.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 19:23:28 +00:00
Chris Lattner
f40761d522 remove a densemap from TargetAsmInfo that was uniquing the targetflags strings,
just use a smallstring instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 07:33:58 +00:00
Chris Lattner
6468b44d3a simplify SectionFlagsForGlobal, even though I want to kill it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77143 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 07:17:39 +00:00
Chris Lattner
37088b3f82 make SectionKind keep track of whether a global had an explicit
section specified for it or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 07:14:28 +00:00
Chris Lattner
4c50922f6b make SectionKind know whether a symbol is weak or not in addition
to its classification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 07:00:12 +00:00
Chris Lattner
2ceb60a677 rename Mergable -> Mergeable and Writable -> Writeable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 06:48:26 +00:00
Chris Lattner
2c5815d090 remove a bunch of helper functions, just use SectionKind::get instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 06:34:33 +00:00
Chris Lattner
5c2f789952 simplify getSectionForMergableConstant to take a SectionKind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 06:26:55 +00:00
Chris Lattner
8ca520944e introduce specialized mergable const sectionkinds for elements of size 4/8/16 to
simplify targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 06:11:33 +00:00
Chris Lattner
7f88a20f67 improve the default impl of getSectionForMergableConstant by
putting readonly constants in the readonly section if we have one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 05:57:07 +00:00
Chris Lattner
e346e180f3 Rearrange all the SectionKinds and structure them into a hierarchical
group instead of a bunch of random unrelated ideas.  Provide predicates
to categorize a SectionKind into a group, and use them instead of 
getKind() throughout the code.

This also renames a ton of SectionKinds to be more consistent and
evocative, and adds a huge number of comments on the enums so that
I will hopefully be able to remember how this stuff works long from
now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 05:44:20 +00:00
Chris Lattner
460d51e0c0 make SectionKind be a first-class pod struct instead of just
an enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 23:21:55 +00:00
Chris Lattner
b4fc419d83 this is (unfortunately) several changes mixed together:
1. Spell SectionFlags::Writeable as "Writable".
2. Add predicates for deriving SectionFlags from SectionKinds.
3. Sink ELF-specific getSectionPrefixForUniqueGlobal impl into
   ELFTargetAsmInfo.
4. Fix SectionFlagsForGlobal to know that BSS/ThreadBSS has the
   BSS bit set (the real fix for PR4619).
5. Fix isSuitableForBSS to not put globals with explicit sections
   set in BSS (which was the reason #4 wasn't fixed earlier).
6. Remove my previous hack for PR4619.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 18:57:34 +00:00
Chris Lattner
4f05591e61 document some invariants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 18:11:58 +00:00
Chris Lattner
10cf6a6a4b add the most expedient hack to fix PR4619, along with a testcase.
Thanks to Rafael for the great example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 17:57:37 +00:00
Chris Lattner
fbd3d4a5c3 fix some predicates
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 20:27:11 +00:00
Chris Lattner
0d4960c3ca change SectionKindForGlobal from being a public (and
previously virtual) function to being a static function
in the .cpp file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 20:14:10 +00:00
Chris Lattner
b303504a56 make SectionKindForGlobal target independent, and therefore non-virtual.
It's classifications now include elf-specific discriminators.  Targets
that don't have these features (like darwin and pecoff) simply treat
data.rel like data, etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 19:15:47 +00:00
Chris Lattner
f20f250b6f we already know the sectionkind when invoking SelectSectionForGlobal,
pass it in instead of recomputing it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 18:42:53 +00:00
Chris Lattner
7420ab2191 make SectionForGlobal non-virtual, add a hook for pic16 to do its "address=" hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 18:34:27 +00:00
Chris Lattner
2dcafe4b8f move ELF-specific code into ELFTargetAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76976 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 17:02:17 +00:00
Chris Lattner
e5ca0ac36b tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 16:53:52 +00:00
Chris Lattner
27f3065cf3 split the ELF-specific section flag inference-from-name code out
into its own helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 16:50:24 +00:00
Chris Lattner
8adc547a91 make SectionFlagsForGlobal a private static function instead of a public
virtual one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 16:46:50 +00:00
Chris Lattner
104bbd10e4 move a method up in the file, GV is always non-null, so remove a check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 16:44:01 +00:00
Chris Lattner
3df6d5d83b There is no need to pass the name into lib/Target/TargetAsmInfo.cpp
when we have a global with no section explicitly specified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 16:40:45 +00:00
Daniel Dunbar
895c9ede1f Another getName -> getNameStr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 12:21:08 +00:00
Chris Lattner
eed05b8042 hoist section name uniquing logic up to the top-level SectionForGlobal
implementation, eliminating a dupe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 05:10:25 +00:00
Chris Lattner
55acc6807f Replace UniqueSectionForGlobal with getSectionPrefixForUniqueGlobal.
The later doesn't depend on any crazy LLVM IR stuff, and this
pulls the concatenation of prefix with GV name (the root problem behind
PR4584) out one level.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 04:49:34 +00:00
Chris Lattner
fb3431aec5 reduce api exposure: clients shouldn't call SectionKindForGlobal directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76941 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 03:49:17 +00:00
Chris Lattner
ad733cd851 remove more bits of small section support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 03:16:53 +00:00
Chris Lattner
013e6b6309 Remove SectionKind::Small*. This was only used on mips, and is apparently
a sad mistake that is regretted. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 03:11:51 +00:00
Chris Lattner
819c4f365f remove SectionFlags::Small: it is only used on Xcore, and we'll find
a better solution for it in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 23:27:22 +00:00