-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ir: Add support for aggregate instructions.
Updates #15.
- Loading branch information
Showing
8 changed files
with
406 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// === [ Aggregate instructions ] ============================================== | ||
// | ||
// References: | ||
// http://llvm.org/docs/LangRef.html#aggregate-operations | ||
|
||
package ast | ||
|
||
// --- [ extractvalue ] ------------------------------------------------------ | ||
|
||
// InstExtractValue represents an extract value instruction. | ||
// | ||
// References: | ||
// http://llvm.org/docs/LangRef.html#extractvalue-instruction | ||
type InstExtractValue struct { | ||
// Name of the local variable associated with the instruction. | ||
Name string | ||
// Aggregate value. | ||
X Value | ||
// Indices. | ||
Indices []int64 | ||
} | ||
|
||
// GetName returns the name of the value. | ||
func (inst *InstExtractValue) GetName() string { | ||
return inst.Name | ||
} | ||
|
||
// SetName sets the name of the value. | ||
func (inst *InstExtractValue) SetName(name string) { | ||
inst.Name = name | ||
} | ||
|
||
// isValue ensures that only values can be assigned to the ast.Value interface. | ||
func (*InstExtractValue) isValue() {} | ||
|
||
// isInst ensures that only instructions can be assigned to the ast.Instruction | ||
// interface. | ||
func (*InstExtractValue) isInst() {} | ||
|
||
// --- [ insertvalue ] ------------------------------------------------------- | ||
|
||
// InstInsertValue represents an insert value instruction. | ||
// | ||
// References: | ||
// http://llvm.org/docs/LangRef.html#insertvalue-instruction | ||
type InstInsertValue struct { | ||
// Name of the local variable associated with the instruction. | ||
Name string | ||
// Aggregate value. | ||
X Value | ||
// Element to insert. | ||
Elem Value | ||
// Indices. | ||
Indices []int64 | ||
} | ||
|
||
// GetName returns the name of the value. | ||
func (inst *InstInsertValue) GetName() string { | ||
return inst.Name | ||
} | ||
|
||
// SetName sets the name of the value. | ||
func (inst *InstInsertValue) SetName(name string) { | ||
inst.Name = name | ||
} | ||
|
||
// isValue ensures that only values can be assigned to the ast.Value interface. | ||
func (*InstInsertValue) isValue() {} | ||
|
||
// isInst ensures that only instructions can be assigned to the ast.Instruction | ||
// interface. | ||
func (*InstInsertValue) isInst() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.