[llvm-commits] [dragonegg] r131125 - /dragonegg/trunk/src/Convert.cpp
Duncan Sands
baldrick at free.fr
Tue May 10 06:51:38 PDT 2011
Author: baldrick
Date: Tue May 10 08:51:38 2011
New Revision: 131125
URL: http://llvm.org/viewvc/llvm-project?rev=131125&view=rev
Log:
Add support for non-constant constructors for vectors of pointers,
fixing PR9724.
Modified:
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=131125&r1=131124&r2=131125&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Tue May 10 08:51:38 2011
@@ -2426,7 +2426,7 @@
unsigned HOST_WIDE_INT idx;
tree value;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value) {
- Value *Elt = EmitMemory(value);
+ Value *Elt = EmitRegister(value);
if (const VectorType *EltTy = dyn_cast<VectorType>(Elt->getType())) {
// GCC allows vectors to be built up from vectors. Extract all of the
@@ -2436,6 +2436,10 @@
BuildVecOps.push_back(Builder.CreateExtractElement(Elt, Index));
}
} else {
+ // LLVM does not support vectors of pointers, so turn any pointers into
+ // integers.
+ if (isa<PointerType>(Elt->getType()))
+ Elt = Builder.CreatePtrToInt(Elt, TD.getIntPtrType(Context));
assert(Elt->getType() == VTy->getElementType() &&
"Unexpected type for vector constructor!");
BuildVecOps.push_back(Elt);
More information about the llvm-commits
mailing list