| 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 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 class BlockParserBaseClass; | 160 class BlockParserBaseClass; |
| 161 | 161 |
| 162 // Top-level class to read PNaCl bitcode files, and translate to ICE. | 162 // Top-level class to read PNaCl bitcode files, and translate to ICE. |
| 163 class TopLevelParser : public NaClBitcodeParser { | 163 class TopLevelParser : public NaClBitcodeParser { |
| 164 TopLevelParser() = delete; | 164 TopLevelParser() = delete; |
| 165 TopLevelParser(const TopLevelParser &) = delete; | 165 TopLevelParser(const TopLevelParser &) = delete; |
| 166 TopLevelParser &operator=(const TopLevelParser &) = delete; | 166 TopLevelParser &operator=(const TopLevelParser &) = delete; |
| 167 | 167 |
| 168 public: | 168 public: |
| 169 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; | |
| 170 | |
| 171 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor, | 169 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor, |
| 172 Ice::ErrorCode &ErrorStatus) | 170 Ice::ErrorCode &ErrorStatus) |
| 173 : NaClBitcodeParser(Cursor), Translator(Translator), | 171 : NaClBitcodeParser(Cursor), Translator(Translator), |
| 174 ErrorStatus(ErrorStatus), | 172 ErrorStatus(ErrorStatus), |
| 175 VariableDeclarations(new Ice::VariableDeclarationList()) {} | 173 VariableDeclarations(new Ice::VariableDeclarationList()) {} |
| 176 | 174 |
| 177 ~TopLevelParser() override = default; | 175 ~TopLevelParser() override = default; |
| 178 | 176 |
| 179 Ice::Translator &getTranslator() const { return Translator; } | 177 Ice::Translator &getTranslator() const { return Translator; } |
| 180 | 178 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 const Ice::FuncSigType &getFuncSigTypeByID(NaClBcIndexSize_t ID) { | 238 const Ice::FuncSigType &getFuncSigTypeByID(NaClBcIndexSize_t ID) { |
| 241 const ExtendedType *Ty = getTypeByIDAsKind(ID, ExtendedType::FuncSig); | 239 const ExtendedType *Ty = getTypeByIDAsKind(ID, ExtendedType::FuncSig); |
| 242 if (Ty == nullptr) | 240 if (Ty == nullptr) |
| 243 // Return error recovery value. | 241 // Return error recovery value. |
| 244 return UndefinedFuncSigType; | 242 return UndefinedFuncSigType; |
| 245 return cast<FuncSigExtendedType>(Ty)->getSignature(); | 243 return cast<FuncSigExtendedType>(Ty)->getSignature(); |
| 246 } | 244 } |
| 247 | 245 |
| 248 /// Sets the next function ID to the given LLVM function. | 246 /// Sets the next function ID to the given LLVM function. |
| 249 void setNextFunctionID(Ice::FunctionDeclaration *Fcn) { | 247 void setNextFunctionID(Ice::FunctionDeclaration *Fcn) { |
| 250 FunctionDeclarationList.push_back(Fcn); | 248 FunctionDeclarations.push_back(Fcn); |
| 251 } | 249 } |
| 252 | 250 |
| 253 /// Returns the value id that should be associated with the the | 251 /// Returns the value id that should be associated with the the |
| 254 /// current function block. Increments internal counters during call | 252 /// current function block. Increments internal counters during call |
| 255 /// so that it will be in correct position for next function block. | 253 /// so that it will be in correct position for next function block. |
| 256 NaClBcIndexSize_t getNextFunctionBlockValueID() { | 254 NaClBcIndexSize_t getNextFunctionBlockValueID() { |
| 257 size_t NumDeclaredFunctions = FunctionDeclarationList.size(); | 255 size_t NumDeclaredFunctions = FunctionDeclarations.size(); |
| 258 while (NextDefiningFunctionID < NumDeclaredFunctions && | 256 while (NextDefiningFunctionID < NumDeclaredFunctions && |
| 259 FunctionDeclarationList[NextDefiningFunctionID]->isProto()) | 257 FunctionDeclarations[NextDefiningFunctionID]->isProto()) |
| 260 ++NextDefiningFunctionID; | 258 ++NextDefiningFunctionID; |
| 261 if (NextDefiningFunctionID >= NumDeclaredFunctions) | 259 if (NextDefiningFunctionID >= NumDeclaredFunctions) |
| 262 Fatal("More function blocks than defined function addresses"); | 260 Fatal("More function blocks than defined function addresses"); |
| 263 return NextDefiningFunctionID++; | 261 return NextDefiningFunctionID++; |
| 264 } | 262 } |
| 265 | 263 |
| 266 /// Returns the function associated with ID. | 264 /// Returns the function associated with ID. |
| 267 Ice::FunctionDeclaration *getFunctionByID(NaClBcIndexSize_t ID) { | 265 Ice::FunctionDeclaration *getFunctionByID(NaClBcIndexSize_t ID) { |
| 268 if (ID < FunctionDeclarationList.size()) | 266 if (ID < FunctionDeclarations.size()) |
| 269 return FunctionDeclarationList[ID]; | 267 return FunctionDeclarations[ID]; |
| 270 return reportGetFunctionByIDError(ID); | 268 return reportGetFunctionByIDError(ID); |
| 271 } | 269 } |
| 272 | 270 |
| 273 /// Returns the constant associated with the given global value ID. | 271 /// Returns the constant associated with the given global value ID. |
| 274 Ice::Constant *getGlobalConstantByID(NaClBcIndexSize_t ID) { | 272 Ice::Constant *getGlobalConstantByID(NaClBcIndexSize_t ID) { |
| 275 assert(ID < ValueIDConstants.size()); | 273 assert(ID < ValueIDConstants.size()); |
| 276 return ValueIDConstants[ID]; | 274 return ValueIDConstants[ID]; |
| 277 } | 275 } |
| 278 | 276 |
| 279 /// Install names for all global values without names. Called after | 277 /// Install names for all global values without names. Called after |
| 280 /// the global value symbol table is processed, but before any | 278 /// the global value symbol table is processed, but before any |
| 281 /// function blocks are processed. | 279 /// function blocks are processed. |
| 282 void installGlobalNames() { | 280 void installGlobalNames() { |
| 283 assert(VariableDeclarations); | 281 assert(VariableDeclarations); |
| 284 installGlobalVarNames(); | 282 installGlobalVarNames(); |
| 285 installFunctionNames(); | 283 installFunctionNames(); |
| 286 } | 284 } |
| 287 | 285 |
| 288 void createValueIDs() { | 286 void createValueIDs() { |
| 289 assert(VariableDeclarations); | 287 assert(VariableDeclarations); |
| 290 ValueIDConstants.reserve(VariableDeclarations->size() + | 288 ValueIDConstants.reserve(VariableDeclarations->size() + |
| 291 FunctionDeclarationList.size()); | 289 FunctionDeclarations.size()); |
| 292 createValueIDsForFunctions(); | 290 createValueIDsForFunctions(); |
| 293 createValueIDsForGlobalVars(); | 291 createValueIDsForGlobalVars(); |
| 294 } | 292 } |
| 295 | 293 |
| 296 /// Returns the number of function declarations in the bitcode file. | 294 /// Returns the number of function declarations in the bitcode file. |
| 297 size_t getNumFunctionIDs() const { return FunctionDeclarationList.size(); } | 295 size_t getNumFunctionIDs() const { return FunctionDeclarations.size(); } |
| 298 | 296 |
| 299 /// Returns the number of global declarations (i.e. IDs) defined in | 297 /// Returns the number of global declarations (i.e. IDs) defined in |
| 300 /// the bitcode file. | 298 /// the bitcode file. |
| 301 size_t getNumGlobalIDs() const { | 299 size_t getNumGlobalIDs() const { |
| 302 if (VariableDeclarations) { | 300 if (VariableDeclarations) { |
| 303 return FunctionDeclarationList.size() + VariableDeclarations->size(); | 301 return FunctionDeclarations.size() + VariableDeclarations->size(); |
| 304 } else { | 302 } else { |
| 305 return ValueIDConstants.size(); | 303 return ValueIDConstants.size(); |
| 306 } | 304 } |
| 307 } | 305 } |
| 308 | 306 |
| 309 /// Adds the given global declaration to the end of the list of global | 307 /// Adds the given global declaration to the end of the list of global |
| 310 /// declarations. | 308 /// declarations. |
| 311 void addGlobalDeclaration(Ice::VariableDeclaration *Decl) { | 309 void addGlobalDeclaration(Ice::VariableDeclaration *Decl) { |
| 312 assert(VariableDeclarations); | 310 assert(VariableDeclarations); |
| 313 VariableDeclarations->push_back(Decl); | 311 VariableDeclarations->push_back(Decl); |
| 314 } | 312 } |
| 315 | 313 |
| 316 /// Returns the global variable declaration with the given index. | 314 /// Returns the global variable declaration with the given index. |
| 317 Ice::VariableDeclaration *getGlobalVariableByID(NaClBcIndexSize_t Index) { | 315 Ice::VariableDeclaration *getGlobalVariableByID(NaClBcIndexSize_t Index) { |
| 318 assert(VariableDeclarations); | 316 assert(VariableDeclarations); |
| 319 if (Index < VariableDeclarations->size()) | 317 if (Index < VariableDeclarations->size()) |
| 320 return VariableDeclarations->at(Index); | 318 return VariableDeclarations->at(Index); |
| 321 return reportGetGlobalVariableByIDError(Index); | 319 return reportGetGlobalVariableByIDError(Index); |
| 322 } | 320 } |
| 323 | 321 |
| 324 /// Returns the global declaration (variable or function) with the | 322 /// Returns the global declaration (variable or function) with the |
| 325 /// given Index. | 323 /// given Index. |
| 326 Ice::GlobalDeclaration *getGlobalDeclarationByID(NaClBcIndexSize_t Index) { | 324 Ice::GlobalDeclaration *getGlobalDeclarationByID(NaClBcIndexSize_t Index) { |
| 327 size_t NumFunctionIds = FunctionDeclarationList.size(); | 325 size_t NumFunctionIds = FunctionDeclarations.size(); |
| 328 if (Index < NumFunctionIds) | 326 if (Index < NumFunctionIds) |
| 329 return getFunctionByID(Index); | 327 return getFunctionByID(Index); |
| 330 else | 328 else |
| 331 return getGlobalVariableByID(Index - NumFunctionIds); | 329 return getGlobalVariableByID(Index - NumFunctionIds); |
| 332 } | 330 } |
| 333 | 331 |
| 334 /// Returns the list of parsed global variable | 332 /// Returns the list of parsed global variable |
| 335 /// declarations. Releases ownership of the current list of global | 333 /// declarations. Releases ownership of the current list of global |
| 336 /// variables. Note: only returns non-null pointer on first | 334 /// variables. Note: only returns non-null pointer on first |
| 337 /// call. All successive calls return a null pointer. | 335 /// call. All successive calls return a null pointer. |
| 338 std::unique_ptr<Ice::VariableDeclarationList> getGlobalVariables() { | 336 std::unique_ptr<Ice::VariableDeclarationList> getGlobalVariables() { |
| 339 // Before returning, check that ValidIDConstants has already been | 337 // Before returning, check that ValidIDConstants has already been |
| 340 // built. | 338 // built. |
| 341 assert(!VariableDeclarations || | 339 assert(!VariableDeclarations || |
| 342 VariableDeclarations->size() <= ValueIDConstants.size()); | 340 VariableDeclarations->size() <= ValueIDConstants.size()); |
| 343 return std::move(VariableDeclarations); | 341 return std::move(VariableDeclarations); |
| 344 } | 342 } |
| 345 | 343 |
| 346 private: | 344 private: |
| 347 // The translator associated with the parser. | 345 // The translator associated with the parser. |
| 348 Ice::Translator &Translator; | 346 Ice::Translator &Translator; |
| 349 // The exit status that should be set to true if an error occurs. | 347 // The exit status that should be set to true if an error occurs. |
| 350 Ice::ErrorCode &ErrorStatus; | 348 Ice::ErrorCode &ErrorStatus; |
| 351 // The number of errors reported. | 349 // The number of errors reported. |
| 352 unsigned NumErrors = 0; | 350 unsigned NumErrors = 0; |
| 353 // The types associated with each type ID. | 351 // The types associated with each type ID. |
| 354 std::vector<ExtendedType> TypeIDValues; | 352 std::vector<ExtendedType> TypeIDValues; |
| 355 // The set of functions (prototype and defined). | 353 // The set of functions (prototype and defined). |
| 356 FunctionDeclarationListType FunctionDeclarationList; | 354 Ice::FunctionDeclarationList FunctionDeclarations; |
| 357 // The ID of the next possible defined function ID in | 355 // The ID of the next possible defined function ID in FunctionDeclarations. |
| 358 // FunctionDeclarationList. FunctionDeclarationList is filled | 356 // FunctionDeclarations is filled first. It's the set of functions (either |
| 359 // first. It's the set of functions (either defined or isproto). Then | 357 // defined or isproto). Then function definitions are encountered/parsed and |
| 360 // function definitions are encountered/parsed and | 358 // NextDefiningFunctionID is incremented to track the next actually-defined |
| 361 // NextDefiningFunctionID is incremented to track the next | 359 // function. |
| 362 // actually-defined function. | |
| 363 size_t NextDefiningFunctionID = 0; | 360 size_t NextDefiningFunctionID = 0; |
| 364 // The set of global variables. | 361 // The set of global variables. |
| 365 std::unique_ptr<Ice::VariableDeclarationList> VariableDeclarations; | 362 std::unique_ptr<Ice::VariableDeclarationList> VariableDeclarations; |
| 366 // Relocatable constants associated with global declarations. | 363 // Relocatable constants associated with global declarations. |
| 367 std::vector<Ice::Constant *> ValueIDConstants; | 364 Ice::ConstantList ValueIDConstants; |
| 368 // Error recovery value to use when getFuncSigTypeByID fails. | 365 // Error recovery value to use when getFuncSigTypeByID fails. |
| 369 Ice::FuncSigType UndefinedFuncSigType; | 366 Ice::FuncSigType UndefinedFuncSigType; |
| 370 // The block parser currently being applied. Used for error | 367 // The block parser currently being applied. Used for error |
| 371 // reporting. | 368 // reporting. |
| 372 BlockParserBaseClass *BlockParser = nullptr; | 369 BlockParserBaseClass *BlockParser = nullptr; |
| 373 | 370 |
| 374 bool ParseBlock(unsigned BlockID) override; | 371 bool ParseBlock(unsigned BlockID) override; |
| 375 | 372 |
| 376 // Gets extended type associated with the given index, assuming the | 373 // Gets extended type associated with the given index, assuming the |
| 377 // extended type is of the WantedKind. Generates error message if | 374 // extended type is of the WantedKind. Generates error message if |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 417 } |
| 421 } | 418 } |
| 422 } | 419 } |
| 423 | 420 |
| 424 // Installs names for functions without names. | 421 // Installs names for functions without names. |
| 425 void installFunctionNames() { | 422 void installFunctionNames() { |
| 426 const Ice::IceString &FunctionPrefix = | 423 const Ice::IceString &FunctionPrefix = |
| 427 getTranslator().getFlags().getDefaultFunctionPrefix(); | 424 getTranslator().getFlags().getDefaultFunctionPrefix(); |
| 428 if (!FunctionPrefix.empty()) { | 425 if (!FunctionPrefix.empty()) { |
| 429 NaClBcIndexSize_t NameIndex = 0; | 426 NaClBcIndexSize_t NameIndex = 0; |
| 430 for (Ice::FunctionDeclaration *Func : FunctionDeclarationList) { | 427 for (Ice::FunctionDeclaration *Func : FunctionDeclarations) { |
| 431 installDeclarationName(Func, FunctionPrefix, "function", NameIndex); | 428 installDeclarationName(Func, FunctionPrefix, "function", NameIndex); |
| 432 } | 429 } |
| 433 } | 430 } |
| 434 } | 431 } |
| 435 | 432 |
| 436 // Builds a constant symbol named Name, suppressing name mangling if | 433 // Builds a constant symbol named Name, suppressing name mangling if |
| 437 // SuppressMangling. IsExternal is true iff the symbol is external. | 434 // SuppressMangling. IsExternal is true iff the symbol is external. |
| 438 Ice::Constant *getConstantSym(const Ice::IceString &Name, | 435 Ice::Constant *getConstantSym(const Ice::IceString &Name, |
| 439 bool SuppressMangling, bool IsExternal) const { | 436 bool SuppressMangling, bool IsExternal) const { |
| 440 if (IsExternal) { | 437 if (IsExternal) { |
| 441 return getTranslator().getContext()->getConstantExternSym(Name); | 438 return getTranslator().getContext()->getConstantExternSym(Name); |
| 442 } else { | 439 } else { |
| 443 const Ice::RelocOffsetT Offset = 0; | 440 const Ice::RelocOffsetT Offset = 0; |
| 444 return getTranslator().getContext()->getConstantSym(Offset, Name, | 441 return getTranslator().getContext()->getConstantSym(Offset, Name, |
| 445 SuppressMangling); | 442 SuppressMangling); |
| 446 } | 443 } |
| 447 } | 444 } |
| 448 | 445 |
| 449 // Converts function declarations into constant value IDs. | 446 // Converts function declarations into constant value IDs. |
| 450 void createValueIDsForFunctions() { | 447 void createValueIDsForFunctions() { |
| 451 for (const Ice::FunctionDeclaration *Func : FunctionDeclarationList) { | 448 for (const Ice::FunctionDeclaration *Func : FunctionDeclarations) { |
| 452 Ice::Constant *C = nullptr; | 449 Ice::Constant *C = nullptr; |
| 453 if (!isIRGenerationDisabled()) { | 450 if (!isIRGenerationDisabled()) { |
| 454 C = getConstantSym(Func->getName(), Func->getSuppressMangling(), | 451 C = getConstantSym(Func->getName(), Func->getSuppressMangling(), |
| 455 Func->isProto()); | 452 Func->isProto()); |
| 456 } | 453 } |
| 457 ValueIDConstants.push_back(C); | 454 ValueIDConstants.push_back(C); |
| 458 } | 455 } |
| 459 } | 456 } |
| 460 | 457 |
| 461 // Converts global variable declarations into constant value IDs. | 458 // Converts global variable declarations into constant value IDs. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 514 } |
| 518 blockError(StrBuf.str()); | 515 blockError(StrBuf.str()); |
| 519 } | 516 } |
| 520 | 517 |
| 521 Ice::FunctionDeclaration * | 518 Ice::FunctionDeclaration * |
| 522 TopLevelParser::reportGetFunctionByIDError(NaClBcIndexSize_t ID) { | 519 TopLevelParser::reportGetFunctionByIDError(NaClBcIndexSize_t ID) { |
| 523 std::string Buffer; | 520 std::string Buffer; |
| 524 raw_string_ostream StrBuf(Buffer); | 521 raw_string_ostream StrBuf(Buffer); |
| 525 StrBuf << "Function index " << ID | 522 StrBuf << "Function index " << ID |
| 526 << " not allowed. Out of range. Must be less than " | 523 << " not allowed. Out of range. Must be less than " |
| 527 << FunctionDeclarationList.size(); | 524 << FunctionDeclarations.size(); |
| 528 blockError(StrBuf.str()); | 525 blockError(StrBuf.str()); |
| 529 if (!FunctionDeclarationList.empty()) | 526 if (!FunctionDeclarations.empty()) |
| 530 return FunctionDeclarationList[0]; | 527 return FunctionDeclarations[0]; |
| 531 Fatal(); | 528 Fatal(); |
| 532 } | 529 } |
| 533 | 530 |
| 534 Ice::VariableDeclaration * | 531 Ice::VariableDeclaration * |
| 535 TopLevelParser::reportGetGlobalVariableByIDError(NaClBcIndexSize_t Index) { | 532 TopLevelParser::reportGetGlobalVariableByIDError(NaClBcIndexSize_t Index) { |
| 536 std::string Buffer; | 533 std::string Buffer; |
| 537 raw_string_ostream StrBuf(Buffer); | 534 raw_string_ostream StrBuf(Buffer); |
| 538 StrBuf << "Global index " << Index | 535 StrBuf << "Global index " << Index |
| 539 << " not allowed. Out of range. Must be less than " | 536 << " not allowed. Out of range. Must be less than " |
| 540 << VariableDeclarations->size(); | 537 << VariableDeclarations->size(); |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 bool convertFunction() { | 1223 bool convertFunction() { |
| 1227 const Ice::TimerStackIdT StackID = Ice::GlobalContext::TSK_Funcs; | 1224 const Ice::TimerStackIdT StackID = Ice::GlobalContext::TSK_Funcs; |
| 1228 Ice::TimerIdT TimerID = 0; | 1225 Ice::TimerIdT TimerID = 0; |
| 1229 const bool TimeThisFunction = getFlags().getTimeEachFunction(); | 1226 const bool TimeThisFunction = getFlags().getTimeEachFunction(); |
| 1230 if (TimeThisFunction) { | 1227 if (TimeThisFunction) { |
| 1231 TimerID = getTranslator().getContext()->getTimerID(StackID, | 1228 TimerID = getTranslator().getContext()->getTimerID(StackID, |
| 1232 FuncDecl->getName()); | 1229 FuncDecl->getName()); |
| 1233 getTranslator().getContext()->pushTimer(TimerID, StackID); | 1230 getTranslator().getContext()->pushTimer(TimerID, StackID); |
| 1234 } | 1231 } |
| 1235 | 1232 |
| 1236 if (!isIRGenerationDisabled()) | 1233 // Note: The Cfg is created, even when IR generation is disabled. This |
| 1237 Func = Ice::Cfg::create(getTranslator().getContext(), | 1234 // is done to install a CfgLocalAllocator for various internal containers. |
| 1238 getTranslator().getNextSequenceNumber()); | 1235 Func = Ice::Cfg::create(getTranslator().getContext(), |
| 1236 getTranslator().getNextSequenceNumber()); |
| 1239 Ice::Cfg::setCurrentCfg(Func.get()); | 1237 Ice::Cfg::setCurrentCfg(Func.get()); |
| 1240 | 1238 |
| 1241 // TODO(kschimpf) Clean up API to add a function signature to | 1239 // TODO(kschimpf) Clean up API to add a function signature to |
| 1242 // a CFG. | 1240 // a CFG. |
| 1243 const Ice::FuncSigType &Signature = FuncDecl->getSignature(); | 1241 const Ice::FuncSigType &Signature = FuncDecl->getSignature(); |
| 1244 if (isIRGenerationDisabled()) { | 1242 if (isIRGenerationDisabled()) { |
| 1245 CurrentNode = nullptr; | 1243 CurrentNode = nullptr; |
| 1246 for (Ice::Type ArgType : Signature.getArgList()) { | 1244 for (Ice::Type ArgType : Signature.getArgList()) { |
| 1247 (void)ArgType; | 1245 (void)ArgType; |
| 1248 setNextLocalInstIndex(nullptr); | 1246 setNextLocalInstIndex(nullptr); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 // The basic block being built. | 1327 // The basic block being built. |
| 1330 Ice::CfgNode *CurrentNode = nullptr; | 1328 Ice::CfgNode *CurrentNode = nullptr; |
| 1331 // The ID for the function. | 1329 // The ID for the function. |
| 1332 NaClBcIndexSize_t FcnId; | 1330 NaClBcIndexSize_t FcnId; |
| 1333 // The corresponding function declaration. | 1331 // The corresponding function declaration. |
| 1334 Ice::FunctionDeclaration *FuncDecl; | 1332 Ice::FunctionDeclaration *FuncDecl; |
| 1335 // Holds the dividing point between local and global absolute value indices. | 1333 // Holds the dividing point between local and global absolute value indices. |
| 1336 size_t CachedNumGlobalValueIDs; | 1334 size_t CachedNumGlobalValueIDs; |
| 1337 // Holds operands local to the function block, based on indices | 1335 // Holds operands local to the function block, based on indices |
| 1338 // defined in the bitcode file. | 1336 // defined in the bitcode file. |
| 1339 std::vector<Ice::Operand *> LocalOperands; | 1337 Ice::OperandList LocalOperands; |
| 1340 // Holds the index within LocalOperands corresponding to the next | 1338 // Holds the index within LocalOperands corresponding to the next |
| 1341 // instruction that generates a value. | 1339 // instruction that generates a value. |
| 1342 NaClBcIndexSize_t NextLocalInstIndex; | 1340 NaClBcIndexSize_t NextLocalInstIndex; |
| 1343 // True if the last processed instruction was a terminating | 1341 // True if the last processed instruction was a terminating |
| 1344 // instruction. | 1342 // instruction. |
| 1345 bool InstIsTerminating = false; | 1343 bool InstIsTerminating = false; |
| 1346 // Upper limit of alignment power allowed by LLVM | 1344 // Upper limit of alignment power allowed by LLVM |
| 1347 static const uint32_t AlignPowerLimit = 29; | 1345 static const uint32_t AlignPowerLimit = 29; |
| 1348 | 1346 |
| 1349 // Extracts the corresponding Alignment to use, given the AlignPower | 1347 // Extracts the corresponding Alignment to use, given the AlignPower |
| (...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 } | 3167 } |
| 3170 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3168 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
| 3171 ErrStream | 3169 ErrStream |
| 3172 << IRFilename | 3170 << IRFilename |
| 3173 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; | 3171 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; |
| 3174 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); | 3172 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); |
| 3175 } | 3173 } |
| 3176 } | 3174 } |
| 3177 | 3175 |
| 3178 } // end of namespace Ice | 3176 } // end of namespace Ice |
| OLD | NEW |