mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-28 22:21:31 +03:00
Use llvm_unreachable instead of assert(0).
Also removed some unused functions.
This commit is contained in:
parent
28a65ff689
commit
8ff3a8060a
18 changed files with 68 additions and 166 deletions
|
@ -139,7 +139,7 @@ void emit_file(llvm::TargetMachine &Target, llvm::Module& m, llvm::raw_fd_ostrea
|
|||
|
||||
llvm::formatted_raw_ostream fout(out);
|
||||
if (Target.addPassesToEmitFile(Passes, fout, fileType, codeGenOptLevel()))
|
||||
assert(0 && "no support for asm output");
|
||||
llvm_unreachable("no support for asm output");
|
||||
|
||||
Passes.doInitialization();
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace {
|
|||
return const_cast<LLType*>(LLType::getX86_FP80Ty(gIR->context()));
|
||||
|
||||
default:
|
||||
assert(0 && "Unanticipated argument class");
|
||||
llvm_unreachable("Unanticipated argument class.");
|
||||
}
|
||||
|
||||
switch(cl.classes[1]) {
|
||||
|
@ -291,7 +291,7 @@ namespace {
|
|||
break;
|
||||
|
||||
default:
|
||||
assert(0 && "Unanticipated argument class for second half");
|
||||
llvm_unreachable("Unanticipated argument class for second half.");
|
||||
}
|
||||
return LLStructType::get(gIR->context(), parts);
|
||||
}
|
||||
|
|
|
@ -1207,8 +1207,7 @@ LLValue* DtoArrayLen(DValue* v)
|
|||
TypeSArray *sarray = static_cast<TypeSArray*>(v->type->toBasetype());
|
||||
return DtoConstSize_t(sarray->dim->toUInteger());
|
||||
}
|
||||
assert(0 && "unsupported array for len");
|
||||
return 0;
|
||||
llvm_unreachable("unsupported array for len");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1232,8 +1231,8 @@ LLValue* DtoArrayPtr(DValue* v)
|
|||
assert(!v->isNull());
|
||||
return DtoGEPi(v->getRVal(), 0,0);
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
|
||||
llvm_unreachable("Unexpected array type.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -275,12 +275,12 @@ AsmStatement::toIR(IRState * irs)
|
|||
case Mode_Input: cns = m_cns; break;
|
||||
case Mode_Output: cns = mw_cns; is_input = false; break;
|
||||
case Mode_Update: cns = mrw_cns; is_input = false; break;
|
||||
default: assert(0); break;
|
||||
default: llvm_unreachable("Unknown inline asm reference mode."); break;
|
||||
}
|
||||
break;
|
||||
case Arg_FrameRelative:
|
||||
// FIXME
|
||||
assert(0 && "asm fixme Arg_FrameRelative");
|
||||
// FIXME
|
||||
llvm_unreachable("Arg_FrameRelative not supported.");
|
||||
/* if (arg->expr->op == TOKvar)
|
||||
arg_val = ((VarExp *) arg->expr)->var->toSymbol()->Stree;
|
||||
else
|
||||
|
@ -296,15 +296,15 @@ assert(0 && "asm fixme Arg_FrameRelative");
|
|||
clobbers_mem = true;
|
||||
break;*/
|
||||
case Arg_LocalSize:
|
||||
// FIXME
|
||||
assert(0 && "asm fixme Arg_LocalSize");
|
||||
// FIXME
|
||||
llvm_unreachable("Arg_LocalSize not supported.");
|
||||
/* var_frame_offset = cfun->x_frame_offset;
|
||||
if (var_frame_offset < 0)
|
||||
var_frame_offset = - var_frame_offset;
|
||||
arg_val = irs->integerConstant( var_frame_offset );*/
|
||||
goto do_integer;
|
||||
default:
|
||||
assert(0);
|
||||
llvm_unreachable("Unknown inline asm reference type.");
|
||||
}
|
||||
|
||||
if (is_input) {
|
||||
|
|
|
@ -68,22 +68,6 @@ LLConstant* DtoConstComplex(Type* _ty, longdouble re, longdouble im)
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLValue* DtoRealPart(DValue* val)
|
||||
{
|
||||
assert(0);
|
||||
return gIR->ir->CreateExtractElement(val->getRVal(), DtoConstUint(0), "tmp");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLValue* DtoImagPart(DValue* val)
|
||||
{
|
||||
assert(0);
|
||||
return gIR->ir->CreateExtractElement(val->getRVal(), DtoConstUint(1), "tmp");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* DtoComplex(Loc& loc, Type* to, DValue* val)
|
||||
{
|
||||
LLType* complexTy = DtoType(to);
|
||||
|
@ -181,7 +165,7 @@ void DtoGetComplexParts(Loc& loc, Type* to, DValue* val, DValue*& re, DValue*& i
|
|||
im = NULL;
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
llvm_unreachable("Unexpected numeric type.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +344,7 @@ DValue* DtoComplexDiv(Loc& loc, Type* type, DValue* lhs, DValue* rhs)
|
|||
res_im = gIR->ir->CreateFMul(lhs_im, rhs_re, "imre");
|
||||
}
|
||||
else
|
||||
assert(0 && "lhs has neither real nor imaginary part");
|
||||
llvm_unreachable("lhs has neither real nor imaginary part");
|
||||
|
||||
tmp1 = gIR->ir->CreateFMul(rhs_re, rhs_re, "rhs_resq");
|
||||
tmp2 = gIR->ir->CreateFMul(rhs_im, rhs_im, "rhs_imsq");
|
||||
|
|
|
@ -21,8 +21,6 @@ LLConstant* DtoConstComplex(Type* t, longdouble re, longdouble im);
|
|||
|
||||
LLConstant* DtoComplexShuffleMask(unsigned a, unsigned b);
|
||||
|
||||
LLValue* DtoRealPart(DValue* val);
|
||||
LLValue* DtoImagPart(DValue* val);
|
||||
DValue* DtoComplex(Loc& loc, Type* to, DValue* val);
|
||||
|
||||
void DtoComplexSet(LLValue* c, LLValue* re, LLValue* im);
|
||||
|
|
|
@ -137,10 +137,8 @@ void VarDeclaration::codegen(Ir* p)
|
|||
Logger::println("data segment");
|
||||
|
||||
#if DMDV2 && 0 // TODO:
|
||||
if (storage_class & STCmanifest)
|
||||
{
|
||||
assert(0 && "manifest constant being codegened!!!");
|
||||
}
|
||||
assert(!(storage_class & STCmanifest) &&
|
||||
"manifest constant being codegen'd!");
|
||||
#endif
|
||||
|
||||
// don't duplicate work
|
||||
|
|
|
@ -444,7 +444,7 @@ llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl)
|
|||
}
|
||||
else {
|
||||
Logger::println("chars: %s type: %s kind: %s", fdecl->toChars(), fdecl->type->toChars(), fdecl->kind());
|
||||
assert(0);
|
||||
llvm_unreachable("needThis, but invalid parent declaration.");
|
||||
}
|
||||
}
|
||||
else if (fdecl->isNested()) {
|
||||
|
|
|
@ -477,9 +477,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
|
|||
// T[n] = T[] - generally only generated by frontend in rare cases
|
||||
else if (t2->ty == Tarray && t->nextOf()->toBasetype()->equals(t2->nextOf()->toBasetype())) {
|
||||
DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs));
|
||||
} else {
|
||||
assert(0 && "Unimplemented static array assign!");
|
||||
}
|
||||
} else llvm_unreachable("Unimplemented static array assign!");
|
||||
}
|
||||
else if (t->ty == Tdelegate) {
|
||||
LLValue* l = lhs->getLVal();
|
||||
|
@ -575,11 +573,7 @@ DValue* DtoNullValue(Type* type)
|
|||
return new DNullValue(type, LLConstant::getNullValue(lltype));
|
||||
}
|
||||
|
||||
// unknown
|
||||
error("unsupported: null value for %s", type->toChars());
|
||||
assert(0);
|
||||
return 0;
|
||||
|
||||
llvm_unreachable("null not known for this type.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1009,8 +1003,7 @@ void DtoResolveDsymbol(Dsymbol* dsym)
|
|||
DtoResolveTypeInfo(fd);
|
||||
}
|
||||
else {
|
||||
error(dsym->loc, "unsupported dsymbol: %s", dsym->toChars());
|
||||
assert(0 && "unsupported dsymbol for DtoResolveDsymbol");
|
||||
llvm_unreachable("Unsupported DSymbol for DtoResolveDsymbol.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,11 +1249,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
|
|||
else if (TupleDeclaration* tupled = declaration->isTupleDeclaration())
|
||||
{
|
||||
Logger::println("TupleDeclaration");
|
||||
if(!tupled->isexp) {
|
||||
error(declaration->loc, "don't know how to handle non-expression tuple decls yet");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
assert(tupled->isexp && "Non-expression tuple decls not handled yet.");
|
||||
assert(tupled->objects);
|
||||
for (unsigned i=0; i < tupled->objects->dim; ++i)
|
||||
{
|
||||
|
@ -1274,13 +1263,10 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
|
|||
Logger::println("TemplateDeclaration");
|
||||
// do nothing
|
||||
}
|
||||
// unsupported declaration
|
||||
else
|
||||
{
|
||||
error(declaration->loc, "Unimplemented Declaration type for DeclarationExp. kind: %s", declaration->kind());
|
||||
assert(0);
|
||||
llvm_unreachable("Unimplemented Declaration type for DeclarationExp.");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// does pretty much the same as DtoDeclarationExp, except it doesn't initialize, and only handles var declarations
|
||||
|
@ -1462,14 +1448,14 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
|
|||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (init->isStructInitializer()) {
|
||||
else if (init->isStructInitializer())
|
||||
{
|
||||
// TODO: again nothing ?
|
||||
}
|
||||
else {
|
||||
Logger::println("unsupported initializer: %s", init->toChars());
|
||||
assert(0);
|
||||
else
|
||||
{
|
||||
llvm_unreachable("Unknown initializer type.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1538,8 +1524,9 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp)
|
|||
Logger::println("type is a static array, building constant array initializer to single value");
|
||||
return expand_to_sarray(base, exp);
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
else if (base->ty == Tvector)
|
||||
if (base->ty == Tvector)
|
||||
{
|
||||
LLConstant* val = exp->toConstElem(gIR);
|
||||
TypeVector* tv = (TypeVector*)base;
|
||||
|
@ -1551,13 +1538,10 @@ LLConstant* DtoConstExpInit(Loc loc, Type* type, Expression* exp)
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
error(loc, "LDC internal error: cannot yet convert default initializer %s of type %s to %s",
|
||||
exp->toChars(), exp->type->toChars(), type->toChars());
|
||||
fatal();
|
||||
}
|
||||
assert(0);
|
||||
|
||||
error(loc, "LDC internal error: cannot yet convert default initializer %s of type %s to %s",
|
||||
exp->toChars(), exp->type->toChars(), type->toChars());
|
||||
llvm_unreachable("Unsupported default initializer.");
|
||||
}
|
||||
|
||||
return exp->toConstElem(gIR);
|
||||
|
|
|
@ -658,14 +658,6 @@ void Module::genmoduleinfo()
|
|||
|
||||
#endif
|
||||
|
||||
/*Logger::println("MODULE INFO INITIALIZERS");
|
||||
for (size_t i=0; i<initVec.size(); ++i)
|
||||
{
|
||||
Logger::cout() << *initVec[i] << '\n';
|
||||
if (initVec[i]->getType() != moduleinfoTy->getElementType(i))
|
||||
assert(0);
|
||||
}*/
|
||||
|
||||
// create and set initializer
|
||||
b.finalize(moduleInfoType, moduleInfoSymbol());
|
||||
|
||||
|
|
|
@ -89,11 +89,7 @@ llvm::Function* LLVM_D_GetRuntimeFunction(llvm::Module* target, const char* name
|
|||
return fn;
|
||||
|
||||
fn = M->getFunction(name);
|
||||
if (!fn) {
|
||||
printf("Runtime function '%s' was not found\n", name);
|
||||
assert(0);
|
||||
//return NULL;
|
||||
}
|
||||
assert(fn && "Runtime function not found.");
|
||||
|
||||
LLFunctionType* fnty = fn->getFunctionType();
|
||||
LLFunction* resfn = llvm::cast<llvm::Function>(target->getOrInsertFunction(name, fnty));
|
||||
|
|
|
@ -52,8 +52,7 @@ TypeFunction* DtoTypeFunction(DValue* fnval)
|
|||
return static_cast<TypeFunction*>(next);
|
||||
}
|
||||
|
||||
assert(0 && "cant get TypeFunction* from non lazy/function/delegate");
|
||||
return 0;
|
||||
llvm_unreachable("Cannot get TypeFunction* from non lazy/function/delegate");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -123,11 +122,8 @@ LLValue* DtoCallableValue(DValue* fn)
|
|||
return gIR->ir->CreateExtractValue(dg, 1, ".funcptr");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "not a callable type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
llvm_unreachable("Not a callable type.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -101,7 +101,7 @@ static llvm::DIType dwarfBasicType(Type* type)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "unsupported basictype for debug info");
|
||||
llvm_unreachable("unsupported basic type for debug info");
|
||||
}
|
||||
|
||||
return gIR->dibuilder.createBasicType(
|
||||
|
|
51
gen/toir.cpp
51
gen/toir.cpp
|
@ -211,7 +211,7 @@ DValue* VarExp::toElem(IRState* p)
|
|||
else if (llvm::isa<llvm::Argument>(vd->ir.getIrValue())) {
|
||||
return new DImValue(type, vd->ir.getIrValue());
|
||||
}
|
||||
else assert(0);
|
||||
else llvm_unreachable("Unexpected parameter value.");
|
||||
}
|
||||
else {
|
||||
Logger::println("a normal variable");
|
||||
|
@ -271,7 +271,7 @@ DValue* VarExp::toElem(IRState* p)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "Unimplemented VarExp type");
|
||||
llvm_unreachable("Unimplemented VarExp type");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -399,8 +399,8 @@ LLConstant* NullExp::toConstElem(IRState* p)
|
|||
else {
|
||||
return LLConstant::getNullValue(t);
|
||||
}
|
||||
assert(0);
|
||||
return NULL;
|
||||
|
||||
llvm_unreachable("Unknown type for null constant.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -504,8 +504,7 @@ DValue* StringExp::toElem(IRState* p)
|
|||
return new DImValue(type, arrptr);
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return 0;
|
||||
llvm_unreachable("Unknown type for StringExp.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -560,8 +559,7 @@ LLConstant* StringExp::toConstElem(IRState* p)
|
|||
return DtoConstSlice(clen, arrptr, type);
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return NULL;
|
||||
llvm_unreachable("Unknown type for StringExp.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1229,8 +1227,7 @@ DValue* SymOffExp::toElem(IRState* p)
|
|||
Logger::print("SymOffExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(0 && "SymOffExp::toElem should no longer be called :/");
|
||||
return 0;
|
||||
llvm_unreachable("SymOffExp::toElem should no longer be called.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1454,7 +1451,7 @@ DValue* DotVarExp::toElem(IRState* p)
|
|||
arrptr = DtoIndexClass(l->getRVal(), tc->sym, vd);
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
llvm_unreachable("Unknown DotVarExp type for VarDeclaration.");
|
||||
|
||||
//Logger::cout() << "mem: " << *arrptr << '\n';
|
||||
return new DVarValue(type, vd, arrptr);
|
||||
|
@ -1513,12 +1510,8 @@ DValue* DotVarExp::toElem(IRState* p)
|
|||
|
||||
return new DFuncValue(fdecl, funcval, passedThis);
|
||||
}
|
||||
else {
|
||||
printf("unsupported dotvarexp: %s\n", var->toChars());
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return 0;
|
||||
llvm_unreachable("Unknown target for VarDeclaration.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1557,9 +1550,7 @@ DValue* ThisExp::toElem(IRState* p)
|
|||
return new DVarValue(type, vd, v);
|
||||
}
|
||||
|
||||
// anything we're not yet handling ?
|
||||
assert(0 && "no var in ThisExp");
|
||||
return 0;
|
||||
llvm_unreachable("No VarDeclaration in ThisExp.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1611,8 +1602,8 @@ DValue* IndexExp::toElem(IRState* p)
|
|||
return DtoAAIndex(loc, type, l, r, modifiable);
|
||||
}
|
||||
else {
|
||||
Logger::println("invalid index exp! e1type: %s", e1type->toChars());
|
||||
assert(0);
|
||||
Logger::println("e1type: %s", e1type->toChars());
|
||||
llvm_unreachable("Unknown IndexExp target.");
|
||||
}
|
||||
return new DVarValue(type, arrptr);
|
||||
}
|
||||
|
@ -1762,7 +1753,7 @@ DValue* CmpExp::toElem(IRState* p)
|
|||
cmpop = llvm::FCmpInst::FCMP_ORD;break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
llvm_unreachable("Unsupported floating point comparison operator.");
|
||||
}
|
||||
eval = p->ir->CreateFCmp(cmpop, l->getRVal(), r->getRVal(), "tmp");
|
||||
}
|
||||
|
@ -1821,7 +1812,7 @@ DValue* CmpExp::toElem(IRState* p)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "Unsupported CmpExp type");
|
||||
llvm_unreachable("Unsupported CmpExp type");
|
||||
}
|
||||
|
||||
return new DImValue(type, eval);
|
||||
|
@ -1858,7 +1849,7 @@ DValue* EqualExp::toElem(IRState* p)
|
|||
cmpop = llvm::ICmpInst::ICMP_NE;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
llvm_unreachable("Unsupported integral type equality comparison.");
|
||||
}
|
||||
if (rv->getType() != lv->getType()) {
|
||||
rv = DtoBitCast(rv, lv->getType());
|
||||
|
@ -1897,7 +1888,7 @@ DValue* EqualExp::toElem(IRState* p)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "Unsupported EqualExp type");
|
||||
llvm_unreachable("Unsupported EqualExp type.");
|
||||
}
|
||||
|
||||
return new DImValue(type, eval);
|
||||
|
@ -1997,7 +1988,7 @@ DValue* NewExp::toElem(IRState* p)
|
|||
// new static array
|
||||
else if (ntype->ty == Tsarray)
|
||||
{
|
||||
assert(0);
|
||||
llvm_unreachable("Static array new should decay to dynamic array.");
|
||||
}
|
||||
// new struct
|
||||
else if (ntype->ty == Tstruct)
|
||||
|
@ -2062,7 +2053,7 @@ DValue* NewExp::toElem(IRState* p)
|
|||
return new DImValue(type, mem);
|
||||
}
|
||||
|
||||
assert(0);
|
||||
llvm_unreachable(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2127,7 +2118,7 @@ DValue* DeleteExp::toElem(IRState* p)
|
|||
// unknown/invalid
|
||||
else
|
||||
{
|
||||
assert(0 && "invalid delete");
|
||||
llvm_unreachable("Unsupported DeleteExp target.");
|
||||
}
|
||||
|
||||
// no value to return
|
||||
|
@ -2442,9 +2433,9 @@ DValue* DelegateExp::toElem(IRState* p)
|
|||
if (e1->op != TOKsuper && e1->op != TOKdottype && func->isVirtual() && !func->isFinal())
|
||||
castfptr = DtoVirtualFunctionPointer(u, func, toChars());
|
||||
else if (func->isAbstract())
|
||||
assert(0 && "TODO delegate to abstract method");
|
||||
llvm_unreachable("Delegate to abstract method not implemented.");
|
||||
else if (func->toParent()->isInterfaceDeclaration())
|
||||
assert(0 && "TODO delegate to interface method");
|
||||
llvm_unreachable("Delegate to interface method not implemented.");
|
||||
else
|
||||
{
|
||||
func->codegen(Type::sir);
|
||||
|
|
|
@ -74,6 +74,9 @@ llvm::Attributes DtoShouldExtend(Type* type)
|
|||
#else
|
||||
return llvm::Attribute::ZExt;
|
||||
#endif
|
||||
default:
|
||||
// Do not extend.
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if LDC_LLVM_VER >= 303
|
||||
|
@ -221,8 +224,7 @@ LLType* DtoType(Type* t)
|
|||
*/
|
||||
|
||||
default:
|
||||
printf("trying to convert unknown type '%s' with value %d\n", t->toChars(), t->ty);
|
||||
assert(0);
|
||||
llvm_unreachable("Unknown class of D Type!");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -363,7 +365,7 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "not global/function");
|
||||
llvm_unreachable("not global/function");
|
||||
}
|
||||
|
||||
// If the function needs to be defined in the current module, check if it
|
||||
|
@ -463,40 +465,6 @@ llvm::GlobalValue::LinkageTypes DtoExternalLinkage(Dsymbol* sym)
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLValue* DtoPointedType(LLValue* ptr, LLValue* val)
|
||||
{
|
||||
LLType* ptrTy = ptr->getType()->getContainedType(0);
|
||||
LLType* valTy = val->getType();
|
||||
// ptr points to val's type
|
||||
if (ptrTy == valTy)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
// ptr is integer pointer
|
||||
else if (ptrTy->isIntegerTy())
|
||||
{
|
||||
// val is integer
|
||||
assert(valTy->isIntegerTy());
|
||||
LLIntegerType* pt = llvm::cast<LLIntegerType>(ptrTy);
|
||||
LLIntegerType* vt = llvm::cast<LLIntegerType>(valTy);
|
||||
if (pt->getBitWidth() < vt->getBitWidth()) {
|
||||
return new llvm::TruncInst(val, pt, "tmp", gIR->scopebb());
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
// something else unsupported
|
||||
else
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << *ptrTy << '|' << *valTy << '\n';
|
||||
assert(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLIntegerType* DtoSize_t()
|
||||
{
|
||||
// the type of size_t does not change once set
|
||||
|
@ -686,9 +654,9 @@ LLConstant* DtoConstFP(Type* t, longdouble value)
|
|||
#else
|
||||
return LLConstantFP::get(gIR->context(), APFloat(APInt(128, 2, bits)));
|
||||
#endif
|
||||
} else {
|
||||
assert(0 && "Unknown floating point type encountered");
|
||||
}
|
||||
|
||||
llvm_unreachable("Unknown floating point type encountered");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -54,9 +54,6 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym);
|
|||
LLGlobalValue::LinkageTypes DtoInternalLinkage(Dsymbol* sym);
|
||||
LLGlobalValue::LinkageTypes DtoExternalLinkage(Dsymbol* sym);
|
||||
|
||||
// TODO: this one should be removed!!!
|
||||
LLValue* DtoPointedType(LLValue* ptr, LLValue* val);
|
||||
|
||||
// some types
|
||||
LLIntegerType* DtoSize_t();
|
||||
LLStructType* DtoInterfaceInfoType();
|
||||
|
|
|
@ -787,7 +787,7 @@ void TypeInfoClassDeclaration::codegen(Ir*i)
|
|||
void TypeInfoClassDeclaration::llvmDefine()
|
||||
{
|
||||
#if DMDV2
|
||||
assert(0);
|
||||
llvm_unreachable("TypeInfoClassDeclaration should not be called for D2");
|
||||
#endif
|
||||
Logger::println("TypeInfoClassDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
|
|
@ -139,8 +139,7 @@ llvm::Type * IrTypeBasic::basic2llvm(Type* t)
|
|||
case Tbool:
|
||||
return llvm::Type::getInt1Ty(ctx);
|
||||
default:
|
||||
assert(0 && "not basic type");
|
||||
return NULL;
|
||||
llvm_unreachable("Unknown basic type.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue