Page MenuHomePhabricator

jberdine (Josh Berdine)
User

Projects

User does not belong to any projects.

User Details

User Since
Sep 17 2018, 3:19 PM (47 w, 6 d)

Recent Activity

Apr 24 2019

jberdine added a comment to D60473: [LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions.

Thanks!

Apr 24 2019, 6:31 AM · Restricted Project
jberdine added a comment to D60473: [LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions.

@whitequark at least while D52239 and D60902 are up in the air, could I ask you to commit this fix for the existing functions?

Apr 24 2019, 6:20 AM · Restricted Project

Apr 23 2019

jberdine added a comment to D60902: [OCaml] Add OCaml APIs to access DebugInfo.

To test this I have an OCaml client (a slightly modified version of https://github.com/facebook/infer/blob/master/sledge/src/llair/frontend.ml) that reads and prints the debug info using the functions in llvm_debuginfo.mli for all of the .bc and .ll files under the test directory, as well as a number of larger internal compilation units.

Apr 23 2019, 2:07 PM · Restricted Project

Apr 19 2019

jberdine added a comment to D60902: [OCaml] Add OCaml APIs to access DebugInfo.

This is an alternative to D52239 which adds OCaml wrappers of the C API that are as thin as I see how to make them. I added a new sublibrary since the exposed functions come from DebugInfo.h instead of Core.h, and that seemed to be the pattern for the other sublibraries. Does this seem like the right approach?

Apr 19 2019, 8:10 AM · Restricted Project
jberdine created D60902: [OCaml] Add OCaml APIs to access DebugInfo.
Apr 19 2019, 8:07 AM · Restricted Project

Apr 17 2019

jberdine added a comment to D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions.

Thanks! Note that I don't have write access, so could I ask you to commit this?

Apr 17 2019, 6:13 AM · Restricted Project

Apr 16 2019

jberdine added a comment to D60489: [LLVM-C] Add DIFile Field Accesssors.

No, looks good, thanks!

Apr 16 2019, 3:09 PM · Restricted Project
jberdine abandoned D60795: [LLVM-C] Add LLVMDISubprogramGetLine accessor.

Included in D60725

Apr 16 2019, 2:45 PM · Restricted Project
jberdine added a comment to D60795: [LLVM-C] Add LLVMDISubprogramGetLine accessor.

Sounds good.

Apr 16 2019, 2:25 PM · Restricted Project
jberdine added a comment to D60473: [LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions.

AFAIU D60484 is about the accessors for the current debug location used by builders, while this diff's functions are about reading the debug info from existing IR values.

Apr 16 2019, 2:05 PM · Restricted Project
jberdine added a comment to D60795: [LLVM-C] Add LLVMDISubprogramGetLine accessor.

Thanks! Note that I don't have write access, so could I ask you to commit this?

Apr 16 2019, 1:56 PM · Restricted Project
jberdine added inline comments to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.
Apr 16 2019, 1:56 PM · Restricted Project
jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

I've updated this to implement the accessors using the new DI APIs instead of the old wrapped value ones, using the functions added in D60725 and D60795.

Apr 16 2019, 1:42 PM · Restricted Project
jberdine updated the diff for D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

update to use new DI APIs

Apr 16 2019, 1:35 PM · Restricted Project
jberdine accepted D60489: [LLVM-C] Add DIFile Field Accesssors.

Modulo the names seemingly left over from copy-paste, this looks good to me and is working in my tests.

Apr 16 2019, 1:35 PM · Restricted Project
jberdine accepted D60725: [LLVM-C] Add Accessors For Global Variable Metadata Properties.

Thanks! These are working for me, though I needed to expose one more function, see D60795 (and feel free to incorporate it into this one).

Apr 16 2019, 1:35 PM · Restricted Project
jberdine created D60795: [LLVM-C] Add LLVMDISubprogramGetLine accessor.
Apr 16 2019, 1:35 PM · Restricted Project

Apr 15 2019

jberdine added a comment to D60680: [OCaml] Update api to account for FNeg and CallBr instructions.

Thanks! Could I bother you to commit this?

Apr 15 2019, 2:16 PM · Restricted Project
jberdine added a comment to D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions.

I see what you mean about the redundancy between the LowerAtomic and AtomicExpand passes.

Apr 15 2019, 4:36 AM · Restricted Project
jberdine updated the diff for D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions.

add tests

Apr 15 2019, 4:32 AM · Restricted Project
jberdine added a comment to D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions.

My understanding (which shouldn't be taken to imply much) is that lib/Transforms/Scalar/LowerAtomic.cpp is for contexts where atomic semantics is known to be unnecessary due to e.g. executing only in a sequential context.

Apr 15 2019, 3:25 AM · Restricted Project
jberdine created D60680: [OCaml] Update api to account for FNeg and CallBr instructions.
Apr 15 2019, 3:06 AM · Restricted Project
jberdine added a reviewer for D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions: arsenm.
Apr 15 2019, 3:06 AM · Restricted Project
jberdine created D60679: [LowerAtomic] Lower fadd and fsub atomicrmw instructions.
Apr 15 2019, 3:03 AM · Restricted Project

Apr 14 2019

jberdine added a comment to D60489: [LLVM-C] Add DIFile Field Accesssors.

@CodaFi thanks! For Instructions, I have modified my client to use these functions and tested. For reference, the callers look like:

CAMLprim value llvm_instr_get_debug_loc_filename(LLVMValueRef Instr) {
  CAMLparam0();
  CAMLlocal2(Option, String);
  LLVMMetadataRef Loc = LLVMInstructionGetDebugLoc(Instr);
  if (!Loc) CAMLreturn(Val_int(0));
  LLVMMetadataRef Scope = LLVMDILocationGetScope(Loc);
  if (!Scope) CAMLreturn(Val_int(0));
  LLVMMetadataRef File = LLVMDIScopeGetFile(Scope);
  if (!File) CAMLreturn(Val_int(0));
  unsigned Length;
  const char *Chars;
  if ((Chars = LLVMDIFileGetFilename(File, &Length))) {
    String = caml_alloc_string(Length);
    memcpy(String_val(String), Chars, Length);
    Option = caml_alloc_small(1, 0);
    Store_field(Option, 0, String);
    CAMLreturn(Option);
  }
  CAMLreturn(Val_int(0));
}

So for instructions, it seems to work well to use LLVMInstructionGetDebugLoc and then LLVMDILocationGetLine, LLVMDILocationGetColumn, LLVMDILocationGetScope and this diff's functions.

Apr 14 2019, 2:00 PM · Restricted Project

Apr 9 2019

jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

I agree, parallel APIs are a no-go. I'll rework shortly.

Apr 9 2019, 3:26 PM · Restricted Project
jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

I have investigated trying to use LLVMGetMetadata instead of adding LLVMGetDebugLoc* functions, which is my understanding of @CodaFi's question. To summarize my (perhaps incorrect) understanding, on the one hand LLVMGetMetadata calls Instruction::getMetadata which returns Instruction::DbgLoc, a DILocation, cast to MDNode. On the other hand, LLVMGetDebugLocLine calls Instruction::getDebugLoc, a DILocation, and calls DILocation::getLine, which returns DILocation::SubclassData32. It does not seem possible to access that field using the MDNode api. To access such fields would seem to require exposing the class hierarchy below MDNode in LLVM-C. Does that align with your understanding?

Apr 9 2019, 10:47 AM · Restricted Project
jberdine updated the diff for D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

rebase

Apr 9 2019, 10:41 AM · Restricted Project
jberdine created D60473: [LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions.
Apr 9 2019, 10:38 AM · Restricted Project

Nov 13 2018

jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

@CodaFi, sorry for the delayed reply, I've been busy with other things.

Nov 13 2018, 2:09 PM · Restricted Project

Oct 30 2018

jberdine added a comment to D53841: [OCaml] Fix incorrect use of CAMLlocal in nested blocks.

@whitequark, could I bother you to commit this for me?

Oct 30 2018, 2:01 PM
jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

@whitequark, could I bother you to commit this for me?

Oct 30 2018, 2:01 PM · Restricted Project

Oct 29 2018

jberdine added inline comments to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.
Oct 29 2018, 3:34 PM · Restricted Project
jberdine updated the diff for D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

fix CAMLlocal

Oct 29 2018, 3:32 PM · Restricted Project
jberdine created D53841: [OCaml] Fix incorrect use of CAMLlocal in nested blocks.
Oct 29 2018, 3:32 PM
jberdine added inline comments to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.
Oct 29 2018, 3:18 PM · Restricted Project

Oct 15 2018

jberdine added a comment to D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

@whitequark, does this one look mostly straightforward now that the C API is settled?

Oct 15 2018, 3:55 AM · Restricted Project

Oct 10 2018

jberdine updated the diff for D52210: [LLVM-C] Add C APIs to access DebugLoc info.

rebase and squash

Oct 10 2018, 2:47 PM
jberdine updated the diff for D52239: [OCaml] Add OCaml APIs to access DebugLoc info.

update re string option

Oct 10 2018, 1:51 PM · Restricted Project
jberdine added a comment to D52210: [LLVM-C] Add C APIs to access DebugLoc info.

Thanks for your help and patience! This has certainly improved a lot from the first version I submitted.

Oct 10 2018, 1:13 PM

Oct 9 2018

jberdine updated the diff for D52210: [LLVM-C] Add C APIs to access DebugLoc info.

early return instead of assert, unsigned instead of int

Oct 9 2018, 5:37 PM

Oct 8 2018

jberdine abandoned D52213: [OCaml] Add OCaml API for __cxa_demangle.
Oct 8 2018, 3:53 PM
jberdine added inline comments to D52210: [LLVM-C] Add C APIs to access DebugLoc info.
Oct 8 2018, 3:48 PM
jberdine updated the diff for D52210: [LLVM-C] Add C APIs to access DebugLoc info.

Rely on default initialization of StringRef, and use conditional assignment instead of early return.

Oct 8 2018, 3:48 PM

Sep 24 2018

jberdine added inline comments to D52210: [LLVM-C] Add C APIs to access DebugLoc info.
Sep 24 2018, 5:56 PM
jberdine updated the diff for D52210: [LLVM-C] Add C APIs to access DebugLoc info.

Suggested changes to LLVMGetDebugLocDirectory and LLVMGetDebugLocColumn, will update LLVMGetDebugLocFilename and LLVMGetDebugLocLine when LLVMGetDebugLocDirectory settles

Sep 24 2018, 5:44 PM

Sep 19 2018

jberdine added a comment to D52213: [OCaml] Add OCaml API for __cxa_demangle.

Thanks for the suggestion @erik.pilkington. I assume you mean to call the itaniumDemangle function declared in include/llvm/Demangle/Demanagle.h. Since that is in the llvm namespace, it would need a shim extern C function in C++ to call from the OCaml bindings. It's not clear to me that such a function would be welcome in e.g. lib/IR/Core.cpp. There could be other options I'm overlooking. My brief experiments adding some C++ code under bindings/ocaml all failed to compile, but maybe there is some build system magic that would make that work. But since it is possible for clients of the OCaml API to call __cxa_demangle without exposing it here, maybe @whitequark is right that it doesn't fit.

Sep 19 2018, 2:02 PM

Sep 18 2018

jberdine added a parent revision for D52239: [OCaml] Add OCaml APIs to access DebugLoc info: D52210: [LLVM-C] Add C APIs to access DebugLoc info.
Sep 18 2018, 9:25 AM · Restricted Project
jberdine added a child revision for D52210: [LLVM-C] Add C APIs to access DebugLoc info: D52239: [OCaml] Add OCaml APIs to access DebugLoc info.
Sep 18 2018, 9:25 AM
jberdine added a comment to D52210: [LLVM-C] Add C APIs to access DebugLoc info.

I don't know if this is the idiomatic way to do dynamic dispatch in C, feedback very welcome.

Sep 18 2018, 9:24 AM
jberdine created D52239: [OCaml] Add OCaml APIs to access DebugLoc info.
Sep 18 2018, 9:23 AM · Restricted Project
jberdine updated the diff for D52210: [LLVM-C] Add C APIs to access DebugLoc info.

split LLVM-C from OCaml changes

Sep 18 2018, 9:23 AM
jberdine updated the diff for D52212: [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs.

rename

Sep 18 2018, 6:17 AM
jberdine added inline comments to D52211: [LLVM-C][OCaml] Add LowerAtomic pass to C and OCaml APIs.
Sep 18 2018, 4:43 AM
jberdine updated the diff for D52211: [LLVM-C][OCaml] Add LowerAtomic pass to C and OCaml APIs.

reorder

Sep 18 2018, 4:42 AM
jberdine added inline comments to D52207: [OCaml] Add OCaml API for LLVMGetIndices.
Sep 18 2018, 4:42 AM
jberdine updated the diff for D52207: [OCaml] Add OCaml API for LLVMGetIndices.

fix doc, rename Val_indices

Sep 18 2018, 4:42 AM
jberdine added inline comments to D52212: [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs.
Sep 18 2018, 4:37 AM
jberdine abandoned D52208: [OCaml] Add OCaml APIs for LLVMGetModuleDataLayout and LLVMABISizeOfType.

Thanks, don't know why I overlooked that.

Sep 18 2018, 4:25 AM

Sep 17 2018

jberdine updated the diff for D52205: [OCaml] Add OCaml API for LLVMIsCleanup.

suggested changes

Sep 17 2018, 6:40 PM
jberdine created D52215: [NFC][OCaml] Fix copy paste error in file header.
Sep 17 2018, 6:26 PM
jberdine created D52214: [NFC][OCaml] Fix implicit declaration compilation warnings.
Sep 17 2018, 6:26 PM
jberdine created D52213: [OCaml] Add OCaml API for __cxa_demangle.
Sep 17 2018, 6:26 PM
jberdine created D52211: [LLVM-C][OCaml] Add LowerAtomic pass to C and OCaml APIs.
Sep 17 2018, 6:26 PM
jberdine created D52212: [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs.
Sep 17 2018, 6:26 PM
jberdine created D52209: [LLVM-C][OCaml] Add C and OCaml APIs for llvm::StructType::isLiteral.
Sep 17 2018, 6:26 PM
jberdine created D52210: [LLVM-C] Add C APIs to access DebugLoc info.
Sep 17 2018, 6:26 PM
jberdine created D52208: [OCaml] Add OCaml APIs for LLVMGetModuleDataLayout and LLVMABISizeOfType.
Sep 17 2018, 6:25 PM
jberdine created D52207: [OCaml] Add OCaml API for LLVMGetIndices.
Sep 17 2018, 6:25 PM
jberdine created D52206: [LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices.
Sep 17 2018, 6:25 PM
jberdine created D52205: [OCaml] Add OCaml API for LLVMIsCleanup.
Sep 17 2018, 6:23 PM
jberdine created D52204: [OCaml] Add OCaml APIs for Invoke arguments and destinations.
Sep 17 2018, 6:22 PM
jberdine added a comment to D52196: [OCaml] Add missing instruction opcodes to OCaml API.

Thanks! Could I ask you to commit this as I don't have commit access?

Sep 17 2018, 4:44 PM
jberdine created D52198: [OCaml] Add GlobalIFunc value kind to OCaml API.
Sep 17 2018, 4:31 PM
jberdine created D52197: [OCaml] Add Token type to kind enum in OCaml API.
Sep 17 2018, 4:31 PM
jberdine created D52196: [OCaml] Add missing instruction opcodes to OCaml API.
Sep 17 2018, 3:53 PM