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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1516753008: Subzero: Use "auto" per (unwritten) auto coding style. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: More <cast> instances without the llvm:: prefix Created 5 years 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 | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »
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 /// \file 10 /// \file
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 return; 977 return;
978 } 978 }
979 case naclbitc::TYPE_CODE_FUNCTION: { 979 case naclbitc::TYPE_CODE_FUNCTION: {
980 // FUNCTION: [vararg, retty, paramty x N] 980 // FUNCTION: [vararg, retty, paramty x N]
981 if (!isValidRecordSizeAtLeast(2, "signature")) 981 if (!isValidRecordSizeAtLeast(2, "signature"))
982 return; 982 return;
983 if (Values[0]) 983 if (Values[0])
984 Error("Function type can't define varargs"); 984 Error("Function type can't define varargs");
985 ExtendedType *Ty = Context->getTypeByIDForDefining(NextTypeId++); 985 ExtendedType *Ty = Context->getTypeByIDForDefining(NextTypeId++);
986 Ty->setAsFunctionType(); 986 Ty->setAsFunctionType();
987 FuncSigExtendedType *FuncTy = cast<FuncSigExtendedType>(Ty); 987 auto *FuncTy = cast<FuncSigExtendedType>(Ty);
988 FuncTy->setReturnType(Context->getSimpleTypeByID(Values[1])); 988 FuncTy->setReturnType(Context->getSimpleTypeByID(Values[1]));
989 for (size_t i = 2, e = Values.size(); i != e; ++i) { 989 for (size_t i = 2, e = Values.size(); i != e; ++i) {
990 // Check that type void not used as argument type. Note: PNaCl 990 // Check that type void not used as argument type. Note: PNaCl
991 // restrictions can't be checked until we know the name, because we have 991 // restrictions can't be checked until we know the name, because we have
992 // to check for intrinsic signatures. 992 // to check for intrinsic signatures.
993 Ice::Type ArgTy = Context->getSimpleTypeByID(Values[i]); 993 Ice::Type ArgTy = Context->getSimpleTypeByID(Values[i]);
994 if (ArgTy == Ice::IceType_void) { 994 if (ArgTy == Ice::IceType_void) {
995 std::string Buffer; 995 std::string Buffer;
996 raw_string_ostream StrBuf(Buffer); 996 raw_string_ostream StrBuf(Buffer);
997 StrBuf << "Type for parameter " << (i - 1) 997 StrBuf << "Type for parameter " << (i - 1)
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1523
1524 // Generates the next available local variable using the given type. 1524 // Generates the next available local variable using the given type.
1525 Ice::Variable *getNextInstVar(Ice::Type Ty) { 1525 Ice::Variable *getNextInstVar(Ice::Type Ty) {
1526 assert(!isIRGenerationDisabled()); 1526 assert(!isIRGenerationDisabled());
1527 assert(NextLocalInstIndex >= CachedNumGlobalValueIDs); 1527 assert(NextLocalInstIndex >= CachedNumGlobalValueIDs);
1528 // Before creating one, see if a forwardtyperef has already defined it. 1528 // Before creating one, see if a forwardtyperef has already defined it.
1529 NaClBcIndexSize_t LocalIndex = NextLocalInstIndex - CachedNumGlobalValueIDs; 1529 NaClBcIndexSize_t LocalIndex = NextLocalInstIndex - CachedNumGlobalValueIDs;
1530 if (LocalIndex < LocalOperands.size()) { 1530 if (LocalIndex < LocalOperands.size()) {
1531 Ice::Operand *Op = LocalOperands[LocalIndex]; 1531 Ice::Operand *Op = LocalOperands[LocalIndex];
1532 if (Op != nullptr) { 1532 if (Op != nullptr) {
1533 if (Ice::Variable *Var = dyn_cast<Ice::Variable>(Op)) { 1533 if (auto *Var = dyn_cast<Ice::Variable>(Op)) {
1534 if (Var->getType() == Ty) { 1534 if (Var->getType() == Ty) {
1535 ++NextLocalInstIndex; 1535 ++NextLocalInstIndex;
1536 return Var; 1536 return Var;
1537 } 1537 }
1538 } 1538 }
1539 std::string Buffer; 1539 std::string Buffer;
1540 raw_string_ostream StrBuf(Buffer); 1540 raw_string_ostream StrBuf(Buffer);
1541 StrBuf << "Illegal forward referenced instruction (" 1541 StrBuf << "Illegal forward referenced instruction ("
1542 << NextLocalInstIndex << "): " << *Op; 1542 << NextLocalInstIndex << "): " << *Op;
1543 Error(StrBuf.str()); 1543 Error(StrBuf.str());
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 StringType &Name) { 3063 StringType &Name) {
3064 // Note: We check when Index is too small, so that we can error recover 3064 // Note: We check when Index is too small, so that we can error recover
3065 // (FP->getOperand will create fatal error). 3065 // (FP->getOperand will create fatal error).
3066 if (Index < getFunctionParser()->getNumGlobalIDs()) { 3066 if (Index < getFunctionParser()->getNumGlobalIDs()) {
3067 reportUnableToAssign("Global value", Index, Name); 3067 reportUnableToAssign("Global value", Index, Name);
3068 return; 3068 return;
3069 } 3069 }
3070 if (isIRGenerationDisabled()) 3070 if (isIRGenerationDisabled())
3071 return; 3071 return;
3072 Ice::Operand *Op = getFunctionParser()->getOperand(Index); 3072 Ice::Operand *Op = getFunctionParser()->getOperand(Index);
3073 if (Ice::Variable *V = dyn_cast<Ice::Variable>(Op)) { 3073 if (auto *V = dyn_cast<Ice::Variable>(Op)) {
3074 if (Ice::BuildDefs::dump()) { 3074 if (Ice::BuildDefs::dump()) {
3075 std::string Nm(Name.data(), Name.size()); 3075 std::string Nm(Name.data(), Name.size());
3076 V->setName(getFunctionParser()->getFunc(), Nm); 3076 V->setName(getFunctionParser()->getFunc(), Nm);
3077 } 3077 }
3078 } else { 3078 } else {
3079 reportUnableToAssign("Local value", Index, Name); 3079 reportUnableToAssign("Local value", Index, Name);
3080 } 3080 }
3081 } 3081 }
3082 3082
3083 void FunctionValuesymtabParser::setBbName(NaClBcIndexSize_t Index, 3083 void FunctionValuesymtabParser::setBbName(NaClBcIndexSize_t Index,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 } 3259 }
3260 GlobalValue::LinkageTypes Linkage; 3260 GlobalValue::LinkageTypes Linkage;
3261 if (!naclbitc::DecodeLinkage(Values[3], Linkage)) { 3261 if (!naclbitc::DecodeLinkage(Values[3], Linkage)) {
3262 std::string Buffer; 3262 std::string Buffer;
3263 raw_string_ostream StrBuf(Buffer); 3263 raw_string_ostream StrBuf(Buffer);
3264 StrBuf << "Function address has unknown linkage. Found " << Values[3]; 3264 StrBuf << "Function address has unknown linkage. Found " << Values[3];
3265 Error(StrBuf.str()); 3265 Error(StrBuf.str());
3266 return; 3266 return;
3267 } 3267 }
3268 bool IsProto = Values[2] == 1; 3268 bool IsProto = Values[2] == 1;
3269 Ice::FunctionDeclaration *Func = Ice::FunctionDeclaration::create( 3269 auto *Func = Ice::FunctionDeclaration::create(
3270 Context->getTranslator().getContext(), Signature, CallingConv, Linkage, 3270 Context->getTranslator().getContext(), Signature, CallingConv, Linkage,
3271 IsProto); 3271 IsProto);
3272 Context->setNextFunctionID(Func); 3272 Context->setNextFunctionID(Func);
3273 return; 3273 return;
3274 } 3274 }
3275 default: 3275 default:
3276 BlockParserBaseClass::ProcessRecord(); 3276 BlockParserBaseClass::ProcessRecord();
3277 return; 3277 return;
3278 } 3278 }
3279 } 3279 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 raw_string_ostream StrBuf(Buffer); 3341 raw_string_ostream StrBuf(Buffer);
3342 StrBuf << IRFilename << ": Does not contain a module!"; 3342 StrBuf << IRFilename << ": Does not contain a module!";
3343 llvm::report_fatal_error(StrBuf.str()); 3343 llvm::report_fatal_error(StrBuf.str());
3344 } 3344 }
3345 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3345 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3346 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3346 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3347 } 3347 }
3348 } 3348 }
3349 3349
3350 } // end of namespace Ice 3350 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698