CodeGenFunction.h revision 3d8400d9a61aa4b63ff35e5cede405b32a41425e
1bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar//===-- CodeGenFunction.h - Per-Function state for LLVM CodeGen -*- C++ -*-===//
25f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
35f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//                     The LLVM Compiler Infrastructure
45f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source
60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details.
75f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
85f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
95f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// This is the internal per-function state used for llvm translation.
115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
14ef52a2fb2ace36c92f88c6e125bd7defa17dafa5Chris Lattner#ifndef CLANG_CODEGEN_CODEGENFUNCTION_H
15ef52a2fb2ace36c92f88c6e125bd7defa17dafa5Chris Lattner#define CLANG_CODEGEN_CODEGENFUNCTION_H
165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
17391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner#include "clang/AST/Type.h"
185f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "llvm/ADT/DenseMap.h"
19da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner#include "llvm/ADT/SmallVector.h"
2050b36741673258aaebcd3c7fe1260031901cae57Chris Lattner#include "llvm/Support/IRBuilder.h"
215549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek#include "clang/AST/Expr.h"
225549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek#include "clang/AST/ExprObjC.h"
235549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek
245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <vector>
250ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar#include <map>
265f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
278f2926b73ed635afecd020da787af6a837601a2bDaniel Dunbar#include "CGValue.h"
288f2926b73ed635afecd020da787af6a837601a2bDaniel Dunbar
295f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace llvm {
30c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar  class BasicBlock;
315f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class Module;
325f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}
335f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
345f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang {
355f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class ASTContext;
365f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class Decl;
37c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar  class EnumConstantDecl;
385f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class FunctionDecl;
39c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar  class FunctionTypeProto;
40c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar  class LabelStmt;
41391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner  class ObjCMethodDecl;
42af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  class ObjCPropertyImplDecl;
435f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class TargetInfo;
44c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar  class VarDecl;
455549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek
465f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace CodeGen {
475f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  class CodeGenModule;
48b84a06e68ffd71da22e3c75b6e4bbdba37816413Devang Patel  class CodeGenTypes;
4988a981b47c7face1b1fdaa9074256245107b9ca9Devang Patel  class CGRecordLayout;
505f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
515f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// CodeGenFunction - This class organizes the per-function state that is used
525f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// while generating LLVM code.
535f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass CodeGenFunction {
54bfc0c1ae4b505b52b36f572a9641f99e76879cabChris Lattnerpublic:
555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  CodeGenModule &CGM;  // Per-module state.
565f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  TargetInfo &Target;
57bfc0c1ae4b505b52b36f572a9641f99e76879cabChris Lattner
5858dee10ed2eee34035f62d1c2d32b3639e9182f8Chris Lattner  typedef std::pair<llvm::Value *, llvm::Value *> ComplexPairTy;
5985e356825b291f86c6e926638914222b834b71a3Chris Lattner  llvm::IRBuilder<> Builder;
605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
61c8aa5f1f264fb230c38182adab944232bb160c2bChris Lattner  // Holds the Decl for the current function or method
624111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner  const Decl *CurFuncDecl;
63391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner  QualType FnRetTy;
645f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::Function *CurFn;
655f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
665f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// AllocaInsertPoint - This is an instruction in the entry block before which
675f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// we prefer to insert allocas.
685f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::Instruction *AllocaInsertPt;
690ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
705f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  const llvm::Type *LLVMIntTy;
717b66000bdfc2684351fb03208e672f23012ed569Hartmut Kaiser  uint32_t LLVMPointerWidth;
725f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
737f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattnerprivate:
740ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// LabelIDs - Track arbitrary ids assigned to labels for use in
750ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// implementing the GCC address-of-label extension and indirect
760ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// goto. IDs are assigned to labels inside getIDForAddrOfLabel().
770ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  std::map<const LabelStmt*, unsigned> LabelIDs;
780ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
790ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// IndirectSwitches - Record the list of switches for indirect
800ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// gotos. Emission of the actual switching code needs to be delayed
810ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// until all AddrLabelExprs have been seen.
820ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  std::vector<llvm::SwitchInst*> IndirectSwitches;
830ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
845f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// LocalDeclMap - This keeps track of the LLVM allocas or globals for local C
855f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// decls.
865f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::DenseMap<const Decl*, llvm::Value*> LocalDeclMap;
875f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
885f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// LabelMap - This keeps track of the LLVM basic block for each C label.
895f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
90da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner
91da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  // BreakContinueStack - This keeps track of where break and continue
92da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  // statements should jump to.
93da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  struct BreakContinue {
94da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner    BreakContinue(llvm::BasicBlock *bb, llvm::BasicBlock *cb)
95da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner      : BreakBlock(bb), ContinueBlock(cb) {}
96da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner
97da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner    llvm::BasicBlock *BreakBlock;
98da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner    llvm::BasicBlock *ContinueBlock;
99da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  };
100da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  llvm::SmallVector<BreakContinue, 8> BreakContinueStack;
101da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner
10280fd5f96e6805ac43aab99faabd5b4c8b19551b7Devang Patel  /// SwitchInsn - This is nearest current switch instruction. It is null if
10380fd5f96e6805ac43aab99faabd5b4c8b19551b7Devang Patel  /// if current context is not in a switch.
10451b09f2c528c8460b5465c676173324e44176d62Devang Patel  llvm::SwitchInst *SwitchInsn;
10551b09f2c528c8460b5465c676173324e44176d62Devang Patel
10680fd5f96e6805ac43aab99faabd5b4c8b19551b7Devang Patel  /// CaseRangeBlock - This block holds if condition check for last case
10780fd5f96e6805ac43aab99faabd5b4c8b19551b7Devang Patel  /// statement range in current switch instruction.
108c049e4f406a7f7179eba98659044a32508e53289Devang Patel  llvm::BasicBlock *CaseRangeBlock;
109c049e4f406a7f7179eba98659044a32508e53289Devang Patel
1105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerpublic:
1115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  CodeGenFunction(CodeGenModule &cgm);
1125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  ASTContext &getContext() const;
1145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
115391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner  void GenerateObjCMethod(const ObjCMethodDecl *OMD);
116af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar
117af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  void StartObjCMethod(const ObjCMethodDecl *MD);
118af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar
119af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  /// GenerateObjCGetter - Synthesize an Objective-C property getter
120af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  /// function.
121af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  void GenerateObjCGetter(const ObjCPropertyImplDecl *PID);
122af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar
123af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  /// GenerateObjCSetter - Synthesize an Objective-C property setter
124af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  /// function for the given property.
125af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  void GenerateObjCSetter(const ObjCPropertyImplDecl *PID);
126af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar
127bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar  void GenerateCode(const FunctionDecl *FD,
128bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar                    llvm::Function *Fn);
129af05bb9073319d8381b71c4325188853fd4b8ed6Daniel Dunbar  void FinishFunction(SourceLocation EndLoc=SourceLocation());
1305f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1315f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  const llvm::Type *ConvertType(QualType T);
132c8aa5f1f264fb230c38182adab944232bb160c2bChris Lattner
133b7ec246872b412f0e7bb9e93eacfd78cfa6adfb3Daniel Dunbar  /// LoadObjCSelf - Load the value of self. This function is only
134b7ec246872b412f0e7bb9e93eacfd78cfa6adfb3Daniel Dunbar  /// valid while generating code for an Objective-C method.
135c8aa5f1f264fb230c38182adab944232bb160c2bChris Lattner  llvm::Value *LoadObjCSelf();
1364111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner
1374111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner  /// isObjCPointerType - Return true if the specificed AST type will map onto
1384111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner  /// some Objective-C pointer type.
1394111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner  static bool isObjCPointerType(QualType T);
1404111024be81e7c0525e42dadcc126d27e5bf2425Chris Lattner
1415f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// hasAggregateLLVMType - Return true if the specified AST type will map into
1425f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// an aggregate LLVM type or is void.
1435f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  static bool hasAggregateLLVMType(QualType T);
1445f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1455f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
1465f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// label maps to.
1475f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
1485f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1495f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1505f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitBlock(llvm::BasicBlock *BB);
151dc5e8268292046114ffe02e48773572a91a310f1Chris Lattner
152488e993a135ce700b982bf099c3d6b856301d642Daniel Dunbar  /// ErrorUnsupported - Print out an error that codegen doesn't support the
153dc5e8268292046114ffe02e48773572a91a310f1Chris Lattner  /// specified stmt yet.
154488e993a135ce700b982bf099c3d6b856301d642Daniel Dunbar  void ErrorUnsupported(const Stmt *S, const char *Type);
1555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1565f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
1575f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //                                  Helpers
1585f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
1595f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// CreateTempAlloca - This creates a alloca and inserts it into the entry
1615f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// block.
1625f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::AllocaInst *CreateTempAlloca(const llvm::Type *Ty,
1635f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer                                     const char *Name = "tmp");
1645f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1655f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// EvaluateExprAsBool - Perform the usual unary conversions on the specified
1665f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// expression and compare the result against zero, returning an Int1Ty value.
1675f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  llvm::Value *EvaluateExprAsBool(const Expr *E);
1685f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1699b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  /// EmitAnyExpr - Emit code to compute the specified expression which can have
1709b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  /// any type.  The result is returned as an RValue struct.  If this is an
1719b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  /// aggregate expression, the aggloc/agglocvolatile arguments indicate where
1729b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  /// the result should be returned.
1739b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  RValue EmitAnyExpr(const Expr *E, llvm::Value *AggLoc = 0,
1749b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner                     bool isAggLocVolatile = false);
175d9363c3a80168283b3da518b4e17f545a6246857Devang Patel
176d9363c3a80168283b3da518b4e17f545a6246857Devang Patel  /// isDummyBlock - Return true if BB is an empty basic block
177d9363c3a80168283b3da518b4e17f545a6246857Devang Patel  /// with no predecessors.
178d9363c3a80168283b3da518b4e17f545a6246857Devang Patel  static bool isDummyBlock(const llvm::BasicBlock *BB);
179d9363c3a80168283b3da518b4e17f545a6246857Devang Patel
18051b09f2c528c8460b5465c676173324e44176d62Devang Patel  /// StartBlock - Start new block named N. If insert block is a dummy block
18151b09f2c528c8460b5465c676173324e44176d62Devang Patel  /// then reuse it.
18251b09f2c528c8460b5465c676173324e44176d62Devang Patel  void StartBlock(const char *N);
18351b09f2c528c8460b5465c676173324e44176d62Devang Patel
18488a981b47c7face1b1fdaa9074256245107b9ca9Devang Patel  /// getCGRecordLayout - Return record layout info.
18588a981b47c7face1b1fdaa9074256245107b9ca9Devang Patel  const CGRecordLayout *getCGRecordLayout(CodeGenTypes &CGT, QualType RTy);
186813733577d33ec56479667b49e1bff42dc6bba90Lauro Ramos Venancio
187813733577d33ec56479667b49e1bff42dc6bba90Lauro Ramos Venancio  /// GetAddrOfStaticLocalVar - Return the address of a static local variable.
188248a753f6b670692523c99afaeb8fe98f7ae3ca7Steve Naroff  llvm::Constant *GetAddrOfStaticLocalVar(const VarDecl *BVD);
1894f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman
1904f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman  /// getAccessedFieldNo - Given an encoded value and a result number, return
1914f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman  /// the input field number being accessed.
1924f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman  static unsigned getAccessedFieldNo(unsigned Idx, const llvm::Constant *Elts);
1934f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman
1940ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  unsigned GetIDForAddrOfLabel(const LabelStmt *L);
1950ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
1963d8400d9a61aa4b63ff35e5cede405b32a41425eAnders Carlsson  /// EmitMemSetToZero - Generate code to memset a value of the given type to 0;
1973d8400d9a61aa4b63ff35e5cede405b32a41425eAnders Carlsson  void EmitMemSetToZero(llvm::Value *DestPtr, QualType Ty);
1983d8400d9a61aa4b63ff35e5cede405b32a41425eAnders Carlsson
1995f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2005f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //                            Declaration Emission
2015f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2025f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2035f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitDecl(const Decl &D);
204248a753f6b670692523c99afaeb8fe98f7ae3ca7Steve Naroff  void EmitBlockVarDecl(const VarDecl &D);
205248a753f6b670692523c99afaeb8fe98f7ae3ca7Steve Naroff  void EmitLocalBlockVarDecl(const VarDecl &D);
206248a753f6b670692523c99afaeb8fe98f7ae3ca7Steve Naroff  void EmitStaticBlockVarDecl(const VarDecl &D);
207b7ec246872b412f0e7bb9e93eacfd78cfa6adfb3Daniel Dunbar
208b7ec246872b412f0e7bb9e93eacfd78cfa6adfb3Daniel Dunbar  /// EmitParmDecl - Emit a ParmVarDecl or an ImplicitParamDecl.
209b7ec246872b412f0e7bb9e93eacfd78cfa6adfb3Daniel Dunbar  void EmitParmDecl(const VarDecl &D, llvm::Value *Arg);
2105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //                             Statement Emission
2135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2155f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitStmt(const Stmt *S);
2169b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  RValue EmitCompoundStmt(const CompoundStmt &S, bool GetLast = false,
2179b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner                          llvm::Value *AggLoc = 0, bool isAggVol = false);
21891d723da7b68be5245c3ac58aa2a36d04658cfb8Chris Lattner  void EmitLabel(const LabelStmt &S); // helper for EmitLabelStmt.
2195f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitLabelStmt(const LabelStmt &S);
2205f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitGotoStmt(const GotoStmt &S);
2210ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  void EmitIndirectGotoStmt(const IndirectGotoStmt &S);
2225f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitIfStmt(const IfStmt &S);
2235f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitWhileStmt(const WhileStmt &S);
2245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitDoStmt(const DoStmt &S);
2255f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitForStmt(const ForStmt &S);
2265f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitReturnStmt(const ReturnStmt &S);
2275f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitDeclStmt(const DeclStmt &S);
228da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  void EmitBreakStmt();
229da13870e99fe33934b2122f06528a5063f78ae4cChris Lattner  void EmitContinueStmt();
23051b09f2c528c8460b5465c676173324e44176d62Devang Patel  void EmitSwitchStmt(const SwitchStmt &S);
23151b09f2c528c8460b5465c676173324e44176d62Devang Patel  void EmitDefaultStmt(const DefaultStmt &S);
23251b09f2c528c8460b5465c676173324e44176d62Devang Patel  void EmitCaseStmt(const CaseStmt &S);
233c049e4f406a7f7179eba98659044a32508e53289Devang Patel  void EmitCaseStmtRange(const CaseStmt &S);
234fb1aeb804c08d5288a923fb278161783e6abdc66Anders Carlsson  void EmitAsmStmt(const AsmStmt &S);
235fb1aeb804c08d5288a923fb278161783e6abdc66Anders Carlsson
2363d8400d9a61aa4b63ff35e5cede405b32a41425eAnders Carlsson  void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S);
2373d8400d9a61aa4b63ff35e5cede405b32a41425eAnders Carlsson
2385f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2395f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //                         LValue Expression Emission
2405f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
2415f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2426ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar  /// EmitUnsupportedLValue - Emit a dummy l-value using the type of E
2436ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar  /// and issue an ErrorUnsupported style diagnostic (using the
2446ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar  /// provided Name).
2456ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar  LValue EmitUnsupportedLValue(const Expr *E,
2466ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar                               const char *Name);
2476ba82a4a4b295e54cf192c3e98b28f39990c6194Daniel Dunbar
2485f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// EmitLValue - Emit code to compute a designator that specifies the location
2495f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// of the expression.
2505f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  ///
2515f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// This can return one of two things: a simple address or a bitfield
2525f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// reference.  In either case, the LLVM Value* in the LValue structure is
2535f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// guaranteed to be an LLVM pointer type.
2545f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  ///
2555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// If this returns a bitfield reference, nothing about the pointee type of
2565f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// the LLVM value is known: For example, it may not be a pointer to an
2575f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// integer.
2585f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  ///
2595f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// If this returns a normal address, and if the lvalue's C type is fixed
2605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// size, this method guarantees that the returned pointer type will point to
2615f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// an LLVM type of the same size of the lvalue's type.  If the lvalue has a
2625f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// variable length type, this is not possible.
2635f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  ///
2645f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  LValue EmitLValue(const Expr *E);
2655f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2665f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// EmitLoadOfLValue - Given an expression that represents a value lvalue,
2675f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// this method emits the address of the lvalue, then loads the result as an
2685f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// rvalue, returning the rvalue.
2695f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  RValue EmitLoadOfLValue(LValue V, QualType LVType);
270213541a68a3e137d11d2cefb612c6cdb410d7e8eNate Begeman  RValue EmitLoadOfExtVectorElementLValue(LValue V, QualType LVType);
2713b8c22d93da1432b2d4cea779d14912645c93866Lauro Ramos Venancio  RValue EmitLoadOfBitfieldLValue(LValue LV, QualType ExprType);
27285c59edda02df48fae8dc85049743319bc6e7e89Daniel Dunbar  RValue EmitLoadOfPropertyRefLValue(LValue LV, QualType ExprType);
2735f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
27434cdc86af5b0a54084a512a1b2643365b8f5bdd2Chris Lattner
2755f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// EmitStoreThroughLValue - Store the specified rvalue into the specified
2765f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// lvalue, where both are guaranteed to the have the same type, and that type
2775f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// is 'Ty'.
2785f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
279213541a68a3e137d11d2cefb612c6cdb410d7e8eNate Begeman  void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst,
280213541a68a3e137d11d2cefb612c6cdb410d7e8eNate Begeman                                                QualType Ty);
281a0c5d0eacede0f67ce46707263ddf4d8de0df706Lauro Ramos Venancio  void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, QualType Ty);
28285c59edda02df48fae8dc85049743319bc6e7e89Daniel Dunbar  void EmitStoreThroughPropertyRefLValue(RValue Src, LValue Dst, QualType Ty);
28322c940ee588a420cd2e6c8f68be2ac3cc80061ffChristopher Lamb
28422c940ee588a420cd2e6c8f68be2ac3cc80061ffChristopher Lamb  // Note: only availabe for agg return types
28522c940ee588a420cd2e6c8f68be2ac3cc80061ffChristopher Lamb  LValue EmitCallExprLValue(const CallExpr *E);
2865f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
2875f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  LValue EmitDeclRefLValue(const DeclRefExpr *E);
2885f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  LValue EmitStringLiteralLValue(const StringLiteral *E);
289d9f6910f4ef37c0e8eeee2a01287d9572c3176efChris Lattner  LValue EmitPredefinedLValue(const PredefinedExpr *E);
2905f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  LValue EmitUnaryOpLValue(const UnaryOperator *E);
2915f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
292213541a68a3e137d11d2cefb612c6cdb410d7e8eNate Begeman  LValue EmitExtVectorElementExpr(const ExtVectorElementExpr *E);
293b84a06e68ffd71da22e3c75b6e4bbdba37816413Devang Patel  LValue EmitMemberExpr(const MemberExpr *E);
29406e863f2902b8ba55b056308875c19f7ba3dab25Eli Friedman  LValue EmitCompoundLiteralLValue(const CompoundLiteralExpr *E);
295472778eb4fce241721c563280886e98389bc7219Eli Friedman
296472778eb4fce241721c563280886e98389bc7219Eli Friedman  LValue EmitLValueForField(llvm::Value* Base, FieldDecl* Field,
2971e692ace08959399794363e77499b73da5494af9Eli Friedman                            bool isUnion, unsigned CVRQualifiers);
298391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner
2990a04d77bde7e3a661c2b41b60630d125d09ed6efDaniel Dunbar  LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E);
300391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner  LValue EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E);
30185c59edda02df48fae8dc85049743319bc6e7e89Daniel Dunbar  LValue EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E);
3020a04d77bde7e3a661c2b41b60630d125d09ed6efDaniel Dunbar
3035f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
304883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  //                         Scalar Expression Emission
3055f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  //===--------------------------------------------------------------------===//
3065f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
3077f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// CallArgList - Type for representing both the value and type of
3087f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// arguments in a call.
30919cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar  typedef llvm::SmallVector<std::pair<llvm::Value*, QualType>, 16> CallArgList;
3107f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar
3117f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// EmitCallArg - Emit the given expression and append the result
3127f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// onto the given Args list.
31319cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar  void EmitCallArg(const Expr *E, CallArgList &Args);
3147f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar
3157f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// EmitCallArg - Append the appropriate call argument for the given
3167f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// rvalue and type onto the Args list.
3177f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  void EmitCallArg(RValue RV, QualType Ty, CallArgList &Args);
3187f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar
3197f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// EmitCall - Generate a call of the given function, expecting the
3207f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// given result type, and using the given argument list which
3217f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// specifies both the LLVM arguments and the types they were
3227f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// derived from.
32319cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar  RValue EmitCall(llvm::Value *Callee,
32419cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar                  QualType ResultType,
32519cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar                  const CallArgList &Args);
32619cd87eb5fb3c197e631ce08fd52c446c4d4e8f1Daniel Dunbar
3275f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  RValue EmitCallExpr(const CallExpr *E);
3285549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek
3295549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek  RValue EmitCallExpr(Expr *FnExpr, CallExpr::const_arg_iterator ArgBeg,
3305549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek                      CallExpr::const_arg_iterator ArgEnd);
3315549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek
3325193b8a3e57c4f696161aeddfe8227c294c0a7feEli Friedman  RValue EmitCallExpr(llvm::Value *Callee, QualType FnType,
3335549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek                      CallExpr::const_arg_iterator ArgBeg,
3345549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek                      CallExpr::const_arg_iterator ArgEnd);
3355549976193e34417d4474a5f4a514268ef6666c7Ted Kremenek
3361e4d21ea5849637c49fd4222b09c4b5dedff7765Chris Lattner  RValue EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
3375f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
338564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson  llvm::Value *EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E);
339564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson  llvm::Value *EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
340564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson
341cc23acae84c6d5c37b4805edbcd95ee5d821c400Anders Carlsson  llvm::Value *EmitShuffleVector(llvm::Value* V1, llvm::Value *V2, ...);
3424119d1aeca8016654d381ce079864058d1709571Nate Begeman  llvm::Value *EmitVector(llvm::Value * const *Vals, unsigned NumVals,
3434119d1aeca8016654d381ce079864058d1709571Nate Begeman                          bool isSplat = false);
3446086bbd1799e22e75561c3d31dc9b923f0508fa5Anders Carlsson
345ed7c618f849e2541b1d0288c43154937652c5b15Daniel Dunbar  llvm::Value *EmitObjCProtocolExpr(const ObjCProtocolExpr *E);
3467f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattner  llvm::Value *EmitObjCStringLiteral(const ObjCStringLiteral *E);
3478fdf32822be2238aa7db62d40e75b168b637ab7dChris Lattner  llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E);
3488f2926b73ed635afecd020da787af6a837601a2bDaniel Dunbar  RValue EmitObjCMessageExpr(const ObjCMessageExpr *E);
3499c3fc703b29a31d40bcf5027dbb4784dd393804eDaniel Dunbar  RValue EmitObjCPropertyGet(const ObjCPropertyRefExpr *E);
35085c59edda02df48fae8dc85049743319bc6e7e89Daniel Dunbar  void EmitObjCPropertySet(const ObjCPropertyRefExpr *E, RValue Src);
3518fdf32822be2238aa7db62d40e75b168b637ab7dChris Lattner
3528fdf32822be2238aa7db62d40e75b168b637ab7dChris Lattner
353883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  //===--------------------------------------------------------------------===//
354bfc0c1ae4b505b52b36f572a9641f99e76879cabChris Lattner  //                           Expression Emission
355883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  //===--------------------------------------------------------------------===//
356bfc0c1ae4b505b52b36f572a9641f99e76879cabChris Lattner
357bfc0c1ae4b505b52b36f572a9641f99e76879cabChris Lattner  // Expressions are broken into three classes: scalar, complex, aggregate.
358883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner
3597f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattner  /// EmitScalarExpr - Emit the computation of the specified expression of
3607f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattner  /// LLVM scalar type, returning the result.
3617f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattner  llvm::Value *EmitScalarExpr(const Expr *E);
3627f02f721d48772e4eee4fccd8af4f800be1bbc1eChris Lattner
3633707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner  /// EmitScalarConversion - Emit a conversion from the specified type to the
3643707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner  /// specified destination type, both of which are LLVM scalar types.
3653707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner  llvm::Value *EmitScalarConversion(llvm::Value *Src, QualType SrcTy,
3663707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner                                    QualType DstTy);
3673707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner
3684f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner  /// EmitComplexToScalarConversion - Emit a conversion from the specified
3694f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner  /// complex type to the specified destination type, where the destination
3704f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner  /// type is an LLVM scalar type.
3714f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner  llvm::Value *EmitComplexToScalarConversion(ComplexPairTy Src, QualType SrcTy,
3724f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner                                             QualType DstTy);
3734f1a7b380809b4ca19ad2daff61bc11cd1e979d8Chris Lattner
3743707b255f8993fb362904c9cff87b0e9bc6ca317Chris Lattner
375883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  /// EmitAggExpr - Emit the computation of the specified expression of
376883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  /// aggregate type.  The result is computed into DestPtr.  Note that if
377883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  /// DestPtr is null, the value of the aggregate expression is not needed.
378883f6a7cc7dccb1d675e27121a82614d63492a8dChris Lattner  void EmitAggExpr(const Expr *E, llvm::Value *DestPtr, bool VolatileDest);
379b6ef18a2b06d6760459e1756a61f79ff496cee19Chris Lattner
380b6ef18a2b06d6760459e1756a61f79ff496cee19Chris Lattner  /// EmitComplexExpr - Emit the computation of the specified expression of
38123b1cdb0b5e089468bb8475b8ec9287af67b4b59Chris Lattner  /// complex type, returning the result.
38258dee10ed2eee34035f62d1c2d32b3639e9182f8Chris Lattner  ComplexPairTy EmitComplexExpr(const Expr *E);
38323b1cdb0b5e089468bb8475b8ec9287af67b4b59Chris Lattner
38423b1cdb0b5e089468bb8475b8ec9287af67b4b59Chris Lattner  /// EmitComplexExprIntoAddr - Emit the computation of the specified expression
38523b1cdb0b5e089468bb8475b8ec9287af67b4b59Chris Lattner  /// of complex type, storing into the specified Value*.
386190dbe203c2e892ac40f1786035c6c9be3f44a4cChris Lattner  void EmitComplexExprIntoAddr(const Expr *E, llvm::Value *DestAddr,
387190dbe203c2e892ac40f1786035c6c9be3f44a4cChris Lattner                               bool DestIsVolatile);
3887f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar
3897f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  /// StoreComplexToAddr - Store a complex number into the specified address.
3907f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar  void StoreComplexToAddr(ComplexPairTy V, llvm::Value *DestAddr,
3917f8ea5c5b3a6a4332a841eefdd86b0726722ea7bDaniel Dunbar                          bool DestIsVolatile);
3929b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  /// LoadComplexFromAddr - Load a complex number from the specified address.
3939b65551d0b387a7597fb39356a4d8ef10046445eChris Lattner  ComplexPairTy LoadComplexFromAddr(llvm::Value *SrcAddr, bool SrcIsVolatile);
3942621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner
3952621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner  /// GenerateStaticBlockVarDecl - return the the static
3962621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner  /// declaration of local variable.
3972621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner  llvm::GlobalValue *GenerateStaticBlockVarDecl(const VarDecl &D,
3982621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner                                                bool NoInit,
3992621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner                                                const char *Separator);
4000ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
401e1b29efab32d02e114046d33cca242a88585bf8aAnders Carlsson  // GenerateStaticBlockVarDecl - return the static declaration of
402e1b29efab32d02e114046d33cca242a88585bf8aAnders Carlsson  // a local variable. Performs initialization of the variable if necessary.
403e1b29efab32d02e114046d33cca242a88585bf8aAnders Carlsson  llvm::GlobalValue *GenerateStaticCXXBlockVarDecl(const VarDecl &D);
404e1b29efab32d02e114046d33cca242a88585bf8aAnders Carlsson
4050ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  //===--------------------------------------------------------------------===//
4060ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  //                             Internal Helpers
4070ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  //===--------------------------------------------------------------------===//
4080ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar
4090ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbarprivate:
4100ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// EmitIndirectSwitches - Emit code for all of the switch
4110ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  /// instructions in IndirectSwitches.
4120ffb125996336fc7602b162c0a9e392f1a93060fDaniel Dunbar  void EmitIndirectSwitches();
4135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer};
4145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}  // end namespace CodeGen
4155f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}  // end namespace clang
4165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
4175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif
418