[Stackmaps] Add command line option to specify the stackmap version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Juergen Ributzka 2014-05-01 22:21:30 +00:00
parent a6775526e4
commit a705794866
2 changed files with 11 additions and 2 deletions

View File

@ -116,7 +116,7 @@ public:
// OpParser.
typedef enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType;
StackMaps(AsmPrinter &AP) : AP(AP) {}
StackMaps(AsmPrinter &AP);
/// \brief Generate a stackmap record for a stackmap instruction.
///

View File

@ -18,6 +18,7 @@
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
@ -29,6 +30,9 @@ using namespace llvm;
#define DEBUG_TYPE "stackmaps"
static cl::opt<int> StackMapVersion("stackmap-version", cl::init(1),
cl::desc("Specify the stackmap encoding version (default = 1)"));
PatchPointOpers::PatchPointOpers(const MachineInstr *MI)
: MI(MI),
HasDef(MI->getOperand(0).isReg() && MI->getOperand(0).isDef() &&
@ -64,6 +68,11 @@ unsigned PatchPointOpers::getNextScratchIdx(unsigned StartIdx) const {
return ScratchIdx;
}
StackMaps::StackMaps(AsmPrinter &AP) : AP(AP) {
if (StackMapVersion != 1)
llvm_unreachable("Unsupported stackmap version!");
}
MachineInstr::const_mop_iterator
StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI,
MachineInstr::const_mop_iterator MOE,
@ -272,7 +281,7 @@ void StackMaps::recordPatchPoint(const MachineInstr &MI) {
/// uint32 : NumRecords
void StackMaps::emitStackmapHeader(MCStreamer &OS) {
// Header.
OS.EmitIntValue(1, 1); // Version.
OS.EmitIntValue(StackMapVersion, 1); // Version.
OS.EmitIntValue(0, 1); // Reserved.
OS.EmitIntValue(0, 2); // Reserved.