mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-13 17:00:01 +00:00
add support for prefix/suffix strings to go around GlobalValue(s)
(which may or be function pointers) in the asmprinter. For the moment, this changes nothing, except the IA64 backend which can use this to write: data8.ua @fptr(blah__blah__mangled_function_name) (by setting FunctionAddrPrefix/Suffix to "@fptr(" / ")") llvm-svn: 21024
This commit is contained in:
parent
5367cc3b49
commit
3a10f491f0
@ -54,6 +54,21 @@ namespace llvm {
|
|||||||
/// onto all global symbols. This is often used for "_" or ".".
|
/// onto all global symbols. This is often used for "_" or ".".
|
||||||
const char *GlobalPrefix; // Defaults to ""
|
const char *GlobalPrefix; // Defaults to ""
|
||||||
|
|
||||||
|
/// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
|
||||||
|
/// will enclose any GlobalVariable (that isn't a function)
|
||||||
|
///
|
||||||
|
const char *GlobalVarAddrPrefix; // Defaults to ""
|
||||||
|
const char *GlobalVarAddrSuffix; // Defaults to ""
|
||||||
|
|
||||||
|
/// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
|
||||||
|
/// will enclose any GlobalVariable that points to a function.
|
||||||
|
/// For example, this is used by the IA64 backend to materialize
|
||||||
|
/// function descriptors, by decorating the ".data8" object with the
|
||||||
|
/// @fptr( ) link-relocation operator.
|
||||||
|
///
|
||||||
|
const char *FunctionAddrPrefix; // Defaults to ""
|
||||||
|
const char *FunctionAddrSuffix; // Defaults to ""
|
||||||
|
|
||||||
/// ZeroDirective - this should be set to the directive used to get some
|
/// ZeroDirective - this should be set to the directive used to get some
|
||||||
/// number of zero bytes emitted to the current section. Common cases are
|
/// number of zero bytes emitted to the current section. Common cases are
|
||||||
/// "\t.zero\t" and "\t.space\t". If this is set to null, the
|
/// "\t.zero\t" and "\t.space\t". If this is set to null, the
|
||||||
@ -87,6 +102,10 @@ namespace llvm {
|
|||||||
: O(o), TM(tm),
|
: O(o), TM(tm),
|
||||||
CommentString("#"),
|
CommentString("#"),
|
||||||
GlobalPrefix(""),
|
GlobalPrefix(""),
|
||||||
|
GlobalVarAddrPrefix(""),
|
||||||
|
GlobalVarAddrSuffix(""),
|
||||||
|
FunctionAddrPrefix(""),
|
||||||
|
FunctionAddrSuffix(""),
|
||||||
ZeroDirective("\t.zero\t"),
|
ZeroDirective("\t.zero\t"),
|
||||||
AsciiDirective("\t.ascii\t"),
|
AsciiDirective("\t.ascii\t"),
|
||||||
Data8bitsDirective("\t.byte\t"),
|
Data8bitsDirective("\t.byte\t"),
|
||||||
|
@ -67,11 +67,16 @@ void AsmPrinter::emitConstantValueOnly(const Constant *CV) {
|
|||||||
O << (unsigned long long)CI->getValue();
|
O << (unsigned long long)CI->getValue();
|
||||||
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
|
||||||
O << CI->getValue();
|
O << CI->getValue();
|
||||||
else if (isa<GlobalValue>((Value*)CV))
|
else if (isa<GlobalValue>((Value*)CV)) {
|
||||||
// This is a constant address for a global variable or function. Use the
|
// This is a constant address for a global variable or function. Use the
|
||||||
// name of the variable or function as the address value.
|
// name of the variable or function as the address value, possibly
|
||||||
O << Mang->getValueName(CV);
|
// decorating it with GlobalVarAddrPrefix/Suffix or
|
||||||
else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
// FunctionAddrPrefix/Suffix (these all default to "" )
|
||||||
|
if (isa<Function>((Value*)CV))
|
||||||
|
O << FunctionAddrPrefix << Mang->getValueName(CV) << FunctionAddrSuffix;
|
||||||
|
else
|
||||||
|
O << GlobalVarAddrPrefix << Mang->getValueName(CV) << GlobalVarAddrSuffix;
|
||||||
|
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
const TargetData &TD = TM.getTargetData();
|
const TargetData &TD = TM.getTargetData();
|
||||||
switch(CE->getOpcode()) {
|
switch(CE->getOpcode()) {
|
||||||
case Instruction::GetElementPtr: {
|
case Instruction::GetElementPtr: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user