diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-02 02:31:24 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-02 02:31:24 +0000 |
| commit | 4b613fae3522c10e17a0f377ba98be68a23fc1c9 (patch) | |
| tree | 625e04ef114cdf5dba1005c6f6c53fa7dd22d567 /clang/lib | |
| parent | b884fe867e874cf8159cbbf7067fd1ce0e1aba27 (diff) | |
| download | bcm5719-llvm-4b613fae3522c10e17a0f377ba98be68a23fc1c9.tar.gz bcm5719-llvm-4b613fae3522c10e17a0f377ba98be68a23fc1c9.zip | |
After much consultation aimed at figuring out what this builtin actually
does, document the results and then implement __builtin_extend_pointer for
platforms where it's a no-op.
llvm-svn: 97540
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index beaf7b89c00..1956abf39f3 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -365,6 +365,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, Value *F = CGM.getIntrinsic(Intrinsic::eh_unwind_init, 0, 0); return RValue::get(Builder.CreateCall(F)); } + case Builtin::BI__builtin_extend_pointer: { + // Extends a pointer to the size of an _Unwind_Word, which is + // generally a uint64_t. Generally this gets poked directly into + // a register (or a "register" depending on platform) and then + // called, so if the pointer is shorter than a word we need to + // zext / sext based on the platform's expectations for pointers + // in registers. + // + // See: http://gcc.gnu.org/ml/gcc-bugs/2002-02/msg00237.html + // + // FIXME: ptrtoint always zexts; use a target hook if we start + // supporting targets where this matters. + Value *Ptr = EmitScalarExpr(E->getArg(0)); + const llvm::Type *Ty = CGM.getTypes().ConvertType(E->getType()); + return RValue::get(Builder.CreatePtrToInt(Ptr, Ty)); + } #if 0 // FIXME: Finish/enable when LLVM backend support stabilizes case Builtin::BI__builtin_setjmp: { |

