diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-03 04:15:11 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-03 04:15:11 +0000 |
| commit | d4f4b7f5eeff451e1b654a3356dd58feb5e38362 (patch) | |
| tree | 02696d1e68ceacc20e965028046ad788a4dcc353 /clang/lib/CodeGen/CGBuiltin.cpp | |
| parent | 1950a11939b31892a97ca93811eb75fdc3835cc5 (diff) | |
| download | bcm5719-llvm-d4f4b7f5eeff451e1b654a3356dd58feb5e38362.tar.gz bcm5719-llvm-d4f4b7f5eeff451e1b654a3356dd58feb5e38362.zip | |
Add proper target hooks for __builtin_extract_return_address and
__builtin_frob_return_address. The implementations for both are
still trivial in the default case.
llvm-svn: 97638
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 0c875f78b1c..7dd9f6eb077 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -360,8 +360,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, return RValue::get(Builder.CreateCall(F, Depth)); } case Builtin::BI__builtin_extract_return_addr: { - // FIXME: There should be a target hook for this - return RValue::get(EmitScalarExpr(E->getArg(0))); + Value *Address = EmitScalarExpr(E->getArg(0)); + Value *Result = getTargetHooks().decodeReturnAddress(*this, Address); + return RValue::get(Result); + } + case Builtin::BI__builtin_frob_return_addr: { + Value *Address = EmitScalarExpr(E->getArg(0)); + Value *Result = getTargetHooks().encodeReturnAddress(*this, Address); + return RValue::get(Result); } case Builtin::BI__builtin_unwind_init: { Value *F = CGM.getIntrinsic(Intrinsic::eh_unwind_init, 0, 0); @@ -391,7 +397,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, // Otherwise, ask the codegen data what to do. const llvm::IntegerType *Int64Ty = llvm::IntegerType::get(C, 64); - if (CGM.getTargetCodeGenInfo().extendPointerWithSExt()) + if (getTargetHooks().extendPointerWithSExt()) return RValue::get(Builder.CreateSExt(Result, Int64Ty, "extend.sext")); else return RValue::get(Builder.CreateZExt(Result, Int64Ty, "extend.zext")); |

