Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clang/lib/CodeGen/Targets/AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AVRABIInfo : public DefaultABIInfo {
unsigned TySize = getContext().getTypeSize(Ty);

// An int8 type argument always costs two registers like an int16.
if (TySize == 8 && NumRegs >= 2) {
if (TySize == 8 && NumRegs >= 2 && Ty->isIntegralOrEnumerationType()) {
NumRegs -= 2;
return ABIArgInfo::getExtend(Ty);
}
Expand Down Expand Up @@ -135,7 +135,8 @@ class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
if (GV->isDeclaration())
return;
const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
if (!FD) return;
if (!FD)
return;
auto *Fn = cast<llvm::Function>(GV);

if (FD->getAttr<AVRInterruptAttr>())
Expand All @@ -145,7 +146,7 @@ class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
Fn->addFnAttr("signal");
}
};
}
} // namespace

std::unique_ptr<TargetCodeGenInfo>
CodeGen::createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR,
Expand Down
10 changes: 10 additions & 0 deletions clang/test/CodeGen/avr/argument.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,13 @@ struct s15 fooa(char a, char b) {
x.arr[1] = b;
return x;
}

struct s8_t {
char a;
};

// AVR-NOT: {{.*}} signext
// TINY-NOT: {{.*}} signext
char foob(struct s8_t a) {
return a.a + 1;
}