summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-07-27 23:32:19 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-07-27 23:32:19 +0000
commit41ba2b47dadb6595272b10ad05fc56352e764e97 (patch)
tree7f896a002e3f28d2f5546fdb593c1eb1b6fca740 /llvm/lib/AsmParser/LLParser.cpp
parent93b3504aa82db9fe6445306277528d2512d64764 (diff)
downloadbcm5719-llvm-41ba2b47dadb6595272b10ad05fc56352e764e97.tar.gz
bcm5719-llvm-41ba2b47dadb6595272b10ad05fc56352e764e97.zip
[opaque pointers] Avoid the use of pointee types when parsing inline asm in IR
When parsing calls to inline asm the pointee type (of the pointer type representing the value type of the InlineAsm value) was used. To avoid using it, use the ValID structure to ferry the FunctionType directly through to the InlineAsm construction. This is a bit of a workaround - alternatively the inline asm could explicitly describe the type but that'd be verbose/redundant in the IR and so long as the inline asm calls directly in the context of a call or invoke, this should suffice. llvm-svn: 243349
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 74cf5665924..f16921dea66 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3980,13 +3980,12 @@ bool LLParser::ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
V = PFS->GetVal(ID.StrVal, Ty, ID.Loc);
return V == nullptr;
case ValID::t_InlineAsm: {
- PointerType *PTy = dyn_cast<PointerType>(Ty);
- FunctionType *FTy =
- PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : nullptr;
- if (!FTy || !InlineAsm::Verify(FTy, ID.StrVal2))
+ assert(ID.FTy);
+ if (!InlineAsm::Verify(ID.FTy, ID.StrVal2))
return Error(ID.Loc, "invalid type for inline asm constraint string");
- V = InlineAsm::get(FTy, ID.StrVal, ID.StrVal2, ID.UIntVal&1,
- (ID.UIntVal>>1)&1, (InlineAsm::AsmDialect(ID.UIntVal>>2)));
+ V = InlineAsm::get(ID.FTy, ID.StrVal, ID.StrVal2, ID.UIntVal & 1,
+ (ID.UIntVal >> 1) & 1,
+ (InlineAsm::AsmDialect(ID.UIntVal >> 2)));
return false;
}
case ValID::t_GlobalName:
@@ -4864,6 +4863,8 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
Ty = FunctionType::get(RetType, ParamTypes, false);
}
+ CalleeID.FTy = Ty;
+
// Look up the callee.
Value *Callee;
if (ConvertValIDToValue(PointerType::getUnqual(Ty), CalleeID, Callee, &PFS))
@@ -5277,6 +5278,8 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
Ty = FunctionType::get(RetType, ParamTypes, false);
}
+ CalleeID.FTy = Ty;
+
// Look up the callee.
Value *Callee;
if (ConvertValIDToValue(PointerType::getUnqual(Ty), CalleeID, Callee, &PFS))
OpenPOWER on IntegriCloud