Commit Graph

136 Commits

Author SHA1 Message Date
Owen Anderson a7aed18624 Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson bda59bd247 Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson 755aceb5d0 Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Eli Friedman 17c5a23559 Get rid of a bunch of duplicated ELF enum values.
llvm-svn: 108520
2010-07-16 07:53:29 +00:00
Dan Gohman 913c998703 Add more const qualifiers for LLVM IR pointers in CodeGen.
llvm-svn: 101342
2010-04-15 04:33:49 +00:00
Benjamin Kramer a6769269f3 Use twines to simplify calls to report_fatal_error. For code size and readability.
llvm-svn: 100756
2010-04-08 10:44:28 +00:00
Chris Lattner 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +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 768ea2add2 change MCContext to always have an MCAsmInfo.
llvm-svn: 98293
2010-03-11 22:53:35 +00:00
Chris Lattner f8928453bc remove dead #include, stupid symlinks.
llvm-svn: 95150
2010-02-02 22:37: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 e244ff35d8 remove a dead call.
llvm-svn: 94297
2010-01-23 07:17:54 +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
Chris Lattner f62e3ee8c5 move the mangler into libtarget from vmcore.
llvm-svn: 93664
2010-01-16 21:57:06 +00:00
Chris Lattner 32c9512132 remove a couple of actively incorrect uses of getMangledName.
llvm-svn: 93627
2010-01-16 02:16:09 +00:00
David Greene af5b9a2d62 Change errs() to dbgs().
llvm-svn: 92502
2010-01-04 19:57:26 +00:00
Chris Lattner fdd8790718 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Bruno Cardoso Lopes 92e18c456a Fix ELF Writter related memory leaks
llvm-svn: 80717
2009-09-01 19:25:52 +00:00
Chris Lattner e9a75a6654 rename TAI -> MAI, being careful not to make MAILJMP instructions :)
llvm-svn: 79777
2009-08-22 21:43:10 +00:00
Chris Lattner 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Bill Wendling bde8a4c6c9 Convert DOUT to DEBUG(errs()...).
llvm-svn: 79749
2009-08-22 20:07:03 +00:00
Bruno Cardoso Lopes c773141e66 *try* to use a better name to describe how common symbols are marked on the elf object file.
llvm-svn: 79029
2009-08-14 19:45:38 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Bruno Cardoso Lopes d2d45a5575 Remove hack used to strip unwanted chars from section name
Use MCSectionELF methods as much as possible, removing some
ELFWriter methods which are now unused

llvm-svn: 78940
2009-08-13 21:25:27 +00:00
Bruno Cardoso Lopes 607cd3b63a Change MCSectionELF to represent a section semantically instead of
syntactically as a string, very similiar to what Chris did with MachO.
The parsing support and validation is not introduced yet.

llvm-svn: 78890
2009-08-13 05:07:35 +00:00
Bruno Cardoso Lopes 9b3484dd14 Move ConstantExpr handling to ResolveConstantExpr method and also
add support for PtrToInt, Add, Mul.

llvm-svn: 78552
2009-08-10 03:32:40 +00:00
Chris Lattner 591105c540 sink the 'name' and 'isdirective' state out of MCSection into its derived classes.
This totally optimizes PIC16 sections by not having an 'isdirective' bit anymore!! ;-)

llvm-svn: 78517
2009-08-08 23:39:42 +00:00
Bruno Cardoso Lopes 72dd2eef36 ELF improvements:
Handle large integers, x86_fp80, ConstantAggregateZero, and two more ConstantExpr:
GetElementPtr and IntToPtr
Set SHF_MERGE bit for mergeable strings
Avoid zero initialized strings to be classified as a bss symbol
Don't allow common symbols to be classified as STB_WEAK
Add a constant to be used as a global value offset in data relocations 

llvm-svn: 78476
2009-08-08 17:29:04 +00:00
Bruno Cardoso Lopes 2b1dc9a783 - Remove custom handling of jumptables by the elf writter (this was
a dirty hack and isn't need anymore since the last x86 code emitter patch)
- Add a target-dependent modifier to addend calculation
- Use R_X86_64_32S relocation for X86::reloc_absolute_word_sext
- Use getELFSectionFlags whenever possible
- fix getTextSection to use TLOF and emit the right text section 
- Handle global emission for static ctors, dtors and Type::PointerTyID
- Some minor fixes

llvm-svn: 78176
2009-08-05 06:57:03 +00:00
Chris Lattner fb53861ee0 remove the dead ELFTargetAsmInfo.h/cpp file. TargetAsmInfo
defaults to being ELF.

llvm-svn: 77866
2009-08-02 04:33:09 +00:00
Chris Lattner f8d9710b6f (re)introduce new simpler apis for creation sectionkinds.
llvm-svn: 77834
2009-08-01 23:57:16 +00:00
Chris Lattner 0c40266b5a 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.

llvm-svn: 77833
2009-08-01 23:46:12 +00:00
Chris Lattner c9c277ba0f Change SectionKind to be a property that is true of a *section*, it
should have no state that is specific to particular globals in the
section.  In this case, it means the removal of the "isWeak" and
"ExplicitSection" bits.  MCSection uses the new form of SectionKind.

To handle isWeak, I introduced a new SectionInfo class, which is
SectionKind + isWeak, and it is used by the part of the code generator
that does classification of a specific global.

The ExplicitSection disappears.  It is moved onto MCSection as a new
"IsDirective" bit.  Since the Name of a section is either a section
or directive, it makes sense to keep this bit in MCSection.  Ultimately
the creator of MCSection should canonicalize (e.g.) .text to whatever
the actual section is.

llvm-svn: 77803
2009-08-01 21:11:14 +00:00
Chris Lattner 4d2c0f9008 switch off of 'Section' onto MCSection. We're not properly using
MCSection subclasses yet, but this is a step in the right direction.

llvm-svn: 77708
2009-07-31 18:48:30 +00:00
Chris Lattner 51d5b43cda refactor section construction in TLOF to be through an explicit
initialize method, which can be called when an MCContext is available.

llvm-svn: 77687
2009-07-31 17:42:42 +00:00
Chris Lattner 5034329f8d pass the mangler down into the various SectionForGlobal methods.
No functionality change.

llvm-svn: 77432
2009-07-29 05:09:30 +00:00
Bruno Cardoso Lopes c6c5dbd5b8 Handle null and file symbol on doInitialization
llvm-svn: 77354
2009-07-28 19:25:33 +00:00
Chris Lattner 5e693ed07b 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.

llvm-svn: 77294
2009-07-28 03:13:23 +00:00
Bruno Cardoso Lopes 16c5b4fca8 add module identifier to the elf object file
llvm-svn: 77238
2009-07-27 19:32:57 +00:00
Bruno Cardoso Lopes cb364ab3f2 Handle external symbols for ELF and add some static methods to ELFSym
llvm-svn: 77232
2009-07-27 18:54:47 +00:00
Chris Lattner 149465ea06 Eliminate SectionFlags, just embed a SectionKind into Section
instead and drive things based off of that.

llvm-svn: 77184
2009-07-27 05:32:16 +00:00
Chris Lattner e45ff5cc2b make SectionKind know whether a symbol is weak or not in addition
to its classification.

llvm-svn: 77140
2009-07-26 07:00:12 +00:00
Chris Lattner 29151b0218 rename Mergable -> Mergeable and Writable -> Writeable
llvm-svn: 77138
2009-07-26 06:48:26 +00:00
Chris Lattner abd47512f7 two files I missed in the last commit.
llvm-svn: 77137
2009-07-26 06:36:20 +00:00
Chris Lattner fb6867c7db simplify getSectionForMergableConstant to take a SectionKind.
llvm-svn: 77134
2009-07-26 06:26:55 +00:00
Chris Lattner 60f3b73e11 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.

llvm-svn: 77085
2009-07-25 18:57:34 +00:00
Chris Lattner b300a4f988 remove the SelectSectionForMachineConst hook, replacing it with
a new getSectionForMergableConstant hook.  This removes one dependence
of TAI on Type, and provides the hook with enough info to make the 
right decision based on whether the global has relocations etc.

llvm-svn: 76705
2009-07-22 00:28:43 +00:00
Bruno Cardoso Lopes 12e543228d Support adding relocations for data sections, handling the cases where
global declared symbols are initialized with references from other global
symbols.

llvm-svn: 76540
2009-07-21 06:51:32 +00:00
Bruno Cardoso Lopes 447b7fd4bb For PC relative relocations where symbols are defined in the same section they
are referenced, ignore the relocation entry and patch the relocatable field with
the computed symbol offset directly

llvm-svn: 76414
2009-07-20 08:52:02 +00:00