Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 1 | /* |
Stephen Hines | 0a813a3 | 2012-08-03 16:52:40 -0700 | [diff] [blame] | 2 | * Copyright 2010-2012, The Android Open Source Project |
Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Stephen Hines | 8b5c5c6 | 2014-06-06 18:03:18 -0700 | [diff] [blame] | 17 | #include "clang/Basic/DiagnosticOptions.h" |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 18 | #include "clang/Driver/DriverDiagnostic.h" |
Stephen Hines | a1f95ee | 2013-08-09 01:26:08 -0700 | [diff] [blame] | 19 | #include "clang/Driver/Options.h" |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 20 | #include "clang/Frontend/TextDiagnosticPrinter.h" |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 21 | #include "clang/Frontend/Utils.h" |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 22 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 23 | #include "llvm/ADT/SmallVector.h" |
Logan | be27482 | 2011-02-16 22:02:54 +0800 | [diff] [blame] | 24 | #include "llvm/ADT/IntrusiveRefCntPtr.h" |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 25 | |
Stephen Hines | a1f95ee | 2013-08-09 01:26:08 -0700 | [diff] [blame] | 26 | #include "llvm/Option/OptTable.h" |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 27 | #include "llvm/Support/CommandLine.h" |
| 28 | #include "llvm/Support/ManagedStatic.h" |
| 29 | #include "llvm/Support/MemoryBuffer.h" |
Logan | be27482 | 2011-02-16 22:02:54 +0800 | [diff] [blame] | 30 | #include "llvm/Support/Path.h" |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 31 | #include "llvm/Support/raw_ostream.h" |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 32 | #include "llvm/Target/TargetMachine.h" |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 33 | |
Stephen Hines | 8b5c5c6 | 2014-06-06 18:03:18 -0700 | [diff] [blame] | 34 | #include "rs_cc_options.h" |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 35 | #include "slang.h" |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 36 | #include "slang_assert.h" |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 37 | #include "slang_diagnostic_buffer.h" |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 38 | #include "slang_rs_reflect_utils.h" |
| 39 | |
Stephen Hines | 8b5c5c6 | 2014-06-06 18:03:18 -0700 | [diff] [blame] | 40 | #include <list> |
| 41 | #include <set> |
| 42 | #include <string> |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 43 | |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 44 | namespace { |
| 45 | class StringSet : public llvm::cl::StringSaver { |
| 46 | public: |
| 47 | const char *SaveString(const char *Str) override { |
| 48 | return Strings.insert(Str).first->c_str(); |
| 49 | } |
| 50 | |
| 51 | private: |
| 52 | std::set<std::string> Strings; |
| 53 | }; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 54 | } |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 55 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 56 | static const char *DetermineOutputFile(const std::string &OutputDir, |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 57 | const std::string &PathSuffix, |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 58 | const char *InputFile, |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 59 | slang::Slang::OutputType OutputType, |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 60 | StringSet *SavedStrings) { |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 61 | if (OutputType == slang::Slang::OT_Nothing) |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 62 | return "/dev/null"; |
| 63 | |
| 64 | std::string OutputFile(OutputDir); |
| 65 | |
Stephen Hines | 7f5704e | 2014-06-10 18:06:50 -0700 | [diff] [blame] | 66 | // Append '/' to Opts.mBitcodeOutputDir if not presents |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 67 | if (!OutputFile.empty() && |
Raphael | 8d5a2f6 | 2011-02-08 00:15:05 -0800 | [diff] [blame] | 68 | (OutputFile[OutputFile.size() - 1]) != OS_PATH_SEPARATOR) |
| 69 | OutputFile.append(1, OS_PATH_SEPARATOR); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 70 | |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 71 | if (!PathSuffix.empty()) { |
| 72 | OutputFile.append(PathSuffix); |
| 73 | OutputFile.append(1, OS_PATH_SEPARATOR); |
| 74 | } |
| 75 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 76 | if (OutputType == slang::Slang::OT_Dependency) { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 77 | // The build system wants the .d file name stem to be exactly the same as |
| 78 | // the source .rs file, instead of the .bc file. |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 79 | OutputFile.append(slang::RSSlangReflectUtils::GetFileNameStem(InputFile)); |
| 80 | } else { |
| 81 | OutputFile.append( |
| 82 | slang::RSSlangReflectUtils::BCFileNameFromRSFileName(InputFile)); |
| 83 | } |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 84 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 85 | switch (OutputType) { |
| 86 | case slang::Slang::OT_Dependency: { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 87 | OutputFile.append(".d"); |
| 88 | break; |
| 89 | } |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 90 | case slang::Slang::OT_Assembly: { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 91 | OutputFile.append(".S"); |
| 92 | break; |
| 93 | } |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 94 | case slang::Slang::OT_LLVMAssembly: { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 95 | OutputFile.append(".ll"); |
| 96 | break; |
| 97 | } |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 98 | case slang::Slang::OT_Object: { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 99 | OutputFile.append(".o"); |
| 100 | break; |
| 101 | } |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 102 | case slang::Slang::OT_Bitcode: { |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 103 | OutputFile.append(".bc"); |
| 104 | break; |
| 105 | } |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 106 | case slang::Slang::OT_Nothing: |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 107 | default: { |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 108 | slangAssert(false && "Invalid output type!"); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 112 | return SavedStrings->SaveString(OutputFile.c_str()); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 115 | typedef std::list<std::pair<const char*, const char*> > NamePairList; |
| 116 | |
| 117 | /* |
| 118 | * Compile the Inputs. |
| 119 | * |
| 120 | * Returns 0 on success and nonzero on failure. |
| 121 | * |
| 122 | * IOFiles - list of (foo.rs, foo.bc) pairs of input/output files. |
| 123 | * IOFiles32 - list of input/output pairs for 32-bit compilation. |
| 124 | * Inputs - input filenames. |
| 125 | * Opts - options controlling compilation. |
| 126 | * DiagEngine - Clang diagnostic engine (for creating diagnostics). |
| 127 | * DiagClient - Slang diagnostic consumer (collects and displays diagnostics). |
| 128 | * SavedStrings - expanded strings copied from argv source input files. |
| 129 | * |
| 130 | * We populate IOFiles dynamically while working through the list of Inputs. |
| 131 | * On any 64-bit compilation, we pass back in the 32-bit pairs of files as |
| 132 | * IOFiles32. This allows the 64-bit compiler to later bundle up both the |
| 133 | * 32-bit and 64-bit bitcode outputs to be included in the final reflected |
| 134 | * source code that is emitted. |
| 135 | */ |
| 136 | static int compileFiles(NamePairList *IOFiles, NamePairList *IOFiles32, |
| 137 | const llvm::SmallVector<const char*, 16> &Inputs, slang::RSCCOptions &Opts, |
| 138 | clang::DiagnosticsEngine *DiagEngine, slang::DiagnosticBuffer *DiagClient, |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 139 | StringSet *SavedStrings) { |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 140 | NamePairList DepFiles; |
| 141 | std::string PathSuffix = ""; |
Stephen Hines | 2d504fd | 2014-08-15 01:52:40 -0700 | [diff] [blame] | 142 | bool CompileSecondTimeFor64Bit = false; |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 143 | |
| 144 | // In our mixed 32/64-bit path, we need to suffix our files differently for |
| 145 | // both 32-bit and 64-bit versions. |
| 146 | if (Opts.mEmit3264) { |
| 147 | if (Opts.mBitWidth == 64) { |
| 148 | PathSuffix = "bc64"; |
Stephen Hines | 2d504fd | 2014-08-15 01:52:40 -0700 | [diff] [blame] | 149 | CompileSecondTimeFor64Bit = true; |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 150 | } else { |
| 151 | PathSuffix = "bc32"; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | for (int i = 0, e = Inputs.size(); i != e; i++) { |
| 156 | const char *InputFile = Inputs[i]; |
| 157 | |
| 158 | const char *BCOutputFile = DetermineOutputFile(Opts.mBitcodeOutputDir, |
| 159 | PathSuffix, InputFile, |
Yang Ni | 18d52a6 | 2015-04-28 17:30:51 -0700 | [diff] [blame] | 160 | Opts.mOutputType, |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 161 | SavedStrings); |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 162 | const char *OutputFile = BCOutputFile; |
| 163 | |
| 164 | if (Opts.mEmitDependency) { |
| 165 | // The dependency file is always emitted without a PathSuffix. |
| 166 | // Collisions between 32-bit and 64-bit files don't make a difference, |
| 167 | // because they share the same sources/dependencies. |
| 168 | const char *DepOutputFile = |
| 169 | DetermineOutputFile(Opts.mDependencyOutputDir, "", InputFile, |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 170 | slang::Slang::OT_Dependency, SavedStrings); |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 171 | if (Opts.mOutputType == slang::Slang::OT_Dependency) { |
| 172 | OutputFile = DepOutputFile; |
| 173 | } |
| 174 | |
| 175 | DepFiles.push_back(std::make_pair(BCOutputFile, DepOutputFile)); |
| 176 | } |
| 177 | |
| 178 | IOFiles->push_back(std::make_pair(InputFile, OutputFile)); |
| 179 | } |
| 180 | |
Jean-Luc Brouillet | c10bc75 | 2015-05-04 23:02:25 -0700 | [diff] [blame] | 181 | std::unique_ptr<slang::Slang> Compiler(new slang::Slang()); |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 182 | Compiler->init(Opts.mBitWidth, DiagEngine, DiagClient); |
| 183 | int CompileFailed = !Compiler->compile(*IOFiles, *IOFiles32, DepFiles, Opts); |
Stephen Hines | 2d504fd | 2014-08-15 01:52:40 -0700 | [diff] [blame] | 184 | // We suppress warnings (via reset) if we are doing a second compilation. |
| 185 | Compiler->reset(CompileSecondTimeFor64Bit); |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 186 | return CompileFailed; |
| 187 | } |
| 188 | |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 189 | #define str(s) #s |
| 190 | #define wrap_str(s) str(s) |
| 191 | static void llvm_rs_cc_VersionPrinter() { |
| 192 | llvm::raw_ostream &OS = llvm::outs(); |
| 193 | OS << "llvm-rs-cc: Renderscript compiler\n" |
| 194 | << " (http://developer.android.com/guide/topics/renderscript)\n" |
| 195 | << " based on LLVM (http://llvm.org):\n"; |
| 196 | OS << " Built " << __DATE__ << " (" << __TIME__ ").\n"; |
| 197 | OS << " Target APIs: " << SLANG_MINIMUM_TARGET_API << " - " |
| 198 | << SLANG_MAXIMUM_TARGET_API; |
| 199 | OS << "\n Build type: " << wrap_str(TARGET_BUILD_VARIANT); |
| 200 | #ifndef __DISABLE_ASSERTS |
| 201 | OS << " with assertions"; |
| 202 | #endif |
| 203 | OS << ".\n"; |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 204 | } |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 205 | #undef wrap_str |
| 206 | #undef str |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 207 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 208 | int main(int argc, const char **argv) { |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 209 | llvm::llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 210 | |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 211 | // Populate a vector with the command line arguments, expanding command files |
| 212 | // that have been included by via the '@' argument. |
| 213 | llvm::SmallVector<const char*, 256> ArgVector; |
| 214 | StringSet SavedStrings; // Keeps track of strings to be destroyed at the end. |
| 215 | const auto& ArgsIn(llvm::makeArrayRef(argv, argc)); |
| 216 | ArgVector.append(ArgsIn.begin(), ArgsIn.end()); |
| 217 | llvm::cl::ExpandResponseFiles(SavedStrings, llvm::cl::TokenizeGNUCommandLine, |
| 218 | ArgVector, false); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 219 | |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 220 | const std::string Argv0 = llvm::sys::path::stem(ArgVector[0]); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 221 | |
| 222 | // Setup diagnostic engine |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 223 | slang::DiagnosticBuffer *DiagClient = new slang::DiagnosticBuffer(); |
Logan | be27482 | 2011-02-16 22:02:54 +0800 | [diff] [blame] | 224 | |
| 225 | llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagIDs( |
| 226 | new clang::DiagnosticIDs()); |
| 227 | |
Stephen Hines | 23c4358 | 2013-01-09 20:02:04 -0800 | [diff] [blame] | 228 | llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts( |
| 229 | new clang::DiagnosticOptions()); |
| 230 | clang::DiagnosticsEngine DiagEngine(DiagIDs, &*DiagOpts, DiagClient, true); |
Logan Chien | 9207a2e | 2011-10-21 15:39:28 +0800 | [diff] [blame] | 231 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 232 | slang::Slang::GlobalInitialization(); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 233 | |
Jean-Luc Brouillet | 21f7c38 | 2015-05-14 13:07:47 -0700 | [diff] [blame^] | 234 | slang::RSCCOptions Opts; |
| 235 | llvm::SmallVector<const char*, 16> Inputs; |
Stephen Hines | 8b5c5c6 | 2014-06-06 18:03:18 -0700 | [diff] [blame] | 236 | slang::ParseArguments(ArgVector, Inputs, Opts, DiagEngine); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 237 | |
| 238 | // Exits when there's any error occurred during parsing the arguments |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 239 | if (DiagEngine.hasErrorOccurred()) { |
| 240 | llvm::errs() << DiagClient->str(); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 241 | return 1; |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 242 | } |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 243 | |
| 244 | if (Opts.mShowHelp) { |
Stephen Hines | 7ac9d0d | 2014-07-15 16:50:03 -0700 | [diff] [blame] | 245 | std::unique_ptr<llvm::opt::OptTable> OptTbl(slang::createRSCCOptTable()); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 246 | OptTbl->PrintHelp(llvm::outs(), Argv0.c_str(), |
Stephen Hines | b7d1269 | 2011-09-02 18:16:19 -0700 | [diff] [blame] | 247 | "Renderscript source compiler"); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | if (Opts.mShowVersion) { |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 252 | llvm_rs_cc_VersionPrinter(); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 253 | return 0; |
| 254 | } |
| 255 | |
| 256 | // No input file |
| 257 | if (Inputs.empty()) { |
Logan Chien | 9207a2e | 2011-10-21 15:39:28 +0800 | [diff] [blame] | 258 | DiagEngine.Report(clang::diag::err_drv_no_input_files); |
Stephen Hines | 8f4d972 | 2011-12-05 14:14:42 -0800 | [diff] [blame] | 259 | llvm::errs() << DiagClient->str(); |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 260 | return 1; |
| 261 | } |
| 262 | |
Zonr Chang | cf6af6a | 2010-10-12 12:38:51 +0800 | [diff] [blame] | 263 | // Prepare input data for RS compiler. |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 264 | NamePairList IOFiles64; |
| 265 | NamePairList IOFiles32; |
Zonr Chang | cf6af6a | 2010-10-12 12:38:51 +0800 | [diff] [blame] | 266 | |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 267 | int CompileFailed = compileFiles(&IOFiles32, &IOFiles32, Inputs, Opts, |
| 268 | &DiagEngine, DiagClient, &SavedStrings); |
Zonr Chang | 641558f | 2010-10-12 21:07:06 +0800 | [diff] [blame] | 269 | |
Stephen Hines | 9ae18b2 | 2014-06-10 23:53:00 -0700 | [diff] [blame] | 270 | // Handle the 64-bit case too! |
| 271 | if (Opts.mEmit3264 && !CompileFailed) { |
| 272 | Opts.mBitWidth = 64; |
| 273 | CompileFailed = compileFiles(&IOFiles64, &IOFiles32, Inputs, Opts, |
| 274 | &DiagEngine, DiagClient, &SavedStrings); |
Zonr Chang | cf6af6a | 2010-10-12 12:38:51 +0800 | [diff] [blame] | 275 | } |
| 276 | |
Stephen Hines | d7f0ea2 | 2011-02-22 17:45:19 -0800 | [diff] [blame] | 277 | return CompileFailed; |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 278 | } |