AMDGPU: Fix getIntegerAttribute type and error message

llvm-svn: 269268
This commit is contained in:
Matt Arsenault 2016-05-12 02:45:18 +00:00
parent a94e383157
commit 8300272823
2 changed files with 6 additions and 4 deletions

View File

@ -109,18 +109,18 @@ bool isReadOnlySegment(const GlobalValue *GV) {
return GV->getType()->getAddressSpace() == AMDGPUAS::CONSTANT_ADDRESS;
}
static unsigned getIntegerAttribute(const Function &F, const char *Name,
unsigned Default) {
int getIntegerAttribute(const Function &F, StringRef Name, int Default) {
Attribute A = F.getFnAttribute(Name);
unsigned Result = Default;
int Result = Default;
if (A.isStringAttribute()) {
StringRef Str = A.getValueAsString();
if (Str.getAsInteger(0, Result)) {
LLVMContext &Ctx = F.getContext();
Ctx.emitError("can't parse shader type");
Ctx.emitError("can't parse integer attribute " + Name);
}
}
return Result;
}

View File

@ -45,6 +45,8 @@ bool isGroupSegment(const GlobalValue *GV);
bool isGlobalSegment(const GlobalValue *GV);
bool isReadOnlySegment(const GlobalValue *GV);
int getIntegerAttribute(const Function &F, StringRef Name, int Default);
unsigned getMaximumWorkGroupSize(const Function &F);
unsigned getInitialPSInputAddr(const Function &F);