[cfe-commits] r107050 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp

Chris Lattner sabre at nondot.org
Mon Jun 28 13:05:43 PDT 2010


Author: lattner
Date: Mon Jun 28 15:05:43 2010
New Revision: 107050

URL: http://llvm.org/viewvc/llvm-project?rev=107050&view=rev
Log:
random acts of tidying.

Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=107050&r1=107049&r2=107050&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Jun 28 15:05:43 2010
@@ -316,6 +316,10 @@
           ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
 }
 
+//===----------------------------------------------------------------------===//
+// X86-32 ABI Implementation
+//===----------------------------------------------------------------------===//
+  
 /// X86_32ABIInfo - The X86-32 ABI information.
 class X86_32ABIInfo : public ABIInfo {
   ASTContext &Context;
@@ -656,6 +660,11 @@
   return false;
 }
 
+//===----------------------------------------------------------------------===//
+// X86-64 ABI Implementation
+//===----------------------------------------------------------------------===//
+
+
 namespace {
 /// X86_64ABIInfo - The X86_64 ABI information.
 class X86_64ABIInfo : public ABIInfo {
@@ -1427,7 +1436,6 @@
 llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
                                       CodeGenFunction &CGF) const {
   llvm::LLVMContext &VMContext = CGF.getLLVMContext();
-  const llvm::Type *DoubleTy = llvm::Type::getDoubleTy(VMContext);
 
   // Assume that va_list type is correct; should be pointer to LLVM type:
   // struct {
@@ -1533,33 +1541,32 @@
     RegAddr = CGF.Builder.CreateGEP(RegAddr, gp_offset);
     RegAddr = CGF.Builder.CreateBitCast(RegAddr,
                                         llvm::PointerType::getUnqual(LTy));
+  } else if (neededSSE == 1) {
+    RegAddr = CGF.Builder.CreateGEP(RegAddr, fp_offset);
+    RegAddr = CGF.Builder.CreateBitCast(RegAddr,
+                                        llvm::PointerType::getUnqual(LTy));
   } else {
-    if (neededSSE == 1) {
-      RegAddr = CGF.Builder.CreateGEP(RegAddr, fp_offset);
-      RegAddr = CGF.Builder.CreateBitCast(RegAddr,
-                                          llvm::PointerType::getUnqual(LTy));
-    } else {
-      assert(neededSSE == 2 && "Invalid number of needed registers!");
-      // SSE registers are spaced 16 bytes apart in the register save
-      // area, we need to collect the two eightbytes together.
-      llvm::Value *RegAddrLo = CGF.Builder.CreateGEP(RegAddr, fp_offset);
-      llvm::Value *RegAddrHi =
-        CGF.Builder.CreateGEP(RegAddrLo,
-                            llvm::ConstantInt::get(CGF.Int32Ty, 16));
-      const llvm::Type *DblPtrTy =
-        llvm::PointerType::getUnqual(DoubleTy);
-      const llvm::StructType *ST = llvm::StructType::get(VMContext, DoubleTy,
-                                                         DoubleTy, NULL);
-      llvm::Value *V, *Tmp = CGF.CreateTempAlloca(ST);
-      V = CGF.Builder.CreateLoad(CGF.Builder.CreateBitCast(RegAddrLo,
-                                                           DblPtrTy));
-      CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 0));
-      V = CGF.Builder.CreateLoad(CGF.Builder.CreateBitCast(RegAddrHi,
-                                                           DblPtrTy));
-      CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1));
-      RegAddr = CGF.Builder.CreateBitCast(Tmp,
-                                          llvm::PointerType::getUnqual(LTy));
-    }
+    assert(neededSSE == 2 && "Invalid number of needed registers!");
+    // SSE registers are spaced 16 bytes apart in the register save
+    // area, we need to collect the two eightbytes together.
+    llvm::Value *RegAddrLo = CGF.Builder.CreateGEP(RegAddr, fp_offset);
+    llvm::Value *RegAddrHi =
+    CGF.Builder.CreateGEP(RegAddrLo,
+                          llvm::ConstantInt::get(CGF.Int32Ty, 16));
+    const llvm::Type *DoubleTy = llvm::Type::getDoubleTy(VMContext);
+    const llvm::Type *DblPtrTy =
+      llvm::PointerType::getUnqual(DoubleTy);
+    const llvm::StructType *ST = llvm::StructType::get(VMContext, DoubleTy,
+                                                       DoubleTy, NULL);
+    llvm::Value *V, *Tmp = CGF.CreateTempAlloca(ST);
+    V = CGF.Builder.CreateLoad(CGF.Builder.CreateBitCast(RegAddrLo,
+                                                         DblPtrTy));
+    CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 0));
+    V = CGF.Builder.CreateLoad(CGF.Builder.CreateBitCast(RegAddrHi,
+                                                         DblPtrTy));
+    CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1));
+    RegAddr = CGF.Builder.CreateBitCast(Tmp,
+                                        llvm::PointerType::getUnqual(LTy));
   }
 
   // AMD64-ABI 3.5.7p5: Step 5. Set:
@@ -1590,11 +1597,14 @@
   ResAddr->reserveOperandSpace(2);
   ResAddr->addIncoming(RegAddr, InRegBlock);
   ResAddr->addIncoming(MemAddr, InMemBlock);
-
   return ResAddr;
 }
 
+
+
+//===----------------------------------------------------------------------===//
 // PIC16 ABI Implementation
+//===----------------------------------------------------------------------===//
 
 namespace {
 
@@ -1727,7 +1737,9 @@
 }
 
 
+//===----------------------------------------------------------------------===//
 // ARM ABI Implementation
+//===----------------------------------------------------------------------===//
 
 namespace {
 
@@ -2043,7 +2055,9 @@
   }
 }
 
+//===----------------------------------------------------------------------===//
 // SystemZ ABI Implementation
+//===----------------------------------------------------------------------===//
 
 namespace {
 
@@ -2127,7 +2141,9 @@
   }
 }
 
+//===----------------------------------------------------------------------===//
 // MSP430 ABI Implementation
+//===----------------------------------------------------------------------===//
 
 namespace {
 
@@ -2164,8 +2180,11 @@
   }
 }
 
+//===----------------------------------------------------------------------===//
 // MIPS ABI Implementation.  This works for both little-endian and
 // big-endian variants.
+//===----------------------------------------------------------------------===//
+
 namespace {
 class MIPSTargetCodeGenInfo : public TargetCodeGenInfo {
 public:





More information about the cfe-commits mailing list