LLVM API Documentation
#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>
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 ST_DEBUG | ( | X | ) |
Definition at line 250 of file AsmWriter.cpp.
| enum PrefixType |
Definition at line 82 of file AsmWriter.cpp.
| 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 425 of file AsmWriter.cpp.
References E, llvm::StructType::element_begin(), llvm::StructType::element_end(), llvm::PointerType::getAddressSpace(), llvm::Type::getDescription(), llvm::SequentialType::getElementType(), llvm::VectorType::getNumElements(), llvm::ArrayType::getNumElements(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getReturnType(), llvm::Type::getTypeID(), llvm::Type::isInteger(), llvm::StructType::isPacked(), llvm::Type::isPrimitiveType(), llvm::FunctionType::isVarArg(), llvm::next(), llvm::FunctionType::param_begin(), llvm::FunctionType::param_end(), and llvm::utostr().
Referenced by printTypeInt().
| static SlotTracker* createSlotTracker | ( | const Value * | V | ) | [static] |
Definition at line 225 of file AsmWriter.cpp.
References BB, llvm::GlobalValue::getParent(), llvm::MachineBasicBlock::getParent(), and GV.
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 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().
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] |
Definition at line 590 of file AsmWriter.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and pred.
Referenced by WriteConstantInt().
| static void PrintEscapedString | ( | const std::string & | Str, | |
| raw_ostream & | Out | |||
| ) | [static] |
| static void PrintEscapedString | ( | const char * | Str, | |
| unsigned | Length, | |||
| raw_ostream & | Out | |||
| ) | [static] |
| 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] |
Definition at line 623 of file AsmWriter.cpp.
References llvm::APFloat::bitcastToAPInt(), CA, llvm::APFloat::convert(), CP, llvm::ftostr(), llvm::APInt::getBitWidth(), llvm::User::getNumOperands(), llvm::Constant::getOperand(), getPredicateText(), llvm::APInt::getRawData(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::APFloat::IEEEdouble, llvm::APFloat::IEEEquad, llvm::APFloat::IEEEsingle, Indices, llvm::Type::Int1Ty, llvm::APFloat::PPCDoubleDouble, PrintEscapedString(), printTypeInt(), llvm::APFloat::rmNearestTiesToEven, llvm::SmallVectorImpl< T >::size(), llvm::utohex_buffer(), Val, WriteAsOperandInternal(), and llvm::APFloat::x87DoubleExtended.
Referenced by llvm::Value::print(), and WriteAsOperandInternal().
Definition at line 931 of file AsmWriter.cpp.
Definition at line 175 of file AsmWriter.cpp.
| bool FunctionProcessed |
Definition at line 167 of file AsmWriter.cpp.
| SlotTracker& Machine |
Definition at line 928 of file AsmWriter.cpp.
Definition at line 171 of file AsmWriter.cpp.
Definition at line 927 of file AsmWriter.cpp.
| const Function* TheFunction |
TheFunction - The function for which we are holding slot numbers.
Definition at line 166 of file AsmWriter.cpp.
TheModule - The module for which we are holding slot numbers.
Definition at line 163 of file AsmWriter.cpp.
Definition at line 930 of file AsmWriter.cpp.