diff --git a/.travis.yml b/.travis.yml index b1bcc67d..565a3213 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: script: - cmake -DD_VERSION=$DVER -DLLVM_CONFIG=/usr/bin/llvm-config-$LLVM_VERSION - make + - bin/ldc2 -version # For environment info. - ctest --output-on-failure -R $TESTSUITE_FILTER notifications: diff --git a/README b/README index ba19f8a5..ab0534f0 100644 --- a/README +++ b/README @@ -4,8 +4,9 @@ LDC – the LLVM D Compiler The LDC project aims to provide a portable D programming language compiler with modern optimization and code generation capabilities. -The compiler uses the official DMD frontends to support both D1 and D2, -and relies on the LLVM Core libraries for code generation. +The compiler uses the official DMD frontends to support the latest +version of D2, and relies on the LLVM Core libraries for code +generation. LDC is fully Open Source; the parts of the code not taken/adapted from other projects are BSD-licensed (see the LICENSE file for details). @@ -13,6 +14,9 @@ other projects are BSD-licensed (see the LICENSE file for details). Please consult the D wiki for further information: http://wiki.dlang.org/LDC +D1 is no longer available; see the 'd1' Git branch for the last +version supporting it. + Installation ------------ @@ -36,7 +40,7 @@ For the impatient, a quick guide for building on *nix systems: 3) Build and install LDC: $ mkdir build && cd build # Out-of-source builds are recommended. - $ cmake .. # Use -DD_VERSION=1 to build the D1 compiler. + $ cmake .. $ make $ make install # Or run LDC directly from the bin/ directory. diff --git a/dmd2/declaration.h b/dmd2/declaration.h index 3e0d21dd..f0b3298c 100644 --- a/dmd2/declaration.h +++ b/dmd2/declaration.h @@ -941,9 +941,12 @@ struct FuncDeclaration : Declaration // Functions that wouldn't have gotten semantic3'ed if we weren't inlining set this flag. bool availableExternally; - // true if overridden with the pragma(allow_inline); stmt + // true if overridden with the pragma(LDC_allow_inline); stmt bool allowInlining; + // true if set with the pragma(LDC_never_inline); stmt + bool neverInline; + // true if has inline assembler bool inlineAsm; #endif diff --git a/dmd2/func.c b/dmd2/func.c index 776252f3..138feed5 100644 --- a/dmd2/func.c +++ b/dmd2/func.c @@ -99,6 +99,7 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageCla // LDC isArrayOp = false; allowInlining = false; + neverInline = false; availableExternally = true; // assume this unless proven otherwise // function types in ldc don't merge if the context parameter differs diff --git a/dmd2/idgen.c b/dmd2/idgen.c index eb156eb5..25b97eae 100644 --- a/dmd2/idgen.c +++ b/dmd2/idgen.c @@ -277,6 +277,7 @@ Msgtable msgtable[] = { "LDC_va_arg" }, { "LDC_verbose" }, { "LDC_allow_inline" }, + { "LDC_never_inline" }, { "LDC_inline_asm" }, { "LDC_inline_ir" }, { "LDC_fence" }, diff --git a/dmd2/statement.c b/dmd2/statement.c index af3a4796..02314b12 100644 --- a/dmd2/statement.c +++ b/dmd2/statement.c @@ -3135,6 +3135,10 @@ Statement *PragmaStatement::semantic(Scope *sc) { sc->func->allowInlining = true; } + else if (ident == Id::LDC_never_inline) + { + sc->func->neverInline = true; + } #endif #if DMDV2 else if (ident == Id::startaddress) diff --git a/gen/functions.cpp b/gen/functions.cpp index 51a0f48f..4b1bcb3b 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -815,6 +815,11 @@ void DtoDeclareFunction(FuncDeclaration* fdecl) } } + if (fdecl->neverInline) + { + fdecl->ir.irFunc->setNeverInline(); + } + if (fdecl->llvmInternal == LLVMglobal_crt_ctor || fdecl->llvmInternal == LLVMglobal_crt_dtor) { AppendFunctionToLLVMGlobalCtorsDtors(func, fdecl->priority, fdecl->llvmInternal == LLVMglobal_crt_ctor); diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index f7a146c0..87d17dd1 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -599,7 +599,16 @@ function(add_tests module_files) endfunction() testcase(debug "-g;-d-debug") - testcase(release "-O3;-release") + + # Building the std.exception tests on x86_64 triggers an infinite + # recursion in scalar evolution on LLVM 3.1 (only), see the list of + # known LLVM bugs for details. + if(${LDC_LLVM_VER} EQUAL 301 AND ${HOST_BITNESS} EQUAL 64 AND + "${testroot}" STREQUAL "phobos_std_exception") + testcase(release "-O1;-release") + else() + testcase(release "-O3;-release") + endif() # On 64 bit multilib builds, run the tests in 32 bit mode as well. if(MULTILIB AND ${HOST_BITNESS} EQUAL 64)