Commit Graph

79 Commits

Author SHA1 Message Date
Daniel Dunbar eb3e4271e8 Revert r7561{9,8,7,6}, which depend on r75610.
--- Reverse-merging r75619 into '.':
U    lib/Target/DarwinTargetAsmInfo.cpp
U    lib/CodeGen/AsmPrinter/AsmPrinter.cpp
--- Reverse-merging r75618 into '.':
U    lib/CodeGen/ELFWriter.cpp
U    lib/CodeGen/MachOCodeEmitter.cpp
U    lib/CodeGen/MachOWriter.cpp
--- Reverse-merging r75617 into '.':
U    lib/Target/CBackend/CBackend.cpp
--- Reverse-merging r75616 into '.':
U    tools/bugpoint/Miscompilation.cpp
U    tools/lto/LTOCodeGenerator.cpp
U    tools/lto/LTOModule.cpp

llvm-svn: 75638
2009-07-14 16:25:11 +00:00
Chris Lattner 688920e511 Rename getValueName -> getMangledName
llvm-svn: 75618
2009-07-14 06:20:20 +00:00
Bruno Cardoso Lopes ffb38f8d35 Cleanup the global emission and refactor some code
llvm-svn: 75537
2009-07-13 22:40:39 +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
Bruno Cardoso Lopes f539f03289 Changed ELFCodeEmitter to inherit from ObjectCodeEmitter
llvm-svn: 74821
2009-07-06 09:26:48 +00:00
Bruno Cardoso Lopes 5661ea68e7 Add the Object Code Emitter class. Original patch by Aaron Gray, I did some
cleanup, removed some #includes and moved Object Code Emitter out-of-line.

llvm-svn: 74813
2009-07-06 05:09:34 +00:00
Bruno Cardoso Lopes 95dd8657ca Factor some code out and support for Jump Table relocations
llvm-svn: 74760
2009-07-03 04:36:26 +00:00
Bruno Cardoso Lopes 6dca2847d9 shrinking down #includes
llvm-svn: 74718
2009-07-02 18:29:24 +00:00
Bruno Cardoso Lopes e364a233c0 Support Constant Pool Sections
Add section symbols to the symbol table

llvm-svn: 74170
2009-06-25 07:36:24 +00:00
Bruno Cardoso Lopes 02a9191b71 Use a default alignment for data and bss sections.
Only pad when the section size > 0 and move the code that deals
with globals initializers to a place we know for sure the global
is initialized.

llvm-svn: 73944
2009-06-23 04:39:27 +00:00
Bruno Cardoso Lopes bd9c94d7af Use different functions to emit the string and symbol tables.
llvm-svn: 73895
2009-06-22 19:29:56 +00:00
Bruno Cardoso Lopes a040566fec Add more methods to gather target specific elf stuff
Support for .text relocations, implementing TargetELFWriter overloaded methods for x86/x86_64.
Use a map to track global values to their symbol table indexes
Code cleanup and small fixes

llvm-svn: 73894
2009-06-22 19:16:16 +00:00
Bruno Cardoso Lopes 2f55027012 Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject.h by Aaron Gray
llvm-svn: 73333
2009-06-14 07:53:21 +00:00
Bruno Cardoso Lopes 1656366e4d Support for ELF Visibility
Emission for globals, using the correct data sections
Function alignment can be computed for each target using TargetELFWriterInfo
Some small fixes

llvm-svn: 73201
2009-06-11 19:16:03 +00:00
Bruno Cardoso Lopes f6d9fd20c2 Delete comment and fix typo
llvm-svn: 73040
2009-06-07 21:49:11 +00:00
Bruno Cardoso Lopes e577492a17 Simple ELF32/64 binary files can now be emitted for x86 and x86_64 without
relocation sections.

llvm-svn: 73038
2009-06-07 21:22:38 +00:00
Bruno Cardoso Lopes 1596c3d9b2 Remove elf specific info from ELFWriter.h to Elf.h. Code cleanup and more comments added
llvm-svn: 72982
2009-06-06 03:56:29 +00:00
Bruno Cardoso Lopes d51db005d0 Move ELFCodeEmiter stuff to new files
llvm-svn: 72785
2009-06-03 17:47:27 +00:00
Duncan Sands af9eaa830a Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.

llvm-svn: 71349
2009-05-09 07:06:46 +00:00
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
Nate Begeman 18d85e7403 Add support to the JIT for true non-lazy operation. When a call to a function
that has not been JIT'd yet, the callee is put on a list of pending functions
to JIT.  The call is directed through a stub, which is updated with the address
of the function after it has been JIT'd.  A new interface for allocating and
updating empty stubs is provided.

Add support for removing the ModuleProvider the JIT was created with, which
would otherwise invalidate the JIT's PassManager, which is initialized with the
ModuleProvider's Module.

Add support under a new ExecutionEngine flag for emitting the infomration 
necessary to update Function and GlobalVariable stubs after JITing them, by
recording the address of the stub and the name of the GlobalValue.  This allows
code to be copied from one address space to another, where libraries may live
at different virtual addresses, and have the stubs updated with their new
correct target addresses.

llvm-svn: 64906
2009-02-18 08:31:02 +00:00
Rafael Espindola 6de96a1b5d Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Duncan Sands dc020f9c3c Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Chris Lattner 8f561c9c97 elf writer really wants the size of the global, not the size
of the pointer to the global.

llvm-svn: 61630
2009-01-04 20:19:20 +00:00
Bill Wendling ac79602005 The llvm::ELFWriter::EmitGlobal() method is calling the
llvm::PATypeHolder::get() method when LLVM is self-hosted in Release
mode. Before the parser changed, there was a definition of llvm::PAHolder::get()
in llvmAsmParser.y. This was probably a bug that no-one noticed.

Explicitly #include the Type.h file as a temporary fix for now.

llvm-svn: 61620
2009-01-04 01:47:14 +00:00
Evan Cheng 0b77319742 Fix MachineCodeEmitter to use uintptr_t instead of intptr_t. This avoids some overflow issues. Patch by Thomas Jablin.
llvm-svn: 60828
2008-12-10 02:32:19 +00:00
Evan Cheng b31a717527 Rename startFunctionStub to startGVStub since it's also used for GV non-lazy ptr.
llvm-svn: 58897
2008-11-08 08:02:53 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Owen Anderson 9371964f47 Use raw_ostream throughout the AsmPrinter.
llvm-svn: 55092
2008-08-21 00:14:44 +00:00
Dale Johannesen ce4396bc92 Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.

llvm-svn: 51118
2008-05-14 20:12:51 +00:00
Dan Gohman e3a63ba3cd Fix a bug in the ELF writer that caused it to produce malformed
ELF headers. The ELF writer still isn't generally usable though.

llvm-svn: 50652
2008-05-05 16:48:32 +00:00
Nicolas Geoffray a7557dfe71 Correlate stubs with functions in JIT: when emitting a stub, the JIT tells the memory manager which function
the stub will resolve.

llvm-svn: 49814
2008-04-16 20:46:05 +00:00
Dan Gohman 24570836b2 Use PassManagerBase instead of FunctionPassManager for functions
that merely add passes. This allows them to be used with either
FunctionPassManager or PassManager, or even with a custom new
kind of pass manager.

llvm-svn: 48256
2008-03-11 22:29:46 +00:00
Nicolas Geoffray 21ad494f67 Enable exception handling int JIT
llvm-svn: 47079
2008-02-13 18:39:37 +00:00
Duncan Sands 05837edae7 Use getPreferredAlignmentLog or getPreferredAlignment
to get the alignment of global variables, rather than
using hand-made versions.

llvm-svn: 46495
2008-01-29 06:23:44 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Dan Gohman 8a332b235d Add explicit keywords, and fix a minor typo that they uncovered.
llvm-svn: 45034
2007-12-14 15:41:34 +00:00
Duncan Sands 283207a71c Eliminate the remaining uses of getTypeSize. This
should only effect x86 when using long double.  Now
12/16 bytes are output for long double globals (the
exact amount depends on the alignment).  This brings
globals in line with the rest of LLVM: the space
reserved for an object is now always the ABI size.
One tricky point is that only 10 bytes should be
output for long double if it is a field in a packed
struct, which is the reason for the additional
argument to EmitGlobalConstant.

llvm-svn: 43688
2007-11-05 00:04:43 +00:00
Devang Patel 8c78a0bff0 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel e95c6ad802 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel 09f162ca6a Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Chris Lattner 945e437c65 Generalize TargetData strings, to support more interesting forms of data.
Patch by Scott Michel.

llvm-svn: 34266
2007-02-14 05:52:17 +00:00
Bill Wendling 3c4d37a531 Add function to create a file writer.
llvm-svn: 34031
2007-02-08 01:35:27 +00:00
Bill Wendling 3814e72ed1 Use TargetELFWriterInfo class.
llvm-svn: 33573
2007-01-27 02:55:44 +00:00
Chris Lattner 50ee0e40e5 Teach TargetData to handle 'preferred' alignment for each target, and use
these alignment amounts to align scalars when we can.  Patch by Scott Michel!

llvm-svn: 33409
2007-01-20 22:35:55 +00:00
Bill Wendling e750f61ac5 Have the OutputBuffer take the is64Bit and isLittleEndian booleans.
llvm-svn: 33316
2007-01-18 01:23:11 +00:00
Bill Wendling cd9c1f035a Changed to use the OutputBuffer instead of the methods in MachO and ELF
writers.

llvm-svn: 33311
2007-01-17 22:22:31 +00:00
Bill Wendling 38ee6519b7 Revert patch.
llvm-svn: 33298
2007-01-17 09:06:13 +00:00
Bill Wendling dcc324b15b Use the methods in the TargetObjInfo object instead of internal methods.
llvm-svn: 33289
2007-01-17 03:49:21 +00:00
Bill Wendling f3baad3ee1 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00