r199754 - Add -m16 option for using x86-*-*-code16 triple
David Woodhouse
dwmw2 at infradead.org
Tue Jan 21 09:19:44 PST 2014
Author: dwmw2
Date: Tue Jan 21 11:19:44 2014
New Revision: 199754
URL: http://llvm.org/viewvc/llvm-project?rev=199754&view=rev
Log:
Add -m16 option for using x86-*-*-code16 triple
Added:
cfe/trunk/test/Driver/x86_m16.c
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=199754&r1=199753&r2=199754&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jan 21 11:19:44 2014
@@ -951,6 +951,7 @@ def lazy__framework : Separate<["-"], "l
def lazy__library : Separate<["-"], "lazy_library">, Flags<[LinkerInput]>;
def EL : Flag<["-"], "EL">, Flags<[DriverOption]>;
def EB : Flag<["-"], "EB">, Flags<[DriverOption]>;
+def m16 : Flag<["-"], "m16">, Group<m_Group>, Flags<[DriverOption, CoreOption]>;
def m32 : Flag<["-"], "m32">, Group<m_Group>, Flags<[DriverOption, CoreOption]>;
def mqdsp6_compat : Flag<["-"], "mqdsp6-compat">, Group<m_Group>, Flags<[DriverOption,CC1Option]>,
HelpText<"Enable hexagon-qdsp6 backward compatibility">;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=199754&r1=199753&r2=199754&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jan 21 11:19:44 2014
@@ -1900,13 +1900,22 @@ static llvm::Triple computeTargetTriple(
Target.getOS() == llvm::Triple::Minix)
return Target;
- // Handle pseudo-target flags '-m32' and '-m64'.
- if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
+ // Handle pseudo-target flags '-m64', '-m32' and '-m16'.
+ if (Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_m32,
+ options::OPT_m16)) {
llvm::Triple::ArchType AT;
- if (A->getOption().matches(options::OPT_m32))
- AT = Target.get32BitArchVariant().getArch();
- else
+ if (A->getOption().matches(options::OPT_m64))
AT = Target.get64BitArchVariant().getArch();
+ else if (A->getOption().matches(options::OPT_m32))
+ AT = Target.get32BitArchVariant().getArch();
+ else if (A->getOption().matches(options::OPT_m16)) {
+ AT = Target.get32BitArchVariant().getArch();
+ if (AT == llvm::Triple::x86)
+ Target.setEnvironment(llvm::Triple::CODE16);
+ else
+ AT = llvm::Triple::UnknownArch;
+ }
+
if (AT != llvm::Triple::UnknownArch)
Target.setArch(AT);
}
Added: cfe/trunk/test/Driver/x86_m16.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86_m16.c?rev=199754&view=auto
==============================================================================
--- cfe/trunk/test/Driver/x86_m16.c (added)
+++ cfe/trunk/test/Driver/x86_m16.c Tue Jan 21 11:19:44 2014
@@ -0,0 +1,4 @@
+// RUN: %clang -target i386 -m16 -### -c %s 2>&1 | FileCheck %s
+
+// CHECK: Target: i386-{{.*}}-{{.*}}-code16
+
More information about the cfe-commits
mailing list