diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-15 06:48:46 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-15 06:48:46 +0000 |
commit | d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0 (patch) | |
tree | e082f87bb3c2c8ba64c0e6e0b77f6e39bcc885e1 /include/clang/Basic | |
parent | 7745cab137b9d91205f13a7adaebe6ed801595f7 (diff) |
Add TargetOptions and use it when constructing targets.
- This ended up being hard to factor, sorry for the large diff.
- Some post-commit cleanup to come.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/DiagnosticCommonKinds.td | 7 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 3 | ||||
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 11 | ||||
-rw-r--r-- | include/clang/Basic/TargetOptions.h | 39 |
4 files changed, 52 insertions, 8 deletions
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index bb251ad73b..9a342b592c 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -52,4 +52,11 @@ def warn_integer_too_large_for_signed : Warning< def note_invalid_subexpr_in_ice : Note< "subexpression not valid in an integer constant expression">; +// Targets + +def err_target_unknown_triple : Error< + "unknown target triple '%0', please use -triple or -arch">; +def err_target_unknown_abi : Error<"unknown target ABI '%0'">; +def err_target_invalid_feature : Error<"invalid target feature '%0'">; + } diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 75e6cbe4dd..e9b351ffe9 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -9,9 +9,6 @@ let Component = "Frontend" in { -def err_fe_unknown_triple : Error< - "unknown target triple '%0', please use -triple or -arch">; -def err_fe_unknown_target_abi : Error<"unknown target ABI '%0'">; def err_fe_error_opening : Error<"error opening '%0': %1">; def err_fe_error_reading : Error<"error reading '%0'">; def err_fe_error_reading_stdin : Error<"error reading stdin">; diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index f1c9cf1936..d2f7399b70 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -28,11 +28,12 @@ class StringRef; } namespace clang { - class Diagnostic; +class LangOptions; class SourceLocation; class SourceManager; -class LangOptions; +class TargetOptions; + namespace Builtin { struct Info; } /// TargetInfo - This class exposes information about the current target. @@ -59,9 +60,9 @@ protected: TargetInfo(const std::string &T); public: - /// CreateTargetInfo - Return the target info object for the specified target - /// triple. - static TargetInfo* CreateTargetInfo(const std::string &Triple); + /// CreateTargetInfo - Construct a target for the given options. + static TargetInfo* CreateTargetInfo(Diagnostic &Diags, + const TargetOptions &Opts); virtual ~TargetInfo(); diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h new file mode 100644 index 0000000000..eeaab1558f --- /dev/null +++ b/include/clang/Basic/TargetOptions.h @@ -0,0 +1,39 @@ +//===--- TargetOptions.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_FRONTEND_TARGETOPTIONS_H +#define LLVM_CLANG_FRONTEND_TARGETOPTIONS_H + +#include <string> +#include <vector> + +namespace clang { + +/// TargetOptions - Options for controlling the target. +class TargetOptions { +public: + + /// If given, the name of the target triple to compile for. If not given the + /// target will be selected to match the host. + std::string Triple; + + /// If given, the name of the target CPU to generate code for. + std::string CPU; + + /// If given, the name of the target ABI to use. + std::string ABI; + + /// The list of target specific features to enable or disable -- this should + /// be a list of strings starting with by '+' or '-'. + std::vector<std::string> Features; +}; + +} // end namespace clang + +#endif |