~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/utils/TableGen/TGValueTypes.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- ValueTypes.cpp - Tablegen extended ValueType implementation --------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// The EVT type is used by tablegen as well as in LLVM. In order to handle
 
11
// extended types, the EVT type uses support functions that call into
 
12
// LLVM's type system code. These aren't accessible in tablegen, so this
 
13
// file provides simple replacements.
 
14
//
 
15
//===----------------------------------------------------------------------===//
 
16
 
 
17
#include "llvm/CodeGen/ValueTypes.h"
 
18
#include <map>
 
19
#include <vector>
 
20
using namespace llvm;
 
21
 
 
22
namespace llvm {
 
23
 
 
24
class Type {
 
25
public:
 
26
  virtual unsigned getSizeInBits() const = 0;
 
27
  virtual ~Type() {}
 
28
};
 
29
 
 
30
}
 
31
 
 
32
class ExtendedIntegerType : public Type {
 
33
  unsigned BitWidth;
 
34
public:
 
35
  explicit ExtendedIntegerType(unsigned bits)
 
36
    : BitWidth(bits) {}
 
37
  unsigned getSizeInBits() const {
 
38
    return getBitWidth();
 
39
  }
 
40
  unsigned getBitWidth() const {
 
41
    return BitWidth;
 
42
  }
 
43
};
 
44
 
 
45
class ExtendedVectorType : public Type {
 
46
  EVT ElementType;
 
47
  unsigned NumElements;
 
48
public:
 
49
  ExtendedVectorType(EVT elty, unsigned num)
 
50
    : ElementType(elty), NumElements(num) {}
 
51
  unsigned getSizeInBits() const {
 
52
    return getNumElements() * getElementType().getSizeInBits();
 
53
  }
 
54
  EVT getElementType() const {
 
55
    return ElementType;
 
56
  }
 
57
  unsigned getNumElements() const {
 
58
    return NumElements;
 
59
  }
 
60
};
 
61
 
 
62
static std::map<unsigned, const Type *>
 
63
  ExtendedIntegerTypeMap;
 
64
static std::map<std::pair<uintptr_t, uintptr_t>, const Type *>
 
65
  ExtendedVectorTypeMap;
 
66
 
 
67
bool EVT::isExtendedFloatingPoint() const {
 
68
  assert(isExtended() && "Type is not extended!");
 
69
  // Extended floating-point types are not supported yet.
 
70
  return false;
 
71
}
 
72
 
 
73
bool EVT::isExtendedInteger() const {
 
74
  assert(isExtended() && "Type is not extended!");
 
75
  return dynamic_cast<const ExtendedIntegerType *>(LLVMTy) != 0;
 
76
}
 
77
 
 
78
bool EVT::isExtendedVector() const {
 
79
  assert(isExtended() && "Type is not extended!");
 
80
  return dynamic_cast<const ExtendedVectorType *>(LLVMTy) != 0;
 
81
}
 
82
 
 
83
bool EVT::isExtended64BitVector() const {
 
84
  assert(isExtended() && "Type is not extended!");
 
85
  return isExtendedVector() && getSizeInBits() == 64;
 
86
}
 
87
 
 
88
bool EVT::isExtended128BitVector() const {
 
89
  assert(isExtended() && "Type is not extended!");
 
90
  return isExtendedVector() && getSizeInBits() == 128;
 
91
}
 
92
 
 
93
EVT EVT::getExtendedVectorElementType() const {
 
94
  assert(isExtendedVector() && "Type is not an extended vector!");
 
95
  return static_cast<const ExtendedVectorType *>(LLVMTy)->getElementType();
 
96
}
 
97
 
 
98
unsigned EVT::getExtendedVectorNumElements() const {
 
99
  assert(isExtendedVector() && "Type is not an extended vector!");
 
100
  return static_cast<const ExtendedVectorType *>(LLVMTy)->getNumElements();
 
101
}
 
102
 
 
103
unsigned EVT::getExtendedSizeInBits() const {
 
104
  assert(isExtended() && "Type is not extended!");
 
105
  return LLVMTy->getSizeInBits();
 
106
}