[llvm-commits] [llvm] r47811 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 1 19:52:39 PST 2008
Author: lattner
Date: Sat Mar 1 21:52:39 2008
New Revision: 47811
URL: http://llvm.org/viewvc/llvm-project?rev=47811&view=rev
Log:
implement insertelement.
Modified:
llvm/trunk/lib/Target/CBackend/CBackend.cpp
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=47811&r1=47810&r2=47811&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sat Mar 1 21:52:39 2008
@@ -187,7 +187,7 @@
// emit it inline where it would go.
if (I.getType() == Type::VoidTy || !I.hasOneUse() ||
isa<TerminatorInst>(I) || isa<CallInst>(I) || isa<PHINode>(I) ||
- isa<LoadInst>(I) || isa<VAArgInst>(I))
+ isa<LoadInst>(I) || isa<VAArgInst>(I) || isa<InsertElementInst>(I))
// Don't inline a load across a store or other bad things!
return false;
@@ -251,6 +251,8 @@
void visitStoreInst (StoreInst &I);
void visitGetElementPtrInst(GetElementPtrInst &I);
void visitVAArgInst (VAArgInst &I);
+
+ void visitInsertElementInst(InsertElementInst &I);
void visitInstruction(Instruction &I) {
cerr << "C Writer does not know about " << I;
@@ -3022,6 +3024,20 @@
Out << ");\n ";
}
+void CWriter::visitInsertElementInst(InsertElementInst &I) {
+ const Type *EltTy = I.getType()->getElementType();
+ writeOperand(I.getOperand(0));
+ Out << ";\n ";
+ Out << "((";
+ printType(Out, PointerType::getUnqual(EltTy));
+ Out << ")(&" << GetValueName(&I) << "))[";
+ writeOperand(I.getOperand(1));
+ Out << "] = (";
+ writeOperand(I.getOperand(2));
+ Out << ")";
+}
+
+
//===----------------------------------------------------------------------===//
// External Interface declaration
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list