[dcomptue] codegen (#2126)

* code generation

* simplify logic

* apply clang-format

* Undo completely inane choice by clang-format

* Guard the use of the command line args.
This commit is contained in:
Nicholas Wilson 2017-05-24 08:55:32 +08:00 committed by GitHub
parent cae9ccd9a4
commit ae6ff33fc1
23 changed files with 378 additions and 92 deletions

View file

@ -22,6 +22,7 @@
#include "gen/abi.h"
#include "gen/arrays.h"
#include "gen/classes.h"
#include "gen/dcompute/target.h"
#include "gen/dvalue.h"
#include "gen/funcgenstate.h"
#include "gen/function-inlining.h"
@ -977,7 +978,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
#if LDC_LLVM_VER >= 500
0, // Address space
#endif
"alloca point", beginbb);
"alloca_point", beginbb);
funcGen.allocapoint = allocaPoint;
// debug info - after all allocas, but before any llvm.dbg.declare etc
@ -1127,6 +1128,11 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
}
gIR->scopes.pop_back();
if (gIR->dcomputetarget && hasKernelAttr(fd)) {
auto fn = gIR->module.getFunction(fd->mangleString);
gIR->dcomputetarget->addKernelMetadata(fd, fn);
}
}
////////////////////////////////////////////////////////////////////////////////