Allow the getRegForInlineAsmConstraint method to return a register class with
authorChris Lattner <sabre@nondot.org>
Thu, 2 Nov 2006 01:41:49 +0000 (01:41 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 2 Nov 2006 01:41:49 +0000 (01:41 +0000)
commit2a821601f1db665fbb825727aacf1a54d17b91ef
tree91a31776181a0452fba0725daee566bfa0ca8e06
parenta74b4a3ddc0aadbcf6bf35754cf1c6d4b2d96e67
Allow the getRegForInlineAsmConstraint method to return a register class with
no fixes physreg.  Treat this as permission to use any register in the register
class.  When this happens and it is safe, allow the llvm register allcoator to
allocate the register instead of doing it at isel time.  This eliminates a ton
of copies around common inline asms.  For example:

int test2(int Y, int X) {
  asm("foo %0, %1" : "=r"(X): "r"(X));
  return X;
}

now compiles to:

_test2:
        foo r3, r4
        blr

instead of:

_test2:
        mr r2, r4
        foo r2, r2
        mr r3, r2
        blr

GCC produces:

_test2:
        foo r4, r4
        mr r3,r4
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31366 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp