Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
3 changes: 3 additions & 0 deletions llvm/include/llvm/AsmParser/LLToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ enum Kind {
kw_graalcc,
kw_riscv_vector_cc,
kw_riscv_vls_cc,
kw_cheriot_compartmentcallcc,
kw_cheriot_compartmentcalleecc,
kw_cheriot_librarycallcc,

// Attributes:
kw_attributes,
Expand Down
14 changes: 14 additions & 0 deletions llvm/include/llvm/IR/CallingConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,20 @@ namespace CallingConv {
// Calling convention for AMDGPU whole wave functions.
AMDGPU_Gfx_WholeWave = 124,

/// CHERIoT_CompartmentCall - Calling convention used for CHERI when
/// crossing a
/// protection boundary.
CHERIoT_CompartmentCall = 125,
/// CHERIoT_CompartmentCallee - Calling convention used for the callee of
/// CHERI_CCall.
/// Ignores the first two capability arguments and the first integer
/// argument, zeroes all unused return registers on return.
CHERIoT_CompartmentCallee = 126,
/// CHERIoT_LibraryCall - Calling convention used for cross-library calls to
/// a
/// stateless compartment.
CHERIoT_LibraryCall = 127,

/// The highest possible ID. Must be some 2^k - 1.
MaxID = 1023
};
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/AsmParser/LLLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(graalcc);
KEYWORD(riscv_vector_cc);
KEYWORD(riscv_vls_cc);
KEYWORD(cheriot_compartmentcallcc);
KEYWORD(cheriot_compartmentcalleecc);
KEYWORD(cheriot_librarycallcc);

KEYWORD(cc);
KEYWORD(c);
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,15 @@ bool LLParser::parseOptionalCallingConv(unsigned &CC) {
#undef CC_VLS_CASE
}
return false;
case lltok::kw_cheriot_compartmentcallcc:
CC = CallingConv::CHERIoT_CompartmentCall;
break;
case lltok::kw_cheriot_compartmentcalleecc:
CC = CallingConv::CHERIoT_CompartmentCallee;
break;
case lltok::kw_cheriot_librarycallcc:
CC = CallingConv::CHERIoT_LibraryCall;
break;
case lltok::kw_cc: {
Lex.Lex();
return parseUInt32(CC);
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/IR/AsmWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) {
CC_VLS_CASE(32768)
CC_VLS_CASE(65536)
#undef CC_VLS_CASE
case CallingConv::CHERIoT_CompartmentCall:
Out << "cheriot_compartmentcallcc";
break;
case CallingConv::CHERIoT_CompartmentCallee:
Out << "cheriot_compartmentcalleecc";
break;
case CallingConv::CHERIoT_LibraryCall:
Out << "cheriot_librarycallcc";
break;
}
}

Expand Down