platform/upstream/llvm.git
10 years agoImplement a rudimentary form of generic lambdas.
Faisal Vali [Thu, 22 Aug 2013 01:49:11 +0000 (01:49 +0000)]
Implement a rudimentary form of generic lambdas.

Specifically, the following features are not included in this commit:
  - any sort of capturing within generic lambdas
  - nested lambdas
  - conversion operator for captureless lambdas
  - ensuring all visitors are generic lambda aware

As an example of what compiles:

template <class F1, class F2>
struct overload : F1, F2 {
    using F1::operator();
    using F2::operator();
    overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
  };

  auto Recursive = [](auto Self, auto h, auto ... rest) {
    return 1 + Self(Self, rest...);
  };
  auto Base = [](auto Self, auto h) {
      return 1;
  };
  overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
  int num_params =  O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

Some implementation notes:

  - Add a new Declarator context => LambdaExprParameterContext to
    clang::Declarator to allow the use of 'auto' in declaring generic
    lambda parameters

  - Augment AutoType's constructor (similar to how variadic
    template-type-parameters ala TemplateTypeParmDecl are implemented) to
    accept an IsParameterPack to encode a generic lambda parameter pack.

  - Add various helpers to CXXRecordDecl to facilitate identifying
    and querying a closure class

  - LambdaScopeInfo (which maintains the current lambda's Sema state)
    was augmented to house the current depth of the template being
    parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
    so that Sema::ActOnLambdaAutoParameter may use it to create the
    appropriate list of corresponding TemplateTypeParmDecl for each
    auto parameter identified within the generic lambda (also stored
    within the current LambdaScopeInfo).  Additionally,
    a TemplateParameterList data-member was added to hold the invented
    TemplateParameterList AST node which will be much more useful
    once we teach TreeTransform how to transform generic lambdas.

  - SemaLambda.h was added to hold some common lambda utility
    functions (this file is likely to grow ...)

  - Teach Sema::ActOnStartOfFunctionDef to check whether it
    is being called to instantiate a generic lambda's call
    operator, and if so, push an appropriately prepared
    LambdaScopeInfo object on the stack.

  - Teach Sema::ActOnStartOfLambdaDefinition to set the
    return type of a lambda without a trailing return type
    to 'auto' in C++1y mode, and teach the return type
    deduction machinery in SemaStmt.cpp to process either
    C++11 and C++14 lambda's correctly depending on the flag.

  - various tests were added - but much more will be needed.

A greatful thanks to all reviewers including Eli Friedman,
James Dennett and the ever illuminating Richard Smith.  And
yet I am certain that I have allowed unidentified bugs to creep in;
bugs, that I will do my best to slay, once identified!

Thanks!

llvm-svn: 188977

10 years agoRemove llvm-lit from the cmake install target.
Hans Wennborg [Thu, 22 Aug 2013 01:34:09 +0000 (01:34 +0000)]
Remove llvm-lit from the cmake install target.

Since it's an llvm-internal tool, we shouldn't install it.

llvm-svn: 188976

10 years agoAdd a constexpr functionality test for static data member templates.
Larisse Voufo [Thu, 22 Aug 2013 01:05:27 +0000 (01:05 +0000)]
Add a constexpr functionality test for static data member templates.

llvm-svn: 188975

10 years agoRefactor for clarity and simplicity.
Larisse Voufo [Thu, 22 Aug 2013 00:59:14 +0000 (00:59 +0000)]
Refactor for clarity and simplicity.

llvm-svn: 188974

10 years agoRevert the change that was done to test commit access.
Virgile Bello [Thu, 22 Aug 2013 00:56:22 +0000 (00:56 +0000)]
Revert the change that was done to test commit access.

llvm-svn: 188973

10 years agoTest commit access.
Virgile Bello [Thu, 22 Aug 2013 00:54:36 +0000 (00:54 +0000)]
Test commit access.

llvm-svn: 188972

10 years agoFileCheck-ize tests.
Bill Wendling [Thu, 22 Aug 2013 00:51:19 +0000 (00:51 +0000)]
FileCheck-ize tests.

llvm-svn: 188971

10 years agoAdjust for r188968.
Eli Friedman [Thu, 22 Aug 2013 00:48:18 +0000 (00:48 +0000)]
Adjust for r188968.

llvm-svn: 188970

10 years agoImprove support for static data member templates. This revision still has at least...
Larisse Voufo [Thu, 22 Aug 2013 00:28:27 +0000 (00:28 +0000)]
Improve support for static data member templates. This revision still has at least one bug, as it does not respect the variable template specialization hierarchy well.

llvm-svn: 188969

10 years agoSplit isFromMainFile into two functions.
Eli Friedman [Thu, 22 Aug 2013 00:27:10 +0000 (00:27 +0000)]
Split isFromMainFile into two functions.

Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't.  Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).

llvm-svn: 188968

10 years agoARM: R9 is not safe to use for tcGPR.
Jim Grosbach [Thu, 22 Aug 2013 00:14:24 +0000 (00:14 +0000)]
ARM: R9 is not safe to use for tcGPR.

Indirect tail-calls shouldn't use R9 for the branch destination, as
it's not reliably a call-clobbered register.

rdar://14793425

llvm-svn: 188967

10 years agoremove trailing whitespace
Shankar Easwaran [Thu, 22 Aug 2013 00:08:25 +0000 (00:08 +0000)]
remove trailing whitespace

llvm-svn: 188965

10 years agoXFAIL 3 tests on darwin 11-12. The tests have recently been modified, are correct...
Howard Hinnant [Thu, 22 Aug 2013 00:04:22 +0000 (00:04 +0000)]
XFAIL 3 tests on darwin 11-12.  The tests have recently been modified, are correct, and pass with an updated libc++.dylib

llvm-svn: 188964

10 years ago[lld][Darwin] fixing an accidentally removed change
Shankar Easwaran [Wed, 21 Aug 2013 23:31:58 +0000 (23:31 +0000)]
[lld][Darwin] fixing an accidentally removed change

llvm-svn: 188963

10 years agoDebugInfo: Require only the declaration of types only used as parameter and return...
David Blaikie [Wed, 21 Aug 2013 23:23:07 +0000 (23:23 +0000)]
DebugInfo: Require only the declaration of types only used as parameter and return types

llvm-svn: 188962

10 years ago[lld] Fix win7 failure on adding InputGraph functionality
Shankar Easwaran [Wed, 21 Aug 2013 23:13:22 +0000 (23:13 +0000)]
[lld] Fix win7 failure on adding InputGraph functionality

llvm-svn: 188961

10 years ago[tests] Update to use lit's now-integrated XFAIL handling.
Daniel Dunbar [Wed, 21 Aug 2013 23:06:32 +0000 (23:06 +0000)]
[tests] Update to use lit's now-integrated XFAIL handling.

llvm-svn: 188960

10 years agoReduce sizeof(TemplateArgument) from 32 to 24.
Eli Friedman [Wed, 21 Aug 2013 23:05:56 +0000 (23:05 +0000)]
Reduce sizeof(TemplateArgument) from 32 to 24.

No intended functionality change.

llvm-svn: 188959

10 years agoadd InputGraph functionality
Shankar Easwaran [Wed, 21 Aug 2013 22:57:10 +0000 (22:57 +0000)]
add InputGraph functionality

llvm-svn: 188958

10 years agoFixed typo.
Michael Gottesman [Wed, 21 Aug 2013 22:53:54 +0000 (22:53 +0000)]
Fixed typo.

llvm-svn: 188957

10 years agoRemoved trailing whitespace.
Michael Gottesman [Wed, 21 Aug 2013 22:53:29 +0000 (22:53 +0000)]
Removed trailing whitespace.

llvm-svn: 188956

10 years agoFixing build errors from r188952
Andrew Kaylor [Wed, 21 Aug 2013 22:53:15 +0000 (22:53 +0000)]
Fixing build errors from r188952

llvm-svn: 188955

10 years agoIntroducing a temporary work-around for a register mapping problem with 32-bit Linux...
Andrew Kaylor [Wed, 21 Aug 2013 22:46:02 +0000 (22:46 +0000)]
Introducing a temporary work-around for a register mapping problem with 32-bit Linux targets.

llvm-svn: 188954

10 years agoSelectionDAG: Make sure stores are always added to the LegalizedNodes list
Tom Stellard [Wed, 21 Aug 2013 22:42:58 +0000 (22:42 +0000)]
SelectionDAG: Make sure stores are always added to the LegalizedNodes list

When truncated vector stores were being custom lowered in
VectorLegalizer::LegalizeOp(), the old (illegal) and new (legal) node pair
was not being added to LegalizedNodes list.  Instead of the legalized
result being passed to VectorLegalizer::TranslateLegalizeResult(),
the result was being passed back into VectorLegalizer::LegalizeOp(),
which ended up adding a (new, new) pair to the list instead.

This was causing an assertion failure when a custom lowered truncated
vector store was the last instruction a basic block and the VectorLegalizer
was unable to find it in the LegalizedNodes list when updating the
DAG root.

llvm-svn: 188953

10 years agoAdding separate cfa alignment check for Darwin and non-Darwin targets in 32-bit ABI.
Andrew Kaylor [Wed, 21 Aug 2013 22:40:46 +0000 (22:40 +0000)]
Adding separate cfa alignment check for Darwin and non-Darwin targets in 32-bit ABI.

llvm-svn: 188952

10 years ago[lit] Fix a couple lingering Py3 compat issues in ProgressBar.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:47 +0000 (22:26 +0000)]
[lit] Fix a couple lingering Py3 compat issues in ProgressBar.

llvm-svn: 188951

10 years ago[tests] Update fma3 check to work with Py3.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:44 +0000 (22:26 +0000)]
[tests] Update fma3 check to work with Py3.

llvm-svn: 188950

10 years ago[lit] Lift XFAIL handling to core infrastructure.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:42 +0000 (22:26 +0000)]
[lit] Lift XFAIL handling to core infrastructure.

llvm-svn: 188949

10 years ago[lit] Allow formats to return lit.Test.Result instances directly.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:40 +0000 (22:26 +0000)]
[lit] Allow formats to return lit.Test.Result instances directly.

llvm-svn: 188948

10 years ago[lit] Factor out a separate Test.Result() object.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:37 +0000 (22:26 +0000)]
[lit] Factor out a separate Test.Result() object.

llvm-svn: 188947

10 years ago[lit] Simplify --time-tests code.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:34 +0000 (22:26 +0000)]
[lit] Simplify --time-tests code.

llvm-svn: 188946

10 years ago[lit] Extract TestFormat base class, for future use.
Daniel Dunbar [Wed, 21 Aug 2013 22:26:26 +0000 (22:26 +0000)]
[lit] Extract TestFormat base class, for future use.

llvm-svn: 188945

10 years agoTBAA: remove !tbaa from testing cases when they are not needed.
Manman Ren [Wed, 21 Aug 2013 22:20:53 +0000 (22:20 +0000)]
TBAA: remove !tbaa from testing cases when they are not needed.

This will make it easier to turn on struct-path aware TBAA since the metadata
format will change.

llvm-svn: 188944

10 years agoAdding a document to describe the MCJIT execution engine implementation.
Andrew Kaylor [Wed, 21 Aug 2013 22:15:09 +0000 (22:15 +0000)]
Adding a document to describe the MCJIT execution engine implementation.

llvm-svn: 188943

10 years agoR600: Remove unnecessary casts
Tom Stellard [Wed, 21 Aug 2013 22:14:17 +0000 (22:14 +0000)]
R600: Remove unnecessary casts

Spotted by Bill Wendling.

llvm-svn: 188942

10 years agoNo functionality change.
Yunzhong Gao [Wed, 21 Aug 2013 22:11:15 +0000 (22:11 +0000)]
No functionality change.
Replace "(255 & value)" with "(0xFF & value)" to improve clarity.

llvm-svn: 188941

10 years agoUpdated the consumed analysis warnings to use a more standardized diagnostic.
Aaron Ballman [Wed, 21 Aug 2013 22:07:20 +0000 (22:07 +0000)]
Updated the consumed analysis warnings to use a more standardized diagnostic.

Patch thanks to Christian Wailes!

llvm-svn: 188940

10 years agoMove -mfpmath handling to -cc1 and implement it for x86.
Rafael Espindola [Wed, 21 Aug 2013 21:59:03 +0000 (21:59 +0000)]
Move -mfpmath handling to -cc1 and implement it for x86.

The original idea was to implement it all on the driver, but to do that the
driver needs to know the sse level and to do that it has to know the default
features of a cpu.

Benjamin Kramer pointed out that if one day we decide to implement support for
' __attribute__ ((__target__ ("arch=core2")))', then the frontend needs to
keep its knowledge of default features of a cpu.

To avoid duplicating which part of clang handles default cpu features,
it is probably better to handle -mfpmath in the frontend.

For ARM this patch is just a small improvement. Instead of a cpu list, we
check if neon is enabled, which allows us to reject things like

-mcpu=cortex-a9 -mfpu=vfp -mfpmath=neon

For X86, since LLVM doesn't support an independent ssefp feature, we just
make sure the selected -mfpmath matches the sse level.

llvm-svn: 188939

10 years agoAnalysis: Add support for MS specific printf format specifiers
David Majnemer [Wed, 21 Aug 2013 21:54:46 +0000 (21:54 +0000)]
Analysis: Add support for MS specific printf format specifiers

Summary: Adds support for %I, %I32 and %I64.

Reviewers: hans, jordan_rose, rnk, majnemer

Reviewed By: majnemer

CC: cfe-commits, cdavis5x
Differential Revision: http://llvm-reviews.chandlerc.com/D1456

llvm-svn: 188937

10 years agoTeach BaseIndexOffset::match to identify base pointers in loops.
Juergen Ributzka [Wed, 21 Aug 2013 21:53:38 +0000 (21:53 +0000)]
Teach BaseIndexOffset::match to identify base pointers in loops.

The small utility function that pattern matches Base + Index +
Offset patterns for loads and stores fails to recognize the base
pointer for loads/stores from/into an array at offset 0 inside a
loop. As a result DAGCombiner::MergeConsecutiveStores was not able
to merge all stores.

This commit fixes the issue by adding an additional pattern match
and also a test case.

Reviewer: Nadav
llvm-svn: 188936

10 years agoADT/Triple: Helper to determine if we are targeting the Windows CRT
David Majnemer [Wed, 21 Aug 2013 21:53:33 +0000 (21:53 +0000)]
ADT/Triple: Helper to determine if we are targeting the Windows CRT

Summary:
This support will be utilized in things like clang to help check printf
format specifiers that are only valid when using the VSCRT.

Reviewers: rnk, asl, chandlerc

Reviewed By: chandlerc

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1455

llvm-svn: 188935

10 years agoRemoved unnecessary asserts.
Aaron Ballman [Wed, 21 Aug 2013 21:38:46 +0000 (21:38 +0000)]
Removed unnecessary asserts.

Patch thanks to Christian Wailes!

llvm-svn: 188934

10 years agoBasic unit tests for PointerUnion
David Blaikie [Wed, 21 Aug 2013 21:30:23 +0000 (21:30 +0000)]
Basic unit tests for PointerUnion

llvm-svn: 188933

10 years agoReorder headers according to lint.
Bill Wendling [Wed, 21 Aug 2013 21:14:19 +0000 (21:14 +0000)]
Reorder headers according to lint.

llvm-svn: 188932

10 years agoTBAA: add testing case to check typedef can alias.
Manman Ren [Wed, 21 Aug 2013 21:00:10 +0000 (21:00 +0000)]
TBAA: add testing case to check typedef can alias.

llvm-svn: 188931

10 years agoDon't use mangleCXXRTTIName in TBAA for C code.
Manman Ren [Wed, 21 Aug 2013 20:58:45 +0000 (20:58 +0000)]
Don't use mangleCXXRTTIName in TBAA for C code.

With r185721, calling mangleCXXRTTIName on C code will cause crashes.
This commit fixes crashes on C testing cases when turning on struct-path TBAA.

For C code, we simply use the Decl name without the context. This can
cause two different structs having the same name, and may cause inaccurate but
conservative alias results.

llvm-svn: 188930

10 years agoUpdate testing case to use FileCheck instead of grep.
Manman Ren [Wed, 21 Aug 2013 20:53:05 +0000 (20:53 +0000)]
Update testing case to use FileCheck instead of grep.

llvm-svn: 188929

10 years agoRemove use of forbidden 'iostream' header.
Bill Wendling [Wed, 21 Aug 2013 20:36:42 +0000 (20:36 +0000)]
Remove use of forbidden 'iostream' header.

Also obsessively reorder the headers to be in something closer to alphabetical order.

llvm-svn: 188928

10 years agoAdd missing ']'.
Bill Wendling [Wed, 21 Aug 2013 20:12:27 +0000 (20:12 +0000)]
Add missing ']'.

llvm-svn: 188927

10 years agoTeach InstCombine about address spaces
Matt Arsenault [Wed, 21 Aug 2013 19:53:10 +0000 (19:53 +0000)]
Teach InstCombine about address spaces

llvm-svn: 188926

10 years agoMC CFG: Remap enough for data too, analoguous to r188873.
Ahmed Bougacha [Wed, 21 Aug 2013 19:40:28 +0000 (19:40 +0000)]
MC CFG: Remap enough for data too, analoguous to r188873.

llvm-svn: 188925

10 years agoStyle cleanup following David's review for r188876.
Ahmed Bougacha [Wed, 21 Aug 2013 19:40:25 +0000 (19:40 +0000)]
Style cleanup following David's review for r188876.

llvm-svn: 188924

10 years agoAdd testcase for r188873: MCTextAtom boundaries.
Ahmed Bougacha [Wed, 21 Aug 2013 19:40:22 +0000 (19:40 +0000)]
Add testcase for r188873: MCTextAtom boundaries.

Check that they are correctly computed if the last instruction is
larger than 1 byte.

llvm-svn: 188923

10 years agoObjectibeC migrator. Annotate cf_consumed arguments,
Fariborz Jahanian [Wed, 21 Aug 2013 19:37:47 +0000 (19:37 +0000)]
ObjectibeC migrator. Annotate cf_consumed arguments,
as reported by static analyer API with CF_CONSUMED.

llvm-svn: 188922

10 years ago[CMake] Automatically pick up subdirectories in llvm/tools as 'external projects...
Argyrios Kyrtzidis [Wed, 21 Aug 2013 19:13:44 +0000 (19:13 +0000)]
[CMake] Automatically pick up subdirectories in llvm/tools as 'external projects' if they contain a 'CMakeLists.txt' file.

Allow CMake to pick up external projects in llvm/tools without the need to modify the "llvm/tools/CMakeLists.txt" file.
This makes it easier to work with projects that live in other repositories, without needing to specify each one in "llvm/tools/CMakeLists.txt".

llvm-svn: 188921

10 years agoFix the end sourcelocation of the call expression in a member access when
Nick Lewycky [Wed, 21 Aug 2013 19:09:44 +0000 (19:09 +0000)]
Fix the end sourcelocation of the call expression in a member access when
recovering by adding empty parenthesis. Fixes PR16676!

llvm-svn: 188920

10 years agoAdd test for bitcast array ptrs with address spaces
Matt Arsenault [Wed, 21 Aug 2013 19:09:28 +0000 (19:09 +0000)]
Add test for bitcast array ptrs with address spaces

llvm-svn: 188919

10 years agoRevert r188863 which could propose wrong fixits for multibyte character literals.
Nick Lewycky [Wed, 21 Aug 2013 18:57:51 +0000 (18:57 +0000)]
Revert r188863 which could propose wrong fixits for multibyte character literals.

llvm-svn: 188918

10 years agoAdd enforce known alignment test with address space
Matt Arsenault [Wed, 21 Aug 2013 18:54:53 +0000 (18:54 +0000)]
Add enforce known alignment test with address space

llvm-svn: 188917

10 years agoUse attribute helper function
Matt Arsenault [Wed, 21 Aug 2013 18:54:50 +0000 (18:54 +0000)]
Use attribute helper function

llvm-svn: 188916

10 years agoFix typo
Matt Arsenault [Wed, 21 Aug 2013 18:54:47 +0000 (18:54 +0000)]
Fix typo

llvm-svn: 188915

10 years agoObjectiveC migrator: until we have beter understanding of
Fariborz Jahanian [Wed, 21 Aug 2013 18:49:03 +0000 (18:49 +0000)]
ObjectiveC migrator: until we have beter understanding of
setter/getter implementations, migrate them to
nonatomic properties.

llvm-svn: 188914

10 years agoRemove dead code.
Rafael Espindola [Wed, 21 Aug 2013 18:13:43 +0000 (18:13 +0000)]
Remove dead code.

setFeatureEnabled is never called with "32" or "64". The driver never passes it
and mips' getDefaultFeatures sets the Features map directly.

llvm-svn: 188913

10 years agoClean up some documentation.
Greg Clayton [Wed, 21 Aug 2013 18:13:29 +0000 (18:13 +0000)]
Clean up some documentation.

llvm-svn: 188912

10 years agoA minor change for an obvous problem caused by r188451:
Hao Liu [Wed, 21 Aug 2013 17:47:53 +0000 (17:47 +0000)]
A minor change for an obvous problem caused by r188451:
        def imm0_63 : Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 63;}]>{
As it seems Imm <63 should be Imm <= 63. ImmLeaf is used in pattern match, but there is already a function check the shift amount range, so just remove ImmLeaf. Also add a test to check 63.

llvm-svn: 188911

10 years agoMove the logic for selecting the last feature in the command line to the driver.
Rafael Espindola [Wed, 21 Aug 2013 17:34:32 +0000 (17:34 +0000)]
Move the logic for selecting the last feature in the command line to the driver.

This is a partial revert of r188817 now that the driver handles -target-feature
in a single place.

llvm-svn: 188910

10 years ago[CGF] Get rid of passing redundant VTable pointer around in CodeGenFunction::Initiali...
Timur Iskhodzhanov [Wed, 21 Aug 2013 17:33:16 +0000 (17:33 +0000)]
[CGF] Get rid of passing redundant VTable pointer around in CodeGenFunction::InitializeVTablePointer[s]

llvm-svn: 188909

10 years agoAdd -mcpu to two X86 tests.
Joey Gouly [Wed, 21 Aug 2013 17:14:31 +0000 (17:14 +0000)]
Add -mcpu to two X86 tests.

These tests are failing on Haswell CPUs due to different instruction selection.

llvm-svn: 188908

10 years agoRemove redundant file.
Hafiz Abid Qadeer [Wed, 21 Aug 2013 17:14:25 +0000 (17:14 +0000)]
Remove redundant file.

llvm-svn: 188907

10 years agoCentralize the handling of -target-feature.
Rafael Espindola [Wed, 21 Aug 2013 16:39:20 +0000 (16:39 +0000)]
Centralize the handling of -target-feature.

No functionality change other than changing the order of -target-feature
relative to other -cc1 command line arguments.

llvm-svn: 188906

10 years agoTweak gnu-flags.c test for z, where globals have 2-byte alignment by default
Richard Sandiford [Wed, 21 Aug 2013 16:37:37 +0000 (16:37 +0000)]
Tweak gnu-flags.c test for z, where globals have 2-byte alignment by default

llvm-svn: 188905

10 years agoAdd basic YAML MC CFG testcase.
Ahmed Bougacha [Wed, 21 Aug 2013 16:13:25 +0000 (16:13 +0000)]
Add basic YAML MC CFG testcase.

Drive-by llvm-objdump cleanup (don't hardcode ToolName).

llvm-svn: 188904

10 years agoUnix/Process.inc: Revert r72332, "Work around a page size issue on Cygwin."
NAKAMURA Takumi [Wed, 21 Aug 2013 13:47:12 +0000 (13:47 +0000)]
Unix/Process.inc: Revert r72332, "Work around a page size issue on Cygwin."

Offset in mmap(3) should be aligned to gepagesize(), 64k, or mmap(3) would fail.

TODO: Invetigate places where 4096 would be required as pagesize, or 4096 would satisfy.
llvm-svn: 188903

10 years agoDon't disable SSE4A when disabling AVX.
Rafael Espindola [Wed, 21 Aug 2013 13:28:02 +0000 (13:28 +0000)]
Don't disable SSE4A when disabling AVX.

Thanks for Craig Topper for noticing it.

llvm-svn: 188902

10 years agoMake "mov" work for all Thumb2 MOV encodings
Mihai Popa [Wed, 21 Aug 2013 13:14:58 +0000 (13:14 +0000)]
Make "mov" work for all Thumb2 MOV encodings

According to the ARM specification, "mov" is a valid mnemonic for all Thumb2 MOV encodings.
To achieve this, the patch adds one instruction alias with a special range condition to avoid collision with the Thumb1 MOV.

llvm-svn: 188901

10 years agoSema: Use the right type for PredefinedExpr when it's in a lambda.
Benjamin Kramer [Wed, 21 Aug 2013 11:45:27 +0000 (11:45 +0000)]
Sema: Use the right type for PredefinedExpr when it's in a lambda.

1. We now print the return type of lambdas and return type deduced functions
as "auto". Trailing return types with decltype print the underlying type.
2. Use the lambda or block scope for the PredefinedExpr type instead of the
parent function. This fixes PR16946, a strange mismatch between type of the
expression and the actual result.
3. Verify the type in CodeGen.
4. The type for blocks is still wrong. They are numbered and the name is not
known until CodeGen.

llvm-svn: 188900

10 years agoAVX-512: Added SHIFT instructions.
Elena Demikhovsky [Wed, 21 Aug 2013 09:36:02 +0000 (09:36 +0000)]
AVX-512: Added SHIFT instructions.

llvm-svn: 188899

10 years ago[SystemZ] Define remainig *MUL_LOHI patterns
Richard Sandiford [Wed, 21 Aug 2013 09:34:56 +0000 (09:34 +0000)]
[SystemZ] Define remainig *MUL_LOHI patterns

The initial port used MLG(R) for i64 UMUL_LOHI but left the other three
combinations as not-legal-or-custom.  Although 32x32->{32,32}
multiplications exist, they're not as quick as doing a normal 64-bit
multiplication, so it didn't seem like i32 SMUL_LOHI and UMUL_LOHI
would be useful.  There's also no direct instruction for i64 SMUL_LOHI,
so it needs to be implemented in terms of UMUL_LOHI.

However, not defining these patterns means that we don't convert
division by a constant into multiplication, so this patch fills
in the other cases.  The new i64 SMUL_LOHI sequence is simpler
than the one that we used previously for 64x64->128 multiplication,
so int-mul-08.ll now tests the full sequence.

llvm-svn: 188898

10 years agoMCFunction.h: Prune \returns to fix a warning in r188881. [-Wdocumentation]
NAKAMURA Takumi [Wed, 21 Aug 2013 09:34:22 +0000 (09:34 +0000)]
MCFunction.h: Prune \returns to fix a warning in r188881. [-Wdocumentation]

llvm-svn: 188897

10 years ago[mips][msa] Matheus Almeida pointed out a silly mistake in r188893. Fixed it.
Daniel Sanders [Wed, 21 Aug 2013 09:09:52 +0000 (09:09 +0000)]
[mips][msa] Matheus Almeida pointed out a silly mistake in r188893. Fixed it.

I accidentally changed the encoding of the MSA registers to zero instead of 0
to 31. This change restores the encoding the registers had prior to r188893.

This didn't show up in the existing tests because direct-object emission isn't
implemented yet for MSA.

llvm-svn: 188896

10 years ago[SystemZ] Use FI[EDX]BRA for codegen
Richard Sandiford [Wed, 21 Aug 2013 09:04:20 +0000 (09:04 +0000)]
[SystemZ] Use FI[EDX]BRA for codegen

llvm-svn: 188895

10 years ago[SystemZ] Add FI[EDX]BRA
Richard Sandiford [Wed, 21 Aug 2013 08:58:08 +0000 (08:58 +0000)]
[SystemZ] Add FI[EDX]BRA

These are extensions of the existing FI[EDX]BR instructions, but use a spare
bit to suppress inexact conditions.

llvm-svn: 188894

10 years ago[mips][msa] Define registers using foreach
Daniel Sanders [Wed, 21 Aug 2013 08:48:25 +0000 (08:48 +0000)]
[mips][msa] Define registers using foreach

No functional change

llvm-svn: 188893

10 years agoRevert the change that was done to test commit access.
Hafiz Abid Qadeer [Wed, 21 Aug 2013 08:45:54 +0000 (08:45 +0000)]
Revert the change that was done to test commit access.

llvm-svn: 188892

10 years agoclang-format: Indent relative to unary operators.
Daniel Jasper [Wed, 21 Aug 2013 08:39:01 +0000 (08:39 +0000)]
clang-format: Indent relative to unary operators.

Before:
  if (!aaaaaaaaaa(  // break
          aaaaa)) {
  }

After:
  if (!aaaaaaaaaa(  // break
           aaaaa)) {
  }

Also cleaned up formatting using clang-format.

llvm-svn: 188891

10 years agoMC CFG: Add YAML MCModule representation to enable MC CFG testing.
Ahmed Bougacha [Wed, 21 Aug 2013 07:29:02 +0000 (07:29 +0000)]
MC CFG: Add YAML MCModule representation to enable MC CFG testing.

Like yaml ObjectFiles, this will be very useful for testing the MC CFG
implementation (mostly MCObjectDisassembler), by matching the output
with YAML, and for potential users of the MC CFG, by using it as an input.

There isn't much to the actual format, it is just a serialization of the
MCModule class. Of note:
  - Basic block references (pred/succ, ..) are represented by the BB's
    start address.
  - Just as in the MC CFG, instructions are MCInsts with a size.
  - Operands have a prefix representing the type (only register and
    immediate supported here).
  - Instruction opcodes are represented by their names; enum values aren't
    stable, enum names mostly are: usually, a change to a name would need
    lots of changes in the backend anyway.
    Same with registers.

All in all, an example is better than 1000 words, here goes:

A simple binary:

  Disassembly of section __TEXT,__text:
  _main:
  100000f9c:      48 8b 46 08             movq    8(%rsi), %rax
  100000fa0:      0f be 00                movsbl  (%rax), %eax
  100000fa3:      3b 04 25 48 00 00 00    cmpl    72, %eax
  100000faa:      0f 8c 07 00 00 00       jl      7 <.Lend>
  100000fb0:      2b 04 25 48 00 00 00    subl    72, %eax
  .Lend:
  100000fb7:      c3                      ret

And the (pretty verbose) generated YAML:

  ---
  Atoms:
    - StartAddress:    0x0000000100000F9C
      Size:            20
      Type:            Text
      Content:
        - Inst:            MOV64rm
          Size:            4
          Ops:             [ RRAX, RRSI, I1, R, I8, R ]
        - Inst:            MOVSX32rm8
          Size:            3
          Ops:             [ REAX, RRAX, I1, R, I0, R ]
        - Inst:            CMP32rm
          Size:            7
          Ops:             [ REAX, R, I1, R, I72, R ]
        - Inst:            JL_4
          Size:            6
          Ops:             [ I7 ]
    - StartAddress:    0x0000000100000FB0
      Size:            7
      Type:            Text
      Content:
        - Inst:            SUB32rm
          Size:            7
          Ops:             [ REAX, REAX, R, I1, R, I72, R ]
    - StartAddress:    0x0000000100000FB7
      Size:            1
      Type:            Text
      Content:
        - Inst:            RET
          Size:            1
          Ops:             [  ]
  Functions:
    - Name:            __text
      BasicBlocks:
        - Address:         0x0000000100000F9C
          Preds:           [  ]
          Succs:           [ 0x0000000100000FB7, 0x0000000100000FB0 ]
     <snip>
  ...

llvm-svn: 188890

10 years agoMC CFG: Support disassembly at arbitrary addresses in MCObjectDisassembler.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:55 +0000 (07:28 +0000)]
MC CFG: Support disassembly at arbitrary addresses in MCObjectDisassembler.

llvm-svn: 188889

10 years agoMC CFG: Use data structures more appropriate than std::set.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:51 +0000 (07:28 +0000)]
MC CFG: Use data structures more appropriate than std::set.

llvm-svn: 188888

10 years agoMC CFG: Add an MCObjectSymbolizer in the MCObjectDisassembler.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:48 +0000 (07:28 +0000)]
MC CFG: Add an MCObjectSymbolizer in the MCObjectDisassembler.

Used to detect calls to function symbol stubs (future commit).

llvm-svn: 188887

10 years agoMC CFG: Add MCObjectDisassembler Mach-O implementation.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:44 +0000 (07:28 +0000)]
MC CFG: Add MCObjectDisassembler Mach-O implementation.

Supports:
- entrypoint, using LC_MAIN.
- static ctors/dtors, using __mod_{init,exit}_func
- translation between effective and object load address, using
  dyld's VM address slide.

llvm-svn: 188886

10 years agoAdd Mach-O entry_point_command declaration.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:40 +0000 (07:28 +0000)]
Add Mach-O entry_point_command declaration.

llvm-svn: 188885

10 years agoMC CFG: Add "dynamic disassembly" support to MCObjectDisassembler.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:37 +0000 (07:28 +0000)]
MC CFG: Add "dynamic disassembly" support to MCObjectDisassembler.

It can now disassemble code in situations where the effective load
address is different than the load address declared in the object file.
This happens for PIC, hence "dynamic".

llvm-svn: 188884

10 years agoMC CFG: When disassembly is impossible, fallback to data bytes.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:32 +0000 (07:28 +0000)]
MC CFG: When disassembly is impossible, fallback to data bytes.

This is the behavior of sequential disassemblers (llvm-objdump, ...),
when there is no instruction size hint (fixed-length, ...)

While there, also do some minor cleanup.

llvm-svn: 188883

10 years agoMC CFG: Add MCObjectDisassembler support for entrypoint + static ctors.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:29 +0000 (07:28 +0000)]
MC CFG: Add MCObjectDisassembler support for entrypoint + static ctors.

For now, this isn't implemented for any format.

llvm-svn: 188882

10 years agoMC CFG: Split MCBasicBlocks to mirror atom splitting.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:24 +0000 (07:28 +0000)]
MC CFG: Split MCBasicBlocks to mirror atom splitting.

When an MCTextAtom is split, all MCBasicBlocks backed by it are
automatically split, with a fallthrough between both blocks, and
the successors moved to the second block.

llvm-svn: 188881

10 years agoMC CFG: Add a few needed methods, mainly MCModule::findFirstAtomAfter.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:17 +0000 (07:28 +0000)]
MC CFG: Add a few needed methods, mainly MCModule::findFirstAtomAfter.

While there, do some minor cleanup.

llvm-svn: 188880

10 years agoMC: ObjectSymbolizer can now recognize external function stubs.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:13 +0000 (07:28 +0000)]
MC: ObjectSymbolizer can now recognize external function stubs.

Only implemented in the Mach-O ObjectSymbolizer.
The testcase sadly introduces a new binary.

llvm-svn: 188879

10 years agoMC: Refactor ObjectSymbolizer to make relocation/section info generation lazy.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:07 +0000 (07:28 +0000)]
MC: Refactor ObjectSymbolizer to make relocation/section info generation lazy.

llvm-svn: 188878

10 years agoMC CFG: Add entrypoint address to MCModule.
Ahmed Bougacha [Wed, 21 Aug 2013 07:28:02 +0000 (07:28 +0000)]
MC CFG: Add entrypoint address to MCModule.

llvm-svn: 188877

10 years agoMC CFG: Add more MCFunction container methods (find, empty).
Ahmed Bougacha [Wed, 21 Aug 2013 07:27:59 +0000 (07:27 +0000)]
MC CFG: Add more MCFunction container methods (find, empty).

llvm-svn: 188876