[llvm-commits] [PATCH] Make Inits FoldingSetNodes
David A. Greene
greened at obbligato.org
Thu Jul 14 14:47:05 PDT 2011
Chris Lattner <clattner at apple.com> writes:
> On Jul 13, 2011, at 3:33 PM, David Greene wrote:
> @@ -530,6 +629,23 @@ const Init *OpInit::resolveListElementReference(Record &R, const
> +const UnOpInit *UnOpInit::get(UnaryOp opc, const Init *lhs, RecTy *Type) {
> + FoldingSetNodeID ID;
> + ID.AddInteger(initUnOp);
> + ID.AddInteger(opc);
> + ID.AddString(Type->getAsString());
> + ID.AddPointer(lhs);
>
> DenseMap makes sense here.
>
> +const BinOpInit *BinOpInit::get(BinaryOp opc, const Init *lhs,
> + const Init *rhs, RecTy *Type) {
>
> and here.
>
> +const TernOpInit *TernOpInit::get(TernaryOp opc, const Init *lhs,
> + const Init *mhs, const Init *rhs,
> + RecTy *Type) {
>
> and here.
I am going through and uniquing Inits in their own unique ways.
Question on these three. DenseMap of what? There's an opcode, multiple
operands and a type. What's the Key, a struct of these items? Is a
DenseMap much more efficient than a FoldingSetNode when string
comparison/hash is involved? Wouldn't hashing a struct of these and
putting them in a DenseMap basically be equivalent to a FoldingSet?
-Dave
More information about the llvm-commits
mailing list