[llvm-commits] [llvm-gcc-4.2] r40129 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Fri Jul 20 15:57:11 PDT 2007
Author: baldrick
Date: Fri Jul 20 17:57:11 2007
New Revision: 40129
URL: http://llvm.org/viewvc/llvm-project?rev=40129&view=rev
Log:
Use new constructor formalism in EmitCONSTRUCTOR.
This partially fixes 2006-03-16-VectorCtor.c.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=40129&r1=40128&r2=40129&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Jul 20 17:57:11 2007
@@ -5381,16 +5381,18 @@
// Insert zero initializers for any uninitialized values.
Constant *Zero = Constant::getNullValue(PTy->getElementType());
BuildVecOps.resize(cast<VectorType>(Ty)->getNumElements(), Zero);
-
+
// Insert all of the elements here.
- for (tree Ops = TREE_OPERAND(exp, 0); Ops; Ops = TREE_CHAIN(Ops)) {
- if (!TREE_PURPOSE(Ops)) continue; // Not actually initialized?
+ unsigned HOST_WIDE_INT ix;
+ tree purpose, value;
+ FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (exp), ix, purpose, value) {
+ if (!purpose) continue; // Not actually initialized?
- unsigned FieldNo = TREE_INT_CST_LOW(TREE_PURPOSE(Ops));
+ unsigned FieldNo = TREE_INT_CST_LOW(purpose);
// Update the element.
if (FieldNo < BuildVecOps.size())
- BuildVecOps[FieldNo] = Emit(TREE_VALUE(Ops), 0);
+ BuildVecOps[FieldNo] = Emit(value, 0);
}
return BuildVector(BuildVecOps);
More information about the llvm-commits
mailing list