[llvm-commits] [llvm-gcc-4.2] r61379 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Chris Lattner sabre at nondot.org
Tue Dec 23 10:52:08 PST 2008


Author: lattner
Date: Tue Dec 23 12:52:07 2008
New Revision: 61379

URL: http://llvm.org/viewvc/llvm-project?rev=61379&view=rev
Log:
Allow tying together an pointers with integers of the same size.  This should
fix FD_ZERO on linux.  Testcase here:
test/FrontendC/2008-12-23-AsmIntPointerTie.c


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=61379&r1=61378&r2=61379&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Dec 23 12:52:07 2008
@@ -4196,25 +4196,26 @@
       const Type *OpTy = Op->getType();
       // If this input operand is matching an output operand, e.g. '0', check if
       // this is something that llvm supports. If the operand types are
-      // different, then emit an error if 1) one of the types is not integer,
-      // 2) if size of input type is larger than the output type. If the size
-      // of the integer input size is smaller than the integer output type, then
-      // cast it to the larger type and shift the value if the target is big
-      // endian.
+      // different, then emit an error if 1) one of the types is not integer or
+      // pointer, 2) if size of input type is larger than the output type. If
+      // the size of the integer input size is smaller than the integer output
+      // type, then cast it to the larger type and shift the value if the target
+      // is big endian.
       if (ISDIGIT(Constraint[0])) {
         unsigned Match = atoi(Constraint);
         const Type *OTy = CallResultTypes[Match];
         if (OTy != OpTy) {
-          if (!OTy->isInteger() || !OpTy->isInteger()) {
-            error("%HUnsupported inline asm: input constraint with a matching "
+          if (!(isa<IntegerType>(OTy) || isa<PointerType>(OTy)) ||
+              !(isa<IntegerType>(OpTy) || isa<PointerType>(OpTy))) {
+            error("%Hunsupported inline asm: input constraint with a matching "
                   "output constraint of incompatible type!",
                   &EXPR_LOCATION(exp));
             return 0;
           }
-          unsigned OTyBits = OTy->getPrimitiveSizeInBits();
-          unsigned OpTyBits = OpTy->getPrimitiveSizeInBits();
+          unsigned OTyBits = TD.getTypeSizeInBits(OTy);
+          unsigned OpTyBits = TD.getTypeSizeInBits(OpTy);
           if (OTyBits == 0 || OpTyBits == 0 || OTyBits < OpTyBits) {
-            error("%HUnsupported inline asm: input constraint with a matching "
+            error("%Hunsupported inline asm: input constraint with a matching "
                   "output constraint of incompatible type!",
                   &EXPR_LOCATION(exp));
             return 0;





More information about the llvm-commits mailing list