As the number of parameter attributes increases, Verifier::visitFunction is suffering a combinatorial explosion due to the number of mutually incompatible attributes.  This patch tidies the whole thing up using attribute masks.  While there I fixed some small bugs: (1) the ByVal attribute tests cast a type to a pointer type, which can fail.  Yes, the fact it is of a pointer type is checked before, but a failing check does not cause the program to exit, it continues on outputting further errors; (2) Nothing was checking that an sret attribute is on the first parameter; (3) nothing was checking that a function for which isStructReturn() is true has a parameter with the sret attribute and vice-versa (I don't think it is possible for this to go wrong, but it seems right to check it).
As the number of parameter attributes increases,
Verifier::visitFunction is suffering a combinatorial
explosion due to the number of mutually incompatible
attributes.  This patch tidies the whole thing up
using attribute masks.  While there I fixed some
small bugs: (1) the ByVal attribute tests cast a
type to a pointer type, which can fail.  Yes, the
fact it is of a pointer type is checked before,
but a failing check does not cause the program
to exit, it continues on outputting further errors;
(2) Nothing was checking that an sret attribute is
on the first parameter; (3) nothing was checking that
a function for which isStructReturn() is true has a
parameter with the sret attribute and vice-versa (I
don't think it is possible for this to go wrong, but
it seems right to check it).


git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@40553 91177308-0d34-0410-b5e6-96231b3b80d8

apple/swift-llvm,chubbymaggie/asap,apple/swift-llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,dslab-epfl/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm