TYnptr in LLVM?

Jacob Carlborg doob at me.com
Tue Jul 17 17:34:46 UTC 2018


On 2018-07-16 20:37, kinke wrote:

> Assuming you only need an opaque pointer to that symbol (and you don't 
> mix LDC/clang bitcode, e.g., via LTO), any type should do (see clang's 
> opaque `%struct._objc_cache` - I think you create an opaque type as IR 
> struct without elements via `llvm::StructType::create(gIR->context(), 
> "name")`).
> 
> Otherwise, you'll have to define these types like clang does (using 
> another `StructType::create()` overload, one taking the array of element 
> types). LDC's `getVoidPtrType()` helpers returns the common `i8*` IR 
> type, `llvm::IntegerType::get(gIR->context(), 32)` returns `i32` etc.

Thanks. Ideally it should be full compatible with Clang so I'll go with 
trying to define the structs exactly as Clang outputs them.

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list