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/Operator.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/FormattedStream.h"
#include <algorithm>
#include <cctype>
#include <map>

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 StringRef &Name, raw_ostream &Out)
static void PrintLLVMName (raw_ostream &OS, const StringRef &Name, PrefixType Prefix)
static void PrintLLVMName (raw_ostream &OS, const Value *V)
static DenseMap< const Type
*, std::string > & 
getTypeNamesMap (void *M)
static void AddModuleTypesToPrinter (TypePrinting &TP, std::vector< const Type * > &NumberedTypes, const Module *M)
void llvm::WriteTypeSymbolic (raw_ostream &, const Type *, const Module *M)
static SlotTracker * createSlotTracker (const Value *V)
static void WriteAsOperandInternal (raw_ostream &Out, const Value *V, TypePrinting *TypePrinter, SlotTracker *Machine)
static const char * getPredicateText (unsigned predicate)
static void WriteMDNodes (formatted_raw_ostream &Out, TypePrinting &TypePrinter, SlotTracker &Machine)
static void WriteOptimizationInfo (raw_ostream &Out, const User *U)
static void WriteConstantInt (raw_ostream &Out, const Constant *CV, TypePrinting &TypePrinter, 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, formatted_raw_ostream &Out)
static void PrintVisibility (GlobalValue::VisibilityTypes Vis, formatted_raw_ostream &Out)


Define Documentation

#define ST_DEBUG ( X   ) 

Definition at line 586 of file AsmWriter.cpp.


Enumeration Type Documentation

enum PrefixType

Enumerator:
GlobalPrefix 
LabelPrefix 
LocalPrefix 
NoPrefix 

Definition at line 80 of file AsmWriter.cpp.


Function Documentation

static void AddModuleTypesToPrinter ( TypePrinting &  TP,
std::vector< const Type * > &  NumberedTypes,
const Module *  M 
) [static]

AddModuleTypesToPrinter - Add all of the symbolic type names for types in the specified module to the TypePrinter and all numbered types to it and the NumberedTypes table.

Definition at line 402 of file AsmWriter.cpp.

References llvm::TypePrinting::addTypeName(), llvm::TypeSymbolTable::begin(), E, llvm::TypeSymbolTable::end(), llvm::raw_ostream::flush(), llvm::SequentialType::getElementType(), llvm::Module::getTypeSymbolTable(), llvm::Type::isInteger(), llvm::Type::isPrimitiveType(), LocalPrefix, and PrintLLVMName().

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

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

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

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

Definition at line 829 of file AsmWriter.cpp.

References pred.

static DenseMap<const Type *, std::string>& getTypeNamesMap ( void *  M  )  [static]

static void PrintEscapedString ( const StringRef &  Name,
raw_ostream &  Out 
) [static]

Definition at line 69 of file AsmWriter.cpp.

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

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

Definition at line 1429 of file AsmWriter.cpp.

References llvm_unreachable.

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

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

static void PrintLLVMName ( raw_ostream &  OS,
const StringRef &  Name,
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 90 of file AsmWriter.cpp.

References llvm::CallingConv::C, llvm::StringRef::data(), GlobalPrefix, LabelPrefix, llvm_unreachable, LocalPrefix, NoPrefix, PrintEscapedString(), and llvm::StringRef::size().

Referenced by AddModuleTypesToPrinter(), and PrintLLVMName().

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

Definition at line 1454 of file AsmWriter.cpp.

References llvm_unreachable.

static void WriteAsOperandInternal ( raw_ostream &  Out,
const Value *  V,
TypePrinting *  TypePrinter,
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 1152 of file AsmWriter.cpp.

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

static void WriteConstantInt ( raw_ostream &  Out,
const Constant *  CV,
TypePrinting &  TypePrinter,
SlotTracker *  Machine 
) [static]

static void WriteMDNodes ( formatted_raw_ostream &  Out,
TypePrinting &  TypePrinter,
SlotTracker &  Machine 
) [static]

static void WriteOptimizationInfo ( raw_ostream &  Out,
const User *  U 
) [static]

Definition at line 895 of file AsmWriter.cpp.


Variable Documentation

Definition at line 1262 of file AsmWriter.cpp.

fMap - The TypePlanes map for the function level data.

Definition at line 487 of file AsmWriter.cpp.

Definition at line 488 of file AsmWriter.cpp.

Definition at line 474 of file AsmWriter.cpp.

SlotTracker& Machine

Definition at line 1259 of file AsmWriter.cpp.

mdnMap - Map for MDNodes.

Definition at line 491 of file AsmWriter.cpp.

Definition at line 492 of file AsmWriter.cpp.

std::map<const MDNode *, unsigned> MDNodes

Definition at line 1266 of file AsmWriter.cpp.

Definition at line 1267 of file AsmWriter.cpp.

mMap - The TypePlanes map for the module level data.

Definition at line 483 of file AsmWriter.cpp.

Definition at line 484 of file AsmWriter.cpp.

std::vector<const Type*> NumberedTypes

Definition at line 310 of file AsmWriter.cpp.

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

Definition at line 1258 of file AsmWriter.cpp.

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

Definition at line 473 of file AsmWriter.cpp.

const MDNode* TheMDNode

TheMDNode - The MDNode for which we are holding slot numbers.

Definition at line 477 of file AsmWriter.cpp.

const Module* TheModule

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

Definition at line 470 of file AsmWriter.cpp.

TheNamedMDNode - The MDNode for which we are holding slot numbers.

Definition at line 480 of file AsmWriter.cpp.

Definition at line 309 of file AsmWriter.cpp.

Definition at line 1261 of file AsmWriter.cpp.

Definition at line 306 of file AsmWriter.cpp.

Definition at line 307 of file AsmWriter.cpp.

Referenced by TypeHasCycleThroughItself().