aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td7
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td3
-rw-r--r--include/clang/Basic/TargetInfo.h11
-rw-r--r--include/clang/Basic/TargetOptions.h39
-rw-r--r--include/clang/CodeGen/CodeGenOptions.h7
-rw-r--r--include/clang/Frontend/ASTConsumers.h6
-rw-r--r--include/clang/Frontend/CompilerInstance.h7
-rw-r--r--include/clang/Frontend/CompilerInvocation.h9
-rw-r--r--include/clang/Frontend/FrontendOptions.h7
9 files changed, 72 insertions, 24 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
diff --git a/include/clang/CodeGen/CodeGenOptions.h b/include/clang/CodeGen/CodeGenOptions.h
index c076ec095f..e570e16756 100644
--- a/include/clang/CodeGen/CodeGenOptions.h
+++ b/include/clang/CodeGen/CodeGenOptions.h
@@ -52,13 +52,6 @@ public:
/// Inlining - The kind of inlining to perform.
InliningMethod Inlining;
- /// CPU - An optional CPU to target.
- std::string CPU;
-
- /// Features - A list of subtarget features to pass to the code
- /// generator.
- std::vector<std::string> Features;
-
public:
CodeGenOptions() {
OptimizationLevel = 0;
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index cd35638f2c..0e7d55e6e4 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -25,11 +25,12 @@ namespace llvm {
namespace clang {
class ASTConsumer;
+class CodeGenOptions;
class Diagnostic;
class FileManager;
-class Preprocessor;
-class CodeGenOptions;
class LangOptions;
+class Preprocessor;
+class TargetOptions;
// AST pretty-printer: prints out the AST in a format that is close to the
// original C code. The output is intended to be in a format such that
@@ -81,6 +82,7 @@ ASTConsumer *CreateBackendConsumer(BackendAction Action,
Diagnostic &Diags,
const LangOptions &Features,
const CodeGenOptions &CodeGenOpts,
+ const TargetOptions &TargetOpts,
const std::string &ModuleID,
llvm::raw_ostream *OS,
llvm::LLVMContext& C);
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 915755558e..ed28050877 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -191,6 +191,13 @@ public:
return Invocation.getPreprocessorOutputOpts();
}
+ TargetOptions &getTargetOpts() {
+ return Invocation.getTargetOpts();
+ }
+ const TargetOptions &getTargetOpts() const {
+ return Invocation.getTargetOpts();
+ }
+
/// }
/// @name Diagnostics Engine
/// {
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index fc0497a7ac..0cdb32b006 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/include/clang/Frontend/CompilerInvocation.h
@@ -11,6 +11,7 @@
#define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/TargetOptions.h"
#include "clang/CodeGen/CodeGenOptions.h"
#include "clang/Frontend/AnalysisConsumer.h"
#include "clang/Frontend/DependencyOutputOptions.h"
@@ -58,6 +59,9 @@ class CompilerInvocation {
/// Options controlling preprocessed output.
PreprocessorOutputOptions PreprocessorOutputOpts;
+ /// Options controlling the target.
+ TargetOptions TargetOpts;
+
public:
CompilerInvocation() {}
@@ -110,6 +114,11 @@ public:
return PreprocessorOutputOpts;
}
+ TargetOptions &getTargetOpts() { return TargetOpts; }
+ const TargetOptions &getTargetOpts() const {
+ return TargetOpts;
+ }
+
/// @}
};
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 67656067fc..f03b9d2b3a 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -85,13 +85,6 @@ public:
unsigned ShowTimers : 1; ///< Show timers for individual
/// actions.
- /// 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 TargetTriple;
-
- /// If given, the name of the target ABI to use.
- std::string TargetABI;
-
/// The input files and their types.
std::vector<std::pair<InputKind, std::string> > Inputs;