Commit Graph

104960 Commits

Author SHA1 Message Date
Rafael Espindola b7c2286055 Revert the previous patch while I figure out how to make llvm-gcc
less agressive about disabling cfi on linux :-(

llvm-svn: 130626
2011-04-30 23:03:44 +00:00
Jakob Stoklund Olesen 2348cdd67f X86AsmPrinter doesn't know how to handle the X86II::MO_GOT_ABSOLUTE_ADDRESS flag
after folding ADD32ri to ADD32mi, so don't do that.

This only happens when the greedy register allocator gets itself in trouble and
spills %vreg9 here:

16L             %vreg9<def> = MOVPC32r 0, %ESP<imp-use>; GR32:%vreg9
48L             %vreg9<def> = ADD32ri %vreg9, <es:_GLOBAL_OFFSET_TABLE_>[TF=1], %EFLAGS<imp-def,dead>; GR32:%vreg9

That should never happen, the live range should be split instead.

llvm-svn: 130625
2011-04-30 23:00:05 +00:00
Rafael Espindola 1f6936b6c7 Update for cfi.
llvm-svn: 130624
2011-04-30 22:30:24 +00:00
Rafael Espindola 5265bc483e Enable CFI on OS X.
Currently the output should be almost identical to the one produced by CodeGen
to make the transition easier.

The only two differences I know of are:

* Some files get an extra advance loc of size 0. This will be fixed when
relaxations are enabled.
* The optimization of declaring an EH symbol as an external variable is not
implemented. This is a subset of adding the nounwind attribute, so we if really
this at -O0 we should probably do it at the IL level.

llvm-svn: 130623
2011-04-30 22:29:54 +00:00
Benjamin Kramer ed5ca78dc5 Remove unused function.
llvm-svn: 130622
2011-04-30 19:55:59 +00:00
Benjamin Kramer e63dbc373a Remove noisy semicolons.
llvm-svn: 130621
2011-04-30 19:55:55 +00:00
Eli Friedman 786d087ebd PR9792: Make sure to use the right definition of wchar_t when the default
wchar_t is an unsigned type.

llvm-svn: 130620
2011-04-30 19:24:24 +00:00
Jakob Stoklund Olesen 38a0b94dce When a physreg is live-in and live through a basic block, make sure its live
range covers the entire block.

The live range can't be terminated at a random instruction.

llvm-svn: 130619
2011-04-30 19:12:33 +00:00
Eli Friedman fe0739dffb Some small improvements to the builtin (-ffreestanding) stdint.h; in
particular, make sure to handle WCHAR_MIN correctly.

llvm-svn: 130618
2011-04-30 19:02:59 +00:00
Rafael Espindola 6a10ed51c0 Pass -fno-dwarf2-cfi-asm and use FileCheck.
llvm-svn: 130617
2011-04-30 18:47:32 +00:00
Rafael Espindola e264187cf2 Implement -fno-dwarf2-cfi-asm.
llvm-svn: 130616
2011-04-30 18:35:43 +00:00
Benjamin Kramer 9aa91b1f4e InstCombine: Turn (zext A) udiv (zext B) into (zext (A udiv B)). Same for urem or constant B.
This obviously helps a lot if the division would be turned into a libcall
(think i64 udiv on i386), but div is also one of the few remaining instructions
on modern CPUs that become more expensive when the bitwidth gets bigger.

This also helps register pressure on i386 when dividing chars, divb needs
two 8-bit parts of a 16 bit register as input where divl uses two registers.

int foo(unsigned char a) { return a/10; }
int bar(unsigned char a, unsigned char b) { return a/b; }

compiles into (x86_64)
_foo:
  imull $205, %edi, %eax
  shrl  $11, %eax
  ret
_bar:
  movzbl        %dil, %eax
  divb  %sil, %al
  movzbl        %al, %eax
  ret

llvm-svn: 130615
2011-04-30 18:16:07 +00:00
Benjamin Kramer 57b3df59b9 Use SimplifyDemandedBits on div instructions.
This folds away silly stuff like (a&255)/1000 -> 0.

llvm-svn: 130614
2011-04-30 18:16:00 +00:00
Benjamin Kramer 6a50bbd284 FileCheckize.
llvm-svn: 130613
2011-04-30 18:15:53 +00:00
Douglas Gregor 85894a8f85 When comparing parameters of reference-to-qualified type during
partial ordering of function templates, use a simple superset
relationship rather than the convertibility-implying
isMoreQualifiedThan/compatibilyIncludes relationship. Fixes partial
ordering between references and address-space-qualified references.

llvm-svn: 130612
2011-04-30 17:07:52 +00:00
Rafael Espindola bde52bca69 Implement MCAsmStreamer::EmitEHSymAttributes. Doing this in the asm streamer
is a bit ugly, but doing it on the base MCStreamer would be redundant
with the object streamer which does it using SD.

llvm-svn: 130611
2011-04-30 16:34:57 +00:00
Rafael Espindola 0b474c2d15 Handle PrivateExtern eh symbols.
llvm-svn: 130609
2011-04-30 16:22:46 +00:00
Ken Dyck d9c83e6cdf Replace a literal 8 with Context->getCharWidth() in
SynthesizeByrefCopyDestroyHelper(). No change in functionality intended.

llvm-svn: 130608
2011-04-30 16:08:27 +00:00
Chandler Carruth 61f4cbf38a Make type-traits reflect that Clang's vectors act like scalar types.
llvm-svn: 130606
2011-04-30 10:46:26 +00:00
Chandler Carruth 7623757cd0 Switch the type-trait like APIs on the AST to only check for incomplete
types after looking through arrays. Arrays with an unknown bound seem to
be specifically allowed in the library type traits in C++0x, and GCC's
builtin __is_trivial returns 'true' for the type 'int[]'. Now Clang
agrees with GCC about __is_trivial here.

Also hardens these methods against dependent types by just returning false.

llvm-svn: 130605
2011-04-30 10:31:50 +00:00
Chandler Carruth b077620c02 Extract a function to impose the completeness requirement on unary type
trait arguments. Reflow the logic to use early exit instead of a complex
condition expression. Switch to a switch for acting on different type
traits and add a bunch of the recently implemented type traits here.
This fixes one of the regressions with the new __is_standard_layout
trait to again require a complete type. It also fixes some latent bugs
in other traits that never did impose this despite the standard
requiring it. However, all these bugs were hidden for non-borland
systems where the default is to require a complete type.

It's unclear to me what the best approach here is: providing an explicit
lists for the ones requiring complete types only w/ Borland and using
a default for the rest, or forcing this switch to enumerate the traits
and make it clear which way each one goes.

I'm still working on cleaning up the tests so that they actually catch
this, a much more comprehensive update to the tests will come once I've
worked through the bugs I'm finding via inspection.

llvm-svn: 130604
2011-04-30 10:07:32 +00:00
Chandler Carruth 583edf8843 Rename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
based on Doug's preferences when we discussed this in IRC. This brings
the wording more in line with the standard.

llvm-svn: 130603
2011-04-30 10:07:30 +00:00
Chandler Carruth c1ce4f58e6 Hoist all of the type-specific trait logic for __is_standard_layout into
a Type method isStandardLayoutType, to keep our user API matching the
type trait builtins as closely as possible. Also, implement it in terms
of other Type APIs rather than in terms of other type traits. This
models the implementation on that of isLiteralType and isTrivialType.
There remain some common problems with these traits still, so this is
a bit of a WIP. However, we can now fix all of these traits at the same
time and in a consistent manner.

llvm-svn: 130602
2011-04-30 09:17:49 +00:00
Chandler Carruth b196374f53 Completely re-implement the core logic behind the __is_standard_layout
type trait. The previous implementation suffered from several problems:

1) It implemented all of the logic in RecordType by walking over every
   base and field in a CXXRecordDecl and validating the constraints of
   the standard. This made for very straightforward code, but is
   extremely inefficient. It also is conceptually wrong, the logic tied
   to the C++ definition of standard-layout classes should be in
   CXXRecordDecl, not RecordType.
2) To address the performance problems with #1, a cache bit was added to
   CXXRecordDecl, and at the completion of every C++ class, the
   RecordType was queried to determine if it was a standard layout
   class, and that state was cached. Two things went very very wrong
   with this. First, the caching version of the query *was never
   called*. Even within the recursive steps of the walk over all fields
   and bases the caching variant was not called, making each query
   a full *recursive* walk. Second, despite the cache not being used, it
   was computed for every class declared, even when the trait was never
   used in the program. This probably significantly regressed compile
   time performance for edge-case files.
3) An ASTContext was required merely to query the type trait because
   querying it performed the actual computations.
4) The caching bit wasn't managed correctly (uninitialized).

The new implementation follows the system for all the other traits on
C++ classes by encoding all the state needed in the definition data and
building up the trait incrementally as each base and member are added to
the definition of the class.

The idiosyncracies of the specification of standard-layout classes
requires more state than I would like; currently 5 bits. I could
eliminate one of the bits easily at the expense of both clarity and
resilience of the code. I might be able to eliminate one of the other
bits by computing its state in terms of other state bits in the
definition. I've already done that in one place where there was a fairly
simple way to achieve it.

It's possible some of the bits could be moved out of the definition data
and into some other structure which isn't serialized if the serialized
bloat is a problem. That would preclude serialization of a partial class
declaration, but that's likely already precluded.

Comments on any of these issues welcome.

llvm-svn: 130601
2011-04-30 09:17:45 +00:00
Benjamin Kramer 08635fcc83 Initialize HasStandardLayout.
llvm-svn: 130600
2011-04-30 08:55:35 +00:00
Jakob Stoklund Olesen f5eaa8dc62 Allow folded spills in test.
llvm-svn: 130599
2011-04-30 08:00:50 +00:00
Ted Kremenek 8067746554 Move the SelfInit checker to the 'cocoa.experimental' package.
llvm-svn: 130598
2011-04-30 06:46:45 +00:00
Jakob Stoklund Olesen ec9b4a6b8b Avoid using stale entries form the sibling value map.
This could happen when trying to use a value that had been eliminated after dead
code elimination and folding loads.

llvm-svn: 130597
2011-04-30 06:42:21 +00:00
Jakob Stoklund Olesen 357dd36136 Use hysteresis for local live range splitting as well.
llvm-svn: 130596
2011-04-30 05:07:46 +00:00
Daniel Dunbar 2f31fb99ef Driver/Darwin: Don't link -lgcc_s.1 when compiling as iOS for the simulator,
that library has never been in the SDK. Fortunately, it shouldn't be necessary,
since that library was also removed in 10.6.

llvm-svn: 130595
2011-04-30 04:25:16 +00:00
Daniel Dunbar 72ceb92aa3 Driver/Darwin: When using -mios-simulator-version-min, explicitly pass this on
to the linker.
 - Only do this explicitly with the argument for now, the linker will need to
   explicitly add support for this.

llvm-svn: 130594
2011-04-30 04:22:58 +00:00
Daniel Dunbar a9cbb6b9d5 Driver/Darwin: Reject invalid arch combinations with
-mios-simulator-version-min.

llvm-svn: 130593
2011-04-30 04:20:40 +00:00
Daniel Dunbar b1189434dd Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it.

llvm-svn: 130592
2011-04-30 04:18:16 +00:00
Daniel Dunbar 9aaeb6400b Driver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
and associated deployment target environment variable.

llvm-svn: 130591
2011-04-30 04:15:58 +00:00
NAKAMURA Takumi 7f7bf595dd runtime/libprofile/PathProfiling.c: Don't use // comment in C source.
llvm-svn: 130589
2011-04-30 03:53:56 +00:00
Rafael Espindola 26cdfa71ef Update API.
llvm-svn: 130588
2011-04-30 03:46:18 +00:00
Rafael Espindola a3181d12c6 Add all the plumbing needed for MC to expand cfi to the old tables in
the final assembly. It is the same technique used when targeting
assemblers that don't support .loc.

llvm-svn: 130587
2011-04-30 03:44:37 +00:00
Hongbin Zheng 27f3afbc1a ScopInfo: Rememeber the induction variable and its parent loop at the same thime.
llvm-svn: 130586
2011-04-30 03:26:51 +00:00
Rafael Espindola 1d1eced025 Implement MCAsmStreamer::EmitDwarfAdvanceFrameAddr.
llvm-svn: 130585
2011-04-30 03:21:04 +00:00
Nico Weber 1f41ab05f5 Fix gcc 'warning: multi-line comment'.
llvm-svn: 130583
2011-04-30 03:13:21 +00:00
Jakob Stoklund Olesen d50e5eb8c3 Update comment.
llvm-svn: 130582
2011-04-30 03:13:08 +00:00
Nico Weber e8fdcac02c Add lib/Tooling to the Makefile build.
llvm-svn: 130581
2011-04-30 03:09:18 +00:00
Nico Weber 1bb8e09c37 Add a Makefile to examples/Tooling for people who do not use cmake.
llvm-svn: 130577
2011-04-30 03:03:12 +00:00
Nico Weber 347339f790 Fix Makefile build of examples/clang-interpreter.
llvm-svn: 130576
2011-04-30 02:52:27 +00:00
Hongbin Zheng ad6915685e JSON: Do not use throw when exception is disabled.
llvm-svn: 130575
2011-04-30 02:47:34 +00:00
Hongbin Zheng 986fee0055 JSON: Disable exception in JSON library, because exception is disable by by default.
llvm-svn: 130574
2011-04-30 02:30:58 +00:00
Argyrios Kyrtzidis c8c7945a40 Add a couple of assertions to make sure the bitfields can fit the value assigned to them. No functionality change.
llvm-svn: 130573
2011-04-30 02:28:27 +00:00
Chad Rosier b9a8525bab Documentation for -Oz; Updated synopsis and item.
llvm-svn: 130570
2011-04-30 02:04:10 +00:00
Chad Rosier bc8d7c27d9 Add documentation for -Oz flag.
llvm-svn: 130569
2011-04-30 01:40:58 +00:00
Jakob Stoklund Olesen 6e399a6ecb Use a greedy algorithm for allocating registers.
llvm-svn: 130568
2011-04-30 01:37:54 +00:00