Skip to content

Commit

Permalink
Also move nakedUse from VarDeclaration to IrGlobal
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyProkhin committed Oct 5, 2014
1 parent bb496e8 commit 6864988
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion dmd2/declaration.c
Expand Up @@ -946,7 +946,6 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
edtor = NULL;
range = NULL;
#if IN_LLVM
nakedUse = false;
#endif
}

Expand Down
2 changes: 0 additions & 2 deletions dmd2/declaration.h
Expand Up @@ -341,8 +341,6 @@ class VarDeclaration : public Declaration
void accept(Visitor *v) { v->visit(this); }

#if IN_LLVM
/// This var is used by a naked function.
bool nakedUse;
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion gen/asm-x86.h
Expand Up @@ -2227,7 +2227,7 @@ namespace AsmParserx8664

// print out the mangle
insnTemplate << mangle(vd);
vd->nakedUse = true;
getIrGlobal(vd, true)->nakedUse = true;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion gen/declarations.cpp
Expand Up @@ -286,7 +286,7 @@ class CodegenVisitor : public Visitor {
// If this global is used from a naked function, we need to create an
// artificial "use" for it, or it could be removed by the optimizer if
// the only reference to it is in inline asm.
if (decl->nakedUse)
if (irGlobal->nakedUse)
irs->usedArray.push_back(DtoBitCast(gvar, getVoidPtrType()));

IF_LOG Logger::cout() << *gvar << '\n';
Expand Down
7 changes: 5 additions & 2 deletions ir/irvar.h
Expand Up @@ -51,12 +51,15 @@ struct IrVar
struct IrGlobal : IrVar
{
IrGlobal(VarDeclaration* v)
: IrVar(v), type(0), constInit(0) { }
: IrVar(v), type(0), constInit(0), nakedUse(false) { }
IrGlobal(VarDeclaration* v, llvm::Type *type, llvm::Constant* constInit = 0)
: IrVar(v), type(type), constInit(constInit) { }
: IrVar(v), type(type), constInit(constInit), nakedUse(false) { }

llvm::Type *type;
llvm::Constant* constInit;

// This var is used by a naked function.
bool nakedUse;
};

// represents a local variable variable
Expand Down

0 comments on commit 6864988

Please sign in to comment.