Chromium Code Reviews| 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 // 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 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1503 } | 1503 } |
| 1504 Ice::CfgNode *ThenBlock = getBranchBasicBlock(Values[0]); | 1504 Ice::CfgNode *ThenBlock = getBranchBasicBlock(Values[0]); |
| 1505 Ice::CfgNode *ElseBlock = getBranchBasicBlock(Values[1]); | 1505 Ice::CfgNode *ElseBlock = getBranchBasicBlock(Values[1]); |
| 1506 if (ThenBlock == NULL || ElseBlock == NULL) | 1506 if (ThenBlock == NULL || ElseBlock == NULL) |
| 1507 return; | 1507 return; |
| 1508 Inst = Ice::InstBr::create(Func, Cond, ThenBlock, ElseBlock); | 1508 Inst = Ice::InstBr::create(Func, Cond, ThenBlock, ElseBlock); |
| 1509 } | 1509 } |
| 1510 InstIsTerminating = true; | 1510 InstIsTerminating = true; |
| 1511 break; | 1511 break; |
| 1512 } | 1512 } |
| 1513 case naclbitc::FUNC_CODE_INST_ALLOCA: { | |
| 1514 // ALLOCA: [Size, align] | |
| 1515 if (!isValidRecordSize(2, "function block alloca")) return; | |
|
jvoung (off chromium)
2014/09/05 16:55:04
return on separate line
Karl
2014/09/08 21:16:23
Done.
| |
| 1516 Ice::Operand *ByteCount = getRelativeOperand(Values[0]); | |
| 1517 if (ByteCount->getType() != Ice::IceType_i32) { | |
| 1518 std::string Buffer; | |
| 1519 raw_string_ostream StrBuf(Buffer); | |
| 1520 StrBuf << "Alloca on non-i32 value. Found: " << ByteCount; | |
| 1521 Error(StrBuf.str()); | |
| 1522 return; | |
| 1523 } | |
| 1524 unsigned Align = static_cast<unsigned>(Values[1]); | |
|
jvoung (off chromium)
2014/09/05 16:55:04
Should probably check that Align <= 29 or so? I th
Karl
2014/09/08 21:16:23
Good point.
| |
| 1525 Ice::Variable *Dest = NextInstVar(Context->getIcePointerType()); | |
| 1526 Inst = Ice::InstAlloca::create(Func, ByteCount, (1 << Align) >> 1, Dest); | |
|
Jim Stichnoth
2014/09/05 23:03:39
Any reason why it isn't (1<<(Align-1)) as opposed
Karl
2014/09/08 21:16:23
In LLVM and PNaCl, 0 is allowed, and hence the spe
| |
| 1527 break; | |
| 1528 } | |
| 1513 default: | 1529 default: |
| 1514 // Generate error message! | 1530 // Generate error message! |
| 1515 BlockParserBaseClass::ProcessRecord(); | 1531 BlockParserBaseClass::ProcessRecord(); |
| 1516 break; | 1532 break; |
| 1517 } | 1533 } |
| 1518 if (Inst) | 1534 if (Inst) |
| 1519 CurrentNode->appendInst(Inst); | 1535 CurrentNode->appendInst(Inst); |
| 1520 } | 1536 } |
| 1521 | 1537 |
| 1522 /// Parses the module block in the bitcode file. | 1538 /// Parses the module block in the bitcode file. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1677 if (TopLevelBlocks != 1) { | 1693 if (TopLevelBlocks != 1) { |
| 1678 errs() << IRFilename | 1694 errs() << IRFilename |
| 1679 << ": Contains more than one module. Found: " << TopLevelBlocks | 1695 << ": Contains more than one module. Found: " << TopLevelBlocks |
| 1680 << "\n"; | 1696 << "\n"; |
| 1681 ErrorStatus = true; | 1697 ErrorStatus = true; |
| 1682 } | 1698 } |
| 1683 return; | 1699 return; |
| 1684 } | 1700 } |
| 1685 | 1701 |
| 1686 } // end of namespace Ice | 1702 } // end of namespace Ice |
| OLD | NEW |