LLVM API Documentation

AsmWriter.cpp File Reference

#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/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cctype>

Include dependency graph for AsmWriter.cpp:

Go to the source code of this file.

Defines

#define ST_DEBUG(X)

Enumerations

enum  PrefixType { GlobalPrefix, LabelPrefix, LocalPrefix, NoPrefix }

Functions

static const Module * getModuleFromVal (const Value *V)
static void PrintEscapedString (const char *Str, unsigned Length, raw_ostream &Out)
static void PrintEscapedString (const std::string &Str, raw_ostream &Out)
static void PrintLLVMName (raw_ostream &OS, const char *NameStr, unsigned NameLen, PrefixType Prefix)
static std::string getLLVMName (const std::string &Name)
static void PrintLLVMName (raw_ostream &OS, const Value *V)
static SlotTracker * createSlotTracker (const Value *V)
static void WriteAsOperandInternal (raw_ostream &Out, const Value *V, std::map< const Type *, std::string > &TypeTable, SlotTracker *Machine)
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 void printTypeInt (raw_ostream &Out, const Type *Ty, std::map< const Type *, std::string > &TypeNames)
void llvm::WriteTypeSymbolic (std::ostream &, const Type *, const Module *M)
void llvm::WriteTypeSymbolic (raw_ostream &, const Type *, const Module *M)
static const char * getPredicateText (unsigned predicate)
static void WriteConstantInt (raw_ostream &Out, const Constant *CV, std::map< const Type *, std::string > &TypeTable, SlotTracker *Machine)
void llvm::WriteAsOperand (std::ostream &, const Value *, bool PrintTy=true, const Module *Context=0)
void llvm::WriteAsOperand (raw_ostream &, const Value *, bool PrintTy=true, const Module *Context=0)
static void PrintLinkage (GlobalValue::LinkageTypes LT, raw_ostream &Out)
static void PrintVisibility (GlobalValue::VisibilityTypes Vis, raw_ostream &Out)


Define Documentation

#define ST_DEBUG ( X   ) 

Definition at line 250 of file AsmWriter.cpp.


Enumeration Type Documentation

enum PrefixType

Enumerator:
GlobalPrefix 
LabelPrefix 
LocalPrefix 
NoPrefix 

Definition at line 82 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]

static SlotTracker* createSlotTracker ( const Value *  V  )  [static]

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

References llvm::TypeSymbolTable::begin(), llvm::TypeSymbolTable::end(), getLLVMName(), llvm::Module::getTypeSymbolTable(), and Ty.

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

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

getLLVMName - Turn the specified string into an 'LLVM name', which is surrounded with ""'s and escaped if it has special chars in it.

Definition at line 130 of file AsmWriter.cpp.

References NoPrefix, OS, PrintLLVMName(), and llvm::raw_string_ostream::str().

Referenced by fillTypeNameTable().

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

Definition at line 46 of file AsmWriter.cpp.

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

Referenced by llvm::WriteAsOperand().

static const char* getPredicateText ( unsigned  predicate  )  [static]

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

Definition at line 78 of file AsmWriter.cpp.

References PrintEscapedString().

static void PrintEscapedString ( const char *  Str,
unsigned  Length,
raw_ostream &  Out 
) [static]

Definition at line 65 of file AsmWriter.cpp.

References llvm::CallingConv::C, and llvm::hexdigit().

static void PrintLinkage ( GlobalValue::LinkageTypes  LT,
raw_ostream &  Out 
) [static]

Definition at line 1160 of file AsmWriter.cpp.

static void PrintLLVMName ( raw_ostream &  OS,
const Value *  V 
) [static]

PrintLLVMName - Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only contains simple characters) or is surrounded with ""'s (if it has special chars in it). Print it out.

Definition at line 141 of file AsmWriter.cpp.

References llvm::Value::getNameLen(), llvm::Value::getNameStart(), GlobalPrefix, LocalPrefix, and PrintLLVMName().

static void PrintLLVMName ( raw_ostream &  OS,
const char *  NameStr,
unsigned  NameLen,
PrefixType  Prefix 
) [static]

PrintLLVMName - Turn the specified name into an 'LLVM name', which is either prefixed with % (if the string only contains simple characters) or is surrounded with ""'s (if it has special chars in it). Print it out.

Definition at line 92 of file AsmWriter.cpp.

References llvm::CallingConv::C, GlobalPrefix, LabelPrefix, LocalPrefix, NoPrefix, PrintEscapedString(), and llvm::raw_ostream::write().

Referenced by getLLVMName(), PrintLLVMName(), and WriteAsOperandInternal().

static void printTypeInt ( raw_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 537 of file AsmWriter.cpp.

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

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

static void PrintVisibility ( GlobalValue::VisibilityTypes  Vis,
raw_ostream &  Out 
) [static]

Definition at line 1179 of file AsmWriter.cpp.

static void WriteAsOperandInternal ( raw_ostream &  Out,
const Value *  V,
std::map< const Type *, std::string > &  TypeTable,
SlotTracker *  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 841 of file AsmWriter.cpp.

References createSlotTracker(), llvm::dyn_cast(), GV, llvm::Value::hasName(), llvm::cl::Prefix, PrintEscapedString(), PrintLLVMName(), and WriteConstantInt().

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

static void WriteConstantInt ( raw_ostream &  Out,
const Constant *  CV,
std::map< const Type *, std::string > &  TypeTable,
SlotTracker *  Machine 
) [static]


Variable Documentation

Definition at line 931 of file AsmWriter.cpp.

fMap - The TypePlanes map for the function level data

Definition at line 174 of file AsmWriter.cpp.

Definition at line 175 of file AsmWriter.cpp.

Definition at line 167 of file AsmWriter.cpp.

SlotTracker& Machine

Definition at line 928 of file AsmWriter.cpp.

mMap - The TypePlanes map for the module level data

Definition at line 170 of file AsmWriter.cpp.

Definition at line 171 of file AsmWriter.cpp.

Definition at line 927 of file AsmWriter.cpp.

TheFunction - The function for which we are holding slot numbers.

Definition at line 166 of file AsmWriter.cpp.

const Module* TheModule

TheModule - The module for which we are holding slot numbers.

Definition at line 163 of file AsmWriter.cpp.

std::map<const Type *, std::string> TypeNames

Definition at line 930 of file AsmWriter.cpp.