comparison gen/abi.cpp @ 1545:7fcb72d518f6

More factory methods moved to LLVMContext
author Benjamin Kramer <benny.kra@gmail.com>
date Wed, 15 Jul 2009 18:09:41 +0200
parents 2292878925f4
children d6e8d5db259f
comparison
equal deleted inserted replaced
1544:8863cf7236e6 1545:7fcb72d518f6
58 // extract real part 58 // extract real part
59 LLValue* rpart = gIR->ir->CreateTrunc(in, LLType::Int32Ty); 59 LLValue* rpart = gIR->ir->CreateTrunc(in, LLType::Int32Ty);
60 rpart = gIR->ir->CreateBitCast(rpart, LLType::FloatTy, ".re"); 60 rpart = gIR->ir->CreateBitCast(rpart, LLType::FloatTy, ".re");
61 61
62 // extract imag part 62 // extract imag part
63 LLValue* ipart = gIR->ir->CreateLShr(in, LLConstantInt::get(LLType::Int64Ty, 32, false)); 63 LLValue* ipart = gIR->ir->CreateLShr(in, gIR->context().getConstantInt(LLType::Int64Ty, 32, false));
64 ipart = gIR->ir->CreateTrunc(ipart, LLType::Int32Ty); 64 ipart = gIR->ir->CreateTrunc(ipart, LLType::Int32Ty);
65 ipart = gIR->ir->CreateBitCast(ipart, LLType::FloatTy, ".im"); 65 ipart = gIR->ir->CreateBitCast(ipart, LLType::FloatTy, ".im");
66 66
67 // return {float,float} aggr pair with same bits 67 // return {float,float} aggr pair with same bits
68 return DtoAggrPair(rpart, ipart, ".final_cfloat"); 68 return DtoAggrPair(rpart, ipart, ".final_cfloat");
85 // cast to i32 85 // cast to i32
86 i = gIR->ir->CreateBitCast(i, LLType::Int32Ty); 86 i = gIR->ir->CreateBitCast(i, LLType::Int32Ty);
87 // zext to i64 87 // zext to i64
88 i = gIR->ir->CreateZExt(i, LLType::Int64Ty); 88 i = gIR->ir->CreateZExt(i, LLType::Int64Ty);
89 // shift up 89 // shift up
90 i = gIR->ir->CreateShl(i, LLConstantInt::get(LLType::Int64Ty, 32, false)); 90 i = gIR->ir->CreateShl(i, gIR->context().getConstantInt(LLType::Int64Ty, 32, false));
91 91
92 // combine and return 92 // combine and return
93 return v = gIR->ir->CreateOr(r, i); 93 return v = gIR->ir->CreateOr(r, i);
94 } 94 }
95 95