Commit Graph

1486 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
8c741b8064 Use logarithmic units for basic block alignment.
This was actually a bit of a mess. TLI.setPrefLoopAlignment was clearly
documented as taking log2(bytes) units, but the x86 target would still
set a preferred loop alignment of '16'.

CodePlacementOpt passed this number on to the basic block, and
AsmPrinter interpreted it as bytes.

Now both MachineFunction and MachineBasicBlock use logarithmic
alignments.

Obviously, MachineConstantPool still measures alignments in bytes, so we
can emulate the thrill of using as.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145889 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-06 01:26:19 +00:00
Eric Christopher
309bedd7bc Add inline subprogram names to the name lookup table since they may
not get there any other way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145789 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-04 06:02:38 +00:00
Anton Korobeynikov
0cb2a45cce Emit the ctors in the proper order on ARM/EABI.
Maybe some targets should use this as well.

Patch by Evgeniy Stepanov!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 23:49:37 +00:00
Nick Lewycky
8a8d479214 Move global variables in TargetMachine into new TargetOptions class. As an API
change, now you need a TargetOptions object to create a TargetMachine. Clang
patch to follow.

One small functionality change in PTX. PTX had commented out the machine
verifier parts in their copy of printAndVerify. That now calls the version in
LLVMTargetMachine. Users of PTX who need verification disabled should rely on
not passing the command-line flag to enable it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 22:16:29 +00:00
Daniel Dunbar
d782bae970 build/CMake: Finish removal of add_llvm_library_dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145420 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 19:25:30 +00:00
Devang Patel
ce35d8b5a1 DISubrange supports unsigned lower/upper array bounds, so let's not fake it in the end while emitting DWARF. If a FE needs to encode signed lower/upper array bounds then we need to extend DISubrange or ad DISignedSubrange.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144937 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-17 23:43:15 +00:00
Eric Christopher
8368f74c43 Stabilize the output of the dwarf accelerator tables. Fixes a comparison
failure during bootstrap with it turned on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144731 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 23:37:17 +00:00
Rafael Espindola
6c5b2dcd83 We currently use a callback to handle an IL pass deleting a BB that still
has a reference to it. Unfortunately, that doesn't work for codegen passes
since we don't get notified of MBB's being deleted (the original BB stays).

Use that fact to our advantage and after printing a function, check if
any of the IL BBs corresponds to a symbol that was not printed. This fixes
pr11202.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144674 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 19:08:46 +00:00
Rafael Espindola
d1ac3a47f2 The dwarf standard says that the only differences between a out-of-line
instance and a concrete inlined instance are the use of DW_TAG_subprogram
instead of DW_TAG_inlined_subroutine and the who owns the tree.

We were also omitting DW_AT_inline from the abstract roots. To fix this,
make sure we mark abstract instance roots with DW_AT_inline even when
we have only out-of-line instances referring to them with DW_AT_abstract_origin.

FileCheck is not a very good tool for tests like this, maybe we should add
a -verify mode to llvm-dwarfdump.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144441 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 01:57:54 +00:00
Eric Christopher
d61c34ba30 Initialize variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144360 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 03:16:32 +00:00
Eric Christopher
d117fbb231 If we have a DIE with an AT_specification use that instead of the normal
addr DIE when adding to the dwarf accelerator tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144354 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 01:55:22 +00:00
Rafael Espindola
01b55b4a80 Check in getOrCreateSubprogramDIE if a declaration exists and if so output
it first.

This is a more general fix to pr11300.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144324 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 22:34:29 +00:00
Eric Christopher
8bd36eafca Make types and namespaces take multiple DIEs for the accelerator tables
as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144319 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 21:47:55 +00:00
Eric Christopher
1b3f9198ab Move type handling to make sure we get all created types that aren't
forward decls and have names into the dwarf accelerator types table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144306 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 19:52:58 +00:00
Eric Christopher
0ffe2b4dd6 Rework adding function names to the dwarf accelerator tables, allow
multiple dies per function and support C++ basenames.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144304 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 19:25:34 +00:00
Benjamin Kramer
983c4578b0 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144194 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 18:16:11 +00:00
Benjamin Kramer
0c45f7d1a7 Take advantage of the zero byte in StringMap when emitting dwarf stringpool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144184 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 12:12:04 +00:00
Devang Patel
c6bcf4315c Remove extra ';'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144172 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 06:20:49 +00:00
Eric Christopher
dfa30e1ab2 Remove the pubnames section, no one consumes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144169 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 05:24:07 +00:00
Eric Christopher
74d8a87f40 Also add the linkage name to the name accelerator tables if it exists
and is different than the normal name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144130 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 21:56:23 +00:00
Eric Christopher
67a917d495 Add the base ObjC method name to the names lookup table as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 19:16:01 +00:00
Eric Christopher
30b4d8b83b A few more places where we can avoid multiple size queries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 18:38:40 +00:00
Eric Christopher
ec8ffc29c0 Don't evaluate Data.size() on every iteration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144095 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 18:22:25 +00:00
Eric Christopher
56c2b109f7 Add all completed and named types to the dwarf type accelerator tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 22:11:16 +00:00
Eric Christopher
2dd5e1e64d Move the hash function to using and taking a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144024 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 21:49:35 +00:00
Eric Christopher
e77546c3c3 Simple destructor to delete the hash data we created earlier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 21:49:28 +00:00
Eric Christopher
2ea402541f Use StringRef::startswith to do some string comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143982 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 18:53:23 +00:00
Eric Christopher
c545322c27 Avoid the use of a local temporary for comment twines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143974 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 18:34:47 +00:00
Eric Christopher
7135457eff Allow for the case where the name of the subprogram is "".
Fixes a self-host error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 18:10:17 +00:00
Eric Christopher
76a4e1a068 Remove unnecessary addition to API. Replace with something much simpler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143925 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:38:42 +00:00
Eric Christopher
2c802b7e88 Add new files to cmake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143924 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:37:06 +00:00
Eric Christopher
09ac3d8413 Add the support code to enable the dwarf accelerator tables. Upcoming patches
to fix the types section (all types, not just global types), and testcases.

The code to do the final emission is disabled by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143923 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:24:32 +00:00
Eric Christopher
bcbd3a4637 Add a new dwarf accelerator table prototype with the goal of replacing
the pubnames and pubtypes tables. LLDB can currently use this format
and a full spec is forthcoming and submission for standardization is planned.

A basic summary:

The dwarf accelerator tables are an indirect hash table optimized
for null lookup rather than access to known data. They are output into
an on-disk format that looks like this:

.-------------.
|  HEADER     |
|-------------|
|  BUCKETS    |
|-------------|
|  HASHES     |
|-------------|
|  OFFSETS    |
|-------------|
|  DATA       |
`-------------'

where the header contains a magic number, version, type of hash function,
the number of buckets, total number of hashes, and room for a special
struct of data and the length of that struct.

The buckets contain an index (e.g. 6) into the hashes array. The hashes
section contains all of the 32-bit hash values in contiguous memory, and
the offsets contain the offset into the data area for the particular
hash.

For a lookup example, we could hash a function name and take it modulo the
number of buckets giving us our bucket. From there we take the bucket value
as an index into the hashes table and look at each successive hash as long
as the hash value is still the same modulo result (bucket value) as earlier.
If we have a match we look at that same entry in the offsets table and
grab the offset in the data for our final match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143921 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:18:42 +00:00
Eric Christopher
d8a8752d5b Expose a way to get the beginning of the dwarf string section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143920 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:18:38 +00:00
Eric Christopher
6370118b16 Fix up comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:18:35 +00:00
Eric Christopher
33aa20f737 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143918 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:18:32 +00:00
Benjamin Kramer
c25c908977 Add an option to pad an uleb128 to MCObjectWriter and remove the uleb128 encoding from the DWARF asm printer.
As a side effect we now print dwarf ulebs with .ascii directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 11:52:44 +00:00
Benjamin Kramer
41a964931a Add more PRI.64 macros for MSVC and use them throughout the codebase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143799 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 08:57:40 +00:00
Rafael Espindola
b052728368 Emit declarations before definitions if they are available. This causes DW_AT_specification to
point back in the file in the included testcase. Fixes PR11300.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 19:00:29 +00:00
Daniel Dunbar
a3a2dfd4a2 build: Add initial cut at LLVMBuild.txt files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143634 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 18:53:17 +00:00
Nick Lewycky
6c1a703e54 Don't emit a directory entry for the value in DW_AT_comp_dir, that is always
implied by directory index zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143570 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 20:55:33 +00:00
NAKAMURA Takumi
c3e48c38bf Dwarf: [PR11022] Fix emitting DW_AT_const_value(>i64), to be host-endian-neutral.
Don't assume APInt::getRawData() would hold target-aware endianness nor host-compliant endianness. rawdata[0] holds most lower i64, even on big endian host.

FIXME: Add a testcase for big endian target.

FIXME: Ditto on CompileUnit::addConstantFPValue() ?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143194 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-28 14:12:22 +00:00
Nick Lewycky
6a7efcfc02 Always use the string pool, even when it makes the .o larger. This may help
tools that read the debug info in the .o files by making the DIE sizes more
consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-28 05:29:47 +00:00
Nick Lewycky
390c40d96a Teach our Dwarf emission to use the string pool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 06:44:11 +00:00
Nick Lewycky
746cb670c3 Reflow lines, fix comments for doxygen style, fix whitespace. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143074 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 22:55:33 +00:00
Nick Lewycky
000b9bdd33 Remove dead enum value. There is no DIESectionOffset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142912 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 07:05:26 +00:00
Eric Christopher
fd747b24a3 Remove unused forward decl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142892 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 00:55:35 +00:00
Nick Lewycky
20b2b788b4 Missed a spot!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142436 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 22:40:18 +00:00
Nick Lewycky
024170f859 Fix some typo/formatting issues. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142435 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 22:39:43 +00:00
Nick Lewycky
d5d52132d7 Minor style cleanup, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:27:36 +00:00