summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantsContext.h
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-07-28 00:06:38 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-07-28 00:06:38 +0000
commit71c9c9ce31bc1e9db6b2ba6df41fd5c2fe2592c7 (patch)
treebcb84589110fa4acfc9d2b1a0274ef1afc0522e9 /llvm/lib/IR/ConstantsContext.h
parent2705819240d39768fe0429d8d7469a53b2bf685b (diff)
downloadbcm5719-llvm-71c9c9ce31bc1e9db6b2ba6df41fd5c2fe2592c7.tar.gz
bcm5719-llvm-71c9c9ce31bc1e9db6b2ba6df41fd5c2fe2592c7.zip
[opaque pointer type] Avoid using pointee types to retrieve InlineAsm's function type
As a stop-gap, retrieving the InlineAsm's function type was done via the pointee type of its (pointer) Value type. Instead, pass down and store the FunctionType in the InlineAsm object. The only wrinkle with this is the ConstantUniqueMap, which then needs to ferry the FunctionType down through the InlineAsmKeyType. This could be done a bit differently if the ConstantInfo trait were broadened a bit to provide an extension point for access to the TypeClass object from the ValType objects, so that the ConstantUniqueMap<InlineAsm> would then be keyed on FunctionTypes instead of PointerTypes that point to FunctionTypes. This drops the number of IR tests that don't roundtrip through bitcode* without calling PointerType::getElementType from 416 to 8 (out of 10733). 3 of those crash when roundtripping at ToT anyway. * modulo various unavoidable uses of pointer types when validating IR (for now) and in the way globals are parsed, unfortunately. These cases will either go away (because such validation will no longer be necessary or possible when pointee types are opaque), or have to be made simultaneously with the removal of pointee types. llvm-svn: 243356
Diffstat (limited to 'llvm/lib/IR/ConstantsContext.h')
-rw-r--r--llvm/lib/IR/ConstantsContext.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index f3ddcd78d26..33e89515b26 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -373,41 +373,45 @@ template <class ConstantClass> struct ConstantAggrKeyType {
struct InlineAsmKeyType {
StringRef AsmString;
StringRef Constraints;
+ FunctionType *FTy;
bool HasSideEffects;
bool IsAlignStack;
InlineAsm::AsmDialect AsmDialect;
InlineAsmKeyType(StringRef AsmString, StringRef Constraints,
- bool HasSideEffects, bool IsAlignStack,
+ FunctionType *FTy, bool HasSideEffects, bool IsAlignStack,
InlineAsm::AsmDialect AsmDialect)
- : AsmString(AsmString), Constraints(Constraints),
+ : AsmString(AsmString), Constraints(Constraints), FTy(FTy),
HasSideEffects(HasSideEffects), IsAlignStack(IsAlignStack),
AsmDialect(AsmDialect) {}
InlineAsmKeyType(const InlineAsm *Asm, SmallVectorImpl<Constant *> &)
: AsmString(Asm->getAsmString()), Constraints(Asm->getConstraintString()),
- HasSideEffects(Asm->hasSideEffects()),
+ FTy(Asm->getFunctionType()), HasSideEffects(Asm->hasSideEffects()),
IsAlignStack(Asm->isAlignStack()), AsmDialect(Asm->getDialect()) {}
bool operator==(const InlineAsmKeyType &X) const {
return HasSideEffects == X.HasSideEffects &&
IsAlignStack == X.IsAlignStack && AsmDialect == X.AsmDialect &&
- AsmString == X.AsmString && Constraints == X.Constraints;
+ AsmString == X.AsmString && Constraints == X.Constraints &&
+ FTy == X.FTy;
}
bool operator==(const InlineAsm *Asm) const {
return HasSideEffects == Asm->hasSideEffects() &&
IsAlignStack == Asm->isAlignStack() &&
AsmDialect == Asm->getDialect() &&
AsmString == Asm->getAsmString() &&
- Constraints == Asm->getConstraintString();
+ Constraints == Asm->getConstraintString() &&
+ FTy == Asm->getFunctionType();
}
unsigned getHash() const {
return hash_combine(AsmString, Constraints, HasSideEffects, IsAlignStack,
- AsmDialect);
+ AsmDialect, FTy);
}
typedef ConstantInfo<InlineAsm>::TypeClass TypeClass;
InlineAsm *create(TypeClass *Ty) const {
- return new InlineAsm(Ty, AsmString, Constraints, HasSideEffects,
+ assert(PointerType::getUnqual(FTy) == Ty);
+ return new InlineAsm(FTy, AsmString, Constraints, HasSideEffects,
IsAlignStack, AsmDialect);
}
};
OpenPOWER on IntegriCloud