Updated test for constant generation
This commit is contained in:
parent
9ffed9bd94
commit
86ad94f17d
|
@ -29,7 +29,7 @@ func (this *generator) generateConstantDeclaration (
|
|||
// have a Multivalue method of types and disallow referencing of
|
||||
// non-multivalue constants.
|
||||
|
||||
irGlobal := this.module.NewGlobal(constantName, irType)
|
||||
irGlobal := this.module.NewGlobal(key.LinkName(), irType)
|
||||
irGlobal.Constant = true
|
||||
|
||||
if ty.Unit() == this.tree.Unit() {
|
||||
|
|
|
@ -5,9 +5,13 @@ import "testing"
|
|||
func TestConstantValueSpecified (test *testing.T) {
|
||||
testString (test,
|
||||
`%"0zNZN147MN2wzMAQ6NS2dQ==::E" = type i64
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.one = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 1
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.three = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 3
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.two = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 2
|
||||
define void @"0zNZN147MN2wzMAQ6NS2dQ==::[f]"() {
|
||||
0:
|
||||
%1 = call i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(i64 2)
|
||||
%1 = load %"0zNZN147MN2wzMAQ6NS2dQ==::E", %"0zNZN147MN2wzMAQ6NS2dQ==::E" @"0zNZN147MN2wzMAQ6NS2dQ==::E.two"
|
||||
%2 = call i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(%"0zNZN147MN2wzMAQ6NS2dQ==::E" %1)
|
||||
ret void
|
||||
}
|
||||
define i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(%"0zNZN147MN2wzMAQ6NS2dQ==::E" %e) {
|
||||
|
@ -50,9 +54,13 @@ E: Int
|
|||
func TestConstantValueUnspecified (test *testing.T) {
|
||||
testString (test,
|
||||
`%"0zNZN147MN2wzMAQ6NS2dQ==::E" = type i64
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.one = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 0
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.three = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 2
|
||||
0zNZN147MN2wzMAQ6NS2dQ==::E.two = constant %"0zNZN147MN2wzMAQ6NS2dQ==::E" i64 1
|
||||
define void @"0zNZN147MN2wzMAQ6NS2dQ==::[f]"() {
|
||||
0:
|
||||
%1 = call i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(i64 1)
|
||||
%1 = load %"0zNZN147MN2wzMAQ6NS2dQ==::E", %"0zNZN147MN2wzMAQ6NS2dQ==::E" @"0zNZN147MN2wzMAQ6NS2dQ==::E.two"
|
||||
%2 = call i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(%"0zNZN147MN2wzMAQ6NS2dQ==::E" %1)
|
||||
ret void
|
||||
}
|
||||
define i64 @"0zNZN147MN2wzMAQ6NS2dQ==::[plus4]"(%"0zNZN147MN2wzMAQ6NS2dQ==::E" %e) {
|
||||
|
|
Loading…
Reference in New Issue