diff options
author | Chris Lattner <sabre@nondot.org> | 2007-06-20 04:44:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-06-20 04:44:43 +0000 |
commit | b6984c485428a1e9564eb63296c1f8009ac8de00 (patch) | |
tree | 9cc06e9c138d1829657d2a5f9f9e8892aaf36d57 /clang/CodeGen/CodeGenModule.h | |
parent | b3fef07a3077da3af60598245c388beb152636f8 (diff) | |
download | bcm5719-llvm-b6984c485428a1e9564eb63296c1f8009ac8de00.tar.gz bcm5719-llvm-b6984c485428a1e9564eb63296c1f8009ac8de00.zip |
Hook up global function and variable handling. We can now compile:
int X, bar(int,int,int);
short Y;
double foo() {
return bar(X, Y, 3);
}
into:
@X = external global i32 ; <i32*> [#uses=1]
@Y = external global i16 ; <i16*> [#uses=1]
define double @foo() {
entry:
%tmp = load i32* @X ; <i32> [#uses=1]
%tmp1 = load i16* @Y ; <i16> [#uses=1]
%promote = sext i16 %tmp1 to i32 ; <i32> [#uses=1]
%call = tail call i32 @bar( i32 %tmp, i32 %promote, i32 3 ) ; <i32> [#uses=1]
%conv = sitofp i32 %call to double ; <double> [#uses=1]
ret double %conv
}
declare i32 @bar(i32, i32, i32)
llvm-svn: 39663
Diffstat (limited to 'clang/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/CodeGen/CodeGenModule.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/CodeGen/CodeGenModule.h b/clang/CodeGen/CodeGenModule.h index d72b84549c8..8e40483bd57 100644 --- a/clang/CodeGen/CodeGenModule.h +++ b/clang/CodeGen/CodeGenModule.h @@ -15,6 +15,7 @@ #define CODEGEN_CODEGENMODULE_H #include "CodeGenTypes.h" +#include "llvm/ADT/DenseMap.h" namespace llvm { class Module; @@ -35,7 +36,7 @@ class CodeGenModule { llvm::Module &TheModule; CodeGenTypes Types; - //llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap; + llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap; public: CodeGenModule(ASTContext &C, llvm::Module &M); @@ -43,6 +44,8 @@ public: llvm::Module &getModule() const { return TheModule; } CodeGenTypes &getTypes() { return Types; } + llvm::Constant *GetAddrOfGlobalDecl(const Decl *D); + void EmitFunction(FunctionDecl *FD); void PrintStats() {} |