LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AsmWriter.cpp File Reference

#include "llvm/Assembly/CachedWriter.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Assembly/AsmAnnotationWriter.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instruction.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/SymbolTable.h"
#include "llvm/Support/CFG.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>

Include dependency graph for AsmWriter.cpp:

Go to the source code of this file.

Namespaces

namespace  llvm

Classes

class  llvm::SlotMachine
 LLVM Assembly Writing Slot Computation. More...
struct  llvm::SlotMachine::ValuePlane
 A plane with next slot number and ValueMap. More...
struct  llvm::SlotMachine::TypePlane
class  llvm::AssemblyWriter

Defines

#define SC_DEBUG(X)

Functions

static void WriteAsOperandInternal (std::ostream &Out, const Value *V, bool PrintName, std::map< const Type *, std::string > &TypeTable, SlotMachine *Machine)
static void WriteAsOperandInternal (std::ostream &Out, const Type *T, bool PrintName, std::map< const Type *, std::string > &TypeTable, SlotMachine *Machine)
static const ModulegetModuleFromVal (const Value *V)
static SlotMachinecreateSlotMachine (const Value *V)
static std::string getLLVMName (const std::string &Name)
static void fillTypeNameTable (const Module *M, std::map< const Type *, std::string > &TypeNames)
static void calcTypeName (const Type *Ty, std::vector< const Type * > &TypeStack, std::map< const Type *, std::string > &TypeNames, std::string &Result)
static std::ostream & printTypeInt (std::ostream &Out, const Type *Ty, std::map< const Type *, std::string > &TypeNames)
std::ostream & llvm::WriteTypeSymbolic (std::ostream &Out, const Type *Ty, const Module *M)
static void WriteConstantInt (std::ostream &Out, const Constant *CV, bool PrintName, std::map< const Type *, std::string > &TypeTable, SlotMachine *Machine)
 Internal constant writer.
std::ostream & llvm::WriteAsOperand (std::ostream &Out, const Value *V, bool PrintType, bool PrintName, const Module *Context)
std::ostream & llvm::WriteAsOperand (std::ostream &Out, const Type *Ty, bool PrintType, bool PrintName, const Module *Context)

Variables

static RegisterPass< PrintModulePassX ("printm","Print module to stderr", PassInfo::Analysis|PassInfo::Optimization)
static RegisterPass< PrintFunctionPassY ("print","Print function to stderr", PassInfo::Analysis|PassInfo::Optimization)


Define Documentation

#define SC_DEBUG  ) 
 

Definition at line 1302 of file AsmWriter.cpp.


Function Documentation

static void calcTypeName const Type Ty,
std::vector< const Type * > &  TypeStack,
std::map< const Type *, std::string > &  TypeNames,
std::string &  Result
[static]
 

Definition at line 249 of file AsmWriter.cpp.

References E, llvm::StructType::element_begin(), llvm::StructType::element_end(), llvm::Type::getDescription(), llvm::SequentialType::getElementType(), llvm::PackedType::getNumElements(), llvm::ArrayType::getNumElements(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getReturnType(), I, llvm::Type::isPrimitiveType(), llvm::FunctionType::isVarArg(), llvm::FunctionType::param_begin(), llvm::FunctionType::param_end(), and llvm::utostr().

Referenced by printTypeInt().

static SlotMachine* createSlotMachine const Value V  )  [static]
 

Definition at line 188 of file AsmWriter.cpp.

References I.

Referenced by WriteAsOperandInternal().

static void fillTypeNameTable const Module M,
std::map< const Type *, std::string > &  TypeNames
[static]
 

fillTypeNameTable - If the module has a symbol table, take all global types and stuff their names into the TypeNames map.

Definition at line 230 of file AsmWriter.cpp.

References getLLVMName(), llvm::Module::getSymbolTable(), llvm::SymbolTable::type_begin(), and llvm::SymbolTable::type_end().

Referenced by llvm::AssemblyWriter::AssemblyWriter(), llvm::WriteAsOperand(), and llvm::WriteTypeSymbolic().

static std::string getLLVMName const std::string &  Name  )  [static]
 

Definition at line 206 of file AsmWriter.cpp.

References C.

Referenced by fillTypeNameTable(), and WriteAsOperandInternal().

static const Module* getModuleFromVal const Value V  )  [static]
 

Definition at line 175 of file AsmWriter.cpp.

References llvm::GlobalValue::getParent(), I, and M.

Referenced by llvm::WriteAsOperand().

static std::ostream& printTypeInt std::ostream &  Out,
const Type Ty,
std::map< const Type *, std::string > &  TypeNames
[static]
 

printTypeInt - The internal guts of printing out a type that has a potentially named portion.

Definition at line 348 of file AsmWriter.cpp.

References calcTypeName(), llvm::Type::getDescription(), I, and llvm::Type::isPrimitiveType().

Referenced by llvm::WriteAsOperand(), WriteConstantInt(), and llvm::WriteTypeSymbolic().

static void WriteAsOperandInternal std::ostream &  Out,
const Type T,
bool  PrintName,
std::map< const Type *, std::string > &  TypeTable,
SlotMachine Machine
[static]
 

WriteAsOperandInternal - Write the name of the specified value out to the specified ostream. This can be useful when you just want to print int reg126, not the whole instruction that generated it.

Definition at line 605 of file AsmWriter.cpp.

References llvm::Type::getDescription(), and llvm::SlotMachine::getSlot().

static void WriteAsOperandInternal std::ostream &  Out,
const Value V,
bool  PrintName,
std::map< const Type *, std::string > &  TypeTable,
SlotMachine Machine
[static]
 

WriteAsOperand - Write the name of the specified value out to the specified ostream. This can be useful when you just want to print int reg126, not the whole instruction that generated it.

Definition at line 550 of file AsmWriter.cpp.

References createSlotMachine(), getLLVMName(), llvm::SlotMachine::getSlot(), and WriteConstantInt().

Referenced by llvm::WriteAsOperand(), WriteConstantInt(), and llvm::AssemblyWriter::writeOperand().

static void WriteConstantInt std::ostream &  Out,
const Constant CV,
bool  PrintName,
std::map< const Type *, std::string > &  TypeTable,
SlotMachine Machine
[static]
 

Internal constant writer.

Definition at line 393 of file AsmWriter.cpp.

References C, llvm::ftostr(), printTypeInt(), True, llvm::utohexstr(), and WriteAsOperandInternal().

Referenced by llvm::Constant::print(), and WriteAsOperandInternal().


Variable Documentation

RegisterPass<PrintModulePass> X("printm","Print module to stderr", PassInfo::Analysis|PassInfo::Optimization) [static]
 

RegisterPass<PrintFunctionPass> Y("print","Print function to stderr", PassInfo::Analysis|PassInfo::Optimization) [static]