LLVM API Documentation

CPPBackend.cpp File Reference

#include "CPPTargetMachine.h"
#include "llvm/CallingConv.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instruction.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Config/config.h"
#include <algorithm>
#include <set>

Include dependency graph for CPPBackend.cpp:

Go to the source code of this file.

Defines

#define HANDLE_ATTR(X)

Typedefs

typedef std::vector< const Type * > TypeList
typedef std::map< const Type
*, std::string > 
TypeMap
typedef std::map< const Value
*, std::string > 
ValueMap
typedef std::set< std::string > NameSet
typedef std::set< const Type * > TypeSet
typedef std::set< const Value * > ValueSet
typedef std::map< const Value
*, std::string > 
ForwardRefMap

Enumerations

enum  WhatToGenerate {
  GenProgram, GenModule, GenContents, GenFunction,
  GenFunctions, GenInline, GenVariable, GenType
}

Functions

raw_ostream & nl (raw_ostream &Out, int delta=0)
void in ()
void out ()
void sanitize (std::string &str)
std::string getTypePrefix (const Type *Ty)
const std::string * findTypeName (const TypeSymbolTable &ST, const Type *Ty)

Variables

static cl::opt< std::string > FuncName ("cppfname", cl::desc("Specify the name of the generated function"), cl::value_desc("function name"))
static cl::opt< WhatToGenerate > GenerationType ("cppgen", cl::Optional, cl::desc("Choose what kind of output to generate"), cl::init(GenProgram), cl::values(clEnumValN(GenProgram,"program","Generate a complete program"), clEnumValN(GenModule,"module","Generate a module definition"), clEnumValN(GenContents,"contents","Generate contents of a module"), clEnumValN(GenFunction,"function","Generate a function definition"), clEnumValN(GenFunctions,"functions","Generate all function definitions"), clEnumValN(GenInline,"inline","Generate an inline function"), clEnumValN(GenVariable,"variable","Generate a variable definition"), clEnumValN(GenType,"type","Generate a type definition"), clEnumValEnd))
static cl::opt< std::string > NameToGenerate ("cppfor", cl::Optional, cl::desc("Specify the name of the thing to generate"), cl::init("!bad!"))
int CppBackendTargetMachineModule = 0
static RegisterTarget
< CPPTargetMachine > 
X ("cpp","C++ backend")
static unsigned indent_level = 0


Define Documentation

#define HANDLE_ATTR ( X   ) 

Value:

if (attrs & Attribute::X)      \
          Out << " | Attribute::" #X;  \
        attrs &= ~Attribute::X;


Typedef Documentation

typedef std::map<const Value*,std::string> ForwardRefMap [static]

Definition at line 92 of file CPPBackend.cpp.

typedef std::set<std::string> NameSet [static]

Definition at line 89 of file CPPBackend.cpp.

typedef std::vector<const Type*> TypeList [static]

Definition at line 86 of file CPPBackend.cpp.

typedef std::map<const Type*,std::string> TypeMap [static]

Definition at line 87 of file CPPBackend.cpp.

typedef std::set<const Type*> TypeSet [static]

Definition at line 90 of file CPPBackend.cpp.

typedef std::map<const Value*,std::string> ValueMap [static]

Definition at line 88 of file CPPBackend.cpp.

typedef std::set<const Value*> ValueSet [static]

Definition at line 91 of file CPPBackend.cpp.


Enumeration Type Documentation

Enumerator:
GenProgram 
GenModule 
GenContents 
GenFunction 
GenFunctions 
GenInline 
GenVariable 
GenType 

Definition at line 43 of file CPPBackend.cpp.


Function Documentation

const std::string* @797::findTypeName ( const TypeSymbolTable &  ST,
const Type *  Ty 
) [inline, static]

Definition at line 211 of file CPPBackend.cpp.

References llvm::TypeSymbolTable::begin(), and llvm::TypeSymbolTable::end().

std::string @797::getTypePrefix ( const Type *  Ty  )  [inline, static]

Definition at line 186 of file CPPBackend.cpp.

References llvm::Type::getTypeID(), and llvm::utostr().

void @797::in (  )  [inline, static]

Definition at line 175 of file CPPBackend.cpp.

References indent_level.

raw_ostream& @797::nl ( raw_ostream &  Out,
int  delta = 0 
) [inline, static]

Definition at line 166 of file CPPBackend.cpp.

References indent_level.

void @797::out (  )  [inline, static]

Definition at line 176 of file CPPBackend.cpp.

References indent_level.

Referenced by LLVMWriteBitcodeToFile(), and llvm::Archive::writeToDisk().

void @797::sanitize ( std::string &  str  )  [inline, static]

Definition at line 179 of file CPPBackend.cpp.


Variable Documentation

CppBackendTargetMachineModule - Note that this is used on hosts that cannot link in a library unless there are references into the library. In particular, it seems that it is not possible to get things to work on Win32 without this. Though it is unused, do not remove it.

Definition at line 79 of file CPPBackend.cpp.

Definition at line 106 of file CPPBackend.cpp.

Definition at line 107 of file CPPBackend.cpp.

Definition at line 108 of file CPPBackend.cpp.

cl::opt<std::string> FuncName("cppfname", cl::desc("Specify the name of the generated function"), cl::value_desc("function name")) [static]

cl::opt<WhatToGenerate> GenerationType("cppgen", cl::Optional, cl::desc("Choose what kind of output to generate"), cl::init(GenProgram), cl::values(clEnumValN(GenProgram,"program","Generate a complete program"),clEnumValN(GenModule,"module","Generate a module definition"),clEnumValN(GenContents,"contents","Generate contents of a module"),clEnumValN(GenFunction,"function","Generate a function definition"),clEnumValN(GenFunctions,"functions","Generate all function definitions"),clEnumValN(GenInline,"inline","Generate an inline function"),clEnumValN(GenVariable,"variable","Generate a variable definition"),clEnumValN(GenType,"type","Generate a type definition"),clEnumValEnd)) [static]

char ID [static]

Definition at line 112 of file CPPBackend.cpp.

unsigned indent_level = 0 [static]

Definition at line 165 of file CPPBackend.cpp.

Referenced by in(), nl(), and out().

bool is_inline

Definition at line 109 of file CPPBackend.cpp.

cl::opt<std::string> NameToGenerate("cppfor", cl::Optional, cl::desc("Specify the name of the thing to generate"), cl::init("!bad!")) [static]

Definition at line 98 of file CPPBackend.cpp.

const char* progname

Definition at line 97 of file CPPBackend.cpp.

const Module* TheModule

Definition at line 99 of file CPPBackend.cpp.

Definition at line 101 of file CPPBackend.cpp.

Definition at line 104 of file CPPBackend.cpp.

Referenced by getOrCreateDesc(), and printTypeInt().

uint64_t uniqueNum

Definition at line 100 of file CPPBackend.cpp.

Definition at line 103 of file CPPBackend.cpp.

Definition at line 105 of file CPPBackend.cpp.

Definition at line 102 of file CPPBackend.cpp.

RegisterTarget<CPPTargetMachine> X("cpp","C++ backend") [static]