Commit Graph

182 Commits

Author SHA1 Message Date
Chris Lattner 03ad885039 rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.

llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner a98c679de0 Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.

Move a variety of predicates from TargetInstrInfo into 
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around.  Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.

Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.

llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Chris Lattner 81798417dc MachineOperand::getImmedValue -> MachineOperand::getImm
llvm-svn: 45454
2007-12-30 20:50:28 +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
Duncan Sands 030bce7b83 The C++ exception handling personality function wants
to know about calls that cannot throw ('nounwind'):
if such a call does throw for some reason then the
personality will terminate the program.  The distinction
between an ordinary call and a nounwind call is that
an ordinary call gets an entry in the exception table
but a nounwind call does not.  This patch sets up the
exception table appropriately.  One oddity is that
I've chosen to bracket nounwind calls with labels (like
invokes) - the other choice would have been to bracket
ordinary calls with labels.  While bracketing
ordinary calls is more natural (because bracketing
by labels would then correspond exactly to getting an
entry in the exception table), I didn't do it because
introducing labels impedes some optimizations and I'm
guessing that ordinary calls occur more often than
nounwind calls.  This fixes the gcc filter2 eh test,
at least at -O0 (the inliner needs some tweaking at
higher optimization levels).

llvm-svn: 45197
2007-12-19 07:36:31 +00:00
Dale Johannesen 763e110a9f Fix .eh table linkage issues on Darwin. Some EH support
for Darwin PPC, but it's not fully working yet.

llvm-svn: 44258
2007-11-20 23:24:42 +00:00
Dale Johannesen 7a7085f6d3 Add parameter to getDwarfRegNum to permit targets
to use different mappings for EH and debug info;
no functional change yet.
Fix warning in X86CodeEmitter.

llvm-svn: 44056
2007-11-13 19:13:01 +00:00
Dan Gohman 9765cc3bbb Move the code that emits the .file directives so that it runs after the
SourceFiles list is fully filled in so that it sees all of the files.

llvm-svn: 42506
2007-10-01 22:40:20 +00:00
Dan Gohman 25d506c41b Make the checks for DW_FORM_data4 consistent with the others, and
add more such code for DIEDwarfLabel::SizeOf and DIEObjectLabel::SizeOf.

llvm-svn: 42435
2007-09-28 16:50:28 +00:00
Dan Gohman 0d23d63b9e Use 32-bit data directives for DW_FORM_data4 format data, even on
targets with 64-bit addresses.

llvm-svn: 42434
2007-09-28 15:43:33 +00:00
Dan Gohman a1d46c7d0a TargetAsmInfo::getAddressSize() was incorrect for x86-64 and 64-bit targets
other than PPC64. Instead of fixing it, just remove it and fix all the
places that use it to use TargetData::getPointerSize() instead, as there
aren't very many. Most of the references were in DwarfWriter.cpp.

llvm-svn: 42419
2007-09-27 23:12:31 +00:00
Dan Gohman 3165699e4b Don't emit .debug_line header data if there aren't any lines to put in it,
such as will happen when .loc directives are used.

llvm-svn: 42277
2007-09-24 21:43:52 +00:00
Dan Gohman 9b00c07be5 Move the Asm->EOL() call for EmitDebugARanges outside the #ifdef for
consistency with the other currently empty sections.

llvm-svn: 42276
2007-09-24 21:36:21 +00:00
Dan Gohman 0baf84b2e1 Add support for emitting .file directives to set up file numbers for
use with .loc directives.

llvm-svn: 42275
2007-09-24 21:32:18 +00:00
Chris Lattner 7d98b23f1a When emitting .set directives, make sure the EH and Debug labels can't conflict.
llvm-svn: 42257
2007-09-24 03:35:37 +00:00
Chris Lattner 51ce795c92 don't read Block after it is freed. This fixes PR1684
llvm-svn: 42204
2007-09-21 18:25:53 +00:00
Bill Wendling 067f1d8e95 Objective-C was generating EH frame info like this:
"_-[NSString(local) isNullOrNil]".eh = 0
        .no_dead_strip  "_-[NSString(local) isNullOrNil]".eh

The ".eh" should be inside the quotes.

llvm-svn: 42074
2007-09-18 01:47:22 +00:00
Chris Lattner 0625bd6472 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.

llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Bill Wendling 74fb0f1a1c Add a bool to indicate if we should set the "indirect encoding" bit in the Dwarf
information for EH.

llvm-svn: 41852
2007-09-11 17:20:55 +00:00
Bill Wendling 2b8fc31df9 The personality function on Darwin needs a global stub. We then refer to
that global stub instead of doing the ".set" thingy we were doing before.

llvm-svn: 41838
2007-09-11 08:27:17 +00:00
Duncan Sands 2c0a0fb725 Due to label merging, the last label for an invoke
may be the same as the first label for the following
invoke.  Remove a micro-optimization which was wrong
in this case.

llvm-svn: 41720
2007-09-05 14:12:46 +00:00
Duncan Sands 3c1b7fc056 Fix PR1628. When exception handling is turned on,
labels are generated bracketing each call (not just
invokes).  This is used to generate entries in
the exception table required by the C++ personality.
However it gets in the way of tail-merging.  This
patch solves the problem by no longer placing labels
around ordinary calls.  Instead we generate entries
in the exception table that cover every instruction
in the function that wasn't covered by an invoke
range (the range given by the labels around the invoke).
As an optimization, such entries are only generated for
parts of the function that contain a call, since for
the moment those are the only instructions that can
throw an exception [1].  As a happy consequence, we
now get a smaller exception table, since the same
region can cover many calls.  While there, I also
implemented folding of invoke ranges - successive
ranges are merged when safe to do so.  Finally, if
a selector contains only a cleanup, there's a special
shorthand for it - place a 0 in the call-site entry.
I implemented this while there.  As a result, the
exception table output (excluding filters) is now
optimal - it cannot be made smaller [2].  The
problem with throw filters is that folding them
optimally is hard, and the benefit of folding them is
minimal.

[1] I tested that having trapping instructions (eg
divide by zero) in such a region doesn't cause trouble.
[2] It could be made smaller with the help of higher
layers, eg by having branch folding reorder basic blocks
ending in invokes with the same landing pad so they
follow each other.  I don't know if this is worth doing.

llvm-svn: 41718
2007-09-05 11:27:52 +00:00
Anton Korobeynikov 38ce90fd44 Emit proper "secrel" directive, where possible. This fixes invalid asm syntax of debug info on mingw32. Also, cleanup
some stuff.

llvm-svn: 41675
2007-09-02 22:07:21 +00:00
Dan Gohman 032d89828e Add explicit keywords and remove spurious trailing semicolons.
llvm-svn: 41482
2007-08-27 14:50:10 +00:00
Bill Wendling 48597b4ff8 The personality function might need to be declared as:
.set  Lset0,___gxx_personality_v0-.
    .long Lset0

on some targets. Make it so!

llvm-svn: 41385
2007-08-25 00:51:55 +00:00
Reid Spencer 446282ae3d Fix minor doxygen nits.
llvm-svn: 40854
2007-08-05 20:06:04 +00:00
Anton Korobeynikov 64b64ae591 Minor cleanup:
- Split EH and debug infiormation
 - Make DwarfWriter more verbose in some cases

llvm-svn: 40481
2007-07-25 00:06:28 +00:00
Dan Gohman b6a8ae20c7 Fix some uses of dyn_cast to be uses of cast.
llvm-svn: 40443
2007-07-23 20:24:29 +00:00
Duncan Sands 0263dd1d7f The type ids making up a filter are unsigned, and
should be output as unsigned values.  Checked against
gcc.

llvm-svn: 39775
2007-07-12 13:51:39 +00:00
Duncan Sands c5b1984f57 Indexes into the list of filter ids cannot be output
directly: they need to be turned into byte offsets
(often the same, but may not be if there are many
type infos).

llvm-svn: 37942
2007-07-06 12:46:24 +00:00
Duncan Sands dc8fc1550e Use more realistically sized vectors. Reserve capacity if we know in advance
how much will be used.

llvm-svn: 37515
2007-06-08 08:59:11 +00:00
Duncan Sands 29d1dc6f1a Fold the exception actions table harder: if two typeid lists start the
same, only output one copy of the common part.

llvm-svn: 37470
2007-06-06 15:37:31 +00:00
Duncan Sands c063f5f362 Integrate exception filter support and exception catch support. This
simplifies the code in DwarfWriter, allows for multiple filters and
makes it trivial to specify filters accompanied by cleanups or catch-all
specifications (see next patch).  What a deal!  Patch blessed by Anton.

llvm-svn: 37398
2007-06-02 16:53:42 +00:00
Anton Korobeynikov 3b327826db Mark all calls as "could throw", when exceptions are enabled. Emit necessary LP info too. This fixes PR1439
llvm-svn: 37311
2007-05-23 11:08:31 +00:00
Owen Anderson 0ae7eb5e7c Silence a warning.
llvm-svn: 37288
2007-05-22 18:13:40 +00:00
Duncan Sands 34e82a4508 Only emit one entry in the exception action table for each action, even if
it occurs for multiple landing pads.

llvm-svn: 37267
2007-05-21 18:50:28 +00:00
Duncan Sands 59ae77486c Output exception call-sites in address order, as required by the unwinding
runtime.

llvm-svn: 37104
2007-05-16 12:12:23 +00:00
Duncan Sands 750e8c5d4d The index into the actions table is a ULEB128 not a SLEB128.
llvm-svn: 37084
2007-05-15 13:54:14 +00:00
Anton Korobeynikov 1ee0c8d563 Emit function debug frames in one atom. This will prevent us from generating incorrect assembler in case of both
debug information & exception information presented.

llvm-svn: 37019
2007-05-13 17:30:11 +00:00
Anton Korobeynikov bbaf55448b Emit multiple common EH frames for multiple (including blank) personality
functions. This partly fixes PR1414: now we're restricted only to one
personality function per eh frame, not per module. Further work on
"multiple personalities" topic needs representative example.

llvm-svn: 37018
2007-05-13 15:42:26 +00:00
Anton Korobeynikov 13da17843c More DWARF-related things cleanup:
1. Fix PR1380
2. Apply Duncan's patch from PR1410
3. Insert workaround for "one personality function per module" as noted in PR1414
4. Emit correct debug frames for x86/linux. This partly fixes DebugInfo/2006-11-06-StackTrace.cpp: stack trace is
shown correctly, but arguments for function on top of stack are displayed incorrectly.

llvm-svn: 37015
2007-05-12 22:36:25 +00:00
Anton Korobeynikov 67286b1266 Perform correct actions numbers/sizes computation
llvm-svn: 36988
2007-05-11 08:47:35 +00:00
Anton Korobeynikov 00d02442b0 Fix action No calculation in multiple-invoke-one-LP mode
llvm-svn: 36987
2007-05-11 08:23:57 +00:00
Anton Korobeynikov 96142de3f0 Allow multiple invokes per landing pad. This (probably) fixes PR1410.
llvm-svn: 36977
2007-05-10 22:34:59 +00:00
Duncan Sands b43fe52136 Later computations assume we are aligned at this point.
llvm-svn: 36975
2007-05-10 18:40:24 +00:00
Anton Korobeynikov ed5dad4306 TypeIds are indexed by j, not i
llvm-svn: 36974
2007-05-10 15:10:34 +00:00
Duncan Sands 00282a21a5 Use the personality function that was registered with MMI rather than
hardwiring in the C++ one.

llvm-svn: 36789
2007-05-05 20:27:00 +00:00
Duncan Sands 02528f5425 Spelling fix.
llvm-svn: 36781
2007-05-05 16:32:57 +00:00
Anton Korobeynikov 4db0090339 Emit sections/directives in the proper order. This fixes PR1376. Also,
some small cleanup was made.

llvm-svn: 36780
2007-05-05 09:04:50 +00:00
Anton Korobeynikov b538f67b1a Fix couple of bugs connected with eh info:
1. Correct output offsets on Linux
2. Fix "style" of personality function. It shouldn't be indirect.

llvm-svn: 36633
2007-05-01 22:23:12 +00:00