[llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Fri Jul 4 09:40:57 PDT 2008


Hi Devang,

> +  case BUILT_IN_OBJECT_SIZE: {
> +    tree ArgList = TREE_OPERAND (exp, 1);
> +    if (!validate_arglist(ArgList, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) {
> +      error("Invalid builtin_object_size argument types");
> +      return false;
> +    }
> +    tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (ArgList));
> +    STRIP_NOPS (ObjSizeTree);
> +    if (TREE_CODE (ObjSizeTree) != INTEGER_CST
> +        || tree_int_cst_sgn (ObjSizeTree) < 0
> +        || compare_tree_int (ObjSizeTree, 3) > 0) {
> +      error("Invalid second builtin_object_size argument");
> +      return false;
> +    }
> +
> +    if (tree_low_cst (ObjSizeTree, 0) < 2)
> +      Result = ConstantInt::get(Type::Int32Ty, 0);
> +    else
> +      Result = ConstantInt::getAllOnesValue(Type::Int32Ty);
> +    return true;
> +  }

it looks like this returns either 0 or -1.  I guess how it
works is that fold or someone turns this into the object size
if it can, and if it reaches here that means the size is
unknown.  Is that right?

Ciao,

Duncan.



More information about the llvm-commits mailing list