CodeGenModule.h revision af2f62ce32e462f256855cd24b06dec4755d2827
1bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar//===--- CodeGenModule.h - Per-Module 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-translation-unit state used for llvm translation. 115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===// 135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 14ef52a2fb2ace36c92f88c6e125bd7defa17dafa5Chris Lattner#ifndef CLANG_CODEGEN_CODEGENMODULE_H 15ef52a2fb2ace36c92f88c6e125bd7defa17dafa5Chris Lattner#define CLANG_CODEGEN_CODEGENMODULE_H 165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "CodeGenTypes.h" 184f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman#include "clang/AST/Attr.h" 195f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include "llvm/ADT/DenseMap.h" 20c9e2091efcb535110474434dd12015afdc3b1637Anders Carlsson#include "llvm/ADT/StringMap.h" 215f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 225f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace llvm { 235f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class Module; 245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class Constant; 255f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class Function; 268bd4afeb876fd0015bb808eb2f3de1fe709658a7Nate Begeman class GlobalValue; 277a4718e813e5e99d478567a482217c7eef8572c5Devang Patel class TargetData; 28ff4a2d9e2c1ddbf87e00e2a36ae341faf03eafb3Eli Friedman class FunctionType; 295f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer} 305f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 315f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang { 325f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class ASTContext; 335f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class FunctionDecl; 34391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner class ObjCMethodDecl; 3520ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov class ObjCImplementationDecl; 3620ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov class ObjCCategoryImplDecl; 3720ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov class ObjCProtocolDecl; 385f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer class Decl; 392824723d6d181d2dfa56e62caabd68b0b18f0b9dOliver Hunt class Expr; 402c8569d5f43f7de1fb993e84c95ea571dd9ac55eChris Lattner class Stmt; 411e04976fc2611d8cc06986a81deed4c42183b870Daniel Dunbar class StringLiteral; 421a1d92ac5e1354634af08c62a1d72e263d13be0cNate Begeman class NamedDecl; 43bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar class ValueDecl; 442b9d2ca4ce53fffbe8a77c7db2fe4df5ccfb9fd4Chris Lattner class VarDecl; 4545e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner struct LangOptions; 46fb97b03e42d397405f617be0252be83e77a66f6eChris Lattner class Diagnostic; 478bd4afeb876fd0015bb808eb2f3de1fe709658a7Nate Begeman class AnnotateAttr; 485f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 495f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace CodeGen { 505f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 51813733577d33ec56479667b49e1bff42dc6bba90Lauro Ramos Venancio class CodeGenFunction; 52e8b9f5b8ea60983c4a74cb8b63879616b914b65aSanjiv Gupta class CGDebugInfo; 53af2f62ce32e462f256855cd24b06dec4755d2827Daniel Dunbar class CGObjCRuntime; 54e8b9f5b8ea60983c4a74cb8b63879616b914b65aSanjiv Gupta 555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// CodeGenModule - This class organizes the cross-module state that is used 565f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// while generating LLVM code. 575f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass CodeGenModule { 586bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar typedef std::vector< std::pair<llvm::Constant*, int> > CtorList; 596bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar 605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer ASTContext &Context; 6145e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner const LangOptions &Features; 625f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer llvm::Module &TheModule; 637a4718e813e5e99d478567a482217c7eef8572c5Devang Patel const llvm::TargetData &TheTargetData; 64fb97b03e42d397405f617be0252be83e77a66f6eChris Lattner Diagnostic &Diags; 655f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer CodeGenTypes Types; 66815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek CGObjCRuntime* Runtime; 67815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek CGDebugInfo* DebugInfo; 685f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 695f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer llvm::Function *MemCpyFn; 700c99509927a0c7a48490486b9fec287b63e5c09cEli Friedman llvm::Function *MemMoveFn; 7141ef30e869d3f4940437503eb6a2cf70819fdb08Lauro Ramos Venancio llvm::Function *MemSetFn; 729986eabd4423d867262c358ca62f94a60ac58412Daniel Dunbar 733c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar /// GlobalDeclMap - Mapping of decl names global variables we have 749986eabd4423d867262c358ca62f94a60ac58412Daniel Dunbar /// already emitted. Note that the entries in this map are the 753c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar /// actual globals and therefore may not be of the same type as the 763c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar /// decl, they should be bitcasted on retrieval. Also note that the 773c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar /// globals are keyed on their source name, not the global name 783c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar /// (which may change with attributes such as asm-labels). 793c827a79cb7d04c255db8080e682ee2c6912373dDaniel Dunbar llvm::StringMap<llvm::GlobalValue*> GlobalDeclMap; 80bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 81bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// List of static global for which code generation is delayed. When 82bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// the translation unit has been fully processed we will lazily 83bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// emit definitions for only the decls that were actually used. 84bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// This should contain only Function and Var decls, and only those 85bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// which actually define something. 86bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar std::vector<const ValueDecl*> StaticDecls; 874c13b7a3973d2d263d9682d7b68fbfeb76334af5Nate Begeman 886bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// GlobalCtors - Store the list of global constructors and their 896bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// respective priorities to be emitted when the translation unit is 906bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// complete. 916bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar CtorList GlobalCtors; 926bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar 936bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// GlobalDtors - Store the list of global destructors and their 946bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// respective priorities to be emitted when the translation unit is 956bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// complete. 966bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar CtorList GlobalDtors; 976bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar 98532485cc6c078d9e51b517c6bbd8984deb17f0feNate Begeman std::vector<llvm::Constant*> Annotations; 9945e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner 100c9e2091efcb535110474434dd12015afdc3b1637Anders Carlsson llvm::StringMap<llvm::Constant*> CFConstantStringMap; 10145e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner llvm::StringMap<llvm::Constant*> ConstantStringMap; 102c9e2091efcb535110474434dd12015afdc3b1637Anders Carlsson llvm::Constant *CFConstantStringClassRef; 103bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner 104bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner std::vector<llvm::Function *> BuiltinFunctions; 1055f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerpublic: 10645e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner CodeGenModule(ASTContext &C, const LangOptions &Features, llvm::Module &M, 107e8b9f5b8ea60983c4a74cb8b63879616b914b65aSanjiv Gupta const llvm::TargetData &TD, Diagnostic &Diags, 108f77ac86f4eca528a04b817d7ad7f045a47d52712Daniel Dunbar bool GenerateDebugInfo); 109815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek 1102b94fe35edf951a14ecd32b21f7ebcc2e3754c67Chris Lattner ~CodeGenModule(); 1115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 112815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek /// Release - Finalize LLVM code generation. 113815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek void Release(); 114208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar 115208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar /// getObjCRuntime() - Return a reference to the configured 116208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar /// Objective-C runtime. 117208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar CGObjCRuntime &getObjCRuntime() { 118208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar assert(Runtime && "No Objective-C runtime has been configured."); 119208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar return *Runtime; 120208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar } 121815c78fd9ab8bd5dfe8e8a91b8c6a413e2b8c889Ted Kremenek 122208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar /// hasObjCRuntime() - Return true iff an Objective-C runtime has 123208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar /// been configured. 124208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar bool hasObjCRuntime() { return !!Runtime; } 125208ff5e8a073de2a5d15cbe03cab8a4c0d935e28Daniel Dunbar 126e8b9f5b8ea60983c4a74cb8b63879616b914b65aSanjiv Gupta CGDebugInfo *getDebugInfo() { return DebugInfo; } 1275f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer ASTContext &getContext() const { return Context; } 12845e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner const LangOptions &getLangOptions() const { return Features; } 1295f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer llvm::Module &getModule() const { return TheModule; } 1305f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer CodeGenTypes &getTypes() { return Types; } 131fb97b03e42d397405f617be0252be83e77a66f6eChris Lattner Diagnostic &getDiags() const { return Diags; } 1328f925280abe3795ae0fb47f2ba90faea62e26af4Chris Lattner const llvm::TargetData &getTargetData() const { return TheTargetData; } 133bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 134bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// GetAddrOfGlobalVar - Return the llvm::Constant for the address 135bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// of the given global variable. 136bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D); 137bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 138bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// GetAddrOfFunction - Return the llvm::Constant for the address 139bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// of the given function. 140bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar llvm::Constant *GetAddrOfFunction(const FunctionDecl *D); 14158c3f9ec11cbe852a518bf2f83af46f938b7b852Chris Lattner 142bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner /// getBuiltinLibFunction - Given a builtin id for a function like 143bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner /// "__builtin_fabsf", return a Function* for "fabsf". 144bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner /// 145bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner llvm::Function *getBuiltinLibFunction(unsigned BuiltinID); 146c9e2091efcb535110474434dd12015afdc3b1637Anders Carlsson llvm::Constant *GetAddrOfConstantCFString(const std::string& str); 147a7ad98ff0919d6a24ea7c46634ea29bea551c1a0Chris Lattner 1481e04976fc2611d8cc06986a81deed4c42183b870Daniel Dunbar /// getStringForStringLiteral - Return the appropriate bytes for a 1491e04976fc2611d8cc06986a81deed4c42183b870Daniel Dunbar /// string literal, properly padded to match the literal type. 1501e04976fc2611d8cc06986a81deed4c42183b870Daniel Dunbar std::string getStringForStringLiteral(const StringLiteral *E); 1511e04976fc2611d8cc06986a81deed4c42183b870Daniel Dunbar 152a7ad98ff0919d6a24ea7c46634ea29bea551c1a0Chris Lattner /// GetAddrOfConstantString -- returns a pointer to the character 153a7ad98ff0919d6a24ea7c46634ea29bea551c1a0Chris Lattner /// array containing the literal. The result is pointer to array type. 15445e8cbdce25c2e16c7aac2036a591f6190097ae6Chris Lattner llvm::Constant *GetAddrOfConstantString(const std::string& str); 1555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer llvm::Function *getMemCpyFn(); 1560c99509927a0c7a48490486b9fec287b63e5c09cEli Friedman llvm::Function *getMemMoveFn(); 15741ef30e869d3f4940437503eb6a2cf70819fdb08Lauro Ramos Venancio llvm::Function *getMemSetFn(); 1587acda7c4a0e4aec6c003b3169ca45a5f3bc7e033Chris Lattner llvm::Function *getIntrinsic(unsigned IID, const llvm::Type **Tys = 0, 1597acda7c4a0e4aec6c003b3169ca45a5f3bc7e033Chris Lattner unsigned NumTys = 0); 160bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner 161391d77a26382dddf25da73e29fc1fa5aaaea4c6fChris Lattner void EmitObjCMethod(const ObjCMethodDecl *OMD); 16220ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov void EmitObjCCategoryImpl(const ObjCCategoryImplDecl *OCD); 16320ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov void EmitObjCClassImplementation(const ObjCImplementationDecl *OID); 16420ff3108fcd2c3bd734dc79efc22ebaa090abd41Anton Korobeynikov void EmitObjCProtocolImplementation(const ObjCProtocolDecl *PD); 165bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 166bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// EmitGlobal - Emit code for a singal global function or var 167bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar /// decl. Forward declarations are emitted lazily. 168bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitGlobal(const ValueDecl *D); 169bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 170bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void AddAnnotation(llvm::Constant *C) { Annotations.push_back(C); } 171bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 172c5b8806cda286cf41866176ef98011fdaa68da01Chris Lattner void UpdateCompletedType(const TagDecl *D); 173813733577d33ec56479667b49e1bff42dc6bba90Lauro Ramos Venancio llvm::Constant *EmitConstantExpr(const Expr *E, CodeGenFunction *CGF = 0); 1748bd4afeb876fd0015bb808eb2f3de1fe709658a7Nate Begeman llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV, 1758bd4afeb876fd0015bb808eb2f3de1fe709658a7Nate Begeman const AnnotateAttr *AA, unsigned LineNo); 1763b1d57b623702865e4158b00cb1d984ba6dd5d50Anders Carlsson 1772c8569d5f43f7de1fb993e84c95ea571dd9ac55eChris Lattner /// WarnUnsupported - Print out a warning that codegen doesn't support the 1782c8569d5f43f7de1fb993e84c95ea571dd9ac55eChris Lattner /// specified stmt yet. 1793b1d57b623702865e4158b00cb1d984ba6dd5d50Anders Carlsson 1802c8569d5f43f7de1fb993e84c95ea571dd9ac55eChris Lattner void WarnUnsupported(const Stmt *S, const char *Type); 1812c8569d5f43f7de1fb993e84c95ea571dd9ac55eChris Lattner 182c6fdc34ac0183bfa03d65f317c78b7bdac52897eChris Lattner /// WarnUnsupported - Print out a warning that codegen doesn't support the 183c6fdc34ac0183bfa03d65f317c78b7bdac52897eChris Lattner /// specified decl yet. 184c6fdc34ac0183bfa03d65f317c78b7bdac52897eChris Lattner void WarnUnsupported(const Decl *D, const char *Type); 185c6fdc34ac0183bfa03d65f317c78b7bdac52897eChris Lattner 1864f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman /// setVisibility - Set the visibility for the given LLVM GlobalValue 1874f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman /// according to the given clang AST visibility value. 1884f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman static void setVisibility(llvm::GlobalValue *GV, 1894f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman VisibilityAttr::VisibilityTypes); 1904f8d123e3e2c260de3377208106ddba87cee28b4Dan Gohman 1919cd4fe4af6d3e8b6dcfce9c2cdefcaafca7eed7cChris Lattnerprivate: 192ff4a2d9e2c1ddbf87e00e2a36ae341faf03eafb3Eli Friedman void SetFunctionAttributes(const FunctionDecl *FD, 193ff4a2d9e2c1ddbf87e00e2a36ae341faf03eafb3Eli Friedman llvm::Function *F, 194ff4a2d9e2c1ddbf87e00e2a36ae341faf03eafb3Eli Friedman const llvm::FunctionType *FTy); 195d4cbda6292b321c2e7dce7f039d92918fee99b3aNuno Lopes 196d4cbda6292b321c2e7dce7f039d92918fee99b3aNuno Lopes void SetGlobalValueAttributes(const FunctionDecl *FD, 197d4cbda6292b321c2e7dce7f039d92918fee99b3aNuno Lopes llvm::GlobalValue *GV); 1989cd4fe4af6d3e8b6dcfce9c2cdefcaafca7eed7cChris Lattner 199bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitGlobalDefinition(const ValueDecl *D); 200bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar llvm::GlobalValue *EmitForwardFunctionDefinition(const FunctionDecl *D); 201bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitGlobalFunctionDefinition(const FunctionDecl *D); 202bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitGlobalVarDefinition(const VarDecl *D); 2036bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar 2046bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar // FIXME: Hardcoding priority here is gross. 2056bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar void AddGlobalCtor(llvm::Function * Ctor, int Priority=65535); 2066bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar void AddGlobalDtor(llvm::Function * Dtor, int Priority=65535); 2076bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar 2086bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// EmitCtorList - Generates a global array of functions and 2096bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// priorities using the given list and name. This array will have 2106bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// appending linkage and is suitable for use as a LLVM constructor 2116bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar /// or destructor array. 2126bfed7e411adc46eaf616371f85f68305c6e6257Daniel Dunbar void EmitCtorList(const CtorList &Fns, const char *GlobalName); 213bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 214bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitAnnotations(void); 215bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar void EmitStatics(void); 216bd012ff1fa088181646a784f385b28867372d434Daniel Dunbar 2175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}; 2185f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer} // end namespace CodeGen 2195f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer} // end namespace clang 2205f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 2215f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif 222