[llvm-commits] CVS: llvm/include/llvm/Support/LLVMBuilder.h
Changes in directory llvm/include/llvm/Support: LLVMBuilder.h added (r1.1) --- Log message: Add a new LLVMBuilder class, which makes it simpler and more uniform to create large amounts of instructions by separating the insertion point logic from the logic of what to create. --- Diffs of the changes: (+431 -0) LLVMBuilder.h | 431 ++ 1 files changed, 431 insertions(+) Index: llvm/include/llvm/Support/LLVMBuilder.h diff -c /dev/null llvm/include/llvm/Support/LLVMBuilder.h:1.1 *** /dev/null Sun May 27 10:09:44 2007 --- llvm/include/llvm/Support/LLVMBuilder.h Sun May 27 10:09:34 2007 *** *** 0 --- 1,431 + //===-- llvm/Support/LLVMBuilder.h - Builder for LLVM Instrs *- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===--===// + // + // This file defines the LLVMBuilder class, which is used as a convenient way + // to create LLVM instructions with a consistent and simplified interface. + // + //===--===// + + #ifndef LLVM_SUPPORT_LLVMBUILDER_H + #define LLVM_SUPPORT_LLVMBUILDER_H + + #include "llvm/BasicBlock.h" + #include "llvm/Instructions.h" + + namespace llvm { + + /// LLVMBuilder - This provides a uniform API for creating instructions and + /// inserting them into a basic block: either at the end of a BasicBlock, or + /// at a specific iterator location in a block. + /// + /// Note that the builder does not expose the full generality of LLVM + /// instructions. For example, it cannot be used to create instructions with + /// arbitrary names (specifically, names with nul characters in them) - It only + /// supports nul-terminated C strings. For fully generic names, use + /// I->setName(). For access to extra instruction properties, use the mutators + /// (e.g. setVolatile) on the instructions after they have been created. + class LLVMBuilder { + BasicBlock *BB; + BasicBlock::iterator InsertPt; + public: + LLVMBuilder() { ClearInsertionPoint(); } + explicit LLVMBuilder(BasicBlock *TheBB) { SetInsertPoint(TheBB); } + LLVMBuilder(BasicBlock *TheBB, BasicBlock::iterator IP) { + SetInsertPoint(TheBB, IP); + } + + //======// + // Builder configuration methods + //======// + + /// ClearInsertionPoint - Clear the insertion point: created instructions will + /// not be inserted into a block. + void ClearInsertionPoint() { + BB = 0; + } + + BasicBlock *GetInsertBlock() const { return BB; } + + /// SetInsertPoint - This specifies that created instructions should be + /// appended to the end of the specified block. + void SetInsertPoint(BasicBlock *TheBB) { + BB = TheBB; + InsertPt = BB->end(); + } + + /// SetInsertPoint - This specifies that created instructions should be + /// inserted at the specified point. + void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) { + BB = TheBB; + InsertPt = IP; + } + + /// Insert - Insert and return the specified instruction. + template + InstTy *Insert(InstTy *I) const { + InsertHelper(I); + return I; + } + + /// InsertHelper - Insert the specified instruction at the specified insertion + /// point. This is split out of Insert so that it isn't duplicated for every + /// template instantiation. + void InsertHelper(Instruction *I) const { + if (BB) BB->getInstList().insert(InsertPt, I); + } + + //======// + // Instruction creation methods: Terminators + //======// + + /// CreateRetVoid - Create a 'ret void' instruction. + ReturnInst *CreateRetVoid() { + return Insert(new ReturnInst()); + } + + /// CreateRet - Create a 'ret ' instruction. + ReturnInst *CreateRet(Value *V) { + return Insert(new ReturnInst(V)); + } + + /// CreateBr - Create an unconditional 'br label X' instruction. + BranchInst *CreateBr(BasicBlock *Dest) { + return Insert(new BranchInst(Dest)); + } + + /// CreateCondBr - Create a conditional 'br Cond, TrueDest, FalseDest' + /// instruction. + BranchInst *CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False) { + return Insert(new BranchInst(True, False, Cond)); + } + + /// CreateSwitch - Create a switch instruction with the specified value, + /// default dest, and with a hint for the number of cases that will be added + /// (for efficient allocation). + Switc
[llvm-commits] [127733] Simplify code by using Intrinsic::getDeclaration.
Revision: 127733 Author: clattner Date: 2007-05-27 08:27:26 -0700 (Sun, 27 May 2007) Log Message: --- Simplify code by using Intrinsic::getDeclaration. Modified Paths: -- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp === --- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-05-27 15:11:20 UTC (rev 127732) +++ apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-05-27 15:27:26 UTC (rev 127733) @@ -101,11 +101,8 @@ return true; } case IX86_BUILTIN_PSLLDI128: { -VectorType *v4i32 = VectorType::get(Type::Int32Ty, 4); -static Constant *pslld = 0; -if (pslld == 0) - pslld = TheModule->getOrInsertFunction("llvm.x86.sse2.psll.d", - v4i32, v4i32, v4i32, NULL); +Function *pslld + = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_d); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); Result = Builder.CreateCall(pslld, Ops[0], Ops[1], "tmp"); @@ -113,24 +110,16 @@ return true; } case IX86_BUILTIN_PSLLQI: { -VectorType *v2i32 = VectorType::get(Type::Int32Ty, 2); -static Constant *psllq = 0; -if (psllq == 0) - psllq = TheModule->getOrInsertFunction("llvm.x86.mmx.psll.q", - v2i32, v2i32, v2i32, NULL); -Value *Undef = UndefValue::get(Type::Int32Ty); -Ops[1] = BuildVector(Ops[1], Undef, NULL); +Function *psllq = + Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psll_q); +Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psllq, Ops[0], Ops[1], "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_PSLLQI128: { -VectorType *v4i32 = VectorType::get(Type::Int32Ty, 4); -VectorType *v2i64 = VectorType::get(Type::Int64Ty, 2); -static Constant *psllq = 0; -if (psllq == 0) - psllq = TheModule->getOrInsertFunction("llvm.x86.sse2.psll.q", - v2i64, v2i64, v4i32, NULL); +Function *psllq = + Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_q); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); Result = Builder.CreateCall(psllq, Ops[0], Ops[1], "tmp"); @@ -138,25 +127,16 @@ return true; } case IX86_BUILTIN_PSRLWI: { -VectorType *v2i32 = VectorType::get(Type::Int32Ty, 2); -VectorType *v4i16 = VectorType::get(Type::Int16Ty, 4); -static Constant *psrlw = 0; -if (psrlw == 0) - psrlw = TheModule->getOrInsertFunction("llvm.x86.mmx.psrl.w", - v4i16, v4i16, v2i32, NULL); -Value *Undef = UndefValue::get(Type::Int32Ty); -Ops[1] = BuildVector(Ops[1], Undef, NULL); +Function *psrlw = + Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_w); +Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psrlw, Ops[0], Ops[1], "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_PSRLWI128: { -VectorType *v4i32 = VectorType::get(Type::Int32Ty, 4); -VectorType *v8i16 = VectorType::get(Type::Int16Ty, 8); -static Constant *psrlw = 0; -if (psrlw == 0) - psrlw = TheModule->getOrInsertFunction("llvm.x86.sse2.psrl.w", - v8i16, v8i16, v4i32, NULL); +Function *psrlw = + Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_w); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); Result = Builder.CreateCall(psrlw, Ops[0], Ops[1], "tmp"); @@ -164,23 +144,16 @@ return true; } case IX86_BUILTIN_PSRLDI: { -VectorType *v2i32 = VectorType::get(Type::Int32Ty, 2); -static Constant *psrld = 0; -if (psrld == 0) - psrld = TheModule->getOrInsertFunction("llvm.x86.mmx.psrl.d", - v2i32, v2i32, v2i32, NULL); -Value *Undef = UndefValue::get(Type::Int32Ty); -Ops[1] = BuildVector(Ops[1], Undef, NULL); +Function *psrld = + Intrinsic::getDeclaration(TheModule, Intrinsic::x86_mmx_psrl_d); +Ops[1] = BuildVector(Ops[1], UndefValue::get(Type::Int32Ty), NULL); Result = Builder.CreateCall(psrld, Ops[0], Ops[1], "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; } case IX86_BUILTIN_PSRLDI128: { -VectorType *v4i32 = VectorType::get(Type::Int32Ty, 4); -static Constant *psrld = 0; -if (psrld == 0) - psrld = TheModu
[llvm-commits] [127734] simplify code by factoring it a bit better.
Revision: 127734 Author: clattner Date: 2007-05-27 08:33:17 -0700 (Sun, 27 May 2007) Log Message: --- simplify code by factoring it a bit better. Modified Paths: -- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp === --- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-05-27 15:27:26 UTC (rev 127733) +++ apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-05-27 15:33:17 UTC (rev 127734) @@ -241,11 +241,13 @@ case IX86_BUILTIN_XORPD: case IX86_BUILTIN_ANDNPD: if (cast(ResultType)->getNumElements() == 4) // v4f32 - Ops[0] = new BitCastInst(Ops[0], VectorType::get (Type::Int32Ty, 4),"tmp"); + Ops[0] = Builder.CreateBitCast(Ops[0], VectorType::get (Type::Int32Ty, 4), + "tmp"); else // v2f64 - Ops[0] = new BitCastInst(Ops[0], VectorType::get (Type::Int64Ty, 2),"tmp"); + Ops[0] = Builder.CreateBitCast(Ops[0], VectorType::get (Type::Int64Ty, 2), + "tmp"); -Ops[1] = new BitCastInst(Ops[1], Ops[0]->getType(), "tmp"); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); switch (FnCode) { case IX86_BUILTIN_ANDPS: Result = Builder.CreateAnd(Ops[0], Ops[1], "tmp"); @@ -496,33 +498,19 @@ case IX86_BUILTIN_CMPUNORDSS: { Function *cmpss = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_cmp_ss); -Value *Pred = 0; +unsigned PredCode; switch (FnCode) { -case IX86_BUILTIN_CMPEQSS: - Pred = ConstantInt::get(Type::Int8Ty, 0); - break; -case IX86_BUILTIN_CMPLTSS: - Pred = ConstantInt::get(Type::Int8Ty, 1); - break; -case IX86_BUILTIN_CMPLESS: - Pred = ConstantInt::get(Type::Int8Ty, 2); - break; -case IX86_BUILTIN_CMPUNORDSS: - Pred = ConstantInt::get(Type::Int8Ty, 3); - break; -case IX86_BUILTIN_CMPNEQSS: - Pred = ConstantInt::get(Type::Int8Ty, 4); - break; -case IX86_BUILTIN_CMPNLTSS: - Pred = ConstantInt::get(Type::Int8Ty, 5); - break; -case IX86_BUILTIN_CMPNLESS: - Pred = ConstantInt::get(Type::Int8Ty, 6); - break; -case IX86_BUILTIN_CMPORDSS: - Pred = ConstantInt::get(Type::Int8Ty, 7); - break; +default: assert(0 && "Unknown fncode"); +case IX86_BUILTIN_CMPEQSS:PredCode = 0; break; +case IX86_BUILTIN_CMPLTSS:PredCode = 1; break; +case IX86_BUILTIN_CMPLESS:PredCode = 2; break; +case IX86_BUILTIN_CMPUNORDSS: PredCode = 3; break; +case IX86_BUILTIN_CMPNEQSS: PredCode = 4; break; +case IX86_BUILTIN_CMPNLTSS: PredCode = 5; break; +case IX86_BUILTIN_CMPNLESS: PredCode = 6; break; +case IX86_BUILTIN_CMPORDSS: PredCode = 7; break; } +Value *Pred = ConstantInt::get(Type::Int8Ty, PredCode); Value *CallOps[3] = { Ops[0], Ops[1], Pred }; Result = Builder.CreateCall(cmpss, CallOps, 3, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); @@ -543,49 +531,23 @@ Function *cmppd = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_cmp_pd); bool flip = false; -Value *Pred = 0; +unsigned PredCode; switch (FnCode) { - case IX86_BUILTIN_CMPEQPD: -Pred = ConstantInt::get(Type::Int8Ty, 0); -break; - case IX86_BUILTIN_CMPLTPD: -Pred = ConstantInt::get(Type::Int8Ty, 1); -break; - case IX86_BUILTIN_CMPGTPD: -Pred = ConstantInt::get(Type::Int8Ty, 1); -flip = true; -break; - case IX86_BUILTIN_CMPLEPD: -Pred = ConstantInt::get(Type::Int8Ty, 2); -break; - case IX86_BUILTIN_CMPGEPD: -Pred = ConstantInt::get(Type::Int8Ty, 2); -flip = true; -break; - case IX86_BUILTIN_CMPUNORDPD: -Pred = ConstantInt::get(Type::Int8Ty, 3); -break; - case IX86_BUILTIN_CMPNEQPD: -Pred = ConstantInt::get(Type::Int8Ty, 4); -break; - case IX86_BUILTIN_CMPNLTPD: -Pred = ConstantInt::get(Type::Int8Ty, 5); -break; - case IX86_BUILTIN_CMPNGTPD: -Pred = ConstantInt::get(Type::Int8Ty, 5); -flip = true; -break; - case IX86_BUILTIN_CMPNLEPD: -Pred = ConstantInt::get(Type::Int8Ty, 6); -break; - case IX86_BUILTIN_CMPNGEPD: -Pred = ConstantInt::get(Type::Int8Ty, 6); -flip = true; -break; - case IX86_BUILTIN_CMPORDPD: -Pred = ConstantInt::get(Type::Int8Ty, 7); -break; +default: assert(0 && "Unknown fncode!"); +case IX86_BUILTIN_CMPEQPD:PredCode = 0; break; +case IX86_BUILTIN_CMPLTPD:PredCode = 1; break; +case IX86_BUILTIN_CMPGTPD:PredCode = 1; flip = true; break; +case IX86_BUILTIN_
[llvm-commits] [127735] simplify this code through the use of Intrinsic::getDeclaration
Revision: 127735 Author: clattner Date: 2007-05-27 08:51:11 -0700 (Sun, 27 May 2007) Log Message: --- simplify this code through the use of Intrinsic::getDeclaration Modified Paths: -- apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp Modified: apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp === --- apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-05-27 15:33:17 UTC (rev 127734) +++ apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-05-27 15:51:11 UTC (rev 127735) @@ -34,30 +34,19 @@ #include "toplev.h" } -/* MergeIntPtrOperand - This merges the int and pointer operands of a GCC - * intrinsic into a single operand for the LLVM intrinsic. For example, this - * turns LVX(4, p) -> llvm.lvx(gep P, 4). OPNUM specifies the operand number - * of the integer to contract with its following pointer and NAME specifies the - * name of the resultant intrinsic. - */ -static void MergeIntPtrOperand(TreeToLLVM *TTL, Constant *&Cache, - unsigned OpNum, const char *Name, +// MergeIntPtrOperand - This merges the int and pointer operands of a GCC +// intrinsic into a single operand for the LLVM intrinsic. For example, this +// turns LVX(4, p) -> llvm.lvx(gep P, 4). OPNUM specifies the operand number +// of the integer to contract with its following pointer and NAME specifies the +// name of the resultant intrinsic. +static void MergeIntPtrOperand(TreeToLLVM *TTL, + unsigned OpNum, Intrinsic::ID IID, const Type *ResultType, std::vector &Ops, LLVMBuilder &Builder, Value *&Result) { const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); - if (!Cache) { -std::vector ArgTys; -for (unsigned i = 0, e = Ops.size(); i != e; ++i) - ArgTys.push_back(Ops[i]->getType()); - -ArgTys.erase(ArgTys.begin() + OpNum); -ArgTys[OpNum] = VoidPtrTy; -FunctionType *FT = FunctionType::get(ResultType, ArgTys, false); -Module *M = Builder.GetInsertBlock()->getParent()->getParent(); -Cache = M->getOrInsertFunction(Name, FT); - } + Function *IntFn = Intrinsic::getDeclaration(TheModule, IID); Value *Offset = Ops[OpNum]; Value *Ptr = Ops[OpNum + 1]; @@ -68,7 +57,7 @@ Ops.erase(Ops.begin() + OpNum); Ops[OpNum] = Ptr; - Value *V = Builder.CreateCall(Cache, &Ops[0], Ops.size()); + Value *V = Builder.CreateCall(IntFn, &Ops[0], Ops.size()); if (V->getType() != Type::VoidTy) { V->setName("tmp"); @@ -76,9 +65,8 @@ } } -/* GetAltivecTypeNumFromType - Given an LLVM type, return a unique ID for - * the type in the range 0-3. - */ +// GetAltivecTypeNumFromType - Given an LLVM type, return a unique ID for +// the type in the range 0-3. static int GetAltivecTypeNumFromType(const Type *Ty) { return ((Ty == Type::Int32Ty) ? 0 : \ ((Ty == Type::Int16Ty) ? 1 : \ @@ -86,20 +74,10 @@ ((Ty == Type::FloatTy) ? 3 : -1; } -/* GetAltivecLetterFromType - Given an LLVM type, return the altivec letter - * for the type, e.g. int -> w. - */ -static char GetAltivecLetterFromType(const Type *Ty) { - return ((Ty == Type::Int32Ty) ? 'w' : - ((Ty == Type::Int16Ty) ? 'h' : - ((Ty == Type::Int8Ty) ? 'b' : -((Ty == Type::FloatTy) ? 'f' : 'x'; -} - -/* TargetIntrinsicLower - To handle builtins, we want to expand the - * invocation into normal LLVM code. If the target can handle the builtin, this - * function should emit the expanded code and return true. - */ +// TargetIntrinsicLower - To handle builtins, we want to expand the +//invocation into normal LLVM code. If the target can handle the builtin, this +//function should emit the expanded code and return true. +// bool TreeToLLVM::TargetIntrinsicLower(tree exp, unsigned FnCode, Value *DestLoc, @@ -137,77 +115,53 @@ case ALTIVEC_BUILTIN_VXOR: Result = Builder.CreateXor(Ops[0], Ops[1], "tmp"); return true; - case ALTIVEC_BUILTIN_LVSL: { - static Constant *Cache = NULL; - MergeIntPtrOperand(this, Cache, 0, "llvm.ppc.altivec.lvsl", - ResultType, Ops, Builder, Result); -} + case ALTIVEC_BUILTIN_LVSL: +MergeIntPtrOperand(this, 0, Intrinsic::ppc_altivec_lvsl, + ResultType, Ops, Builder, Result); return true; - case ALTIVEC_BUILTIN_LVSR: { - static Constant *Cache = NULL; - MergeIntPtrOperand(this, Cache, 0, "llvm.ppc.altivec.lvsr", - ResultType, Ops, Builder, Result); -} + case ALTIVEC_BUILTIN_LVSR: +MergeIntPtrOperand(this, 0, Intrinsic::ppc_altivec_lvsr, + ResultType, Ops, Builder, Result); return true; - case AL
[llvm-commits] [127736] Minor cleanups, get this compiling again
Revision: 127736 Author: clattner Date: 2007-05-27 09:01:01 -0700 (Sun, 27 May 2007) Log Message: --- Minor cleanups, get this compiling again Modified Paths: -- apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp Modified: apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp === --- apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-05-27 15:51:11 UTC (rev 127735) +++ apple-local/branches/llvm/gcc/config/rs6000/llvm-rs6000.cpp 2007-05-27 16:01:01 UTC (rev 127736) @@ -139,7 +139,7 @@ MergeIntPtrOperand(this, 0, Intrinsic::ppc_altivec_lvehx, ResultType, Ops, Builder, Result); return true; - case ALTIVEC_BUILTIN_LVEWX: { + case ALTIVEC_BUILTIN_LVEWX: MergeIntPtrOperand(this, 0, Intrinsic::ppc_altivec_lvewx, ResultType, Ops, Builder, Result); return true; @@ -155,7 +155,7 @@ MergeIntPtrOperand(this, 1, Intrinsic::ppc_altivec_stvehx, ResultType, Ops, Builder, Result); return true; - case ALTIVEC_BUILTIN_STVEWX: { + case ALTIVEC_BUILTIN_STVEWX: MergeIntPtrOperand(this, 1, Intrinsic::ppc_altivec_stvewx, ResultType, Ops, Builder, Result); return true; @@ -229,8 +229,8 @@ /* Map all of these to a shuffle. */ unsigned Amt = Elt->getZExtValue() & 15; VectorType *v16i8 = VectorType::get(Type::Int8Ty, 16); - Ops[0] = Builder.CreateBitCast(Op0, v16i8, "tmp"); - Ops[1] = Builder.CreateBitCast(Op1, v16i8, "tmp"); + Ops[0] = Builder.CreateBitCast(Ops[0], v16i8, "tmp"); + Ops[1] = Builder.CreateBitCast(Ops[1], v16i8, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], Amt, Amt+1, Amt+2, Amt+3, Amt+4, Amt+5, Amt+6, Amt+7, @@ -241,23 +241,17 @@ Result = Ops[0]; } return true; - case ALTIVEC_BUILTIN_VPKUHUM: { -Value *Op0 = Ops[0]; -Ops[0] = Builder.CreateBitCast(Op0, ResultType, Op0->getName ().c_str()); -Value *Op1 = Ops[1]; -Ops[1] = Builder.CreateBitCast(Op1, ResultType, Op1->getName ().c_str()); + case ALTIVEC_BUILTIN_VPKUHUM: +Ops[0] = Builder.CreateBitCast(Ops[0], ResultType, "tmp"); +Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31); return true; - } - case ALTIVEC_BUILTIN_VPKUWUM: { -Value *Op0 = Ops[0]; -Ops[0] = Builder.CreateBitCast(Op0, ResultType, Op0->getName ().c_str()); -Value *Op1 = Ops[1]; -Ops[1] = Builder.CreateBitCast(Op1, ResultType, Op1->getName()); + case ALTIVEC_BUILTIN_VPKUWUM: +Ops[0] = Builder.CreateBitCast(Ops[0], ResultType, "tmp"); +Ops[1] = Builder.CreateBitCast(Ops[1], ResultType, "tmp"); Result = BuildVectorShuffle(Ops[0], Ops[1], 1, 3, 5, 7, 9, 11, 13, 15); return true; - } case ALTIVEC_BUILTIN_VMRGHB: Result = BuildVectorShuffle(Ops[0], Ops[1], 0, 16, 1, 17, 2, 18, 3, 19, @@ -295,7 +289,7 @@ case ALTIVEC_BUILTIN_ABS_V16QI: { // iabs(x) -> smax(x, 0-x) Result = Builder.CreateNeg(Ops[0], "tmp"); // get the right smax intrinsic. -static const unsigned smax_iid[3] = { +static const Intrinsic::ID smax_iid[3] = { Intrinsic::ppc_altivec_vmaxsw, Intrinsic::ppc_altivec_vmaxsh, Intrinsic::ppc_altivec_vmaxsb @@ -310,18 +304,17 @@ case ALTIVEC_BUILTIN_ABSS_V8HI: case ALTIVEC_BUILTIN_ABSS_V16QI: { // iabss(x) -> smax(x, satsub (0,x)) // get the right smax/subs intrinsics. -static const unsigned smax_iid[3] = { +static const Intrinsic::ID smax_iid[3] = { Intrinsic::ppc_altivec_vmaxsw, Intrinsic::ppc_altivec_vmaxsh, Intrinsic::ppc_altivec_vmaxsb }; -static const unsigned subss_iid[3] = { +static const Intrinsic::ID subss_iid[3] = { Intrinsic::ppc_altivec_vsubsws, Intrinsic::ppc_altivec_vsubshs, Intrinsic::ppc_altivec_vsubsbs }; -static Constant *sxs[3], *smax[3]; // get the right satsub intrinsic. const VectorType *PTy = cast(ResultType); unsigned N = GetAltivecTypeNumFromType(PTy->getElementType()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] Regalloc Refactoring
Evan Cheng wrote: > That's fine. Please check in what you have now after you've merged in > the recent changes. I don't have write access to the repository. :-/ I'd gladly do the update merge and commit if someone wants to grant me access. Thanks for getting this in. As soon as I wrap up my regalloc work here I'll be tacking a coalescer, among other things. -Dave ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [127737] test commit
Revision: 127737 Author: clattner Date: 2007-05-27 15:18:27 -0700 (Sun, 27 May 2007) Log Message: --- test commit Modified Paths: -- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp === --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-27 16:01:01 UTC (rev 127736) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-27 22:18:27 UTC (rev 127737) @@ -74,6 +74,7 @@ // than the LLVM Value pointer while usig PCH. // Collection of LLVM Values + static std::vector LLVMValues; typedef DenseMap LLVMValuesMapTy; static LLVMValuesMapTy LLVMValuesMap; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [127738] Checking svn messages
Revision: 127738 Author: bwendlin Date: 2007-05-27 15:18:57 -0700 (Sun, 27 May 2007) Log Message: --- Checking svn messages Modified Paths: -- apple-local/branches/llvm/README.LLVM Modified: apple-local/branches/llvm/README.LLVM === --- apple-local/branches/llvm/README.LLVM 2007-05-27 22:18:27 UTC (rev 127737) +++ apple-local/branches/llvm/README.LLVM 2007-05-27 22:18:57 UTC (rev 127738) @@ -146,4 +146,3 @@ ** NOTE: If the -v line above doesn't include "LLVM", you probably mistyped the --enable-llvm=xxx line and have a normal gcc, not an llvm-gcc. - ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c multiple_assign.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: multiple_assign.c updated: 1.2 -> 1.3 multiple_assign.reference_output updated: 1.1 -> 1.2 --- Log message: Enhance this test case. --- Diffs of the changes: (+60 -3) multiple_assign.c| 47 +-- multiple_assign.reference_output | 16 - 2 files changed, 60 insertions(+), 3 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c diff -u llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c:1.2 llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c:1.2 Thu May 17 00:15:12 2007 +++ llvm-test/SingleSource/UnitTests/Integer/multiple_assign.c Sun May 27 21:29:57 2007 @@ -1,8 +1,51 @@ #include "bits.h" int main(int argc, char**argv) { - int69 X; + int54 X; int169 Y; - X = Y = 0; + uint250 Z = 0; + int250 K; + uint250 U = 0; + + X = Y = Z = K = -1; + U = -1; + printf("int54 X = "); + printBits(X); + printf("\nint169 Y = "); + printBits(Y); + printf("\nuint250 Z = "); + printBits(Z); + printf("\nuint250 U = "); + printBits(U); + printf("\nint250 K = "); + printBits(K); + printf("\n"); + + K = Y = Z = X = -1; + printf("int54 X = "); + printBits(X); + printf("\nint169 Y = "); + printBits(Y); + printf("\nuint250 Z = "); + printBits(Z); + printf("\nuint250 U = "); + printBits(U); + printf("\nint250 K = "); + printBits(K); + printf("\n"); + + X = Y = Z = K = U = -1; + printf("int54 X = "); + printBits(X); + printf("\nint169 Y = "); + printBits(Y); + printf("\nuint250 Z = "); + printBits(Z); + printf("\nuint250 U = "); + printBits(U); + printf("\nint250 K = "); + printBits(K); + printf("\n"); + return X; } Index: llvm-test/SingleSource/UnitTests/Integer/multiple_assign.reference_output diff -u llvm-test/SingleSource/UnitTests/Integer/multiple_assign.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/multiple_assign.reference_output:1.2 --- llvm-test/SingleSource/UnitTests/Integer/multiple_assign.reference_output:1.1 Thu May 17 01:47:06 2007 +++ llvm-test/SingleSource/UnitTests/Integer/multiple_assign.reference_output Sun May 27 21:29:57 2007 @@ -1 +1,15 @@ -exit 0 +int54 X = 11 +int169 Y = 1 +uint250 Z = 11 +uint250 U = 11 +int250 K = 11 +int54 X = 11 +int169 Y = 1 +uint250 Z = 11 +uint250 U = 11 +int250 K = 11 +int54 X = 11 +int169 Y = 1 +uint250 Z = 11
[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.c integer_all_onesp.reference_output
Changes in directory llvm-test/SingleSource/UnitTests/Integer: integer_all_onesp.c added (r1.1) integer_all_onesp.reference_output added (r1.1) --- Log message: Add a new test case. --- Diffs of the changes: (+10 -0) integer_all_onesp.c|9 + integer_all_onesp.reference_output |1 + 2 files changed, 10 insertions(+) Index: llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.c diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.c:1.1 *** /dev/null Sun May 27 21:34:54 2007 --- llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.cSun May 27 21:34:44 2007 *** *** 0 --- 1,9 + #include "bits.h" + + int main(int argc, char **argv) { + typedef uint256 BitType; + + BitType X = rand() % bitwidthof(BitType); + + return 0; + } Index: llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.reference_output diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.reference_output:1.1 *** /dev/null Sun May 27 21:35:13 2007 --- llvm-test/SingleSource/UnitTests/Integer/integer_all_onesp.reference_output Sun May 27 21:34:44 2007 *** *** 0 --- 1 + exit 0 ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits