Commit Graph

201 Commits

Author SHA1 Message Date
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
Devang Patel a4f43fb5dd Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.

llvm-svn: 77370
2009-07-28 21:49:47 +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 9d0e762c81 hoist MCContext/MCStreamer up to AsmPrinter since we're going to start creating
MCSections soon instead of Section for all targets, and we need something to
own them.

llvm-svn: 77252
2009-07-27 21:28:04 +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
Daniel Dunbar 9813b0b025 Eliminate some uses of DOUT, cerr, and getNameStart().
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Daniel Dunbar e03eecb75f Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.

llvm-svn: 77098
2009-07-25 23:55:21 +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 1553fdee55 use section flags more correctly.
llvm-svn: 76944
2009-07-24 04:08:17 +00:00
Chris Lattner 53f92dc95b fix a mysterious and scary failure on test/CodeGen/X86/cstring.ll
llvm-svn: 76942
2009-07-24 03:55:48 +00:00
Chris Lattner 07bd1cd8c5 reduce api exposure: clients shouldn't call SectionKindForGlobal directly.
llvm-svn: 76941
2009-07-24 03:49:17 +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
Bill Wendling a3c6f6bffa Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.

This is plumbing, so we don't have a use of it yet. More to come, etc.

llvm-svn: 76385
2009-07-20 01:03:30 +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
Daniel Dunbar c151c51ea0 Kill off <TARGET>MachineModule variables, and <TARGETASMPRINTER>ForceLink
variables.
 - Module initialization functions supplanted the need for these.

llvm-svn: 75886
2009-07-16 01:55:13 +00:00
Daniel Dunbar 5302288c90 Remove old style hacks to register AsmPrinter into TargetMachine.
- No intended functionality change.

llvm-svn: 75843
2009-07-15 22:01:32 +00:00
Daniel Dunbar e833810a5e Reapply TargetRegistry refactoring commits.
--- Reverse-merging r75799 into '.':
 U   test/Analysis/PointerTracking
U    include/llvm/Target/TargetMachineRegistry.h
U    include/llvm/Target/TargetMachine.h
U    include/llvm/Target/TargetRegistry.h
U    include/llvm/Target/TargetSelect.h
U    tools/lto/LTOCodeGenerator.cpp
U    tools/lto/LTOModule.cpp
U    tools/llc/llc.cpp
U    lib/Target/PowerPC/PPCTargetMachine.h
U    lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
U    lib/Target/PowerPC/PPCTargetMachine.cpp
U    lib/Target/PowerPC/PPC.h
U    lib/Target/ARM/ARMTargetMachine.cpp
U    lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
U    lib/Target/ARM/ARMTargetMachine.h
U    lib/Target/ARM/ARM.h
U    lib/Target/XCore/XCoreTargetMachine.cpp
U    lib/Target/XCore/XCoreTargetMachine.h
U    lib/Target/PIC16/PIC16TargetMachine.cpp
U    lib/Target/PIC16/PIC16TargetMachine.h
U    lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
U    lib/Target/Alpha/AlphaTargetMachine.cpp
U    lib/Target/Alpha/AlphaTargetMachine.h
U    lib/Target/X86/X86TargetMachine.h
U    lib/Target/X86/X86.h
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
U    lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h
U    lib/Target/X86/X86TargetMachine.cpp
U    lib/Target/MSP430/MSP430TargetMachine.cpp
U    lib/Target/MSP430/MSP430TargetMachine.h
U    lib/Target/CppBackend/CPPTargetMachine.h
U    lib/Target/CppBackend/CPPBackend.cpp
U    lib/Target/CBackend/CTargetMachine.h
U    lib/Target/CBackend/CBackend.cpp
U    lib/Target/TargetMachine.cpp
U    lib/Target/IA64/IA64TargetMachine.cpp
U    lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
U    lib/Target/IA64/IA64TargetMachine.h
U    lib/Target/IA64/IA64.h
U    lib/Target/MSIL/MSILWriter.cpp
U    lib/Target/CellSPU/SPUTargetMachine.h
U    lib/Target/CellSPU/SPU.h
U    lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
U    lib/Target/CellSPU/SPUTargetMachine.cpp
U    lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
U    lib/Target/Mips/MipsTargetMachine.cpp
U    lib/Target/Mips/MipsTargetMachine.h
U    lib/Target/Mips/Mips.h
U    lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
U    lib/Target/Sparc/SparcTargetMachine.cpp
U    lib/Target/Sparc/SparcTargetMachine.h
U    lib/ExecutionEngine/JIT/TargetSelect.cpp
U    lib/Support/TargetRegistry.cpp

llvm-svn: 75820
2009-07-15 20:24:03 +00:00
Stuart Hastings 338191cd67 Revert 75762, 75763, 75766..75769, 75772..75775, 75778, 75780, 75782 to repair broken LLVM-GCC build.
Will revert 75770 in the llvm-gcc trunk.

llvm-svn: 75799
2009-07-15 17:27:11 +00:00
Daniel Dunbar b22f50e4c4 Register Target's TargetMachine and AsmPrinter in the new registry.
- This abuses TargetMachineRegistry's constructor for now, this will get
   cleaned up in time.

llvm-svn: 75762
2009-07-15 09:22:31 +00:00
Chris Lattner e4a3f6fa3b rename decorateName -> DecorateCygMingName, make it assert if not
cygming, make the two callers only call it if cygming.  Other minor
cleanups.

llvm-svn: 75744
2009-07-15 04:55:56 +00:00
Chris Lattner 52d0fec140 use makeNameProper to add the globalprefix instead of doing it manually.
llvm-svn: 75734
2009-07-15 03:01:23 +00:00
Chris Lattner 1447bd2314 actually $stub labels *are* private, I just missed that
printSuffixedName automatically does this.

llvm-svn: 75727
2009-07-15 01:53:36 +00:00
Chris Lattner 7f318128d0 $stub references should not be private ("L") labels.
llvm-svn: 75721
2009-07-15 01:23:13 +00:00
Daniel Dunbar 2c2c4af05e Fix path name.
llvm-svn: 75697
2009-07-14 22:58:03 +00:00
David Greene a31f96cf2b Have asm printers use formatted_raw_ostream directly to avoid a
dynamic_cast<>.

llvm-svn: 75670
2009-07-14 20:18:05 +00:00
Chris Lattner 8c9a96b966 Reapply my previous asmprinter changes now with more testing and two
additional bug fixes:

1. The bug that everyone hit was a problem in the asmprinter where it
   would remove $stub but keep the L prefix on a name when emitting the
   indirect symbol.  This is easy to fix by keeping the name of the stub
   and the name of the symbol in a StringMap instead of just keeping a
   StringSet and trying to reconstruct it late.

2. There was a problem printing the personality function.  The current
   logic to print out the personality function from the DWARF information
   is a bit of a cesspool right now that duplicates a bunch of other 
   logic in the asm printer.  The short version of it is that it depends
   on emitting both the L and _ prefix for symbols (at least on darwin)
   and until I can untangle it, it is best to switch the mangler back to
   emitting both prefixes.

llvm-svn: 75646
2009-07-14 18:17:16 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Daniel Dunbar 6c5282e3db Revert r75615, which depended on 75610.
--- Reverse-merging r75615 into '.':
U    lib/Target/XCore/XCoreAsmPrinter.cpp
U    lib/Target/PIC16/PIC16AsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
U    lib/Target/MSP430/MSP430AsmPrinter.cpp
U    lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
U    lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
U    lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
U    lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
U    lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
U    lib/Target/MSIL/MSILWriter.cpp
U    lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
U    lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp

llvm-svn: 75637
2009-07-14 16:12:13 +00:00
Daniel Dunbar 966932ccb7 Revert r75610 (and r75620, which was blocking the revert), in the hopes of
unbreaking llvm-gcc (on Darwin).

--- Reverse-merging r75620 into '.':
U    include/llvm/Support/Mangler.h
--- Reverse-merging r75610 into '.':
U    test/CodeGen/X86/loop-hoist.ll
G    include/llvm/Support/Mangler.h
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U    lib/VMCore/Mangler.cpp

llvm-svn: 75636
2009-07-14 15:57:55 +00:00
Torok Edwin 6cdb897258 eliminate extra space.
llvm-svn: 75630
2009-07-14 12:22:58 +00:00
Chris Lattner 027c84d2c8 Rename getValueName -> getMangledName.
llvm-svn: 75615
2009-07-14 06:18:50 +00:00
Chris Lattner 774f2a2d51 Change the X86 asmprinter to use the mangler to apply suffixes like "$non_lazy_ptr"
to symbols instead of doing it with "printSuffixedName".  This gets us to the point
where there is a real separation between computing a symbol name and printing it,
something I need for MC printer stuff.

This patch also fixes a corner case bug where unnamed private globals wouldn't get
the private label prefix.

Next up, rename all uses of getValueName -> getMangledName for better greppability,
and then tackle the ppc/arm backends to eliminate "printSuffixedName".

llvm-svn: 75610
2009-07-14 06:04:35 +00:00
Chris Lattner fc4b5cb7a6 use getValueName instead of makeNameProper.
llvm-svn: 75577
2009-07-14 01:01:12 +00:00
Chris Lattner d8435e9989 don't print redundant @PLT suffixes
llvm-svn: 75554
2009-07-13 23:44:13 +00:00
Chris Lattner a45c9b67cc clean up some syntax.
llvm-svn: 75532
2009-07-13 22:28:21 +00:00
Chris Lattner f8542ba3a9 eliminate a bunch of code in print_pcrel_imm for printing symbols, using
printSymbolOperand instead.

llvm-svn: 75526
2009-07-13 22:07:30 +00:00
Chris Lattner 40091b8cef move a method and add a comment, no functionality change.
llvm-svn: 75520
2009-07-13 21:53:19 +00:00
Chris Lattner a479bf1afa refactor operand printing to remove hte last of the "mem" modifier hack. The
only remaining modifier is "subreg".

llvm-svn: 75516
2009-07-13 21:48:33 +00:00
Chris Lattner bf25a209dc refactor symbol printing so the whole "mem" thing is handled in fewer places.
llvm-svn: 75512
2009-07-13 21:41:08 +00:00
Torok Edwin 69208f0f9e Remove extra \n from LLVM_UNREACHABLE calls.
llvm-svn: 75416
2009-07-12 07:15:17 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Chris Lattner 2745607dc6 remove the "debug" modifier, it is only used by one instruction which can
never be generated.

llvm-svn: 75305
2009-07-10 22:34:11 +00:00
Chris Lattner a6009306c2 make pcrel and non-pcrel global printing more similar.
llvm-svn: 75298
2009-07-10 21:57:21 +00:00
Chris Lattner 21c2940553 remove the now-dead TM argument to these methods.
llvm-svn: 75276
2009-07-10 21:00:45 +00:00
Chris Lattner e2f524f176 add a couple of predicates to test for "stub style pic in PIC mode" and "stub style pic in dynamic-no-pic" mode.
llvm-svn: 75273
2009-07-10 20:47:30 +00:00
Chris Lattner 9531b039b9 make this more like printOperand. Perhaps some merging will happen
tomorrow.

llvm-svn: 75245
2009-07-10 07:50:52 +00:00
Dale Johannesen 546a7bbe8f Handle 'A' modifier in inline asms.
gcc.apple/asm-block-13.c
gcc.apple/asm-block-57.c

llvm-svn: 75169
2009-07-09 20:06:27 +00:00
Chris Lattner 72e3deca47 move reasoning about darwin $non_lazy_ptr stubs from asmprinter into
isel.

llvm-svn: 75117
2009-07-09 06:59:17 +00:00
Chris Lattner 3ffd238f1c reduce nesting by rearranging branches.
llvm-svn: 75110
2009-07-09 05:55:04 +00:00
Chris Lattner e0dae0e716 make isel use MO_PIC_BASE_OFFSET when lowering globalvalues on darwin in pic
mode, instead of having asmprinter just "know" to print them.

llvm-svn: 75109
2009-07-09 05:47:33 +00:00