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

Unified Diff: lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp

Issue 221693002: PNaCl: Add support for GCC/LLVM vector extensions (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Address dschuff's comments. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
index 8f6da8d4c533b02eaca459c1d33c72569cbcf1f6..65e21cd973cb7785d2630c3434b062a8502c3389 100644
--- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
+++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
@@ -285,6 +285,14 @@ static void WriteTypeTable(const NaClValueEnumerator &VE,
Code = naclbitc::TYPE_CODE_INTEGER;
TypeVals.push_back(cast<IntegerType>(T)->getBitWidth());
break;
+ case Type::VectorTyID: {
+ VectorType *VT = cast<VectorType>(T);
+ // VECTOR [numelts, eltty]
+ Code = naclbitc::TYPE_CODE_VECTOR;
+ TypeVals.push_back(VT->getNumElements());
+ TypeVals.push_back(VE.getTypeID(VT->getElementType()));
+ break;
+ }
case Type::FunctionTyID: {
FunctionType *FT = cast<FunctionType>(T);
// FUNCTION: [isvararg, retty, paramty x N]
@@ -300,8 +308,6 @@ static void WriteTypeTable(const NaClValueEnumerator &VE,
report_fatal_error("Struct types are not supported in PNaCl bitcode");
case Type::ArrayTyID:
report_fatal_error("Array types are not supported in PNaCl bitcode");
- case Type::VectorTyID:
- report_fatal_error("Vector types are not supported in PNaCl bitcode");
}
// Emit the finished record.
@@ -645,6 +651,17 @@ static bool WriteInstruction(const Instruction &I, unsigned InstID,
pushValue(I.getOperand(2), InstID, Vals, VE, Stream);
pushValue(I.getOperand(0), InstID, Vals, VE, Stream);
break;
+ case Instruction::ExtractElement:
+ Code = naclbitc::FUNC_CODE_INST_EXTRACTELT;
+ pushValue(I.getOperand(0), InstID, Vals, VE, Stream);
+ pushValue(I.getOperand(1), InstID, Vals, VE, Stream);
+ break;
+ case Instruction::InsertElement:
+ Code = naclbitc::FUNC_CODE_INST_INSERTELT;
+ pushValue(I.getOperand(0), InstID, Vals, VE, Stream);
+ pushValue(I.getOperand(1), InstID, Vals, VE, Stream);
+ pushValue(I.getOperand(2), InstID, Vals, VE, Stream);
+ break;
case Instruction::ICmp:
case Instruction::FCmp:
// compare returning Int1Ty or vector of Int1Ty

Powered by Google App Engine
This is Rietveld 408576698