Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jan 17, 2014
1 parent 43a901f commit a54c3b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
39 changes: 19 additions & 20 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
static GlobalVariable *prepare_global(GlobalVariable *G)
{
#ifdef USE_MCJIT
if(G->getParent() != jl_Module) {
if (G->getParent() != jl_Module) {
GlobalVariable *gv = jl_Module->getGlobalVariable(G->getName());
if(!gv) {
gv =
new GlobalVariable(*jl_Module, G->getType()->getElementType(),
true, GlobalVariable::ExternalLinkage,
NULL, G->getName());
if (!gv) {
gv = new GlobalVariable(*jl_Module, G->getType()->getElementType(),
true, GlobalVariable::ExternalLinkage,
NULL, G->getName());
}
return gv;
}
Expand All @@ -26,14 +25,14 @@ static llvm::Value *prepare_call(llvm::Value* Callee)
return Callee;
if (F->getParent() != jl_Module) {
Function *ModuleF = jl_Module->getFunction(F->getName());
if(ModuleF) {
if (ModuleF) {
return ModuleF;
}
else {
return Function::Create(F->getFunctionType(),
Function::ExternalLinkage,
F->getName(),
jl_Module);
Function::ExternalLinkage,
F->getName(),
jl_Module);
}
}
#endif
Expand Down Expand Up @@ -108,11 +107,11 @@ class FunctionMover : public ValueMaterializer
virtual Value *materializeValueFor (Value *V)
{
Function *F = dyn_cast<Function>(V);
if(F) {
if(F->isIntrinsic()) {
if (F) {
if (F->isIntrinsic()) {
return destModule->getOrInsertFunction(F->getName(),F->getFunctionType());
}
if(F->isDeclaration() || F->getParent() != destModule) {
if (F->isDeclaration() || F->getParent() != destModule) {
Function *shadow = srcModule->getFunction(F->getName());
if (shadow != NULL && !shadow->isDeclaration()) {
// Not truly external
Expand All @@ -130,7 +129,7 @@ class FunctionMover : public ValueMaterializer
}
}
// Still a declaration and still in a different module
if(F->isDeclaration() && F->getParent() != destModule) {
if (F->isDeclaration() && F->getParent() != destModule) {
// Create forward declaration in current module
return destModule->getOrInsertFunction(F->getName(),F->getFunctionType());
}
Expand All @@ -148,7 +147,7 @@ class FunctionMover : public ValueMaterializer
if (GV->isDeclaration())
return newGV;
uint64_t addr = jl_mcjmm->getSymbolAddress(GV->getName());
if(addr != 0) {
if (addr != 0) {
newGV->setExternallyInitialized(true);
return newGV;
}
Expand All @@ -171,14 +170,14 @@ class FunctionMover : public ValueMaterializer
static Function *clone_llvm_function(llvm::Function *toClone,FunctionMover *mover)
{
Function *NewF = Function::Create(toClone->getFunctionType(),
Function::ExternalLinkage,
toClone->getName(),
mover->destModule);
Function::ExternalLinkage,
toClone->getName(),
mover->destModule);
ClonedCodeInfo info;
Function::arg_iterator DestI = NewF->arg_begin();
for (Function::const_arg_iterator I = toClone->arg_begin(), E = toClone->arg_end(); I != E; ++I) {
DestI->setName(I->getName()); // Copy the name over...
mover->VMap[I] = DestI++; // Add mapping to VMap
DestI->setName(I->getName()); // Copy the name over...
mover->VMap[I] = DestI++; // Add mapping to VMap
}

// Necessary in case the function is self referential
Expand Down
10 changes: 5 additions & 5 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3006,17 +3006,17 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
funcName << "julia_" << lam->name->name;

Module *m;
#ifdef USE_MCJIT
if(!imaging_mode) {
#ifdef USE_MCJIT
if (!imaging_mode) {
m = new Module(funcName.str(), jl_LLVMContext);
jl_setup_module(m,true);
}
else {
m = shadow_module;
}
#else
m = jl_Module;
#endif
#else
m = jl_Module;
#endif

funcName << globalUnique++;

Expand Down

0 comments on commit a54c3b8

Please sign in to comment.