diff options
author | Chris Lattner <sabre@nondot.org> | 2007-06-02 22:49:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-06-02 22:49:07 +0000 |
commit | 6db1fb845a5c3fc3cb9fcc3045f81e311bd6ca84 (patch) | |
tree | 009dc9c6a27bd12ba3849819807b1cca43104bd7 /clang/CodeGen/CodeGenFunction.cpp | |
parent | 226d419e21c87de4603c6919a2eee8e6db7590fb (diff) | |
download | bcm5719-llvm-6db1fb845a5c3fc3cb9fcc3045f81e311bd6ca84.tar.gz bcm5719-llvm-6db1fb845a5c3fc3cb9fcc3045f81e311bd6ca84.zip |
implement a first hack at codegen'ing the usual unary conversions.
This allows us to compile:
int func() {
int A[10];
if (!A) {
to:
define i32 @func() {
entry:
%A = alloca [10 x i32] ; <[10 x i32]*> [#uses=1]
%arraydecay = getelementptr [10 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%tobool = icmp ne i32* %arraydecay, null ; <i1> [#uses=1]
%lnot = xor i1 %tobool, true ; <i1> [#uses=1]
br i1 %lnot, label %ifthen, label %ifend
-Chris
llvm-svn: 39564
Diffstat (limited to 'clang/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/CodeGen/CodeGenFunction.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp index ef80e51d0e3..9da66c635bd 100644 --- a/clang/CodeGen/CodeGenFunction.cpp +++ b/clang/CodeGen/CodeGenFunction.cpp @@ -26,6 +26,10 @@ using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) : CGM(cgm), Target(CGM.getContext().Target) {} +ASTContext &CodeGenFunction::getContext() const { + return CGM.getContext(); +} + llvm::BasicBlock *CodeGenFunction::getBasicBlockForLabel(const LabelStmt *S) { BasicBlock *&BB = LabelMap[S]; @@ -131,6 +135,8 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) { void CodeGenFunction::GenerateCode(const FunctionDecl *FD) { + LLVMIntTy = ConvertType(getContext().IntTy, FD->getLocation()); + const llvm::FunctionType *Ty = cast<llvm::FunctionType>(ConvertType(FD->getType(), FD->getLocation())); |