From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30069 invoked by alias); 11 Jan 2010 07:53:23 -0000 Received: (qmail 30052 invoked by uid 22791); 11 Jan 2010 07:53:22 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Jan 2010 07:53:18 +0000 Received: from sspiff.sspiff.org (seba.sebabeach.org [10.8.159.10]) by sebabeach.org (Postfix) with ESMTP id 590B06E3D4; Sun, 10 Jan 2010 23:53:16 -0800 (PST) Message-ID: <4B4AD8EC.8000106@sebabeach.org> Date: Mon, 11 Jan 2010 07:53:00 -0000 From: Doug Evans User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Dmitry Eremin-Solenikov CC: cgen@sources.redhat.com Subject: Re: branch insn question References: <20100109164523.GA15551@doriath.ww600.siemens.net> In-Reply-To: <20100109164523.GA15551@doriath.ww600.siemens.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2010-q1/txt/msg00004.txt.bz2 Dmitry Eremin-Solenikov wrote: > Hello, > > I've a small problem with branch instructions on my platorm (m68hc08). > All branch instructions are only short-ranged (signed 8bit offset). > The recommended way to handle this is to emit jump-over code: instead of > beq _long_label > emit: > bne .Lshort > jmp _long_label > .Lshort: > > My question is: should this be handled somehow by cgen? Or this should > be completely done via gas relaxation? And what attributes should I use > on branch instructions in .cpu file? > > Thank you. > > My first thought is that this should be handled at a higher layer than cgen. OTOH, I can't quite disagree with adding macro-insns that implement jump-overs. [Alas, macro insns at the moment are limited to simple 1->1 translations at the moment so that won't work; I need to add support for multiple-insn macros, I wouldn't wait for them for this though.] As for how to handle this in gas, I think the standard copy-existing-port-and-cut-n-paste-n-tweak will work here. Having not looked at gas relax support in awhile I just grepped for "relax" in the gas sources and found several promising starting points. E.g. grep for TC_GENERIC_RELAX_TABLE.