Commit Graph

332 Commits

Author SHA1 Message Date
Chris Lattner df16c223da remove dead member.
llvm-svn: 79764
2009-08-22 20:50:18 +00:00
Chris Lattner 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Chris Lattner a7668ff636 Revert r79563
llvm-svn: 79691
2009-08-21 23:12:47 +00:00
Chris Lattner 773416e062 revert r79562 + r79563
llvm-svn: 79690
2009-08-21 23:12:15 +00:00
Chris Lattner f407dbbb1a revert r79631
llvm-svn: 79686
2009-08-21 23:08:45 +00:00
Chris Lattner 6af22f02ef revert 79631
llvm-svn: 79685
2009-08-21 23:08:09 +00:00
Duncan Sands 08b437d600 Fix a problem noticed by gcc-4.4:
warning: comparison is always true due to limited range of data type.

llvm-svn: 79642
2009-08-21 17:16:10 +00:00
Daniel Dunbar 2f0e8f55f5 Fix -Asserts warning.
llvm-svn: 79636
2009-08-21 16:17:36 +00:00
Sanjiv Gupta 9ae3bcb79e Add a pass to do call graph analyis to overlay the autos and frame sections of
leaf functions. This pass will be extended to color other nodes of the call tree 
as well in future.

llvm-svn: 79631
2009-08-21 15:22:33 +00:00
Bill Wendling 64965aafe7 Remove #include <iostream>.
llvm-svn: 79603
2009-08-21 06:52:44 +00:00
Sanjiv Gupta a874d82492 part of the previous commit for PIC16 ISR implementation.
llvm-svn: 79563
2009-08-20 19:34:18 +00:00
Sanjiv Gupta 686e9f55dc Implement support for ISRs.
Clone functions that are shared between the Main thread and Interrupt thread.
CallSites are changed in AsmPrinter currently. A better solution would have been to modify the legalizer (SoftenFloat) to allow targets to change the name of libcalls for float operations. But that currently breaks other targets.
Also, cloing of automatic variables is done AsmPrinter, a better approach would
be to use the ValueMap in CloneFunction itself.

llvm-svn: 79562
2009-08-20 19:28:24 +00:00
Chris Lattner 4b7dadb76e eliminate AsmPrinter::SwitchToSection and just have clients
talk to the MCStreamer directly instead.

llvm-svn: 79405
2009-08-19 05:49:37 +00:00
Sanjiv Gupta 1e5027aaef Revert a few changes that were done in 78603.
PIC16DebugInfo currently rely on NameStr of composite type descriptors to uniquely
identify debug info for two aggregate type decls with same name.
This implementation will change when we have MDNodes based debug info implemenatation in place

llvm-svn: 79097
2009-08-15 14:36:48 +00:00
Chris Lattner 84ff2c9348 update for rename.
llvm-svn: 79082
2009-08-15 06:14:07 +00:00
Chris Lattner 6362cbe64e rename PIC16Section.h -> MCSectionPIC16.h for consistency with
the class it defines.

llvm-svn: 79081
2009-08-15 06:13:40 +00:00
Daniel Dunbar c01ed862c8 Reapply pieces of 78914 reverted in 78916, this has been fixed.
llvm-svn: 78921
2009-08-13 17:08:54 +00:00
Daniel Dunbar e95b32b057 Remove obsoleted files (from AsmPrinter move)
llvm-svn: 78917
2009-08-13 16:57:03 +00:00
Owen Anderson ca232776ec Revert r78914, as it was breaking the build.
llvm-svn: 78916
2009-08-13 16:54:39 +00:00
Sanjiv Gupta 89ec31a26a Move PIC16 AsmPrinter to PIC16/AsmPrinter directory.
Remove CooperTargetMachine, as currently only one is supported.

llvm-svn: 78914
2009-08-13 16:37:05 +00:00
Chris Lattner 5ed8c4212a make PIC16 unique its own sections instead of having mcontext do it.
llvm-svn: 78871
2009-08-13 00:26:52 +00:00
Chris Lattner 1fe315fe13 some compiler don't get string from TLOF.h implicitly or something.
llvm-svn: 78864
2009-08-12 23:53:59 +00:00
Dan Gohman 1432ef864e This void is implicit in C++.
llvm-svn: 78848
2009-08-12 22:10:57 +00:00
Chris Lattner 9a6cf91261 Change TargetAsmInfo to be constructed via TargetRegistry from a Target+Triple
pair instead of from a virtual method on TargetMachine.  This cuts the final
ties of TargetAsmInfo to TargetMachine, meaning that MC can now use 
TargetAsmInfo.

llvm-svn: 78802
2009-08-12 07:22:17 +00:00
Owen Anderson 117c9e8497 Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
llvm-svn: 78759
2009-08-12 00:36:31 +00:00
Owen Anderson 9f94459d24 Split EVT into MVT and EVT, the former representing _just_ a primitive type, while
the latter is capable of representing either a primitive or an extended type.

llvm-svn: 78713
2009-08-11 20:47:22 +00:00
Chris Lattner 2c30970b22 pass the TargetTriple down from each target ctor to the
LLVMTargetMachine ctor.  It is currently unused.

llvm-svn: 78711
2009-08-11 20:42:37 +00:00
Sanjiv Gupta dd4103b55b Fixed more problems caused by 78142.
Passing of indirect arguments starts after return value on the callee's frame.

llvm-svn: 78635
2009-08-11 01:51:55 +00:00
Owen Anderson 53aa7a960c Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
llvm-svn: 78610
2009-08-10 22:56:29 +00:00
Devang Patel 148e9f0d3f Do not rely on magic "llvm.dbg.*" global variable name to find debug info.
PIC16 developers, please verify. 

llvm-svn: 78603
2009-08-10 22:11:20 +00:00
Owen Anderson c30530d105 Start moving TargetLowering away from using full MVTs and towards SimpleValueType, which will simplify the privatization of IntegerType in the future.
llvm-svn: 78584
2009-08-10 18:56:59 +00:00
Chris Lattner 7b01bf6125 fix some warnings for the MSVC build, by Yonggang Luo!
llvm-svn: 78571
2009-08-10 17:35:42 +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
Chris Lattner 1cb9396f4f 1. Make MCSection an abstract class.
2. Move section switch printing to MCSection virtual method which takes a
   TAI.  This eliminates textual formatting stuff from TLOF.
3. Eliminate SwitchToSectionDirective, getSectionFlagsAsString, and 
   TLOFELF::AtIsCommentChar.

llvm-svn: 78510
2009-08-08 22:41:53 +00:00
Chris Lattner 26cc5b78d0 add new PIC16Section class, this time hopefully not breaking the build :)
llvm-svn: 78505
2009-08-08 21:37:01 +00:00
Daniel Dunbar 59410aaea6 Revert r78501, it doesn't build.
--- Reverse-merging r78501 into '.':
U    lib/Target/PIC16/PIC16TargetObjectFile.cpp
D    lib/Target/PIC16/PIC16Section.h

llvm-svn: 78503
2009-08-08 21:12:40 +00:00
Chris Lattner 4a4e4487fc make PIC16 create its own custom MCSection.
llvm-svn: 78501
2009-08-08 20:55:25 +00:00
Chris Lattner 36d04ec972 give pic16 a target-specific section creation name too
llvm-svn: 78496
2009-08-08 20:23:47 +00:00
Chris Lattner 302041d5c9 sink getOrCreateSection down into all the object file implementations,
now that they create *all* the sections.

llvm-svn: 78494
2009-08-08 20:14:13 +00:00
Chris Lattner b94284b5e2 make printInstruction return void since its result is omitted. Make the
error condition get trapped with an assert.

llvm-svn: 78449
2009-08-08 01:32:19 +00:00
Sanjiv Gupta 54c847cd6c Minor fixes to avoid using invalid debugloc.
llvm-svn: 78383
2009-08-07 11:00:02 +00:00
Benjamin Kramer 24ee4d0aa4 Simplify code and avoid allocations.
llvm-svn: 78382
2009-08-07 10:42:28 +00:00
Sanjiv Gupta 003dc1fa5b Run memsel inserter just before emit assembly to avoid tinkering by other passes.
llvm-svn: 78369
2009-08-07 05:44:27 +00:00
Devang Patel cd4688905f Use DebugInfoFinder
llvm-svn: 78334
2009-08-06 20:53:24 +00:00
Chris Lattner 1ff90134a4 Fix several fixmes and clean up code by sinking *all* section
creation activity into the target-specific subclasses of TLOF.
Before this, globals with explicit sections could be created by
the base class.

1. make getOrCreateSection protected, add a new getExplicitSectionGlobal
   pure virtual method to assign sections to globals with a specified
   section.
2. eliminate getSpecialCasedSectionGlobals, which is now PIC specific.
3. eliminate the getKindForNamedSection virtual method, which is
   now just a static method for ELF.
4. Add implementions of getExplicitSectionGlobal for ELF/PECOFF/Darwin/PIC16.
   They are now all detangled and understandable, woo! :)

llvm-svn: 78319
2009-08-06 16:39:58 +00:00
Chris Lattner b29996eb23 go through PIC16TargetObjectFile to make sections instead of
creating them directly in the pic16 asmprinter.

llvm-svn: 78317
2009-08-06 16:27:28 +00:00
Dan Gohman 477fd55c9a Fix a bug in the PIC16 backend.
llvm-svn: 78211
2009-08-05 16:46:43 +00:00
Dan Gohman f9bbcd1afd Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.

This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.

This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.

llvm-svn: 78142
2009-08-05 01:29:28 +00:00
Sanjiv Gupta b4c28d23e1 Legalize i64 store operations generated by inst-combine.
llvm-svn: 78082
2009-08-04 17:59:16 +00:00
Daniel Dunbar ed65bf420d Avoid compiler warning (in -Asserts mode)
llvm-svn: 78070
2009-08-04 16:46:12 +00:00
Daniel Dunbar c3719c36e6 Move most targets TargetMachine constructor to only taking a target triple.
- The C, C++, MSIL, and Mips backends still need the module.

llvm-svn: 77927
2009-08-02 23:37:13 +00:00
Daniel Dunbar 31b44e8f6c Normalize Subtarget constructors to take a target triple string instead of
Module*.

Also, dropped uses of TargetMachine where unnecessary. The only target which
still takes a TargetMachine& is Mips, I would appreciate it if someone would
normalize this to match other targets.

llvm-svn: 77918
2009-08-02 22:11:08 +00:00
Chris Lattner 3ea23cff65 PIC16 TAI doesn't need TM
llvm-svn: 77867
2009-08-02 04:41:14 +00:00
Chris Lattner b25afe081c remove TargetAsmInfo::TM, which is now dead. The basic TAI class now
no longer depends on TM!

llvm-svn: 77863
2009-08-02 04:27:24 +00:00
Daniel Dunbar cc5e54e986 Fix a possible crash on delete of an uninitialized variable.
llvm-svn: 77846
2009-08-02 01:25:15 +00:00
Dan Gohman 321dc97adf Don't call SectionForGlobal for hasAvailableExternallyLinkage()
variables either.

llvm-svn: 77844
2009-08-02 01:18:44 +00:00
Chris Lattner a17d2e5c21 don't call SectionForGlobal on declarations, you can't tell the section a
declaration will end up in.

llvm-svn: 77843
2009-08-02 01:02:43 +00:00
Chris Lattner 73d577c933 Make SectionKind::get() private.
llvm-svn: 77835
2009-08-02 00:02:44 +00:00
Chris Lattner d5c01136ef fix a fixme by sinking various target-specific directives down into
the appropriate subclasses.

llvm-svn: 77815
2009-08-01 21:56:13 +00:00
Chris Lattner 26fb277f92 it turns out that isWeak() was basically dead anyway. Kill off SectionInfo :-/
llvm-svn: 77812
2009-08-01 21:46:23 +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
Sanjiv Gupta 7de154708a define target names for std libcalls.
llvm-svn: 77667
2009-07-31 07:35:57 +00:00
Sanjiv Gupta 8787861004 Keep track of references to mem(cpy,move,set) and then print only one extern
declaration for them.

llvm-svn: 77578
2009-07-30 04:15:15 +00:00
Owen Anderson 4056ca9568 Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +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
Chris Lattner e1a70c964f fix a casting problem on the llvm-x86_64-linux tester
llvm-svn: 77295
2009-07-28 03:20:34 +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
Chris Lattner 697150ec0c don't copy TargetLowering.
llvm-svn: 77293
2009-07-28 03:05:40 +00:00
Sanjiv Gupta 96b3d4a2f9 Remove duplicate entries while printing decls for external symbols.
Some libcall names are same, so they were getting printed twice.

llvm-svn: 77215
2009-07-27 18:04:34 +00:00
Chris Lattner 86b7255776 Eliminate getNamed/getUnnamedSection, adding a new and unified getOrCreateSection
instead.

llvm-svn: 77186
2009-07-27 06:17:14 +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
Sanjiv Gupta c8885129d8 Generate a libcall for i8 multiply.
llvm-svn: 77179
2009-07-27 02:44:46 +00:00
Sanjiv Gupta e334b34bfd fixed incorrect lowering of ISD::SUB node. SUB has only one result value.
It wasn't caught during tests because we never got a sub generated, (i8 was always getting promoted to int, which in turn was broken into subc/sube). Though the optimizer leaves an i8 sub now. 

llvm-svn: 77178
2009-07-27 02:26:06 +00:00
Chris Lattner 06ad4948f5 reduce indentation
llvm-svn: 77161
2009-07-26 18:08:15 +00:00
Sanjiv Gupta fc4d4994ee Fix the breakage caused by 76950.
PIC16 has special naming conventions for variables having section names specified via section attribute.

llvm-svn: 77153
2009-07-26 10:25:01 +00:00
Daniel Dunbar ee01b242e8 Factor commonality in triple match routines into helper template for registering
classes, and migrate existing targets over.

llvm-svn: 77126
2009-07-26 05:03:33 +00:00
Daniel Dunbar bc981d8efa Kill Target specific ModuleMatchQuality stuff.
- This was overkill and inconsistently implemented.

llvm-svn: 77114
2009-07-26 02:22:58 +00:00
Chris Lattner 0af00396a7 make SectionKind be a first-class pod struct instead of just
an enum.

llvm-svn: 77096
2009-07-25 23:21: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
Daniel Dunbar 691a4784db Simplify JIT target selection.
- Instead of requiring targets to define a JIT quality match function, we just
   have them specify if they support a JIT.

 - Target selection for the JIT just gets the host triple and looks for the best
   target which matches the triple and has a JIT.

llvm-svn: 77060
2009-07-25 10:09:50 +00:00
Sanjiv Gupta b6ee0b1d9b Mark attributes of return insn correctly. It was being assumed safe to delete in isSafeToDelete (a thing checked-in 76281).
llvm-svn: 77056
2009-07-25 07:48:53 +00:00
Daniel Dunbar 5680b4f285 Add new helpers for registering targets.
- Less boilerplate == good.

llvm-svn: 77052
2009-07-25 06:49:55 +00:00
Chris Lattner 73f6651439 we already know the sectionkind when invoking SelectSectionForGlobal,
pass it in instead of recomputing it.

llvm-svn: 76990
2009-07-24 18:42:53 +00:00
Chris Lattner bf9ac228f7 make SectionForGlobal non-virtual, add a hook for pic16 to do its "address=" hack.
llvm-svn: 76989
2009-07-24 18:34:27 +00:00
Chris Lattner b68b506d84 start refactoring pic16 section selection logic.
llvm-svn: 76977
2009-07-24 17:13:27 +00:00
Daniel Dunbar 12368685d8 Switch to getNameStr().
llvm-svn: 76962
2009-07-24 08:24:36 +00:00
Chris Lattner ddf377df1a simplify code by making special case more obvious
llvm-svn: 76950
2009-07-24 04:59:43 +00:00
Sanjiv Gupta 56df1e7969 Do not call getMangledName on Intrinsics.
llvm-svn: 76842
2009-07-23 02:11:04 +00:00
Daniel Dunbar 5899dda08c Switch some clients to Value::getName(), and other getName() user
simplification.
 - NFC

llvm-svn: 76789
2009-07-22 21:33:09 +00:00
Eli Friedman da9eda8ef6 Remove shift amount flavor. It isn't actually complete enough to
be useful, and it's currently unused.  (Some issues: it isn't actually 
rich enough to capture the semantics on many architectures, and
semantics can vary depending on the type being shifted.)

llvm-svn: 76633
2009-07-21 20:12:16 +00:00
Chris Lattner 100865e59d make AsmPrinter::doFinalization iterate over the global variables
and call PrintGlobalVariable, allowing elimination and simplification
of various targets.

llvm-svn: 76604
2009-07-21 18:38:57 +00:00
Chris Lattner ecaf7dedd2 more random whitespace cleanup, eliminate #define, avoid copying
vectors needlessly, doxygenify comments, improve constness, etc.

llvm-svn: 76585
2009-07-21 17:20:18 +00:00
Chris Lattner 0e6e8cb590 some simple whitespace cleanup, avoid copying vectors for no reason
as much, etc.

llvm-svn: 76578
2009-07-21 16:44:47 +00:00
Chris Lattner 2cd8f753c0 clean up some formatting, indent by 2 instead of 4.
llvm-svn: 76490
2009-07-20 22:23:48 +00:00
Chris Lattner d290543332 rename TargetAsmInfo::getASDirective -> getDataASDirective
llvm-svn: 76431
2009-07-20 17:12:46 +00:00
Daniel Dunbar 7eaf6dd84a Tweak cmake files for the four targets that don't split CodeGen out.
- We should canonicalize this and get rid of the cmake and llvm-config hacks to
   support both variants.

llvm-svn: 76350
2009-07-19 00:26:46 +00:00
Daniel Dunbar 83779208cc Add dependencies from TargetInfo onto .td generation.
- Shouldn't really be necessary, but currently .inc files get included into
   some main target headers.

llvm-svn: 76349
2009-07-19 00:21:12 +00:00
Daniel Dunbar 67038c1333 Put Target definitions inside Target specific header, and llvm namespace.
llvm-svn: 76344
2009-07-18 23:03:22 +00:00
Eli Friedman 836024d76d Remove some unnecessary expansion markings. Add a few expansion
markings that show up in test/CodeGen/Generic.

llvm-svn: 76160
2009-07-17 07:03:00 +00:00