diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-15 23:26:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-15 23:26:23 +0000 |
commit | fce4be843ef8f16e778235604593d36b0e4980ea (patch) | |
tree | b9b1110be82c4070ad2c265a27786b3de4c13ffa /clang/lib/CodeGen/CodeGenModule.h | |
parent | db0b7f942a74306065d4a1e52b25fcc35bf3879a (diff) | |
download | bcm5719-llvm-fce4be843ef8f16e778235604593d36b0e4980ea.tar.gz bcm5719-llvm-fce4be843ef8f16e778235604593d36b0e4980ea.zip |
Clean up CodeGenModule interface.
- Add CodeGenModule::EmitTopLevelDecl which uses switch on kind
instead of ugly & slow dyn_cast chains.
- Drop some simple forwarding methods into the ObjC runtime.
- Privatize appropriate methods.
llvm-svn: 54827
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index dd8ac1739f9..5f3714cb283 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -52,8 +52,8 @@ namespace CodeGen { class CGDebugInfo; class CGObjCRuntime; -/// CodeGenModule - This class organizes the cross-module state that is used -/// while generating LLVM code. +/// CodeGenModule - This class organizes the cross-function state that +/// is used while generating LLVM code. class CodeGenModule { typedef std::vector< std::pair<llvm::Constant*, int> > CtorList; @@ -138,11 +138,6 @@ public: /// GetAddrOfFunction - Return the llvm::Constant for the address /// of the given function. llvm::Constant *GetAddrOfFunction(const FunctionDecl *D); - - /// getBuiltinLibFunction - Given a builtin id for a function like - /// "__builtin_fabsf", return a Function* for "fabsf". - /// - llvm::Function *getBuiltinLibFunction(unsigned BuiltinID); /// GetStringForStringLiteral - Return the appropriate bytes for a /// string literal, properly padded to match the literal type. If @@ -150,6 +145,8 @@ public: /// GetAddrOfConstantStringLiteral. std::string GetStringForStringLiteral(const StringLiteral *E); + /// GetAddrOfConstantCFString - Return a pointer to a + /// constant CFString object for the given string. llvm::Constant *GetAddrOfConstantCFString(const std::string& str); /// GetAddrOfConstantStringFromLiteral - Return a pointer to a @@ -170,21 +167,19 @@ public: /// array containing the literal and a terminating '\-' /// character. The result has pointer to array type. llvm::Constant *GetAddrOfConstantCString(const std::string &str); + + /// getBuiltinLibFunction - Given a builtin id for a function like + /// "__builtin_fabsf", return a Function* for "fabsf". + llvm::Function *getBuiltinLibFunction(unsigned BuiltinID); llvm::Function *getMemCpyFn(); llvm::Function *getMemMoveFn(); llvm::Function *getMemSetFn(); llvm::Function *getIntrinsic(unsigned IID, const llvm::Type **Tys = 0, unsigned NumTys = 0); - - void EmitObjCMethod(const ObjCMethodDecl *OMD); - void EmitObjCCategoryImpl(const ObjCCategoryImplDecl *OCD); - void EmitObjCClassImplementation(const ObjCImplementationDecl *OID); - void EmitObjCProtocolImplementation(const ObjCProtocolDecl *PD); - /// EmitGlobal - Emit code for a singal global function or var - /// decl. Forward declarations are emitted lazily. - void EmitGlobal(const ValueDecl *D); + /// EmitTopLevelDecl - Emit code for a single top level declaration. + void EmitTopLevelDecl(Decl *D); void AddAnnotation(llvm::Constant *C) { Annotations.push_back(C); } @@ -194,18 +189,12 @@ public: const AnnotateAttr *AA, unsigned LineNo); /// WarnUnsupported - Print out a warning that codegen doesn't support the - /// specified stmt yet. - + /// specified stmt yet. void WarnUnsupported(const Stmt *S, const char *Type); /// WarnUnsupported - Print out a warning that codegen doesn't support the /// specified decl yet. void WarnUnsupported(const Decl *D, const char *Type); - - /// setVisibility - Set the visibility for the given LLVM GlobalValue - /// according to the given clang AST visibility value. - static void setVisibility(llvm::GlobalValue *GV, - VisibilityAttr::VisibilityTypes); private: void SetFunctionAttributes(const FunctionDecl *FD, @@ -215,6 +204,10 @@ private: void SetGlobalValueAttributes(const FunctionDecl *FD, llvm::GlobalValue *GV); + /// EmitGlobal - Emit code for a singal global function or var + /// decl. Forward declarations are emitted lazily. + void EmitGlobal(const ValueDecl *D); + void EmitGlobalDefinition(const ValueDecl *D); llvm::GlobalValue *EmitForwardFunctionDefinition(const FunctionDecl *D); void EmitGlobalFunctionDefinition(const FunctionDecl *D); |