[llvm-commits] [llvm-gcc-4.2] r95422 - /llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 5 11:55:39 PST 2010
Author: lattner
Date: Fri Feb 5 13:55:39 2010
New Revision: 95422
URL: http://llvm.org/viewvc/llvm-project?rev=95422&view=rev
Log:
update alpha backend to new llvm apis, patch by Matt Turner!
Modified:
llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp?rev=95422&r1=95421&r2=95422&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp Fri Feb 5 13:55:39 2010
@@ -29,12 +29,15 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
extern "C" {
#include "toplev.h"
}
+static LLVMContext &Context = getGlobalContext();
+
enum alpha_builtin
{
ALPHA_BUILTIN_CMPBGE,
@@ -105,11 +108,12 @@
case ALPHA_BUILTIN_UMULH: {
Value *Arg0 = Ops[0];
Value *Arg1 = Ops[1];
- Arg0 = Builder.CreateZExt(Arg0, IntegerType::get(128));
- Arg1 = Builder.CreateZExt(Arg1, IntegerType::get(128));
+ Arg0 = Builder.CreateZExt(Arg0, IntegerType::get(Context, 128));
+ Arg1 = Builder.CreateZExt(Arg1, IntegerType::get(Context, 128));
Result = Builder.CreateMul(Arg0, Arg1);
- Result = Builder.CreateLShr(Result, ConstantInt::get(Type::Int64Ty, 64));
- Result = Builder.CreateTrunc(Result, Type::Int64Ty);
+ Result = Builder.CreateLShr(Result, ConstantInt::get(
+ Type::getInt64Ty(Context), 64));
+ Result = Builder.CreateTrunc(Result, Type::getInt64Ty(Context));
return true;
}
case ALPHA_BUILTIN_CMPBGE: {
@@ -117,14 +121,17 @@
Value *Arg1 = Ops[1];
Value* cmps[8];
for (unsigned x = 0; x < 8; ++x) {
- Value* LHS = Builder.CreateLShr(Arg0, ConstantInt::get(Type::Int64Ty, x*8));
- LHS = Builder.CreateTrunc(LHS, Type::Int8Ty);
- Value* RHS = Builder.CreateLShr(Arg1, ConstantInt::get(Type::Int64Ty, x*8));
- RHS = Builder.CreateTrunc(RHS, Type::Int8Ty);
+ Value* LHS = Builder.CreateLShr(Arg0, ConstantInt::get(
+ Type::getInt64Ty(Context), x*8));
+ LHS = Builder.CreateTrunc(LHS, Type::getInt8Ty(Context));
+ Value* RHS = Builder.CreateLShr(Arg1, ConstantInt::get(
+ Type::getInt64Ty(Context), x*8));
+ RHS = Builder.CreateTrunc(RHS, Type::getInt8Ty(Context));
Value* cmps = Builder.CreateICmpUGE(LHS, RHS);
cmps = Builder.CreateIsNotNull(cmps);
- cmps = Builder.CreateZExt(cmps, Type::Int64Ty);
- cmps = Builder.CreateShl(cmps, ConstantInt::get(Type::Int64Ty, x));
+ cmps = Builder.CreateZExt(cmps, Type::getInt64Ty(Context));
+ cmps = Builder.CreateShl(cmps, ConstantInt::get(
+ Type::getInt64Ty(Context), x));
if (x == 0)
Result = cmps;
else
@@ -144,9 +151,11 @@
case ALPHA_BUILTIN_EXTQL: mask = 0xFFFFFFFFFFFFFFFFULL; break;
};
Value *Arg0 = Ops[0];
- Value *Arg1 = Builder.CreateAnd(Ops[1], ConstantInt::get(Type::Int64Ty, 7));
+ Value *Arg1 = Builder.CreateAnd(Ops[1], ConstantInt::get(
+ Type::getInt64Ty(Context), 7));
Arg0 = Builder.CreateLShr(Arg0, Arg1);
- Result = Builder.CreateAnd(Arg0, ConstantInt::get(Type::Int64Ty, mask));
+ Result = Builder.CreateAnd(Arg0, ConstantInt::get(
+ Type::getInt64Ty(Context), mask));
return true;
}
case ALPHA_BUILTIN_EXTWH:
@@ -159,10 +168,13 @@
case ALPHA_BUILTIN_EXTQH: mask = 0xFFFFFFFFFFFFFFFFULL; break;
};
Value *Arg0 = Ops[0];
- Value *Arg1 = Builder.CreateAnd(Ops[1], ConstantInt::get(Type::Int64Ty, 7));
- Arg1 = Builder.CreateSub(ConstantInt::get(Type::Int64Ty, 64), Arg1);
+ Value *Arg1 = Builder.CreateAnd(Ops[1], ConstantInt::get(
+ Type::getInt64Ty(Context), 7));
+ Arg1 = Builder.CreateSub(ConstantInt::get(
+ Type::getInt64Ty(Context), 64), Arg1);
Arg0 = Builder.CreateShl(Arg0, Arg1);
- Result = Builder.CreateAnd(Arg0, ConstantInt::get(Type::Int64Ty, mask));
+ Result = Builder.CreateAnd(Arg0, ConstantInt::get(
+ Type::getInt64Ty(Context), mask));
return true;
}
More information about the llvm-commits
mailing list