Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal merge #432

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open

Temporal merge #432

wants to merge 26 commits into from

Conversation

LawrenceEsswood
Copy link

All the changes I have made for CheriOS.

Clang changes:

  • New safe and unsafe attributes

LLVM changes:

  • A pass to automatically tag things
  • Extra tracking for stack objects (safe/unsafe) (not target specific)
  • New general stack layout rules for safe/unsafe objects (not target specific)
  • Support for multiple entry points (not target specific)
  • Extra code generation in the mips backend for CheriOS's extra entry points
  • A second captable for TLS

LLD changes:

  • Support for the second captable
  • CheriOS specific captable layout stuff

clang/lib/Basic/Targets/Mips.h Outdated Show resolved Hide resolved
lld/ELF/Arch/Cheri.cpp Outdated Show resolved Hide resolved
@jrtc27
Copy link
Member

jrtc27 commented May 29, 2020

Not doing a full review, but you have 3 files that have been made executable, and you have a lot of non-conforming formatting. Please go through the patch yourself and review these kinds of things (clang-format is your friend for the latter).

lld/ELF/Arch/Cheri.h Outdated Show resolved Hide resolved
clang/lib/CodeGen/CGDecl.cpp Outdated Show resolved Hide resolved
clang/lib/CodeGen/CGDecl.cpp Outdated Show resolved Hide resolved
@LawrenceEsswood LawrenceEsswood force-pushed the temporal_merge branch 2 times, most recently from fc7e35b to 669f902 Compare October 6, 2021 15:50
@LawrenceEsswood
Copy link
Author

I have rebased / gone over the commits with clang-format.

clang/lib/CodeGen/CGDecl.cpp Outdated Show resolved Hide resolved
clang/lib/Sema/SemaDeclAttr.cpp Outdated Show resolved Hide resolved
@@ -4767,6 +4767,12 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
if (AllocaInst *NewAI = rewritePartition(AI, AS, P)) {
Changed = true;
if (NewAI != &AI) {

MDNode *Meta = AI.getMetadata("temporal");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that other passes also drop metadata. I guess if it's only needed for allocas the risk is slightly reduced.

llvm/lib/Transforms/TemporalStacks/TemporalStackPass.cpp Outdated Show resolved Hide resolved
@@ -11,6 +11,30 @@
#include "llvm/Support/CommandLine.h"

using namespace llvm;
using namespace escape;

static cl::opt<analysis_type> TemporalType(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to pass this as a global metadata node in the generated IR? If it's not present the pass isn't run (i.e. the default) and the when compiling for CheriOS clang adds the right metadata.

@@ -51,6 +51,12 @@ CheriCapabilityTableABI MCTargetOptions::cheriCapabilityTableABI() {
return CapTableABI;
}

static cl::opt<bool> IsCheriOSABI("is-cherios",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should be part of the triple (riscv64-unknown-cherios) rather than a hidden -mllvm flag. It adds a bit more work since you need to copy-paste the useful bits of FreeBSD.cpp but is much cleaner than reusing the FreeBSD driver code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this depends on if I ever want CheriOS to compose with FreeBSD in some way. i.e. run the CheriOS style calling convention on FreeBSD.

@@ -301,6 +301,7 @@ bool MipsSubtarget::isABI_O32() const { return getABI().IsO32(); }
bool MipsSubtarget::isABI_CheriPureCap() const {
return getABI().IsCheriPureCap();
}
bool MipsSubtarget::isABI_CheriOS() const { return getABI().IsCheriOS(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TM.getTargetTriple().getOS() == llvm::Triple::CheriOS

llvm/lib/Target/Mips/MipsRegisterInfo.cpp Outdated Show resolved Hide resolved
unsigned MipsABIInfo::GetReturnAddress() const {
return IsCheriPureCap() ?
Mips::C17 :
(ArePtrs64bit() ? Mips::RA_64 : Mips::RA);
}

unsigned MipsABIInfo::GetFunctionAddress() const { return Mips::C12; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could change those to return MCRegister now.

llvm/lib/Target/Mips/MipsISelLowering.cpp Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants