ADd support for select instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12316 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-12 05:52:14 +00:00
parent 46b787e986
commit 9f24a077bd
2 changed files with 24 additions and 0 deletions

View File

@ -140,6 +140,7 @@ namespace {
void visitBinaryOperator(Instruction &I);
void visitCastInst (CastInst &I);
void visitSelectInst(SelectInst &I);
void visitCallInst (CallInst &I);
void visitCallSite (CallSite CS);
void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
@ -1185,6 +1186,17 @@ void CWriter::visitCastInst(CastInst &I) {
writeOperand(I.getOperand(0));
}
void CWriter::visitSelectInst(SelectInst &I) {
Out << "((";
writeOperand(I.getCondition());
Out << ") ? (";
writeOperand(I.getTrueValue());
Out << ") : (";
writeOperand(I.getFalseValue());
Out << "))";
}
void CWriter::lowerIntrinsics(Module &M) {
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)

View File

@ -140,6 +140,7 @@ namespace {
void visitBinaryOperator(Instruction &I);
void visitCastInst (CastInst &I);
void visitSelectInst(SelectInst &I);
void visitCallInst (CallInst &I);
void visitCallSite (CallSite CS);
void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
@ -1185,6 +1186,17 @@ void CWriter::visitCastInst(CastInst &I) {
writeOperand(I.getOperand(0));
}
void CWriter::visitSelectInst(SelectInst &I) {
Out << "((";
writeOperand(I.getCondition());
Out << ") ? (";
writeOperand(I.getTrueValue());
Out << ") : (";
writeOperand(I.getFalseValue());
Out << "))";
}
void CWriter::lowerIntrinsics(Module &M) {
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)