[llvm-commits] [llvm] r148741 - in /llvm/trunk: include/llvm/Constants.h include/llvm/Value.h lib/VMCore/Constants.cpp lib/VMCore/LLVMContextImpl.cpp lib/VMCore/LLVMContextImpl.h

Duncan Sands baldrick at free.fr
Mon Jan 30 09:01:29 PST 2012


Hi Chris,

> --- llvm/trunk/include/llvm/Constants.h (original)
> +++ llvm/trunk/include/llvm/Constants.h Mon Jan 23 16:57:10 2012
> @@ -535,6 +534,166 @@
>       return V->getValueID() == ConstantPointerNullVal;
>     }
>   };
> +
> +//===----------------------------------------------------------------------===//
> +/// ConstantDataSequential - A vector or array of data that contains no
> +/// relocations, and whose element type is a simple 1/2/4/8-byte integer or

why talk about "relocations" here?  What is a "relocation"?  Don't you
just mean that it is an array of numbers?  Same goes for the other uses
of "relocations" later in the file.

> +public:
> +
> +  virtual void destroyConstant();
> +
> +  /// getElementAsInteger - If this is a sequential container of integers (of
> +  /// any size), return the specified element in the low bits of a uint64_t.
> +  uint64_t getElementAsInteger(unsigned i) const;
> +
> +  /// getElementAsAPFloat - If this is a sequential container of floating point
> +  /// type, return the specified element as an APFloat.
> +  APFloat getElementAsAPFloat(unsigned i) const;

Wouldn't it be more symmetric to also have a method "getElementAsAPInt"?

> +  /// getElementAsDouble - If this is an sequential container of doubles, return
> +  /// the specified element as a float.

as a float -> as a double

> --- llvm/trunk/lib/VMCore/Constants.cpp (original)
> +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jan 23 16:57:10 2012
> @@ -1913,6 +1913,154 @@
>       OperandList[i+1] = IdxList[i];
>   }
>
> +//===----------------------------------------------------------------------===//
> +//                       ConstantData* implementations
> +
> +void ConstantDataArray::anchor() {}
> +void ConstantDataVector::anchor() {}
> +
> +/// isAllZeros - return true if the array is empty or all zeros.
> +static bool isAllZeros(StringRef Arr) {
> +  for (StringRef::iterator I = Arr.begin(), E = Arr.end(); I != E; ++I)
> +    if (*I != 0)
> +      return false;
> +  return true;
> +}
Missing blank line.
> +/// getImpl - This is the underlying implementation of all of the
> +/// ConstantDataSequential::get methods.  They all thunk down to here, providing
> +/// the correct element type.  We take the bytes in as an StringRef because

an StringRef -> a StringRef

Ciao, Duncan.



More information about the llvm-commits mailing list