LLVM API Documentation

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/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/SymbolTable.h"
#include "llvm/Support/CFG.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.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, bool prefixName=true)
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 PrintEscapedString (const std::string &Str, std::ostream &Out)
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 ( X   ) 

Definition at line 1394 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 258 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::Type::isPrimitiveType(), Slot, Ty, and llvm::utostr().

Referenced by printTypeInt().

static SlotMachine* createSlotMachine ( const Value V  )  [static]

Definition at line 193 of file AsmWriter.cpp.

References BB, Func, llvm::GlobalValue::getParent(), llvm::BasicBlock::getParent(), GV, and V.

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 239 of file AsmWriter.cpp.

References getLLVMName(), llvm::Module::getSymbolTable(), M, Ty, 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,
bool  prefixName = true 
) [static]

Definition at line 211 of file AsmWriter.cpp.

References C.

Referenced by fillTypeNameTable(), and WriteAsOperandInternal().

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

Definition at line 180 of file AsmWriter.cpp.

References BB, llvm::GlobalValue::getParent(), llvm::BasicBlock::getParent(), GV, M, and V.

Referenced by llvm::WriteAsOperand().

static void PrintEscapedString ( const std::string &  Str,
std::ostream &  Out 
) [static]

Definition at line 403 of file AsmWriter.cpp.

References C.

Referenced by WriteAsOperandInternal(), and WriteConstantInt().

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 357 of file AsmWriter.cpp.

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

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 623 of file AsmWriter.cpp.

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

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 559 of file AsmWriter.cpp.

References createSlotMachine(), getLLVMName(), llvm::SlotMachine::getSlot(), PrintEscapedString(), Slot, V, 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 417 of file AsmWriter.cpp.

References CP, llvm::DoubleToBits(), llvm::ftostr(), llvm::User::getNumOperands(), llvm::Constant::getOperand(), llvm::Value::getType(), Indent, OI, PrintEscapedString(), 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]