[llvm-commits] [PATCH] Fixed ADR in ARM code generator

Greg Fitzgerald gregf at codeaurora.org
Mon Sep 17 10:27:10 PDT 2012


> There was a previous thread on this topic, but that bug
> should have been closed as invalid, I believe.

Thanks Gordon.  Stepan's patch would fix the problem with encoding
immediates, but agree with Owen that it should break ADR when the argument
is a label, because it would be shifted twice.  The patch I submitted fixes
only the immediates and doesn't affect fixups.  It also makes sure the
immediate is a multiple of 4 and within the range 0 to 1020.  I've updated
the unit tests and walked through relaxation in the debugger to verify the
fix.  I would have liked to see post-relaxation unit tests as well, but
didn't spot any.  If we have those for ADR or for other instructions, can
someone kindly point me to an example?

Owen, Anton, can you please have a look at my patch?

Thanks,
Greg


-----Original Message-----
From: Gordon Keiser [mailto:gkeiser at arxan.com] 
Sent: Sunday, September 16, 2012 12:00 PM
To: Greg Fitzgerald; llvm-commits at cs.uiuc.edu
Subject: RE: [llvm-commits] [PATCH] Fixed ADR in ARM code generator


> From: llvm-commits-bounces at cs.uiuc.edu 
> [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Greg Fitzgerald
> Sent: Friday, September 14, 2012 2:26 PM
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm-commits] [PATCH] Fixed ADR in ARM code generator
>
> My first patch to LLVM, please review.
>
> This addresses bug 13537: http://llvm.org/bugs/show_bug.cgi?id=13537
>
> Thanks,
> Greg
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
> hosted by The Linux Foundation

There was a previous thread on this topic, but that bug should have been
closed as invalid, I believe.   
getThumbAdrLabelOpValue retrieves the branch target using the fixup type
fixup_thumb_adr_pcrel_10, which is defined in ARMAsmBackend.cpp to return:
((Value - 4) >> 2) & 0xff

Original message on gmane
http://permalink.gmane.org/gmane.comp.compilers.llvm.cvs/119492
Someone with more extensive knowledge of the ARM backend can probably tell
you more, you may be fixing something somewhat different.  

Cheers,
Gordon Keiser
Software Development Engineer
Arxan Technologies
gkeiser at arxan.com  www.arxan.comĀ 







More information about the llvm-commits mailing list