Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!hellgate.utah.edu!cdr.utah.edu!moore From: moore%cdr.utah.edu@cs.utah.edu (Tim Moore) Newsgroups: gnu.gcc Subject: Re: short jumps Keywords: port Message-ID: <1990Feb2.094716.12223@hellgate.utah.edu> Date: 2 Feb 90 16:47:16 GMT References: <1049@tuvie> Organization: University of Utah CS Dept Lines: 37 Newsgroups: gnu.gcc Subject: Re: short jumps Summary: Expires: References: <1049@tuvie> Sender: Followup-To: Distribution: Organization: University of Utah CS Dept Keywords: port In article <1049@tuvie> inst182@tuvie (Inst.f.Techn.Informatik) writes: >I want to make a port of gcc to a new processor that has short relative >jumps for up to +-128 instructions. Now my problem is the following: >This jump has completely different semantics than a far jump. How can I >check if I can use the short jump instead of a far jump. I cannot delay >the decision till assembly time, so I *MUST* have gcc emit the right >instruction. *ANY* hints will be appreciated. It's not an easy problem. You can't make this decision before assembly time unless your compiler knows the length of each instruction and how that length depends on the instruction being "near" or "far." A good paper that describes this problem and an algorithm to solve it is "Assembling Code for Machines with Span-Dependent Instructions", Thomas G. Szymanski, CACM, 21(4), April 1978. I implemented this algorithm for Utah Common Lisp's assembler, and I believe that gas uses a similar algorithm. > thanx in advance, > mike Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters