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

Greg Fitzgerald gregf at codeaurora.org
Tue Sep 18 11:25:04 PDT 2012


Hi Evan,

I'm new to the LLVM community and hoping to fix a small bug in the encoding
of ADR with and immediate operand.  Are you the owner of the ARM code
generation code? 

Thanks,
Greg

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Greg Fitzgerald
Sent: Monday, September 17, 2012 10:27 AM
To: 'Owen Anderson'; 'Anton Korobeynikov'; 'Stepan Dyatkovskiy'; 'Gordon
Keiser'
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [PATCH] Fixed ADR in ARM code generator

> 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Ā 




_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ThumbADR.patch
Type: application/octet-stream
Size: 6853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120918/f947b1ec/attachment.obj>


More information about the llvm-commits mailing list