Re: [PATCH] D14982: ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply Add/Subtract.

2015-11-27 Thread Alexandros Lamprineas via cfe-commits
labrinea updated this revision to Diff 41316.
labrinea added a comment.

@t.p.northover you were right, my patch was missing predefined guard macros for 
the instrinsics. I've now updated the patch.


http://reviews.llvm.org/D14982

Files:
  include/clang/Basic/arm_neon.td
  lib/Basic/Targets.cpp
  test/CodeGen/aarch64-v8.1a-neon-intrinsics.c
  test/CodeGen/arm-v8.1a-neon-intrinsics.c
  test/Preprocessor/aarch64-target-features.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -407,4 +407,5 @@
 // CHECK-V81A: __ARM_ARCH 8
 // CHECK-V81A: __ARM_ARCH_8_1A__ 1
 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
+// CHECK-V81A: __ARM_FEATURE_QRDMX 1
 // CHECK-V81A: #define __ARM_FP 0xE
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -71,6 +71,9 @@
 // CHECK-NEON: __ARM_NEON 1
 // CHECK-NEON: __ARM_NEON_FP 0xE
 
+// RUN: %clang -target aarch64-none-eabi -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V81A %s
+// CHECK-V81A: __ARM_FEATURE_QRDMX 1
+
 // RUN: %clang -target aarch64 -march=arm64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
 // RUN: %clang -target aarch64 -march=aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
 // CHECK-ARCH-NOT-ACCEPT: error: the clang compiler does not support
Index: test/CodeGen/arm-v8.1a-neon-intrinsics.c
===
--- /dev/null
+++ test/CodeGen/arm-v8.1a-neon-intrinsics.c
@@ -0,0 +1,121 @@
+// RUN: %clang_cc1 -triple armv8.1a-linux-gnu -target-feature +neon \
+// RUN:  -O3 -S -o - %s \
+// RUN:  | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ARM
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon \
+// RUN:  -target-feature +v8.1a -O3 -S -o - %s \
+// RUN:  | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH64
+
+#include 
+
+// CHECK-LABEL: test_vqrdmlah_s16
+int16x4_t test_vqrdmlah_s16(int16x4_t a, int16x4_t b, int16x4_t c) {
+// CHECK-ARM: vqrdmlah.s16 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.4h, {{v[0-9]+}}.4h, {{v[0-9]+}}.4h
+  return vqrdmlah_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlah_s32
+int32x2_t test_vqrdmlah_s32(int32x2_t a, int32x2_t b, int32x2_t c) {
+// CHECK-ARM: vqrdmlah.s32 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
+  return vqrdmlah_s32(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_s16
+int16x8_t test_vqrdmlahq_s16(int16x8_t a, int16x8_t b, int16x8_t c) {
+// CHECK-ARM: vqrdmlah.s16 q{{[0-9]+}}, q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.8h, {{v[0-9]+}}.8h, {{v[0-9]+}}.8h
+  return vqrdmlahq_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_s32
+int32x4_t test_vqrdmlahq_s32(int32x4_t a, int32x4_t b, int32x4_t c) {
+// CHECK-ARM: vqrdmlah.s32 q{{[0-9]+}}, q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
+  return vqrdmlahq_s32(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlah_lane_s16
+int16x4_t test_vqrdmlah_lane_s16(int16x4_t a, int16x4_t b, int16x4_t c) {
+// CHECK-ARM: vqrdmlah.s16 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}[3]
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.4h, {{v[0-9]+}}.4h, {{v[0-9]+}}.h[3]
+  return vqrdmlah_lane_s16(a, b, c, 3);
+}
+
+// CHECK-LABEL: test_vqrdmlah_lane_s32
+int32x2_t test_vqrdmlah_lane_s32(int32x2_t a, int32x2_t b, int32x2_t c) {
+// CHECK-ARM: vqrdmlah.s32 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}[1]
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[1]
+  return vqrdmlah_lane_s32(a, b, c, 1);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_lane_s16
+int16x8_t test_vqrdmlahq_lane_s16(int16x8_t a, int16x8_t b, int16x4_t c) {
+// CHECK-ARM: vqrdmlah.s16 q{{[0-9]+}}, q{{[0-9]+}}, d{{[0-9]+}}[3]
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.8h, {{v[0-9]+}}.8h, {{v[0-9]+}}.h[3]
+  return vqrdmlahq_lane_s16(a, b, c, 3);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_lane_s32
+int32x4_t test_vqrdmlahq_lane_s32(int32x4_t a, int32x4_t b, int32x2_t c) {
+// CHECK-ARM: vqrdmlah.s32 q{{[0-9]+}}, q{{[0-9]+}}, d{{[0-9]+}}[1]
+// CHECK-AARCH64: sqrdmlah {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[1]
+  return vqrdmlahq_lane_s32(a, b, c, 1);
+}
+
+// CHECK-LABEL: test_vqrdmlsh_s16
+int16x4_t test_vqrdmlsh_s16(int16x4_t a, int16x4_t b, int16x4_t c) {
+// CHECK-ARM: vqrdmlsh.s16 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-AARCH64: sqrdmlsh {{v[0-9]+}}.4h, {{v[0-9]+}}.4h, {{v[0-9]+}}.4h
+  return vqrdmlsh_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlsh_s32
+int32x2_t test_vqrdmlsh_s32(int32x2_t a, int32x2_t b, int32x2_t c) {
+// CHECK-ARM: 

Re: [PATCH] D15029: [OpenMP] Parsing and sema support for thread_limit clause

2015-11-27 Thread Kelvin Li via cfe-commits
kkwli0 closed this revision.
kkwli0 added a comment.

Committed revision 254207.


http://reviews.llvm.org/D15029



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254207 - [OpenMP] Parsing and sema support for thread_limit clause.

2015-11-27 Thread Kelvin Li via cfe-commits
Author: kli
Date: Fri Nov 27 12:47:36 2015
New Revision: 254207

URL: http://llvm.org/viewvc/llvm-project?rev=254207=rev
Log:
[OpenMP] Parsing and sema support for thread_limit clause.

http://reviews.llvm.org/D15029

Added:
cfe/trunk/test/OpenMP/teams_thread_limit_messages.cpp
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/teams_ast_print.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=254207=254206=254207=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Fri Nov 27 12:47:36 2015
@@ -2783,6 +2783,61 @@ public:
   child_range children() { return child_range(,  + 1); }
 };
 
+/// \brief This represents 'thread_limit' clause in the '#pragma omp ...'
+/// directive.
+///
+/// \code
+/// #pragma omp teams thread_limit(n)
+/// \endcode
+/// In this example directive '#pragma omp teams' has clause 'thread_limit'
+/// with single expression 'n'.
+///
+class OMPThreadLimitClause : public OMPClause {
+  friend class OMPClauseReader;
+  /// \brief Location of '('.
+  SourceLocation LParenLoc;
+  /// \brief ThreadLimit number.
+  Stmt *ThreadLimit;
+  /// \brief Set the ThreadLimit number.
+  ///
+  /// \param E ThreadLimit number.
+  ///
+  void setThreadLimit(Expr *E) { ThreadLimit = E; }
+
+public:
+  /// \brief Build 'thread_limit' clause.
+  ///
+  /// \param E Expression associated with this clause.
+  /// \param StartLoc Starting location of the clause.
+  /// \param LParenLoc Location of '('.
+  /// \param EndLoc Ending location of the clause.
+  ///
+  OMPThreadLimitClause(Expr *E, SourceLocation StartLoc,
+   SourceLocation LParenLoc, SourceLocation EndLoc)
+  : OMPClause(OMPC_thread_limit, StartLoc, EndLoc), LParenLoc(LParenLoc),
+ThreadLimit(E) {}
+
+  /// \brief Build an empty clause.
+  ///
+  OMPThreadLimitClause()
+  : OMPClause(OMPC_thread_limit, SourceLocation(), SourceLocation()),
+LParenLoc(SourceLocation()), ThreadLimit(nullptr) {}
+  /// \brief Sets the location of '('.
+  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+  /// \brief Returns the location of '('.
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+  /// \brief Return ThreadLimit number.
+  Expr *getThreadLimit() { return cast(ThreadLimit); }
+  /// \brief Return ThreadLimit number.
+  Expr *getThreadLimit() const { return cast(ThreadLimit); }
+
+  static bool classof(const OMPClause *T) {
+return T->getClauseKind() == OMPC_thread_limit;
+  }
+
+  child_range children() { return child_range(,  + 1); 
}
+};
+
 } // end namespace clang
 
 #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254207=254206=254207=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Nov 27 12:47:36 2015
@@ -2728,6 +2728,13 @@ bool RecursiveASTVisitor::Visit
   return true;
 }
 
+template 
+bool RecursiveASTVisitor::VisitOMPThreadLimitClause(
+OMPThreadLimitClause *C) {
+  TRY_TO(TraverseStmt(C->getThreadLimit()));
+  return true;
+}
+
 // FIXME: look at the following tricky-seeming exprs to see if we
 // need to recurse on anything.  These are ones that have methods
 // returning decls or qualtypes or nestednamespecifier -- though I'm

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=254207=254206=254207=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Nov 27 12:47:36 2015
@@ -151,6 +151,7 @@ OPENMP_CLAUSE(threads, OMPThreadsClause)
 OPENMP_CLAUSE(simd, OMPSIMDClause)
 OPENMP_CLAUSE(map, OMPMapClause)
 OPENMP_CLAUSE(num_teams, OMPNumTeamsClause)
+OPENMP_CLAUSE(thread_limit, OMPThreadLimitClause)
 
 // Clauses allowed for OpenMP directive 'parallel'.
 OPENMP_PARALLEL_CLAUSE(if)
@@ -323,6 +324,7 @@ 

r254204 - Revert r254203: [mips] Interrupt attribute support.

2015-11-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Nov 27 12:00:36 2015
New Revision: 254204

URL: http://llvm.org/viewvc/llvm-project?rev=254204=rev
Log:
Revert r254203: [mips] Interrupt attribute support.

I forgot to credit the author.

Removed:
cfe/trunk/test/CodeGen/mips-interrupt-attr.c
cfe/trunk/test/Sema/mips-interrupt-attr.c
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=254204=254203=254204=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 27 12:00:36 2015
@@ -426,8 +426,8 @@ def Annotate : InheritableParamAttr {
 }
 
 def ARMInterrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, MSP430Interrupt's and
-  // MipsInterrupt's spellings must match.
+  // NOTE: If you add any additional spellings, MSP430Interrupt's spellings
+  // must match.
   let Spellings = [GNU<"interrupt">];
   let Args = [EnumArgument<"Interrupt", "InterruptType",
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
@@ -845,8 +845,8 @@ def MSABI : InheritableAttr {
 }
 
 def MSP430Interrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, ARMInterrupt's and
-  // MipsInterrupt's spellings must match.
+  // NOTE: If you add any additional spellings, ARMInterrupt's spellings must
+  // match.
   let Spellings = [GNU<"interrupt">];
   let Args = [UnsignedArgument<"Number">];
   let ParseKind = "Interrupt";
@@ -860,22 +860,6 @@ def Mips16 : InheritableAttr, TargetSpec
   let Documentation = [Undocumented];
 }
 
-def MipsInterrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, ARMInterrupt's and
-  // MSP430Interrupt's spellings must match.
-  let Spellings = [GNU<"interrupt">];
-  let Subjects = SubjectList<[Function]>;
-  let Args = [EnumArgument<"Interrupt", "InterruptType",
-   ["vector=sw0", "vector=sw1", "vector=hw0",
-"vector=hw1", "vector=hw2", "vector=hw3",
-"vector=hw4", "vector=hw5", "eic", ""],
-   ["sw0", "sw1", "hw0", "hw1", "hw2", "hw3",
-"hw4", "hw5", "eic", "eic"]
-   >];
-  let ParseKind = "Interrupt";
-  let Documentation = [MipsInterruptDocs];
-}
-
 def Mode : Attr {
   let Spellings = [GCC<"mode">];
   let Args = [IdentifierArgument<"Mode">];

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=254204=254203=254204=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Nov 27 12:00:36 2015
@@ -714,46 +714,6 @@ The semantics are as follows:
   }];
 }
 
-def MipsInterruptDocs : Documentation {
-  let Category = DocCatFunction;
-  let Content = [{
-Clang supports the GNU style ``__attribute__((interrupt("ARGUMENT")))`` 
attribute on
-MIPS targets. This attribute may be attached to a function definition and 
instructs
-the backend to generate appropriate function entry/exit code so that it can be 
used
-directly as an interrupt service routine.
-
-By default, the compiler will produce a function prologue and epilogue 
suitable for
-an interrupt service routine that handles an External Interrupt Controller 
(eic)
-generated interrupt. This behaviour can be explicitly requested with the "eic"
-argument.
-
-Otherwise, for use with vectored interrupt mode, the argument passed should be
-of the form "vector=LEVEL" where LEVEL is one of the following values:
-"sw0", "sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5". The compiler will
-then set the interrupt mask to the corresponding level which will mask all
-interrupts up to and including the argument.
-
-The semantics are as follows:
-
-- The prologue is modified so that the Exception Program Counter (EPC) and
-  Status coprocessor registers are saved to the stack. The interrupt mask is
-  set so that the function can only be interrupted by a higher priority
-  interrupt. The epilogue will restore the previous values of EPC and Status.
-
-- The prologue and epilogue are modified to save and restore all non-kernel
-  registers as necessary.
-
-- The FPU is disabled in the prologue, as the floating pointer registers are 
not
-  spilled to the stack.
-
-- The function return sequence is changed to use an exception return 
instruction.
-
-- The parameter sets the interrupt mask for the function corresponding to the
-  

Re: [PATCH] D14982: ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply Add/Subtract.

2015-11-27 Thread Tim Northover via cfe-commits
t.p.northover accepted this revision.
t.p.northover added a reviewer: t.p.northover.
t.p.northover added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM!

Tim.


http://reviews.llvm.org/D14982



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254208 - Fixed default label in fully covered switch warning that was introduced in r254203.

2015-11-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Nov 27 13:49:24 2015
New Revision: 254208

URL: http://llvm.org/viewvc/llvm-project?rev=254208=rev
Log:
Fixed default label in fully covered switch warning that was introduced in 
r254203.

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=254208=254207=254208=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri Nov 27 13:49:24 2015
@@ -5900,7 +5900,6 @@ public:
 
 const char *Kind;
 switch (Attr->getInterrupt()) {
-default: llvm_unreachable("Unknown Mips interrupt attribute type!");
 case MipsInterruptAttr::eic: Kind = "eic"; break;
 case MipsInterruptAttr::sw0: Kind = "sw0"; break;
 case MipsInterruptAttr::sw1: Kind = "sw1"; break;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254206 - int function without a return statement is invalid C++.

2015-11-27 Thread Artyom Skrobov via cfe-commits
Author: askrobov
Date: Fri Nov 27 12:10:49 2015
New Revision: 254206

URL: http://llvm.org/viewvc/llvm-project?rev=254206=rev
Log:
int function without a return statement is invalid C++.

Changing the return type to void.


Modified:
cfe/trunk/test/Tooling/clang-check-analyzer.cpp
cfe/trunk/test/Tooling/clang-check-extra-arg.cpp

Modified: cfe/trunk/test/Tooling/clang-check-analyzer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-analyzer.cpp?rev=254206=254205=254206=diff
==
--- cfe/trunk/test/Tooling/clang-check-analyzer.cpp (original)
+++ cfe/trunk/test/Tooling/clang-check-analyzer.cpp Fri Nov 27 12:10:49 2015
@@ -1,4 +1,4 @@
 // RUN: clang-check -analyze "%s" -- -c 2>&1 | FileCheck %s
 
 // CHECK: Dereference of null pointer
-int a(int *x) { if(x){} *x = 47; }
+void a(int *x) { if(x){} *x = 47; }

Modified: cfe/trunk/test/Tooling/clang-check-extra-arg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-extra-arg.cpp?rev=254206=254205=254206=diff
==
--- cfe/trunk/test/Tooling/clang-check-extra-arg.cpp (original)
+++ cfe/trunk/test/Tooling/clang-check-extra-arg.cpp Fri Nov 27 12:10:49 2015
@@ -2,4 +2,4 @@
 
 // CHECK: unknown warning option '-Wunimplemented-warning-before'
 // CHECK: unknown warning option '-Wunimplemented-warning'
-int a(){}
+void a(){}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254205 - [mips] Interrupt attribute support.

2015-11-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Nov 27 12:03:44 2015
New Revision: 254205

URL: http://llvm.org/viewvc/llvm-project?rev=254205=rev
Log:
[mips] Interrupt attribute support.

Summary: This patch adds support for the interrupt attribute for mips32r2+.

Patch by Simon Dardis.

Reviewers: dsanders, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: http://reviews.llvm.org/D10802

Added:
cfe/trunk/test/CodeGen/mips-interrupt-attr.c
  - copied unchanged from r254203, 
cfe/trunk/test/CodeGen/mips-interrupt-attr.c
cfe/trunk/test/Sema/mips-interrupt-attr.c
  - copied unchanged from r254203, cfe/trunk/test/Sema/mips-interrupt-attr.c
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=254205=254204=254205=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 27 12:03:44 2015
@@ -426,8 +426,8 @@ def Annotate : InheritableParamAttr {
 }
 
 def ARMInterrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, MSP430Interrupt's spellings
-  // must match.
+  // NOTE: If you add any additional spellings, MSP430Interrupt's and
+  // MipsInterrupt's spellings must match.
   let Spellings = [GNU<"interrupt">];
   let Args = [EnumArgument<"Interrupt", "InterruptType",
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
@@ -845,8 +845,8 @@ def MSABI : InheritableAttr {
 }
 
 def MSP430Interrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, ARMInterrupt's spellings must
-  // match.
+  // NOTE: If you add any additional spellings, ARMInterrupt's and
+  // MipsInterrupt's spellings must match.
   let Spellings = [GNU<"interrupt">];
   let Args = [UnsignedArgument<"Number">];
   let ParseKind = "Interrupt";
@@ -860,6 +860,22 @@ def Mips16 : InheritableAttr, TargetSpec
   let Documentation = [Undocumented];
 }
 
+def MipsInterrupt : InheritableAttr, TargetSpecificAttr {
+  // NOTE: If you add any additional spellings, ARMInterrupt's and
+  // MSP430Interrupt's spellings must match.
+  let Spellings = [GNU<"interrupt">];
+  let Subjects = SubjectList<[Function]>;
+  let Args = [EnumArgument<"Interrupt", "InterruptType",
+   ["vector=sw0", "vector=sw1", "vector=hw0",
+"vector=hw1", "vector=hw2", "vector=hw3",
+"vector=hw4", "vector=hw5", "eic", ""],
+   ["sw0", "sw1", "hw0", "hw1", "hw2", "hw3",
+"hw4", "hw5", "eic", "eic"]
+   >];
+  let ParseKind = "Interrupt";
+  let Documentation = [MipsInterruptDocs];
+}
+
 def Mode : Attr {
   let Spellings = [GCC<"mode">];
   let Args = [IdentifierArgument<"Mode">];

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=254205=254204=254205=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Nov 27 12:03:44 2015
@@ -714,6 +714,46 @@ The semantics are as follows:
   }];
 }
 
+def MipsInterruptDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+Clang supports the GNU style ``__attribute__((interrupt("ARGUMENT")))`` 
attribute on
+MIPS targets. This attribute may be attached to a function definition and 
instructs
+the backend to generate appropriate function entry/exit code so that it can be 
used
+directly as an interrupt service routine.
+
+By default, the compiler will produce a function prologue and epilogue 
suitable for
+an interrupt service routine that handles an External Interrupt Controller 
(eic)
+generated interrupt. This behaviour can be explicitly requested with the "eic"
+argument.
+
+Otherwise, for use with vectored interrupt mode, the argument passed should be
+of the form "vector=LEVEL" where LEVEL is one of the following values:
+"sw0", "sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5". The compiler will
+then set the interrupt mask to the corresponding level which will mask all
+interrupts up to and including the argument.
+
+The semantics are as follows:
+
+- The prologue is modified so that the Exception Program Counter (EPC) and
+  Status coprocessor registers are saved to the stack. The interrupt mask is
+  set so that the function can only be interrupted by a higher priority
+  interrupt. The epilogue will restore the previous values of EPC and Status.
+
+- The prologue and epilogue are modified 

Re: [PATCH] D14146: Introduction of -miamcu option

2015-11-27 Thread Andrey Turetskiy via cfe-commits
aturetsk updated this revision to Diff 41309.
aturetsk added a comment.

Extended to take into account recent MCU related changes


http://reviews.llvm.org/D14146

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/miamcu-opt.c
  test/Driver/miamcu-opt.s

Index: test/Driver/miamcu-opt.s
===
--- /dev/null
+++ test/Driver/miamcu-opt.s
@@ -0,0 +1,9 @@
+// RUN: %clang -m32 -miamcu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M32
+// RUN: %clang -m64 -miamcu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M64
+
+// M32-NOT: error: unsupported option '-miamcu'
+// M32: "-cc1as"
+// M32: "-triple" "i586-intel-elfiamcu"
+
+// M64: error: unsupported option '-miamcu'
+// M64: "-cc1as"
Index: test/Driver/miamcu-opt.c
===
--- /dev/null
+++ test/Driver/miamcu-opt.c
@@ -0,0 +1,11 @@
+// RUN: %clang -m32 -miamcu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M32
+// RUN: %clang -m64 -miamcu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M64
+
+// M32-NOT: error: unsupported option '-miamcu'
+// M32: "-cc1"
+// M32: "-triple" "i586-intel-elfiamcu"
+// M32: "-mfloat-abi" "soft"
+// M32: "-mstack-alignment=4"
+
+// M64: error: unsupported option '-miamcu'
+// M64: "-cc1"
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -122,6 +122,8 @@
   : Tool("clang::as", "clang integrated assembler", TC, RF_Full) {}
   void AddMIPSTargetArgs(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ) const;
+  void AddX86TargetArgs(const llvm::opt::ArgList ,
+llvm::opt::ArgStringList ) const;
   bool hasGoodDiagnostics() const override { return true; }
   bool hasIntegratedAssembler() const override { return false; }
   bool hasIntegratedCPP() const override { return false; }
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1994,6 +1994,18 @@
   << A->getOption().getName() << Value;
 }
   }
+
+  // If -miamcu is set then set flags to support MCU ABI and use MCU triple.
+  if (Args.getLastArg(options::OPT_miamcu)) {
+if (getToolChain().getArch() != llvm::Triple::x86)
+  getToolChain().getDriver().Diag(diag::err_drv_unsupported_opt)
+  << "-miamcu";
+CmdArgs.push_back("-triple");
+CmdArgs.push_back("i586-intel-elfiamcu");
+CmdArgs.push_back("-mfloat-abi");
+CmdArgs.push_back("soft");
+CmdArgs.push_back("-mstack-alignment=4");
+  }
 }
 
 void Clang::AddHexagonTargetArgs(const ArgList ,
@@ -5707,6 +5719,18 @@
   CmdArgs.push_back(ABIName.data());
 }
 
+void ClangAs::AddX86TargetArgs(const ArgList ,
+   ArgStringList ) const {
+  // If -miamcu is set then use MCU triple.
+  if (Args.getLastArg(options::OPT_miamcu)) {
+if (getToolChain().getArch() != llvm::Triple::x86)
+  getToolChain().getDriver().Diag(diag::err_drv_unsupported_opt)
+  << "-miamcu";
+CmdArgs.push_back("-triple");
+CmdArgs.push_back("i586-intel-elfiamcu");
+  }
+}
+
 void ClangAs::ConstructJob(Compilation , const JobAction ,
const InputInfo , const InputInfoList ,
const ArgList ,
@@ -5847,6 +5871,11 @@
   case llvm::Triple::mips64el:
 AddMIPSTargetArgs(Args, CmdArgs);
 break;
+
+  case llvm::Triple::x86:
+  case llvm::Triple::x86_64:
+AddX86TargetArgs(Args, CmdArgs);
+break;
   }
 
   // Consume all the warning flags. Usually this would be handled more
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1226,6 +1226,8 @@
 def m64 : Flag<["-"], "m64">, Group, Flags<[DriverOption, CoreOption]>;
 def mx32 : Flag<["-"], "mx32">, Group, Flags<[DriverOption, CoreOption]>;
 def mabi_EQ : Joined<["-"], "mabi=">, Group;
+def miamcu : Flag<["-"], "miamcu">, Group, Flags<[DriverOption, CoreOption]>,
+  HelpText<"Use Intel MCU ABI.">;
 def malign_functions_EQ : Joined<["-"], "malign-functions=">, Group;
 def malign_loops_EQ : Joined<["-"], "malign-loops=">, Group;
 def malign_jumps_EQ : Joined<["-"], "malign-jumps=">, Group;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254203 - [mips] Interrupt attribute support.

2015-11-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Nov 27 11:39:20 2015
New Revision: 254203

URL: http://llvm.org/viewvc/llvm-project?rev=254203=rev
Log:
[mips] Interrupt attribute support.

Summary: This patch adds support for the interrupt attribute for mips32r2+.

Reviewers: dsanders, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: http://reviews.llvm.org/D10802

Added:
cfe/trunk/test/CodeGen/mips-interrupt-attr.c
cfe/trunk/test/Sema/mips-interrupt-attr.c
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=254203=254202=254203=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 27 11:39:20 2015
@@ -426,8 +426,8 @@ def Annotate : InheritableParamAttr {
 }
 
 def ARMInterrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, MSP430Interrupt's spellings
-  // must match.
+  // NOTE: If you add any additional spellings, MSP430Interrupt's and
+  // MipsInterrupt's spellings must match.
   let Spellings = [GNU<"interrupt">];
   let Args = [EnumArgument<"Interrupt", "InterruptType",
["IRQ", "FIQ", "SWI", "ABORT", "UNDEF", ""],
@@ -845,8 +845,8 @@ def MSABI : InheritableAttr {
 }
 
 def MSP430Interrupt : InheritableAttr, TargetSpecificAttr {
-  // NOTE: If you add any additional spellings, ARMInterrupt's spellings must
-  // match.
+  // NOTE: If you add any additional spellings, ARMInterrupt's and
+  // MipsInterrupt's spellings must match.
   let Spellings = [GNU<"interrupt">];
   let Args = [UnsignedArgument<"Number">];
   let ParseKind = "Interrupt";
@@ -860,6 +860,22 @@ def Mips16 : InheritableAttr, TargetSpec
   let Documentation = [Undocumented];
 }
 
+def MipsInterrupt : InheritableAttr, TargetSpecificAttr {
+  // NOTE: If you add any additional spellings, ARMInterrupt's and
+  // MSP430Interrupt's spellings must match.
+  let Spellings = [GNU<"interrupt">];
+  let Subjects = SubjectList<[Function]>;
+  let Args = [EnumArgument<"Interrupt", "InterruptType",
+   ["vector=sw0", "vector=sw1", "vector=hw0",
+"vector=hw1", "vector=hw2", "vector=hw3",
+"vector=hw4", "vector=hw5", "eic", ""],
+   ["sw0", "sw1", "hw0", "hw1", "hw2", "hw3",
+"hw4", "hw5", "eic", "eic"]
+   >];
+  let ParseKind = "Interrupt";
+  let Documentation = [MipsInterruptDocs];
+}
+
 def Mode : Attr {
   let Spellings = [GCC<"mode">];
   let Args = [IdentifierArgument<"Mode">];

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=254203=254202=254203=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Nov 27 11:39:20 2015
@@ -714,6 +714,46 @@ The semantics are as follows:
   }];
 }
 
+def MipsInterruptDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+Clang supports the GNU style ``__attribute__((interrupt("ARGUMENT")))`` 
attribute on
+MIPS targets. This attribute may be attached to a function definition and 
instructs
+the backend to generate appropriate function entry/exit code so that it can be 
used
+directly as an interrupt service routine.
+
+By default, the compiler will produce a function prologue and epilogue 
suitable for
+an interrupt service routine that handles an External Interrupt Controller 
(eic)
+generated interrupt. This behaviour can be explicitly requested with the "eic"
+argument.
+
+Otherwise, for use with vectored interrupt mode, the argument passed should be
+of the form "vector=LEVEL" where LEVEL is one of the following values:
+"sw0", "sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5". The compiler will
+then set the interrupt mask to the corresponding level which will mask all
+interrupts up to and including the argument.
+
+The semantics are as follows:
+
+- The prologue is modified so that the Exception Program Counter (EPC) and
+  Status coprocessor registers are saved to the stack. The interrupt mask is
+  set so that the function can only be interrupted by a higher priority
+  interrupt. The epilogue will restore the previous values of EPC and Status.
+
+- The prologue and epilogue are modified to save and restore all non-kernel
+  registers as necessary.
+
+- The FPU is disabled in the prologue, as the floating pointer registers are 
not
+  spilled to the stack.
+
+- The function 

[PATCH] D15040: [ARM] Add command-line options for ARMv8.2-A

2015-11-27 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added reviewers: t.p.northover, ab.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

This allows ARMv8.2-A to be targeted either by using "armv8.2a" in the
triple, or by using -march=armv8.2-a (or the alias -march=armv8.2a).

The FP16 extension can be enabled with the "+fp16" suffix to the -march
or -mcpu option. This is consistent with the AArch64 option, rather than
the usual ARM option of -mfpu. We have agreed with the team which will
be upstreaming this to GCC that we want to use this new option format
for new architecture extensions for both ARM and AArch64.

Most of the work for this was done by the TargetParser patch in llvm.

Repository:
  rL LLVM

http://reviews.llvm.org/D15040

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/Driver/arm-cortex-cpus.c

Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -230,6 +230,49 @@
 // RUN: %clang -target arm -march=armebv8.1-a -mbig-endian -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // CHECK-BE-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.1a-{{.*}}" 
"-target-cpu" "generic" "-target-feature" "+v8.1a"
 
+// RUN: %clang -target armv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2-a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2a -mlittle-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target armv8.2a -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2a -mlittle-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -mlittle-endian -march=armv8.2-a -mlittle-endian 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V82A %s
+// CHECK-V82A: "-cc1"{{.*}} "-triple" "armv8.2{{.*}}" "-target-cpu" "generic" 
"-target-feature" "+v8.2a"
+
+// RUN: %clang -target armebv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V82A %s
+// RUN: %clang -target armv8.2a -mbig-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V82A %s
+// RUN: %clang -target armeb -march=armebv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V82A %s
+// RUN: %clang -target armeb -march=armebv8.2-a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V82A %s
+// RUN: %clang -target arm -march=armebv8.2a -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V82A %s
+// RUN: %clang -target arm -march=armebv8.2-a -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V82A %s
+// CHECK-BE-V82A: "-cc1"{{.*}} "-triple" "armebv8.2{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+v8.2a"
+
+// RUN: %clang -target armv8.2a -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A-THUMB %s
+// RUN: %clang -target arm -march=armv8.2a -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V82A-THUMB %s
+// RUN: %clang -target arm -march=armv8.2-a -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V82A-THUMB %s
+// RUN: %clang -target armv8.2a -mlittle-endian -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V82A-THUMB %s
+// RUN: %clang -target arm -march=armv8.2a -mlittle-endian -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-V82A-THUMB %s
+// RUN: %clang -target arm -march=armv8.2-a -mlittle-endian -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-V82A-THUMB %s
+// CHECK-V82A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8.2a-{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+v8.2a"
+
+// RUN: %clang -target armebv8.2a -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V82A-THUMB %s
+// RUN: %clang -target armeb -march=armebv8.2a -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
+// RUN: %clang -target armeb -march=armebv8.2-a -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
+// RUN: %clang -target armv8.2a -mbig-endian -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
+// RUN: %clang -target arm -march=armebv8.2a -mbig-endian -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
+// RUN: %clang -target arm -march=armebv8.2-a -mbig-endian -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-BE-V82A-THUMB %s
+// CHECK-BE-V82A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.2a-{{.*}}" 
"-target-cpu" "generic" "-target-feature" "+v8.2a"
+
+// RUN: %clang -target armv8a -march=armv8.2-a+fp16 -### -c %s 2>&1 | 
FileCheck --check-prefix CHECK-V82A-FP16 %s
+// CHECK-V82A-FP16: "-cc1"{{.*}} "-triple" "armv8.2{{.*}}" "-target-cpu" 
"generic" {{.*}}"-target-feature" "+v8.2a" {{.*}}"-target-feature" "+fullfp16"
+

Re: [PATCH] D15040: [ARM] Add command-line options for ARMv8.2-A

2015-11-27 Thread Oliver Stannard via cfe-commits
olista01 removed rL LLVM as the repository for this revision.
olista01 updated this revision to Diff 41302.
olista01 added a comment.

Removed obsolete logic for setting subtarget features, and fixed up v8.1-A 
tests to match.

Also added a missing test for predefined macros.


http://reviews.llvm.org/D15040

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/Driver/arm-cortex-cpus.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -408,3 +408,9 @@
 // CHECK-V81A: __ARM_ARCH_8_1A__ 1
 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
 // CHECK-V81A: #define __ARM_FP 0xE
+
+// RUN: %clang -target armv8.2a-none-none-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V82A %s
+// CHECK-V82A: __ARM_ARCH 8
+// CHECK-V82A: __ARM_ARCH_8_2A__ 1
+// CHECK-V82A: #define __ARM_ARCH_PROFILE 'A'
+// CHECK-V82A: #define __ARM_FP 0xE
Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -204,31 +204,74 @@
 // RUN: %clang -mcpu=generic -target armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s
 // RUN: %clang -mcpu=generic -target arm -mlittle-endian -march=armv8.1-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s
-// CHECK-V81A: "-cc1"{{.*}} "-triple" "armv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a"
+// CHECK-V81A: "-cc1"{{.*}} "-triple" "armv8.1a-{{.*}}" "-target-cpu" "generic"
 
 // RUN: %clang -target armebv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
 // RUN: %clang -target armeb -march=armebv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
 // RUN: %clang -target armeb -march=armebv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
 // RUN: %clang -target armv8.1a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
 // RUN: %clang -target arm -march=armebv8.1a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
 // RUN: %clang -target arm -march=armebv8.1-a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s
-// CHECK-BE-V81A: "-cc1"{{.*}} "-triple" "armebv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a"
+// CHECK-BE-V81A: "-cc1"{{.*}} "-triple" "armebv8.1a-{{.*}}" "-target-cpu" "generic"
 
 // RUN: %clang -target armv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
 // RUN: %clang -target arm -march=armv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
 // RUN: %clang -target arm -march=armv8.1-a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
 // RUN: %clang -target armv8.1a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
 // RUN: %clang -target arm -march=armv8.1a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
 // RUN: %clang -target arm -march=armv8.1-a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s
-// CHECK-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a"
+// CHECK-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8.1a-{{.*}}" "-target-cpu" "generic"
 
 // RUN: %clang -target armebv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // RUN: %clang -target armeb -march=armebv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // RUN: %clang -target armeb -march=armebv8.1-a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // RUN: %clang -target armv8.1a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // RUN: %clang -target arm -march=armebv8.1a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
 // RUN: %clang -target arm -march=armebv8.1-a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s
-// CHECK-BE-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a"
+// CHECK-BE-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.1a-{{.*}}" "-target-cpu" "generic"
+
+// RUN: %clang -target armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target arm -march=armv8.2a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V82A %s
+// RUN: %clang -target armv8.2a 

Re: [PATCH] D14954: [x86] Exclusion of incorrect include headers paths for MCU target

2015-11-27 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254195: [x86] Exclusion of incorrect include headers paths 
for MCU target (authored by asbokhan).

Changed prior to commit:
  http://reviews.llvm.org/D14954?vs=41045=41286#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14954

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.h

Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -1178,12 +1178,7 @@
 // to get GlobalValue with exactly the type we need, not something that
 // might had been created for another decl with the same mangled name but
 // different type.
-// FIXME: Support for variables is not implemented yet.
-if (isa(D.getDecl()))
-  GV = cast(GetAddrOfGlobal(D, /*IsForDefinition=*/true));
-else
-  if (!GV)
-GV = GetGlobalValue(getMangledName(D));
+GV = cast(GetAddrOfGlobal(D, /*IsForDefinition=*/true));
 
 // Check to see if we've already emitted this.  This is necessary
 // for a couple of reasons: first, decls can end up in the
@@ -1693,8 +1688,8 @@
 // error.
 if (IsForDefinition && !Entry->isDeclaration()) {
   GlobalDecl OtherGD;
-  // Check that GD is not yet in ExplicitDefinitions is required to make
-  // sure that we issue an error only once.
+  // Check that GD is not yet in DiagnosedConflictingDefinitions is required
+  // to make sure that we issue an error only once.
   if (lookupRepresentativeDecl(MangledName, OtherGD) &&
   (GD.getCanonicalDecl().getDecl() !=
OtherGD.getCanonicalDecl().getDecl()) &&
@@ -1904,7 +1899,8 @@
 llvm::Constant *
 CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
  llvm::PointerType *Ty,
- const VarDecl *D) {
+ const VarDecl *D,
+ bool IsForDefinition) {
   // Lookup the entry, lazily creating it if necessary.
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
   if (Entry) {
@@ -1920,19 +1916,53 @@
 if (Entry->getType() == Ty)
   return Entry;
 
+// If there are two attempts to define the same mangled name, issue an
+// error.
+if (IsForDefinition && !Entry->isDeclaration()) {
+  GlobalDecl OtherGD;
+  // Check that D is not yet in DiagnosedConflictingDefinitions is required
+  // to make sure that we issue an error only once.
+  if (lookupRepresentativeDecl(MangledName, OtherGD) &&
+  (D->getCanonicalDecl() != OtherGD.getCanonicalDecl().getDecl()) &&
+  DiagnosedConflictingDefinitions.insert(D).second) {
+getDiags().Report(D->getLocation(),
+  diag::err_duplicate_mangled_name);
+getDiags().Report(OtherGD.getDecl()->getLocation(),
+  diag::note_previous_definition);
+  }
+}
+
 // Make sure the result is of the correct type.
 if (Entry->getType()->getAddressSpace() != Ty->getAddressSpace())
   return llvm::ConstantExpr::getAddrSpaceCast(Entry, Ty);
 
-return llvm::ConstantExpr::getBitCast(Entry, Ty);
+// Make sure the result is of the correct type.
+// (If global is requested for a definition, we always need to create a new
+// global, not just return a bitcast.)
+if (!IsForDefinition)
+  return llvm::ConstantExpr::getBitCast(Entry, Ty);
   }
 
   unsigned AddrSpace = GetGlobalVarAddressSpace(D, Ty->getAddressSpace());
   auto *GV = new llvm::GlobalVariable(
   getModule(), Ty->getElementType(), false,
   llvm::GlobalValue::ExternalLinkage, nullptr, MangledName, nullptr,
   llvm::GlobalVariable::NotThreadLocal, AddrSpace);
 
+  // If we already created a global with the same mangled name (but different
+  // type) before, take its name and remove it from its parent.
+  if (Entry) {
+GV->takeName(Entry);
+
+if (!Entry->use_empty()) {
+  llvm::Constant *NewPtrForOldDecl =
+  llvm::ConstantExpr::getBitCast(GV, Entry->getType());
+  Entry->replaceAllUsesWith(NewPtrForOldDecl);
+}
+
+Entry->eraseFromParent();
+  }
+
   // This is the first use or definition of a mangled name.  If there is a
   // deferred decl with this name, remember that we need to emit it at the end
   // of the file.
@@ -2005,7 +2035,8 @@
 return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false,
  IsForDefinition);
   } else
-return GetAddrOfGlobalVar(cast(GD.getDecl()));
+return GetAddrOfGlobalVar(cast(GD.getDecl()), /*Ty=*/nullptr,
+  IsForDefinition);
 }
 
 llvm::GlobalVariable *
@@ -2055,7 +2086,8 @@
 /// then it will be created with the specified type instead of whatever the
 /// normal requested type 

r254195 - [x86] Exclusion of incorrect include headers paths for MCU target

2015-11-27 Thread Andrey Bokhanko via cfe-commits
Author: asbokhan
Date: Fri Nov 27 06:18:22 2015
New Revision: 254195

URL: http://llvm.org/viewvc/llvm-project?rev=254195=rev
Log:
[x86] Exclusion of incorrect include headers paths for MCU target

Exclusion of /usr/include and /usr/local/include headers paths for MCU target.

Differential Revision: http://reviews.llvm.org/D14954

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=254195=254194=254195=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 27 06:18:22 2015
@@ -1178,12 +1178,7 @@ void CodeGenModule::EmitDeferred() {
 // to get GlobalValue with exactly the type we need, not something that
 // might had been created for another decl with the same mangled name but
 // different type.
-// FIXME: Support for variables is not implemented yet.
-if (isa(D.getDecl()))
-  GV = cast(GetAddrOfGlobal(D, 
/*IsForDefinition=*/true));
-else
-  if (!GV)
-GV = GetGlobalValue(getMangledName(D));
+GV = cast(GetAddrOfGlobal(D, /*IsForDefinition=*/true));
 
 // Check to see if we've already emitted this.  This is necessary
 // for a couple of reasons: first, decls can end up in the
@@ -1693,8 +1688,8 @@ CodeGenModule::GetOrCreateLLVMFunction(S
 // error.
 if (IsForDefinition && !Entry->isDeclaration()) {
   GlobalDecl OtherGD;
-  // Check that GD is not yet in ExplicitDefinitions is required to make
-  // sure that we issue an error only once.
+  // Check that GD is not yet in DiagnosedConflictingDefinitions is 
required
+  // to make sure that we issue an error only once.
   if (lookupRepresentativeDecl(MangledName, OtherGD) &&
   (GD.getCanonicalDecl().getDecl() !=
OtherGD.getCanonicalDecl().getDecl()) &&
@@ -1904,7 +1899,8 @@ bool CodeGenModule::isTypeConstant(QualT
 llvm::Constant *
 CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
  llvm::PointerType *Ty,
- const VarDecl *D) {
+ const VarDecl *D,
+ bool IsForDefinition) {
   // Lookup the entry, lazily creating it if necessary.
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
   if (Entry) {
@@ -1920,11 +1916,31 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
 if (Entry->getType() == Ty)
   return Entry;
 
+// If there are two attempts to define the same mangled name, issue an
+// error.
+if (IsForDefinition && !Entry->isDeclaration()) {
+  GlobalDecl OtherGD;
+  // Check that D is not yet in DiagnosedConflictingDefinitions is required
+  // to make sure that we issue an error only once.
+  if (lookupRepresentativeDecl(MangledName, OtherGD) &&
+  (D->getCanonicalDecl() != OtherGD.getCanonicalDecl().getDecl()) &&
+  DiagnosedConflictingDefinitions.insert(D).second) {
+getDiags().Report(D->getLocation(),
+  diag::err_duplicate_mangled_name);
+getDiags().Report(OtherGD.getDecl()->getLocation(),
+  diag::note_previous_definition);
+  }
+}
+
 // Make sure the result is of the correct type.
 if (Entry->getType()->getAddressSpace() != Ty->getAddressSpace())
   return llvm::ConstantExpr::getAddrSpaceCast(Entry, Ty);
 
-return llvm::ConstantExpr::getBitCast(Entry, Ty);
+// Make sure the result is of the correct type.
+// (If global is requested for a definition, we always need to create a new
+// global, not just return a bitcast.)
+if (!IsForDefinition)
+  return llvm::ConstantExpr::getBitCast(Entry, Ty);
   }
 
   unsigned AddrSpace = GetGlobalVarAddressSpace(D, Ty->getAddressSpace());
@@ -1933,6 +1949,20 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
   llvm::GlobalValue::ExternalLinkage, nullptr, MangledName, nullptr,
   llvm::GlobalVariable::NotThreadLocal, AddrSpace);
 
+  // If we already created a global with the same mangled name (but different
+  // type) before, take its name and remove it from its parent.
+  if (Entry) {
+GV->takeName(Entry);
+
+if (!Entry->use_empty()) {
+  llvm::Constant *NewPtrForOldDecl =
+  llvm::ConstantExpr::getBitCast(GV, Entry->getType());
+  Entry->replaceAllUsesWith(NewPtrForOldDecl);
+}
+
+Entry->eraseFromParent();
+  }
+
   // This is the first use or definition of a mangled name.  If there is a
   // deferred decl with this name, remember that we need to emit it at the end
   // of the file.
@@ -2005,7 +2035,8 @@ CodeGenModule::GetAddrOfGlobal(GlobalDec
 return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false,
  

Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Beren Minor via cfe-commits
berenm updated this revision to Diff 41296.
berenm added a comment.

[clang-format] Code cleanup and variable naming in 
WhitespaceManager::AlignTokens


http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8659,7 +8659,7 @@
Alignment);
   verifyFormat("class C {\n"
"public:\n"
-   "  int i = 1;\n"
+   "  int i= 1;\n"
"  virtual void f() = 0;\n"
"};",
Alignment);
@@ -8708,6 +8708,19 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
+  verifyFormat("int aa   = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8908,6 +8921,47 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
+
+  Alignment.ColumnLimit = 30;
+  Alignment.BinPackParameters = false;
+  verifyFormat("void foo(float a,\n"
+   " float b,\n"
+   " int   c,\n"
+   " uint32_t *d) {\n"
+   "  int *  e = 0;\n"
+   "  float  f = 0;\n"
+   "  double g = 0;\n"
+   "}\n"
+   "void bar(ino_t a,\n"
+   " int   b,\n"
+   " uint32_t *c,\n"
+   " bool  d) {}\n",
+   Alignment);
+  Alignment.BinPackParameters = true;
+  Alignment.ColumnLimit = 80;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.h
===
--- lib/Format/WhitespaceManager.h
+++ lib/Format/WhitespaceManager.h
@@ -168,20 +168,9 @@
   /// \brief Align consecutive assignments over all \c Changes.
   void alignConsecutiveAssignments();
 
-  /// \brief Align consecutive assignments from change \p Start to change \p End
-  /// at
-  /// the specified \p Column.
-  void alignConsecutiveAssignments(unsigned Start, unsigned End,
-   unsigned Column);
-
   /// \brief Align consecutive declarations over all \c Changes.
   void alignConsecutiveDeclarations();
 
-  /// \brief Align consecutive declarations from change \p Start to change \p
-  /// End at the specified \p Column.
-  void alignConsecutiveDeclarations(unsigned Start, unsigned End,
-unsigned Column);
-
   /// \brief Align trailing comments over all \c Changes.
   void alignTrailingComments();
 
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -148,125 +148,24 @@
   }
 }
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
-  unsigned MinColumn = 0;
-  unsigned MaxColumn = UINT_MAX;
-  unsigned StartOfSequence = 0;
-  unsigned EndOfSequence = 0;
-  bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
-
-  // Aligns a sequence of assignment tokens, on 

Re: [PATCH] D14871: [Power PC] fix calculating address of arguments on stack for variadic functions

2015-11-27 Thread Strahinja Petrovic via cfe-commits
spetrovic updated this revision to Diff 41297.
spetrovic marked 2 inline comments as done.

http://reviews.llvm.org/D14871

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/ppc-varargs-struct.c
  test/CodeGen/x86_64-arguments.c

Index: test/CodeGen/x86_64-arguments.c
===
--- test/CodeGen/x86_64-arguments.c
+++ test/CodeGen/x86_64-arguments.c
@@ -336,7 +336,8 @@
 
 // CHECK-LABEL: define i32 @f44
 // CHECK: ptrtoint
-// CHECK-NEXT: and {{.*}}, -32
+// CHECK-NEXT: add i64 %{{[0-9]+}}, 31
+// CHECK-NEXT: and i64 %{{[0-9]+}}, -32
 // CHECK-NEXT: inttoptr
 typedef int T44 __attribute((vector_size(32)));
 struct s44 { T44 x; int y; };
Index: test/CodeGen/ppc-varargs-struct.c
===
--- test/CodeGen/ppc-varargs-struct.c
+++ test/CodeGen/ppc-varargs-struct.c
@@ -39,9 +39,13 @@
 // CHECK-PPC:[[USING_OVERFLOW]]
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA:%.+]] = load i8*, i8** [[OVERFLOW_AREA_P]], align 4
-// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to %struct.x**
-// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* [[OVERFLOW_AREA]], i32 4
-// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]]
+// CHECK-PPC-NEXT:  %{{[0-9]+}} =  ptrtoint i8* %argp.cur to i32
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = add i32 %{{[0-9]+}}, 7
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8
+// CHECK-PPC-NEXT:  %argp.cur.aligned = inttoptr i32 %{{[0-9]+}} to i8*
+// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* %argp.cur.aligned to %struct.x**
+// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* %argp.cur.aligned, i32 4
+// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** [[OVERFLOW_AREA_P]], align 4
 // CHECK-PPC-NEXT:  br label %[[CONT]]
 //
 // CHECK-PPC:[[CONT]]
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -162,6 +162,23 @@
   OS << ")\n";
 }
 
+// Dynamically round a pointer up to a multiple of the given alignment.
+static llvm::Value* emitRoundPointerUpToAlignment(CodeGenFunction ,
+  llvm::Value *Ptr,
+  CharUnits Align) {
+  llvm::Value *PtrAsInt = Ptr;
+  // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;
+  PtrAsInt = CGF.Builder.CreatePtrToInt(PtrAsInt, CGF.IntPtrTy);
+  PtrAsInt = CGF.Builder.CreateAdd(PtrAsInt,
+llvm::ConstantInt::get(CGF.IntPtrTy, Align.getQuantity() - 1));
+  PtrAsInt = CGF.Builder.CreateAnd(PtrAsInt,
+   llvm::ConstantInt::get(CGF.IntPtrTy, -Align.getQuantity()));
+  PtrAsInt = CGF.Builder.CreateIntToPtr(PtrAsInt,
+Ptr->getType(),
+Ptr->getName() + ".aligned");
+  return PtrAsInt;
+}
+
 /// Emit va_arg for a platform using the common void* representation,
 /// where arguments are simply emitted in an array of slots on the stack.
 ///
@@ -192,19 +209,11 @@
 
   // If the CC aligns values higher than the slot size, do so if needed.
   Address Addr = Address::invalid();
-  if (AllowHigherAlign && DirectAlign > SlotSize) {
-llvm::Value *PtrAsInt = Ptr;
-PtrAsInt = CGF.Builder.CreatePtrToInt(PtrAsInt, CGF.IntPtrTy);
-PtrAsInt = CGF.Builder.CreateAdd(PtrAsInt,
-  llvm::ConstantInt::get(CGF.IntPtrTy, DirectAlign.getQuantity() - 1));
-PtrAsInt = CGF.Builder.CreateAnd(PtrAsInt,
- llvm::ConstantInt::get(CGF.IntPtrTy, -DirectAlign.getQuantity()));
-Addr = Address(CGF.Builder.CreateIntToPtr(PtrAsInt, Ptr->getType(),
-  "argp.cur.aligned"),
-   DirectAlign);
-  } else {
-Addr = Address(Ptr, SlotSize);
-  }
+  if (AllowHigherAlign && DirectAlign > SlotSize)
+Addr = Address(emitRoundPointerUpToAlignment(CGF, Ptr, DirectAlign),
+ DirectAlign);
+  else
+Addr = Address(Ptr, SlotSize); 
 
   // Advance the pointer past the argument, then store that back.
   CharUnits FullDirectSize = DirectSize.RoundUpToAlignment(SlotSize);
@@ -3072,20 +3081,10 @@
   // byte boundary if alignment needed by type exceeds 8 byte boundary.
   // It isn't stated explicitly in the standard, but in practice we use
   // alignment greater than 16 where necessary.
-  uint64_t Align = CGF.getContext().getTypeAlignInChars(Ty).getQuantity();
-  if (Align > 8) {
-// overflow_arg_area = (overflow_arg_area + align - 1) & -align;
-llvm::Value *Offset =
-  llvm::ConstantInt::get(CGF.Int64Ty, Align - 1);
-overflow_arg_area = CGF.Builder.CreateGEP(overflow_arg_area, Offset);
- 

Re: [PATCH] D14871: [Power PC] fix calculating address of arguments on stack for variadic functions

2015-11-27 Thread Strahinja Petrovic via cfe-commits
spetrovic added a comment.

Comments addressed.


http://reviews.llvm.org/D14871



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/WhitespaceManager.cpp:197
@@ +196,3 @@
+  // Keep track of the nesting level of matching tokens, i.e. the number of
+  // surrounding (), [], or {}. We will only align a sequence of matching
+  // token that share the same scope depth.

berenm wrote:
> I have added some details in the comments, but couldn't manage to use the 
> FormatToken::NestingLevel member. I haven't figured out why exactly, but it 
> doesn't increase the nesting level counter in the braced scope of examples 
> like:
> 
> ```
> int l = []() {
>   int i = 0;
>   int h = 0;
> }
> ```
> 
> i.e.: tokens `i` and `h` have `NestingLevel == 0` as it is the case for token 
> `l`.
> 
> I will try to figure out why exactly but it will require a bit more time.
Ah, right. It's fine to do this later. The reason is that the lines in the 
nested block are handled separately and scope counting starts from the 
beginning. You could probably use the line level somehow, but that's probably 
insufficient as it doesn't count the scopes in the outer statement.


Comment at: lib/Format/WhitespaceManager.cpp:263
@@ -321,20 +262,3 @@
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
+if (Matches(Changes[i])) {
+  // If there is more than one matching token per line, or if the number of

berenm wrote:
> I did that.
> 
> It makes me think that the code actually forbids the generic `AlignToken` 
> function to be used with a matcher for aligning commas or braces, paren and 
> brackets...
Use:

  if (!Matches(Changes[i]))
continue;


Comment at: lib/Format/WhitespaceManager.cpp:263-274
@@ -321,21 +262,14 @@
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
+if (Matches(Changes[i])) {
+  // If there is more than one matching token per line, or if the number of
+  // preceding commas, or the scope depth, do not match anymore, end the
+  // sequence.
+  if (FoundMatchOnLine || CommasBeforeMatch != CommasBeforeLastMatch ||
+  NestingLevel != NestingLevelOfLastMatch)
+AlignCurrentSequence();
+
+  CommasBeforeLastMatch = CommasBeforeMatch;
+  NestingLevelOfLastMatch = NestingLevel;
+  FoundMatchOnLine = true;
+
   if (StartOfSequence == 0)

djasper wrote:
> berenm wrote:
> > I did that.
> > 
> > It makes me think that the code actually forbids the generic `AlignToken` 
> > function to be used with a matcher for aligning commas or braces, paren and 
> > brackets...
> Use:
> 
>   if (!Matches(Changes[i]))
> continue;
I don't understand what you mean.


http://reviews.llvm.org/D14325



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Beren Minor via cfe-commits
berenm updated this revision to Diff 41299.
berenm marked an inline comment as done.
berenm added a comment.

Fix continue statements.


http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8659,7 +8659,7 @@
Alignment);
   verifyFormat("class C {\n"
"public:\n"
-   "  int i = 1;\n"
+   "  int i= 1;\n"
"  virtual void f() = 0;\n"
"};",
Alignment);
@@ -8708,6 +8708,19 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
+  verifyFormat("int aa   = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8908,6 +8921,47 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
+
+  Alignment.ColumnLimit = 30;
+  Alignment.BinPackParameters = false;
+  verifyFormat("void foo(float a,\n"
+   " float b,\n"
+   " int   c,\n"
+   " uint32_t *d) {\n"
+   "  int *  e = 0;\n"
+   "  float  f = 0;\n"
+   "  double g = 0;\n"
+   "}\n"
+   "void bar(ino_t a,\n"
+   " int   b,\n"
+   " uint32_t *c,\n"
+   " bool  d) {}\n",
+   Alignment);
+  Alignment.BinPackParameters = true;
+  Alignment.ColumnLimit = 80;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.h
===
--- lib/Format/WhitespaceManager.h
+++ lib/Format/WhitespaceManager.h
@@ -168,20 +168,9 @@
   /// \brief Align consecutive assignments over all \c Changes.
   void alignConsecutiveAssignments();
 
-  /// \brief Align consecutive assignments from change \p Start to change \p End
-  /// at
-  /// the specified \p Column.
-  void alignConsecutiveAssignments(unsigned Start, unsigned End,
-   unsigned Column);
-
   /// \brief Align consecutive declarations over all \c Changes.
   void alignConsecutiveDeclarations();
 
-  /// \brief Align consecutive declarations from change \p Start to change \p
-  /// End at the specified \p Column.
-  void alignConsecutiveDeclarations(unsigned Start, unsigned End,
-unsigned Column);
-
   /// \brief Align trailing comments over all \c Changes.
   void alignTrailingComments();
 
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -148,125 +148,24 @@
   }
 }
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
-  unsigned MinColumn = 0;
-  unsigned MaxColumn = UINT_MAX;
-  unsigned StartOfSequence = 0;
-  unsigned EndOfSequence = 0;
-  bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
-
-  // Aligns a sequence of assignment tokens, on the MinColumn 

Re: r254195 - [x86] Exclusion of incorrect include headers paths for MCU target

2015-11-27 Thread Hal Finkel via cfe-commits
Hi Andrey,

This commit does not seem to match the description. What is it doing?

Thanks again,
Hal

- Original Message -
> From: "Andrey Bokhanko via cfe-commits" 
> To: cfe-commits@lists.llvm.org
> Sent: Friday, November 27, 2015 6:18:23 AM
> Subject: r254195 - [x86] Exclusion of incorrect include headers paths for MCU 
> target
> 
> Author: asbokhan
> Date: Fri Nov 27 06:18:22 2015
> New Revision: 254195
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=254195=rev
> Log:
> [x86] Exclusion of incorrect include headers paths for MCU target
> 
> Exclusion of /usr/include and /usr/local/include headers paths for
> MCU target.
> 
> Differential Revision: http://reviews.llvm.org/D14954
> 
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/lib/CodeGen/CodeGenModule.h
> 
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=254195=254194=254195=diff
> ==
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 27 06:18:22 2015
> @@ -1178,12 +1178,7 @@ void CodeGenModule::EmitDeferred() {
>  // to get GlobalValue with exactly the type we need, not
>  something that
>  // might had been created for another decl with the same mangled
>  name but
>  // different type.
> -// FIXME: Support for variables is not implemented yet.
> -if (isa(D.getDecl()))
> -  GV = cast(GetAddrOfGlobal(D,
> /*IsForDefinition=*/true));
> -else
> -  if (!GV)
> -GV = GetGlobalValue(getMangledName(D));
> +GV = cast(GetAddrOfGlobal(D,
> /*IsForDefinition=*/true));
>  
>  // Check to see if we've already emitted this.  This is
>  necessary
>  // for a couple of reasons: first, decls can end up in the
> @@ -1693,8 +1688,8 @@ CodeGenModule::GetOrCreateLLVMFunction(S
>  // error.
>  if (IsForDefinition && !Entry->isDeclaration()) {
>GlobalDecl OtherGD;
> -  // Check that GD is not yet in ExplicitDefinitions is required
> to make
> -  // sure that we issue an error only once.
> +  // Check that GD is not yet in DiagnosedConflictingDefinitions
> is required
> +  // to make sure that we issue an error only once.
>if (lookupRepresentativeDecl(MangledName, OtherGD) &&
>(GD.getCanonicalDecl().getDecl() !=
> OtherGD.getCanonicalDecl().getDecl()) &&
> @@ -1904,7 +1899,8 @@ bool CodeGenModule::isTypeConstant(QualT
>  llvm::Constant *
>  CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
>   llvm::PointerType *Ty,
> - const VarDecl *D) {
> + const VarDecl *D,
> + bool IsForDefinition) {
>// Lookup the entry, lazily creating it if necessary.
>llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
>if (Entry) {
> @@ -1920,11 +1916,31 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
>  if (Entry->getType() == Ty)
>return Entry;
>  
> +// If there are two attempts to define the same mangled name,
> issue an
> +// error.
> +if (IsForDefinition && !Entry->isDeclaration()) {
> +  GlobalDecl OtherGD;
> +  // Check that D is not yet in DiagnosedConflictingDefinitions
> is required
> +  // to make sure that we issue an error only once.
> +  if (lookupRepresentativeDecl(MangledName, OtherGD) &&
> +  (D->getCanonicalDecl() !=
> OtherGD.getCanonicalDecl().getDecl()) &&
> +  DiagnosedConflictingDefinitions.insert(D).second) {
> +getDiags().Report(D->getLocation(),
> +  diag::err_duplicate_mangled_name);
> +getDiags().Report(OtherGD.getDecl()->getLocation(),
> +  diag::note_previous_definition);
> +  }
> +}
> +
>  // Make sure the result is of the correct type.
>  if (Entry->getType()->getAddressSpace() !=
>  Ty->getAddressSpace())
>return llvm::ConstantExpr::getAddrSpaceCast(Entry, Ty);
>  
> -return llvm::ConstantExpr::getBitCast(Entry, Ty);
> +// Make sure the result is of the correct type.
> +// (If global is requested for a definition, we always need to
> create a new
> +// global, not just return a bitcast.)
> +if (!IsForDefinition)
> +  return llvm::ConstantExpr::getBitCast(Entry, Ty);
>}
>  
>unsigned AddrSpace = GetGlobalVarAddressSpace(D,
>Ty->getAddressSpace());
> @@ -1933,6 +1949,20 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
>llvm::GlobalValue::ExternalLinkage, nullptr, MangledName,
>nullptr,
>llvm::GlobalVariable::NotThreadLocal, AddrSpace);
>  
> +  // If we already created a global with the same mangled name (but
> different
> +  // type) before, take its name and remove it from its parent.
> + 

Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks awesome :-)



Comment at: lib/Format/WhitespaceManager.cpp:242-243
@@ -320,34 +241,4 @@
 }
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
-  if (StartOfSequence == 0)
-StartOfSequence = i;
-
-  unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn;
-  int LineLengthAfter = -Changes[i].Spaces;
-  for (unsigned j = i; j != e && Changes[j].NewlinesBefore == 0; ++j)
-LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
-  unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
-
-  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn) {
-AlignSequence();
-StartOfSequence = i;
-  }
+if (Changes[i].Kind == tok::comma) {
+  ++CommasBeforeMatch;

berenm wrote:
> The code was only checking for a match if none of the previous conditions 
> were true. I changed that and with your suggestion so I guess it's OK now.
Ah, I see, I guess the initial if-else chains were too complicated for me ;-).

This looks good now, thanks.


http://reviews.llvm.org/D14325



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254199 - Revert Sparc and SparcV9 to external assembler. Now that the CPU

2015-11-27 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Fri Nov 27 07:16:33 2015
New Revision: 254199

URL: http://llvm.org/viewvc/llvm-project?rev=254199=rev
Log:
Revert Sparc and SparcV9 to external assembler. Now that the CPU
handling is corrected, the primary reason for forcing IAS as default is
gone and the remaining issues are still somewhat problematic in common
situations.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/sparc-as.c
cfe/trunk/test/Driver/sparcv9-as.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=254199=254198=254199=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Nov 27 07:16:33 2015
@@ -2377,9 +2377,6 @@ bool Generic_GCC::IsIntegratedAssemblerD
   case llvm::Triple::ppc:
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
-  case llvm::Triple::sparc:
-  case llvm::Triple::sparcel:
-  case llvm::Triple::sparcv9:
   case llvm::Triple::systemz:
 return true;
   default:

Modified: cfe/trunk/test/Driver/sparc-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sparc-as.c?rev=254199=254198=254199=diff
==
--- cfe/trunk/test/Driver/sparc-as.c (original)
+++ cfe/trunk/test/Driver/sparc-as.c Fri Nov 27 07:16:33 2015
@@ -1,3 +1,17 @@
+// Make sure Sparc does not use the integrated assembler by default.
+
+// RUN: %clang -target sparc-linux -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=NO-IAS %s
+
+// RUN: %clang -target sparc-linux -fintegrated-as -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=IAS %s
+
+// RUN: %clang -target sparc-linux -fno-integrated-as -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=NO-IAS %s
+
+// IAS-NOT: "-no-integrated-as"
+// NO-IAS: "-no-integrated-as"
+
 // RUN: %clang -no-canonical-prefixes -target sparc--netbsd \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=SPARC %s

Modified: cfe/trunk/test/Driver/sparcv9-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sparcv9-as.c?rev=254199=254198=254199=diff
==
--- cfe/trunk/test/Driver/sparcv9-as.c (original)
+++ cfe/trunk/test/Driver/sparcv9-as.c Fri Nov 27 07:16:33 2015
@@ -1,3 +1,17 @@
+// Make sure SparcV9 does not use the integrated assembler by default.
+
+// RUN: %clang -target sparcv9-linux -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=NO-IAS %s
+
+// RUN: %clang -target sparcv9-linux -fintegrated-as -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=IAS %s
+
+// RUN: %clang -target sparcv9-linux -fno-integrated-as -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=NO-IAS %s
+
+// IAS-NOT: "-no-integrated-as"
+// NO-IAS: "-no-integrated-as"
+
 // RUN: %clang -no-canonical-prefixes -target sparcv9--netbsd \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=SPARC %s


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15040: [ARM] Add command-line options for ARMv8.2-A

2015-11-27 Thread Bradley Smith via cfe-commits
bsmith added a subscriber: bsmith.


Comment at: lib/Driver/Tools.cpp:868-876
@@ -867,4 +867,11 @@
 
-  if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8_1a) {
+  switch (Triple.getSubArch()) {
+  case llvm::Triple::SubArchType::ARMSubArch_v8_1a:
 Features.insert(Features.begin(), "+v8.1a");
+break;
+  case llvm::Triple::SubArchType::ARMSubArch_v8_2a:
+Features.insert(Features.begin(), "+v8.2a");
+break;
+  default:
+break;
   }

Now that -mcpu=generic works correctly and isn't hardcoded to ARMv8.1-A, I 
don't believe we need this hardcoded logic to add these features.


Repository:
  rL LLVM

http://reviews.llvm.org/D15040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Beren Minor via cfe-commits
berenm marked 2 inline comments as done.


Comment at: lib/Format/WhitespaceManager.cpp:197
@@ +196,3 @@
+  // Keep track of the nesting level of matching tokens, i.e. the number of
+  // surrounding (), [], or {}. We will only align a sequence of matching
+  // token that share the same scope depth.

I have added some details in the comments, but couldn't manage to use the 
FormatToken::NestingLevel member. I haven't figured out why exactly, but it 
doesn't increase the nesting level counter in the braced scope of examples like:

```
int l = []() {
  int i = 0;
  int h = 0;
}
```

i.e.: tokens `i` and `h` have `NestingLevel == 0` as it is the case for token 
`l`.

I will try to figure out why exactly but it will require a bit more time.


Comment at: lib/Format/WhitespaceManager.cpp:263-274
@@ -321,21 +262,14 @@
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
+if (Matches(Changes[i])) {
+  // If there is more than one matching token per line, or if the number of
+  // preceding commas, or the scope depth, do not match anymore, end the
+  // sequence.
+  if (FoundMatchOnLine || CommasBeforeMatch != CommasBeforeLastMatch ||
+  NestingLevel != NestingLevelOfLastMatch)
+AlignCurrentSequence();
+
+  CommasBeforeLastMatch = CommasBeforeMatch;
+  NestingLevelOfLastMatch = NestingLevel;
+  FoundMatchOnLine = true;
+
   if (StartOfSequence == 0)

I did that.

It makes me think that the code actually forbids the generic `AlignToken` 
function to be used with a matcher for aligning commas or braces, paren and 
brackets...


http://reviews.llvm.org/D14325



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Beren Minor via cfe-commits
berenm added inline comments.


Comment at: lib/Format/WhitespaceManager.cpp:242-243
@@ -320,34 +241,4 @@
 }
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
-  if (StartOfSequence == 0)
-StartOfSequence = i;
-
-  unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn;
-  int LineLengthAfter = -Changes[i].Spaces;
-  for (unsigned j = i; j != e && Changes[j].NewlinesBefore == 0; ++j)
-LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
-  unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
-
-  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn) {
-AlignSequence();
-StartOfSequence = i;
-  }
+if (Changes[i].Kind == tok::comma) {
+  ++CommasBeforeMatch;

The code was only checking for a match if none of the previous conditions were 
true. I changed that and with your suggestion so I guess it's OK now.


http://reviews.llvm.org/D14325



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r254216 - [clang-tidy] google-explicit-constructor: improve the warning message

2015-11-27 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Nov 27 20:25:02 2015
New Revision: 254216

URL: http://llvm.org/viewvc/llvm-project?rev=254216=rev
Log:
[clang-tidy] google-explicit-constructor: improve the warning message

Also switch some more tests to %check_clang_tidy.

Modified:
clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/deduplication.cpp
clang-tools-extra/trunk/test/clang-tidy/diagnostic.cpp
clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp
clang-tools-extra/trunk/test/clang-tidy/line-filter.cpp
clang-tools-extra/trunk/test/clang-tidy/macros.cpp
clang-tools-extra/trunk/test/clang-tidy/nolint.cpp

Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=254216=254215=254216=diff
==
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Fri 
Nov 27 20:25:02 2015
@@ -119,9 +119,11 @@ void ExplicitConstructorCheck::check(con
   bool SingleArgument =
   Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack();
   SourceLocation Loc = Ctor->getLocation();
-  diag(Loc, SingleArgument ? "single-argument constructors must be explicit"
-   : "constructors that are callable with a single "
- "argument must be marked explicit")
+  diag(Loc,
+   "%0 must be marked explicit to avoid unintentional implicit 
conversions")
+  << (SingleArgument
+  ? "single-argument constructors"
+  : "constructors that are callable with a single argument")
   << FixItHint::CreateInsertion(Loc, "explicit ");
 }
 

Modified: clang-tools-extra/trunk/test/clang-tidy/deduplication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/deduplication.cpp?rev=254216=254215=254216=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/deduplication.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/deduplication.cpp Fri Nov 27 
20:25:02 2015
@@ -1,10 +1,8 @@
-// RUN: clang-tidy -checks='-*,google-explicit-constructor' %s -- | FileCheck 
%s
+// RUN: %check_clang_tidy %s google-explicit-constructor %t
 
 template
 struct A { A(T); };
-// CHECK: :[[@LINE-1]]:12: warning: single-argument constructors must be 
explicit [google-explicit-constructor]
-// CHECK-NOT: warning:
-
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must 
be marked explicit
 
 void f() {
   A a(0);

Modified: clang-tools-extra/trunk/test/clang-tidy/diagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/diagnostic.cpp?rev=254216=254215=254216=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/diagnostic.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/diagnostic.cpp Fri Nov 27 20:25:02 
2015
@@ -11,8 +11,8 @@
 // CHECK3: :[[@LINE+1]]:9: warning: implicit conversion from 'double' to 'int' 
changes value
 int a = 1.5;
 
-// CHECK2: :[[@LINE+2]]:11: warning: single-argument constructors must be 
explicit [google-explicit-constructor]
-// CHECK3: :[[@LINE+1]]:11: warning: single-argument constructors must be 
explicit [google-explicit-constructor]
+// CHECK2: :[[@LINE+2]]:11: warning: single-argument constructors must be 
marked explicit
+// CHECK3: :[[@LINE+1]]:11: warning: single-argument constructors must be 
marked explicit
 class A { A(int) {} };
 
 #define MACRO_FROM_COMMAND_LINE

Modified: clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp?rev=254216=254215=254216=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp Fri Nov 27 20:25:02 
2015
@@ -8,7 +8,7 @@
 
 #include "header1.h"
 // CHECK-NOT: warning:
-// CHECK2: header1.h:1:12: warning: single-argument constructors must be 
explicit [google-explicit-constructor]
+// CHECK2: header1.h:1:12: warning: single-argument constructors must be 
marked explicit
 // CHECK3-NOT: warning:
 // CHECK4: header1.h:1:12: warning: single-argument constructors
 

Modified: 
clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp?rev=254216=254215=254216=diff

Re: [PATCH] D10802: [mips] Interrupt attribute support.

2015-11-27 Thread Simon Dardis via cfe-commits
sdardis updated this revision to Diff 41283.
sdardis added a comment.

Nit addressed.

Daniel or Aaron, can one of you commit on my behalf? Thanks.

Aaron, thanks for the review.


http://reviews.llvm.org/D10802

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/mips-interrupt-attr.c
  test/Sema/mips-interrupt-attr.c

Index: test/Sema/mips-interrupt-attr.c
===
--- /dev/null
+++ test/Sema/mips-interrupt-attr.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 %s -triple mips-img-elf -verify -fsyntax-only
+struct a { int b; };
+
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+
+__attribute__((interrupt("EIC"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: 'EIC'}}
+
+__attribute__((interrupt("eic", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
+
+__attribute__((interrupt("eic"))) void foo3() {}
+__attribute__((interrupt("vector=sw0"))) void foo4() {}
+__attribute__((interrupt("vector=hw0"))) void foo5() {}
+__attribute__((interrupt("vector=hw1"))) void foo6() {}
+__attribute__((interrupt("vector=hw2"))) void foo7() {}
+__attribute__((interrupt("vector=hw3"))) void foo8() {}
+__attribute__((interrupt("vector=hw4"))) void foo9() {}
+__attribute__((interrupt("vector=hw5"))) void fooa() {}
+__attribute__((interrupt(""))) void food() {}
+
+__attribute__((interrupt)) int foob() {return 0;} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have a 'void' return type}}
+__attribute__((interrupt())) void fooc(int a) {} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have no parameters}}
+__attribute__((interrupt,mips16)) void fooe() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \
+ // expected-note {{conflicting attribute is here}}
+__attribute__((mips16,interrupt)) void foof() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \
+ // expected-note {{conflicting attribute is here}}
+__attribute__((interrupt)) __attribute__ ((mips16)) void foo10() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \
+// expected-note {{conflicting attribute is here}}
+__attribute__((mips16)) __attribute ((interrupt)) void foo11() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \
+  // expected-note {{conflicting attribute is here}}
Index: test/CodeGen/mips-interrupt-attr.c
===
--- /dev/null
+++ test/CodeGen/mips-interrupt-attr.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -triple mipsel-unknown-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK
+
+void __attribute__ ((interrupt("vector=sw0")))
+isr_sw0 (void)
+{
+  // CHECK: define void @isr_sw0() [[SW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=sw1")))
+isr_sw1 (void)
+{
+  // CHECK: define void @isr_sw1() [[SW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw0")))
+isr_hw0 (void)
+{
+  // CHECK: define void @isr_hw0() [[HW0:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw1")))
+isr_hw1 (void)
+{
+  // CHECK: define void @isr_hw1() [[HW1:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw2")))
+isr_hw2 (void)
+{
+  // CHECK: define void @isr_hw2() [[HW2:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw3")))
+isr_hw3 (void)
+{
+  // CHECK: define void @isr_hw3() [[HW3:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw4")))
+isr_hw4 (void)
+{
+  // CHECK: define void @isr_hw4() [[HW4:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt("vector=hw5")))
+isr_hw5 (void)
+{
+  // CHECK: define void @isr_hw5() [[HW5:#[0-9]+]]
+}
+
+void __attribute__ ((interrupt))
+isr_eic (void)
+{
+  // CHECK: define void @isr_eic() [[EIC:#[0-9]+]]
+}
+// CHECK: attributes [[SW0]] = { {{.*}} "interrupt"="sw0" {{.*}} }
+// CHECK: attributes [[SW1]] = { {{.*}} "interrupt"="sw1" {{.*}} }
+// CHECK: attributes [[HW0]] = { {{.*}} "interrupt"="hw0" {{.*}} }
+// CHECK: attributes [[HW1]] = { {{.*}} "interrupt"="hw1" {{.*}} }
+// CHECK: attributes [[HW2]] = { {{.*}} "interrupt"="hw2" {{.*}} }
+// CHECK: attributes [[HW3]] = { {{.*}} "interrupt"="hw3" {{.*}} }
+// CHECK: attributes [[HW4]] = { {{.*}} "interrupt"="hw4" {{.*}} }
+// CHECK: attributes [[HW5]] = { {{.*}} "interrupt"="hw5" {{.*}} }
+// CHECK: attributes [[EIC]] = { {{.*}} "interrupt"="eic" {{.*}} }
Index: lib/Sema/SemaDeclAttr.cpp

Re: [PATCH] D14736: [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.

2015-11-27 Thread Gábor Horváth via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

In the meantime I realized dead store analysis only works with local variables, 
so I think I answered my comment.

It was commited in r253630 .


http://reviews.llvm.org/D14736



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-27 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Sorry for being so slow to respond. Feel free to ping me more frequently ;-).



Comment at: lib/Format/WhitespaceManager.cpp:197
@@ +196,3 @@
+  // Keep track of the scope depth of matching tokens. We will only align a
+  // sequence of matching token that share the same scope depth.
+  unsigned DepthOfPrevToken = 0;

Maybe be slightly more specific about what constitutes a "scope".

Also, FormatTokens already have this information stored in NestingLevel. Would 
it maybe make sense to copy that information into each Change? In the long run, 
we might actually wanna switch to storing a back-reference to the actual token 
in a change to have access to all the information. But that would probably 
better be done in a subsequent change.


Comment at: lib/Format/WhitespaceManager.cpp:208
@@ +207,3 @@
+  // Whether a matching token has been found on the current line.
+  bool FoundOnLine = false;
+

FoundOnLine seems to be missing some crucial information. Would you might 
changing to FoundMathcingTokenOnLine or FoundMatchOnLine?


Comment at: lib/Format/WhitespaceManager.cpp:239
@@ -321,20 +238,3 @@
 
-if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundDeclarationOnLine)
-AlignSequence();
-} else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
-  FoundDeclarationOnLine = true;
+if (Changes[i].Kind == tok::comma) {
+  ++CommasBeforeToken;

I think this would be slightly easier to read if you used "continue" (basically 
instead of each "else" here)
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code


Comment at: unittests/Format/FormatTest.cpp:8662
@@ -8661,3 +8661,3 @@
"public:\n"
-   "  int i = 1;\n"
+   "  int i= 1;\n"
"  virtual void f() = 0;\n"

I am not sure that this is actually desirable, but then again, I also don't 
think it matters. If people don't like it, they can add a blank line or a 
comment in-between.


http://reviews.llvm.org/D14325



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits