Skip to content

Commit

Permalink
Going through code, removing unneeded stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
charlieMonroe committed Sep 13, 2013
1 parent fea2faa commit f778475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
2 changes: 0 additions & 2 deletions LanguageKit/CodeGenLexicalScope.h
Expand Up @@ -30,7 +30,6 @@ class CodeGenSubroutine
friend class CGObjCRuntime;
protected:
CodeGenModule *CGM;
Value *Context;
DIDescriptor ScopeDescriptor;

typedef unordered_map<id,
Expand All @@ -43,7 +42,6 @@ class CodeGenSubroutine
Value* RetVal;
BasicBlock* CleanupBB;
BasicBlock* CleanupEndBB;
BasicBlock* ExceptionBB;
BasicBlock* RetBB;
Function* CurrentFunction;
CGBuilder Builder;
Expand Down
24 changes: 5 additions & 19 deletions LanguageKit/CodeGenLexicalScope.mm
Expand Up @@ -549,21 +549,7 @@ static bool isObject(NSString *encoding)
releaseVariable(cleanupBuilder.CreateLoad(var));
}

LLVMType *Int1Ty = Type::getInt1Ty(CGM->Context);
// Flag indicating if we are in an exception handler. Used for branching
// later - should be removed by mem2reg and subsequent passes.
Value *inException = Builder.CreateAlloca(Int1Ty, 0, "inException");
Value *is_catch =
Builder.CreateAlloca(Int1Ty, 0, "is_catch");
Value *exceptionPtr =
Builder.CreateAlloca(types.ptrToVoidTy, 0, "exception_pointer");
Context = Builder.CreateAlloca(types.ptrToVoidTy, 0, "context");

Builder.CreateStore(ConstantInt::get(Type::getInt1Ty(CGM->Context), 0), inException);
Builder.CreateStore(ConstantPointerNull::get(types.ptrToVoidTy), exceptionPtr);



// Create a basic block for returns, reached only from the cleanup block
RetVal = 0;
if (retTy != Type::getVoidTy(CGM->Context))
Expand All @@ -579,11 +565,12 @@ static bool isObject(NSString *encoding)
Builder.CreateStore(Constant::getNullValue(retTy), RetVal);
}


/// Handle returns

// Create the real return handler
BasicBlock *realRetBB = llvm::BasicBlock::Create(CGM->Context, "return", CurrentFunction);
CGBuilder ReturnBuilder(realRetBB);
RetBB = llvm::BasicBlock::Create(CGM->Context, "return", CurrentFunction);
CGBuilder ReturnBuilder(RetBB);

// If this is returning an object, autorelease it.
if (retTy != Type::getVoidTy(CGM->Context) && isObject(ReturnType) && !returnsRetained)
Expand Down Expand Up @@ -616,7 +603,6 @@ static bool isObject(NSString *encoding)
{
ReturnBuilder.CreateRetVoid();
}
ReturnBuilder.CreateBr(realRetBB);

/*
ExceptionBB =
Expand Down Expand Up @@ -733,8 +719,8 @@ static bool isObject(NSString *encoding)

void CodeGenSubroutine::EndScope(void)
{
// CGBuilder CleanupBuilder(CleanupEndBB);
// CleanupBuilder.CreateBr(RetBB);
CGBuilder CleanupBuilder(CleanupEndBB);
CleanupBuilder.CreateBr(RetBB);
}
void CodeGenSubroutine::storeValueInVariable(llvm::Value *value, NSString *aVariable)
{
Expand Down

0 comments on commit f778475

Please sign in to comment.