mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Split the init.trampoline intrinsic, which currently combines GCC's
init.trampoline and adjust.trampoline intrinsics, into two intrinsics like in GCC. While having one combined intrinsic is tempting, it is not natural because typically the trampoline initialization needs to be done in one function, and the result of adjust trampoline is needed in a different (nested) function. To get around this llvm-gcc hacks the nested function lowering code to insert an additional parent variable holding the adjust.trampoline result that can be accessed from the child function. Dragonegg doesn't have the luxury of tweaking GCC code, so it stored the result of adjust.trampoline in the memory GCC set aside for the trampoline itself (this is always available in the child function), and set up some new memory (using an alloca) to hold the trampoline. Unfortunately this breaks Go which allocates trampoline memory on the heap and wants to use it even after the parent has exited (!). Rather than doing even more hacks to get Go working, it seemed best to just use two intrinsics like in GCC. Patch mostly by Sanjoy Das. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -566,14 +566,19 @@ namespace ISD {
|
||||
// HANDLENODE node - Used as a handle for various purposes.
|
||||
HANDLENODE,
|
||||
|
||||
// TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
|
||||
// It takes as input a token chain, the pointer to the trampoline,
|
||||
// the pointer to the nested function, the pointer to pass for the
|
||||
// 'nest' parameter, a SRCVALUE for the trampoline and another for
|
||||
// the nested function (allowing targets to access the original
|
||||
// Function*). It produces the result of the intrinsic and a token
|
||||
// chain as output.
|
||||
TRAMPOLINE,
|
||||
// INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic. It
|
||||
// takes as input a token chain, the pointer to the trampoline, the pointer
|
||||
// to the nested function, the pointer to pass for the 'nest' parameter, a
|
||||
// SRCVALUE for the trampoline and another for the nested function (allowing
|
||||
// targets to access the original Function*). It produces a token chain as
|
||||
// output.
|
||||
INIT_TRAMPOLINE,
|
||||
|
||||
// ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
|
||||
// It takes a pointer to the trampoline and produces a (possibly) new
|
||||
// pointer to the same trampoline with platform-specific adjustments
|
||||
// applied. The pointer it returns points to an executable block of code.
|
||||
ADJUST_TRAMPOLINE,
|
||||
|
||||
// TRAP - Trapping instruction
|
||||
TRAP,
|
||||
|
@@ -344,10 +344,14 @@ def int_annotation : Intrinsic<[llvm_anyint_ty],
|
||||
|
||||
//===------------------------ Trampoline Intrinsics -----------------------===//
|
||||
//
|
||||
def int_init_trampoline : Intrinsic<[llvm_ptr_ty],
|
||||
def int_init_trampoline : Intrinsic<[],
|
||||
[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
|
||||
[IntrReadWriteArgMem]>,
|
||||
GCCBuiltin<"__builtin_init_trampoline">;
|
||||
[IntrReadWriteArgMem, NoCapture<0>]>,
|
||||
GCCBuiltin<"__builtin_init_trampoline">;
|
||||
|
||||
def int_adjust_trampoline : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty],
|
||||
[IntrReadArgMem]>,
|
||||
GCCBuiltin<"__builtin_adjust_trampoline">;
|
||||
|
||||
//===------------------------ Overflow Intrinsics -------------------------===//
|
||||
//
|
||||
|
Reference in New Issue
Block a user