Skip to content

Commit

Permalink
Get rid of now unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed May 20, 2024
1 parent 4818101 commit a37c2ab
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 41 deletions.
4 changes: 0 additions & 4 deletions gen/aa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ DLValue *DtoAAIndex(const Loc &loc, Type *type, DValue *aa, DValue *key,
// first get the runtime function
llvm::Function *func =
getRuntimeFunction(loc, gIR->module, lvalue ? "_aaGetY" : "_aaInX");
LLFunctionType *funcTy = func->getFunctionType();

// aa param
LLValue *aaval = lvalue ? DtoLVal(aa) : DtoRVal(aa);
Expand Down Expand Up @@ -105,7 +104,6 @@ DValue *DtoAAIn(const Loc &loc, Type *type, DValue *aa, DValue *key) {

// first get the runtime function
llvm::Function *func = getRuntimeFunction(loc, gIR->module, "_aaInX");
LLFunctionType *funcTy = func->getFunctionType();

IF_LOG Logger::cout() << "_aaIn = " << *func << '\n';

Expand Down Expand Up @@ -141,7 +139,6 @@ DValue *DtoAARemove(const Loc &loc, DValue *aa, DValue *key) {

// first get the runtime function
llvm::Function *func = getRuntimeFunction(loc, gIR->module, "_aaDelX");
LLFunctionType *funcTy = func->getFunctionType();

IF_LOG Logger::cout() << "_aaDel = " << *func << '\n';

Expand Down Expand Up @@ -171,7 +168,6 @@ LLValue *DtoAAEquals(const Loc &loc, EXP op, DValue *l, DValue *r) {
assert(t == r->type->toBasetype() &&
"aa equality is only defined for aas of same type");
llvm::Function *func = getRuntimeFunction(loc, gIR->module, "_aaEqual");
LLFunctionType *funcTy = func->getFunctionType();

LLValue *aaval = DtoRVal(l);
assert(aaval->getType()->isPointerTy());
Expand Down
1 change: 0 additions & 1 deletion gen/classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ DValue *DtoDynamicCastInterface(const Loc &loc, DValue *val, Type *_to) {

llvm::Function *func =
getRuntimeFunction(loc, gIR->module, "_d_interface_cast");
LLFunctionType *funcTy = func->getFunctionType();

resolveObjectAndClassInfoClasses();

Expand Down
2 changes: 0 additions & 2 deletions gen/modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ LLFunction *build_module_reference_and_ctor(const char *moduleMangle,
// .minfo (COFF & MachO) / __minfo section.
void emitModuleRefToSection(std::string moduleMangle,
llvm::Constant *thisModuleInfo) {
const auto moduleInfoPtrTy = DtoPtrToType(getModuleInfoType());

const auto &triple = *global.params.targetTriple;
const auto sectionName =
triple.isOSBinFormatCOFF()
Expand Down
29 changes: 4 additions & 25 deletions gen/tocall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,6 @@ static LLValue *getTypeinfoArrayArgumentForDVarArg(Expressions *argexps,

////////////////////////////////////////////////////////////////////////////////

static LLType *getPtrToAtomicType(LLType *type) {
switch (const size_t N = getTypeBitSize(type)) {
case 8:
case 16:
case 32:
case 64:
case 128:
#if LDC_LLVM_VER < 1800
return LLType::getIntNPtrTy(gIR->context(), static_cast<unsigned>(N));
#else
return LLType::getIntNTy(gIR->context(), static_cast<unsigned>(N))
->getPointerTo();
#endif
default:
return nullptr;
}
}

static LLType *getAtomicType(LLType *type) {
switch (const size_t N = getTypeBitSize(type)) {
case 8:
Expand Down Expand Up @@ -399,8 +381,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
LLValue *val = nullptr;
if (pointeeType->isIntegerTy()) {
val = DtoRVal(dval);
} else if (auto intPtrType = getPtrToAtomicType(pointeeType)) {
LLType *atype = getAtomicType(pointeeType);
} else if (auto atype = getAtomicType(pointeeType)) {
auto lval = makeLValue(exp1->loc, dval);
val = DtoLoad(atype, lval);
} else {
Expand Down Expand Up @@ -434,8 +415,8 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
Type *retType = exp->type->nextOf();

if (!pointeeType->isIntegerTy()) {
if (auto intPtrType = getPtrToAtomicType(pointeeType)) {
loadedType = getAtomicType(pointeeType);
if (auto atype = getAtomicType(pointeeType)) {
loadedType = atype;
} else {
error(e->loc,
"atomic load only supports types of size 1/2/4/8/16 bytes, "
Expand Down Expand Up @@ -489,8 +470,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
if (pointeeType->isIntegerTy()) {
cmp = DtoRVal(dcmp);
val = DtoRVal(dval);
} else if (auto intPtrType = getPtrToAtomicType(pointeeType)) {
LLType *atype = getAtomicType(pointeeType);
} else if (auto atype = getAtomicType(pointeeType)) {
auto cmpLVal = makeLValue(exp2->loc, dcmp);
cmp = DtoLoad(atype, cmpLVal);
auto lval = makeLValue(exp3->loc, dval);
Expand Down Expand Up @@ -731,7 +711,6 @@ class ImplicitArgumentsBuilder {
return;

size_t index = args.size();
LLType *llArgType = *(llArgTypesBegin + index);

if (dfnval && (dfnval->func->ident == Id::ensure ||
dfnval->func->ident == Id::require)) {
Expand Down
5 changes: 0 additions & 5 deletions gen/toconstelem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,6 @@ class ToConstElemVisitor : public Visitor {

// extract D types
Type *bt = e->type->toBasetype();
Type *elemt = bt->nextOf();

// build llvm array type
LLArrayType *arrtype =
LLArrayType::get(DtoMemType(elemt), e->elements->length);

// dynamic arrays can occur here as well ...
bool dyn = (bt->ty != TY::Tsarray);
Expand Down
2 changes: 0 additions & 2 deletions gen/toir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,6 @@ class ToElemVisitor : public Visitor {
}

assert(e->type->toBasetype()->ty == TY::Tdelegate);
LLType *dgty = DtoType(e->type);

DValue *u = toElem(e->e1);
LLValue *contextptr;
Expand Down Expand Up @@ -2521,7 +2520,6 @@ class ToElemVisitor : public Visitor {

llvm::Function *func =
getRuntimeFunction(e->loc, gIR->module, "_d_assocarrayliteralTX");
LLFunctionType *funcTy = func->getFunctionType();
LLValue *aaTypeInfo = DtoTypeInfoOf(e->loc, stripModifiers(aatype));

LLConstant *initval = arrayConst(keysInits, indexType);
Expand Down
2 changes: 0 additions & 2 deletions ir/irclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ LLConstant *IrClass::getClassInfoInit() {

// void function(Object) classInvariant
assert(!isInterface || !cd->inv);
VarDeclaration *invVar = cinfo->fields[6];
b.push_funcptr(cd->inv);

// ClassFlags m_flags
Expand All @@ -423,7 +422,6 @@ LLConstant *IrClass::getClassInfoInit() {
b.push_null(offTiVar->type);

// void function(Object) defaultConstructor
VarDeclaration *defConstructorVar = cinfo->fields[11];
CtorDeclaration *defConstructor = cd->defaultCtor;
if (defConstructor && (defConstructor->storage_class & STCdisable)) {
defConstructor = nullptr;
Expand Down

0 comments on commit a37c2ab

Please sign in to comment.