mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-11-03 15:47:26 +01:00
Simplify code by using the right type.
Removes some comditional compiling by replacing unsigned with llvm::Attributes.
This commit is contained in:
+1
-17
@@ -57,11 +57,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype,
|
||||
else
|
||||
{
|
||||
Type* rt = f->next;
|
||||
#if LDC_LLVM_VER == 300
|
||||
unsigned a = 0;
|
||||
#else
|
||||
llvm::Attributes a = None;
|
||||
#endif
|
||||
|
||||
// sret return
|
||||
if (abi->returnInArg(f))
|
||||
{
|
||||
@@ -77,13 +74,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype,
|
||||
if (f->isref)
|
||||
t = t->pointerTo();
|
||||
#endif
|
||||
#if LDC_LLVM_VER == 300
|
||||
if (unsigned se = DtoShouldExtend(t))
|
||||
a = se;
|
||||
#else
|
||||
if (llvm::Attributes atts = DtoShouldExtend(t))
|
||||
a = atts;
|
||||
#endif
|
||||
}
|
||||
#if DMDV2
|
||||
fty.ret = new IrFuncTyArg(rt, f->isref, a);
|
||||
@@ -157,11 +149,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype,
|
||||
#endif
|
||||
|
||||
Type* argtype = arg->type;
|
||||
#if LDC_LLVM_VER == 300
|
||||
unsigned a = 0;
|
||||
#else
|
||||
llvm::Attributes a = None;
|
||||
#endif
|
||||
|
||||
// handle lazy args
|
||||
if (arg->storageClass & STClazy)
|
||||
@@ -424,11 +412,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
|
||||
|
||||
// set attrs on the rest of the arguments
|
||||
size_t n = Parameter::dim(f->parameters);
|
||||
#if LDC_LLVM_VER == 300
|
||||
LLSmallVector<unsigned, 8> attrptr(n, 0);
|
||||
#else
|
||||
LLSmallVector<llvm::Attributes, 8> attrptr(n, None);
|
||||
#endif
|
||||
|
||||
for (size_t k = 0; k < n; ++k)
|
||||
{
|
||||
|
||||
@@ -277,11 +277,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
||||
llvm::AttributeWithIndex Attr;
|
||||
// specify arguments
|
||||
args.push_back(DtoLoad(typeinfoarrayparam));
|
||||
#if LDC_LLVM_VER == 300
|
||||
if (unsigned atts = tf->fty.arg_arguments->attrs) {
|
||||
#else
|
||||
if (llvm::Attributes atts = tf->fty.arg_arguments->attrs) {
|
||||
#endif
|
||||
Attr.Index = argidx;
|
||||
Attr.Attrs = atts;
|
||||
attrs.push_back(Attr);
|
||||
@@ -289,11 +285,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
||||
++argidx;
|
||||
|
||||
args.push_back(gIR->ir->CreateBitCast(mem, getPtrToType(LLType::getInt8Ty(gIR->context())), "tmp"));
|
||||
#if LDC_LLVM_VER == 300
|
||||
if (unsigned atts = tf->fty.arg_argptr->attrs) {
|
||||
#else
|
||||
if (llvm::Attributes atts = tf->fty.arg_argptr->attrs) {
|
||||
#endif
|
||||
Attr.Index = argidx;
|
||||
Attr.Attrs = atts;
|
||||
attrs.push_back(Attr);
|
||||
@@ -505,13 +497,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
||||
}
|
||||
|
||||
size_t n = Parameter::dim(tf->parameters);
|
||||
|
||||
#if LDC_LLVM_VER == 300
|
||||
LLSmallVector<unsigned, 10> attrptr(n, 0);
|
||||
#else
|
||||
LLSmallVector<llvm::Attributes, 10> attrptr(n, llvm::Attribute::None);
|
||||
#endif
|
||||
|
||||
std::vector<DValue*> argvals;
|
||||
if (dfnval && dfnval->func->isArrayOp) {
|
||||
// slightly different approach for array operators
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#if LDC_LLVM_VER == 300
|
||||
#include "llvm/Support/PathV2.h"
|
||||
#else
|
||||
#include "llvm/Support/Path.h"
|
||||
#endif
|
||||
|
||||
#include "declaration.h"
|
||||
#include "module.h"
|
||||
|
||||
@@ -34,11 +34,7 @@ bool DtoIsPassedByRef(Type* type)
|
||||
return (t == Tstruct || t == Tsarray);
|
||||
}
|
||||
|
||||
#if LDC_LLVM_VER == 300
|
||||
unsigned DtoShouldExtend(Type* type)
|
||||
#else
|
||||
llvm::Attributes DtoShouldExtend(Type* type)
|
||||
#endif
|
||||
{
|
||||
type = type->toBasetype();
|
||||
if (type->isintegral())
|
||||
|
||||
@@ -19,11 +19,7 @@ LLType* DtoTypeNotVoid(Type* t);
|
||||
bool DtoIsPassedByRef(Type* type);
|
||||
|
||||
// should argument be zero or sign extended
|
||||
#if LDC_LLVM_VER == 300
|
||||
unsigned DtoShouldExtend(Type* type);
|
||||
#else
|
||||
llvm::Attributes DtoShouldExtend(Type* type);
|
||||
#endif
|
||||
|
||||
// tuple helper
|
||||
// takes a arguments list and makes a struct type out of them
|
||||
|
||||
Reference in New Issue
Block a user