aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-15 23:26:23 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-15 23:26:23 +0000
commit41071debe9b8887449c3f2ee0dd7124ed47bdda8 (patch)
tree96b7a6aa93b6e73ed755b26d72da22c9c3215b59 /lib/CodeGen/CodeGenModule.h
parent226e04a9b7790a7311aff2aa9df340c1841e20e3 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r--lib/CodeGen/CodeGenModule.h37
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index dd8ac1739f..5f3714cb28 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/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);