[Mesa-dev] [PATCH] gallivm: Do not use NoFramePointerElim with LLVM 3.7

Jose Fonseca jfonseca at vmware.com
Thu May 28 05:28:36 PDT 2015


For the record, we also feel the pain, and I did look into the LLVM C 
API for disassembly, but the problem is that we only get the function 
start address -- we don't know where it finishes --, and the LLVM C API 
doesn't expose enough capabilities to describe jump/return instructions, 
which we rely upon to guess where a function ends.

Another approach would be to get the functions start-stop addresses 
separately -- via the DelegatingJITMemoryManager somehow.



BTW, this LLVM breakage has nothing to do with the disassembly. It just 
happens to be  on the same file.  It would have been broken even without 
it.

In fact, doesn't this mean that we'll stumble into 
http://llvm.org/PR21435 again?
We must disable frame pointer elimination *somehow*, given upstream LLVM 
didn't bother fixing the bug.


Jose


On 28/05/15 12:56, Roland Scheidegger wrote:
> I use this sometimes for debugging things in llvmpipe, so I don't think
> that's a good option. Without it getting the actual assembly of the
> shaders would be quite annoying.
> It is unfortunately true that (due to the heavy use of the unstable C++
> API) it breaks very often, but as long as it isn't possible to do that
> with llvm's C API it seems unavoidable.
>
> Roland
>
> Am 28.05.2015 um 12:01 schrieb Marek Olšák:
>> The disassemble function does more harm than good and is often the
>> most often broken function after an LLVM update. Shouldn't we remove
>> it to make our lives easier?
>>
>> Marek
>>
>>
>> On Wed, May 27, 2015 at 7:27 AM, Vinson Lee <vlee at freedesktop.org> wrote:
>>> TargetOptions::NoFramePointerElim was removed in llvm-3.7.0svn r238244
>>> "Remove NoFramePointerElim and NoFramePointerElimOverride from
>>> TargetOptions and remove ExecutionEngine's dependence on CodeGen. NFC."
>>>
>>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>>> ---
>>>   src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 ++
>>>   src/gallium/auxiliary/gallivm/lp_bld_misc.cpp  | 2 ++
>>>   2 files changed, 4 insertions(+)
>>>
>>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
>>> index be3e834..76c302f 100644
>>> --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
>>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
>>> @@ -277,8 +277,10 @@ disassemble(const void* func, llvm::raw_ostream & Out)
>>>      options.StackAlignmentOverride = 4;
>>>   #endif
>>>   #if defined(DEBUG) || defined(PROFILE)
>>> +#if HAVE_LLVM < 0x0307
>>>      options.NoFramePointerElim = true;
>>>   #endif
>>> +#endif
>>>      OwningPtr<TargetMachine> TM(T->createTargetMachine(Triple, sys::getHostCPUName(), "", options));
>>>
>>>      /*
>>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> index 5e8a634..ffed9e6 100644
>>> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> @@ -439,8 +439,10 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>>>   #if HAVE_LLVM < 0x0304
>>>      options.NoFramePointerElimNonLeaf = true;
>>>   #endif
>>> +#if HAVE_LLVM < 0x0307
>>>      options.NoFramePointerElim = true;
>>>   #endif
>>> +#endif
>>>
>>>      builder.setEngineKind(EngineKind::JIT)
>>>             .setErrorStr(&Error)
>>> --
>>> 2.4.1
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=oJN3RQI6auvaC8t4GPlTvSe8h-WZYhBL7xSRhbwFgDI&s=Ht4F7y_dMUmK34b_5vMdCKunj7WvDKU8-8HWca89Ei0&e=
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=oJN3RQI6auvaC8t4GPlTvSe8h-WZYhBL7xSRhbwFgDI&s=Ht4F7y_dMUmK34b_5vMdCKunj7WvDKU8-8HWca89Ei0&e=
>>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=j--Khc7uwEjgb39x21uUdm65cn47ORER1E2LLAosy28&s=KOd3_0hp1Z6nppy1NmIibOIP05Q_sl7IY3G7yoFrt9M&e=
>



More information about the mesa-dev mailing list