Commit d1fb5541 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

plugin: support for vector types

During the historical build of cPython, I discovered that hashing of
vector operations was not implemented. Again this had no influence on
the incremental builds, since there was no chance to detect a change.
parent 4f90a782
......@@ -262,6 +262,14 @@ bool HashVisitor::VisitConstantArrayType(const ConstantArrayType *T) {
return true;
}
bool HashVisitor::VisitVectorType(const VectorType *T) {
topHash() << AstElementVectorType;
hashType(T->getElementType());
topHash() << T->getNumElements() << T->getVectorKind();
return true;
}
bool HashVisitor::VisitVariableArrayType(const VariableArrayType *T) {
topHash() << AstElementVariableArrayType;
hashType(T->getElementType());
......@@ -535,6 +543,22 @@ bool HashVisitor::VisitInitListExpr(const InitListExpr *Node) {
return true;
}
bool HashVisitor::VisitShuffleVectorExpr(const ShuffleVectorExpr *Node) {
topHash() << AstElementShuffleVectorExpr;
for (unsigned I = 0, E = Node->getNumSubExprs(); I < E; ++I) {
hashStmt(Node->getExpr(I));
}
return true;
}
bool HashVisitor::VisitConvertVectorExpr(const ConvertVectorExpr *Node) {
topHash() << AstElementConvertVectorExpr;
hashStmt(Node->getSrcExpr());
hashType(Node->getTypeSourceInfo()->getType());
return true;
}
bool HashVisitor::VisitUnaryOperator(const UnaryOperator *Node) {
topHash() << AstElementUnaryOperator;
hashStmt(Node->getSubExpr());
......@@ -997,7 +1021,7 @@ void HashVisitor::hashStmt(const Stmt *Node) {
const bool Handled = mt_stmtvisitor::Visit(Node);
if (!Handled) {
errs() << "---- START unhandled statement ----\n";
// Node->dump();
Node->dump();
errs() << "----- END unhandled statement -----\n";
}
}
......
......@@ -95,6 +95,7 @@ public:
bool VisitArrayType(const ArrayType *T);
bool VisitConstantArrayType(const ConstantArrayType *T);
bool VisitVariableArrayType(const VariableArrayType *T);
bool VisitVectorType(const VectorType *);
bool VisitRecordType(const RecordType *);
bool VisitTypedefType(const TypedefType *T);
bool VisitComplexType(const ComplexType *T);
......@@ -145,6 +146,9 @@ public:
bool VisitDesignatedInitExpr(const DesignatedInitExpr *Node);
bool VisitStmtExpr(const StmtExpr *Node);
bool VisitVAArgExpr(const VAArgExpr *Node);
bool VisitShuffleVectorExpr(const ShuffleVectorExpr *Node);
bool VisitConvertVectorExpr(const ConvertVectorExpr *Node);
// TODO: evtl. ImplicitValueInitExpr, GenericSelectionExpr, ArraySubscriptExpr
// TODO: evtl. OpaqueValueExpr, ExtVectorElementExpr (Beschreibung klingt nach
......@@ -308,10 +312,10 @@ protected:
AstElementOffsetOfNode = 0x17f2d532,
AstElementFieldDecl = 0xac0c83d4,
AstElementRecordDecl = 0x27892cea
// AstElement = 0x4ed393c3
// AstElement = 0x2e2321ad
// AstElement = 0xfe447195
AstElementRecordDecl = 0x27892cea,
AstElementVectorType = 0x4ed393c3,
AstElementShuffleVectorExpr = 0x2e2321ad,
AstElementConvertVectorExpr = 0xfe447195,
// AstElement = 0xe9bda7ae
// AstElement = 0x366466fc
// AstElement = 0xd6b02f4e
......
typedef float vector_t __attribute__((__vector_size__(16))); {{A}}
typedef float vector_t __attribute__((ext_vector_type(16))); {{B}}
typedef float vector_t; {{C}}
vector_t variable;
/*
* check-name: vector types should be hashed
* oj-not-diff: yes
* assert-ast: A != B, B != C, C != A
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment