Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: lib/Bitcode/NaCl/Analysis/NaClCompress.cpp

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===-- NaClCompress.cpp - Bitcode (abbrev) compression -----------------===// 1 //===-- NaClCompress.cpp - Bitcode (abbrev) compression -----------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
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 // Analyzes the data in memory buffer, and determines what 10 // Analyzes the data in memory buffer, and determines what
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 Abbrevs = new BlockAbbrevs(BlockID); 458 Abbrevs = new BlockAbbrevs(BlockID);
459 AbbrevsMap[BlockID] = Abbrevs; 459 AbbrevsMap[BlockID] = Abbrevs;
460 } 460 }
461 return Abbrevs; 461 return Abbrevs;
462 } 462 }
463 463
464 /// Parses the bitcode file, analyzes it, and generates the 464 /// Parses the bitcode file, analyzes it, and generates the
465 /// corresponding lists of global abbreviations to use in the 465 /// corresponding lists of global abbreviations to use in the
466 /// generated (compressed) bitcode file. 466 /// generated (compressed) bitcode file.
467 class NaClAnalyzeParser : public NaClBitcodeParser { 467 class NaClAnalyzeParser : public NaClBitcodeParser {
468 NaClAnalyzeParser(const NaClAnalyzeParser&) 468 NaClAnalyzeParser(const NaClAnalyzeParser&) = delete;
469 LLVM_DELETED_FUNCTION; 469 void operator=(const NaClAnalyzeParser&) = delete;
470 void operator=(const NaClAnalyzeParser&)
471 LLVM_DELETED_FUNCTION;
472 470
473 public: 471 public:
474 // Creates the analysis parser, which will fill the given 472 // Creates the analysis parser, which will fill the given
475 // BlockAbbrevsMap with appropriate abbreviations, after 473 // BlockAbbrevsMap with appropriate abbreviations, after
476 // analyzing the bitcode file defined by Cursor. 474 // analyzing the bitcode file defined by Cursor.
477 NaClAnalyzeParser(const NaClBitcodeCompressor::CompressFlags &Flags, 475 NaClAnalyzeParser(const NaClBitcodeCompressor::CompressFlags &Flags,
478 NaClBitstreamCursor &Cursor, 476 NaClBitstreamCursor &Cursor,
479 BlockAbbrevsMapType &BlockAbbrevsMap) 477 BlockAbbrevsMapType &BlockAbbrevsMap)
480 : NaClBitcodeParser(Cursor), Flags(Flags), 478 : NaClBitcodeParser(Cursor), Flags(Flags),
481 BlockAbbrevsMap(BlockAbbrevsMap), 479 BlockAbbrevsMap(BlockAbbrevsMap),
(...skipping 14 matching lines...) Expand all
496 BlockAbbrevsMapType &BlockAbbrevsMap; 494 BlockAbbrevsMapType &BlockAbbrevsMap;
497 495
498 // Nested distribution capturing distribution of records in bitcode file. 496 // Nested distribution capturing distribution of records in bitcode file.
499 NaClBitcodeBlockDist BlockDist; 497 NaClBitcodeBlockDist BlockDist;
500 498
501 // Listener used to get abbreviations as they are read. 499 // Listener used to get abbreviations as they are read.
502 NaClBitcodeParserListener AbbrevListener; 500 NaClBitcodeParserListener AbbrevListener;
503 }; 501 };
504 502
505 class NaClBlockAnalyzeParser : public NaClBitcodeParser { 503 class NaClBlockAnalyzeParser : public NaClBitcodeParser {
506 NaClBlockAnalyzeParser(const NaClBlockAnalyzeParser&) 504 NaClBlockAnalyzeParser(const NaClBlockAnalyzeParser&) = delete;
507 LLVM_DELETED_FUNCTION; 505 void operator=(NaClBlockAnalyzeParser&) = delete;
508 void operator=(NaClBlockAnalyzeParser&)
509 LLVM_DELETED_FUNCTION;
510 506
511 public: 507 public:
512 /// Top-level constructor to build the top-level block with the 508 /// Top-level constructor to build the top-level block with the
513 /// given BlockID, and collect data (for compression) in that block. 509 /// given BlockID, and collect data (for compression) in that block.
514 NaClBlockAnalyzeParser(unsigned BlockID, 510 NaClBlockAnalyzeParser(unsigned BlockID,
515 NaClAnalyzeParser *Context) 511 NaClAnalyzeParser *Context)
516 : NaClBitcodeParser(BlockID, Context), Context(Context) { 512 : NaClBitcodeParser(BlockID, Context), Context(Context) {
517 init(); 513 init();
518 } 514 }
519 515
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 /// in [VBR(6), Lit(4), VBR(6), Array(VBR(6))]. 641 /// in [VBR(6), Lit(4), VBR(6), Array(VBR(6))].
646 /// 642 ///
647 /// After we have done appropriate substitutions, we can simplify the 643 /// After we have done appropriate substitutions, we can simplify the
648 /// unrolled abbreviation by calling method Restore. 644 /// unrolled abbreviation by calling method Restore.
649 /// 645 ///
650 /// Note: We unroll in the form that best matches the distribution 646 /// Note: We unroll in the form that best matches the distribution
651 /// map. Hence, the code is stored as a separate operator. We also 647 /// map. Hence, the code is stored as a separate operator. We also
652 /// keep the array abbreviation op, for untracked elements within the 648 /// keep the array abbreviation op, for untracked elements within the
653 /// distribution maps. 649 /// distribution maps.
654 class UnrolledAbbreviation { 650 class UnrolledAbbreviation {
655 void operator=(const UnrolledAbbreviation&) LLVM_DELETED_FUNCTION; 651 void operator=(const UnrolledAbbreviation&) = delete;
656 public: 652 public:
657 /// Unroll the given abbreviation, assuming it has the given size 653 /// Unroll the given abbreviation, assuming it has the given size
658 /// (as specified in the distribution maps). 654 /// (as specified in the distribution maps).
659 /// 655 ///
660 /// If argument CanBeBigger is true, then we do not assume that we 656 /// If argument CanBeBigger is true, then we do not assume that we
661 /// can remove the trailing array when expanding, because the 657 /// can remove the trailing array when expanding, because the
662 /// actual size of the corresponding record using this abbreviation 658 /// actual size of the corresponding record using this abbreviation
663 /// may be bigger. 659 /// may be bigger.
664 UnrolledAbbreviation(NaClBitCodeAbbrev *Abbrev, unsigned Size, 660 UnrolledAbbreviation(NaClBitCodeAbbrev *Abbrev, unsigned Size,
665 bool CanBeBigger = false) 661 bool CanBeBigger = false)
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 BlockAbbrevsQueueMap AbbrevsQueueMap; 1644 BlockAbbrevsQueueMap AbbrevsQueueMap;
1649 bool Result = true; 1645 bool Result = true;
1650 if (chooseAbbrevs(MemBuf, BlockAbbrevsMap, AbbrevsQueueMap)) 1646 if (chooseAbbrevs(MemBuf, BlockAbbrevsMap, AbbrevsQueueMap))
1651 Result = false; 1647 Result = false;
1652 else if (copyBitcode(Flags, MemBuf, BitcodeOutput, BlockAbbrevsMap, 1648 else if (copyBitcode(Flags, MemBuf, BitcodeOutput, BlockAbbrevsMap,
1653 AbbrevsQueueMap)) 1649 AbbrevsQueueMap))
1654 Result = false; 1650 Result = false;
1655 DeleteContainerSeconds(AbbrevsQueueMap); 1651 DeleteContainerSeconds(AbbrevsQueueMap);
1656 return Result; 1652 return Result;
1657 } 1653 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698