forked from OSchip/llvm-project
implement codegen for real/imag. TODO: imag of non-complex.
llvm-svn: 41376
This commit is contained in:
parent
30b5dd0b79
commit
9f0ad96b3e
|
@ -147,7 +147,8 @@ public:
|
|||
}
|
||||
Value *EmitSizeAlignOf(QualType TypeToSize, QualType RetType,
|
||||
bool isSizeOf);
|
||||
// FIXME: Real,Imag.
|
||||
Value *VisitUnaryReal (const UnaryOperator *E);
|
||||
Value *VisitUnaryImag (const UnaryOperator *E);
|
||||
Value *VisitUnaryExtension(const UnaryOperator *E) {
|
||||
return Visit(E->getSubExpr());
|
||||
}
|
||||
|
@ -363,7 +364,7 @@ Value *ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *E) {
|
|||
/// EmitSizeAlignOf - Return the size or alignment of the 'TypeToSize' type as
|
||||
/// an integer (RetType).
|
||||
Value *ScalarExprEmitter::EmitSizeAlignOf(QualType TypeToSize,
|
||||
QualType RetType,bool isSizeOf){
|
||||
QualType RetType,bool isSizeOf){
|
||||
/// FIXME: This doesn't handle VLAs yet!
|
||||
std::pair<uint64_t, unsigned> Info =
|
||||
CGF.getContext().getTypeInfo(TypeToSize, SourceLocation());
|
||||
|
@ -377,6 +378,22 @@ Value *ScalarExprEmitter::EmitSizeAlignOf(QualType TypeToSize,
|
|||
return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val));
|
||||
}
|
||||
|
||||
Value *ScalarExprEmitter::VisitUnaryReal(const UnaryOperator *E) {
|
||||
Expr *Op = E->getSubExpr();
|
||||
if (Op->getType()->isComplexType())
|
||||
return CGF.EmitComplexExpr(Op).first;
|
||||
return Visit(Op);
|
||||
}
|
||||
Value *ScalarExprEmitter::VisitUnaryImag(const UnaryOperator *E) {
|
||||
Expr *Op = E->getSubExpr();
|
||||
if (Op->getType()->isComplexType())
|
||||
return CGF.EmitComplexExpr(Op).second;
|
||||
|
||||
// FIXME: does this evaluate the subexpr??
|
||||
return 0; // FIXME: Return zero of the right int/fp type.
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Binary Operators
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -26,4 +26,6 @@ void test3() {
|
|||
g1 = g1 - g2;
|
||||
g1 = g1 * g2;
|
||||
g1 = +-~g1;
|
||||
|
||||
double Gr = __real g1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue