| OLD | NEW |
| 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// | 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| 11 /// \brief Implements the interface for translation from PNaCl bitcode files to | 11 /// \brief Implements the interface for translation from PNaCl bitcode files to |
| 12 /// ICE to machine code. | 12 /// ICE to machine code. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "PNaClTranslator.h" | 16 #include "PNaClTranslator.h" |
| 17 | 17 |
| 18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceClFlags.h" | 20 #include "IceClFlags.h" |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 #include "IceGlobalInits.h" | 22 #include "IceGlobalInits.h" |
| 23 #include "IceInst.h" | 23 #include "IceInst.h" |
| 24 #include "IceOperand.h" | 24 #include "IceOperand.h" |
| 25 #include "IceRangeSpec.h" |
| 25 | 26 |
| 26 #ifdef __clang__ | 27 #ifdef __clang__ |
| 27 #pragma clang diagnostic push | 28 #pragma clang diagnostic push |
| 28 #pragma clang diagnostic ignored "-Wunused-parameter" | 29 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 29 #endif // __clang__ | 30 #endif // __clang__ |
| 30 | 31 |
| 31 #include "llvm/ADT/Hashing.h" | 32 #include "llvm/ADT/Hashing.h" |
| 32 #include "llvm/ADT/SmallString.h" | 33 #include "llvm/ADT/SmallString.h" |
| 33 #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" | 34 #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" |
| 34 #include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h" | 35 #include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 NaClBcIndexSize_t &NameIndex) { | 475 NaClBcIndexSize_t &NameIndex) { |
| 475 if (Decl->hasName()) { | 476 if (Decl->hasName()) { |
| 476 Translator.checkIfUnnamedNameSafe(Decl->getName().toString(), DeclType, | 477 Translator.checkIfUnnamedNameSafe(Decl->getName().toString(), DeclType, |
| 477 Prefix); | 478 Prefix); |
| 478 } else { | 479 } else { |
| 479 Ice::GlobalContext *Ctx = Translator.getContext(); | 480 Ice::GlobalContext *Ctx = Translator.getContext(); |
| 480 // Synthesize a dummy name if any of the following is true: | 481 // Synthesize a dummy name if any of the following is true: |
| 481 // - DUMP is enabled | 482 // - DUMP is enabled |
| 482 // - The symbol is external | 483 // - The symbol is external |
| 483 // - The -timing-funcs flag is enabled | 484 // - The -timing-funcs flag is enabled |
| 484 // - The -timing-focus flag is enabled | 485 // - Some RangeSpec is initialized with actual names |
| 485 if (Ice::BuildDefs::dump() || !Decl->isInternal() || | 486 if (Ice::BuildDefs::dump() || !Decl->isInternal() || |
| 486 Ice::getFlags().getTimeEachFunction() || | 487 Ice::RangeSpec::hasNames() || Ice::getFlags().getTimeEachFunction()) { |
| 487 !Ice::getFlags().getTimingFocusOn().empty()) { | |
| 488 Decl->setName(Ctx, Translator.createUnnamedName(Prefix, NameIndex)); | 488 Decl->setName(Ctx, Translator.createUnnamedName(Prefix, NameIndex)); |
| 489 } else { | 489 } else { |
| 490 Decl->setName(Ctx); | 490 Decl->setName(Ctx); |
| 491 } | 491 } |
| 492 ++NameIndex; | 492 ++NameIndex; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 // Installs names for global variables without names. | 496 // Installs names for global variables without names. |
| 497 void installGlobalVarNames() { | 497 void installGlobalVarNames() { |
| (...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3302 raw_string_ostream StrBuf(Buffer); | 3302 raw_string_ostream StrBuf(Buffer); |
| 3303 StrBuf << IRFilename << ": Does not contain a module!"; | 3303 StrBuf << IRFilename << ": Does not contain a module!"; |
| 3304 llvm::report_fatal_error(StrBuf.str()); | 3304 llvm::report_fatal_error(StrBuf.str()); |
| 3305 } | 3305 } |
| 3306 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3306 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
| 3307 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); | 3307 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); |
| 3308 } | 3308 } |
| 3309 } | 3309 } |
| 3310 | 3310 |
| 3311 } // end of namespace Ice | 3311 } // end of namespace Ice |
| OLD | NEW |