mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-26 23:32:58 +00:00
implement extractelement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47812 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
33a44d928b
commit
0452ed6bd6
@ -191,8 +191,10 @@ namespace {
|
|||||||
// Don't inline a load across a store or other bad things!
|
// Don't inline a load across a store or other bad things!
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Must not be used in inline asm
|
// Must not be used in inline asm or extractelement.
|
||||||
if (I.hasOneUse() && isInlineAsm(*I.use_back())) return false;
|
if (I.hasOneUse() &&
|
||||||
|
(isInlineAsm(*I.use_back()) || isa<ExtractElementInst>(I)))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Only inline instruction it if it's use is in the same BB as the inst.
|
// Only inline instruction it if it's use is in the same BB as the inst.
|
||||||
return I.getParent() == cast<Instruction>(I.use_back())->getParent();
|
return I.getParent() == cast<Instruction>(I.use_back())->getParent();
|
||||||
@ -253,6 +255,7 @@ namespace {
|
|||||||
void visitVAArgInst (VAArgInst &I);
|
void visitVAArgInst (VAArgInst &I);
|
||||||
|
|
||||||
void visitInsertElementInst(InsertElementInst &I);
|
void visitInsertElementInst(InsertElementInst &I);
|
||||||
|
void visitExtractElementInst(ExtractElementInst &I);
|
||||||
|
|
||||||
void visitInstruction(Instruction &I) {
|
void visitInstruction(Instruction &I) {
|
||||||
cerr << "C Writer does not know about " << I;
|
cerr << "C Writer does not know about " << I;
|
||||||
@ -3037,6 +3040,18 @@ void CWriter::visitInsertElementInst(InsertElementInst &I) {
|
|||||||
Out << ")";
|
Out << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWriter::visitExtractElementInst(ExtractElementInst &I) {
|
||||||
|
// We know that our operand is not inlined.
|
||||||
|
Out << "((";
|
||||||
|
const Type *EltTy =
|
||||||
|
cast<VectorType>(I.getOperand(0)->getType())->getElementType();
|
||||||
|
printType(Out, PointerType::getUnqual(EltTy));
|
||||||
|
Out << ")(&" << GetValueName(I.getOperand(0)) << "))[";
|
||||||
|
writeOperand(I.getOperand(1));
|
||||||
|
Out << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// External Interface declaration
|
// External Interface declaration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user