diff options
Diffstat (limited to 'bindings/go/llvm/target.go')
-rw-r--r-- | bindings/go/llvm/target.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/bindings/go/llvm/target.go b/bindings/go/llvm/target.go index 6b1895b9ac609..268cc0eb1979c 100644 --- a/bindings/go/llvm/target.go +++ b/bindings/go/llvm/target.go @@ -121,13 +121,6 @@ func NewTargetData(rep string) (td TargetData) { return } -// Adds target data information to a pass manager. This does not take ownership -// of the target data. -// See the method llvm::PassManagerBase::add. -func (pm PassManager) Add(td TargetData) { - C.LLVMAddTargetData(td.C, pm.C) -} - // Converts target data to a target layout string. The string must be disposed // with LLVMDisposeMessage. // See the constructor llvm::TargetData::TargetData. @@ -261,17 +254,19 @@ func (t Target) CreateTargetMachine(Triple string, CPU string, Features string, return } +// CreateTargetData returns a new TargetData describing the TargetMachine's +// data layout. The returned TargetData is owned by the caller, who is +// responsible for disposing of it by calling the TargetData.Dispose method. +func (tm TargetMachine) CreateTargetData() TargetData { + return TargetData{C.LLVMCreateTargetDataLayout(tm.C)} +} + // Triple returns the triple describing the machine (arch-vendor-os). func (tm TargetMachine) Triple() string { cstr := C.LLVMGetTargetMachineTriple(tm.C) return C.GoString(cstr) } -// TargetData returns the TargetData for the machine. -func (tm TargetMachine) TargetData() TargetData { - return TargetData{C.LLVMGetTargetMachineData(tm.C)} -} - func (tm TargetMachine) EmitToMemoryBuffer(m Module, ft CodeGenFileType) (MemoryBuffer, error) { var errstr *C.char var mb MemoryBuffer |