Created
September 27, 2015 14:04
-
-
Save carnaval/76ad63cffb21e0914229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/llvm/CodeGen/StackMaps.h b/include/llvm/CodeGen/StackMaps.h | |
index fdc1a91..3f81506 100644 | |
--- a/include/llvm/CodeGen/StackMaps.h | |
+++ b/include/llvm/CodeGen/StackMaps.h | |
@@ -193,6 +193,7 @@ private: | |
typedef SmallVector<LiveOutReg, 8> LiveOutVec; | |
typedef MapVector<uint64_t, uint64_t> ConstantPool; | |
typedef MapVector<const MCSymbol *, uint64_t> FnStackSizeMap; | |
+ typedef std::map<const MCSymbol *, uint64_t> FnNumRecordMap; | |
struct CallsiteInfo { | |
const MCExpr *CSOffsetExpr; | |
@@ -212,6 +213,7 @@ private: | |
CallsiteInfoList CSInfos; | |
ConstantPool ConstPool; | |
FnStackSizeMap FnStackSize; | |
+ FnNumRecordMap FnNumRecord; | |
MachineInstr::const_mop_iterator | |
parseOperand(MachineInstr::const_mop_iterator MOI, | |
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp | |
index ed230ee..97ba0ea 100644 | |
--- a/lib/CodeGen/PrologEpilogInserter.cpp | |
+++ b/lib/CodeGen/PrologEpilogInserter.cpp | |
@@ -928,7 +928,7 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn, | |
unsigned Reg; | |
MachineOperand &Offset = MI->getOperand(i + 1); | |
const unsigned refOffset = | |
- TFI->getFrameIndexReferenceFromSP(Fn, MI->getOperand(i).getIndex(), | |
+ TFI->getFrameIndexReference(Fn, MI->getOperand(i).getIndex(), | |
Reg); | |
Offset.setImm(Offset.getImm() + refOffset); | |
diff --git a/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | |
index 0bfa89d..231de2f 100644 | |
--- a/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | |
+++ b/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | |
@@ -340,8 +340,10 @@ lowerCallFromStatepoint(ImmutableStatepoint ISP, const BasicBlock *EHPadBB, | |
if (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg || | |
CallEnd->getOpcode() == ISD::LOAD)) | |
CallEnd = CallEnd->getOperand(0).getNode(); | |
+ if (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg)) | |
+ CallEnd = CallEnd->getOperand(0).getNode(); | |
- assert(CallEnd->getOpcode() == ISD::CALLSEQ_END && "expected!"); | |
+ assert(CallEnd->getOpcode() == ISD::CALLSEQ_END && "expected!?!?"); | |
if (HasDef) { | |
if (CS.isInvoke()) { | |
diff --git a/lib/CodeGen/StackMaps.cpp b/lib/CodeGen/StackMaps.cpp | |
index b3cd8b3..956f239 100644 | |
--- a/lib/CodeGen/StackMaps.cpp | |
+++ b/lib/CodeGen/StackMaps.cpp | |
@@ -30,7 +30,7 @@ using namespace llvm; | |
#define DEBUG_TYPE "stackmaps" | |
static cl::opt<int> StackMapVersion( | |
- "stackmap-version", cl::init(1), | |
+ "stackmap-version", cl::init(2), | |
cl::desc("Specify the stackmap encoding version (default = 1)")); | |
const char *StackMaps::WSMP = "Stack Maps: "; | |
@@ -70,7 +70,7 @@ unsigned PatchPointOpers::getNextScratchIdx(unsigned StartIdx) const { | |
} | |
StackMaps::StackMaps(AsmPrinter &AP) : AP(AP) { | |
- if (StackMapVersion != 1) | |
+ if (StackMapVersion > 2) | |
llvm_unreachable("Unsupported stackmap version!"); | |
} | |
@@ -339,6 +339,7 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID, | |
MFI->hasVarSizedObjects() || RegInfo->needsStackRealignment(*(AP.MF)); | |
FnStackSize[AP.CurrentFnSym] = | |
HasDynamicFrameSize ? UINT64_MAX : MFI->getStackSize(); | |
+ FnNumRecord[AP.CurrentFnSym] += 1; | |
} | |
void StackMaps::recordStackMap(const MachineInstr &MI) { | |
@@ -422,6 +423,7 @@ void StackMaps::emitFunctionFrameRecords(MCStreamer &OS) { | |
<< " frame size: " << FR.second); | |
OS.EmitSymbolValue(FR.first, 8); | |
OS.EmitIntValue(FR.second, 8); | |
+ if (StackMapVersion >= 2) OS.EmitIntValue(FnNumRecord[FR.first], 8); | |
} | |
} | |
diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp | |
index 64ebdb4..a67ee02 100644 | |
--- a/lib/IR/Function.cpp | |
+++ b/lib/IR/Function.cpp | |
@@ -482,8 +482,16 @@ static std::string getMangledTypeStr(Type* Ty) { | |
Result += "a" + llvm::utostr(ATyp->getNumElements()) + | |
getMangledTypeStr(ATyp->getElementType()); | |
} else if (StructType* STyp = dyn_cast<StructType>(Ty)) { | |
- assert(!STyp->isLiteral() && "TODO: implement literal types"); | |
- Result += STyp->getName(); | |
+ //assert(!STyp->isLiteral() && "TODO: implement literal types"); | |
+ if (STyp->isLiteral()) { | |
+ Result += "s_"; | |
+ for (Type *elty : STyp->elements()) { | |
+ Result += getMangledTypeStr(elty); | |
+ Result += "_"; | |
+ } | |
+ Result += "s"; | |
+ } else | |
+ Result += STyp->getName(); | |
} else if (FunctionType* FT = dyn_cast<FunctionType>(Ty)) { | |
Result += "f_" + getMangledTypeStr(FT->getReturnType()); | |
for (size_t i = 0; i < FT->getNumParams(); i++) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment