Mercurial > projects > ldc
diff gen/statements.cpp @ 131:5825d48b27d1 trunk
[svn r135] * Merged DMD 1.025 *
* Fixed a minor linking order mishap *
* Added an command line option -annotate *
* Fixed some problems with running optimizations *
* Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) *
* Fixed problems with passing aggregate types to variadic functions *
* Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory *
* Fixed problems with resolving nested function context pointers for some heavily nested cases *
* Redid function argument passing + other minor code cleanups, still lots to do on this end... *
author | lindquist |
---|---|
date | Fri, 04 Jan 2008 01:38:42 +0100 |
parents | 7f9a0a58394b |
children | 1700239cab2e |
line wrap: on
line diff
--- a/gen/statements.cpp Fri Dec 28 23:52:40 2007 +0100 +++ b/gen/statements.cpp Fri Jan 04 01:38:42 2008 +0100 @@ -7,6 +7,7 @@ #include <iostream> #include "gen/llvm.h" +#include "llvm/InlineAsm.h" #include "total.h" #include "init.h" @@ -129,6 +130,9 @@ Logger::println("ExpStatement::toIR(%d): %s", esi++, toChars()); LOG_SCOPE; + if (global.params.llvmAnnotate) + DtoAnnotation(exp->toChars()); + if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); @@ -146,8 +150,7 @@ void IfStatement::toIR(IRState* p) { - static int wsi = 0; - Logger::println("IfStatement::toIR(%d): %s", wsi++, toChars()); + Logger::println("IfStatement::toIR()"); LOG_SCOPE; DValue* cond_e = condition->toElem(p); @@ -983,6 +986,40 @@ ////////////////////////////////////////////////////////////////////////////// +void AsmStatement::toIR(IRState* p) +{ + Logger::println("AsmStatement::toIR(): %s", toChars()); + LOG_SCOPE; + error("%s: inline asm is not yet implemented", loc.toChars()); + fatal(); + + assert(!asmcode && !asmalign && !refparam && !naked && !regs); + + Token* t = tokens; + assert(t); + + std::string asmstr; + + do { + Logger::println("token: %s", t->toChars()); + asmstr.append(t->toChars()); + asmstr.append(" "); + } while (t = t->next); + + Logger::println("asm expr = '%s'", asmstr.c_str()); + + // create function type + std::vector<const llvm::Type*> args; + const llvm::FunctionType* fty = llvm::FunctionType::get(DtoSize_t(), args, false); + + // create inline asm callee + llvm::InlineAsm* inasm = llvm::InlineAsm::get(fty, asmstr, "r,r", false); + + assert(0); +} + +////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// #define STUBST(x) void x::toIR(IRState * p) {error("Statement type "#x" not implemented: %s", toChars());fatal();} @@ -1004,7 +1041,7 @@ //STUBST(ExpStatement); //STUBST(CompoundStatement); //STUBST(ScopeStatement); -STUBST(AsmStatement); +//STUBST(AsmStatement); //STUBST(TryCatchStatement); //STUBST(TryFinallyStatement); STUBST(VolatileStatement);