[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:13:21 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 8997b147258c7760a63e38dbeb99eb6fd0c4ba90
Author: Török Edvin <edwin at clamav.net>
Date:   Wed Dec 30 15:08:35 2009 +0200

    bswap.

diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp
index a320b31..ff315f8 100644
--- a/libclamav/c++/bytecode2llvm.cpp
+++ b/libclamav/c++/bytecode2llvm.cpp
@@ -618,6 +618,27 @@ public:
 	FMemcpy->setDoesNotThrow();
 	FMemcpy->setDoesNotCapture(1, true);
 
+	args.clear();
+	args.push_back(Type::getInt16Ty(Context));
+	FunctionType *FuncTy_5 = FunctionType::get(Type::getInt16Ty(Context), args, false);
+	Function *FBSwap16 = Function::Create(FuncTy_5, GlobalValue::ExternalLinkage,
+					      "llvm.bswap.i16", M);
+	FBSwap16->setDoesNotThrow();
+
+	args.clear();
+	args.push_back(Type::getInt32Ty(Context));
+	FunctionType *FuncTy_6 = FunctionType::get(Type::getInt32Ty(Context), args, false);
+	Function *FBSwap32 = Function::Create(FuncTy_6, GlobalValue::ExternalLinkage,
+					      "llvm.bswap.i32", M);
+	FBSwap32->setDoesNotThrow();
+
+	args.clear();
+	args.push_back(Type::getInt64Ty(Context));
+	FunctionType *FuncTy_7 = FunctionType::get(Type::getInt64Ty(Context), args, false);
+	Function *FBSwap64 = Function::Create(FuncTy_7, GlobalValue::ExternalLinkage,
+					      "llvm.bswap.i64", M);
+	FBSwap16->setDoesNotThrow();
+
 	FunctionType* DummyTy = FunctionType::get(Type::getVoidTy(Context), false);
 	Function *FRealMemset = Function::Create(DummyTy, GlobalValue::ExternalLinkage,
 						 "memset", M);
@@ -633,7 +654,7 @@ public:
 	args.push_back(PointerType::getUnqual(Type::getInt8Ty(Context)));
 	args.push_back(PointerType::getUnqual(Type::getInt8Ty(Context)));
 	args.push_back(EE->getTargetData()->getIntPtrType(Context));
-	FunctionType* FuncTy_5 = FunctionType::get(Type::getInt32Ty(Context),
+	FuncTy_5 = FunctionType::get(Type::getInt32Ty(Context),
 						   args, false);
 	Function* FRealMemcmp = Function::Create(FuncTy_5, GlobalValue::ExternalLinkage, "memcmp", M);
 	EE->addGlobalMapping(FRealMemcmp, (void*)(intptr_t)memcmp);
@@ -1087,6 +1108,31 @@ public:
 				unreachable = true;
 			    }
 			    break;
+			case OP_BC_BSWAP16:
+			    {
+				CallInst *C = Builder.CreateCall(FBSwap16, convertOperand(func, inst, inst->u.unaryop));
+				C->setTailCall(true);
+				C->setDoesNotThrow(true);
+				Store(inst->dest, C);
+				break;
+			    }
+			case OP_BC_BSWAP32:
+			    {
+				CallInst *C = Builder.CreateCall(FBSwap32, convertOperand(func, inst, inst->u.unaryop));
+				C->setTailCall(true);
+				C->setDoesNotThrow(true);
+				Store(inst->dest, C);
+				break;
+			    }
+			case OP_BC_BSWAP64:
+			    {
+				CallInst *C = Builder.CreateCall(FBSwap64, convertOperand(func, inst, inst->u.unaryop));
+				C->setTailCall(true);
+				C->setDoesNotThrow(true);
+				Store(inst->dest, C);
+				break;
+			    }
+
 			default:
 			    errs() << MODULE << "JIT doesn't implement opcode " <<
 				inst->opcode << " yet!\n";
diff --git a/libclamav/clambc.h b/libclamav/clambc.h
index 8d98265..1632c98 100644
--- a/libclamav/clambc.h
+++ b/libclamav/clambc.h
@@ -80,6 +80,9 @@ enum bc_opcode {
   OP_BC_MEMCMP,
   OP_BC_ISBIGENDIAN,
   OP_BC_ABORT,
+  OP_BC_BSWAP16,
+  OP_BC_BSWAP32,
+  OP_BC_BSWAP64,
   OP_BC_INVALID /* last */
 };
 
@@ -105,8 +108,8 @@ static const unsigned char operand_counts[] = {
   3, 3, 3, 3,
   /* OP_BC_ISBIGENDIAN */
   0,
-  /* OP_BC_ABORT */
-  0
+  /* OP_BC_ABORT, OP_BSWAP* */
+  0, 1, 1, 1
 };
 
 enum bc_global {

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list