summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-28 23:59:40 +0000
committerChris Lattner <sabre@nondot.org>2009-10-28 23:59:40 +0000
commit6c4d255bf3d64fd2ecb48334e780c87f060f1280 (patch)
treed89f05cd759ed3e4900f018b4a0e546745eb1f43 /clang/lib/CodeGen/CGExprConstant.cpp
parent48d9995d2ba86daf86396dbe847235fcf492bbbe (diff)
downloadbcm5719-llvm-6c4d255bf3d64fd2ecb48334e780c87f060f1280.tar.gz
bcm5719-llvm-6c4d255bf3d64fd2ecb48334e780c87f060f1280.zip
Implement clang support for indirect branch and address of label
using the new LLVM support for this. This is temporarily hiding behind horrible and ugly #ifdefs until the time when the optimizer is stable (hopefully a week or so). Until then, lets make it "opt in" :) llvm-svn: 85446
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index f8923efd24a..dc0aa9e7c42 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -776,11 +776,17 @@ public:
}
case Expr::AddrLabelExprClass: {
assert(CGF && "Invalid address of label expression outside function.");
+#ifndef USEINDIRECTBRANCH
unsigned id =
CGF->GetIDForAddrOfLabel(cast<AddrLabelExpr>(E)->getLabel());
llvm::Constant *C =
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), id);
return llvm::ConstantExpr::getIntToPtr(C, ConvertType(E->getType()));
+#else
+ llvm::Constant *Ptr =
+ CGF->GetAddrOfLabel(cast<AddrLabelExpr>(E)->getLabel());
+ return llvm::ConstantExpr::getBitCast(Ptr, ConvertType(E->getType()));
+#endif
}
case Expr::CallExprClass: {
CallExpr* CE = cast<CallExpr>(E);
OpenPOWER on IntegriCloud