From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7548 invoked by alias); 25 May 2012 14:03:22 -0000 Received: (qmail 7537 invoked by uid 22791); 25 May 2012 14:03:20 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 May 2012 14:03:02 +0000 Received: by dalh21 with SMTP id h21so1249624dal.20 for ; Fri, 25 May 2012 07:03:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:x-gm-message-state; bh=rqLHNzB9/OUfcHHOy367RLcpuMjFQNE1LQ5iwy9Ellw=; b=jRw1cQY5Zzl45kHv4d+HynK619hjXyf7YRZdZ40YQA9oc2xWxE8H1y5CpJIB2MsWf0 ItISuab0/dqszUuGzU6mTJgweZKeKukA5vFAkNLR0IkAQTOhlABJhlDC6TB6bgKCDcID QNoiqdlORKrMZZ1Yl/X63I+wzGwLkQd2O/3eeOL0m59fjgLqEwOINs30/uQL8sTt1uSX DRTXqEtlbmfij2Lu468OZKXxjtnqeT/Y3C4Ltr8FYUPM2NU4sSNVPMcC/lmjEVATA6or e1WEnn/RnGX4mcE6fZHf7ndyovGnQfab2m/maG3EjUJh9okqH195h2TGCo525t+7HMgb KNrQ== Received: by 10.68.228.170 with SMTP id sj10mr32500076pbc.106.1337954581504; Fri, 25 May 2012 07:03:01 -0700 (PDT) Received: by 10.68.228.170 with SMTP id sj10mr32500042pbc.106.1337954581289; Fri, 25 May 2012 07:03:01 -0700 (PDT) Received: from coign.google.com ([65.50.217.182]) by mx.google.com with ESMTPS id ku7sm9156271pbc.31.2012.05.25.07.02.59 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 May 2012 07:02:59 -0700 (PDT) From: Ian Lance Taylor To: "Setjem Setjem" Cc: gcc-help@gcc.gnu.org Subject: Re: How to define special requirements for an address operand? References: <1337773963.10856.ezmlm@gcc.gnu.org> <20120525121114.192480@gmx.net> Date: Fri, 25 May 2012 14:03:00 -0000 In-Reply-To: <20120525121114.192480@gmx.net> (Setjem Setjem's message of "Fri, 25 May 2012 14:11:14 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQkiB0rXB4xxU6xhCgR88BMJB2goW+6bTRFIjvmbYNv85AjAIQz0Y+lcoh+dl9P0CvONZJxqhy0R7YNKdctXytArAU0tDOP9+or9sxkj2xij9zqFRx86DsrI8qpzvKZhe2q6MyKaK0Qmjga+DyPaRqOokyL1tUofMmzQXtig3T2b2X1e0E0= X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg00204.txt.bz2 "Setjem Setjem" writes: > I'am trying to write a backend for my own target system. > The target has two pointer registers but only one of them can be used to read data from memory and the other one to write data into memory. > > How could i tell the compiler to use the correct register for the respective operation? > > I have tried to copy the address into the correct register in the define_expand "mov", but this seems to confuse the compiler and not working always. > I also tried to describe it in the target hook TARGET_LEGITIMATE_ADDRESS_P, but there i have no idea how to find out which operation is performed (write/read). That target sounds insane. I think it is going to be quite difficult to get GCC to generate efficient code with this restriction. GCC has a basic concept of a memory address. It does not separate memory addresses into readable addresses and writable addresses. If you write code like a[i]++ GCC is going to use a single pseudo-register to hold the address to read and write. I would not know how to begin fixing that. Setting aside efficiency considerations, the easy way is going to be to ignore the write register, and change all your insns that write to memory to first move the value from the read register to the write register before doing the actual write. Ian