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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 567703003: Allow ability to name unnamed global addresses in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add tests Created 6 years, 3 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 //===- 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 // This file implements the PNaCl bitcode file to Ice, to machine code 10 // This file implements the PNaCl bitcode file to Ice, to machine code
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 default: 1834 default:
1835 break; 1835 break;
1836 } 1836 }
1837 return BlockParserBaseClass::ParseBlock(BlockID); 1837 return BlockParserBaseClass::ParseBlock(BlockID);
1838 } 1838 }
1839 1839
1840 /// Parses the module block in the bitcode file. 1840 /// Parses the module block in the bitcode file.
1841 class ModuleParser : public BlockParserBaseClass { 1841 class ModuleParser : public BlockParserBaseClass {
1842 public: 1842 public:
1843 ModuleParser(unsigned BlockID, TopLevelParser *Context) 1843 ModuleParser(unsigned BlockID, TopLevelParser *Context)
1844 : BlockParserBaseClass(BlockID, Context) {} 1844 : BlockParserBaseClass(BlockID, Context),
1845 FoundFirstFunctionBlock(false) {}
1845 1846
1846 virtual ~ModuleParser() LLVM_OVERRIDE {} 1847 virtual ~ModuleParser() LLVM_OVERRIDE {}
1847 1848
1848 protected: 1849 private:
1850 // True if we have parsed a function block.
1851 bool FoundFirstFunctionBlock;
1849 virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE; 1852 virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE;
1850 1853
1851 virtual void ProcessRecord() LLVM_OVERRIDE; 1854 virtual void ProcessRecord() LLVM_OVERRIDE;
1852 }; 1855 };
1853 1856
1854 class ModuleValuesymtabParser : public ValuesymtabParser { 1857 class ModuleValuesymtabParser : public ValuesymtabParser {
1855 ModuleValuesymtabParser(const ModuleValuesymtabParser &) 1858 ModuleValuesymtabParser(const ModuleValuesymtabParser &)
1856 LLVM_DELETED_FUNCTION; 1859 LLVM_DELETED_FUNCTION;
1857 void operator=(const ModuleValuesymtabParser &) LLVM_DELETED_FUNCTION; 1860 void operator=(const ModuleValuesymtabParser &) LLVM_DELETED_FUNCTION;
1858 1861
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1900 }
1898 case naclbitc::GLOBALVAR_BLOCK_ID: { 1901 case naclbitc::GLOBALVAR_BLOCK_ID: {
1899 GlobalsParser Parser(BlockID, this); 1902 GlobalsParser Parser(BlockID, this);
1900 return Parser.ParseThisBlock(); 1903 return Parser.ParseThisBlock();
1901 } 1904 }
1902 case naclbitc::VALUE_SYMTAB_BLOCK_ID: { 1905 case naclbitc::VALUE_SYMTAB_BLOCK_ID: {
1903 ModuleValuesymtabParser Parser(BlockID, this); 1906 ModuleValuesymtabParser Parser(BlockID, this);
1904 return Parser.ParseThisBlock(); 1907 return Parser.ParseThisBlock();
1905 } 1908 }
1906 case naclbitc::FUNCTION_BLOCK_ID: { 1909 case naclbitc::FUNCTION_BLOCK_ID: {
1910 if (!FoundFirstFunctionBlock) {
1911 getTranslator().nameUnnamedGlobalAddresses(Context->getModule());
1912 FoundFirstFunctionBlock = true;
1913 }
1907 FunctionParser Parser(BlockID, this); 1914 FunctionParser Parser(BlockID, this);
1908 return Parser.ParseThisBlock(); 1915 return Parser.ParseThisBlock();
1909 } 1916 }
1910 default: 1917 default:
1911 return BlockParserBaseClass::ParseBlock(BlockID); 1918 return BlockParserBaseClass::ParseBlock(BlockID);
1912 } 1919 }
1913 } 1920 }
1914 1921
1915 void ModuleParser::ProcessRecord() { 1922 void ModuleParser::ProcessRecord() {
1916 const NaClBitcodeRecord::RecordVector &Values = Record.GetValues(); 1923 const NaClBitcodeRecord::RecordVector &Values = Record.GetValues();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 if (TopLevelBlocks != 1) { 2038 if (TopLevelBlocks != 1) {
2032 errs() << IRFilename 2039 errs() << IRFilename
2033 << ": Contains more than one module. Found: " << TopLevelBlocks 2040 << ": Contains more than one module. Found: " << TopLevelBlocks
2034 << "\n"; 2041 << "\n";
2035 ErrorStatus = true; 2042 ErrorStatus = true;
2036 } 2043 }
2037 return; 2044 return;
2038 } 2045 }
2039 2046
2040 } // end of namespace Ice 2047 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698