Skip to content

Conversation

@dave-bartolomeo
Copy link
Contributor

Lack of support for the GCC vector extensions was causing a bunch of sanity failures in the syntax zoo. This PR adds minimal IR generation support for these types.

Added VectorAggregateLiteral, and factored most of ArrayAggregateLiteral out into the common base class ArrayOrVectorAggregateLiteral. I'd be happy to merge these all into ArrayAggregateLiteral if we don't care about the distinction.

Made a few tweaks to TranslatedArrayExpr to compute the element type by looking at the result type of the ArrayExpr, not the type of the base operand. Note that this means that for T a[10]; a[i] = foo;, the result of the PointerAdd for a[i] will now be glvalue<T>, not T*. This is actually more faithful to the source language, and has no semantic difference on the IR.

Added some missing getInstructionElementSize() overrides.

Added the new BuiltIn opcode, renamed the existing BuiltInInstruction to BuiltInOperationInstruction, and made any BuiltInOperation that we don't specifically handle translate to BuiltIn. BuiltInOperationInstruction now has a way to get the specific BuiltInOperation.

Added getCanonicalQLClass() overrides for GNUVectorType and BuiltInOperation.

Added a simple IR test for vector types.

jbj
jbj previously approved these changes Aug 20, 2019
@jbj
Copy link
Contributor

jbj commented Aug 20, 2019

I re-triggered the tests, and they show a semantic merge conflict between this PR and one of the getCanonicalQLClass PRs that was merged:

10:13:11  +ERROR: Predicate getCanonicalQLClass is already declared (/.../ql/cpp/ql/src/semmle/code/cpp/Type.qll:1071,19-38)
10:13:11  +ERROR: This predicate does not override another predicate (/.../ql/cpp/ql/src/semmle/code/cpp/Type.qll:1058,3-69)

Lack of support for the GCC vector extensions was causing a bunch of sanity failures in the syntax zoo. This PR adds minimal IR generation support for these types.

Added `VectorAggregateLiteral`, and factored most of `ArrayAggregateLiteral` out into the common base class `ArrayOrVectorAggregateLiteral`. I'd be happy to merge these all into `ArrayAggregateLiteral` if we don't care about the distinction.

Made a few tweaks to `TranslatedArrayExpr` to compute the element type by looking at the result type of the `ArrayExpr`, not the type of the base operand. Note that this means that for `T a[10]; a[i] = foo;`, the result of the `PointerAdd` for `a[i]` will now be `glvalue<T>`, not `T*`. This is actually more faithful to the source language, and has no semantic difference on the IR.

Added some missing `getInstructionElementSize()` overrides.

Added the new `BuiltIn` opcode, renamed the existing `BuiltInInstruction` to `BuiltInOperationInstruction`, and made any `BuiltInOperation` that we don't specifically handle translate to `BuiltIn`. `BuiltInOperationInstruction` now has a way to get the specific `BuiltInOperation`.

Added `getCanonicalQLClass()` overrides for `GNUVectorType` and `BuiltInOperation`.

Added a simple IR test for vector types.
@dave-bartolomeo
Copy link
Contributor Author

Semantic conflicts fixed and ready for merge.

Copy link
Contributor

@rdmarsh2 rdmarsh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after rebase

@rdmarsh2 rdmarsh2 merged commit 23b74b5 into github:master Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants