LLVM backend for 6502
Go to file
Gerolf Hoflehner 049a087d3f Suppress inlining when the block address is taken
Inlining functions with block addresses can cause many problem and requires a
rich infrastructure to support including escape analysis.  At this point the
safest approach to address these problems is by blocking inlining from
happening.

Background:
There have been reports on Ruby segmentation faults triggered by inlining
functions with block addresses like

//Ruby code snippet
vm_exec_core() {
    finish_insn_seq_0 = &&INSN_LABEL_finish;
    INSN_LABEL_finish:
      ;
}

This kind of scenario can also happen when LLVM picks a subset of blocks for
inlining, which is the case with the actual code in the Ruby environment.

LLVM suppresses inlining for such functions when there is an indirect branch.
The attached patch does so even when there is no indirect branch.  Note that
user code like above would not make much sense: using the global for jumping
across function boundaries would be illegal.

Why was there a segfault:

In the snipped above the block with the label is recognized as dead So it is
eliminated. Instead of a block address the cloner stores a constant (sic!) into
the global resulting in the segfault (when the global is used in a goto).

Why had it worked in the past then:

By luck. In older versions vm_exec_core was also inlined but the label address
used was the block label address in vm_exec_core.  So the global jump ended up
in the original function rather than in the caller which accidentally happened
to work.

Test case ./tools/clang/test/CodeGen/indirect-goto.c will fail as a result
of this commit.

rdar://17245966



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212077 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-01 00:19:34 +00:00
autoconf Remove path_tclsh.m4. 2014-06-02 12:54:32 +00:00
bindings [OCaml] Documentation improvements. 2014-06-30 16:53:53 +00:00
cmake cmake: Don't do anything for LLVM_ENABLE_ASSERTIONS=OFF 2014-06-27 18:17:30 +00:00
docs Fix 'platform-specific' hyphenations 2014-06-30 18:57:16 +00:00
examples Try to fix the msvc build. 2014-04-29 23:37:02 +00:00
include Refactor the code in clang to find a file in a PATH like environment variable into a helper function 2014-06-30 19:54:20 +00:00
lib Suppress inlining when the block address is taken 2014-07-01 00:19:34 +00:00
projects Remove projects/sample. 2014-03-12 22:40:22 +00:00
test Suppress inlining when the block address is taken 2014-07-01 00:19:34 +00:00
tools Add the -arch flag support to llvm-nm to select the slice out of a Mach-O 2014-06-30 18:45:23 +00:00
unittests Reverting r211950 -- it did not help resolve the -Wcomment warnings triggered in GCC. 2014-06-27 19:52:34 +00:00
utils Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
.arcconfig Updated phabricator server. 2014-04-07 03:57:04 +00:00
.clang-format Test commit. 2014-03-02 13:08:46 +00:00
.gitignore Add Polly to the ignored trees. 2014-06-25 13:13:36 +00:00
CMakeLists.txt Delete utils/FileUpdate. 2014-06-23 17:58:39 +00:00
CODE_OWNERS.TXT ARM Linux support 2014-04-02 23:03:28 +00:00
configure Touch configure to force clang's config.h.in reconfiguration on the build servers 2014-06-06 10:36:38 +00:00
CREDITS.TXT Update Credits. 2014-05-29 19:59:58 +00:00
LICENSE.TXT Remove projects/sample. 2014-03-12 22:40:22 +00:00
llvm.spec.in
LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Makefile [configure/make] Propagate names of build host tools when making BuildTools 2014-03-25 21:45:41 +00:00
Makefile.common
Makefile.config.in Add a --enable-clang-plugin-support option to configure. 2014-03-10 16:58:35 +00:00
Makefile.rules [Make] Fix dependencies for td.expanded 2014-06-20 19:00:41 +00:00
README.txt Trivial test commit. 2014-04-26 19:05:45 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you're writing a package for LLVM, see docs/Packaging.rst for our
suggestions.