forked from OSchip/llvm-project
implement codegen support for FP literals
llvm-svn: 39718
This commit is contained in:
parent
84ff4b44b0
commit
2ada32ed7d
|
@ -432,6 +432,8 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
|
||||||
// Leaf expressions.
|
// Leaf expressions.
|
||||||
case Expr::IntegerLiteralClass:
|
case Expr::IntegerLiteralClass:
|
||||||
return EmitIntegerLiteral(cast<IntegerLiteral>(E));
|
return EmitIntegerLiteral(cast<IntegerLiteral>(E));
|
||||||
|
case Expr::FloatingLiteralClass:
|
||||||
|
return EmitFloatingLiteral(cast<FloatingLiteral>(E));
|
||||||
|
|
||||||
// Operators.
|
// Operators.
|
||||||
case Expr::ParenExprClass:
|
case Expr::ParenExprClass:
|
||||||
|
@ -451,6 +453,10 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
|
||||||
RValue CodeGenFunction::EmitIntegerLiteral(const IntegerLiteral *E) {
|
RValue CodeGenFunction::EmitIntegerLiteral(const IntegerLiteral *E) {
|
||||||
return RValue::get(llvm::ConstantInt::get(E->getValue()));
|
return RValue::get(llvm::ConstantInt::get(E->getValue()));
|
||||||
}
|
}
|
||||||
|
RValue CodeGenFunction::EmitFloatingLiteral(const FloatingLiteral *E) {
|
||||||
|
return RValue::get(llvm::ConstantFP::get(ConvertType(E->getType()),
|
||||||
|
E->getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
|
RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
|
||||||
QualType SrcTy;
|
QualType SrcTy;
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace clang {
|
||||||
class DeclRefExpr;
|
class DeclRefExpr;
|
||||||
class StringLiteral;
|
class StringLiteral;
|
||||||
class IntegerLiteral;
|
class IntegerLiteral;
|
||||||
|
class FloatingLiteral;
|
||||||
class CastExpr;
|
class CastExpr;
|
||||||
class CallExpr;
|
class CallExpr;
|
||||||
class UnaryOperator;
|
class UnaryOperator;
|
||||||
|
@ -280,6 +281,7 @@ public:
|
||||||
|
|
||||||
RValue EmitExpr(const Expr *E);
|
RValue EmitExpr(const Expr *E);
|
||||||
RValue EmitIntegerLiteral(const IntegerLiteral *E);
|
RValue EmitIntegerLiteral(const IntegerLiteral *E);
|
||||||
|
RValue EmitFloatingLiteral(const FloatingLiteral *E);
|
||||||
|
|
||||||
RValue EmitCastExpr(const CastExpr *E);
|
RValue EmitCastExpr(const CastExpr *E);
|
||||||
RValue EmitCallExpr(const CallExpr *E);
|
RValue EmitCallExpr(const CallExpr *E);
|
||||||
|
|
Loading…
Reference in New Issue