[llvm-commits] [llvm-gcc-4.2] r76208 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp

Eli Friedman eli.friedman at gmail.com
Fri Jul 17 14:32:45 PDT 2009


On Fri, Jul 17, 2009 at 1:47 PM, Anton
Korobeynikov<anton at korobeynikov.info> wrote:
>> Okay, I guess... as long as it doesn't break tying a variable to an
>> allocatable register.  (I'm specifically worried about a variable
>> being overwritten because it gets allocated over.)
> It's up to programmer. :) Note that we only translate loads and stores
> to such variables (modelled as inline asm reading / writing to the
> specified register), so I think this should be perfectly ok.

The case I'm worried about is something like the following:
int test() {
  register int x __asm__(("edi")) = 0;
  // Lots of code, where the register allocator
  // happens to reuse edi for something else
  return x; // Returns a random value instead of zero
            // because it's reading the register rather than
            // the value
}

-Eli




More information about the llvm-commits mailing list