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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 848473002: Add instruction alignment tests to unit tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 11 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
« no previous file with comments | « no previous file | unittest/IceParseInstsTest.cpp » ('j') | unittest/IceParseInstsTest.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 void popTimerIfTimingEachFunction() const { 1167 void popTimerIfTimingEachFunction() const {
1168 if (ALLOW_DUMP && getFlags().TimeEachFunction) { 1168 if (ALLOW_DUMP && getFlags().TimeEachFunction) {
1169 getTranslator().getContext()->popTimer( 1169 getTranslator().getContext()->popTimer(
1170 getTranslator().getContext()->getTimerID( 1170 getTranslator().getContext()->getTimerID(
1171 Ice::GlobalContext::TSK_Funcs, Func->getFunctionName()), 1171 Ice::GlobalContext::TSK_Funcs, Func->getFunctionName()),
1172 Ice::GlobalContext::TSK_Funcs); 1172 Ice::GlobalContext::TSK_Funcs);
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 // Extracts the corresponding Alignment to use, given the AlignPower 1176 // Extracts the corresponding Alignment to use, given the AlignPower
1177 // (i.e. 2**AlignPower, or 0 if AlignPower == 0). InstName is the 1177 // (i.e. 2**(AlignPower-1), or 0 if AlignPower == 0). InstName is the
1178 // name of the instruction the alignment appears in. 1178 // name of the instruction the alignment appears in.
1179 void extractAlignment(const char *InstName, uint32_t AlignPower, 1179 void extractAlignment(const char *InstName, uint32_t AlignPower,
1180 uint32_t &Alignment) { 1180 uint32_t &Alignment) {
1181 if (AlignPower <= AlignPowerLimit) { 1181 if (AlignPower <= AlignPowerLimit + 1) {
1182 Alignment = (1 << AlignPower) >> 1; 1182 Alignment = (1 << AlignPower) >> 1;
1183 return; 1183 return;
1184 } 1184 }
1185 std::string Buffer; 1185 std::string Buffer;
1186 raw_string_ostream StrBuf(Buffer); 1186 raw_string_ostream StrBuf(Buffer);
1187 StrBuf << InstName << " alignment greater than 2**" << AlignPowerLimit 1187 StrBuf << InstName << " alignment greater than 2**" << AlignPowerLimit
1188 << ". Found: 2**" << AlignPower; 1188 << ". Found: 2**" << AlignPower;
jvoung (off chromium) 2015/01/12 18:10:06 "2**... AlignPower - 1"
Karl 2015/01/14 22:03:07 Done.
1189 Error(StrBuf.str()); 1189 Error(StrBuf.str());
1190 // Error recover with value that is always acceptable. 1190 // Error recover with value that is always acceptable.
1191 Alignment = 1; 1191 Alignment = 1;
1192 } 1192 }
1193 1193
1194 bool ParseBlock(unsigned BlockID) override; 1194 bool ParseBlock(unsigned BlockID) override;
1195 1195
1196 void ProcessRecord() override; 1196 void ProcessRecord() override;
1197 1197
1198 void ExitBlock() override; 1198 void ExitBlock() override;
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 3001
3002 if (TopLevelBlocks != 1) { 3002 if (TopLevelBlocks != 1) {
3003 errs() << IRFilename 3003 errs() << IRFilename
3004 << ": Contains more than one module. Found: " << TopLevelBlocks 3004 << ": Contains more than one module. Found: " << TopLevelBlocks
3005 << "\n"; 3005 << "\n";
3006 ErrorStatus = true; 3006 ErrorStatus = true;
3007 } 3007 }
3008 } 3008 }
3009 3009
3010 } // end of namespace Ice 3010 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | unittest/IceParseInstsTest.cpp » ('j') | unittest/IceParseInstsTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698