~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/utils/TableGen/InstrEnumEmitter.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
//===- InstrEnumEmitter.cpp - Generate Instruction Set Enums --------------===//
 
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
// This tablegen backend is responsible for emitting enums for each machine
 
11
// instruction.
 
12
//
 
13
//===----------------------------------------------------------------------===//
 
14
 
 
15
#include "InstrEnumEmitter.h"
 
16
#include "CodeGenTarget.h"
 
17
#include "Record.h"
 
18
#include <cstdio>
 
19
using namespace llvm;
 
20
 
 
21
// runEnums - Print out enum values for all of the instructions.
 
22
void InstrEnumEmitter::run(raw_ostream &OS) {
 
23
  EmitSourceFileHeader("Target Instruction Enum Values", OS);
 
24
  OS << "namespace llvm {\n\n";
 
25
 
 
26
  CodeGenTarget Target;
 
27
 
 
28
  // We must emit the PHI opcode first...
 
29
  std::string Namespace;
 
30
  for (CodeGenTarget::inst_iterator II = Target.inst_begin(), 
 
31
       E = Target.inst_end(); II != E; ++II) {
 
32
    if (II->second.Namespace != "TargetOpcode") {
 
33
      Namespace = II->second.Namespace;
 
34
      break;
 
35
    }
 
36
  }
 
37
  
 
38
  if (Namespace.empty()) {
 
39
    fprintf(stderr, "No instructions defined!\n");
 
40
    exit(1);
 
41
  }
 
42
 
 
43
  std::vector<const CodeGenInstruction*> NumberedInstructions;
 
44
  Target.getInstructionsByEnumValue(NumberedInstructions);
 
45
 
 
46
  OS << "namespace " << Namespace << " {\n";
 
47
  OS << "  enum {\n";
 
48
  for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
 
49
    OS << "    " << NumberedInstructions[i]->TheDef->getName()
 
50
       << "\t= " << i << ",\n";
 
51
  }
 
52
  OS << "    INSTRUCTION_LIST_END = " << NumberedInstructions.size() << "\n";
 
53
  OS << "  };\n}\n";
 
54
  OS << "} // End llvm namespace \n";
 
55
}