From 0ffb125996336fc7602b162c0a9e392f1a93060f Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 4 Aug 2008 16:51:22 +0000 Subject: Add CodeGen support for indirect goto. - Follows emission scheme used by llvm-gcc, i.e. invent an id for each label whose address is taken and replace each indirect goto by a switch to each possible target. - Currently we emit a switch for each indirect goto instead of merging them as llvm-gcc does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54318 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index c44af4b8f1..e8adc59e9f 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -117,6 +117,12 @@ public: Value *VisitSizeOfAlignOfTypeExpr(const SizeOfAlignOfTypeExpr *E) { return EmitSizeAlignOf(E->getArgumentType(), E->getType(), E->isSizeOf()); } + Value *VisitAddrLabelExpr(const AddrLabelExpr *E) { + Value *V = llvm::ConstantInt::get(llvm::Type::Int32Ty, + CGF.GetIDForAddrOfLabel(E->getLabel())); + return Builder.CreateIntToPtr(V, + llvm::PointerType::getUnqual(llvm::Type::Int8Ty)); + } // l-values. Value *VisitDeclRefExpr(DeclRefExpr *E) { -- cgit v1.2.3-70-g09d2