mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
implement insertelement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90683abb56
commit
33a44d928b
@ -187,7 +187,7 @@ namespace {
|
||||
// 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;
|
||||
|
||||
@ -252,6 +252,8 @@ namespace {
|
||||
void visitGetElementPtrInst(GetElementPtrInst &I);
|
||||
void visitVAArgInst (VAArgInst &I);
|
||||
|
||||
void visitInsertElementInst(InsertElementInst &I);
|
||||
|
||||
void visitInstruction(Instruction &I) {
|
||||
cerr << "C Writer does not know about " << I;
|
||||
abort();
|
||||
@ -3022,6 +3024,20 @@ void CWriter::visitVAArgInst(VAArgInst &I) {
|
||||
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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user