Re: [llvm-dev] mips builders on LLVM buildbot?

2018-11-02 Thread Daniel Sanders via cfe-commits
Hi Galina,

I'm sad that they appear to have been abandoned but no objections from me as 
I'm not the admin for any of these anymore. A couple of them were taken over by 
a colleague when I left but he too has left MIPS since then. Simon Atanasyan 
might be able to find the owners if there still are any.

> On Nov 2, 2018, at 13:29, Galina Kistanova via llvm-dev 
>  wrote:
> 
> Hello everyone, 
> 
> There are few abandoned mips builders on LLVM buildbot:
> 
> llvm-mips-linux
> clang-cmake-mipsel
> clang-cmake-mips
> 
> I am going to remove them, if anyone has any objections, please speak up!
> 
> Thanks
> 
> Galina
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

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


[clang] 7209f83 - Allow .dSYM's to be directly placed in an alternate directory

2020-08-03 Thread Daniel Sanders via cfe-commits

Author: Daniel Sanders
Date: 2020-08-03T13:18:52-07:00
New Revision: 7209f83112db4dbe15d8328705f9d2aff0624fbd

URL: 
https://github.com/llvm/llvm-project/commit/7209f83112db4dbe15d8328705f9d2aff0624fbd
DIFF: 
https://github.com/llvm/llvm-project/commit/7209f83112db4dbe15d8328705f9d2aff0624fbd.diff

LOG: Allow .dSYM's to be directly placed in an alternate directory

Once available in the relevant toolchains this will allow us to implement
LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR after D84127 by directly placing the dSYM
in the desired location instead of emitting next to the output file and moving
it.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D84572

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/test/Driver/darwin-dsymutil.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 16051934c1e0..fcb5c030755e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -677,6 +677,9 @@ def dependency_dot : Separate<["-"], "dependency-dot">, 
Flags<[CC1Option]>,
   HelpText<"Filename to write DOT-formatted header dependencies to">;
 def module_dependency_dir : Separate<["-"], "module-dependency-dir">,
   Flags<[CC1Option]>, HelpText<"Directory to dump module dependencies to">;
+def dsym_dir : JoinedOrSeparate<["-"], "dsym-dir">,
+  Flags<[DriverOption, RenderAsInput]>,
+  HelpText<"Directory to output dSYM's (if any) to">, MetaVarName<"">;
 def dumpmachine : Flag<["-"], "dumpmachine">;
 def dumpspecs : Flag<["-"], "dumpspecs">, Flags<[Unsupported]>;
 def dumpversion : Flag<["-"], "dumpversion">;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 317098e24823..35263fbe1b2d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4604,7 +4604,17 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   StringRef BaseName;
 
   // Dsymutil actions should use the full path.
-  if (isa(JA) || isa(JA))
+  if (isa(JA) && C.getArgs().hasArg(options::OPT_dsym_dir)) 
{
+SmallString<128> ExternalPath(
+C.getArgs().getLastArg(options::OPT_dsym_dir)->getValue());
+// We use posix style here because the tests (specifically
+// darwin-dsymutil.c) demonstrate that posix style paths are acceptable
+// even on Windows and if we don't then the similar test covering this
+// fails.
+llvm::sys::path::append(ExternalPath, llvm::sys::path::Style::posix,
+llvm::sys::path::filename(BasePath));
+BaseName = ExternalPath;
+  } else if (isa(JA) || isa(JA))
 BaseName = BasePath;
   else
 BaseName = llvm::sys::path::filename(BasePath);

diff  --git a/clang/test/Driver/darwin-dsymutil.c 
b/clang/test/Driver/darwin-dsymutil.c
index 09451a81b797..8cdb2f3cbf64 100644
--- a/clang/test/Driver/darwin-dsymutil.c
+++ b/clang/test/Driver/darwin-dsymutil.c
@@ -26,10 +26,21 @@
 //
 // RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
 // RUN:   -o foo %s -g 2> %t
-// RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s
+// RUN: FileCheck -Doutfile=foo -Ddsymfile=foo.dSYM \
+// RUN:  -check-prefix=CHECK-OUTPUT-NAME < %t %s
 //
-// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: 
[{{.*}}], output: "foo"
-// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: 
["foo"], output: "foo.dSYM"
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN:   -o bar/foo %s -g 2> %t
+// RUN: FileCheck -Doutfile=bar/foo -Ddsymfile=bar/foo.dSYM \
+// RUN:   -check-prefix=CHECK-OUTPUT-NAME < %t %s
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN:   -o bar/foo -dsym-dir external %s -g 2> %t
+// RUN: FileCheck -Doutfile=bar/foo -Ddsymfile=external/foo.dSYM \
+// RUN:   -check-prefix=CHECK-OUTPUT-NAME < %t %s
+//
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: 
[{{.*}}], output: "[[outfile]]"
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: 
["[[outfile]]"], output: "[[dsymfile]]"
 
 // Check that we only use dsymutil when needed.
 //
@@ -38,12 +49,5 @@
 // RUN:   -o foo %t.o -g 2> %t
 // RUN: not grep "Dsymutil" %t
 
-// Check that we put the .dSYM in the right place.
-// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
-// RUN:   -o bar/foo %s -g 2> %t
-// RUN: FileCheck -check-prefix=CHECK-LOCATION < %t %s
-
-// CHECK-LOCATION: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: 
["bar/foo"], output: "bar/foo.dSYM"
-
 // Check that we don't crash when translating arguments for dsymutil.
 // RUN: %clang -m32 -arch x86_64 -g %s -###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm

[clang] 1beb00d - Fix use-after-scope in 7209f83112db caught by the sanitizer bots

2020-08-03 Thread Daniel Sanders via cfe-commits

Author: Daniel Sanders
Date: 2020-08-03T16:55:00-07:00
New Revision: 1beb00db1f5197efb73f839da681b8e439f37628

URL: 
https://github.com/llvm/llvm-project/commit/1beb00db1f5197efb73f839da681b8e439f37628
DIFF: 
https://github.com/llvm/llvm-project/commit/1beb00db1f5197efb73f839da681b8e439f37628.diff

LOG: Fix use-after-scope in 7209f83112db caught by the sanitizer bots

Added: 


Modified: 
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 35263fbe1b2d..e6a267621d8b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4601,12 +4601,12 @@ const char *Driver::GetNamedOutputPath(Compilation &C, 
const JobAction &JA,
   }
 
   SmallString<128> BasePath(BaseInput);
+  SmallString<128> ExternalPath("");
   StringRef BaseName;
 
   // Dsymutil actions should use the full path.
   if (isa(JA) && C.getArgs().hasArg(options::OPT_dsym_dir)) 
{
-SmallString<128> ExternalPath(
-C.getArgs().getLastArg(options::OPT_dsym_dir)->getValue());
+ExternalPath += C.getArgs().getLastArg(options::OPT_dsym_dir)->getValue();
 // We use posix style here because the tests (specifically
 // darwin-dsymutil.c) demonstrate that posix style paths are acceptable
 // even on Windows and if we don't then the similar test covering this



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


[clang-tools-extra] r370512 - [clang-tidy] Add llvm-prefer-register-over-unsigned to clang-tidy

2019-08-30 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Aug 30 13:01:59 2019
New Revision: 370512

URL: http://llvm.org/viewvc/llvm-project?rev=370512&view=rev
Log:
[clang-tidy] Add llvm-prefer-register-over-unsigned to clang-tidy

Summary:
This clang-tidy check is looking for unsigned integer variables whose 
initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Reviewers: arsenm, bogner

Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, 
sdardis, nemanjai, jvesely, wdng, nhaehnle, mgorny, sbc100, jgravelle-google, 
kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, 
rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, 
edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, 
jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D65919

Added:
clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-prefer-register-over-unsigned.rst

clang-tools-extra/trunk/test/clang-tidy/llvm-prefer-register-over-unsigned.cpp

clang-tools-extra/trunk/test/clang-tidy/llvm-prefer-register-over-unsigned2.cpp

clang-tools-extra/trunk/test/clang-tidy/llvm-prefer-register-over-unsigned3.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt?rev=370512&r1=370511&r2=370512&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt Fri Aug 30 13:01:59 
2019
@@ -5,6 +5,7 @@ add_clang_library(clangTidyLLVMModule
   IncludeOrderCheck.cpp
   LLVMTidyModule.cpp
   PreferIsaOrDynCastInConditionalsCheck.cpp
+  PreferRegisterOverUnsignedCheck.cpp
   TwineLocalCheck.cpp
 
   LINK_LIBS

Modified: clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp?rev=370512&r1=370511&r2=370512&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp Fri Aug 30 
13:01:59 2019
@@ -13,6 +13,7 @@
 #include "HeaderGuardCheck.h"
 #include "IncludeOrderCheck.h"
 #include "PreferIsaOrDynCastInConditionalsCheck.h"
+#include "PreferRegisterOverUnsignedCheck.h"
 #include "TwineLocalCheck.h"
 
 namespace clang {
@@ -28,6 +29,8 @@ public:
 "llvm-namespace-comment");
 CheckFactories.registerCheck(
 "llvm-prefer-isa-or-dyn-cast-in-conditionals");
+CheckFactories.registerCheck(
+"llvm-prefer-register-over-unsigned");
 CheckFactories.registerCheck("llvm-twine-local");
   }
 };

Added: 
clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp?rev=370512&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp 
Fri Aug 30 13:01:59 2019
@@ -0,0 +1,64 @@
+//===--- PreferRegisterOverUnsignedCheck.cpp - clang-tidy 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "PreferRegisterOverUnsignedCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace llvm_check {
+
+void PreferRegisterOverUnsignedCheck::registerMatchers(MatchFinder *Finder) {
+  auto RegisterClassMatch = hasType(
+  cxxRecordDecl(hasName("::llvm::Register")).bind("registerClassDecl"));
+
+  Finder->addMatcher(
+  valueDecl(allOf(
+  hasType(qualType(isUnsignedInteger()).bind("varType")),
+  varDecl(hasInitializer(exprWithCleanups(has(implicitCastExpr(has(
+  cxxMemberCallExpr(allOf(on(RegisterClas

[clang-tools-extra] r370527 - Make add_new_check.py's insertion of registerCheck<> match the sort order

2019-08-30 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Aug 30 13:47:02 2019
New Revision: 370527

URL: http://llvm.org/viewvc/llvm-project?rev=370527&view=rev
Log:
Make add_new_check.py's insertion of registerCheck<> match the sort order

Summary:
Following on from review comments in D65919 about the ordering
of the registerCheck<> calls. Sort based on the check name which might
be on the line after the registerCheck<>

Reviewers: aaron.ballman

Subscribers: cfe-commits, llvm-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66505

Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py

Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=370527&r1=370526&r2=370527&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Fri Aug 30 13:47:02 2019
@@ -165,31 +165,50 @@ def adapt_module(module_path, module, ch
 header_added = False
 header_found = False
 check_added = False
+check_fq_name = module + '-' + check_name
 check_decl = ('CheckFactories.registerCheck<' + check_name_camel +
-  '>(\n"' + module + '-' + check_name + '");\n')
+  '>(\n"' + check_fq_name + '");\n')
 
-for line in lines:
-  if not header_added:
-match = re.search('#include "(.*)"', line)
-if match:
-  header_found = True
-  if match.group(1) > check_name_camel:
+lines = iter(lines)
+try:
+  while True:
+line = lines.next()
+if not header_added:
+  match = re.search('#include "(.*)"', line)
+  if match:
+header_found = True
+if match.group(1) > check_name_camel:
+  header_added = True
+  f.write('#include "' + check_name_camel + '.h"\n')
+  elif header_found:
 header_added = True
 f.write('#include "' + check_name_camel + '.h"\n')
-elif header_found:
-  header_added = True
-  f.write('#include "' + check_name_camel + '.h"\n')
 
-  if not check_added:
-if line.strip() == '}':
-  check_added = True
-  f.write(check_decl)
-else:
-  match = re.search('registerCheck<(.*)>', line)
-  if match and match.group(1) > check_name_camel:
+if not check_added:
+  if line.strip() == '}':
 check_added = True
 f.write(check_decl)
-  f.write(line)
+  else:
+match = re.search('registerCheck<(.*)> *\( *(?:"([^"]*)")?', line)
+prev_line = None
+if match:
+  current_check_name = match.group(2)
+  if current_check_name is None:
+# If we didn't find the check name on this line, look on the
+# next one.
+prev_line = line
+line = lines.next()
+match = re.search(' *"([^"]*)"', line)
+if match:
+  current_check_name = match.group(1)
+  if current_check_name > check_fq_name:
+check_added = True
+f.write(check_decl)
+  if prev_line:
+f.write(prev_line)
+f.write(line)
+except StopIteration:
+  pass
 
 
 # Adds a release notes entry.


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


[clang] 3278948 - Fix `sed -e s@FOO@%/S@` and similar when there's @'s in the working directory

2019-12-03 Thread Daniel Sanders via cfe-commits

Author: Daniel Sanders
Date: 2019-12-03T15:44:01-08:00
New Revision: 327894859cc41c1730807f8a179aa880203262f5

URL: 
https://github.com/llvm/llvm-project/commit/327894859cc41c1730807f8a179aa880203262f5
DIFF: 
https://github.com/llvm/llvm-project/commit/327894859cc41c1730807f8a179aa880203262f5.diff

LOG: Fix `sed -e s@FOO@%/S@` and similar when there's @'s in the working 
directory

Jenkins sometimes starts a new working directory by appending @2 (or
incrementing the number if the @n suffix is already there). This causes
several clang tests to fail as:
  s@INPUT_DIR@%/S/Inputs@g
gets expanded to the invalid:
  s@INPUT_DIR@/path/to/workdir@2/Inputs@g
   ~~
where the part marked with ~'s is interpreted as the flags. These are
invalid and the test fails.

Previous fixes simply exchanged the @ character for another like | but
that's just moving the problem. Address it by adding an expansion that
escapes the @ character we're using as a delimiter as well as other magic
characters in the replacement of sed's s@@@.

There's still room for expansions to cause trouble though. One I ran into
while testing this was that having a directory called foo@bar causes lots
of `CHECK-NOT: foo` directives to match. There's also things like
directories containing `\1`

Added: 


Modified: 
clang/test/Index/index-module-with-vfs.m
clang/test/Modules/crash-vfs-ivfsoverlay.m
clang/test/Modules/double-quotes.m
clang/test/Modules/framework-public-includes-private.m
clang/test/VFS/external-names.c
clang/test/VFS/framework-import.m
clang/test/VFS/implicit-include.c
clang/test/VFS/include-mixed-real-and-virtual.c
clang/test/VFS/include-real-from-virtual.c
clang/test/VFS/include-virtual-from-real.c
clang/test/VFS/include.c
clang/test/VFS/incomplete-umbrella.m
clang/test/VFS/module-import.m
clang/test/VFS/module_missing_vfs.m
clang/test/VFS/real-path-found-first.m
clang/test/VFS/relative-path.c
clang/test/VFS/test_nonmodular.c
clang/test/VFS/umbrella-framework-import-skipnonexist.m
clang/test/VFS/vfsroot-include.c
clang/test/VFS/vfsroot-module.m
clang/test/VFS/vfsroot-with-overlay.c
llvm/utils/lit/lit/TestRunner.py

Removed: 




diff  --git a/clang/test/Index/index-module-with-vfs.m 
b/clang/test/Index/index-module-with-vfs.m
index 46fa68dfa130..06944d372d49 100644
--- a/clang/test/Index/index-module-with-vfs.m
+++ b/clang/test/Index/index-module-with-vfs.m
@@ -6,7 +6,7 @@ void foo() {
 }
 
 // RUN: rm -rf %t.cache
-// RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" 
%S/Inputs/vfsoverlay.yaml > %t.yaml
+// RUN: sed -e "s@INPUT_DIR@%{/S:regex_replacement}/Inputs@g" -e 
"s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsoverlay.yaml > %t.yaml
 // RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -F 
%t -I %t \
 // RUN:  -ivfsoverlay %t.yaml -Xclang -fdisable-module-hash | 
FileCheck %s
 

diff  --git a/clang/test/Modules/crash-vfs-ivfsoverlay.m 
b/clang/test/Modules/crash-vfs-ivfsoverlay.m
index 00992aa19fad..d2d2ccbd2546 100644
--- a/clang/test/Modules/crash-vfs-ivfsoverlay.m
+++ b/clang/test/Modules/crash-vfs-ivfsoverlay.m
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/m
 // RUN: cp %S/../VFS/Inputs/actual_module2.map %t/actual_module2.map
-// RUN: sed -e "s@INPUT_DIR@%/t@g" -e "s@OUT_DIR@%/t/example@g" \
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" -e 
"s@OUT_DIR@%{/t:regex_replacement}/example@g" \
 // RUN:   %S/../VFS/Inputs/vfsoverlay2.yaml > %t/srcvfs.yaml
 
 // RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \

diff  --git a/clang/test/Modules/double-quotes.m 
b/clang/test/Modules/double-quotes.m
index 4ce712ccc6c5..99187fc26654 100644
--- a/clang/test/Modules/double-quotes.m
+++ b/clang/test/Modules/double-quotes.m
@@ -4,7 +4,7 @@
 // RUN: %hmaptool write %S/Inputs/double-quotes/a.hmap.json %t/a.hmap
 // RUN: %hmaptool write %S/Inputs/double-quotes/x.hmap.json %t/x.hmap
 
-// RUN: sed -e "s@TEST_DIR@%/S/Inputs/double-quotes@g" \
+// RUN: sed -e "s@TEST_DIR@%{/S:regex_replacement}/Inputs/double-quotes@g" \
 // RUN:   %S/Inputs/double-quotes/z.yaml > %t/z.yaml
 
 // The output with and without modules should be the same

diff  --git a/clang/test/Modules/framework-public-includes-private.m 
b/clang/test/Modules/framework-public-includes-private.m
index 0f1e3a242a15..37c43e9a6390 100644
--- a/clang/test/Modules/framework-public-includes-private.m
+++ b/clang/test/Modules/framework-public-includes-private.m
@@ -4,7 +4,7 @@
 // RUN: %hmaptool write 
%S/Inputs/framework-public-includes-private/a.hmap.json %t/a.hmap
 // RUN: %hmaptool write 
%S/Inputs/framework-public-includes-private/z.hmap.json %t/z.hmap
 
-// RUN: sed -e "s@TEST_DIR@%/S/Inputs/framework-public-includes-private@g" \
+// RUN: sed -e 
"s@TEST_DIR@%{/S:regex_replacement}/Inputs/fra

r247683 - Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.

2015-09-15 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Sep 15 08:17:40 2015
New Revision: 247683

URL: http://llvm.org/viewvc/llvm-project?rev=247683&view=rev
Log:
Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.

Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, 
javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, 
llvm-commits, rengolin

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


Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=247683&r1=247682&r2=247683&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Tue Sep 15 08:17:40 2015
@@ -546,8 +546,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
   std::unique_ptr TargetParser(
   TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
 
-  std::unique_ptr IP(
-  TheTarget->createMCInstPrinter(llvm::Triple(TT), 1, *MAI, *MII, *MRI));
+  std::unique_ptr IP(TheTarget->createMCInstPrinter(
+  llvm::TargetTuple(llvm::Triple(TT)), 1, *MAI, *MII, *MRI));
 
   // Change to the Intel dialect.
   Parser->setAssemblerDialect(1);

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=247683&r1=247682&r2=247683&view=diff
==
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Sep 15 08:17:40 2015
@@ -358,7 +358,8 @@ static bool ExecuteAssembler(AssemblerIn
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
 MCInstPrinter *IP = TheTarget->createMCInstPrinter(
-llvm::Triple(Opts.Triple), Opts.OutputAsmVariant, *MAI, *MCII, *MRI);
+llvm::TargetTuple(llvm::Triple(Opts.Triple)), Opts.OutputAsmVariant,
+*MAI, *MCII, *MRI);
 MCCodeEmitter *CE = nullptr;
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
@@ -382,10 +383,10 @@ static bool ExecuteAssembler(AssemblerIn
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
   Opts.CPU);
-Triple T(Opts.Triple);
-Str.reset(TheTarget->createMCObjectStreamer(T, Ctx, *MAB, *Out, CE, *STI,
-Opts.RelaxAll,
-/*DWARFMustBeAtTheEnd*/ true));
+Triple TT(Opts.Triple);
+Str.reset(TheTarget->createMCObjectStreamer(
+llvm::TargetTuple(TT), Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
+/*DWARFMustBeAtTheEnd*/ true));
 Str.get()->InitSections(Opts.NoExecStack);
   }
 


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


r247686 - Revert r247684 - Replace Triple with a new TargetTuple ...

2015-09-15 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Sep 15 08:46:21 2015
New Revision: 247686

URL: http://llvm.org/viewvc/llvm-project?rev=247686&view=rev
Log:
Revert r247684 - Replace Triple with a new TargetTuple ...

LLDB needs to be updated in the same commit.


Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=247686&r1=247685&r2=247686&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Tue Sep 15 08:46:21 2015
@@ -546,8 +546,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
   std::unique_ptr TargetParser(
   TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
 
-  std::unique_ptr IP(TheTarget->createMCInstPrinter(
-  llvm::TargetTuple(llvm::Triple(TT)), 1, *MAI, *MII, *MRI));
+  std::unique_ptr IP(
+  TheTarget->createMCInstPrinter(llvm::Triple(TT), 1, *MAI, *MII, *MRI));
 
   // Change to the Intel dialect.
   Parser->setAssemblerDialect(1);

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=247686&r1=247685&r2=247686&view=diff
==
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Sep 15 08:46:21 2015
@@ -358,8 +358,7 @@ static bool ExecuteAssembler(AssemblerIn
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
 MCInstPrinter *IP = TheTarget->createMCInstPrinter(
-llvm::TargetTuple(llvm::Triple(Opts.Triple)), Opts.OutputAsmVariant,
-*MAI, *MCII, *MRI);
+llvm::Triple(Opts.Triple), Opts.OutputAsmVariant, *MAI, *MCII, *MRI);
 MCCodeEmitter *CE = nullptr;
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
@@ -383,10 +382,10 @@ static bool ExecuteAssembler(AssemblerIn
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
   Opts.CPU);
-Triple TT(Opts.Triple);
-Str.reset(TheTarget->createMCObjectStreamer(
-llvm::TargetTuple(TT), Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
-/*DWARFMustBeAtTheEnd*/ true));
+Triple T(Opts.Triple);
+Str.reset(TheTarget->createMCObjectStreamer(T, Ctx, *MAB, *Out, CE, *STI,
+Opts.RelaxAll,
+/*DWARFMustBeAtTheEnd*/ true));
 Str.get()->InitSections(Opts.NoExecStack);
   }
 


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


r247692 - Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.

2015-09-15 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Sep 15 09:08:28 2015
New Revision: 247692

URL: http://llvm.org/viewvc/llvm-project?rev=247692&view=rev
Log:
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and 
related. NFC.

Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, 
javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, 
llvm-commits, rengolin

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

Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=247692&r1=247691&r2=247692&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Tue Sep 15 09:08:28 2015
@@ -546,8 +546,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
   std::unique_ptr TargetParser(
   TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
 
-  std::unique_ptr IP(
-  TheTarget->createMCInstPrinter(llvm::Triple(TT), 1, *MAI, *MII, *MRI));
+  std::unique_ptr IP(TheTarget->createMCInstPrinter(
+  llvm::TargetTuple(llvm::Triple(TT)), 1, *MAI, *MII, *MRI));
 
   // Change to the Intel dialect.
   Parser->setAssemblerDialect(1);

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=247692&r1=247691&r2=247692&view=diff
==
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Sep 15 09:08:28 2015
@@ -358,7 +358,8 @@ static bool ExecuteAssembler(AssemblerIn
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
 MCInstPrinter *IP = TheTarget->createMCInstPrinter(
-llvm::Triple(Opts.Triple), Opts.OutputAsmVariant, *MAI, *MCII, *MRI);
+llvm::TargetTuple(llvm::Triple(Opts.Triple)), Opts.OutputAsmVariant,
+*MAI, *MCII, *MRI);
 MCCodeEmitter *CE = nullptr;
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
@@ -382,10 +383,10 @@ static bool ExecuteAssembler(AssemblerIn
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
   Opts.CPU);
-Triple T(Opts.Triple);
-Str.reset(TheTarget->createMCObjectStreamer(T, Ctx, *MAB, *Out, CE, *STI,
-Opts.RelaxAll,
-/*DWARFMustBeAtTheEnd*/ true));
+Triple TT(Opts.Triple);
+Str.reset(TheTarget->createMCObjectStreamer(
+llvm::TargetTuple(TT), Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
+/*DWARFMustBeAtTheEnd*/ true));
 Str.get()->InitSections(Opts.NoExecStack);
   }
 


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


r247702 - Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.

2015-09-15 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Sep 15 11:17:27 2015
New Revision: 247702

URL: http://llvm.org/viewvc/llvm-project?rev=247702&view=rev
Log:
Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and 
related. NFC.

Eric has replied and has demanded the patch be reverted.


Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=247702&r1=247701&r2=247702&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Tue Sep 15 11:17:27 2015
@@ -546,8 +546,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
   std::unique_ptr TargetParser(
   TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));
 
-  std::unique_ptr IP(TheTarget->createMCInstPrinter(
-  llvm::TargetTuple(llvm::Triple(TT)), 1, *MAI, *MII, *MRI));
+  std::unique_ptr IP(
+  TheTarget->createMCInstPrinter(llvm::Triple(TT), 1, *MAI, *MII, *MRI));
 
   // Change to the Intel dialect.
   Parser->setAssemblerDialect(1);

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=247702&r1=247701&r2=247702&view=diff
==
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Sep 15 11:17:27 2015
@@ -358,8 +358,7 @@ static bool ExecuteAssembler(AssemblerIn
   // FIXME: There is a bit of code duplication with addPassesToEmitFile.
   if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
 MCInstPrinter *IP = TheTarget->createMCInstPrinter(
-llvm::TargetTuple(llvm::Triple(Opts.Triple)), Opts.OutputAsmVariant,
-*MAI, *MCII, *MRI);
+llvm::Triple(Opts.Triple), Opts.OutputAsmVariant, *MAI, *MCII, *MRI);
 MCCodeEmitter *CE = nullptr;
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
@@ -383,10 +382,10 @@ static bool ExecuteAssembler(AssemblerIn
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
   Opts.CPU);
-Triple TT(Opts.Triple);
-Str.reset(TheTarget->createMCObjectStreamer(
-llvm::TargetTuple(TT), Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
-/*DWARFMustBeAtTheEnd*/ true));
+Triple T(Opts.Triple);
+Str.reset(TheTarget->createMCObjectStreamer(T, Ctx, *MAB, *Out, CE, *STI,
+Opts.RelaxAll,
+/*DWARFMustBeAtTheEnd*/ true));
 Str.get()->InitSections(Opts.NoExecStack);
   }
 


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


Re: [PATCH] D12600: [mips] Added support for using the command line options -Wa, -msoft-float and -Wa, -mhard-float.

2015-09-16 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM

It's not for this patch but I think we need a general solution to the -Wa,... 
options. It seems wrong to implement each assembler option twice (both with and 
without the '-Wa,').


http://reviews.llvm.org/D12600



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


r248276 - [mips] Added support for using the command line options -Wa, -msoft-float and -Wa, -mhard-float.

2015-09-22 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Sep 22 08:52:32 2015
New Revision: 248276

URL: http://llvm.org/viewvc/llvm-project?rev=248276&view=rev
Log:
[mips] Added support for using the command line options -Wa,-msoft-float and 
-Wa,-mhard-float.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-ias-Wa.s

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248276&r1=248275&r2=248276&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Sep 22 08:52:32 2015
@@ -2383,6 +2383,12 @@ static void CollectArgsForIntegratedAsse
   } else if (Value == "--break") {
 CmdArgs.push_back("-target-feature");
 CmdArgs.push_back("-use-tcc-in-div");
+  } else if (Value.startswith("-msoft-float")) {
+CmdArgs.push_back("-target-feature");
+CmdArgs.push_back("+soft-float");
+  } else if (Value.startswith("-mhard-float")) {
+CmdArgs.push_back("-target-feature");
+CmdArgs.push_back("-soft-float");
   } else {
 D.Diag(diag::err_drv_unsupported_option_argument)
 << A->getOption().getName() << Value;

Modified: cfe/trunk/test/Driver/mips-ias-Wa.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-ias-Wa.s?rev=248276&r1=248275&r2=248276&view=diff
==
--- cfe/trunk/test/Driver/mips-ias-Wa.s (original)
+++ cfe/trunk/test/Driver/mips-ias-Wa.s Tue Sep 22 08:52:32 2015
@@ -22,3 +22,28 @@
 // RUN:   FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s
 // TRAP-BOTH-BREAK-FIRST: -cc1as
 // TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" 
"-target-feature" "+use-tcc-in-div"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=MSOFT-FLOAT-DEFAULT %s
+// MSOFT-FLOAT-DEFAULT: -cc1as
+// MSOFT-FLOAT-DEFAULT-NOT: "-target-feature" "-soft-float"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,-msoft-float 2>&1 | \
+// RUN:   FileCheck -check-prefix=MSOFT-FLOAT-ON %s
+// MSOFT-FLOAT-ON: -cc1as
+// MSOFT-FLOAT-ON: "-target-feature" "+soft-float"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,-mhard-float 2>&1 | \
+// RUN:   FileCheck -check-prefix=MSOFT-FLOAT-OFF %s
+// MSOFT-FLOAT-OFF: -cc1as
+// MSOFT-FLOAT-OFF: "-target-feature" "-soft-float"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,-msoft-float,-mhard-float 2>&1 | \
+// RUN:   FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST %s
+// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: -cc1as
+// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: "-target-feature" "+soft-float" 
"-target-feature" "-soft-float"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,-mhard-float,-msoft-float 2>&1 | \
+// RUN:   FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s
+// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as
+// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" 
"-target-feature" "+soft-float"


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


[PATCH] D13057: [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.

2015-09-22 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: cfe-commits.

Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this
feature was added in MIPS*R3. However, other toolchains permit this and we
should do the same.

http://reviews.llvm.org/D13057

Files:
  lib/Driver/Tools.cpp
  test/CodeGen/mips-unsupported-nan.c

Index: test/CodeGen/mips-unsupported-nan.c
===
--- test/CodeGen/mips-unsupported-nan.c
+++ test/CodeGen/mips-unsupported-nan.c
@@ -1,24 +1,44 @@
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm 
-S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS3 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS4 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-NOT-MIPS32R3 
-check-prefix=CHECK-NAN2008 %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R6 
-check-prefix=CHECK-NAN2008 %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R6 
-check-prefix=CHECK-NAN2008 %s
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm 
-S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t
+//
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t
+//
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
+// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
+//
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
+// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
+//
+// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS32R6 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS64 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
+// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS64R6 %s < %t
+
+// NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option
+// NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option
 
 // CHECK-MIPS2: warning: ignoring '-mnan=2008' option because the 'mips2' 
architecture does not support it
 // CHECK-MIPS3: warning: ignoring '-mnan=2008' option because the 'mips3' 
architecture does not support it
 // CHECK-MIPS4: warning: ignoring '-mnan=2008' option because the 'mips4' 
architecture does not support it
 // CHECK-MIPS32: warning: ignoring '-mnan=2008' option because the 'mips32' 
architecture does not support it
-// CHECK-MIPS32R2: warning: ignoring '-mnan=2008' 

r248481 - [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.

2015-09-24 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Thu Sep 24 05:22:17 2015
New Revision: 248481

URL: http://llvm.org/viewvc/llvm-project?rev=248481&view=rev
Log:
[mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.

Summary:
Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this
feature was added in MIPS*R3. However, other toolchains permit this and we
should do the same.

Reviewers: atanasyan

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/mips-unsupported-nan.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248481&r1=248480&r2=248481&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 24 05:22:17 2015
@@ -6191,6 +6191,9 @@ void arm::appendEBLinkFlags(const ArgLis
 }
 
 mips::NanEncoding mips::getSupportedNanEncoding(StringRef &CPU) {
+  // Strictly speaking, mips32r2 and mips64r2 are NanLegacy-only since Nan2008
+  // was first introduced in Release 3. However, other compilers have
+  // traditionally allowed it for Release 2 so we should do the same.
   return (NanEncoding)llvm::StringSwitch(CPU)
   .Case("mips1", NanLegacy)
   .Case("mips2", NanLegacy)
@@ -6198,12 +6201,12 @@ mips::NanEncoding mips::getSupportedNanE
   .Case("mips4", NanLegacy)
   .Case("mips5", NanLegacy)
   .Case("mips32", NanLegacy)
-  .Case("mips32r2", NanLegacy)
+  .Case("mips32r2", NanLegacy | Nan2008)
   .Case("mips32r3", NanLegacy | Nan2008)
   .Case("mips32r5", NanLegacy | Nan2008)
   .Case("mips32r6", Nan2008)
   .Case("mips64", NanLegacy)
-  .Case("mips64r2", NanLegacy)
+  .Case("mips64r2", NanLegacy | Nan2008)
   .Case("mips64r3", NanLegacy | Nan2008)
   .Case("mips64r5", NanLegacy | Nan2008)
   .Case("mips64r6", Nan2008)

Modified: cfe/trunk/test/CodeGen/mips-unsupported-nan.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mips-unsupported-nan.c?rev=248481&r1=248480&r2=248481&view=diff
==
--- cfe/trunk/test/CodeGen/mips-unsupported-nan.c (original)
+++ cfe/trunk/test/CodeGen/mips-unsupported-nan.c Thu Sep 24 05:22:17 2015
@@ -1,24 +1,44 @@
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm 
-S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS3 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS4 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-NOT-MIPS32R3 
-check-prefix=CHECK-NAN2008 %s
-// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R6 
-check-prefix=CHECK-NAN2008 %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R2 
-check-prefix=CHECK-NANLEGACY %s
-// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 
-emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R6 
-check-prefix=CHECK-NAN2008 %s
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm 
-S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t
+//
+// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t
+//
+// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 
-emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
+// RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t
+//
+// RUN: %clang -target mipsel-

Re: [PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

2015-09-24 Thread Daniel Sanders via cfe-commits
dsanders added subscribers: rengolin, joerg.
dsanders added a comment.

+Renato and Joerg

I was going to say I think it's ok and the optimizer should be smart enough to 
factor out the common IsMips check but I've just realized there may be a better 
way. The current code is using an else after an (implicit) continue. If we made 
that continue explicit, we could make this code a bit neater and have a place 
to add target specific options.

I'm thinking something like:

  for (...) {
...
  
auto Arch = C.getDefaultToolChain().getArch();
  
if (C.getDefaultToolChain().getArch() == llvm::Triple::mips ||
C.getDefaultToolChain().getArch() == llvm::Triple::mipsel ||
C.getDefaultToolChain().getArch() == llvm::Triple::mips64 ||
C.getDefaultToolChain().getArch() == llvm::Triple::mips64el)
  if (mips::CollectArgsForIntegratedAssembler(...)
continue;
  
if (Value == "-force_cpusubtype_ALL")
  continue;
  
...
  
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
  }

Thoughts?


http://reviews.llvm.org/D13100



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


RE: [PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

2015-09-30 Thread Daniel Sanders via cfe-commits
Hi,

Sorry for the slow reply. I'm a bit behind on cfe-commits and it seems I 
dropped out of the CC list so it didn't land in my inbox.

Do you mean something like this?:
for (...) {
  ...

  switch (C.getDefaultToolChain().getArch()) {
  default:
break;
  case llvm::Triple::mips:
  case llvm::Triple::mipsel:
  case llvm::Triple::mips64:
  case llvm::Triple::mips64el:
if (Value == "--trap") {
  ...
  continue;
}
break;
  }

  if (Value == "-force_cpusubtype_ALL") {
...
continue;
  }

  ...

  D.Diag(diag::err_drv_unsupported_option_argument)
  << A->getOption().getName() << Value;
}

If so, that sounds good to me.
 
> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Joerg Sonnenberger via cfe-commits
> Sent: 24 September 2015 13:27
> To: cfe-commits@lists.llvm.org
> Subject: Re: [PATCH] D13100: [mips] Separated mips specific -Wa options, so
> that they are not checked on other platforms.
> 
> On Thu, Sep 24, 2015 at 10:22:29AM +, Daniel Sanders via cfe-commits
> wrote:
> > I'm thinking something like:
> 
> I think we really want to have an outer case, platform specific -Wa
> options are quite common. Only x86 is mostly getting by without them so
> far. I also think the switch is not that difficult to read.
> 
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r249306 - [mips][p5600] Add -mcpu=p5600 option.

2015-10-05 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Mon Oct  5 07:24:30 2015
New Revision: 249306

URL: http://llvm.org/viewvc/llvm-project?rev=249306&view=rev
Log:
[mips][p5600] Add -mcpu=p5600 option.

Summary:

Reviewers: vkalintiris, atanasyan

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/mips-abi.c
cfe/trunk/test/Driver/mips-as.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=249306&r1=249305&r2=249306&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct  5 07:24:30 2015
@@ -6312,6 +6312,7 @@ public:
 .Case("mips64r5", true)
 .Case("mips64r6", true)
 .Case("octeon", true)
+.Case("p5600", true)
 .Default(false);
   }
   const std::string& getCPU() const { return CPU; }

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249306&r1=249305&r2=249306&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct  5 07:24:30 2015
@@ -1809,7 +1809,7 @@ static bool findMIPSMultilibs(const llvm
   addMultilibFlag(isMips16(Args), "mips16", Flags);
   addMultilibFlag(CPUName == "mips32", "march=mips32", Flags);
   addMultilibFlag(CPUName == "mips32r2" || CPUName == "mips32r3" ||
-  CPUName == "mips32r5",
+  CPUName == "mips32r5" || CPUName == "p5600",
   "march=mips32r2", Flags);
   addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags);
   addMultilibFlag(CPUName == "mips64", "march=mips64", Flags);

Modified: cfe/trunk/test/Driver/mips-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=249306&r1=249305&r2=249306&view=diff
==
--- cfe/trunk/test/Driver/mips-abi.c (original)
+++ cfe/trunk/test/Driver/mips-abi.c Mon Oct  5 07:24:30 2015
@@ -99,6 +99,12 @@
 // MIPS-ARCH-32R2: "-target-abi" "o32"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:-march=p5600 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600 %s
+// MIPS-ARCH-P5600: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s
 // MIPS-ARCH-3264: "-target-cpu" "mips64"

Modified: cfe/trunk/test/Driver/mips-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-as.c?rev=249306&r1=249305&r2=249306&view=diff
==
--- cfe/trunk/test/Driver/mips-as.c (original)
+++ cfe/trunk/test/Driver/mips-as.c Mon Oct  5 07:24:30 2015
@@ -58,6 +58,11 @@
 // RUN:   | FileCheck -check-prefix=MIPS-32R2 %s
 // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" 
"-call_nonpic" "-EB"
 //
+// RUN: %clang -target mips-linux-gnu -march=p5600 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-P5600 %s
+// MIPS-P5600: as{{(.exe)?}}" "-march" "p5600" "-mabi" "32" "-mno-shared" 
"-call_nonpic" "-EB"
+//
 // RUN: %clang -target mips64-linux-gnu -march=octeon -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-OCTEON %s


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


Re: [PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

2015-10-06 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D13100



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


[PATCH] D12234: [mips][p5600] Add -mcpu=p5600 option.

2015-08-21 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: vkalintiris, atanasyan.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D12193: [mips][p5600] Added P5600 processor and 
initial scheduler..

Depends on D12193

http://reviews.llvm.org/D12234

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  test/Driver/mips-abi.c
  test/Driver/mips-as.c

Index: test/Driver/mips-as.c
===
--- test/Driver/mips-as.c
+++ test/Driver/mips-as.c
@@ -58,6 +58,11 @@
 // RUN:   | FileCheck -check-prefix=MIPS-32R2 %s
 // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" 
"-call_nonpic" "-EB"
 //
+// RUN: %clang -target mips-linux-gnu -march=p5600 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-P5600 %s
+// MIPS-P5600: as{{(.exe)?}}" "-march" "p5600" "-mabi" "32" "-mno-shared" 
"-call_nonpic" "-EB"
+//
 // RUN: %clang -target mips64-linux-gnu -march=octeon -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-OCTEON %s
Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -99,6 +99,12 @@
 // MIPS-ARCH-32R2: "-target-abi" "o32"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:-march=p5600 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600 %s
+// MIPS-ARCH-P5600: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s
 // MIPS-ARCH-3264: "-target-cpu" "mips64"
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1754,7 +1754,7 @@
   addMultilibFlag(isMips16(Args), "mips16", Flags);
   addMultilibFlag(CPUName == "mips32", "march=mips32", Flags);
   addMultilibFlag(CPUName == "mips32r2" || CPUName == "mips32r3" ||
-  CPUName == "mips32r5",
+  CPUName == "mips32r5" || CPUName == "p5600",
   "march=mips32r2", Flags);
   addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags);
   addMultilibFlag(CPUName == "mips64", "march=mips64", Flags);
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6263,6 +6263,7 @@
 .Case("mips64r5", true)
 .Case("mips64r6", true)
 .Case("octeon", true)
+.Case("p5600", true)
 .Default(false);
   }
   const std::string& getCPU() const { return CPU; }


Index: test/Driver/mips-as.c
===
--- test/Driver/mips-as.c
+++ test/Driver/mips-as.c
@@ -58,6 +58,11 @@
 // RUN:   | FileCheck -check-prefix=MIPS-32R2 %s
 // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB"
 //
+// RUN: %clang -target mips-linux-gnu -march=p5600 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-P5600 %s
+// MIPS-P5600: as{{(.exe)?}}" "-march" "p5600" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB"
+//
 // RUN: %clang -target mips64-linux-gnu -march=octeon -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-OCTEON %s
Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -99,6 +99,12 @@
 // MIPS-ARCH-32R2: "-target-abi" "o32"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:-march=p5600 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600 %s
+// MIPS-ARCH-P5600: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s
 // MIPS-ARCH-3264: "-target-cpu" "mips64"
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1754,7 +1754,7 @@
   addMultilibFlag(isMips16(Args), "mips16", Flags);
   addMultilibFlag(CPUName == "mips32", "march=mips32", Flags);
   addMultilibFlag(CPUName == "mips32r2" || CPUName == "mips32r3" ||
-  CPUName == "mips32r5",
+  CPUName == "mips32r5" || CPUName == "p5600",
   "march=mips32r2", Flags);
   addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags);
   addMultilibFlag(CPUName == "mips64", "march=mips64", Flags);
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6263,6 +6263,7 @@
 .Case(

r246765 - [mips] Added support for choosing between traps and breaks in the integrated assembler macros.

2015-09-03 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Thu Sep  3 07:58:39 2015
New Revision: 246765

URL: http://llvm.org/viewvc/llvm-project?rev=246765&view=rev
Log:
[mips] Added support for choosing between traps and breaks in the integrated 
assembler macros.

Summary: The command line options for these are -Wa,--trap and -Wa,--break.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: llvm-commits

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

Added:
cfe/trunk/test/Driver/mips-ias-Wa.s
Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=246765&r1=246764&r2=246765&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep  3 07:58:39 2015
@@ -2335,6 +2335,12 @@ static void CollectArgsForIntegratedAsse
   } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
  Value.startswith("-mhwdiv") || Value.startswith("-march")) {
 // Do nothing, we'll validate it later.
+  } else if (Value == "--trap") {
+CmdArgs.push_back("-target-feature");
+CmdArgs.push_back("+use-tcc-in-div");
+  } else if (Value == "--break") {
+CmdArgs.push_back("-target-feature");
+CmdArgs.push_back("-use-tcc-in-div");
   } else {
 D.Diag(diag::err_drv_unsupported_option_argument)
 << A->getOption().getName() << Value;

Added: cfe/trunk/test/Driver/mips-ias-Wa.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-ias-Wa.s?rev=246765&view=auto
==
--- cfe/trunk/test/Driver/mips-ias-Wa.s (added)
+++ cfe/trunk/test/Driver/mips-ias-Wa.s Thu Sep  3 07:58:39 2015
@@ -0,0 +1,24 @@
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=TRAP-DEFAULT %s
+// TRAP-DEFAULT: -cc1as
+// TRAP-DEFAULT-NOT: "-target-feature" "-use-tcc-in-div"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap 
2>&1 | \
+// RUN:   FileCheck -check-prefix=TRAP-ON %s
+// TRAP-ON: -cc1as
+// TRAP-ON: "-target-feature" "+use-tcc-in-div"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break 
2>&1 | \
+// RUN:   FileCheck -check-prefix=TRAP-OFF %s
+// TRAP-OFF: -cc1as
+// TRAP-OFF: "-target-feature" "-use-tcc-in-div"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,--trap,--break 2>&1 | \
+// RUN:   FileCheck -check-prefix=TRAP-BOTH-TRAP-FIRST %s
+// TRAP-BOTH-TRAP-FIRST: -cc1as
+// TRAP-BOTH-TRAP-FIRST: "-target-feature" "+use-tcc-in-div" "-target-feature" 
"-use-tcc-in-div"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,--break,--trap 2>&1 | \
+// RUN:   FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s
+// TRAP-BOTH-BREAK-FIRST: -cc1as
+// TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" 
"-target-feature" "+use-tcc-in-div"


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


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

2015-09-07 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits



Comment at: include/clang/Basic/Attr.td:841-842
@@ +840,4 @@
+def MipsInterrupt : InheritableAttr, TargetSpecificAttr {
+  // NOTE: if you add any additional spellings, ARMInterrupts's &
+  // MSP430Interrupt must match.
+  let Spellings = [GNU<"interrupt">];

if -> If
ARMInterrupts's -> ARMInterrupt's

Also, you should update the comments for ARMInterrupt and MSP430Interrupt to 
mention MipsInterrupt.


Comment at: include/clang/Basic/AttrDocs.td:690-691
@@ +689,4 @@
+The parameter passed to the interrupt attribute is optional, but if
+provided it must be a string literal with one of the following values: "sw0",
+"sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5" or "eic".
+

Aside from "eic" shouldn't these be "vector=..."?


Comment at: lib/Sema/SemaDeclAttr.cpp:4222
@@ -4192,3 +4221,3 @@
 handleMSP430InterruptAttr(S, D, Attr);
-  else
+  else if (S.Context.getTargetInfo().getTriple().getArch() == 
llvm::Triple::arm)
 handleARMInterruptAttr(S, D, Attr);

I think you also need to cover aarch64, thumb, etc. It's probably best to leave 
it as an else clause and add mips above it.


http://reviews.llvm.org/D10802



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


r251430 - [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

2015-10-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Oct 27 13:04:42 2015
New Revision: 251430

URL: http://llvm.org/viewvc/llvm-project?rev=251430&view=rev
Log:
[mips] Separated mips specific -Wa options, so that they are not checked on 
other platforms.

Summary: This is a follow on to post review comments on revision r248276.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: joerg, rengolin, cfe-commits

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251430&r1=251429&r2=251430&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 27 13:04:42 2015
@@ -2386,6 +2386,36 @@ static void CollectArgsForIntegratedAsse
 continue;
   }
 
+  switch (C.getDefaultToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+if (Value == "--trap") {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("+use-tcc-in-div");
+  continue;
+}
+if (Value == "--break") {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("-use-tcc-in-div");
+  continue;
+}
+if (Value.startswith("-msoft-float")) {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("+soft-float");
+  continue;
+}
+if (Value.startswith("-mhard-float")) {
+  CmdArgs.push_back("-target-feature");
+  CmdArgs.push_back("-soft-float");
+  continue;
+}
+break;
+  }
+
   if (Value == "-force_cpusubtype_ALL") {
 // Do nothing, this is the default and we don't support anything else.
   } else if (Value == "-L") {
@@ -2418,18 +2448,6 @@ static void CollectArgsForIntegratedAsse
   } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
  Value.startswith("-mhwdiv") || Value.startswith("-march")) {
 // Do nothing, we'll validate it later.
-  } else if (Value == "--trap") {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("+use-tcc-in-div");
-  } else if (Value == "--break") {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("-use-tcc-in-div");
-  } else if (Value.startswith("-msoft-float")) {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("+soft-float");
-  } else if (Value.startswith("-mhard-float")) {
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back("-soft-float");
   } else {
 D.Diag(diag::err_drv_unsupported_option_argument)
 << A->getOption().getName() << Value;


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


r275967 - [mips] Correct label prefixes for N32 and N64.

2016-07-19 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Jul 19 05:49:03 2016
New Revision: 275967

URL: http://llvm.org/viewvc/llvm-project?rev=275967&view=rev
Log:
[mips] Correct label prefixes for N32 and N64.

Summary:
N32 and N64 follow the standard ELF conventions (.L) whereas O32 uses its own
($).

This fixes the majority of object differences between -fintegrated-as and
-fno-integrated-as.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

Differential Revision: https://reviews.llvm.org/D22412


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/target-data.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=275967&r1=275966&r2=275967&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Jul 19 05:49:03 2016
@@ -7105,9 +7105,9 @@ class MipsTargetInfo : public TargetInfo
 if (ABI == "o32")
   Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
 else if (ABI == "n32")
-  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+  Layout = "m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
 else if (ABI == "n64")
-  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+  Layout = "m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128";
 else
   llvm_unreachable("Invalid ABI");
 

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=275967&r1=275966&r2=275967&view=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Tue Jul 19 05:49:03 2016
@@ -40,19 +40,19 @@
 
 // RUN: %clang_cc1 -triple mips64el-linux-gnu -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=MIPS-64EL
-// MIPS-64EL: target datalayout = "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
+// MIPS-64EL: target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
 
 // RUN: %clang_cc1 -triple mips64el-linux-gnu -o - -emit-llvm -target-abi n32 \
 // RUN: %s | FileCheck %s -check-prefix=MIPS-64EL-N32
-// MIPS-64EL-N32: target datalayout = 
"e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"
+// MIPS-64EL-N32: target datalayout = 
"e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"
 
 // RUN: %clang_cc1 -triple mips64-linux-gnu -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=MIPS-64EB
-// MIPS-64EB: target datalayout = "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
+// MIPS-64EB: target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
 
 // RUN: %clang_cc1 -triple mips64-linux-gnu -o - -emit-llvm %s -target-abi n32 
\
 // RUN: | FileCheck %s -check-prefix=MIPS-64EB-N32
-// MIPS-64EB-N32: target datalayout = 
"E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"
+// MIPS-64EB-N32: target datalayout = 
"E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"
 
 // RUN: %clang_cc1 -triple powerpc64-lv2 -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PS3


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


Re: [PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-07-21 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 64870.
dsanders added a comment.

Refresh and ping


https://reviews.llvm.org/D21070

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -69,6 +69,10 @@
   /// The name of the target triple to assemble for.
   std::string Triple;
 
+  /// The name of the ABI to assembler for or the empty string for the default
+  /// ABI.
+  std::string ABI;
+
   /// If given, the name of the target CPU to determine which instructions
   /// are legal.
   std::string CPU;
@@ -134,6 +138,7 @@
 public:
   AssemblerInvocation() {
 Triple = "";
+ABI = "";
 NoInitialTextSection = 0;
 InputFile = "-";
 OutputPath = "-";
@@ -185,13 +190,24 @@
 
   // Target Options
   Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.ABI = Args.getLastArgValue(OPT_target_abi);
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.Features = Args.getAllArgValues(OPT_target_feature);
 
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
 
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
+
   // Language Options
   Opts.IncludePaths = Args.getAllArgValues(OPT_I);
   Opts.NoInitialTextSection = Args.hasArg(OPT_n);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2306,6 +2306,16 @@
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
 }
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1249,7 +1249,7 @@
   // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the
   // default for mips64(el)?-img-linux-gnu.
   if (Triple.getVendor() == llvm::Triple::ImaginationTechnologies &&
-  Triple.getEnvironment() == llvm::Triple::GNU) {
+  Triple.isGNUEnvironment()) {
 DefMips32CPU = "mips32r6";
 DefMips64CPU = "mips64r6";
   }
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2404,7 +2404,7 @@
 
   if (TargetTriple.getVendor() == llvm::Triple::ImaginationTechnologies &&
   TargetTriple.getOS() == llvm::Triple::Linux &&
-  TargetTriple.getEnvironment() == llvm::Triple::GNU)
+  TargetTriple.isGNUEnvironment())
 return findMipsImgMultilibs(Flags, NonExistent, Result);
 
   if (findMipsCsMultilibs(Flags, NonExistent, Result))
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7145,10 +7145,22 @@
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-setABI((getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel)
-   ? "o32"
-   : "n64");
+if (getTriple().getEnvironment() == llvm::Triple::ABI32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABI32 ||
+getTriple().getEnvironment() == llvm::Triple::AndroidABI32)
+  setABI("o32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABIN32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABIN32)
+  setABI("n32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::GNUABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::AndroidABI64)
+  setABI("n64");
+else
+  setABI((getTriple().getArch() == llvm::Triple::mips ||
+  getTriple().getArch() == llvm::Triple::mipsel)
+ ? "o32"
+ : "

[PATCH] D22679: [mips][ias] Enable IAS by default for N64 on Debian mips64el.

2016-07-22 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: sdardis.
dsanders added a subscriber: cfe-commits.

Unfortunately we can't enable it for all N64 because it is not yet possible to  
  
distinguish N32 from N64 from the triple on other environments. 


  
N64 has been confirmed to produce identical (within reason) objects to GAS  
  
during stage 2 of compiler recursion on N64-abi Fedora. Unfortunately,  
 
Fedora's triples do not distinguish N32 from N64 so I can't enable it by
  
default there. I'm currently repeating this testing for Debian mips64el but 
  
it's very unlikely to produce a different result.

https://reviews.llvm.org/D22679

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2758,6 +2758,13 @@
   case llvm::Triple::mips:
   case llvm::Triple::mipsel:
 return true;
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+// Enabled for Debian mips64/mips64el only. Other targets are unable to
+// distinguish N32 from N64.
+if (getTriple().getEnvironment() == llvm::Triple::GNUABI64)
+  return true;
+return false;
   default:
 return false;
   }


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2758,6 +2758,13 @@
   case llvm::Triple::mips:
   case llvm::Triple::mipsel:
 return true;
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+// Enabled for Debian mips64/mips64el only. Other targets are unable to
+// distinguish N32 from N64.
+if (getTriple().getEnvironment() == llvm::Triple::GNUABI64)
+  return true;
+return false;
   default:
 return false;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r276361 - Reverting r275115 which caused PR28634.

2016-07-27 Thread Daniel Sanders via cfe-commits
Thanks for reverting this, our internal buildbots have gone green again.

> Can you add a non-regression test case?
> (It seems the test-suite didn’t catch this bug right?)

Do we have any upstream buildbots using -O0? I haven't investigated very far* 
but -O0 seems to be the common factor between our internal builders that 
failed. Also, adding -O1 to the failing command causes the compilation failure 
to disappear on MultiSource/Applications/JM/ldecod/loopFilter.c. I haven't 
tested the other failing tests yet but they were:
MultiSource/Applications/SPASS/SPASS
MultiSource/Benchmarks/Olden/bh/bh
MultiSource/Applications/viterbi/viterbi
MultiSource/Applications/sqlite3/sqlite3
MultiSource/Applications/JM/lencod/lencod
MultiSource/Applications/hbd/hbd
MultiSource/Benchmarks/MallocBench/gs/gs
MultiSource/Benchmarks/ASC_Sequoia/AMGmk/AMGmk
MultiSource/Benchmarks/MiBench/consumer-typeset/consumer-typeset

* We've had higher priority buildbot issues over the last couple weeks and I'm 
still tracking down a particularly unpleasant one where failing 'ninja 
check-all' somehow manages to kill all _future_ python processes as they're 
being created. I'm having to reboot the machine after each attempt at bisecting 
it.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Mehdi Amini via cfe-commits
> Sent: 22 July 2016 01:31
> To: Wolfgang Pieb
> Cc: cfe-commits@lists.llvm.org
> Subject: Re: r276361 - Reverting r275115 which caused PR28634.
> 
> 
> > On Jul 21, 2016, at 4:28 PM, Wolfgang Pieb via cfe-commits  comm...@lists.llvm.org> wrote:
> >
> > Author: wolfgangp
> > Date: Thu Jul 21 18:28:18 2016
> > New Revision: 276361
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=276361&view=rev
> > Log:
> > Reverting r275115 which caused PR28634.
> > When empty (forwarding) basic blocks that are referenced by user labels
> > are removed, incorrect code may be generated.
> 
> Can you add a non-regression test case?
> (It seems the test-suite didn’t catch this bug right?)
> 
> Thanks,
> 
> —
> Mehdi
> 
> 
> >
> >
> > Removed:
> >cfe/trunk/test/CodeGen/forwarding-blocks-if.c
> > Modified:
> >cfe/trunk/lib/CodeGen/CGStmt.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> > URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=276361&r1=276360&r2=27
> 6361&view=diff
> >
> ==
> 
> > --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Thu Jul 21 18:28:18 2016
> > @@ -623,14 +623,7 @@ void CodeGenFunction::EmitIfStmt(const I
> > RunCleanupsScope ThenScope(*this);
> > EmitStmt(S.getThen());
> >   }
> > -  {
> > -auto CurBlock = Builder.GetInsertBlock();
> > -EmitBranch(ContBlock);
> > -// Eliminate any empty blocks that may have been created by nested
> > -// control flow statements in the 'then' clause.
> > -if (CurBlock)
> > -  SimplifyForwardingBlocks(CurBlock);
> > -  }
> > +  EmitBranch(ContBlock);
> >
> >   // Emit the 'else' code if present.
> >   if (const Stmt *Else = S.getElse()) {
> > @@ -646,12 +639,7 @@ void CodeGenFunction::EmitIfStmt(const I
> > {
> >   // There is no need to emit line number for an unconditional branch.
> >   auto NL = ApplyDebugLocation::CreateEmpty(*this);
> > -  auto CurBlock = Builder.GetInsertBlock();
> >   EmitBranch(ContBlock);
> > -  // Eliminate any empty blocks that may have been created by nested
> > -  // control flow statements emitted in the 'else' clause.
> > -  if (CurBlock)
> > -SimplifyForwardingBlocks(CurBlock);
> > }
> >   }
> >
> >
> > Removed: cfe/trunk/test/CodeGen/forwarding-blocks-if.c
> > URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/test/CodeGen/forwarding-blocks-
> if.c?rev=276360&view=auto
> >
> ==
> 
> > --- cfe/trunk/test/CodeGen/forwarding-blocks-if.c (original)
> > +++ cfe/trunk/test/CodeGen/forwarding-blocks-if.c (removed)
> > @@ -1,36 +0,0 @@
> > -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
> > -// Check that no empty blocks are generated for nested ifs.
> > -
> > -extern void func();
> > -
> > -int f0(int val) {
> > -  if (val == 0) {
> > -func();
> > -  } else if (val == 1) {
> > -func();
> > -  }
> > -  return 0;
> > -}
> > -
> > -// CHECK-LABEL: define {{.*}}i32 @f0
> > -// CHECK: call void {{.*}} @func
> > -// CHECK: call void {{.*}} @func
> > -// CHECK: br label %[[RETBLOCK1:[^ ]*]]
> > -// CHECK: [[RETBLOCK1]]:
> > -// CHECK-NOT: br label
> > -// CHECK: ret i32
> > -
> > -int f1(int val, int g) {
> > -  if (val == 0)
> > -if (g == 1) {
> > -  func();
> > -}
> > -  return 0;
> > -}
> > -
> > -// CHECK-LABEL: define {{.*}}i32 @f1
> > -// CHECK: call void {{.*}} @func
> > -// CHECK: br label %[

Re: [PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-07-28 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 65918.
dsanders added a comment.

Refresh and ping


https://reviews.llvm.org/D21070

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -69,6 +69,10 @@
   /// The name of the target triple to assemble for.
   std::string Triple;
 
+  /// The name of the ABI to assembler for or the empty string for the default
+  /// ABI.
+  std::string ABI;
+
   /// If given, the name of the target CPU to determine which instructions
   /// are legal.
   std::string CPU;
@@ -134,6 +138,7 @@
 public:
   AssemblerInvocation() {
 Triple = "";
+ABI = "";
 NoInitialTextSection = 0;
 InputFile = "-";
 OutputPath = "-";
@@ -185,13 +190,24 @@
 
   // Target Options
   Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.ABI = Args.getLastArgValue(OPT_target_abi);
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.Features = Args.getAllArgValues(OPT_target_feature);
 
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
 
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
+
   // Language Options
   Opts.IncludePaths = Args.getAllArgValues(OPT_I);
   Opts.NoInitialTextSection = Args.hasArg(OPT_n);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2309,6 +2309,16 @@
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
 }
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1249,7 +1249,7 @@
   // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the
   // default for mips64(el)?-img-linux-gnu.
   if (Triple.getVendor() == llvm::Triple::ImaginationTechnologies &&
-  Triple.getEnvironment() == llvm::Triple::GNU) {
+  Triple.isGNUEnvironment()) {
 DefMips32CPU = "mips32r6";
 DefMips64CPU = "mips64r6";
   }
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2409,7 +2409,7 @@
 
   if (TargetTriple.getVendor() == llvm::Triple::ImaginationTechnologies &&
   TargetTriple.getOS() == llvm::Triple::Linux &&
-  TargetTriple.getEnvironment() == llvm::Triple::GNU)
+  TargetTriple.isGNUEnvironment())
 return findMipsImgMultilibs(Flags, NonExistent, Result);
 
   if (findMipsCsMultilibs(Flags, NonExistent, Result))
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7161,10 +7161,22 @@
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-setABI((getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel)
-   ? "o32"
-   : "n64");
+if (getTriple().getEnvironment() == llvm::Triple::ABI32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABI32 ||
+getTriple().getEnvironment() == llvm::Triple::AndroidABI32)
+  setABI("o32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABIN32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABIN32)
+  setABI("n32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::GNUABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::AndroidABI64)
+  setABI("n64");
+else
+  setABI((getTriple().getArch() == llvm::Triple::mips ||
+  getTriple().getArch() == llvm::Triple::mipsel)
+ ? "o32"
+ : "

Re: [PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-08-05 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

One last ping since I need to either commit this series next week or hand over 
to a colleague to continue it.


https://reviews.llvm.org/D21070



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


Re: [PATCH] D21072: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-08-05 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

One last ping since I need to either commit this series next week or hand over 
to a colleague to continue it.


https://reviews.llvm.org/D21072



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


Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-03 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

FWIW, the changes in the last revision look minor to me. I doubt it affects the 
LGTM

> Do we have any test cases for arbitrary sized trivally copyable structures? 
> That might also be needed.


The failures in 3.8.0rc1 (and presumably still occur in the 3.8.0rc2 that was 
tagged last night) were all related to 64-bit atomics.


http://reviews.llvm.org/D16613



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


Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-09 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.

LGTM


http://reviews.llvm.org/D16613



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


RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-11 Thread Daniel Sanders via cfe-commits
Hi,

In my latests rc2+patches build I've also found that we need to rename 
HAVE_CXX_ATOMICS_WITH_LIB to something like LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB. 
It's currently re-using the result of LLVM's check which doesn't include 64-bit 
atomics.

From: Vasileios Kalintiris
Sent: 09 February 2016 23:50
To: h...@chromium.org
Cc: cfe-commits@lists.llvm.org; Daniel Sanders; mclow.li...@gmail.com
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Please wait before merging this as it breaks LLVM bootstraps when using the 
-gcc-toolchain option and the system's default gcc installation does not 
provide libatomic. We have to check LIBCXX_GCC_TOOLCHAIN in our test. I'll 
create a patch tomorrow and I'll let you know when it's okay to merge them. In 
the meantime, I reverted it in r260323.

- Vasileios

From: Vasileios Kalintiris
Sent: 09 February 2016 18:56
To: h...@chromium.org
Cc: cfe-commits@lists.llvm.org; Daniel Sanders; mclow.li...@gmail.com
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Can we merge this on the 3.8 release branch? It fixes libcxx builds on MIPS by 
linking with libatomic when needed. Also, all the x86_64 and ARM buildbots for 
libcxx look good.

Thanks,
Vasileios


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Vasileios 
Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 09 February 2016 17:00
To: cfe-commits@lists.llvm.org
Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether we 
need to link with libatomic.

Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

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

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Tue Feb  9 11:00:38 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)

 # Check compiler flags

@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_

[PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-11 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: mclow.lists, hans.
dsanders added a subscriber: cfe-commits.

On glibc, the bits used for the various character classes is endian dependant
(see _ISbit() in ctypes.h) but __regex_word does not account for this and uses
a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the
bit for graphic characters which causes '-', '@', etc. to be considered a word
character.

Fixed this by defining the value using _ISbit(15) on glibc systems.

Fixes PR26476.

http://reviews.llvm.org/D17132

Files:
  include/regex

Index: include/regex
===
--- include/regex
+++ include/regex
@@ -976,7 +976,12 @@
 typedef locale  locale_type;
 typedef ctype_base::maskchar_class_type;
 
+#if defined(__GLIBC__)
+static const char_class_type __regex_word = 
static_cast(_ISbit(15));
+#else
 static const char_class_type __regex_word = 0x80;
+#endif
+
 private:
 locale __loc_;
 const ctype* __ct_;


Index: include/regex
===
--- include/regex
+++ include/regex
@@ -976,7 +976,12 @@
 typedef locale  locale_type;
 typedef ctype_base::maskchar_class_type;
 
+#if defined(__GLIBC__)
+static const char_class_type __regex_word = static_cast(_ISbit(15));
+#else
 static const char_class_type __regex_word = 0x80;
+#endif
+
 private:
 locale __loc_;
 const ctype* __ct_;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-11 Thread Daniel Sanders via cfe-commits
dsanders added inline comments.


Comment at: include/regex:980
@@ +979,3 @@
+#if defined(__GLIBC__)
+static const char_class_type __regex_word = 
static_cast(_ISbit(15));
+#else

The static_cast is necessary to silence a false-positive warning on 
little-endian. _ISbit(15) expands to:
  ((15) < 8 ? ((1 << (15)) << 8) : ((1 << (15)) >> 8))
which simplifies to:
  0 ? 0x80 : 0x80
Clang warns about the truncation of the 0x80 to char_class_type (unsigned 
short) even though this value doesn't matter.



http://reviews.llvm.org/D17132



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


Re: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-11 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

In http://reviews.llvm.org/D17132#349993, @mclow.lists wrote:

> In r260527, I added some tests to catch this if it happens again.
>
> If those tests fail w/o this patch and succeed with, then I'm happy with 
> applying it.


The tests in r260527, don't fail without this patch because it doesn't check 
'graph'. It also doesn't fail when I add it. The reason for this is that 
std::ctype_base::graph isn't the same as _ISgraph:

  std::regex_traits::__regex_word = 128
  std::ctype_base::graph = 1036
  _ISgraph = 128

ctype_base is defining graph by combining alnum and punct instead of using the 
_IS* macro like the other bits.

I'm not sure where it's getting the definition of classic_table. Presumably 
it's coming from glibc because adding a #error next to the optional one in 
libcxx doesn't cause build failures.


http://reviews.llvm.org/D17132



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


Re: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-11 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

I haven't fully proven this yet (because I haven't found the table), but I 
think that C and C++ are sharing the same table and we're colliding with a bit 
that only makes sense to C. This would explain why your tests don't fail but 
regex_word still collides with _ISgraph in the table.

I've confirmed that glibc is testing for _ISgraph, and libstdc++ defines 
ctype_base as per the standard. I just need to find the table.


http://reviews.llvm.org/D17132



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


Re: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-11 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

The table is apparently inside locale-archive and it looks like C and C++ both 
share this table. At this point I'm satisfied that the table also contains 
information that C++ isn't interested in and it's this data that regex_word 
collides with.

Are you happy to lift the condition that your tests fail without my patch?


http://reviews.llvm.org/D17132



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


RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-12 Thread Daniel Sanders via cfe-commits
> Fixed in r260531.

Thanks

> I think we will eventually want to merge the following commits, assuming they 
> don't regress the build, especially with the -gcc-toolchain option.

Yes, the MIPS release needs these changes to fix the ~24 tests in PR26369.

From: Eric Fiselier [mailto:e...@efcs.ca]
Sent: 11 February 2016 16:08
To: Daniel Sanders
Cc: Vasileios Kalintiris; h...@chromium.org; mclow.li...@gmail.com; 
cfe-commits@lists.llvm.org
Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

>  we need to rename HAVE_CXX_ATOMICS_WITH_LIB to something like 
> LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB.
Fixed in r260531.

I think we will eventually want to merge the following commits, assuming they 
don't regress the build, especially with the -gcc-toolchain option.

- [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out whether 
we need to link with libatomic."
- [libcxx] r260524 - Fix r260515 - Correct typos in CMake changes
- [libcxx] r260531 - Rename CheckLibcxxAtomic.cmake variable result names so 
they don't clash with LLVM

@Marshall Any objections?

On Thu, Feb 11, 2016 at 2:18 AM, Daniel Sanders via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Hi,

In my latests rc2+patches build I've also found that we need to rename 
HAVE_CXX_ATOMICS_WITH_LIB to something like LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB. 
It's currently re-using the result of LLVM's check which doesn't include 64-bit 
atomics.

From: Vasileios Kalintiris
Sent: 09 February 2016 23:50
To: h...@chromium.org<mailto:h...@chromium.org>
Cc: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>; Daniel 
Sanders; mclow.li...@gmail.com<mailto:mclow.li...@gmail.com>
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Please wait before merging this as it breaks LLVM bootstraps when using the 
-gcc-toolchain option and the system's default gcc installation does not 
provide libatomic. We have to check LIBCXX_GCC_TOOLCHAIN in our test. I'll 
create a patch tomorrow and I'll let you know when it's okay to merge them. In 
the meantime, I reverted it in r260323.

- Vasileios

From: Vasileios Kalintiris
Sent: 09 February 2016 18:56
To: h...@chromium.org<mailto:h...@chromium.org>
Cc: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>; Daniel 
Sanders; mclow.li...@gmail.com<mailto:mclow.li...@gmail.com>
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Can we merge this on the 3.8 release branch? It fixes libcxx builds on MIPS by 
linking with libatomic when needed. Also, all the x86_64 and ARM buildbots for 
libcxx look good.

Thanks,
Vasileios


From: cfe-commits 
[cfe-commits-boun...@lists.llvm.org<mailto:cfe-commits-boun...@lists.llvm.org>] 
on behalf of Vasileios Kalintiris via cfe-commits 
[cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>]
Sent: 09 February 2016 17:00
To: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>
Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether we 
need to link with libatomic.

Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

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

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in<http://lit.site.cfg.in>

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of

Re: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-16 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Sorry for the early ping but I need to fix this for rc3 (which Hans is hoping 
to tag mid-week) and I'm stuck as long as the requirement that the C++ tests in 
r260527 fail without my patch is in place.

I'm happy to make this '#ifdef __mips__' if that helps.


http://reviews.llvm.org/D17132



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


RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-16 Thread Daniel Sanders via cfe-commits
Hi Ben,

Does 'this change' refer to r260235 or r260961?

From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Craig, Ben 
via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 16 February 2016 21:09
To: cfe-commits@lists.llvm.org
Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

FYI, this change and the LLVM version have each broken my libcxx
builds.  I cross compile from Linux x64 to Hexagon, and my host machine
doesn't have .  The LLVM change was particularly offensive
because I wasn't planning on building LLVM itself.

I have since worked around the issue by making my cmake invocation longer.

I'm not sure what you can do for the LLVM check, but if you can use the
libcxx headers directly for the  check, while still using all
the custom flags and tools that I pass on the command line, then I
should be able to remove the explicit setting of
"LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB" in the future.

On 2/16/2016 2:09 PM, Vasileios Kalintiris via cfe-commits wrote:
> Hi Hans,
>
>> Or is this comment on PR26059 all that needs to be done for 3.8?
> That's correct. I wrote that comment in order to clarify which bits we should 
> merge in 3.8.
>
> The latest commit:
>
> - [libcxx] r260961 - Issue a warning instead of fatal errors when checks for 
> libatomic fail."
>
> makes sure that my changes don't break older configurations that used to work 
> previously, by emitting a warning message instead of a fatal error.
>
> I had to turn the error to warning because there are cases where the host 
> compiler doesn't provide the  and  headers when 
> bootstrapping llvm.
>
> The correct solution would be to use the headers provided from libc++ itself. 
> However, I wanted to take the safe route for the 3.8 branch and provide the 
> elegant solution on the trunk after having the proper discussion with the 
> libc++ devs.
>
> Thanks,
> Vasileios
>
> 
> From: hwennb...@google.com [hwennb...@google.com] on behalf of Hans Wennborg 
> [h...@chromium.org]
> Sent: 16 February 2016 19:53
> To: Vasileios Kalintiris
> Cc: Eric Fiselier; Daniel Sanders; mclow.li...@gmail.com; 
> cfe-commits@lists.llvm.org
> Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out 
> whether we need to link with libatomic.
>
> Or is this comment on PR26059 all that needs to be done for 3.8?
>
> "Bug 26369, which has been fixed with r260961, requires the following
> commits to get merged on the release branch:
>
> - [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out
> whether we need to link with libatomic."
> - [libcxx] r260524 - Fix r260515 - Correct typos in CMake changes
> - [libcxx] r260531 - Rename CheckLibcxxAtomic.cmake variable result
> names so they don't clash with LLVM
> - [libcxx] r260961 - Issue a warning instead of fatal errors when
> checks for libatomic fail."
>
> Thanks,
> Hans
>
> On Tue, Feb 16, 2016 at 11:47 AM, Hans Wennborg  wrote:
>> Do I understand correctly that there are still issues here's that are not 
>> fixed?
>>
>> (I'm trying to understand if there is something here to merge for 3.8,
>> but I'm having trouble following these commits.)
>>
>> On Tue, Feb 16, 2016 at 6:44 AM, Vasileios Kalintiris
>>  wrote:
>>> I changed the type of message from fatal_error to warning in r260961. While
>>> the test for atomics works fine in most cases, it fails because we include
>>>  and , and the user's host compiler might not provide them
>>> during a bootstrap (see PR26631 and PR26622).
>>>
>>> Does anyone have any idea how to tackle this problem? As suggested by the
>>> bug reports, we could include the headers provided by libc++. However, I'm
>>> not sure whether we are supposed to do that during configuration time.
>>>
>>> - Vasileios
>>>
>>>
>>> 
>>> From: Eric Fiselier [e...@efcs.ca]
>>> Sent: 11 February 2016 16:08
>>> To: Daniel Sanders
>>> Cc: Vasileios Kalintiris; h...@chromium.org; mclow.li...@gmail.com;
>>> cfe-commits@lists.llvm.org
>>> Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out
>>> whether we need to link with libatomic.
>>>
>>>>   we need to rename HAVE_CXX_ATOMICS_WITH_LIB to something like
>>>> LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB.
>>> Fixed in r260531.
>>>
>>> I think we will eventually want to merge the following commits, assuming
&

RE: [PATCH] D17132: [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-16 Thread Daniel Sanders via cfe-commits
Thanks. I'll commit using a MIPS ifdef in the morning and merge once it's 
through the buildbots.

From: Marshall Clow [mclow.li...@gmail.com]
Sent: 16 February 2016 22:37
To: Daniel Sanders; h...@chromium.org; mclow.li...@gmail.com
Cc: cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D17132: [libcxx] Fix definition of 
regex_traits::__regex_word on big-endian glibc systems

mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Let's wrap it in a MIPS ifdef for the moment, and then, post-release we can see 
if that can be relaxed.

Given that, LGTM.


http://reviews.llvm.org/D17132



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


[libcxx] r261088 - [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc systems

2016-02-17 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Wed Feb 17 07:16:31 2016
New Revision: 261088

URL: http://llvm.org/viewvc/llvm-project?rev=261088&view=rev
Log:
[libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc 
systems

Summary:
On glibc, the bits used for the various character classes is endian dependant
(see _ISbit() in ctypes.h) but __regex_word does not account for this and uses
a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the
bit for graphic characters which causes '-', '@', etc. to be considered a word
character.

Fixed this by defining the value using _ISbit(15) on MIPS glibc systems. We've
restricted this to MIPS for now to avoid the risk of introducing failures in
other targets.

Fixes PR26476.

Reviewers: hans, mclow.lists

Subscribers: dsanders, cfe-commits

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

Modified:
libcxx/trunk/include/regex

Modified: libcxx/trunk/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=261088&r1=261087&r2=261088&view=diff
==
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed Feb 17 07:16:31 2016
@@ -976,7 +976,12 @@ public:
 typedef locale  locale_type;
 typedef ctype_base::maskchar_class_type;
 
+#if defined(__mips__) && defined(__GLIBC__)
+static const char_class_type __regex_word = 
static_cast(_ISbit(15));
+#else
 static const char_class_type __regex_word = 0x80;
+#endif
+
 private:
 locale __loc_;
 const ctype* __ct_;


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


[libcxx] r261097 - Merging r261088:

2016-02-17 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Wed Feb 17 09:02:33 2016
New Revision: 261097

URL: http://llvm.org/viewvc/llvm-project?rev=261097&view=rev
Log:
Merging r261088:

r261088 | dsanders | 2016-02-17 13:16:31 + (Wed, 17 Feb 2016) | 21 lines

[libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc 
systems

Summary:
On glibc, the bits used for the various character classes is endian dependant
(see _ISbit() in ctypes.h) but __regex_word does not account for this and uses
a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the
bit for graphic characters which causes '-', '@', etc. to be considered a word
character.

Fixed this by defining the value using _ISbit(15) on MIPS glibc systems. We've
restricted this to MIPS for now to avoid the risk of introducing failures in
other targets.

Fixes PR26476.

Reviewers: hans, mclow.lists

Subscribers: dsanders, cfe-commits

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



Modified:
libcxx/branches/release_38/include/regex

Modified: libcxx/branches/release_38/include/regex
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_38/include/regex?rev=261097&r1=261096&r2=261097&view=diff
==
--- libcxx/branches/release_38/include/regex (original)
+++ libcxx/branches/release_38/include/regex Wed Feb 17 09:02:33 2016
@@ -976,7 +976,12 @@ public:
 typedef locale  locale_type;
 typedef ctype_base::maskchar_class_type;
 
+#if defined(__mips__) && defined(__GLIBC__)
+static const char_class_type __regex_word = 
static_cast(_ISbit(15));
+#else
 static const char_class_type __regex_word = 0x80;
+#endif
+
 private:
 locale __loc_;
 const ctype* __ct_;


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


Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-02-19 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Can you explain what the problem was and why this change is needed?

I'm guessing it's something to do with the 'Features[CPU] = true' line.


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



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


RE: r269411 - [mips] Consult triple's vendor field before using musl's interpreter.

2016-05-13 Thread Daniel Sanders via cfe-commits
Hi,

This change makes sense but it needs a test case.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Vasileios Kalintiris via cfe-commits
> Sent: 13 May 2016 13:13
> To: cfe-commits@lists.llvm.org
> Subject: r269411 - [mips] Consult triple's vendor field before using musl's
> interpreter.
> 
> Author: vkalintiris
> Date: Fri May 13 07:13:13 2016
> New Revision: 269411
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=269411&view=rev
> Log:
> [mips] Consult triple's vendor field before using musl's interpreter.
> 
> This should affect only the mips-mti-linux toolchain.
> 
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=269411&r1=269410&r2=269411&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:13:13 2016
> @@ -8991,7 +8991,9 @@ static std::string getLinuxDynamicLinker
>  bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
>  if (mips::isUCLibc(Args))
>LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
> -else if (!ToolChain.getTriple().hasEnvironment()) {
> +else if (!ToolChain.getTriple().hasEnvironment() &&
> + ToolChain.getTriple().getVendor() ==
> + llvm::Triple::VendorType::MipsTechnologies) {
>bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
>  (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
>LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269560 - [mips] Enable IAS by default for 32-bit MIPS targets (O32).

2016-05-14 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Sat May 14 07:43:08 2016
New Revision: 269560

URL: http://llvm.org/viewvc/llvm-project?rev=269560&view=rev
Log:
[mips] Enable IAS by default for 32-bit MIPS targets (O32).

Summary:
The MIPS IAS can now pass 'ninja check-all', recurse, build a bootable linux
kernel, and pass a variety of LNT testing.

Unfortunately we can't enable it by default for 64-bit targets yet since the N32
ABI is still very buggy and this also means we can't enable it for N64 either
because we can't distinguish between N32 and N64 in the relevant code.

Reviewers: vkalintiris

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18759
Differential Revision: http://reviews.llvm.org/D18761


Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=269560&r1=269559&r2=269560&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sat May 14 07:43:08 2016
@@ -2444,6 +2444,8 @@ bool Generic_GCC::IsIntegratedAssemblerD
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
   case llvm::Triple::systemz:
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
 return true;
   default:
 return false;


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


Re: [PATCH] D17933: Set MaxAtomicInlineWidth properly for i386, i486, and x86-64 cpus without cmpxchg16b.

2016-04-04 Thread Daniel Sanders via cfe-commits
dsanders added a subscriber: dsanders.


Comment at: test/Preprocessor/init.c:3295
@@ +3294,3 @@
+// MIPSN32BE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+// MIPSN32BE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+// MIPSN32BE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16

I've just noticed that we only check the '__GCC_*' macros for the 64-bit ABI's 
(N32/N64). I'm not sure why the 32-bit (O32) checks are missing.

The O32 cases are the same as N32 except that `__GCC_ATOMIC_LLONG_LOCK_FREE` is 
1 and `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8` is not defined.
Could you add:
  // MIPS32LE: #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_CHAR_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_INT_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
  // MIPS32LE: #define __GCC_ATOMIC_LONG_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_POINTER_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_SHORT_LOCK_FREE 2
  // MIPS32LE: #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
  // MIPS32LE: #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
  // MIPS32LE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
  // MIPS32LE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
  // MIPS32LE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
  // MIPS32LE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
  // MIPS32LE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
and the same for the MIPS32BE case?


http://reviews.llvm.org/D17933



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


[PATCH] D18761: [mips] Enable IAS by default for 32-bit MIPS targets (O32).

2016-04-04 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: vkalintiris.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D18753: [mips][sanitizer_common] Don't use `ld` in 
internal_clone() on 32-bit MIPS..

The MIPS IAS can now pass 'ninja check-all' and recurse now that the immediates
are all range checked properly.

Unfortunately we can't enable it by default for 64-bit targets yet since the N32
ABI is still very buggy and this also means we can't enable it for N64 either
because we can't distinguish between N32 and N64 in the relevant code.

Depends on D18753

http://reviews.llvm.org/D18761

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2396,6 +2396,8 @@
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
   case llvm::Triple::systemz:
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
 return true;
   default:
 return false;


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2396,6 +2396,8 @@
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
   case llvm::Triple::systemz:
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
 return true;
   default:
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
Herald added subscribers: dschuff, jfb.

This unifies mips/mipsel and mips64/mips64el into a single class so that we can
later support O32 on mips64/mips64el and N32/N64 on mips/mipsel (when an
appropriate CPU selected).

http://reviews.llvm.org/D20678

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6938,8 +6938,29 @@
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -6960,12 +6981,40 @@
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &,
- const std::string &ABIStr, const std::string &CPUStr)
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else if (getTriple().getArch() == llvm::Triple::mips64 ||
+   getTriple().getArch() == llvm::Triple::mips64el) {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = &llvm::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -6981,6 +7030,48 @@
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string &Name) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
+  }
+
+  void setN32ABITypes() {
+LongWidth = LongAlign = 32;
+PointerWidth = PointerAlign = 32;
+SizeType = UnsignedInt;
+PtrDiffType = SignedInt;
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+  }
+
   bool setCPU(const std::string &Name) override {
  

[PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
dsanders added a dependency: D20678: [mips] Fold MipsTargetInfoBase subclasses 
into MipsTargetInfoBase and rename to MipsTargetInfo. NFC.

There are no clang or llvm* tests for EABI and no EABI buildbots.

*There is a single backend test that specifies EABI but it tests MIPS16.

Depends on D20678

http://reviews.llvm.org/D20679

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6941,16 +6941,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7033,7 +7033,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7150,9 +7150,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6941,16 +6941,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7033,7 +7033,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7150,9 +7150,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
dsanders added a dependency: D20679: [mips] Kill 'support' for untested EABI..

Depends on D20679

http://reviews.llvm.org/D20680

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6940,25 +6940,21 @@
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-if (BigEndian) {
-  if (ABI == "o32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-} else {
-  if (ABI == "o32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-}
+StringRef Layout;
+
+if (ABI == "o32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+else if (ABI == "n32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else if (ABI == "n64")
+  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else
+  llvm_unreachable("Invalid ABI");
+
+if (BigEndian)
+  resetDataLayout(("E-" + Layout).str());
+else
+  resetDataLayout(("e-" + Layout).str());
   }
 
 


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6940,25 +6940,21 @@
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-if (BigEndian) {
-  if (ABI == "o32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-} else {
-  if (ABI == "o32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-}
+StringRef Layout;
+
+if (ABI == "o32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+else if (ABI == "n32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else if (ABI == "n64")
+  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else
+  llvm_unreachable("Invalid ABI");
+
+if (BigEndian)
+  resetDataLayout(("E-" + Layout).str());
+else
+  resetDataLayout(("e-" + Layout).str());
   }
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders added inline comments.


Comment at: lib/Basic/Targets.cpp:6986
@@ +6985,3 @@
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"

atanasyan wrote:
> What do you think about creation a static function and using it to simplify 
> this and similar conditions?
> 
> ```
> static bool is32BitTriple(const llvm::Triple &Triple) {
>   return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == 
> llvm::Triple::mipsel;
> }
> ```
I'm happy to add one if you want it but I'm currently finishing a patch that 
removes most of them in favour of ABI checks. The only one I think should 
remain as an Arch check is the one for MipsTargetInfo::ABI. Even that one is 
incorrect on our buildbots which detect as mips64-linux-gnu but should default 
to O32.


Comment at: lib/Basic/Targets.cpp:7006
@@ +7005,3 @@
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else if (getTriple().getArch() == llvm::Triple::mips64 ||
+   getTriple().getArch() == llvm::Triple::mips64el) {

atanasyan wrote:
> Can we use just `else` here?
Sure


http://reviews.llvm.org/D20678



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


RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing

2016-05-26 Thread Daniel Sanders via cfe-commits
Hi,

I think this commit may have caused the failure in 
http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/13743. Could you 
check? Buildbot will have supressed the usual email because the previous build 
failed (for a different reason).

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Alexey Bataev via cfe-commits
> Sent: 26 May 2016 12:10
> To: cfe-commits@lists.llvm.org
> Subject: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]'
> allowing choosing
> 
> Author: abataev
> Date: Thu May 26 06:10:11 2016
> New Revision: 270838
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=270838&view=rev
> Log:
> [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
> OpenMP version.
> 
> If '-fopenmp' option is provided '-fopenmp-version=' allows to control,
> which version of OpenMP must be supported. Currently it affects only the
> value of _OPENMP define.
> 
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/OpenMP/driver.c
> cfe/trunk/test/OpenMP/predefined_macro.c
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838&r1=270
> 837&r2=270838&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11
> 2016
> @@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ
>  LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
>  LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
>  LANGOPT(CUDA  , 1, 0, "CUDA")
> -LANGOPT(OpenMP, 1, 0, "OpenMP support")
> +LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP
> (31, 40 or 45)")
>  LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime
> calls")
>  LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target
> device")
> 
> 
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Driver/Options.td?rev=270838&r1=270837&
> r2=270838&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016
> @@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl
>  def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">,
> Group;
>  def fopenmp : Flag<["-"], "fopenmp">, Group, Flags<[CC1Option,
> NoArgumentUnused]>;
>  def fno_openmp : Flag<["-"], "fno-openmp">, Group,
> Flags<[NoArgumentUnused]>;
> +def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">,
> Group, Flags<[CC1Option, NoArgumentUnused]>;
>  def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group;
>  def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group,
> Flags<[NoArgumentUnused]>;
>  def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">,
> Group, Flags<[CC1Option, NoArgumentUnused]>;
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838&r1=270837&r2=270838&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016
> @@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation &C,
> 
>// Forward flags for OpenMP
>if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
> -   options::OPT_fno_openmp, false))
> +   options::OPT_fno_openmp, false)) {
> +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
>  switch (getOpenMPRuntime(getToolChain(), Args)) {
>  case OMPRT_OMP:
>  case OMPRT_IOMP5:
> @@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation &C,
>// semantic analysis, etc.
>break;
>  }
> +  }
> 
>const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs();
>Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);
> 
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270838&r1=270
> 837&r2=270838&view=diff
> ==
> 
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 06:10:11
> 2016
> @@ -1960,18 +1960,23 @@ static void ParseLangArgs(LangOptions &O
>Opts.OpenMPIsDevice =
>Opts.OpenMP && Args.has

RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing

2016-05-27 Thread Daniel Sanders via cfe-commits
Thanks. r270962 seems to have fixed the buildbot.

> -Original Message-
> From: Daniel Sanders
> Sent: 26 May 2016 16:24
> To: 'Alexey Bataev'; cfe-commits@lists.llvm.org
> Subject: RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]'
> allowing choosing
> 
> Hi,
> 
> I think this commit may have caused the failure in
> http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/13743. Could you
> check? Buildbot will have supressed the usual email because the previous
> build failed (for a different reason).
> 
> > -Original Message-
> > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> > Of Alexey Bataev via cfe-commits
> > Sent: 26 May 2016 12:10
> > To: cfe-commits@lists.llvm.org
> > Subject: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]'
> > allowing choosing
> >
> > Author: abataev
> > Date: Thu May 26 06:10:11 2016
> > New Revision: 270838
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=270838&view=rev
> > Log:
> > [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
> > OpenMP version.
> >
> > If '-fopenmp' option is provided '-fopenmp-version=' allows to control,
> > which version of OpenMP must be supported. Currently it affects only the
> > value of _OPENMP define.
> >
> > Modified:
> > cfe/trunk/include/clang/Basic/LangOptions.def
> > cfe/trunk/include/clang/Driver/Options.td
> > cfe/trunk/lib/Driver/Tools.cpp
> > cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> > cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> > cfe/trunk/test/OpenMP/driver.c
> > cfe/trunk/test/OpenMP/predefined_macro.c
> >
> > Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838&r1=270
> > 837&r2=270838&view=diff
> >
> ==
> > 
> > --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> > +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11
> > 2016
> > @@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ
> >  LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
> >  LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
> >  LANGOPT(CUDA  , 1, 0, "CUDA")
> > -LANGOPT(OpenMP, 1, 0, "OpenMP support")
> > +LANGOPT(OpenMP, 32, 0, "OpenMP support and version of
> OpenMP
> > (31, 40 or 45)")
> >  LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime
> > calls")
> >  LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP
> target
> > device")
> >
> >
> > Modified: cfe/trunk/include/clang/Driver/Options.td
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/include/clang/Driver/Options.td?rev=270838&r1=270837&
> > r2=270838&view=diff
> >
> ==
> > 
> > --- cfe/trunk/include/clang/Driver/Options.td (original)
> > +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016
> > @@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl
> >  def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">,
> > Group;
> >  def fopenmp : Flag<["-"], "fopenmp">, Group,
> Flags<[CC1Option,
> > NoArgumentUnused]>;
> >  def fno_openmp : Flag<["-"], "fno-openmp">, Group,
> > Flags<[NoArgumentUnused]>;
> > +def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">,
> > Group, Flags<[CC1Option, NoArgumentUnused]>;
> >  def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group;
> >  def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group,
> > Flags<[NoArgumentUnused]>;
> >  def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">,
> > Group, Flags<[CC1Option, NoArgumentUnused]>;
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL: http://llvm.org/viewvc/llvm-
> >
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838&r1=270837&r2=270838&
> > view=diff
> >
> ==
> > 
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016
> > @@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation &C,
> >
> >// Forward flags for OpenMP
> >if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
> > -   options::OPT_fno_openmp, false))
> > +   options::OPT_fno_openmp, false)) {
> > +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
> >  switch (getOpenMPRuntime(getToolChain(), Args)) {
> >  case OMPRT_OMP:
> >  case OMPRT_IOMP5:
> > @@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation &C,
> >// semantic analysis, etc.
> >break;
> >  }
> > +  }
> >
> >const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs();
> >Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);
> >
> > Modified: cfe/trunk/lib/Frontend/CompilerIn

r270984 - [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri May 27 06:51:02 2016
New Revision: 270984

URL: http://llvm.org/viewvc/llvm-project?rev=270984&view=rev
Log:
[mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to 
MipsTargetInfo. NFC

Summary:
This unifies mips/mipsel and mips64/mips64el into a single class so that we can
later support O32 on mips64/mips64el and N32/N64 on mips/mipsel (when an
appropriate CPU selected).

Reviewers: atanasyan

Subscribers: atanasyan, jfb, cfe-commits, dschuff

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270984&r1=270983&r2=270984&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 06:51:02 2016
@@ -7006,8 +7006,29 @@ public:
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -7028,12 +7049,39 @@ protected:
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &,
- const std::string &ABIStr, const std::string &CPUStr)
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), 
HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = &llvm::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -7049,6 +7097,48 @@ public:
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string &Name) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+In

Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-27 Thread Daniel Sanders via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270984: [mips] Fold MipsTargetInfoBase subclasses into 
MipsTargetInfoBase and rename… (authored by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D20678?vs=58604&id=58770#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20678

Files:
  cfe/trunk/lib/Basic/Targets.cpp

Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -7006,8 +7006,29 @@
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -7028,12 +7049,39 @@
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &,
- const std::string &ABIStr, const std::string &CPUStr)
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = &llvm::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -7049,6 +7097,48 @@
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string &Name) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
+  }
+
+  void setN32ABITypes() {
+LongWidth = LongAlign = 32;
+PointerWidth = PointerAlign = 32;
+SizeType = UnsignedInt;
+PtrDiffType = SignedInt;
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+  }
+
   bool setCPU(const std::string &Name) override {
 bool IsMips32 = getTriple().getArch() == llvm::Triple::mips ||
 

Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 58772.
dsanders added a comment.
Herald added subscribers: sdardis, emaste.

Removed the 'eabi' from Tools.cpp this revealed three driver tests for passing
-mabi to the assembler but the ABI itself is still completely untested.


http://reviews.llvm.org/D20679

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/Driver/freebsd-mips-as.c
  test/Driver/mips-abi.c
  test/Driver/mips-as.c

Index: test/Driver/mips-as.c
===
--- test/Driver/mips-as.c
+++ test/Driver/mips-as.c
@@ -30,11 +30,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s
 // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64"  "-mno-shared" "-KPIC" "-EL"
 //
-// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB"
-//
 // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-mabi=unknown 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s
Index: test/Driver/freebsd-mips-as.c
===
--- test/Driver/freebsd-mips-as.c
+++ test/Driver/freebsd-mips-as.c
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1233,7 +1233,7 @@
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7009,16 +7009,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Just to double-check: Do you still agree we should kill this now that the 
number of tests covering EABI-specific behaviour is non-zero?

I think we should on the basis that we still have no backend tests and no 
buildbots. The only tests we have check that the driver passes -mabi=eabi to 
the assembler.


http://reviews.llvm.org/D20679



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


r270998 - [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri May 27 09:30:23 2016
New Revision: 270998

URL: http://llvm.org/viewvc/llvm-project?rev=270998&view=rev
Log:
[mips] Kill 'support' for untested EABI.

Summary:
There are no llvm backend tests* for EABI and no EABI buildbots. There were only
three clang tests, all of which checked that -mabi=eabi was passed to the
assembler.

*There is a single backend test that specifies EABI but it actually tests 
MIPS16.

Reviewers: atanasyan

Subscribers: emaste, sdardis, atanasyan, cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/freebsd-mips-as.c
cfe/trunk/test/Driver/mips-abi.c
cfe/trunk/test/Driver/mips-as.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270998&r1=270997&r2=270998&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 09:30:23 2016
@@ -7009,7 +7009,7 @@ public:
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7018,7 +7018,7 @@ class MipsTargetInfo : public TargetInfo
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@ public:
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@ public:
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270998&r1=270997&r2=270998&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 09:30:23 2016
@@ -1233,7 +1233,7 @@ void mips::getMipsCPUAndABI(const ArgLis
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }

Modified: cfe/trunk/test/Driver/freebsd-mips-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd-mips-as.c?rev=270998&r1=270997&r2=270998&view=diff
==
--- cfe/trunk/test/Driver/freebsd-mips-as.c (original)
+++ cfe/trunk/test/Driver/freebsd-mips-as.c Fri May 27 09:30:23 2016
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s

Modified: cfe/trunk/test/Driver/mips-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=270998&r1=270997&r2=270998&view=diff
==
--- cfe/trunk/test/Driver/mips-abi.c (original)
+++ cfe/trunk/test/Driver/mips-abi.c Fri May 27 09:30:23 2016
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-

Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270998: [mips] Kill 'support' for untested EABI. (authored 
by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D20679?vs=58772&id=58782#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20679

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/freebsd-mips-as.c
  cfe/trunk/test/Driver/mips-abi.c
  cfe/trunk/test/Driver/mips-as.c

Index: cfe/trunk/test/Driver/freebsd-mips-as.c
===
--- cfe/trunk/test/Driver/freebsd-mips-as.c
+++ cfe/trunk/test/Driver/freebsd-mips-as.c
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: cfe/trunk/test/Driver/mips-abi.c
===
--- cfe/trunk/test/Driver/mips-abi.c
+++ cfe/trunk/test/Driver/mips-abi.c
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-mabi=unknown 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s
Index: cfe/trunk/test/Driver/mips-as.c
===
--- cfe/trunk/test/Driver/mips-as.c
+++ cfe/trunk/test/Driver/mips-as.c
@@ -30,11 +30,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s
 // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64"  "-mno-shared" "-KPIC" "-EL"
 //
-// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB"
-//
 // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -7009,16 +7009,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -1233,7 +1233,7 @@
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
htt

r271647 - [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

2016-06-03 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri Jun  3 05:11:01 2016
New Revision: 271647

URL: http://llvm.org/viewvc/llvm-project?rev=271647&view=rev
Log:
[mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

Summary:

Reviewers: atanasyan

Subscribers: atanasyan, cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271647&r1=271646&r2=271647&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jun  3 05:11:01 2016
@@ -7009,25 +7009,21 @@ public:
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-if (BigEndian) {
-  if (ABI == "o32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-} else {
-  if (ABI == "o32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-}
+StringRef Layout;
+
+if (ABI == "o32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+else if (ABI == "n32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else if (ABI == "n64")
+  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else
+  llvm_unreachable("Invalid ABI");
+
+if (BigEndian)
+  resetDataLayout(("E-" + Layout).str());
+else
+  resetDataLayout(("e-" + Layout).str());
   }
 
 


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


[PATCH] D20961: [mips] Replace almost all Arch checks in MipsTargetInfo with ABI checks. NFC.

2016-06-03 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: cfe-commits.

setABI() is still tied to the Arch component of the Triple to preserve existing
behaviour.

http://reviews.llvm.org/D20961

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7047,38 +7047,19 @@
 
 public:
   MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
-  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
- getTriple().getArch() == llvm::Triple::mipsel)
-? "mips32r2"
-: "mips64r2"),
-IsMips16(false), IsMicromips(false), IsNan2008(false),
-IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false),
-HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
- getTriple().getArch() == llvm::Triple::mipsel)
-? "o32"
-: "n64") {
+  : TargetInfo(Triple), IsMips16(false), IsMicromips(false),
+IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
+DspRev(NoDSP), HasMSA(false), HasFP64(false) {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-if (getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel) {
-  SizeType = UnsignedInt;
-  PtrDiffType = SignedInt;
-  Int64Type = SignedLongLong;
-  IntMaxType = Int64Type;
-  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
-} else {
-  LongDoubleWidth = LongDoubleAlign = 128;
-  LongDoubleFormat = &llvm::APFloat::IEEEquad;
-  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
-LongDoubleWidth = LongDoubleAlign = 64;
-LongDoubleFormat = &llvm::APFloat::IEEEdouble;
-  }
-  setN64ABITypes();
-  SuitableAlign = 128;
-  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
-}
+setABI((getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel)
+   ? "o32"
+   : "n64");
+
+CPU = ABI == "o32" ? "mips32r2" : "mips64r2";
   }
 
   bool isNaN2008Default() const {
@@ -7095,9 +7076,16 @@
 
   StringRef getABI() const override { return ABI; }
   bool setABI(const std::string &Name) override {
+// FIXME: The Arch component on the triple actually has no bearing on
+//whether the ABI is valid or not. It's features of the CPU that
+//matters and the size of the GPR's in particular.
+//However, we can't allow O32 on 64-bit processors just yet because
+//the backend still checks the Arch component instead of the ABI in
+//a few places.
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
   if (Name == "o32") {
+setO32ABITypes();
 ABI = Name;
 return true;
   }
@@ -7118,39 +7106,64 @@
 return false;
   }
 
+  void setO32ABITypes() {
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+LongDoubleWidth = LongDoubleAlign = 64;
+LongWidth = LongAlign = 32;
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+PointerWidth = PointerAlign = 32;
+PtrDiffType = SignedInt;
+SizeType = UnsignedInt;
+SuitableAlign = 64;
+  }
+
+  void setN32N64ABITypes() {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = &llvm::APFloat::IEEEquad;
+if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+  LongDoubleWidth = LongDoubleAlign = 64;
+  LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+}
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+SuitableAlign = 128;
+  }
+
   void setN64ABITypes() {
+setN32N64ABITypes();
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
 LongWidth = LongAlign = 64;
 PointerWidth = PointerAlign = 64;
-SizeType = UnsignedLong;
 PtrDiffType = SignedLong;
-Int64Type = SignedLong;
-IntMaxType = Int64Type;
+SizeType = UnsignedLong;
   }
 
   void setN32ABITypes() {
+setN32N64ABITypes();
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
 LongWidth = LongAlign = 32;
 PointerWidth = PointerAlign = 32;
-SizeType = UnsignedInt;
 PtrDiffType = SignedInt;
-Int64Type = SignedLongLong;
-IntMaxType = Int64Type;
+SizeType = UnsignedInt;
   }
 
   bool setCPU(const std::string &Name) override {
-bool IsMips32 = getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel;
+bool GPR64Required =

[PATCH] D20963: [mips] The P5600 does not support N32/N64 since it's a 32-bit CPU.

2016-06-03 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D20961: [mips] Replace almost all Arch checks in 
MipsTargetInfo with ABI checks. NFC..
Herald added a subscriber: sdardis.

Depends on D20961

http://reviews.llvm.org/D20963

Files:
  lib/Basic/Targets.cpp
  test/Driver/mips-abi.c

Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -98,6 +98,11 @@
 // MIPS-ARCH-P5600: "-target-cpu" "p5600"
 // MIPS-ARCH-P5600: "-target-abi" "o32"
 //
+// RUN: not %clang -target mips-linux-gnu -c %s \
+// RUN:-march=p5600 -mabi=64 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
+// MIPS-ARCH-P5600-N64: error: unknown target ABI 'n64'
+//
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7170,7 +7170,7 @@
 .Case("mips64r5", true)
 .Case("mips64r6", true)
 .Case("octeon", true)
-.Case("p5600", true)
+.Case("p5600", !GPR64Required)
 .Default(false);
   }
   const std::string& getCPU() const { return CPU; }


Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -98,6 +98,11 @@
 // MIPS-ARCH-P5600: "-target-cpu" "p5600"
 // MIPS-ARCH-P5600: "-target-abi" "o32"
 //
+// RUN: not %clang -target mips-linux-gnu -c %s \
+// RUN:-march=p5600 -mabi=64 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
+// MIPS-ARCH-P5600-N64: error: unknown target ABI 'n64'
+//
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7170,7 +7170,7 @@
 .Case("mips64r5", true)
 .Case("mips64r6", true)
 .Case("octeon", true)
-.Case("p5600", true)
+.Case("p5600", !GPR64Required)
 .Default(false);
   }
   const std::string& getCPU() const { return CPU; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271875 - [mips] Replace almost all Arch checks in MipsTargetInfo with ABI checks. NFC.

2016-06-06 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Mon Jun  6 04:07:08 2016
New Revision: 271875

URL: http://llvm.org/viewvc/llvm-project?rev=271875&view=rev
Log:
[mips] Replace almost all Arch checks in MipsTargetInfo with ABI checks. NFC.

Summary:
setABI() is still tied to the Arch component of the Triple to preserve existing
behaviour.

Reviewers: atanasyan

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271875&r1=271874&r2=271875&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Jun  6 04:07:08 2016
@@ -7047,38 +7047,19 @@ protected:
 
 public:
   MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
-  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
- getTriple().getArch() == llvm::Triple::mipsel)
-? "mips32r2"
-: "mips64r2"),
-IsMips16(false), IsMicromips(false), IsNan2008(false),
-IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), 
HasMSA(false),
-HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
- getTriple().getArch() == llvm::Triple::mipsel)
-? "o32"
-: "n64") {
+  : TargetInfo(Triple), IsMips16(false), IsMicromips(false),
+IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
+DspRev(NoDSP), HasMSA(false), HasFP64(false) {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-if (getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel) {
-  SizeType = UnsignedInt;
-  PtrDiffType = SignedInt;
-  Int64Type = SignedLongLong;
-  IntMaxType = Int64Type;
-  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
-} else {
-  LongDoubleWidth = LongDoubleAlign = 128;
-  LongDoubleFormat = &llvm::APFloat::IEEEquad;
-  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
-LongDoubleWidth = LongDoubleAlign = 64;
-LongDoubleFormat = &llvm::APFloat::IEEEdouble;
-  }
-  setN64ABITypes();
-  SuitableAlign = 128;
-  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
-}
+setABI((getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel)
+   ? "o32"
+   : "n64");
+
+CPU = ABI == "o32" ? "mips32r2" : "mips64r2";
   }
 
   bool isNaN2008Default() const {
@@ -7095,9 +7076,16 @@ public:
 
   StringRef getABI() const override { return ABI; }
   bool setABI(const std::string &Name) override {
+// FIXME: The Arch component on the triple actually has no bearing on
+//whether the ABI is valid or not. It's features of the CPU that
+//matters and the size of the GPR's in particular.
+//However, we can't allow O32 on 64-bit processors just yet because
+//the backend still checks the Arch component instead of the ABI in
+//a few places.
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
   if (Name == "o32") {
+setO32ABITypes();
 ABI = Name;
 return true;
   }
@@ -7118,39 +7106,64 @@ public:
 return false;
   }
 
+  void setO32ABITypes() {
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+LongDoubleWidth = LongDoubleAlign = 64;
+LongWidth = LongAlign = 32;
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+PointerWidth = PointerAlign = 32;
+PtrDiffType = SignedInt;
+SizeType = UnsignedInt;
+SuitableAlign = 64;
+  }
+
+  void setN32N64ABITypes() {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = &llvm::APFloat::IEEEquad;
+if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+  LongDoubleWidth = LongDoubleAlign = 64;
+  LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+}
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+SuitableAlign = 128;
+  }
+
   void setN64ABITypes() {
+setN32N64ABITypes();
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
 LongWidth = LongAlign = 64;
 PointerWidth = PointerAlign = 64;
-SizeType = UnsignedLong;
 PtrDiffType = SignedLong;
-Int64Type = SignedLong;
-IntMaxType = Int64Type;
+SizeType = UnsignedLong;
   }
 
   void setN32ABITypes() {
+setN32N64ABITypes();
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
 LongWidth = Long

r271877 - [mips] The P5600 does not support N32/N64 since it's a 32-bit CPU.

2016-06-06 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Mon Jun  6 04:47:32 2016
New Revision: 271877

URL: http://llvm.org/viewvc/llvm-project?rev=271877&view=rev
Log:
[mips] The P5600 does not support N32/N64 since it's a 32-bit CPU.

Summary:

Reviewers: atanasyan

Subscribers: cfe-commits, sdardis

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/mips-abi.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271877&r1=271876&r2=271877&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Jun  6 04:47:32 2016
@@ -7170,7 +7170,7 @@ public:
 .Case("mips64r5", true)
 .Case("mips64r6", true)
 .Case("octeon", true)
-.Case("p5600", true)
+.Case("p5600", !GPR64Required)
 .Default(false);
   }
   const std::string& getCPU() const { return CPU; }

Modified: cfe/trunk/test/Driver/mips-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=271877&r1=271876&r2=271877&view=diff
==
--- cfe/trunk/test/Driver/mips-abi.c (original)
+++ cfe/trunk/test/Driver/mips-abi.c Mon Jun  6 04:47:32 2016
@@ -98,6 +98,11 @@
 // MIPS-ARCH-P5600: "-target-cpu" "p5600"
 // MIPS-ARCH-P5600: "-target-abi" "o32"
 //
+// RUN: not %clang -target mips-linux-gnu -c %s \
+// RUN:-march=p5600 -mabi=64 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
+// MIPS-ARCH-P5600-N64: error: unknown target ABI 'n64'
+//
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-3264 %s


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


[PATCH] D21016: [mips] The default ABI depends on the CPU not the Arch on MTI and IMG vendor triples.

2016-06-06 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: cfe-commits.
Herald added a subscriber: sdardis.

32-bit CPU's default to O32. 64-bit CPU's default to N64. The default CPU
(mips32r2/mips64r2) still depends on the arch so there's no functional
change when the CPU isn't specified but commands like:
  clang -target mips-mti-linux-gnu -mips64r2
will now default to a 64-bit ABI like our gcc toolchains do* instead of
asserting in the backend**.

Other vendors (including Triple::UnknownVendor) still derive the default
ABI from the arch.

* Although not the same one as our gcc toolchains, clang has historically
  defaulted to N64 where gcc defaults to N32.
** Mixing O32 and a 64-bit CPU causing assertions is a long-standing bug.

http://reviews.llvm.org/D21016

Files:
  lib/Driver/Tools.cpp
  test/Driver/mips-abi.c

Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -6,9 +6,22 @@
 // MIPS-DEF: "-target-abi" "o32"
 //
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64-DEF %s
-// MIPS64-DEF: "-target-cpu" "mips64r2"
-// MIPS64-DEF: "-target-abi" "n64"
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// MIPS64R2-N64: "-target-cpu" "mips64r2"
+// MIPS64R2-N64: "-target-abi" "n64"
+//
+// RUN: %clang -target mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// MIPS64R3-N64: "-target-cpu" "mips64r3"
+// MIPS64R3-N64: "-target-abi" "n64"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-mabi=32 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1221,6 +1221,30 @@
 }
   }
 
+  if (ABIName.empty() &&
+  (Triple.getVendor() == llvm::Triple::MipsTechnologies ||
+   Triple.getVendor() == llvm::Triple::ImaginationTechnologies)) {
+ABIName = llvm::StringSwitch(CPUName)
+  .Case("mips1", "o32")
+  .Case("mips2", "o32")
+  .Case("mips3", "n64")
+  .Case("mips4", "n64")
+  .Case("mips5", "n64")
+  .Case("mips32", "o32")
+  .Case("mips32r2", "o32")
+  .Case("mips32r3", "o32")
+  .Case("mips32r5", "o32")
+  .Case("mips32r6", "o32")
+  .Case("mips64", "n64")
+  .Case("mips64r2", "n64")
+  .Case("mips64r3", "n64")
+  .Case("mips64r5", "n64")
+  .Case("mips64r6", "n64")
+  .Case("octeon", "n64")
+  .Case("p5600", "o32")
+  .Default("");
+  }
+
   if (ABIName.empty()) {
 // Deduce ABI name from the target triple.
 if (Triple.getArch() == llvm::Triple::mips ||


Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -6,9 +6,22 @@
 // MIPS-DEF: "-target-abi" "o32"
 //
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64-DEF %s
-// MIPS64-DEF: "-target-cpu" "mips64r2"
-// MIPS64-DEF: "-target-abi" "n64"
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// MIPS64R2-N64: "-target-cpu" "mips64r2"
+// MIPS64R2-N64: "-target-abi" "n64"
+//
+// RUN: %clang -target mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// MIPS64R3-N64: "-target-cpu" "mips64r3"
+// MIPS64R3-N64: "-target-abi" "n64"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-mabi=32 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1221,6 +1221,30 @@
 }
   }
 
+  if (ABIName.empty() &&
+ 

r271884 - [mips] The default ABI depends on the CPU not the Arch on MTI and IMG vendor triples.

2016-06-06 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Mon Jun  6 07:02:21 2016
New Revision: 271884

URL: http://llvm.org/viewvc/llvm-project?rev=271884&view=rev
Log:
[mips] The default ABI depends on the CPU not the Arch on MTI and IMG vendor 
triples.

Summary:
32-bit CPU's default to O32. 64-bit CPU's default to N64. The default CPU
(mips32r2/mips64r2) still depends on the arch so there's no functional
change when the CPU isn't specified but commands like:
  clang -target mips-mti-linux-gnu -mips64r2
will now default to a 64-bit ABI like our gcc toolchains do* instead of
asserting in the backend**.

Other vendors (including Triple::UnknownVendor) still derive the default
ABI from the arch.

* Although not the same one as our gcc toolchains, clang has historically
  defaulted to N64 where gcc defaults to N32.
** Mixing O32 and a 64-bit CPU causing assertions is a long-standing bug.

Reviewers: atanasyan

Subscribers: sdardis, cfe-commits

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-abi.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271884&r1=271883&r2=271884&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jun  6 07:02:21 2016
@@ -1221,6 +1221,30 @@ void mips::getMipsCPUAndABI(const ArgLis
 }
   }
 
+  if (ABIName.empty() &&
+  (Triple.getVendor() == llvm::Triple::MipsTechnologies ||
+   Triple.getVendor() == llvm::Triple::ImaginationTechnologies)) {
+ABIName = llvm::StringSwitch(CPUName)
+  .Case("mips1", "o32")
+  .Case("mips2", "o32")
+  .Case("mips3", "n64")
+  .Case("mips4", "n64")
+  .Case("mips5", "n64")
+  .Case("mips32", "o32")
+  .Case("mips32r2", "o32")
+  .Case("mips32r3", "o32")
+  .Case("mips32r5", "o32")
+  .Case("mips32r6", "o32")
+  .Case("mips64", "n64")
+  .Case("mips64r2", "n64")
+  .Case("mips64r3", "n64")
+  .Case("mips64r5", "n64")
+  .Case("mips64r6", "n64")
+  .Case("octeon", "n64")
+  .Case("p5600", "o32")
+  .Default("");
+  }
+
   if (ABIName.empty()) {
 // Deduce ABI name from the target triple.
 if (Triple.getArch() == llvm::Triple::mips ||

Modified: cfe/trunk/test/Driver/mips-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=271884&r1=271883&r2=271884&view=diff
==
--- cfe/trunk/test/Driver/mips-abi.c (original)
+++ cfe/trunk/test/Driver/mips-abi.c Mon Jun  6 07:02:21 2016
@@ -6,9 +6,22 @@
 // MIPS-DEF: "-target-abi" "o32"
 //
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64-DEF %s
-// MIPS64-DEF: "-target-cpu" "mips64r2"
-// MIPS64-DEF: "-target-abi" "n64"
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// MIPS64R2-N64: "-target-cpu" "mips64r2"
+// MIPS64R2-N64: "-target-abi" "n64"
+//
+// RUN: %clang -target mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// RUN: %clang -target mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R3-N64 %s
+// MIPS64R3-N64: "-target-cpu" "mips64r3"
+// MIPS64R3-N64: "-target-abi" "n64"
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-mabi=32 2>&1 \


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


[PATCH] D21023: [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.

2016-06-06 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: cfe-commits.
Herald added a subscriber: sdardis.

The validity of ABI/CPU pairs is no longer checked on the fly but is
instead checked after initialization. As a result, invalid CPU/ABI pairs
can be reported as being known but invalid instead of being unknown. For
example, we now emit:
  error: ABI 'n32' is not supported on CPU 'mips32r2'
instead of:
  error: unknown target ABI 'n64'

http://reviews.llvm.org/D21023

Files:
  include/clang/Basic/DiagnosticCommonKinds.td
  include/clang/Basic/TargetInfo.h
  lib/Basic/Targets.cpp
  test/Driver/mips-abi.c

Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -1,16 +1,27 @@
 // Check passing Mips ABI options to the backend.
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-DEF %s
-// MIPS-DEF: "-target-cpu" "mips32r2"
-// MIPS-DEF: "-target-abi" "o32"
+// RUN:   | FileCheck -check-prefix=MIPS32R2-O32 %s
+// RUN: %clang -target mips64-linux-gnu -mips32r2 -mabi=32 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS32R2-O32 %s
+// MIPS32R2-O32: "-target-cpu" "mips32r2"
+// MIPS32R2-O32: "-target-abi" "o32"
+//
+// FIXME: This is a valid combination of options but we reject it at the moment
+//because the backend can't handle it.
+// RUN: not %clang -target mips-linux-gnu -c %s \
+// RUN:-march=mips64r2 -mabi=32 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
+// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
 //
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
+// RUN: %clang -target mips-linux-gnu -mips64r2 -mabi=64 -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // MIPS64R2-N64: "-target-cpu" "mips64r2"
 // MIPS64R2-N64: "-target-abi" "n64"
 //
@@ -114,7 +125,7 @@
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-march=p5600 -mabi=64 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
-// MIPS-ARCH-P5600-N64: error: unknown target ABI 'n64'
+// MIPS-ARCH-P5600-N64: error: ABI 'n64' is not supported on CPU 'p5600'
 //
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN:-march=mips64 2>&1 \
@@ -143,7 +154,7 @@
 // RUN: not %clang -target mips64-linux-gnu -c %s \
 // RUN:-march=mips32 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ARCH-6432 %s
-// MIPS-ARCH-6432: error: unknown target CPU 'mips32'
+// MIPS-ARCH-6432: error: ABI 'n64' is not supported on CPU 'mips32'
 //
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-march=unknown 2>&1 \
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7074,34 +7074,38 @@
 return IsNan2008;
   }
 
+  bool processorSupportsGPR64() const {
+return llvm::StringSwitch(CPU)
+.Case("mips3", true)
+.Case("mips4", true)
+.Case("mips5", true)
+.Case("mips64", true)
+.Case("mips64r2", true)
+.Case("mips64r3", true)
+.Case("mips64r5", true)
+.Case("mips64r6", true)
+.Case("octeon", true)
+.Default(false);
+return false;
+  }
+
   StringRef getABI() const override { return ABI; }
   bool setABI(const std::string &Name) override {
-// FIXME: The Arch component on the triple actually has no bearing on
-//whether the ABI is valid or not. It's features of the CPU that
-//matters and the size of the GPR's in particular.
-//However, we can't allow O32 on 64-bit processors just yet because
-//the backend still checks the Arch component instead of the ABI in
-//a few places.
-if (getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32") {
-setO32ABITypes();
-ABI = Name;
-return true;
-  }
+if (Name == "o32") {
+  setO32ABITypes();
+  ABI = Name;
+  return true;
 }
-if (getTriple().getArch() == llvm::Triple::mips64 ||
-getTriple().getArch() == llvm::Triple::mips64el) {
-  if (Name == "n32") {
-setN32ABITypes();
-ABI = Name;
-return true;
-  }
-  if (Name == "n64") {
-setN64ABITypes();
-ABI = Name;
-return true;
-  }
+
+if (Name == "n32") {
+  setN32ABITypes();
+  ABI = Name;
+  return true;
+}
+if (Name == "n64") {
+  setN64ABITypes();
+  ABI = Name;
+  re

Re: [PATCH] D18761: [mips] Enable IAS by default for 32-bit MIPS targets (O32).

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders closed this revision.
dsanders added a comment.

This has already been committed. I'm not sure why it didn't auto-close.


http://reviews.llvm.org/D18761



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


[PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D21069: [mips] Require that ABI's are passed in 
the triple within LLVM..
Herald added subscribers: srhines, danalbert, tberghammer.

'clang -cc1' and 'clang -cc1as' will mutate the triple to account for
-target-abi if such a conversion is defined by Triple::getABIVariant().
Otherwise, the ABI will continue to be passed via MCTargetOptions::ABIName.

Additionally, 'clang -cc1as' now applies the effect of -target-abi. Previously
it was ignored.

Depends on D21069

http://reviews.llvm.org/D21070

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -71,6 +71,10 @@
   /// The name of the target triple to assemble for.
   std::string Triple;
 
+  /// The name of the ABI to assembler for or the empty string for the default
+  /// ABI.
+  std::string ABI;
+
   /// If given, the name of the target CPU to determine which instructions
   /// are legal.
   std::string CPU;
@@ -136,6 +140,7 @@
 public:
   AssemblerInvocation() {
 Triple = "";
+ABI = "";
 NoInitialTextSection = 0;
 InputFile = "-";
 OutputPath = "-";
@@ -187,13 +192,20 @@
 
   // Target Options
   Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.ABI = Args.getLastArgValue(OPT_target_abi);
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.Features = Args.getAllArgValues(OPT_target_feature);
 
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
 
+  llvm::Triple ABITriple = llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() != llvm::Triple::UnknownArch) {
+Opts.Triple = ABITriple.str();
+Opts.ABI = "";
+  }
+
   // Language Options
   Opts.IncludePaths = Args.getAllArgValues(OPT_I);
   Opts.NoInitialTextSection = Args.hasArg(OPT_n);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2253,6 +2253,14 @@
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+
+  // Pass the ABI in the triple if the target prefers this, otherwise
+  // pass it in Opts.ABI.
+  llvm::Triple ABITriple = llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() != llvm::Triple::UnknownArch) {
+Opts.Triple = ABITriple.str();
+Opts.ABI = "";
+  }
 }
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1177,7 +1177,7 @@
   // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the
   // default for mips64(el)?-img-linux-gnu.
   if (Triple.getVendor() == llvm::Triple::ImaginationTechnologies &&
-  Triple.getEnvironment() == llvm::Triple::GNU) {
+  Triple.isGNUEnvironment()) {
 DefMips32CPU = "mips32r6";
 DefMips64CPU = "mips64r6";
   }
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2277,7 +2277,7 @@
 
   if (TargetTriple.getVendor() == llvm::Triple::ImaginationTechnologies &&
   TargetTriple.getOS() == llvm::Triple::Linux &&
-  TargetTriple.getEnvironment() == llvm::Triple::GNU) {
+  TargetTriple.isGNUEnvironment()) {
 // Select mips-img-linux-gnu toolchain.
 for (auto Candidate : {&ImgMultilibsV1, &ImgMultilibsV2}) {
   if (Candidate->select(Flags, Result.SelectedMultilib)) {
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7054,10 +7054,22 @@
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-setABI((getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel)
-   ? "o32"
-   : "n64");
+if (getTriple().getEnvironment() == llvm::Triple::ABI32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABI32 ||
+getTriple().getEnvironment() == llvm::Triple::AndroidABI32)
+  setABI("o32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABIN32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABIN32)
+  setABI("n32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::GNUABI64 ||
+  

[PATCH] D21071: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D21070: Pass the ABI in the triple when 
appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'.
Herald added subscribers: dschuff, jfb.

This stops cases such as '-target mips-linux-gnu -mabi=n32' from using the
IAS by default.

Depends on D21070.

http://reviews.llvm.org/D21071

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4236,7 +4236,7 @@
   // Decide whether to use verbose asm. Verbose assembly is the default on
   // toolchains which have the integrated assembler on by default.
   bool IsIntegratedAssemblerDefault =
-  getToolChain().IsIntegratedAssemblerDefault();
+  getToolChain().IsIntegratedAssemblerDefault(Args);
   if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
IsIntegratedAssemblerDefault) ||
   Args.hasArg(options::OPT_dA))
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -207,7 +207,8 @@
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
 
 protected:
   Tool *getTool(Action::ActionClass AC) const override;
@@ -314,7 +315,8 @@
 // expected to use /usr/include/Block.h.
 return true;
   }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 // Default integrated assembler to on for Apple's MachO targets.
 return true;
   }
@@ -633,7 +635,10 @@
   Solaris(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
@@ -651,7 +656,8 @@
   MinGW(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -896,7 +902,10 @@
   LanaiToolChain(const Driver &D, const llvm::Triple &Triple,
  const llvm::opt::ArgList &Args)
   : Generic_ELF(D, Triple, Args) {}
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
@@ -919,7 +928,8 @@
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return true;
   }
 
@@ -944,7 +954,10 @@
   AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
   unsigned GetDefaultDwarfVersion() const override { return 2; }
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
@@ -964,7 +977,8 @@
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return getTriple().getArch() == llvm::Triple::mipsel;
   }
 
@@ -1007,7 +1021,8 @@
   TranslateArgs(const llvm::opt::DerivedArgList &Args,
 const char *BoundArch) const override;
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -1054,7 +1069,10 @@
   CrossWindowsToolChain(const Driver &D, const llvm::Triple &T,
 const llvm::opt

Re: [PATCH] D21071: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders abandoned this revision.
dsanders added a comment.

Part of this patch is missing. I'll repost it soon.


http://reviews.llvm.org/D21071



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


[PATCH] D21072: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: jfb, dschuff, cfe-commits.
dsanders added a dependency: D21070: Pass the ABI in the triple when 
appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'.
Herald added subscribers: sdardis, srhines, danalbert, tberghammer.

This stops cases such as '-target mips-linux-gnu -mabi=n32' from using the
IAS by default.

Depends on D21070.

http://reviews.llvm.org/D21072

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  test/Driver/mips-integrated-as.s

Index: test/Driver/mips-integrated-as.s
===
--- test/Driver/mips-integrated-as.s
+++ test/Driver/mips-integrated-as.s
@@ -1,3 +1,5 @@
+// RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=ABI-O32 %s
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=ABI-O32 %s
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=32 2>&1 | \
@@ -293,3 +295,13 @@
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float"
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx"
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg"
+
+// RUN: %clang -target mips-linux-gnu -### -c %s -mips64 -mabi=n32 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips64-linux-gnu -### -c %s -mabi=n32 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips-linux-gnu -### -c %s -mips64 -mabi=64 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// GAS-NOT: -cc1as
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4236,7 +4236,7 @@
   // Decide whether to use verbose asm. Verbose assembly is the default on
   // toolchains which have the integrated assembler on by default.
   bool IsIntegratedAssemblerDefault =
-  getToolChain().IsIntegratedAssemblerDefault();
+  getToolChain().IsIntegratedAssemblerDefault(Args);
   if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
IsIntegratedAssemblerDefault) ||
   Args.hasArg(options::OPT_dA))
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -207,7 +207,8 @@
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
 
 protected:
   Tool *getTool(Action::ActionClass AC) const override;
@@ -314,7 +315,8 @@
 // expected to use /usr/include/Block.h.
 return true;
   }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 // Default integrated assembler to on for Apple's MachO targets.
 return true;
   }
@@ -633,7 +635,10 @@
   Solaris(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
@@ -651,7 +656,8 @@
   MinGW(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -896,7 +902,10 @@
   LanaiToolChain(const Driver &D, const llvm::Triple &Triple,
  const llvm::opt::ArgList &Args)
   : Generic_ELF(D, Triple, Args) {}
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
@@ -919,7 +928,8 @@
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return true;
   }
 
@@ -944,7 +954,10 @@
   AMDGPUToolChain(const Driver &D, const llvm::Triple &Tripl

r272645 - [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.

2016-06-14 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Jun 14 03:58:50 2016
New Revision: 272645

URL: http://llvm.org/viewvc/llvm-project?rev=272645&view=rev
Log:
[mips] Defer validity check for CPU/ABI pairs and improve error message for 
invalid cases.

Summary:
The validity of ABI/CPU pairs is no longer checked on the fly but is
instead checked after initialization. As a result, invalid CPU/ABI pairs
can be reported as being known but invalid instead of being unknown. For
example, we now emit:
  error: ABI 'n32' is not supported on CPU 'mips32r2'
instead of:
  error: unknown target ABI 'n64'

Reviewers: atanasyan

Subscribers: sdardis, cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/mips-abi.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Tue Jun 14 03:58:50 
2016
@@ -180,6 +180,9 @@ def err_target_unknown_triple : Error<
   "unknown target triple '%0', please use -triple or -arch">;
 def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
 def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
+def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU 
'%1'">;
+def err_target_unsupported_abi_for_triple : Error<
+  "ABI '%0' is not supported for '%1'">;
 def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
 def err_target_unsupported_fpmath : Error<
 "the '%0' unit is not supported with this instruction set">;

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jun 14 03:58:50 2016
@@ -982,6 +982,11 @@ public:
   return getTargetOpts().SupportedOpenCLOptions;
   }
 
+  /// \brief Check the target is valid after it is fully initialized.
+  virtual bool validateTarget(DiagnosticsEngine &Diags) const {
+return true;
+  }
+
 protected:
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
 return PointerWidth;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Jun 14 03:58:50 2016
@@ -7112,34 +7112,38 @@ public:
 return IsNan2008;
   }
 
+  bool processorSupportsGPR64() const {
+return llvm::StringSwitch(CPU)
+.Case("mips3", true)
+.Case("mips4", true)
+.Case("mips5", true)
+.Case("mips64", true)
+.Case("mips64r2", true)
+.Case("mips64r3", true)
+.Case("mips64r5", true)
+.Case("mips64r6", true)
+.Case("octeon", true)
+.Default(false);
+return false;
+  }
+
   StringRef getABI() const override { return ABI; }
   bool setABI(const std::string &Name) override {
-// FIXME: The Arch component on the triple actually has no bearing on
-//whether the ABI is valid or not. It's features of the CPU that
-//matters and the size of the GPR's in particular.
-//However, we can't allow O32 on 64-bit processors just yet because
-//the backend still checks the Arch component instead of the ABI in
-//a few places.
-if (getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32") {
-setO32ABITypes();
-ABI = Name;
-return true;
-  }
+if (Name == "o32") {
+  setO32ABITypes();
+  ABI = Name;
+  return true;
 }
-if (getTriple().getArch() == llvm::Triple::mips64 ||
-getTriple().getArch() == llvm::Triple::mips64el) {
-  if (Name == "n32") {
-setN32ABITypes();
-ABI = Name;
-return true;
-  }
-  if (Name == "n64") {
-setN64ABITypes();
-ABI = Name;
-return true;
-  }
+
+if (Name == "n32") {
+  setN32ABITypes();
+  ABI = Name;
+  return true;
+}
+if (Name == "n64") {
+  setN64ABITypes();
+  ABI = Name;
+  return true;
 }
 return false;
   }
@@ -7189,26 +7193,25 @@ public:
   }
 
   bool setCPU(const std::string &Name) override {
-bool GPR64Required = ABI == "n32" || ABI ==

r273552 - Attempt to fix MIPS buildbots after r273425.

2016-06-23 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Thu Jun 23 04:29:38 2016
New Revision: 273552

URL: http://llvm.org/viewvc/llvm-project?rev=273552&view=rev
Log:
Attempt to fix MIPS buildbots after r273425.

MIPS has a 'signext' attribute that was causing the check to fail.

Modified:
cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl

Modified: cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl?rev=273552&r1=273551&r2=273552&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl Thu Jun 23 04:29:38 2016
@@ -3,10 +3,10 @@
 typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
 
 kernel  __attribute__((vec_type_hint(int))) 
__attribute__((reqd_work_group_size(1,2,4))) void kernel1(int a) {}
-// CHECK: define void @kernel1(i32 %a) {{[^{]+}} !vec_type_hint 
![[MD1:[0-9]+]] !reqd_work_group_size ![[MD2:[0-9]+]]
+// CHECK: define void @kernel1(i32 {{[^%]*}}%a) {{[^{]+}} !vec_type_hint 
![[MD1:[0-9]+]] !reqd_work_group_size ![[MD2:[0-9]+]]
 
 kernel __attribute__((vec_type_hint(uint4))) 
__attribute__((work_group_size_hint(8,16,32))) void kernel2(int a) {}
-// CHECK: define void @kernel2(i32 %a) {{[^{]+}} !vec_type_hint 
![[MD3:[0-9]+]] !work_group_size_hint ![[MD4:[0-9]+]]
+// CHECK: define void @kernel2(i32 {{[^%]*}}%a) {{[^{]+}} !vec_type_hint 
![[MD3:[0-9]+]] !work_group_size_hint ![[MD4:[0-9]+]]
 
 // CHECK: [[MD1]] = !{i32 undef, i32 1}
 // CHECK: [[MD2]] = !{i32 1, i32 2, i32 4}


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


Re: [PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-23 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

This change agrees with what I think the calling convention is and the 
documentation. However, I've hit quite a few discrepancies between the 
documented calling convention and the de-facto one implemented by gcc so I'm 
wary of going by that alone.

Have you tried putting the caller and callee side of this test in different 
compilation units and then linking a gcc-compiled caller with a clang-compiled 
callee (and then repeating that for the other three combinations) like the test 
generator in tools/clang/utils/ABITest does? Does this produce a program that 
executes correctly for all four combinations?

> > Hmm.  On MIPS64, a slot is 64 bits, right?  How is a float passed?

>  Oh, floats are promoted to doubles in varargs, of course, which neatly makes 
> that an impossible situation.

> 

> My inclination is that the right condition here is that only integer types 
> should be right-justified in their slot, but I'll admit to not having an easy 
> example of a type for which your condition doesn't work.


Floats are left justified according to the 'MIPSproTM N32 ABI Handbook' (which 
also discusses the O32 and N64 ABI's) but I can't think of a test case that 
would expose a problem due to the promotion to double.



Comment at: test/CodeGen/struct-union-BE.c:1-3
@@ +1,4 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S 
-emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+

Do we need %clang and -O2? Can we use %clang_cc1 and the default optimization 
level instead?


http://reviews.llvm.org/D21611



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


Re: [PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-23 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

In that case the MIPS side of this LGTM. Someone more familiar with ARM should 
approve it for ARM.


http://reviews.llvm.org/D21611



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


Re: [PATCH] D21599: [Libcxx][MIPS] Use LLVM CheckAtomic.cmake module to figure out whether we need to link with libatomic.

2016-07-12 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

What sets HAVE_CXX_LIBATOMICS64? I don't see a reference to LLVM's CheckAtomic.


Repository:
  rL LLVM

http://reviews.llvm.org/D21599



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


Re: [PATCH] D21599: [Libcxx][MIPS] Use LLVM CheckAtomic.cmake module to figure out whether we need to link with libatomic.

2016-07-12 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Have you tried a standalone build? I suspect HAVE_CXX_LIBATOMICS64 will never 
be set for that case. If that's the case, adding 'include(CheckAtomic)' will 
probably fix it.


Repository:
  rL LLVM

http://reviews.llvm.org/D21599



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


Re: [PATCH] D21599: [Libcxx][MIPS] Use LLVM CheckAtomic.cmake module to figure out whether we need to link with libatomic.

2016-07-12 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

I haven't used it that way either and I'm not sure it's a supported build for 
libcxx but most LLVM projects support a standalone build as far as I know. Can 
someone from the libcxx project confirm whether standalone builds are supported?


Repository:
  rL LLVM

http://reviews.llvm.org/D21599



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


Re: [PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-07-12 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 63676.
dsanders added a comment.

Updated to match latest version of http://reviews.llvm.org/D21467.

At this point Mips is in the X86/everyone-else camp but there's a loose end to
tie up in LLVM in order to prove it. Once LLVM rejects non-empty ABIName's
for Mips, we have proven we're in the X86/everyone-else camp and can start
uniting the Mips/X86/everyone-else camp with the ARM/PowerPC camp.


http://reviews.llvm.org/D21070

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -69,6 +69,10 @@
   /// The name of the target triple to assemble for.
   std::string Triple;
 
+  /// The name of the ABI to assembler for or the empty string for the default
+  /// ABI.
+  std::string ABI;
+
   /// If given, the name of the target CPU to determine which instructions
   /// are legal.
   std::string CPU;
@@ -134,6 +138,7 @@
 public:
   AssemblerInvocation() {
 Triple = "";
+ABI = "";
 NoInitialTextSection = 0;
 InputFile = "-";
 OutputPath = "-";
@@ -185,13 +190,24 @@
 
   // Target Options
   Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.ABI = Args.getLastArgValue(OPT_target_abi);
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.Features = Args.getAllArgValues(OPT_target_feature);
 
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
 
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
+
   // Language Options
   Opts.IncludePaths = Args.getAllArgValues(OPT_I);
   Opts.NoInitialTextSection = Args.hasArg(OPT_n);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2301,6 +2301,16 @@
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+
+  // Modify the Triple and ABI according to the Triple and ABI.
+  llvm::Triple ABITriple;
+  StringRef ABIName;
+  std::tie(ABITriple, ABIName) =
+  llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() == llvm::Triple::UnknownArch)
+Diags.Report(diag::err_target_unknown_abi) << Opts.ABI;
+  Opts.Triple = ABITriple.str();
+  Opts.ABI = ABIName;
 }
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1202,7 +1202,7 @@
   // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the
   // default for mips64(el)?-img-linux-gnu.
   if (Triple.getVendor() == llvm::Triple::ImaginationTechnologies &&
-  Triple.getEnvironment() == llvm::Triple::GNU) {
+  Triple.isGNUEnvironment()) {
 DefMips32CPU = "mips32r6";
 DefMips64CPU = "mips64r6";
   }
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2344,7 +2344,7 @@
 
   if (TargetTriple.getVendor() == llvm::Triple::ImaginationTechnologies &&
   TargetTriple.getOS() == llvm::Triple::Linux &&
-  TargetTriple.getEnvironment() == llvm::Triple::GNU)
+  TargetTriple.isGNUEnvironment())
 return findMipsImgMultilibs(Flags, NonExistent, Result);
 
   if (findMipsCsMultilibs(Flags, NonExistent, Result))
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7134,10 +7134,22 @@
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-setABI((getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel)
-   ? "o32"
-   : "n64");
+if (getTriple().getEnvironment() == llvm::Triple::ABI32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABI32 ||
+getTriple().getEnvironment() == llvm::Triple::AndroidABI32)
+  setABI("o32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABIN32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABIN32)
+  setABI("n32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABI64 ||
+  

r262350 - Explicitly select IAS in new embed-bitcode.c test.

2016-03-01 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Mar  1 11:15:11 2016
New Revision: 262350

URL: http://llvm.org/viewvc/llvm-project?rev=262350&view=rev
Log:
Explicitly select IAS in new embed-bitcode.c test.

This should fix clang-cmake-mips builder since MIPS does not have IAS enabled
by default (yet).


Modified:
cfe/trunk/test/Driver/embed-bitcode.c

Modified: cfe/trunk/test/Driver/embed-bitcode.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/embed-bitcode.c?rev=262350&r1=262349&r2=262350&view=diff
==
--- cfe/trunk/test/Driver/embed-bitcode.c (original)
+++ cfe/trunk/test/Driver/embed-bitcode.c Tue Mar  1 11:15:11 2016
@@ -2,7 +2,7 @@
 // CHECK: clang
 // CHECK: clang
 
-// RUN: %clang %s -c -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-CC
+// RUN: %clang %s -c -fembed-bitcode -fintegrated-as 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-CC
 // CHECK-CC: -cc1
 // CHECK-CC: -emit-llvm-bc
 // CHECK-CC: -cc1
@@ -26,7 +26,7 @@
 // CHECK-LTO-NOT: -cc1
 // CHECK-LTO-NOT: -fembed-bitcode
 
-// RUN: %clang -c %s -fembed-bitcode-marker 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-MARKER
+// RUN: %clang -c %s -fembed-bitcode-marker -fintegrated-as 2>&1 -### | 
FileCheck %s -check-prefix=CHECK-MARKER
 // CHECK-MARKER: -cc1
 // CHECK-MARKER: -emit-obj
 // CHECK-MARKER: -fembed-bitcode-marker


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


RE: r262282 - Introduce -fembed-bitcode driver option

2016-03-01 Thread Daniel Sanders via cfe-commits
Hi,

I've made a small change to the test case in r262350 to fix the 
clang-cmake-mips builder. MIPS doesn't
enable the integrated assembler by default yet so it was failing to find the 
-emit-obj option. I've fixed this by adding -fintegrated-as.


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Steven Wu 
via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 01 March 2016 01:07
To: cfe-commits@lists.llvm.org
Subject: r262282 - Introduce -fembed-bitcode driver option

Author: steven_wu
Date: Mon Feb 29 19:07:58 2016
New Revision: 262282

URL: http://llvm.org/viewvc/llvm-project?rev=262282&view=rev
Log:
Introduce -fembed-bitcode driver option

Summary:
This is the clang driver part of the change to embedded bitcode. This
includes:
1. -fembed-bitcode option which breaks down the compilation into two
stages. The first stage emits optimized bitcode and the second stage
compiles bitcode into object file.
2. -fembed-bitcode-marker option which doesn't really break down to
two stages to speedup the compilation flow.
3. pass the correct linker flag to darwin linker if tool chains supports
embedded bitcode.

Reviewers: rsmith, thakis

Subscribers: thakis, cfe-commits

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

Added:
cfe/trunk/test/Driver/embed-bitcode.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=262282&r1=262281&r2=262282&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Feb 29 19:07:58 
2016
@@ -134,7 +134,9 @@ def err_drv_omp_host_ir_file_not_found :
   "The provided host compiler IR file '%0' is required to generate code for 
OpenMP target regions but cannot be found.">;
 def err_drv_omp_host_target_not_supported : Error<
   "The target '%0' is not a supported OpenMP host target.">;
-
+def err_drv_bitcode_unsupported_on_toolchain : Error<
+  "-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
+
 def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup;
 def warn_drv_lto_libpath : Warning<"libLTO.dylib relative to clang installed 
dir not found; using 'ld' default search path instead">,
   InGroup;

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=262282&r1=262281&r2=262282&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Mon Feb 29 19:07:58 2016
@@ -83,6 +83,12 @@ class Driver {
 SaveTempsObj
   } SaveTemps;

+  enum BitcodeEmbedMode {
+EmbedNone,
+EmbedMarker,
+EmbedBitcode
+  } BitcodeEmbed;
+
   /// LTO mode selected via -f(no-)?lto(=.*)? options.
   LTOKind LTOMode;

@@ -262,6 +268,9 @@ public:
   bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
   bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }

+  bool embedBitcodeEnabled() const { return BitcodeEmbed == EmbedBitcode; }
+  bool embedBitcodeMarkerOnly() const { return BitcodeEmbed == EmbedMarker; }
+
   /// @}
   /// @name Primary Functionality
   /// @{

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=262282&r1=262281&r2=262282&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Feb 29 19:07:58 2016
@@ -437,6 +437,12 @@ def fno_autolink : Flag <["-"], "fno-aut
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable generation of linker directives for automatic library 
linking">;

+def fembed_bitcode : Flag<["-"], "fembed-bitcode">, Group,
+  Flags<[CC1Option, CC1AsOption]>,
+  HelpText<"Embed LLVM IR bitcode as data">;
+def fembed_bitcode_marker : Flag<["-"], "fembed-bitcode-marker">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Embed placeholder LLVM IR data as a marker">;
 def fgnu_inline_asm : Flag<["-"], "fgnu-inline-asm">, Group, 
Flags<[DriverOption]>;
 def fno_gnu_inline_asm : Flag<["-"], "fno-gnu-inline-asm">, Group,
   Flags<[DriverOption, CC1Option]>,

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=262282&r1

r262409 - Explicitly select IAS on one more RUN line in new embed-bitcode.c test.

2016-03-01 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Mar  1 15:57:22 2016
New Revision: 262409

URL: http://llvm.org/viewvc/llvm-project?rev=262409&view=rev
Log:
Explicitly select IAS on one more RUN line in new embed-bitcode.c test.

This should fix clang-cmake-mips builder since MIPS does not have IAS enabled
by default (yet).

Modified:
cfe/trunk/test/Driver/embed-bitcode.c

Modified: cfe/trunk/test/Driver/embed-bitcode.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/embed-bitcode.c?rev=262409&r1=262408&r2=262409&view=diff
==
--- cfe/trunk/test/Driver/embed-bitcode.c (original)
+++ cfe/trunk/test/Driver/embed-bitcode.c Tue Mar  1 15:57:22 2016
@@ -9,7 +9,7 @@
 // CHECK-CC: -emit-obj
 // CHECK-CC: -fembed-bitcode
 
-// RUN: %clang %s -c -save-temps -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-SAVE-TEMP
+// RUN: %clang %s -c -save-temps -fembed-bitcode -fintegrated-as 2>&1 -### | 
FileCheck %s -check-prefix=CHECK-SAVE-TEMP
 // CHECK-SAVE-TEMP: -cc1
 // CHECK-SAVE-TEMP: -E
 // CHECK-SAVE-TEMP: -cc1


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


RE: r262282 - Introduce -fembed-bitcode driver option

2016-03-01 Thread Daniel Sanders via cfe-commits
No problem.

It seems I missed one of the relevant RUN lines on the first attempt. I've 
fixed that in r262409. 

From: steve...@apple.com [steve...@apple.com]
Sent: 01 March 2016 17:26
To: Daniel Sanders
Cc: cfe-commits@lists.llvm.org
Subject: Re: r262282 - Introduce -fembed-bitcode driver option

Great. Thanks for the fix.

Steven

> On Mar 1, 2016, at 9:24 AM, Daniel Sanders  wrote:
>
> Hi,
>
> I've made a small change to the test case in r262350 to fix the 
> clang-cmake-mips builder. MIPS doesn't
> enable the integrated assembler by default yet so it was failing to find the 
> -emit-obj option. I've fixed this by adding -fintegrated-as.
>
> 
> From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Steven Wu 
> via cfe-commits [cfe-commits@lists.llvm.org]
> Sent: 01 March 2016 01:07
> To: cfe-commits@lists.llvm.org
> Subject: r262282 - Introduce -fembed-bitcode driver option
>
> Author: steven_wu
> Date: Mon Feb 29 19:07:58 2016
> New Revision: 262282
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262282&view=rev
> Log:
> Introduce -fembed-bitcode driver option
>
> Summary:
> This is the clang driver part of the change to embedded bitcode. This
> includes:
> 1. -fembed-bitcode option which breaks down the compilation into two
> stages. The first stage emits optimized bitcode and the second stage
> compiles bitcode into object file.
> 2. -fembed-bitcode-marker option which doesn't really break down to
> two stages to speedup the compilation flow.
> 3. pass the correct linker flag to darwin linker if tool chains supports
> embedded bitcode.
>
> Reviewers: rsmith, thakis
>
> Subscribers: thakis, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D17390
>
> Added:
>cfe/trunk/test/Driver/embed-bitcode.c
> Modified:
>cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
>cfe/trunk/include/clang/Driver/Driver.h
>cfe/trunk/include/clang/Driver/Options.td
>cfe/trunk/include/clang/Driver/ToolChain.h
>cfe/trunk/lib/Driver/Driver.cpp
>cfe/trunk/lib/Driver/ToolChains.cpp
>cfe/trunk/lib/Driver/ToolChains.h
>cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=262282&r1=262281&r2=262282&view=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Feb 29 
> 19:07:58 2016
> @@ -134,7 +134,9 @@ def err_drv_omp_host_ir_file_not_found :
>   "The provided host compiler IR file '%0' is required to generate code for 
> OpenMP target regions but cannot be found.">;
> def err_drv_omp_host_target_not_supported : Error<
>   "The target '%0' is not a supported OpenMP host target.">;
> -
> +def err_drv_bitcode_unsupported_on_toolchain : Error<
> +  "-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
> +
> def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup;
> def warn_drv_lto_libpath : Warning<"libLTO.dylib relative to clang installed 
> dir not found; using 'ld' default search path instead">,
>   InGroup;
>
> Modified: cfe/trunk/include/clang/Driver/Driver.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=262282&r1=262281&r2=262282&view=diff
> ==
> --- cfe/trunk/include/clang/Driver/Driver.h (original)
> +++ cfe/trunk/include/clang/Driver/Driver.h Mon Feb 29 19:07:58 2016
> @@ -83,6 +83,12 @@ class Driver {
> SaveTempsObj
>   } SaveTemps;
>
> +  enum BitcodeEmbedMode {
> +EmbedNone,
> +EmbedMarker,
> +EmbedBitcode
> +  } BitcodeEmbed;
> +
>   /// LTO mode selected via -f(no-)?lto(=.*)? options.
>   LTOKind LTOMode;
>
> @@ -262,6 +268,9 @@ public:
>   bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
>   bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
>
> +  bool embedBitcodeEnabled() const { return BitcodeEmbed == EmbedBitcode; }
> +  bool embedBitcodeMarkerOnly() const { return BitcodeEmbed == EmbedMarker; }
> +
>   /// @}
>   /// @name Primary Functionality
>   /// @{
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=262282&r1=262281&r2=262282&view=diff
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Feb 29 19:07:58 2016
> @@ -437,6 +437,12 @@ def fno_autolink : Flag <["-"], "fno-aut
>   Flags<[DriverOption, CC1Option]>,
>   HelpText<"Disable generation of linker directives for automatic library 
> linking">;
>
> +def fembed_bitcode : Fl

Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-03-03 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.

Thanks. LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



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


Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-03-05 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

In http://reviews.llvm.org/D16139#368217, @echristo wrote:

> This seems wrong. You should fix setCPU instead or set a default CPU.


We already set a default CPU in the constructor (e.g. 
Mips32TargetInfoBase::Mips32TargetInfoBase() provides "mips32r2"). It's the CPU 
argument to initFeatureMap() that's the root problem. In several targets, this 
argument has the same name as a member variable and is not subject to anything 
the constructor or setCPU() does to that member variable.

I suspect the right thing to do is to drop the CPU argument and use the member 
variable instead but there may be differences in value/usage that make this 
difficult. For now, this patch serves as a stop-gap measure that resolves the 
empty string to a real CPU name.


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



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


RE: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-03-09 Thread Daniel Sanders via cfe-commits
> > From: Eric Christopher [echri...@gmail.com]
> > Sent: 09 March 2016 06:50
> > To: reviews+d16139+public+275805419034a...@reviews.llvm.org; Bhushan 
> > Attarde; Vasileios Kalintiris; Daniel Sanders
> > Cc: Sagar Thakur; Nitesh Jain; Mohit Bhakkad; Jaydeep Patil; 
> > cfe-commits@lists.llvm.org
> > Subject: Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string 
> > argument
> > 
> > On Sat, Mar 5, 2016 at 6:16 AM Daniel Sanders 
> > mailto:daniel.sand...@imgtec.com>> wrote:
> > dsanders added a comment.
> > 
> > In http://reviews.llvm.org/D16139#368217, @echristo wrote:
> > 
> > > This seems wrong. You should fix setCPU instead or set a default CPU.
> > 
> > We already set a default CPU in the constructor (e.g. 
> > Mips32TargetInfoBase::Mips32TargetInfoBase() provides "mips32r2").
> > It's the CPU argument to initFeatureMap() that's the root problem. In 
> > several targets, this argument has the same name as
> > a member variable and is not subject to anything the constructor or 
> > setCPU() does to that member variable.
> 
> To be clear, no, this is not the problem.

I can agree that there are additional problems (and that fixing them also fixes 
this problem) but I disagree that it's not a part of
the problem. At the moment, I think we're both looking at different aspects of 
it and saying "this is the whole problem" and I
think we've each missed the piece the other is looking at.

Suppose TargetOptions::CPU is the empty string and 
TargetInfo::CreateTargetInfo() is called. The call to AllocateTarget() will 
leave
MipsTargetInfoBase::CPU set to the default mips32r2 or mips64r2 (depending on 
the subclass). The call to MipsTargetInfoBase::setCPU()
will not happen because the CPU is the empty string. Then when 
MipsTargetInfoBase::initFeatureMap() is called we have the following
state:
* MipsTargetInfoBase::CPU is mips32r2 or mips64r2
* The CPU argument of initFeatureMap() is the empty string.
The CPU name came from a single place but only one path resolved the empty 
string to a CPU name. I think this is wrong and that
both paths should resolve to the default CPU, or preferably, there should only 
be one CPU variable.

Let's consider something other than MIPS for a moment. I'll pick SystemZ 
because it's the only other target that initializes its CPU
to a non-empty value in the constructor. In SystemZ, we have the following 
state for the above example:
* SystemZTargetInfo::CPU is z10
* The CPU argument of initFeatureMap() is the empty string.
Now, SystemZTargetInfo::initFeatureMap() doesn't have any checks for CPU == 
"z10" but if it did there would be a difference in
behaviour between the default 'z10' and an explicit 'z10' since CPU == "z10" 
would be false in the default 'z10' case (because CPU
would be the empty string).

Going back to MIPS, MipsTargetInfoBase::initFeatureMap() does encounter a 
difference between a default 'mips32r2' and an explicit
'mips32r2' because of the 'Features[CPU] = true' line. The clang driver 
currently makes sure we're always explicit but lldb doesn't have this.

Fixing the above inconsistency would resolve the problem by itself, but I do 
agree that we're also handling the CPU name incorrectly
in MipsTargetInfoBase::initFeatureMap(). I agree that the 'Features[CPU] = 
true' is bad and fixing that should also resolve the problem by
itself. However, it would leave this weird inconsistency between the default 
'mips32r2' and the explicit 'mips32r2'.

I'm also wondering if the 'Features[CPU] = true' line might be redundant since 
the backend Processor<> and ProcessorModel<>
definitions should have the same effect. I'll have to look into that when I get 
chance.

> > I suspect the right thing to do is to drop the CPU argument and use the 
> > member variable instead but there may be differences in value/usage that 
> > make this difficult. For now, this patch serves as a stop-gap measure that 
> > resolves the empty string to a real CPU name.
> 
> This is also not the problem. There are a few problems here:
> 
> z) This code is terrible, I did my best to clean it up recently, but it's a 
> lot of code and a bit painful.
> a) There should be a testcase, everything can be done by the driver here as 
> the code is pretty specialized for that use case.

The test case is intended to be the lldb testsuite, without it lldb emits 
countless warnings about the '+' feature. I'm not aware of a
way to trigger the problem from the clang driver since it always passes an 
explicit CPU name. As a result, I'm don't know of a way to
test on the clang side.

> b) CPUs are not subtarget features (or they shouldn't be), they're CPUs that 
> contain features. They may be generic names for ISAs as well, but probably 
> best to keep them separate.

I agree, we have two separate concepts that happen to use the same strings. We 
should probably map them explicitly.

> c) You should set the features based on the CPUs given to the function. The 
> typical way the cpu comes in, is via

Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-03-09 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Thanks for working on this.



Comment at: llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp:2715-2718
@@ -2714,3 +2714,6 @@
 
-  unsigned TrgReg;
+  // TrgReg should never normally be assigned NUM_TARGET_REGS.
+  // If you end up with NUM_TARGET_REGS, you have a bug.
+  // FIXME: is there a better way to ensure TrgReg is assigned something?
+  unsigned TrgReg = Mips::NUM_TARGET_REGS;
   if (TrgOp.isReg())

I think this should be Mips::NoRegister.


Comment at: llvm/lib/Target/Mips/MipsAsmPrinter.cpp:889-938
@@ -888,48 +888,52 @@
   OutStreamer->EmitSymbolAttribute(MSymbol, MCSA_Global);
-  const char *RetType;
+  const char *RetType = "";
   //
   // make the comment field identifying the return and parameter
   // types of the floating point stub
   // # Stub function to call rettype  (params)
   //
   switch (Signature->RetSig) {
   case FRet:
 RetType = "float";
 break;
   case DRet:
 RetType = "double";
 break;
   case CFRet:
 RetType = "complex";
 break;
   case CDRet:
 RetType = "double complex";
 break;
   case NoFPRet:
 RetType = "";
 break;
+  default:
+llvm_unreachable("Unexpected FPReturnVariant!");
   }
-  const char *Parms;
+  const char *Parms = "";
   switch (Signature->ParamSig) {
   case FSig:
 Parms = "float";
 break;
   case FFSig:
 Parms = "float, float";
 break;
   case FDSig:
 Parms = "float, double";
 break;
   case DSig:
 Parms = "double";
 break;
   case DDSig:
 Parms = "double, double";
 break;
   case DFSig:
 Parms = "double, float";
 break;
   case NoSig:
 Parms = "";
 break;
+  default:
+llvm_unreachable("Unexpected FPParamVariant!");
   }

These two are false positives since all the enum values are covered.

The default labels cause warnings when clang is the compiler:
  lib/Target/Mips/MipsAsmPrinter.cpp:911:3: warning: default label in switch 
which covers all enumeration values [-Wcovered-switch-default]
which will cause -Werror builders to fail.

I'd suggest dropping the default labels to avoid the clang warning, but keeping 
the initializations to keep your compiler happy.


http://reviews.llvm.org/D17983



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


Re: [PATCH] D16538: [cc1as] Add MCTargetOptions argument to createAsmBackend

2016-03-11 Thread Daniel Sanders via cfe-commits
dsanders added subscribers: eugenis, ygorshenin.
dsanders added a comment.

I think it refers to MCTargetOptions::SanitizeAddress but I don't know where 
we'd get that information from. Unfortunately, it seems that the original 
author (@ygorshenin) might not be on the list anymore (phabricator shows no 
activity since 2014) but we can ask Evgeniy.



Comment at: tools/driver/cc1as_main.cpp:413-416
@@ -412,6 +414,6 @@
 
   // FIXME: init MCTargetOptions from sanitizer flags here.
   MCTargetOptions Options;
   std::unique_ptr TAP(
   TheTarget->createMCAsmParser(*STI, *Parser, *MCII, Options));
   if (!TAP)

@eugenis: Do you know what needs to be done for this FIXME?


http://reviews.llvm.org/D16538



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


Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-03-23 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

> > > b) CPUs are not subtarget features (or they shouldn't be), they're CPUs 
> > > that contain features. They may be generic names for ISAs as well, but 
> > > probably best to keep them separate.

>  > 

>  > I agree, we have two separate concepts that happen to use the same 
> strings. We should probably map them explicitly.

>  > 

>  Yes, and that's what you should do instead of this patch.


Just making the mapping explicit isn't enough by itself. We still have to 
resolve the empty string to the default CPU because initFeatureMap()'s CPU 
argument dodges the defaults that are normally handled in the constructor. I'll 
post patches soon (I've been away for a few days too) I just need to test a 
couple changes we're agreed on first and sort out some remaining IAS work.

> > > c) You should set the features based on the CPUs given to the function. 
> > > The typical way the cpu comes in, is via -target-cpu which comes via:

>  > >

>  > >   case llvm::Triple::mips:

>  > >   case llvm::Triple::mipsel:

>  > >   case llvm::Triple::mips64:

>  > >   case llvm::Triple::mips64el: {

>  > > StringRef CPUName;

>  > > StringRef ABIName;

>  > > mips::getMipsCPUAndABI(Args, T, CPUName, ABIName);

>  > > return CPUName;

>  > >   }

>  > >

>  > > for mips.

>  > >

>  > > Now if your triple is returning an empty string here you might have 
> gotten to where you are (I tried mips64r2-linux-gnu as the -target option). 
> Which is what typically happens down

>  > >  this path.

>  > 

>  > This usage is from the clang driver. On this path, getMipsCPUAndABI 
> ensures that the CPU is never empty.

> 

> I gave you a testcase that can prove otherwise in my earlier email.


I don't think it proves otherwise. The triple you quoted isn't a supported MIPS 
triple and LLVM will reject it. LLVM for MIPS doesn't accept CPU names in the 
first component of the triple and this particular one isn't known to gcc 
either. Can you give me the exact command you tried? I get this:

  $ bin/clang -target mips64r2-linux-gnu -o hello.s -S hello.c
  error: unknown target triple 'mips64r2--linux-gnu', please use -triple or 
-arch
  $ bin/llc -mtriple mips64r2-linux-gnu -o hello.s hello.bc
  bin/llc: : error: unable to get target for 'mips64r2--linux-gnu', see 
--version and --triple.

and if a triple that wasn't mips/mipsel/mips64/mips64el somehow got in to 
getMipsCPUAndABI() it would trigger an llvm_unreachable().

It's impossible to provide a known MIPS triple and end up with the empty string 
as the CPU name within the clang driver. The empty string is only known to 
occur from LLDB's usage.


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



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


Re: [PATCH] D17378: Add additional Hi/Lo registers to Clang MipsTargetInfoBase

2016-03-29 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM

Sorry for missing this when it was first posted. I've also been away for 
roughly half of the two weeks since Petar added me to the review.


http://reviews.llvm.org/D17378



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


RE: r256468 - On {mips, mipsel, mips64, mips64el}-freebsd, we need to pass any -G option to the assembler.

2016-01-14 Thread Daniel Sanders via cfe-commits
Did you get an answer to this question? I think it's just that the FreeBSD 
class hasn't refactored to that style yet.
That switch statement is getting quite large so it would be a nice cleanup to 
switch to that style.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Joerg Sonnenberger via cfe-commits
> Sent: 27 December 2015 11:59
> To: cfe-commits@lists.llvm.org
> Subject: Re: r256468 - On {mips, mipsel, mips64, mips64el}-freebsd, we need
> to pass any -G option to the assembler.
> 
> On Sun, Dec 27, 2015 at 10:36:44AM -, Dimitry Andric via cfe-commits
> wrote:
> > Author: dim
> > Date: Sun Dec 27 04:36:44 2015
> > New Revision: 256468
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=256468&view=rev
> > Log:
> > On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option
> to the assembler.
> 
> Why is this reinventing the wheel and not using AddMIPSTargetArgs?
> 
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r256468 - On {mips, mipsel, mips64, mips64el}-freebsd, we need to pass any -G option to the assembler.

2016-01-14 Thread Daniel Sanders via cfe-commits
-G isn't handled there at the moment but ClangAs::AddMIPSTargetArgs() and 
Clang::AddMIPSTargetArgs() would be the right place to add it in the Linux 
toolchain when we add it.

The cleanup I'm referring to is that someone hoisted the bulk of the code out 
of the big switch-statement in Clang::ConstructJob() and 
ClangAs::ConstructJob() into AddTargetArgs() functions. The 
switch-statement in freebsd::Assembler::ConstructJob() isn't as big as either 
of those yet but it's already reached a couple screens long. I think 
freebsd::Assembler::ConstructJob() should take the same approach at some point 
in the near future.

From: Dimitry Andric [dimi...@andric.com]
Sent: 14 January 2016 19:20
To: Daniel Sanders
Cc: Joerg Sonnenberger; cfe-commits@lists.llvm.org
Subject: Re: r256468 - On {mips, mipsel, mips64, mips64el}-freebsd, we need to 
pass any -G option to the assembler.

Sorry, but I fail to see where in AddMIPSTargetArgs the -G options are handled? 
 What is the general idea about the "new style" cleanup?

-Dimitry

> On 14 Jan 2016, at 18:13, Daniel Sanders  wrote:
>
> Did you get an answer to this question? I think it's just that the FreeBSD 
> class hasn't refactored to that style yet.
> That switch statement is getting quite large so it would be a nice cleanup to 
> switch to that style.
>
>> -Original Message-
>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
>> Of Joerg Sonnenberger via cfe-commits
>> Sent: 27 December 2015 11:59
>> To: cfe-commits@lists.llvm.org
>> Subject: Re: r256468 - On {mips, mipsel, mips64, mips64el}-freebsd, we need
>> to pass any -G option to the assembler.
>>
>> On Sun, Dec 27, 2015 at 10:36:44AM -, Dimitry Andric via cfe-commits
>> wrote:
>>> Author: dim
>>> Date: Sun Dec 27 04:36:44 2015
>>> New Revision: 256468
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=256468&view=rev
>>> Log:
>>> On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option
>> to the assembler.
>>
>> Why is this reinventing the wheel and not using AddMIPSTargetArgs?
>>
>> Joerg
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


RE: r257827 - [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On

2016-01-15 Thread Daniel Sanders via cfe-commits
Hi Chris,

This doesn't seem to work when building clang separately from llvm. LLVMLinux 
fails to build clang with:
CMake Error at CMakeLists.txt:104 (include):
  include could not find load file:

VersionFromVCS

CMake Error at CMakeLists.txt:222 (add_version_info_from_vcs):
  Unknown CMake command "add_version_info_from_vcs".
See 
http://buildbot.llvm.linuxfoundation.org/builders/13_malta/builds/383/steps/shell_3/logs/stdio
 for the full log.

I've added a patch to llvmlinux to work around the problem for now 
http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=toolchain/clang/patches/clang/workaround-versionfromvcsbug.patch;h=848a096df37b1255575650680a266234f5d4936e;hb=e0c4c72c5a008006dc230db748ea69e0d1518daf.
Should we make that change to clang or fix it another way?

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Chris Bieneman via cfe-commits
> Sent: 14 January 2016 22:45
> To: cfe-commits@lists.llvm.org
> Subject: r257827 - [CMake] Set SVN_REVISION if
> CLANG_APPEND_VC_REV=On
> 
> Author: cbieneman
> Date: Thu Jan 14 16:45:12 2016
> New Revision: 257827
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=257827&view=rev
> Log:
> [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On
> 
> This matches autoconf's ability to put clang revisions in the clang --version
> spew.
> 
> Modified:
> cfe/trunk/CMakeLists.txt
> 
> Modified: cfe/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/CMakeLists.txt?rev=257827&r1=257826&r2=257827&view
> =diff
> ==
> 
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Thu Jan 14 16:45:12 2016
> @@ -101,6 +101,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
>include(AddLLVM)
>include(TableGen)
>include(HandleLLVMOptions)
> +  include(VersionFromVCS)
> 
>set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
> 
> @@ -213,6 +214,18 @@ if(CLANG_REPOSITORY_STRING)
>add_definitions(-
> DCLANG_REPOSITORY_STRING="${CLANG_REPOSITORY_STRING}")
>  endif()
> 
> +option(CLANG_APPEND_VC_REV
> +  "Append the version control system revision id to clang version spew"
> OFF)
> +
> +if(NOT SVN_REVISION)
> +  # This macro will set SVN_REVISION in the parent scope
> +  add_version_info_from_vcs(VERSION_VAR)
> +endif()
> +
> +if(SVN_REVISION)
> +  add_definitions(-DSVN_REVISION="${SVN_REVISION}")
> +endif()
> +
>  set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
>"Vendor-specific uti.")
> 
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r257827 - [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On

2016-01-18 Thread Daniel Sanders via cfe-commits
Thanks, that did the trick. I've removed the workaround from LLVMLinux.

> -Original Message-
> From: cbiene...@apple.com [mailto:cbiene...@apple.com] On Behalf Of
> Chris Bieneman
> Sent: 15 January 2016 17:55
> To: Daniel Sanders
> Cc: cfe-commits@lists.llvm.org
> Subject: Re: r257827 - [CMake] Set SVN_REVISION if
> CLANG_APPEND_VC_REV=On
> 
> Thanks for the heads up. It looks like that module is was excluded from the
> LLVM install. I’ve changed that in LLVM r257909. That change should resolve
> your build issue. Please let me know if you continue having problems.
> 
> Thanks,
> -Chris
> 
> > On Jan 15, 2016, at 5:18 AM, Daniel Sanders 
> wrote:
> >
> > Hi Chris,
> >
> > This doesn't seem to work when building clang separately from llvm.
> LLVMLinux fails to build clang with:
> > CMake Error at CMakeLists.txt:104 (include):
> >   include could not find load file:
> >
> > VersionFromVCS
> >
> > CMake Error at CMakeLists.txt:222 (add_version_info_from_vcs):
> >   Unknown CMake command "add_version_info_from_vcs".
> > See
> http://buildbot.llvm.linuxfoundation.org/builders/13_malta/builds/383/step
> s/shell_3/logs/stdio for the full log.
> >
> > I've added a patch to llvmlinux to work around the problem for now
> http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=toolchain/clang/pat
> ches/clang/workaround-
> versionfromvcsbug.patch;h=848a096df37b1255575650680a266234f5d4936e;h
> b=e0c4c72c5a008006dc230db748ea69e0d1518daf.
> > Should we make that change to clang or fix it another way?
> >
> >> -Original Message-
> >> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On
> Behalf
> >> Of Chris Bieneman via cfe-commits
> >> Sent: 14 January 2016 22:45
> >> To: cfe-commits@lists.llvm.org
> >> Subject: r257827 - [CMake] Set SVN_REVISION if
> >> CLANG_APPEND_VC_REV=On
> >>
> >> Author: cbieneman
> >> Date: Thu Jan 14 16:45:12 2016
> >> New Revision: 257827
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=257827&view=rev
> >> Log:
> >> [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On
> >>
> >> This matches autoconf's ability to put clang revisions in the clang 
> >> --version
> >> spew.
> >>
> >> Modified:
> >>cfe/trunk/CMakeLists.txt
> >>
> >> Modified: cfe/trunk/CMakeLists.txt
> >> URL: http://llvm.org/viewvc/llvm-
> >>
> project/cfe/trunk/CMakeLists.txt?rev=257827&r1=257826&r2=257827&view
> >> =diff
> >>
> ==
> >> 
> >> --- cfe/trunk/CMakeLists.txt (original)
> >> +++ cfe/trunk/CMakeLists.txt Thu Jan 14 16:45:12 2016
> >> @@ -101,6 +101,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
> >>   include(AddLLVM)
> >>   include(TableGen)
> >>   include(HandleLLVMOptions)
> >> +  include(VersionFromVCS)
> >>
> >>   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
> >>
> >> @@ -213,6 +214,18 @@ if(CLANG_REPOSITORY_STRING)
> >>   add_definitions(-
> >> DCLANG_REPOSITORY_STRING="${CLANG_REPOSITORY_STRING}")
> >> endif()
> >>
> >> +option(CLANG_APPEND_VC_REV
> >> +  "Append the version control system revision id to clang version spew"
> >> OFF)
> >> +
> >> +if(NOT SVN_REVISION)
> >> +  # This macro will set SVN_REVISION in the parent scope
> >> +  add_version_info_from_vcs(VERSION_VAR)
> >> +endif()
> >> +
> >> +if(SVN_REVISION)
> >> +  add_definitions(-DSVN_REVISION="${SVN_REVISION}")
> >> +endif()
> >> +
> >> set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
> >>   "Vendor-specific uti.")
> >>
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


[PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: mclow.lists, hans.
dsanders added a subscriber: cfe-commits.

http://reviews.llvm.org/D16406

Files:
  test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
  
test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
  test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
  test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
  
test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
  test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
  test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
  test/std/localization/locales/locale/locale.cons/default.pass.cpp
  test/std/localization/locales/locale/locale.members/name.pass.cpp
  test/std/localization/locales/locale/locale.operators/eq.pass.cpp
  test/std/localization/locales/locale/locale.statics/global.pass.cpp
  test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
  test/std/re/re.traits/default.pass.cpp
  test/std/re/re.traits/getloc.pass.cpp
  test/std/re/re.traits/imbue.pass.cpp

Index: test/std/re/re.traits/imbue.pass.cpp
===
--- test/std/re/re.traits/imbue.pass.cpp
+++ test/std/re/re.traits/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/getloc.pass.cpp
===
--- test/std/re/re.traits/getloc.pass.cpp
+++ test/std/re/re.traits/getloc.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/default.pass.cpp
===
--- test/std/re/re.traits/default.pass.cpp
+++ test/std/re/re.traits/default.pass.cpp
@@ -8,6 +8,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
===
--- test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
+++ test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template > class basic_regex;
Index: test/std/localization/locales/locale/locale.statics/global.pass.cpp
===
--- test/std/localization/locales/locale/locale.statics/global.pass.cpp
+++ test/std/localization/locales/locale/locale.statics/global.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // static const locale& classic();
Index: test/std/localization/locales/locale/locale.operators/eq.pass.cpp
===
--- test/std/localization/locales/locale/locale.operators/eq.pass.cpp
+++ test/std/localization/locales/locale/locale.operators/eq.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.members/name.pass.cpp
===
--- test/std/localization/locales/locale/locale.members/name.pass.cpp
+++ test/std/localization/locales/locale/locale.members/name.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.cons/default.pass.cpp
===
--- test/st

Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Hi,

I'd like to merge this to the 3.8 branch once it has been accepted.


http://reviews.llvm.org/D16406



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


Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 45531.
dsanders added a comment.

Added one more. It was also guarded by a check for ru_RU.UTF-8 so it was missed 
on the first sweep.


http://reviews.llvm.org/D16406

Files:
  test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
  
test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
  test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
  test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
  
test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
  test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
  test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
  test/std/localization/locales/locale/locale.cons/default.pass.cpp
  test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
  test/std/localization/locales/locale/locale.members/name.pass.cpp
  test/std/localization/locales/locale/locale.operators/eq.pass.cpp
  test/std/localization/locales/locale/locale.statics/global.pass.cpp
  test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
  test/std/re/re.traits/default.pass.cpp
  test/std/re/re.traits/getloc.pass.cpp
  test/std/re/re.traits/imbue.pass.cpp

Index: test/std/re/re.traits/imbue.pass.cpp
===
--- test/std/re/re.traits/imbue.pass.cpp
+++ test/std/re/re.traits/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/getloc.pass.cpp
===
--- test/std/re/re.traits/getloc.pass.cpp
+++ test/std/re/re.traits/getloc.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/default.pass.cpp
===
--- test/std/re/re.traits/default.pass.cpp
+++ test/std/re/re.traits/default.pass.cpp
@@ -8,6 +8,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
===
--- test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
+++ test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template > class basic_regex;
Index: test/std/localization/locales/locale/locale.statics/global.pass.cpp
===
--- test/std/localization/locales/locale/locale.statics/global.pass.cpp
+++ test/std/localization/locales/locale/locale.statics/global.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // static const locale& classic();
Index: test/std/localization/locales/locale/locale.operators/eq.pass.cpp
===
--- test/std/localization/locales/locale/locale.operators/eq.pass.cpp
+++ test/std/localization/locales/locale/locale.operators/eq.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.members/name.pass.cpp
===
--- test/std/localization/locales/locale/locale.members/name.pass.cpp
+++ test/std/localization/locales/locale/locale.members/name.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/lo

Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Thanks. I've added one more which came up after enabling all the missing 
locales except for en_US.UTF-8.

I'll commit this and find the other 8 with grep afterwards.


http://reviews.llvm.org/D16406



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


  1   2   >