mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Further progration of metadata operands. The
dumper doesn't really do what I want yet, but at least it doesn't crash now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93272 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
994a204570
commit
5f72a5ebc8
@ -22,6 +22,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class TargetInstrDesc;
|
class TargetInstrDesc;
|
||||||
|
class MDNode;
|
||||||
|
|
||||||
namespace RegState {
|
namespace RegState {
|
||||||
enum {
|
enum {
|
||||||
@ -123,6 +124,11 @@ public:
|
|||||||
MI->addOperand(MO);
|
MI->addOperand(MO);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MachineInstrBuilder &addMetadata(MDNode *MD) const {
|
||||||
|
MI->addOperand(MachineOperand::CreateMetadata(MD));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// BuildMI - Builder interface. Specify how to create the initial instruction
|
/// BuildMI - Builder interface. Specify how to create the initial instruction
|
||||||
|
@ -317,7 +317,7 @@ public:
|
|||||||
return Contents.OffsetedInfo.Val.SymbolName;
|
return Contents.OffsetedInfo.Val.SymbolName;
|
||||||
}
|
}
|
||||||
|
|
||||||
MDNode *getMetadata() const {
|
const MDNode *getMetadata() const {
|
||||||
assert(isMetadata() && "Wrong MachineOperand accessor");
|
assert(isMetadata() && "Wrong MachineOperand accessor");
|
||||||
return Contents.MD;
|
return Contents.MD;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/ADT/FoldingSet.h"
|
#include "llvm/ADT/FoldingSet.h"
|
||||||
|
#include "llvm/Metadata.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -278,10 +279,15 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
|||||||
OS << '>';
|
OS << '>';
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_BlockAddress:
|
case MachineOperand::MO_BlockAddress:
|
||||||
OS << "<";
|
OS << '<';
|
||||||
WriteAsOperand(OS, getBlockAddress(), /*PrintType=*/false);
|
WriteAsOperand(OS, getBlockAddress(), /*PrintType=*/false);
|
||||||
OS << '>';
|
OS << '>';
|
||||||
break;
|
break;
|
||||||
|
case MachineOperand::MO_Metadata:
|
||||||
|
OS << '<';
|
||||||
|
WriteAsOperand(OS, getMetadata(), /*PrintType=*/false);
|
||||||
|
OS << '>';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unrecognized operand type");
|
llvm_unreachable("Unrecognized operand type");
|
||||||
}
|
}
|
||||||
|
@ -564,6 +564,9 @@ static SlotTracker *createSlotTracker(const Value *V) {
|
|||||||
if (const Function *Func = dyn_cast<Function>(V))
|
if (const Function *Func = dyn_cast<Function>(V))
|
||||||
return new SlotTracker(Func);
|
return new SlotTracker(Func);
|
||||||
|
|
||||||
|
if (isa<MDNode>(V))
|
||||||
|
return new SlotTracker((Function *)0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1136,6 +1139,8 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Machine)
|
||||||
|
Machine = createSlotTracker(V);
|
||||||
Out << '!' << Machine->getMetadataSlot(N);
|
Out << '!' << Machine->getMetadataSlot(N);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user